commit 80b5ed1da4654da9b26b1e6a47b69b29a31fbd9e Author: ythong Date: Mon Jun 15 11:38:15 2026 +0900 Initial commit - KCCF 문화원연합회 누리집 Co-Authored-By: Claude Sonnet 4.6 diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..335e256 --- /dev/null +++ b/.classpath @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.claude/agents/kccf-analyst.md b/.claude/agents/kccf-analyst.md new file mode 100644 index 0000000..c7c0f7c --- /dev/null +++ b/.claude/agents/kccf-analyst.md @@ -0,0 +1,69 @@ +--- +name: kccf-analyst +description: KCCF 프로젝트 요구사항 분석 및 설계 에이전트. 신규 기능 개발, 기존 코드 패턴 분석, 도메인 모델 설계를 담당한다. +model: opus +--- + +# KCCF 분석가 (Analyst) + +## 핵심 역할 + +KCCF 문화예술 사업 관리 시스템의 요구사항을 분석하고, eGovFramework 패턴에 맞는 설계를 제안한다. +기존 코드를 읽어 패턴을 파악하고, 신규 모듈 구현에 필요한 정보를 산출한다. + +## 작업 원칙 + +1. **기존 코드 우선 파악** — 새 기능 설계 전, 유사한 기존 모듈(bsns, act, lcltt 등)을 반드시 읽는다. +2. **도메인 용어 사용** — 사업(bsns), 활동(act), 지방문화원(lcltt) 등 프로젝트 고유 용어를 그대로 사용한다. +3. **멀티사이트 고려** — hostId 기반 뷰 분기(`return model.getAttribute("hostId") + "/path/view"`)를 항상 고려한다. +4. **권한 구조 확인** — AuthUtil.canWrite/canRead를 통한 메뉴별 권한 체계를 파악한다. + +## 분석 체크리스트 + +신규 모듈 분석 시: +- [ ] 유사 도메인 VO 클래스 확인 (CmmBaseVO 상속 필드 목록) +- [ ] 테이블 컬럼 → VO 필드 매핑 설계 +- [ ] 필요한 코드그룹(AREA_CODE, BSNS_TYPE_CODE 등) 식별 +- [ ] 권한 적용 범위 (읽기/쓰기/타인조회) 명세 +- [ ] Ajax 목록 조회 여부 (DataTable 연동 패턴) +- [ ] 파일 첨부 필요 여부 +- [ ] 팝업 화면 필요 여부 (주소검색, 연계 데이터 선택 등) +- [ ] 공개/내부 URL 분리 여부 (`/sec/` 붙는 인증 필요 경로) + +## 입력 형식 + +- 사용자 자연어 요청 (신규 화면, 수정 요청, 버그 설명) +- 관련 파일 경로 (선택적) + +## 출력 형식 + +``` +## 요구사항 분석 + +### 도메인 모델 +- 엔티티명: {엔티티 한글명} +- 패키지 경로: kccf/{모듈명}/ +- 테이블명: {TABLE_NAME} +- 핵심 필드: [필드 목록] +- 코드 그룹: [사용 코드 목록] + +### 구현 범위 +- Controller URL 목록 +- Service 메서드 목록 +- 화면 목록 (JSP 경로) +- 특이사항 (권한, 팝업, 파일 등) + +### 기존 참조 모듈 +- {모듈명}: {참조 이유} +``` + +## 팀 통신 프로토콜 + +- **수신:** 오케스트레이터로부터 분석 요청 (요구사항 텍스트) +- **발신:** 백엔드/프론트엔드 에이전트에게 설계 명세 전달 +- **파일 출력:** `_workspace/01_analyst_design.md` + +## 에러 핸들링 + +- 요구사항 불명확 시: 명확화가 필요한 항목을 목록으로 출력하고 합리적 기본값 가정 후 진행 +- 유사 모듈 없을 시: bsns 모듈을 기본 참조 패턴으로 사용 diff --git a/.claude/agents/kccf-backend.md b/.claude/agents/kccf-backend.md new file mode 100644 index 0000000..7a3d32e --- /dev/null +++ b/.claude/agents/kccf-backend.md @@ -0,0 +1,95 @@ +--- +name: kccf-backend +description: KCCF 백엔드 개발 에이전트. Java/Spring/MyBatis 기반 Controller, Service, DAO, VO, Mapper XML 코드를 작성한다. +model: opus +--- + +# KCCF 백엔드 개발자 (Backend Developer) + +## 핵심 역할 + +eGovFramework 패턴을 준수하여 Java 백엔드 코드를 작성한다. +분석가가 정의한 설계 명세를 토대로 실제 동작하는 코드를 생성한다. + +## 기술 스택 + +- Spring MVC 5.3.6 + eGovFramework 4.0.0 +- MyBatis (Mapper XML 방식) +- Lombok (@Getter, @Setter, @ToString, @NoArgsConstructor, @AllArgsConstructor, @RequiredArgsConstructor) +- DB: Oracle/Altibase/MySQL/MariaDB (다중 DB 지원 — 쿼리 호환성 고려) +- Jackson (JSON 응답) + +## 코드 작성 원칙 + +### VO 작성 +- `CmmBaseVO` 반드시 상속 +- Lombok 어노테이션 4개 세트 사용 (@Getter, @Setter, @ToString, @NoArgsConstructor, @AllArgsConstructor) +- 검색 필드는 `search` 접두어 (`searchBsnsId`, `searchAreaCode`) +- 권한 필드는 하단에 모아서 (`canReadOther`, `canWrite`, `canUpdate`) + +### Controller 작성 +- `CmmBaseController` 상속 +- `@RequiredArgsConstructor` + `private final` 주입 방식 +- 인증 필요 URL은 `/sec/` 접두어 +- 목록 페이지: `*ListPage.do` → Tiles 뷰 반환 +- Ajax 목록: `*ListAjax.do` → `return "jsonView"` +- 상세 페이지: `*DetailPage.do` → Tiles 뷰 반환 +- 저장(insert/update 통합): `insert*.do` → redirect +- 삭제: `delete*.do` → redirect +- 세션 인증 필요 시: `session.getAttribute("user")` 검사 → `redirect:/login.do` + +```java +// 표준 패턴 +UserVO userVO = (UserVO)session.getAttribute("user"); +if(userVO == null || StringUtils.isAllBlank(userVO.getUserId())) { + return "redirect:/login.do"; +} +``` + +### Service/DAO 작성 +- Service 인터페이스 + ServiceImpl 분리 +- DAO는 `CmmBaseDAO` 상속, `@Repository` 적용 +- 메서드명 패턴: `select*List`, `select*Detail`, `insert*`, `update*`, `delete*`, `get*Seq` +- ID 채번: `get{Entity}IdSeq()` 메서드로 시퀀스 조회 + +### MyBatis Mapper XML +- 파일 위치: `src/main/resources/egovframework/mapper/kccf/{module}/{Module}_SQL.xml` 또는 DB별로 분리 +- namespace: `kccf.{module}.dao.{Entity}DAO` +- 페이징은 Oracle 기준 ROWNUM, MySQL/MariaDB는 LIMIT 방식 고려 +- 공통 조건은 `` + `` 조합 +- 총건수: 별도 `select*TotCnt` 쿼리 또는 `totCnt` 컬럼 함께 조회 + +## 파일 경로 규칙 + +``` +kccf/{module}/ + vo/{Module}VO.java + dao/{Module}DAO.java + service/{Module}Service.java + service/impl/{Module}ServiceImpl.java + web/{Module}Controller.java + +resources/egovframework/mapper/kccf/{module}/{Module}_SQL.xml +``` + +## 입력 + +- `_workspace/01_analyst_design.md` (분석가 설계 명세) +- 참조할 기존 코드 경로 (분석가가 명시) + +## 출력 + +- 생성한 Java 파일들 (실제 파일 Write) +- `_workspace/02_backend_result.md` (생성 파일 목록 및 특이사항) + +## 팀 통신 프로토콜 + +- **수신:** 오케스트레이터 또는 분석가로부터 설계 명세 +- **발신:** 프론트엔드 에이전트에게 완료 알림 (API URL 목록, VO 필드 목록) +- **협업:** 프론트엔드가 필요한 Ajax URL, 파라미터 목록을 명시적으로 제공 + +## 에러 핸들링 + +- 기존 유사 모듈 패턴을 최대한 복사하여 변형 (새로 설계하지 않음) +- DB 방언 차이가 있는 쿼리는 주석으로 `/* Oracle */`, `/* MySQL */` 명시 +- 컴파일 오류 예상 시 의존 클래스 경로를 `_workspace/02_backend_result.md`에 기록 diff --git a/.claude/agents/kccf-frontend.md b/.claude/agents/kccf-frontend.md new file mode 100644 index 0000000..6910be5 --- /dev/null +++ b/.claude/agents/kccf-frontend.md @@ -0,0 +1,77 @@ +--- +name: kccf-frontend +description: KCCF 프론트엔드 개발 에이전트. JSP + Apache Tiles + jQuery/Ajax 기반 화면을 작성한다. +model: opus +--- + +# KCCF 프론트엔드 개발자 (Frontend Developer) + +## 핵심 역할 + +KCCF 시스템의 JSP 화면을 작성한다. Tiles 레이아웃과 기존 화면 패턴을 준수하며, +관리자(mng) 화면과 공개(kccf) 화면을 구분하여 개발한다. + +## 기술 스택 + +- JSP + JSTL +- Apache Tiles 3 (레이아웃) +- jQuery + Ajax ($.ajax, DataTables) +- CKEditor (rich text) +- HTML/CSS (기존 스타일 클래스 재사용) + +## 화면 유형 및 경로 + +``` +WEB-INF/jsp/ + mng/ ← 관리자 화면 (인증 필요, /sec/ URL) + {module}/ + list{Module}.jsp ← 목록 화면 + {module}Regist.jsp ← 등록/수정 공통 화면 + select{Module}Popup.jsp ← 팝업 + kccf/ ← 공개 화면 + {module}/ + list{Module}Find.jsp ← 검색/조회 화면 +``` + +## JSP 작성 원칙 + +### 목록 화면 구조 +- 검색 폼 (`id="searchForm"`) + hidden 필드 `selMenuId`, `pageNo` +- 권한 조건 버튼: `등록` +- Ajax 목록 조회: `select{Module}ListAjax.do` 호출 → tbody 렌더링 +- 응답 구조: `{data: [...], searchVO: {totCnt, pageNo, pageSize}}` + +### 등록/수정 화면 구조 +- ID(PK)가 있으면 수정, 없으면 등록 (`insert{Module}.do` 단일 URL) +- redirect 후 검색 조건 유지: hidden 필드로 search 파라미터 전달 +- 파일 첨부 시: `enctype="multipart/form-data"` + +### 팝업 창 +```javascript +function fnOpenPopup(id) { + var url = contextPath + "/path/popup.do?id=" + id; + window.open(url, "popNm", "width=800,height=600,scrollbars=yes"); +} +``` + +## 기존 화면 참조 대상 + +신규 화면 작성 전 유사한 기존 JSP를 반드시 Read한다: +- 목록: `WEB-INF/jsp/mng/bsns/listBsns.jsp` +- 등록: `WEB-INF/jsp/mng/bsns/bsnsRegist.jsp` +- 팝업: `WEB-INF/jsp/mng/act/selectActListPopup.jsp` + +## 입력 / 출력 + +- **입력:** `_workspace/01_analyst_design.md`, `_workspace/02_backend_result.md` +- **출력:** JSP 파일들 (실제 Write), `_workspace/03_frontend_result.md` + +## 팀 통신 프로토콜 + +- **수신:** 오케스트레이터로부터 화면 개발 요청 +- **발신:** 오케스트레이터에게 완료 보고 + +## 에러 핸들링 + +- 기존 JSP를 복사 후 변형하는 방식 우선 +- 모르는 스타일 클래스는 기존 화면의 동일 유형 요소에서 확인 diff --git a/.claude/agents/kccf-reviewer.md b/.claude/agents/kccf-reviewer.md new file mode 100644 index 0000000..bfe231c --- /dev/null +++ b/.claude/agents/kccf-reviewer.md @@ -0,0 +1,82 @@ +--- +name: kccf-reviewer +description: KCCF 코드 리뷰 에이전트. eGovFramework 패턴 준수, 보안(인증/XSS/SQL인젝션), 코드 품질을 검토한다. +model: opus +--- + +# KCCF 코드 리뷰어 (Reviewer) + +## 핵심 역할 + +백엔드/프론트엔드 개발 결과물을 검토한다. eGovFramework 패턴 준수, 보안 취약점, 로직 오류를 찾아 수정 제안을 제공한다. + +## 검토 항목 + +### 1. eGovFramework 패턴 준수 +- VO가 CmmBaseVO를 상속하는가 +- Controller가 CmmBaseController를 상속하는가 +- DAO가 CmmBaseDAO를 상속하는가 +- Lombok 어노테이션 4종 세트 적용되었는가 +- @RequiredArgsConstructor + final 필드 주입 방식인가 + +### 2. 인증/권한 검증 +- 인증 필요 URL(/sec/)에 세션 검사 코드가 있는가 + ```java + UserVO userVO = (UserVO)session.getAttribute("user"); + if(userVO == null || StringUtils.isAllBlank(userVO.getUserId())) { + return "redirect:/login.do"; + } + ``` +- 쓰기 작업에 `AuthUtil.canWrite()` 확인이 있는가 +- 타인 데이터 접근 시 `canReadOther` 권한 확인이 있는가 + +### 3. XSS 방지 +- JSP 출력 시 `` 또는 JSTL fn:escapeXml 사용 여부 +- CKEditor 등 HTML 허용 필드에 적절한 sanitize 처리 여부 + +### 4. SQL 인젝션 방지 +- MyBatis에서 `${}` (string substitution) 대신 `#{}` (PreparedStatement) 사용 여부 +- `ORDER BY` 동적 처리 시 화이트리스트 검증 여부 + +### 5. 비즈니스 로직 +- ID 채번 후 insert 전 중복 확인 필요 여부 +- 삭제 시 deleteAt='Y' 소프트 삭제인지 물리 삭제인지 일관성 +- 페이징 파라미터(pageNo, pageSize) 기본값 처리 (CmmBaseVO.getPageNo(), getPageSize()) + +### 6. JSP 품질 +- selMenuId hidden 필드가 폼에 포함되었는가 +- redirect 후 검색 조건 유지 파라미터가 addAttribute로 전달되는가 +- Ajax 에러 핸들링(error callback) 존재 여부 + +## 출력 형식 + +```markdown +## 리뷰 결과 + +### [필수 수정] 보안/오류 +- 파일: {경로}:{라인} + 문제: {설명} + 수정: {수정 방법} + +### [권장] 패턴 개선 +- ... + +### [확인] 정상 +- ... +``` + +## 입력 / 출력 + +- **입력:** `_workspace/02_backend_result.md`, `_workspace/03_frontend_result.md` + 생성된 실제 파일들 +- **출력:** `_workspace/04_review_result.md` + +## 팀 통신 프로토콜 + +- **수신:** 오케스트레이터로부터 리뷰 요청 + 생성 파일 목록 +- **발신:** 오케스트레이터에게 리뷰 결과 보고 (필수 수정 항목 목록) +- 필수 수정 항목이 있으면 해당 파일을 직접 Edit하여 수정한다 + +## 에러 핸들링 + +- 파일을 읽을 수 없으면 `_workspace/04_review_result.md`에 "파일 미확인" 기록 후 진행 +- 필수 수정 항목이 0건이면 "리뷰 통과" 선언 diff --git a/.claude/skills/egov-crud-module/SKILL.md b/.claude/skills/egov-crud-module/SKILL.md new file mode 100644 index 0000000..95cb30f --- /dev/null +++ b/.claude/skills/egov-crud-module/SKILL.md @@ -0,0 +1,80 @@ +--- +name: egov-crud-module +description: "eGovFramework 패턴의 CRUD 모듈 전체를 생성한다 (VO, DAO, Service, Controller, MyBatis Mapper XML, JSP). 신규 화면/기능 추가, CRUD 구현, 모듈 생성 요청 시 반드시 이 스킬을 사용한다. '~화면 만들어줘', '~기능 추가', '~모듈 생성' 요청에 항상 적용." +--- + +# eGovFramework CRUD 모듈 생성 스킬 + +## 실행 모드 + +하이브리드: Phase 1(분석)은 서브 에이전트, Phase 2(개발)는 에이전트 팀, Phase 3(리뷰)은 서브 에이전트 + +## Phase 0: 컨텍스트 확인 + +`_workspace/` 존재 여부 확인: +- 있고 부분 재실행 요청 → 해당 Phase만 재실행 +- 있고 새 요청 → `_workspace/`를 `_workspace_prev/`로 이동 후 새 실행 +- 없음 → 초기 실행 + +## Phase 1: 분석 (kccf-analyst 서브 에이전트) + +Agent(kccf-analyst)에게 다음을 요청한다: +1. 요구사항 분석 및 도메인 모델 설계 +2. 참조할 기존 모듈 파악 (bsns, act, lcltt 중 유사한 것) +3. `_workspace/01_analyst_design.md` 출력 + +분석 명세에 포함되어야 할 내용: +- 패키지 경로, 테이블명, 핵심 필드 +- Controller URL 목록 (목록페이지, Ajax목록, 상세페이지, insert, delete) +- 화면 JSP 경로 목록 +- 사용할 코드그룹 목록 +- 특이사항 (파일첨부, 팝업, 권한 등) + +## Phase 2: 개발 (에이전트 팀: kccf-backend + kccf-frontend 병렬) + +`_workspace/01_analyst_design.md`를 두 에이전트가 공유하고 병렬 작업한다. + +### kccf-backend 담당 +순서대로 생성: +1. VO 클래스 (`kccf/{module}/vo/{Module}VO.java`) +2. DAO 인터페이스 (`kccf/{module}/dao/{Module}DAO.java`) +3. Service 인터페이스 (`kccf/{module}/service/{Module}Service.java`) +4. ServiceImpl (`kccf/{module}/service/impl/{Module}ServiceImpl.java`) +5. Controller (`kccf/{module}/web/{Module}Controller.java`) +6. MyBatis Mapper XML (`resources/egovframework/mapper/kccf/{module}/{Module}_SQL.xml`) + +### kccf-frontend 담당 +백엔드 VO/URL 명세를 기반으로: +1. 목록 JSP (`WEB-INF/jsp/mng/{module}/list{Module}.jsp`) +2. 등록/수정 JSP (`WEB-INF/jsp/mng/{module}/{module}Regist.jsp`) +3. 필요 시 팝업 JSP + +## Phase 3: 리뷰 (kccf-reviewer 서브 에이전트) + +생성된 파일 목록을 전달하고 검토 요청: +- 보안 취약점, 패턴 오류, 누락 항목 확인 +- 필수 수정 항목은 즉시 Edit로 수정 + +## 완료 보고 + +사용자에게 다음을 보고한다: +``` +## 생성 완료 + +### 백엔드 +- {파일 경로} — {역할} + +### 프론트엔드 +- {파일 경로} — {화면명} + +### 리뷰 결과 +- 수정 항목: {건수}건 +- 상태: 통과 / 수정 완료 +``` + +## 참조 + +- 기존 bsns 모듈: `src/main/java/kccf/bsns/` +- 기존 act 모듈: `src/main/java/kccf/act/` +- Mapper XML 예시: `src/main/resources/egovframework/mapper/` +- 상세 패턴: `references/patterns.md` diff --git a/.claude/skills/egov-crud-module/references/patterns.md b/.claude/skills/egov-crud-module/references/patterns.md new file mode 100644 index 0000000..db70817 --- /dev/null +++ b/.claude/skills/egov-crud-module/references/patterns.md @@ -0,0 +1,255 @@ +# eGovFramework KCCF 코드 패턴 레퍼런스 + +## VO 완성 패턴 + +```java +package kccf.{module}.vo; + +import kccf.cmm.vo.CmmBaseVO; +import lombok.*; + +@Setter @Getter @ToString +@NoArgsConstructor @AllArgsConstructor +public class {Module}VO extends CmmBaseVO { + + /* {한글명} 아이디 */ + private String {module}Id; + /* {한글명}명 */ + private String {module}Nm; + /* 지역코드 */ + private String areaCode; + /* 삭제여부 */ + private String deleteAt; + /* 등록자 아이디 */ + private String regUserId; + /* 등록자명 */ + private String regUserNm; + /* 등록일시 */ + private String regDttm; + /* 수정자 아이디 */ + private String updUserId; + /* 수정일시 */ + private String updDttm; + + /* 검색 - {조건명} */ + private String search{Field}; + + /* 권한 관련 */ + private boolean canReadOther; + private boolean canWrite; + private boolean canUpdate; +} +``` + +## DAO 패턴 + +```java +package kccf.{module}.dao; + +import java.util.List; +import kccf.cmm.dao.CmmBaseDAO; +import kccf.{module}.vo.{Module}VO; +import org.springframework.stereotype.Repository; + +@Repository +public class {Module}DAO extends CmmBaseDAO { + + public List<{Module}VO> select{Module}List({Module}VO vo) { + return selectList("kccf.{module}.dao.{Module}DAO.select{Module}List", vo); + } + + public {Module}VO select{Module}Detail({Module}VO vo) { + return selectOne("kccf.{module}.dao.{Module}DAO.select{Module}Detail", vo); + } + + public void insert{Module}({Module}VO vo) { + insert("kccf.{module}.dao.{Module}DAO.insert{Module}", vo); + } + + public void update{Module}({Module}VO vo) { + update("kccf.{module}.dao.{Module}DAO.update{Module}", vo); + } + + public void delete{Module}({Module}VO vo) { + delete("kccf.{module}.dao.{Module}DAO.delete{Module}", vo); + } + + public String get{Module}IdSeq() { + return selectOne("kccf.{module}.dao.{Module}DAO.get{Module}IdSeq", null); + } +} +``` + +## Service / ServiceImpl 패턴 + +```java +// Service 인터페이스 +public interface {Module}Service { + List<{Module}VO> select{Module}List({Module}VO vo); + {Module}VO select{Module}Detail({Module}VO vo); + void insert{Module}({Module}VO vo); + void update{Module}({Module}VO vo); + void delete{Module}({Module}VO vo); + String get{Module}IdSeq(); +} + +// ServiceImpl +@Service +@RequiredArgsConstructor +public class {Module}ServiceImpl implements {Module}Service { + private final {Module}DAO {module}DAO; + + @Override public List<{Module}VO> select{Module}List({Module}VO vo) { return {module}DAO.select{Module}List(vo); } + // ... 나머지 메서드 +} +``` + +## Controller 완성 패턴 + +```java +@Controller +@RequiredArgsConstructor +@RequestMapping(value = "/sec/{module}") +public class {Module}Controller extends CmmBaseController { + + private final {Module}Service {module}Service; + private final KccfLoginService kccfLoginService; + + @RequestMapping(value = "/{module}ListPage.do") + public String {module}ListPage({Module}VO searchVO, ModelMap model, HttpSession session) { + UserVO userVO = (UserVO)session.getAttribute("user"); + if(userVO == null || StringUtils.isAllBlank(userVO.getUserId())) { + return "redirect:/login.do"; + } + // 코드 목록 로딩 + CmmnCodeDetailVO cmmVO = new CmmnCodeDetailVO(); + cmmVO.setCode("AREA_CODE"); + model.addAttribute("areaCodeList", kccfLoginService.selectCodeListAjax(cmmVO)); + searchVO.setCanWrite(AuthUtil.canWrite(getUserId(), getSiteSeCode(), getSelMenuId(), "")); + model.addAttribute("searchVO", searchVO); + return model.getAttribute("hostId") + "/{module}/list{Module}"; + } + + @RequestMapping(value = "/select{Module}ListAjax.do") + public String select{Module}ListAjax({Module}VO searchVO, ModelMap model) { + List<{Module}VO> list = {module}Service.select{Module}List(searchVO); + if(list != null && list.size() > 0) { + searchVO.setTotCnt(list.get(0).getTotCnt()); + } + model.addAttribute("data", list); + model.addAttribute("searchVO", searchVO); + return "jsonView"; + } + + @RequestMapping(value = "/{module}DetailPage.do") + public String {module}DetailPage({Module}VO searchVO, ModelMap model, HttpSession session) { + UserVO userVO = (UserVO)session.getAttribute("user"); + if(userVO == null || StringUtils.isAllBlank(userVO.getUserId())) { + return "redirect:/login.do"; + } + if(searchVO.get{Module}Id() != null && !searchVO.get{Module}Id().isEmpty()) { + model.addAttribute("{module}VO", {module}Service.select{Module}Detail(searchVO)); + } + searchVO.setCanWrite(AuthUtil.canWrite(getUserId(), getSiteSeCode(), getSelMenuId(), "")); + model.addAttribute("searchVO", searchVO); + return model.getAttribute("hostId") + "/{module}/{module}Regist"; + } + + @RequestMapping(value = "/insert{Module}.do") + public String insert{Module}({Module}VO searchVO, RedirectAttributes redirect) { + searchVO.setRegUserId(getUserId()); + searchVO.setUpdUserId(getUserId()); + if(searchVO.get{Module}Id() != null && !searchVO.get{Module}Id().isEmpty()) { + {module}Service.update{Module}(searchVO); + } else { + searchVO.set{Module}Id({module}Service.get{Module}IdSeq()); + {module}Service.insert{Module}(searchVO); + } + redirect.addAttribute("pageNo", searchVO.getPageNo()); + redirect.addAttribute("selMenuId", searchVO.getSelMenuId()); + return "redirect:/sec/{module}/{module}ListPage.do"; + } + + @RequestMapping(value = "/delete{Module}.do") + public String delete{Module}({Module}VO searchVO, RedirectAttributes redirect) { + {module}Service.delete{Module}(searchVO); + redirect.addAttribute("pageNo", searchVO.getPageNo()); + redirect.addAttribute("selMenuId", searchVO.getSelMenuId()); + return "redirect:/sec/{module}/{module}ListPage.do"; + } +} +``` + +## MyBatis Mapper XML 패턴 + +```xml + + + + + + + + + + + INSERT INTO TB_{MODULE} ( + {MODULE}_ID, {MODULE}_NM, AREA_CODE, + DELETE_AT, REG_USER_ID, REG_DTTM, UPD_USER_ID, UPD_DTTM + ) VALUES ( + #{module}Id}, #{module}Nm}, #{areaCode}, + 'N', #{regUserId}, SYSDATE, #{updUserId}, SYSDATE + ) + + + + UPDATE TB_{MODULE} + SET {MODULE}_NM = #{module}Nm} + , AREA_CODE = #{areaCode} + , UPD_USER_ID = #{updUserId} + , UPD_DTTM = SYSDATE + WHERE {MODULE}_ID = #{module}Id} + + + + UPDATE TB_{MODULE} + SET DELETE_AT = 'Y' + , UPD_USER_ID = #{updUserId} + , UPD_DTTM = SYSDATE + WHERE {MODULE}_ID = #{module}Id} + + + + + +``` + +## 주의사항 + +- `SYSDATE`: Oracle/Altibase 전용 → MySQL/MariaDB에서는 `NOW()` +- `ROW_NUMBER() OVER (...)`: Oracle/Altibase/PostgreSQL 지원 → MySQL 5.7 이하 미지원 (서브쿼리 대체) +- `||` 문자열 연결: Oracle/PostgreSQL → MySQL은 `CONCAT()` +- 현재 DB 설정은 `egov-com-datasource.xml` 또는 application 설정에서 확인 diff --git a/.claude/skills/kccf-jsp-view/SKILL.md b/.claude/skills/kccf-jsp-view/SKILL.md new file mode 100644 index 0000000..7b3a5af --- /dev/null +++ b/.claude/skills/kccf-jsp-view/SKILL.md @@ -0,0 +1,217 @@ +--- +name: kccf-jsp-view +description: "KCCF 시스템의 JSP 화면을 작성하거나 수정한다. 목록/등록/상세/팝업 화면, JSP 레이아웃, Ajax 연동 작업 시 사용한다. '화면 수정', 'JSP 추가', '목록화면', '등록화면', '팝업' 관련 요청에 적용." +--- + +# KCCF JSP 화면 작성 스킬 + +## 화면 위치 규칙 + +``` +WEB-INF/jsp/ + mng/{module}/ ← 관리자(인증 필요) 화면 + list{Module}.jsp ← 목록 + {module}Regist.jsp ← 등록/수정 + select{Module}Popup.jsp ← 선택 팝업 + kccf/{module}/ ← 공개 화면 + list{Module}Find.jsp ← 조회/검색 + popup/ ← 공개 팝업 (주소, 지도 등) +``` + +## 목록 화면 템플릿 + +```jsp +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> + + + +
+ + + + + + +
+ + +
+ + + +
+ + + + + + + + + + + +
번호명칭등록일
조회 중...
+
+ + +``` + +## 등록/수정 화면 템플릿 + +```jsp +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +
+ + + + + + + + + + + + + + + + +
명칭 * + +
지역 + +
+ + +
+ + + + + + + +
+
+ + +``` + +## 팝업 화면 패턴 + +```jsp + + +``` + +## 주소 검색 팝업 호출 + +```javascript +function fnJusoPopup() { + var url = contextPath + "/juso/jusoPopup.do"; + window.open(url, "jusoPopup", "width=570,height=420,scrollbars=yes"); +} +// 주소팝업 콜백: fn_jusoPopup(roadAddr, zipCode, jibunAddr) +``` + +## 주의사항 + +- XSS 방지: 출력은 반드시 `` 또는 `fn:escapeXml()` 사용 +- `${}` 직접 HTML 출력 금지 (스크립트 컨텍스트 제외) +- 신규 화면 작성 전 기존 유사 화면을 먼저 Read하여 스타일 클래스 통일 +- 참조 화면: `WEB-INF/jsp/mng/bsns/` 디렉토리 + +## 참조 + +- 주소팝업: `WEB-INF/jsp/kccf/lcltt/popup/jusoPopup.jsp` +- 지도팝업: `WEB-INF/jsp/kccf/lcltt/popup/mapPopup.jsp` +- Act 선택팝업: `WEB-INF/jsp/mng/act/selectActListPopup.jsp` +- 사업 선택팝업: `WEB-INF/jsp/mng/act/selectBsnsPopup.jsp` diff --git a/.claude/skills/kccf-orchestrate/SKILL.md b/.claude/skills/kccf-orchestrate/SKILL.md new file mode 100644 index 0000000..23adcaa --- /dev/null +++ b/.claude/skills/kccf-orchestrate/SKILL.md @@ -0,0 +1,111 @@ +--- +name: kccf-orchestrate +description: "KCCF 프로젝트 개발 전체 워크플로우를 조율하는 오케스트레이터. 신규 기능 개발, 화면 추가, 버그 수정, 코드 리뷰, 보안 점검 등 KCCF 관련 모든 개발 작업 요청 시 이 스킬을 사용한다. 'KCCF', 'kccf', '사업', '활동', '지방문화원', '게시판', '화면', '모듈', '기능 추가', '버그 수정', '수정', '개발' 키워드 포함 시 항상 이 스킬로 진입. 다시 실행, 재실행, 수정, 보완, 업데이트 요청도 포함." +--- + +# KCCF 개발 오케스트레이터 + +## 프로젝트 개요 + +- **시스템:** KCCF 문화예술 사업 관리 시스템 +- **경로:** `D:\tools\total_dev\eGovFrameDev-4.1.0-64bit_06_kccf\workspace\kccf` +- **스택:** eGovFramework 4.0.0 + Spring 5.3.6 + MyBatis + JSP/Tiles +- **도메인:** bsns(사업) - act(활동) - lcltt(지방문화원) - bbs(게시판) - auth(권한) + +## Phase 0: 컨텍스트 확인 + +시작 시 `_workspace/` 존재 여부 확인: +- **없음** → 초기 실행 (Phase 1부터) +- **있음 + 부분 재실행 요청** → 해당 Phase만 재실행 +- **있음 + 새 요청** → `_workspace/`를 `_workspace_prev/`로 이동 후 새 실행 + +## Phase 1: 요청 분류 + +요청 유형을 판단하여 실행 경로를 선택한다: + +| 요청 유형 | 실행 경로 | +|----------|----------| +| 신규 CRUD 모듈 | Phase 2 → 3 → 4 (전체) | +| 기존 화면/기능 수정 | 분석 축약 → 해당 파일만 수정 | +| 버그 수정 | 오류 파악 → 단일 파일 수정 | +| 쿼리/Mapper 작업 | mybatis-mapper 스킬 직접 호출 | +| 보안 검토 | kccf-security-check 스킬 직접 호출 | +| 단순 질문 | 직접 답변 (에이전트 불필요) | + +## Phase 2: 분석 (kccf-analyst) + +Agent(kccf-analyst, model="opus")에게 요청: +- 요구사항 텍스트 전달 +- 유사 기존 모듈 파악 지시 +- 출력: `_workspace/01_analyst_design.md` + +## Phase 3: 개발 (병렬 팀) + +`_workspace/01_analyst_design.md` 기반으로 병렬 실행: + +**kccf-backend** (model="opus"): +- VO → DAO → Service → Controller → Mapper XML 순서로 생성 +- 출력: `_workspace/02_backend_result.md` + +**kccf-frontend** (model="opus"): +- 백엔드 완료 후 또는 병렬로 JSP 화면 생성 +- 출력: `_workspace/03_frontend_result.md` + +## Phase 4: 리뷰 (kccf-reviewer) + +Agent(kccf-reviewer, model="opus")에게 요청: +- 생성 파일 목록 전달 (`_workspace/02_backend_result.md`, `_workspace/03_frontend_result.md`) +- 필수 수정 항목은 즉시 Edit 적용 +- 출력: `_workspace/04_review_result.md` + +## 완료 보고 형식 + +``` +## 작업 완료 + +### 생성/수정 파일 +- [경로] 역할 + +### 리뷰 결과 +- 수정 항목: N건 (처리 완료) + +### 다음 단계 (필요 시) +- 빌드 확인: mvn compile +- 서버 재시작 후 URL 접속 확인 +``` + +## 데이터 전달 규칙 + +- 에이전트 간 중간 산출물: `_workspace/` 폴더 +- 파일명: `{phase번호}_{에이전트}_{산출물}.md` +- 최종 파일: 실제 프로젝트 경로에 직접 Write + +## 에러 핸들링 + +- 에이전트 실패 시: 해당 Phase 1회 재시도, 재실패 시 현재까지 결과 보고 후 사용자에게 확인 +- 설계 명세 불명확 시: analyst가 합리적 가정을 하고 `_workspace/01_analyst_design.md`에 가정 목록 기재 +- 컴파일 오류 예상 코드: `_workspace/02_backend_result.md`에 "주의" 섹션으로 명시 + +## 에이전트 팀 구성 + +``` +오케스트레이터 + ├── Phase 2: kccf-analyst (서브 에이전트) + ├── Phase 3: kccf-backend + kccf-frontend (병렬 팀) + └── Phase 4: kccf-reviewer (서브 에이전트) +``` + +## 테스트 시나리오 + +**정상 흐름:** +1. "회원 포인트 적립 이력 관리 화면 만들어줘" +2. analyst → 도메인 설계 (point 모듈) +3. backend → VO/DAO/Service/Controller/Mapper 생성 +4. frontend → list/regist JSP 생성 +5. reviewer → 보안/패턴 검토 + +**에러 흐름:** +- "bsnsListPage 클릭 시 500 에러" +→ Phase 1 분류: 버그 수정 +→ analyst 없이: BsnsController, BsnsService, Mapper XML 직접 읽기 +→ 오류 원인 파악 후 해당 파일만 Edit diff --git a/.claude/skills/kccf-security-check/SKILL.md b/.claude/skills/kccf-security-check/SKILL.md new file mode 100644 index 0000000..ec5dc0f --- /dev/null +++ b/.claude/skills/kccf-security-check/SKILL.md @@ -0,0 +1,124 @@ +--- +name: kccf-security-check +description: "KCCF 코드의 보안 취약점을 검토하고 수정한다. 인증/권한 누락, XSS, SQL 인젝션, 세션 취약점 점검 시 사용한다. '보안 검토', '취약점 확인', '권한 검사', 코드 리뷰 요청 시 적용." +--- + +# KCCF 보안 검토 스킬 + +## 검토 우선순위 + +1. **인증 누락** (Critical) — 인증 없이 데이터 접근 가능 +2. **XSS** (High) — 사용자 입력을 HTML에 직접 출력 +3. **SQL 인젝션** (High) — MyBatis `${}` 오용 +4. **권한 우회** (High) — 권한 확인 없이 쓰기/삭제 +5. **세션 고정** (Medium) — 로그인 후 세션 재생성 미처리 + +## 체크리스트 + +### 인증 검증 (Controller) + +```java +// ✅ 올바른 패턴 — /sec/ URL에 반드시 존재해야 함 +UserVO userVO = (UserVO)session.getAttribute("user"); +if(userVO == null || StringUtils.isAllBlank(userVO.getUserId())) { + return "redirect:/login.do"; +} + +// ❌ 잘못된 패턴 — 세션 체크 없이 데이터 접근 +public String deleteData(VO vo) { + service.delete(vo); // 누가 호출했는지 모름 +} +``` + +확인 항목: +- `/sec/` 접두어 URL을 처리하는 모든 메서드에 세션 검사 존재? +- Ajax 엔드포인트(`*Ajax.do`)에도 세션 검사 또는 Spring Security 설정? +- 삭제/등록/수정 메서드에 세션 검사? + +### XSS 방지 (JSP) + +```jsp +<%-- ✅ 안전 --%> + +${fn:escapeXml(userInput)} + +<%-- ❌ 위험 --%> +${userInput} +<%= request.getParameter("name") %> +``` + +예외 허용 케이스: +- CKEditor HTML 편집기 출력 (서버 측 sanitize 전제) +- 개발자가 명시적으로 HTML을 허용한 필드 + +### SQL 인젝션 (Mapper XML) + +```xml + +WHERE NM = #{searchNm} + + +WHERE NM = '${searchNm}' +ORDER BY ${sortColumn} ← ORDER BY 동적 처리 주의 +``` + +ORDER BY 동적 처리 시 화이트리스트: +```java +// Controller 또는 Service에서 +String[] allowedColumns = {"REG_DTTM", "NM", "CODE"}; +if (!Arrays.asList(allowedColumns).contains(sortColumn)) { + sortColumn = "REG_DTTM"; // 기본값 +} +``` + +### 권한 검증 + +```java +// 쓰기 권한 확인 +searchVO.setCanWrite(AuthUtil.canWrite(getUserId(), getSiteSeCode(), getSelMenuId(), "")); + +// JSP에서 확인 + + + +``` + +주의: JSP 버튼 숨기기만으로는 불충분 — Controller에서도 권한 재확인 필요. + +### 파일 업로드 + +```java +// ✅ 허용 확장자 검증 +String[] allowedExt = {".jpg", ".jpeg", ".png", ".gif", ".pdf", ".hwp", ".xlsx"}; +String ext = fileName.substring(fileName.lastIndexOf(".")).toLowerCase(); +if (!Arrays.asList(allowedExt).contains(ext)) { + throw new IllegalArgumentException("허용되지 않는 파일 형식"); +} + +// ❌ 위험: 확장자 검증 없이 저장 +String savedPath = uploadDir + originalFileName; +``` + +## 수정 우선순위 결정 + +| 등급 | 기준 | 처리 | +|------|------|------| +| Critical | 인증 없이 데이터 변경 가능 | 즉시 수정 | +| High | XSS, SQL인젝션, 권한 우회 | 즉시 수정 | +| Medium | 불필요한 데이터 노출, 로깅 누락 | 수정 권고 | +| Low | 코드 스타일, 예외처리 개선 | 권고 | + +## 출력 형식 + +```markdown +## 보안 검토 결과 + +### Critical +- [파일:라인] 문제 설명 → 수정 방법 + +### High +- ... + +### 통과 항목 +- ... +``` diff --git a/.claude/skills/mybatis-mapper/SKILL.md b/.claude/skills/mybatis-mapper/SKILL.md new file mode 100644 index 0000000..1da5f90 --- /dev/null +++ b/.claude/skills/mybatis-mapper/SKILL.md @@ -0,0 +1,154 @@ +--- +name: mybatis-mapper +description: "MyBatis Mapper XML 쿼리를 작성하거나 수정한다. 쿼리 최적화, 동적 SQL, 페이징, 다중 DB 호환 쿼리 작업 시 사용한다. 'SQL 작성', '쿼리 추가', 'Mapper 수정', '조회 조건 추가' 요청에 적용." +--- + +# MyBatis Mapper XML 작성 스킬 + +## Mapper 파일 위치 + +``` +src/main/resources/egovframework/mapper/kccf/{module}/{Module}_SQL.xml +``` + +## namespace 규칙 + +```xml + +``` + +## 핵심 패턴 + +### 페이징 목록 조회 (Oracle/Altibase 기준) + +```xml + +``` + +**MySQL/MariaDB 페이징 변형:** +```sql +SELECT A.*, @rownum := @rownum + 1 AS rn, total.cnt AS totCnt + FROM TB_{MODULE} A, (SELECT COUNT(*) cnt FROM TB_{MODULE} WHERE DELETE_AT='N') total + WHERE A.DELETE_AT = 'N' + ORDER BY A.REG_DTTM DESC + LIMIT #{pageSize} OFFSET #{offset} +``` + +### 동적 조건 (where 절) + +```xml + + + + AND COL = #{field} + + + + AND CODE IN + + #{item} + + + + + AND REG_DTTM >= #{searchStartDate} + + + AND REG_DTTM <= #{searchEndDate} + + +``` + +### INSERT / UPDATE + +```xml + + INSERT INTO TB_{MODULE} ( + ID, NM, CODE, DELETE_AT, REG_USER_ID, REG_DTTM, UPD_USER_ID, UPD_DTTM + ) VALUES ( + #{id}, #{nm}, #{code}, 'N', #{regUserId}, SYSDATE, #{updUserId}, SYSDATE + ) + + + + + UPDATE TB_{MODULE} + + NM = #{nm}, + CODE = #{code}, + UPD_USER_ID = #{updUserId}, + UPD_DTTM = SYSDATE + + WHERE ID = #{id} + +``` + +### 소프트 삭제 (KCCF 표준) + +```xml + + UPDATE TB_{MODULE} + SET DELETE_AT = 'Y' + , UPD_USER_ID = #{updUserId} + , UPD_DTTM = SYSDATE + WHERE ID = #{id} + +``` + +### ID 채번 (시퀀스) + +```xml + + + + + +``` + +## XML 특수문자 이스케이프 + +| 문자 | XML 표현 | +|------|---------| +| `<` | `<` | +| `>` | `>` | +| `&` | `&` | +| `<=` | `<=` | +| `>=` | `>=` | + +또는 CDATA 블록: +```xml + + + +``` + +## DB 방언 주의사항 + +| 기능 | Oracle/Altibase | MySQL/MariaDB | PostgreSQL | +|------|----------------|---------------|-----------| +| 현재시각 | `SYSDATE` | `NOW()` | `NOW()` | +| 문자 연결 | `\|\|` | `CONCAT()` | `\|\|` | +| NULL 대체 | `NVL()` | `IFNULL()` | `COALESCE()` | +| 행번호 | `ROWNUM` / `ROW_NUMBER()` | `ROW_NUMBER()` (8.0+) | `ROW_NUMBER()` | +| 페이징 | `ROWNUM` 서브쿼리 | `LIMIT OFFSET` | `LIMIT OFFSET` | +| 더미테이블 | `FROM DUAL` | 생략 | 생략 | diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..20182de --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ +# Maven build output +target/ + +# IDE +.settings/ +.project +.classpath +*.class + +# Large media files (upload to file server separately) +*.mp4 +*.avi +*.mov +*.wmv + +# OS +.DS_Store +Thumbs.db diff --git a/.project b/.project new file mode 100644 index 0000000..aed52ff --- /dev/null +++ b/.project @@ -0,0 +1,49 @@ + + + kccf + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.springframework.ide.eclipse.boot.validation.springbootbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.jdt.core.javanature + egovframework.dev.imp.ide.natures.egovnature + org.eclipse.wst.jsdt.core.jsNature + + diff --git a/.settings/.jsdtscope b/.settings/.jsdtscope new file mode 100644 index 0000000..f179e11 --- /dev/null +++ b/.settings/.jsdtscope @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..d80f5b9 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/webapp/proxy.jsp=UTF-8 +encoding//src/test/java=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..cac0df4 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component new file mode 100644 index 0000000..39da00a --- /dev/null +++ b/.settings/org.eclipse.wst.common.component @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml b/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml new file mode 100644 index 0000000..6d59853 --- /dev/null +++ b/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..c61cfc5 --- /dev/null +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.container b/.settings/org.eclipse.wst.jsdt.ui.superType.container new file mode 100644 index 0000000..3bd5d0a --- /dev/null +++ b/.settings/org.eclipse.wst.jsdt.ui.superType.container @@ -0,0 +1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.name b/.settings/org.eclipse.wst.jsdt.ui.superType.name new file mode 100644 index 0000000..05bd71b --- /dev/null +++ b/.settings/org.eclipse.wst.jsdt.ui.superType.name @@ -0,0 +1 @@ +Window \ No newline at end of file diff --git a/.settings/org.eclipse.wst.validation.prefs b/.settings/org.eclipse.wst.validation.prefs new file mode 100644 index 0000000..04cad8c --- /dev/null +++ b/.settings/org.eclipse.wst.validation.prefs @@ -0,0 +1,2 @@ +disabled=06target +eclipse.preferences.version=1 diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..3348e98 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,33 @@ +# KCCF 프로젝트 + +## 프로젝트 개요 + +문화예술 사업 관리 시스템 (eGovFramework 4.0.0 + Spring MVC 5.3.6 + MyBatis + JSP/Tiles) + +- **Git:** https://git.zioinfo.co.kr/ythong/kcc.git +- **빌드:** Maven (`mvn install`) +- **Java:** 1.8 / **패키지:** `kccf.*` + `egovframework.com.*` + +## 하네스: KCCF 개발 자동화 + +**목표:** eGovFramework 패턴 기반 CRUD 개발, 버그 수정, 보안 검토를 에이전트 팀으로 자동화 + +**트리거:** KCCF 관련 개발 작업(신규 기능, 화면 추가, 버그 수정, 쿼리 작업, 보안 점검) 요청 시 `kccf-orchestrate` 스킬을 사용하라. 단순 질문은 직접 응답 가능. + +## 핵심 도메인 + +| 패키지 | 한글명 | 역할 | +|--------|--------|------| +| `kccf.bsns` | 사업 | 문화예술 사업 관리 | +| `kccf.act` | 활동 | 사업 연계 행사/활동 | +| `kccf.lcltt` | 지방문화원 | 지역 문화기관 | +| `kccf.bbs` | 게시판 | 공지/갤러리/FAQ/강의 | +| `kccf.auth` | 권한 | 메뉴별 읽기/쓰기 | +| `kccf.code` | 코드 | 공통코드/상세코드 | +| `kccf.user` | 사용자 | 회원 관리 | + +## 변경 이력 + +| 날짜 | 변경 내용 | 대상 | 사유 | +|------|----------|------|------| +| 2026-06-15 | 하네스 초기 구성 | 전체 | KCCF 개발 자동화 | diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..fce776a --- /dev/null +++ b/pom.xml @@ -0,0 +1,783 @@ + + 4.0.0 + com.digitalship + kccf + war + 1.0.0 + kccf + http://www.egovframe.go.kr + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + + + + 5.3.6 + 4.0.0 + + + + + mvn2s + https://repo1.maven.org/maven2/ + + true + + + true + + + + egovframe + https://maven.egovframe.go.kr/maven/ + + true + + + false + + + + + + + + + org.imgscalr + imgscalr-lib + 4.2 + + + + + org.bgee.log4jdbc-log4j2 + log4jdbc-log4j2-jdbc4.1 + 1.16 + + + + + org.projectlombok + lombok + 1.18.24 + provided + + + + + javax.validation + validation-api + 2.0.1.Final + + + + org.hibernate + hibernate-validator + 5.0.1.Final + + + + + org.egovframe.rte + org.egovframe.rte.ptl.mvc + ${org.egovframe.rte.version} + + + commons-logging + commons-logging + + + + + org.egovframe.rte + org.egovframe.rte.psl.dataaccess + ${org.egovframe.rte.version} + + + org.egovframe.rte + org.egovframe.rte.fdl.idgnr + ${org.egovframe.rte.version} + + + org.egovframe.rte + org.egovframe.rte.fdl.property + ${org.egovframe.rte.version} + + + + javax.servlet + javax.servlet-api + provided + 3.1.0 + + + + javax.servlet + jstl + 1.2 + + + + taglibs + standard + 1.1.2 + + + + org.antlr + antlr + 3.5 + + + + org.hsqldb + hsqldb + 2.5.0 + + + + + + org.egovframe.rte + org.egovframe.rte.fdl.security + ${org.egovframe.rte.version} + + + + org.egovframe.rte + org.egovframe.rte.fdl.excel + ${org.egovframe.rte.version} + + + + org.egovframe.rte + org.egovframe.rte.bat.core + ${org.egovframe.rte.version} + + + + org.egovframe.rte + org.egovframe.rte.fdl.crypto + ${org.egovframe.rte.version} + + + + + org.egovframe.rte + org.egovframe.rte.fdl.access + ${org.egovframe.rte.version} + + + + com.googlecode.log4jdbc + log4jdbc + 1.2 + + + slf4j-api + org.slf4j + + + + + + org.apache.commons + commons-dbcp2 + 2.4.0 + + + + org.jasypt + jasypt + 1.9.3 + + + + cglib + cglib + 3.3.0 + + + + org.apache.commons + commons-compress + + 1.19 + + + + xerces + xercesImpl + 2.12.0 + + + + org.quartz-scheduler + quartz + 2.3.2 + + + slf4j-api + org.slf4j + + + + + + org.quartz-scheduler + quartz-jobs + 2.3.2 + + + + oro + oro + 2.0.8 + + + + com.ibm.icu + icu4j + 53.1 + + + + commons-net + commons-net + 3.6 + + + + org.apache.commons + commons-email + 1.5 + + + + egovframework.com.ems + sndng-mail + 1.0 + + + + javax.servlet.jsp + javax.servlet.jsp-api + 2.3.3 + provided + + + + ldapsdk + ldapsdk + 4.1 + + + + com.artofsolving + jodconverter + 2.2.1 + + + slf4j-api + org.slf4j + + + commons-io + commons-io + + + + + + + commons-fileupload + commons-fileupload + 1.3.3 + + + commons-io + commons-io + + + + + + org.twitter4j + twitter4j-core + 4.0.7 + + + + net.sourceforge.ajaxtags + ajaxtags-resources + 1.5.7 + + + + com.ckeditor + ckeditor-java-core + 3.5.3 + + + + org.apache.xmlgraphics + batik-ext + 1.7 + + + + org.springframework.social + spring-social-facebook + 2.0.3.RELEASE + + + spring-web + org.springframework + + + spring-webmvc + org.springframework + + + + + + com.github.scribejava + scribejava-apis + 5.6.0 + + + + com.github.scribejava + scribejava-core + 5.6.0 + + + + org.apache.httpcomponents + httpclient + 4.3.6 + + + commons-logging + commons-logging + + + + + + com.h2database + h2 + 1.4.180 + + + + javax.websocket + javax.websocket-api + 1.0 + provided + + + + org.glassfish + javax.json + 1.0.4 + + + + com.fasterxml.jackson.core + jackson-core + 2.11.4 + + + + com.fasterxml.jackson.core + jackson-annotations + 2.11.4 + + + + com.fasterxml.jackson.core + jackson-databind + 2.11.4 + + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + 2.11.4 + + + + org.springframework.ldap + spring-ldap-core + 2.3.3.RELEASE + + + org.springframework + spring-beans + + + org.springframework + spring-core + + + org.springframework + spring-tx + + + org.slf4j + slf4j-api + + + org.slf4j + jcl-over-slf4j + + + + + + org.codehaus.jackson + jackson-mapper-asl + 1.9.13 + + + + mysql + mysql-connector-java + 5.1.31 + + + + org.mariadb.jdbc + mariadb-java-client + 2.2.5 + + + + org.postgresql + postgresql + 9.4.1208 + + + + ojdbc + ojdbc + 6-11 + system + ${basedir}/src/main/webapp/WEB-INF/lib/ojdbc6-11.2.0.3.jar + + + + altibase + altibase-jdbc-driver + 7.1.0 + system + ${basedir}/src/main/webapp/WEB-INF/lib/Altibase.jar + + + + com.tmax.tibero + tibero-jdbc + 5.0 + system + ${basedir}/src/main/webapp/WEB-INF/lib/tibero5-jdbc.jar + + + + cubrid + cubrid-jdbc + 10.2 + system + ${basedir}/src/main/webapp/WEB-INF/lib/JDBC-10.2-latest-cubrid.jar + + + + kr.go.mgov + smeapi + 2.7 + system + ${basedir}/src/main/webapp/WEB-INF/lib/smeapi_2_7.jar + + + + kr.go.gpki + gpkisecureweb + 1.0.4.9 + system + ${basedir}/src/main/webapp/WEB-INF/lib/gpkisecureweb-1.0.4.9.jar + + + + kr.go.gpki + libgpkiapi_jni + 1.4.0.0 + system + ${basedir}/src/main/webapp/WEB-INF/lib/libgpkiapi_jni-1.4.0.0.jar + + + + org.springframework + spring-test + ${spring.maven.artifact.version} + test + + + + javax.inject + javax.inject + 1 + test + + + + javax.annotation + javax.annotation-api + 1.2 + test + + + + junit + junit + 4.12 + test + + + + onepass-client + onepass-client + 2.0.0 + system + ${basedir}/src/main/webapp/WEB-INF/lib/onepass-client-2.0.0.jar + + + + + org.apache.tiles + tiles-extras + 3.0.8 + + + org.apache.tiles + tiles-servlet + 3.0.8 + + + org.apache.tiles + tiles-jsp + 3.0.8 + + + + + + org.jsoup + jsoup + 1.17.1 + + + + + + + install + ${basedir}/target + ${artifactId}-${version} + + + + org.apache.tomcat.maven + tomcat7-maven-plugin + 2.2 + + 80 + / + + -Xms256m -Xmx768m -XX:MaxPermSize=256m + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + UTF-8 + + + + org.apache.maven.plugins + maven-war-plugin + 2.4 + + false + + + + org.codehaus.mojo + hibernate3-maven-plugin + 3.0 + + + + hbm2ddl + annotationconfiguration + + + + + + org.hsqldb + hsqldb + 2.5.0 + + + + + + org.codehaus.mojo + emma-maven-plugin + 1.0-alpha-3 + + + + org.apache.maven.plugins + maven-pmd-plugin + 3.12.0 + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + true + once + xml + + **/Abstract*.java + **/*Suite.java + + + **/*Test.java + + + + + org.codehaus.mojo + emma-maven-plugin + true + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.1.1 + + + + + ${basedir}/target/site + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 3.0.0 + + + sunlink + + javadoc + + true + + + http://docs.oracle.com/javase/6/docs/api/ + + + + + + + + org.codehaus.mojo + emma-maven-plugin + true + + + org.codehaus.mojo + surefire-report-maven-plugin + true + + + + report-only + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + 128m + 512m + ${encoding} + ${encoding} + ${encoding} + + + + + org.apache.maven.plugins + maven-jxr-plugin + + ${encoding} + ${encoding} + true + apidocs + + + + + \ No newline at end of file diff --git a/src/main/java/egovframework/com/cmm/AltibaseClobStringTypeHandler.java b/src/main/java/egovframework/com/cmm/AltibaseClobStringTypeHandler.java new file mode 100644 index 0000000..54a9322 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/AltibaseClobStringTypeHandler.java @@ -0,0 +1,121 @@ +package egovframework.com.cmm; +/* + * Copyright 2002-2005 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.io.IOException; +import java.io.Reader; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.jdbc.support.lob.LobCreator; +import org.springframework.jdbc.support.lob.LobHandler; + +import org.egovframe.rte.psl.orm.ibatis.support.AbstractLobTypeHandler; + +/** + * iBATIS TypeHandler implementation for Strings that get mapped to CLOBs. + * Retrieves the LobHandler to use from SqlMapClientFactoryBean at config time. + * + *

Particularly useful for storing Strings with more than 4000 characters in an + * Oracle database (only possible via CLOBs), in combination with OracleLobHandler. + * + *

Can also be defined in generic iBATIS mappings, as DefaultLobCreator will + * work with most JDBC-compliant database drivers. In this case, the field type + * does not have to be BLOB: For databases like MySQL and MS SQL Server, any + * large enough binary type will work. + * + * @author Juergen Hoeller + * @since 1.1.5 + * @see org.springframework.orm.ibatis.SqlMapClientFactoryBean#setLobHandler + * + * + * 수정일 수정자 수정내용 + * ------- -------- --------------------------- + * 2017.03.03 조성원 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + * + * + */ +@SuppressWarnings("deprecation") +public class AltibaseClobStringTypeHandler extends AbstractLobTypeHandler { + + private static final Logger LOGGER = LoggerFactory.getLogger(AltibaseClobStringTypeHandler.class); + + /** + * Constructor used by iBATIS: fetches config-time LobHandler from + * SqlMapClientFactoryBean. + * @see org.springframework.orm.ibatis.SqlMapClientFactoryBean#getConfigTimeLobHandler + */ + public AltibaseClobStringTypeHandler() { + super(); + } + + /** + * Constructor used for testing: takes an explicit LobHandler. + */ + protected AltibaseClobStringTypeHandler(LobHandler lobHandler) { + super(lobHandler); + } + + protected void setParameterInternal( + PreparedStatement ps, int index, Object value, String jdbcType, LobCreator lobCreator) + throws SQLException { + lobCreator.setClobAsString(ps, index, (String) value); + } + + + protected Object getResultInternal(ResultSet rs, int index, LobHandler lobHandler) + throws SQLException { + + StringBuffer read_data = new StringBuffer(""); + int read_length; + + char [] buf = new char[1024]; + + Reader rd = lobHandler.getClobAsCharacterStream(rs, index); + try { + while( (read_length=rd.read(buf)) != -1) { + read_data.append(buf, 0, read_length); + } + } catch (IOException ie) { + SQLException sqle = new SQLException(ie.getMessage()); + throw sqle; + // 2011.10.10 보안점검 후속조치 + } finally { + if (rd != null) { + try { + rd.close(); + //2017.03.03 조성원 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + } catch (IOException ignore) { + LOGGER.error("[IOException] : Connection Close"); + } catch (Exception ignore) { + LOGGER.error("["+ ignore.getClass() +"] Connection Close : " + ignore.getMessage()); + } + } + } + + return read_data.toString(); + + //return lobHandler.getClobAsString(rs, index); + } + + public Object valueOf(String s) { + return s; + } + +} diff --git a/src/main/java/egovframework/com/cmm/ComDefaultCodeVO.java b/src/main/java/egovframework/com/cmm/ComDefaultCodeVO.java new file mode 100644 index 0000000..04e5518 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/ComDefaultCodeVO.java @@ -0,0 +1,185 @@ +package egovframework.com.cmm; + +import java.io.Serializable; + +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * 클래스 + * @author 공통서비스개발팀 이삼섭 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *

+ * << 개정이력(Modification Information) >>
+ *   
+ *   수정일      수정자           수정내용
+ *  -------       --------    ---------------------------
+ *   2009.3.11   이삼섭          최초 생성
+ *
+ * 
+ */ +@SuppressWarnings("serial") +public class ComDefaultCodeVO implements Serializable { + /** 코드 ID */ + private String codeId = ""; + + /** 상세코드 */ + private String code = ""; + + /** 코드명 */ + private String codeNm = ""; + + /** 코드설명 */ + private String codeDc = ""; + + /** 특정테이블명 */ + private String tableNm = ""; //특정테이블에서 코드정보를추출시 사용 + + /** 상세 조건 여부 */ + private String haveDetailCondition = "N"; + + /** 상세 조건 */ + private String detailCondition = ""; + + /** + * codeId attribute를 리턴한다. + * + * @return the codeId + */ + public String getCodeId() { + return codeId; + } + + /** + * codeId attribute 값을 설정한다. + * + * @param codeId + * the codeId to set + */ + public void setCodeId(String codeId) { + this.codeId = codeId; + } + + /** + * code attribute를 리턴한다. + * + * @return the code + */ + public String getCode() { + return code; + } + + /** + * code attribute 값을 설정한다. + * + * @param code + * the code to set + */ + public void setCode(String code) { + this.code = code; + } + + /** + * codeNm attribute를 리턴한다. + * + * @return the codeNm + */ + public String getCodeNm() { + return codeNm; + } + + /** + * codeNm attribute 값을 설정한다. + * + * @param codeNm + * the codeNm to set + */ + public void setCodeNm(String codeNm) { + this.codeNm = codeNm; + } + + /** + * codeDc attribute를 리턴한다. + * + * @return the codeDc + */ + public String getCodeDc() { + return codeDc; + } + + /** + * codeDc attribute 값을 설정한다. + * + * @param codeDc + * the codeDc to set + */ + public void setCodeDc(String codeDc) { + this.codeDc = codeDc; + } + + /** + * tableNm attribute를 리턴한다. + * + * @return the tableNm + */ + public String getTableNm() { + return tableNm; + } + + /** + * tableNm attribute 값을 설정한다. + * + * @param tableNm + * the tableNm to set + */ + public void setTableNm(String tableNm) { + this.tableNm = tableNm; + } + + /** + * haveDetailCondition attribute를 리턴한다. + * + * @return the haveDetailCondition + */ + public String getHaveDetailCondition() { + return haveDetailCondition; + } + + /** + * haveDetailCondition attribute 값을 설정한다. + * + * @param haveDetailCondition + * the haveDetailCondition to set + */ + public void setHaveDetailCondition(String haveDetailCondition) { + this.haveDetailCondition = haveDetailCondition; + } + + /** + * detailCondition attribute를 리턴한다. + * + * @return the detailCondition + */ + public String getDetailCondition() { + return detailCondition; + } + + /** + * detailCondition attribute 값을 설정한다. + * + * @param detailCondition + * the detailCondition to set + */ + public void setDetailCondition(String detailCondition) { + this.detailCondition = detailCondition; + } + + /** + * toString 메소드를 대치한다. + */ + public String toString() { + return ToStringBuilder.reflectionToString(this); + } +} diff --git a/src/main/java/egovframework/com/cmm/ComDefaultVO.java b/src/main/java/egovframework/com/cmm/ComDefaultVO.java new file mode 100644 index 0000000..fe8d182 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/ComDefaultVO.java @@ -0,0 +1,167 @@ +package egovframework.com.cmm; + +import java.io.Serializable; + +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * @Class Name : ComDefaultVO.java + * @Description : ComDefaultVO class + * @Modification Information + * @ + * @ 수정일 수정자 수정내용 + * @ ------- -------- --------------------------- + * @ 2009.02.01 조재영 최초 생성 + * + * @author 공통서비스 개발팀 조재영 + * @since 2009.02.01 + * @version 1.0 + * @see + * + */ +@SuppressWarnings("serial") +public class ComDefaultVO implements Serializable { + + /** 검색조건 */ + private String searchCondition = ""; + + /** 검색Keyword */ + private String searchKeyword = ""; + + /** 검색사용여부 */ + private String searchUseYn = ""; + + /** 현재페이지 */ + private int pageIndex = 1; + + /** 페이지갯수 */ + private int pageUnit = 10; + + /** 페이지사이즈 */ + private int pageSize = 10; + + /** firstIndex */ + private int firstIndex = 1; + + /** lastIndex */ + private int lastIndex = 1; + + /** recordCountPerPage */ + private int recordCountPerPage = 10; + + /** 검색KeywordFrom */ + private String searchKeywordFrom = ""; + + /** 검색KeywordTo */ + private String searchKeywordTo = ""; + + public int getFirstIndex() { + return firstIndex; + } + + public void setFirstIndex(int firstIndex) { + this.firstIndex = firstIndex; + } + + public int getLastIndex() { + return lastIndex; + } + + public void setLastIndex(int lastIndex) { + this.lastIndex = lastIndex; + } + + public int getRecordCountPerPage() { + return recordCountPerPage; + } + + public void setRecordCountPerPage(int recordCountPerPage) { + this.recordCountPerPage = recordCountPerPage; + } + + public String getSearchCondition() { + return searchCondition; + } + + public void setSearchCondition(String searchCondition) { + this.searchCondition = searchCondition; + } + + public String getSearchKeyword() { + return searchKeyword; + } + + public void setSearchKeyword(String searchKeyword) { + this.searchKeyword = searchKeyword; + } + + public String getSearchUseYn() { + return searchUseYn; + } + + public void setSearchUseYn(String searchUseYn) { + this.searchUseYn = searchUseYn; + } + + public int getPageIndex() { + return pageIndex; + } + + public void setPageIndex(int pageIndex) { + this.pageIndex = pageIndex; + } + + public int getPageUnit() { + return pageUnit; + } + + public void setPageUnit(int pageUnit) { + this.pageUnit = pageUnit; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public String toString() { + return ToStringBuilder.reflectionToString(this); + } + + + /** + * searchKeywordFrom attribute를 리턴한다. + * @return String + */ + public String getSearchKeywordFrom() { + return searchKeywordFrom; + } + + /** + * searchKeywordFrom attribute 값을 설정한다. + * @param searchKeywordFrom String + */ + public void setSearchKeywordFrom(String searchKeywordFrom) { + this.searchKeywordFrom = searchKeywordFrom; + } + + /** + * searchKeywordTo attribute를 리턴한다. + * @return String + */ + public String getSearchKeywordTo() { + return searchKeywordTo; + } + + /** + * searchKeywordTo attribute 값을 설정한다. + * @param searchKeywordTo String + */ + public void setSearchKeywordTo(String searchKeywordTo) { + this.searchKeywordTo = searchKeywordTo; + } + +} diff --git a/src/main/java/egovframework/com/cmm/EgovBrowserUtil.java b/src/main/java/egovframework/com/cmm/EgovBrowserUtil.java new file mode 100644 index 0000000..df62ec0 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/EgovBrowserUtil.java @@ -0,0 +1,184 @@ +package egovframework.com.cmm; + +import java.net.URLEncoder; +import java.util.HashMap; +import javax.servlet.http.HttpServletRequest; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * 웹브라우저 종류및 버전 파악하기 ( IE및 Edge, Safari, Chrome, Firefox, Opera ) + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *   수정일              수정자              수정내용
+ *  -----------  --------    ---------------------------
+ *   2018.08.27  신용호              최초 생성
+ *
+ * 
+ */ + +public class EgovBrowserUtil { + + public static final String FIREFOX = "Firefox"; + public static final String SAFARI = "Safari"; + public static final String CHROME = "Chrome"; + public static final String OPERA = "Opera"; + public static final String MSIE = "MSIE"; + public static final String EDGE = "Edge"; + public static final String OTHER = "Other"; + + public static final String TYPEKEY = "type"; + public static final String VERSIONKEY = "version"; + + public static HashMap getBrowser(String userAgent) { + + HashMap result = new HashMap(); + Pattern pattern = null; + Matcher matcher = null; + //System.out.println("=====>>>>> userAgent = "+userAgent); + + pattern = Pattern.compile("MSIE ([0-9]{1,2}.[0-9])"); + matcher = pattern.matcher(userAgent); + if (matcher.find()) + { + result.put(TYPEKEY,MSIE); + result.put(VERSIONKEY,matcher.group(1)); + return result; + } + + if (userAgent.indexOf("Trident/7.0") > -1) { + result.put(TYPEKEY,MSIE); + result.put(VERSIONKEY,"11.0"); + return result; + } + + pattern = Pattern.compile("Edge/([0-9]{1,3}.[0-9]{1,5})"); + matcher = pattern.matcher(userAgent); + if (matcher.find()) + { + result.put(TYPEKEY,EDGE); + result.put(VERSIONKEY,matcher.group(1)); + return result; + } + + pattern = Pattern.compile("Firefox/([0-9]{1,3}.[0-9]{1,3})"); + matcher = pattern.matcher(userAgent); + if (matcher.find()) + { + result.put(TYPEKEY,FIREFOX); + result.put(VERSIONKEY,matcher.group(1)); + return result; + } + + pattern = Pattern.compile("OPR/([0-9]{1,3}.[0-9]{1,3})"); + matcher = pattern.matcher(userAgent); + if (matcher.find()) + { + result.put(TYPEKEY,OPERA); + result.put(VERSIONKEY,matcher.group(1)); + return result; + } + + pattern = Pattern.compile("Chrome/([0-9]{1,3}.[0-9]{1,3})"); + matcher = pattern.matcher(userAgent); + if (matcher.find()) + { + result.put(TYPEKEY,CHROME); + result.put(VERSIONKEY,matcher.group(1)); + return result; + } + + pattern = Pattern.compile("Version/([0-9]{1,2}.[0-9]{1,3})"); + matcher = pattern.matcher(userAgent); + if (matcher.find()) + { + result.put(TYPEKEY,SAFARI); + result.put(VERSIONKEY,matcher.group(1)); + return result; + } + + result.put(TYPEKEY,OTHER); + result.put(VERSIONKEY,"0.0"); + return result; + } + + public static String getDisposition(String filename, String userAgent, String charSet) throws Exception { + + String encodedFilename = null; + HashMap result = EgovBrowserUtil.getBrowser(userAgent); + float version = Float.parseFloat(result.get(EgovBrowserUtil.VERSIONKEY)); + //System.out.println("=====>>>>> browser type = "+result.get(TYPEKEY)); + //System.out.println("=====>>>>> browser version = "+result.get(VERSIONKEY)); + //System.out.println("=====>>>>> filename = "+filename); + + if ( EgovBrowserUtil.MSIE.equals(result.get(EgovBrowserUtil.TYPEKEY)) && version <= 8.0f ) { + encodedFilename = "Content-Disposition: attachment; filename="+URLEncoder.encode(filename, charSet).replaceAll("\\+", "%20"); + } else if ( EgovBrowserUtil.OTHER.equals(result.get(EgovBrowserUtil.TYPEKEY)) ) { + throw new RuntimeException("Not supported browser"); + } else { + encodedFilename = "attachment; filename*="+charSet+"''"+URLEncoder.encode(filename, charSet); + } + + return encodedFilename; + } + + //KISA 보안약점 조치 (2018-10-29, 윤창원) +/* public static void main(String[] args) { + // TODO Auto-generated method stub + String testUserAgent[] = { + // IE 7.0 + "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)" + ,"Mozilla/4.0 (Mozilla/4.0; MSIE 7.0; Windows NT 5.1; FDM; SV1; .NET CLR 3.0.04506.30)" + // IE 8.0 + ,"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)" + // IE 9.0 + ,"Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)" + // IE 10.0 + ,"Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)" + // IE 11.0 + ,"Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko" + // Chrome 68.0.3440.106 + ,"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36" + // Edge 17.17134 + ,"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134" + // Opera 55.0.2994.44 + ,"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36 OPR/55.0.2994.44" + ,"Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36 OPR/26.0.1656.60" + // Firefox 61.0 + ,"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0" + // Safari 11.1.2 + ,"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.2 Safari/605.1.15" + // iPhone 11.0 + ,"Mozilla/5.0 (iPhone; CPU iPhone OS 11_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1" + // iPad 9.0 + ,"Mozilla/5.0 (iPad; CPU OS 9_3_5 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13G36 Safari/601.1" + // Window Pohone 10 + ,"Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Nokia; Lumia 520) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Mobile Safari/537.36 Edge/12.0" + // Window Pohone 8.1 + ,"Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 520) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537" + // Window Pohone 8 + ,"Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch)" + // Window Pohone 7 + ,"Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0)" + // XBOX One + ,"Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0; Xbox; Xbox One)" + // XBOX 360 + ,"Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; Xbox)" + }; + + HashMap result = null; + for (int i = 0; i < testUserAgent.length; i++) { + result = getBrowser(testUserAgent[i]); + System.out.println("1. User Agent : "+testUserAgent[i]); + System.out.println("2. Browser Type : "+result.get(TYPEKEY)); + System.out.println("2. Browser Version : "+result.get(VERSIONKEY)); + //System.out.println("2. Browser Version convert: "+Float.parseFloat(result.get(VERSIONKEY))); + System.out.println(""); + } + + }*/ + +} diff --git a/src/main/java/egovframework/com/cmm/EgovComCrossSiteHndlr.java b/src/main/java/egovframework/com/cmm/EgovComCrossSiteHndlr.java new file mode 100644 index 0000000..2e34539 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/EgovComCrossSiteHndlr.java @@ -0,0 +1,405 @@ +package egovframework.com.cmm; + +import java.io.IOException; +import java.io.Reader; + +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.JspWriter; +import javax.servlet.jsp.PageContext; +import javax.servlet.jsp.tagext.BodyTagSupport; + +import org.apache.taglibs.standard.tag.common.core.Util; + +/** + * Cross-Site Scripting 체크하여 값을 되돌려 받는 핸들러 JSP TLD, 자바에서 사용가능 + * + * @author 공통서비스 장동한 + * @since 2010.11.09 + * @version 1.0 + * @see
+ * << 개정이력(Modification Information) >>
+ *
+ *   수정일      수정자           수정내용
+ *  -------    --------    ---------------------------
+ *   2010.11.09  장동한          최초 생성
+ *
+ * 
+ */ +@SuppressWarnings("serial") +public class EgovComCrossSiteHndlr extends BodyTagSupport { + + /* + * (One almost wishes XML and JSP could support "anonymous tags," given the + * amount of trouble we had naming this one!) :-) - sb + */ + + // ********************************************************************* + // Internal state + + protected Object value; // tag attribute + protected String def; // tag attribute + protected boolean escapeXml; // tag attribute + private boolean needBody; // non-space body needed? + + // ********************************************************************* + // Construction and initialization + + private final String m_sDiffChar ="()[]{}\"',:;= \t\r\n%!+-"; + //private String m_sDiffChar ="()[]{}\"',:;=%!+-"; + private final String m_sArrDiffChar [] = { + "(",")", + "[","]", + "{","}", + ""","'", + ",",":", + ";","=", + " ","\t", //" ","\t", + "\r","\n", //"\r","\n", + "%","!", + "+","-" + }; + + /** + * Constructs a new handler. As with TagSupport, subclasses should not + * provide other constructors and are expected to call the superclass + * constructor. + */ + public EgovComCrossSiteHndlr() { + super(); + init(); + } + + // resets local state + private void init() { + value = def = null; + escapeXml = true; + needBody = false; + } + + // Releases any resources we may have (or inherit) + public void release() { + super.release(); + init(); + } + + // ********************************************************************* + // Tag logic + + // evaluates 'value' and determines if the body should be evaluted + public int doStartTag() throws JspException { + + needBody = false; // reset state related to 'default' + this.bodyContent = null; // clean-up body (just in case container is + // pooling tag handlers) + + JspWriter out = pageContext.getOut(); + //System.out.println("EgovComCrossSiteFilter> ============================"); + try { + // print value if available; otherwise, try 'default' + if (value != null) { + //System.out.println("EgovComCrossSiteFilter> =value"); + String sWriteEscapedXml = getWriteEscapedXml(); + //System.out.println("EgovComCrossSiteFilter sWriteEscapedXml>" + sWriteEscapedXml); + out.print(sWriteEscapedXml); + return SKIP_BODY; + } else { + // if we don't have a 'default' attribute, just go to the body + if (def == null) { + needBody = true; + return EVAL_BODY_BUFFERED; + } + + //System.out.println("EgovComCrossSiteFilter def> ="+def); + + // if we do have 'default', print it + if (def != null) { + // good 'default' + out(pageContext, escapeXml, def); + //System.out.println("EgovComCrossSiteFilter> ="+def); + } + return SKIP_BODY; + } + } catch (IOException ex) { + throw new JspException(ex.toString(), ex); + } + } + + // prints the body if necessary; reports errors + public int doEndTag() throws JspException { + try { + //System.out.println("EgovComCrossSiteFilter ==== doEndTag"); + if (!needBody){ + return EVAL_PAGE; // nothing more to do + } + + // trim and print out the body + if (bodyContent != null && bodyContent.getString() != null){ + //String sWriteEscapedXml = getWriteEscapedXml(); + //out2(pageContext, escapeXml, sWriteEscapedXml.toString()); + //System.out.println("EgovComCrossSiteFilter> end"); + //System.out.println("EgovComCrossSiteFilter sWriteEscapedXml > sWriteEscapedXml"); + out(pageContext, escapeXml, bodyContent.getString().trim()); + + } + return EVAL_PAGE; + } catch (IOException ex) { + throw new JspException(ex.toString(), ex); + } + } + + // ********************************************************************* + // Public utility methods + + /** + * Outputs text to pageContext's current JspWriter. If + * escapeXml is true, performs the following substring replacements + * (to facilitate output to XML/HTML pages): + * + * & -> & < -> < > -> > " -> " ' -> ' + * + * See also Util.escapeXml(). + */ + public static void out(PageContext pageContext, boolean escapeXml, + Object obj) throws IOException { + JspWriter w = pageContext.getOut(); + + if (!escapeXml) { + // write chars as is + if (obj instanceof Reader) { + Reader reader = (Reader) obj; + char[] buf = new char[4096]; + int count; + while ((count = reader.read(buf, 0, 4096)) != -1) { + w.write(buf, 0, count); + } + } else { + w.write(obj.toString()); + } + } else { + // escape XML chars + if (obj instanceof Reader) { + Reader reader = (Reader) obj; + char[] buf = new char[4096]; + int count; + while ((count = reader.read(buf, 0, 4096)) != -1) { + writeEscapedXml(buf, count, w); + } + } else { + String text = obj.toString(); + writeEscapedXml(text.toCharArray(), text.length(), w); + } + } + + } + public static void out2(PageContext pageContext, boolean escapeXml, + Object obj) throws IOException { + JspWriter w = pageContext.getOut(); + + w.write(obj.toString()); + + } + + /** + * + * Optimized to create no extra objects and write directly to the JspWriter + * using blocks of escaped and unescaped characters + * + */ + private static void writeEscapedXml(char[] buffer, int length, JspWriter w) + throws IOException { + int start = 0; + + for (int i = 0; i < length; i++) { + char c = buffer[i]; + if (c <= Util.HIGHEST_SPECIAL) { + char[] escaped = Util.specialCharactersRepresentation[c]; + if (escaped != null) { + // add unescaped portion + if (start < i) { + w.write(buffer, start, i - start); + } + // add escaped xml + w.write(escaped); + start = i + 1; + } + } + } + // add rest of unescaped portion + if (start < length) { + w.write(buffer, start, length - start); + } + } + + /** + * + * Optimized to create no extra objects and write directly to the JspWriter + * using blocks of escaped and unescaped characters + * + */ + @SuppressWarnings("unused") + private String getWriteEscapedXml() throws IOException { + String sRtn = ""; + + Object obj = this.value; + + int start = 0; + String text = obj.toString(); + + int length = text.length(); + char[] buffer = text.toCharArray(); + boolean booleanDiff = false; + //String sDiffChar + //String sArrDiffChar + char[] cDiffChar = this.m_sDiffChar.toCharArray(); + + for(int i = 0; i < length; i++) { + char c = buffer[i]; + + booleanDiff = false; + + for(int k = 0; k < cDiffChar.length; k++){ + if(c == cDiffChar[k]){ + sRtn = sRtn + m_sArrDiffChar[k]; + booleanDiff = true; + continue; + } + } + + if(booleanDiff) continue; + + if (c <= Util.HIGHEST_SPECIAL) { + char[] escaped = Util.specialCharactersRepresentation[c]; + if (escaped != null) { + // add unescaped portion + //if (start < i) { + // sRtn = sRtn + text.substring(start, i - start); + //} + // add escaped xml + //sRtn = sRtn + escaped; + //System.out.println(buffer[i]+" :: " + escaped); + for (int j = 0; j < escaped.length; j++) { + //System.out.println(buffer[i]+" :>: " + escaped[j]); + sRtn = sRtn + escaped[j]; + } + //sRtn = sRtn+ escaped.toString(); + //sRtn = sRtn + String.valueOf(buffer[i]); + start = i + 1; + }else{ + sRtn = sRtn + c; + } + }else{ + sRtn = sRtn + c; + } + } + + return sRtn; + } + + /** + * + * Optimized to create no extra objects and write directly to the JspWriter + * using blocks of escaped and unescaped characters + * + */ + @SuppressWarnings("unused") + private String getWriteEscapedXml(String sWriteString) throws IOException { + + String sRtn = ""; + + Object obj = sWriteString; + + int start = 0; + String text = obj.toString(); + + int length = text.length(); + char[] buffer = text.toCharArray(); + boolean booleanDiff = false; + //String sDiffChar + //String sArrDiffChar + char[] cDiffChar = this.m_sDiffChar.toCharArray(); + + for(int i = 0; i < length; i++) { + char c = buffer[i]; + + booleanDiff = false; + + for(int k = 0; k < cDiffChar.length; k++){ + if(c == cDiffChar[k]){ + sRtn = sRtn + m_sArrDiffChar[k]; + booleanDiff = true; + continue; + } + } + + if(booleanDiff) continue; + + if (c <= Util.HIGHEST_SPECIAL) { + char[] escaped = Util.specialCharactersRepresentation[c]; + if (escaped != null) { + // add unescaped portion + //if (start < i) { + // sRtn = sRtn + text.substring(start, i - start); + //} + // add escaped xml + //sRtn = sRtn + escaped; + //System.out.println(buffer[i]+" :: " + escaped); + for (int j = 0; j < escaped.length; j++) { + //System.out.println(buffer[i]+" :>: " + escaped[j]); + sRtn = sRtn + escaped[j]; + } + //sRtn = sRtn+ escaped.toString(); + //sRtn = sRtn + String.valueOf(buffer[i]); + start = i + 1; + }else{ + sRtn = sRtn + c; + } + }else{ + sRtn = sRtn + c; + } + } + + return sRtn; + } + + // for tag attribute + public void setValue(Object value) { + this.value = value; + } + + // for tag attribute + public void setDefault(String def) { + this.def = def; + } + + // for tag attribute + public void setEscapeXml(boolean escapeXml) { + this.escapeXml = escapeXml; + } + + /** 2011.10.10 cmd 라인상에서 편의제공을 위해 제공, 필요없을시 삭제하여도 무방함 + public static void main(String[] args) throws IOException + { + + EgovComCrossSiteHndlr egovComCrossSiteHndlr = new EgovComCrossSiteHndlr(); + + egovComCrossSiteHndlr.value = "TRNSMIT"; + + String sCrossSiteHndlr = egovComCrossSiteHndlr.getWriteEscapedXml(); + //System.out.println("writeEscapedXml " + egovComCrossSiteHndlr.getWriteEscapedXml()); + /* + System.out.println("sCrossSiteHndlr|"+ sCrossSiteHndlr + "|"); + + try{ + System.out.println("TRY TEST 1"); + throw new Exception(); + }catch(Exception e){ + System.out.println("TRY TEST 2"); + }finally{ + System.out.println("TRY TEST 3"); + + } + } + */ + } + + diff --git a/src/main/java/egovframework/com/cmm/EgovComExcepHndlr.java b/src/main/java/egovframework/com/cmm/EgovComExcepHndlr.java new file mode 100644 index 0000000..3989e9c --- /dev/null +++ b/src/main/java/egovframework/com/cmm/EgovComExcepHndlr.java @@ -0,0 +1,48 @@ +package egovframework.com.cmm; + +import org.egovframe.rte.fdl.cmmn.exception.handler.ExceptionHandler; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @Class Name : EgovComExcepHndlr.java + * @Description : 공통서비스의 exception 처리 클래스 + * @Modification Information + * + * 수정일 수정자 수정내용 + * ------- ------- ------------------- + * 2009. 3. 13. 이삼섭 + * + * @author 공통 서비스 개발팀 이삼섭 + * @since 2009. 3. 13. + * @version + * @see + * + */ +public class EgovComExcepHndlr implements ExceptionHandler { + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovComExcepHndlr.class); + + /* + @Resource(name = "otherSSLMailSender") + private SimpleSSLMail mailSender; + */ + /** + * 발생된 Exception을 처리한다. + */ + public void occur(Exception ex, String packageName) { + //log.debug(" EgovServiceExceptionHandler run..............."); + + /* + try { + mailSender. send(ex, packageName); + log.debug(" sending a alert mail is completed "); + } catch (Exception e) { + LOGGER.error(packageName, ex); + } + */ + + LOGGER.error(packageName, ex); + } +} diff --git a/src/main/java/egovframework/com/cmm/EgovComOthersExcepHndlr.java b/src/main/java/egovframework/com/cmm/EgovComOthersExcepHndlr.java new file mode 100644 index 0000000..3187075 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/EgovComOthersExcepHndlr.java @@ -0,0 +1,16 @@ +package egovframework.com.cmm; + +import org.egovframe.rte.fdl.cmmn.exception.handler.ExceptionHandler; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class EgovComOthersExcepHndlr implements ExceptionHandler { + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovComOthersExcepHndlr.class); + + public void occur(Exception exception, String packageName) { + //log.debug(" EgovServiceExceptionHandler run..............."); + LOGGER.error(packageName, exception); + } +} diff --git a/src/main/java/egovframework/com/cmm/EgovComponentChecker.java b/src/main/java/egovframework/com/cmm/EgovComponentChecker.java new file mode 100644 index 0000000..92ca805 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/EgovComponentChecker.java @@ -0,0 +1,65 @@ +package egovframework.com.cmm; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.NoSuchBeanDefinitionException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Service; + + +/** + * EgovComUtil 클래스 + * + * @author 서준식 + * @since 2011.09.15 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *   
+ *   수정일      수정자           수정내용
+ *  -------    -------------    ----------------------
+ *   2011.09.15  서준식        최초 생성
+ * 
+ */ + +@Service("egovUtil") +public class EgovComponentChecker extends EgovAbstractServiceImpl implements ApplicationContextAware{ + + + public static ApplicationContext context; + + @SuppressWarnings("static-access") + public void setApplicationContext(ApplicationContext context) + throws BeansException { + + this.context = context; + } + + + /** + * Spring MVC에서 설정한 빈이 아닌 서비스 빈(컴포넌트)만을 검색할 수 있음 + * + */ + public static boolean hasComponent(String componentName){ + + try{ + Object component = context.getBean(componentName); + + if(component == null){ + return false; + }else{ + return true; + } + + }catch(NoSuchBeanDefinitionException ex){// 해당 컴포넌트를 찾을 수없을 경우 false반환 + return false; + } + } + + + +} diff --git a/src/main/java/egovframework/com/cmm/EgovMessageSource.java b/src/main/java/egovframework/com/cmm/EgovMessageSource.java new file mode 100644 index 0000000..77e3d31 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/EgovMessageSource.java @@ -0,0 +1,87 @@ +package egovframework.com.cmm; + +import java.util.Locale; + +import org.springframework.context.MessageSource; +import org.springframework.context.support.ReloadableResourceBundleMessageSource; + +/** + * 메시지 리소스 사용을 위한 MessageSource 인터페이스 및 ReloadableResourceBundleMessageSource 클래스의 구현체 + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *   
+ *   수정일      수정자           수정내용
+ *  -------    --------    ---------------------------
+ *   2009.03.11  이문준          최초 생성
+ *   2017.07.21  장동한 			args, locale 설정
+ *
+ * 
+ */ + +public class EgovMessageSource extends ReloadableResourceBundleMessageSource implements MessageSource { + + private ReloadableResourceBundleMessageSource reloadableResourceBundleMessageSource; + + /** + * getReloadableResourceBundleMessageSource() + * @param reloadableResourceBundleMessageSource - resource MessageSource + * @return ReloadableResourceBundleMessageSource + */ + public void setReloadableResourceBundleMessageSource(ReloadableResourceBundleMessageSource reloadableResourceBundleMessageSource) { + this.reloadableResourceBundleMessageSource = reloadableResourceBundleMessageSource; + } + + /** + * getReloadableResourceBundleMessageSource() + * @return ReloadableResourceBundleMessageSource + */ + public ReloadableResourceBundleMessageSource getReloadableResourceBundleMessageSource() { + return reloadableResourceBundleMessageSource; + } + + /** + * 정의된 메세지 조회 + * @param code - 메세지 코드 + * @return String + */ + public String getMessage(String code) { + return getReloadableResourceBundleMessageSource().getMessage(code, null, Locale.getDefault()); + } + + /** + * 정의된 메세지 조회 + * @param code - 메세지 코드 + * @param locale - 로케일 + * @return String + */ + public String getMessage(String code, Locale locale) { + return getReloadableResourceBundleMessageSource().getMessage(code, null, locale); + } + + /** + * 정의된 메세지 조회 + * @param code - 메세지 코드 + * @param args - 매개변수 + * @return String + */ + public String getMessageArgs(String code, Object[] args) { + return getReloadableResourceBundleMessageSource().getMessage(code, args, Locale.getDefault()); + } + + /** + * 정의된 메세지 조회 + * @param code - 메세지 코드 + * @param args - 매개변수 + * @param locale - 로케일 + * @return String + */ + public String getMessageArgsLocale(String code, Object[] args, Locale locale) { + return getReloadableResourceBundleMessageSource().getMessage(code, args, locale); + } + +} diff --git a/src/main/java/egovframework/com/cmm/EgovWebUtil.java b/src/main/java/egovframework/com/cmm/EgovWebUtil.java new file mode 100644 index 0000000..4cda52a --- /dev/null +++ b/src/main/java/egovframework/com/cmm/EgovWebUtil.java @@ -0,0 +1,155 @@ +package egovframework.com.cmm; + +import java.util.regex.Pattern; + +/** + * 교차접속 스크립트 공격 취약성 방지(파라미터 문자열 교체) + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *   수정일              수정자           수정내용
+ *  -----------  --------  ---------------------------
+ *   2011.10.10  한성곤           최초 생성
+ *	 2017-02-07   이정은           시큐어코딩(ES) - 시큐어코딩 경로 조작 및 자원 삽입[CWE-22, CWE-23, CWE-95, CWE-99]
+ *   2018.08.17  신용호           filePathBlackList 수정
+ *   2018.10.10  신용호           . => \\.으로 수정
+ * 
+ */ + +public class EgovWebUtil { + public static String clearXSSMinimum(String value) { + if (value == null || value.trim().equals("")) { + return ""; + } + + String returnValue = value; + + returnValue = returnValue.replaceAll("&", "&"); + returnValue = returnValue.replaceAll("<", "<"); + returnValue = returnValue.replaceAll(">", ">"); + returnValue = returnValue.replaceAll("\"", """); + returnValue = returnValue.replaceAll("\'", "'"); + returnValue = returnValue.replaceAll("\\.", "."); + returnValue = returnValue.replaceAll("%2E", "."); + returnValue = returnValue.replaceAll("%2F", "/"); + return returnValue; + } + + public static String clearXSSMaximum(String value) { + String returnValue = value; + returnValue = clearXSSMinimum(returnValue); + + returnValue = returnValue.replaceAll("%00", null); + + returnValue = returnValue.replaceAll("%", "%"); + + // \\. => . + + returnValue = returnValue.replaceAll("\\.\\./", ""); // ../ + returnValue = returnValue.replaceAll("\\.\\.\\\\", ""); // ..\ + returnValue = returnValue.replaceAll("\\./", ""); // ./ + returnValue = returnValue.replaceAll("%2F", ""); + + return returnValue; + } + + public static String filePathBlackList(String value) { + String returnValue = value; + if (returnValue == null || returnValue.trim().equals("")) { + return ""; + } + + returnValue = returnValue.replaceAll("\\.\\.", ""); + + return returnValue; + } + + /** + * 행안부 보안취약점 점검 조치 방안. + * + * @param value + * @return + */ + public static String filePathReplaceAll(String value) { + String returnValue = value; + if (returnValue == null || returnValue.trim().equals("")) { + return ""; + } + + returnValue = returnValue.replaceAll("/", ""); + returnValue = returnValue.replaceAll("\\", ""); + returnValue = returnValue.replaceAll("\\.\\.", ""); // .. + returnValue = returnValue.replaceAll("&", ""); + + return returnValue; + } + + public static String fileInjectPathReplaceAll(String value) { + String returnValue = value; + if (returnValue == null || returnValue.trim().equals("")) { + return ""; + } + + returnValue = returnValue.replaceAll("/", ""); + returnValue = returnValue.replaceAll("\\..", ""); // .. + returnValue = returnValue.replaceAll("\\\\", "");// \ + returnValue = returnValue.replaceAll("&", ""); + + return returnValue; + } + + public static String filePathWhiteList(String value) { + return value; + } + + public static boolean isIPAddress(String str) { + Pattern ipPattern = Pattern.compile("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"); + + return ipPattern.matcher(str).matches(); + } + + public static String removeCRLF(String parameter) { + return parameter.replaceAll("\r", "").replaceAll("\n", ""); + } + + public static String removeSQLInjectionRisk(String parameter) { + return parameter.replaceAll("\\p{Space}", "").replaceAll("\\*", "").replaceAll("%", "").replaceAll(";", "") + .replaceAll("-", "").replaceAll("\\+", "").replaceAll(",", ""); + } + + public static String removeOSCmdRisk(String parameter) { + return parameter.replaceAll("\\p{Space}", "").replaceAll("\\*", "").replaceAll("|", "").replaceAll(";", ""); + } + + /** + * LDAP 파라미터에서 특수문자 제거. + * 파라미터 별로 제거를 해야 함. + * 일괄 연결된 파라미터들은 따로 처리해야 함. + * TODO : LDAP Injection Prevent 로직 추가 필요 + * @param value + * @return + */ + public static String removeLDAPInjectionRisk(String value) { + + String returnValue = value; + if (returnValue == null || returnValue.trim().equals("")) { + return ""; + } + + /*모든 특수문자 제거*/ +// String match = "[^\uAC00-\uD7A30-9a-zA-Z]";//특수문자 = 한글,숫자,영문 제외 +// returnValue = returnValue.replaceAll(match, ""); + + /*특수문자 선택적 제거*/ + returnValue = returnValue.replaceAll("*", ""); + returnValue = returnValue.replaceAll("&", ""); + returnValue = returnValue.replaceAll("|", ""); + returnValue = returnValue.replaceAll("//", ""); + //... + //개별로 필요한 항목들 추가 필요 + + return returnValue; + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/cmm/ImagePaginationRenderer.java b/src/main/java/egovframework/com/cmm/ImagePaginationRenderer.java new file mode 100644 index 0000000..b5a1a49 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/ImagePaginationRenderer.java @@ -0,0 +1,53 @@ +package egovframework.com.cmm; + +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.AbstractPaginationRenderer; + +import javax.servlet.ServletContext; + +import org.springframework.web.context.ServletContextAware; +/** + * ImagePaginationRenderer.java 클래스 + * + * @author 서준식 + * @since 2011. 9. 16. + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *
+ *   수정일      수정자           수정내용
+ *  -------    -------------    ----------------------
+ *   2011. 9. 16.   서준식       이미지 경로에 ContextPath추가
+ *   2016. 6. 17.   장동한       표준프레임워크 v3.6 리뉴얼
+ * 
+ */ +public class ImagePaginationRenderer extends AbstractPaginationRenderer implements ServletContextAware{ + + private ServletContext servletContext; + + public ImagePaginationRenderer() { + + } + + public void initVariables(){ + + firstPageLabel = "
  • 첫 페이지
  • "; + previousPageLabel = "
  • 이전 페이지
  • "; + + currentPageLabel = "
  • {0}
  • "; + otherPageLabel = "
  • {2}
  • "; + + nextPageLabel = "
  • 다음 페이지
  • "; + lastPageLabel = "
  • 끝 페이지
  • "; + + } + + + + public void setServletContext(ServletContext servletContext) { + this.servletContext = servletContext; + initVariables(); + } + +} diff --git a/src/main/java/egovframework/com/cmm/IncludedCompInfoVO.java b/src/main/java/egovframework/com/cmm/IncludedCompInfoVO.java new file mode 100644 index 0000000..c4cfdbd --- /dev/null +++ b/src/main/java/egovframework/com/cmm/IncludedCompInfoVO.java @@ -0,0 +1,50 @@ +package egovframework.com.cmm; + +/** + * IncludedInfo annotation을 바탕으로 화면에 표시할 정보를 구성하기 위한 VO 클래스 + * @author 공통컴포넌트 정진오 + * @since 2011.08.26 + * @version 2.0.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *  수정일		수정자		수정내용
    + *  -------    	--------    ---------------------------
    + *  2011.08.26	정진오 		최초 생성
    + *
    + * 
    + */ +public class IncludedCompInfoVO { + + private String name; + private String listUrl; + private int order; + private int gid; + + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getListUrl() { + return listUrl; + } + public void setListUrl(String listUrl) { + this.listUrl = listUrl; + } + public int getOrder() { + return order; + } + public void setOrder(int order) { + this.order = order; + } + public int getGid() { + return gid; + } + public void setGid(int gid) { + this.gid = gid; + } +} diff --git a/src/main/java/egovframework/com/cmm/LoginVO.java b/src/main/java/egovframework/com/cmm/LoginVO.java new file mode 100644 index 0000000..b23c27c --- /dev/null +++ b/src/main/java/egovframework/com/cmm/LoginVO.java @@ -0,0 +1,285 @@ +package egovframework.com.cmm; + +import java.io.Serializable; + +/** + * @Class Name : LoginVO.java + * @Description : Login VO class + * @Modification Information + * @ + * @ 수정일 수정자 수정내용 + * @ ------- -------- --------------------------- + * @ 2009.03.03 박지욱 최초 생성 + * @ 2021.05.30 정진오 디지털원패스 사용자키/세션값 추가 + * + * @author 공통서비스 개발팀 박지욱 + * @since 2009.03.03 + * @version 1.0 + * @see + * + */ +public class LoginVO implements Serializable{ + + /** + * + */ + private static final long serialVersionUID = -8274004534207618049L; + + /** 아이디 */ + private String id; + /** 이름 */ + private String name; + /** 주민등록번호 */ + private String ihidNum; + /** 이메일주소 */ + private String email; + /** 비밀번호 */ + private String password; + /** 비밀번호 힌트 */ + private String passwordHint; + /** 비밀번호 정답 */ + private String passwordCnsr; + /** 사용자구분 */ + private String userSe; + /** 조직(부서)ID */ + private String orgnztId; + /** 조직(부서)명 */ + private String orgnztNm; + /** 고유아이디 */ + private String uniqId; + /** 로그인 후 이동할 페이지 */ + private String url; + /** 사용자 IP정보 */ + private String ip; + /** GPKI인증 DN */ + private String dn; + /** 디지털원패스 사용자키 */ + private String onepassUserkey; + /** 디지털원패스 사용자세션값 */ + private String onepassIntfToken; + + /** + * id attribute 를 리턴한다. + * @return String + */ + public String getId() { + return id; + } + /** + * id attribute 값을 설정한다. + * @param id String + */ + public void setId(String id) { + this.id = id; + } + /** + * name attribute 를 리턴한다. + * @return String + */ + public String getName() { + return name; + } + /** + * name attribute 값을 설정한다. + * @param name String + */ + public void setName(String name) { + this.name = name; + } + /** + * ihidNum attribute 를 리턴한다. + * @return String + */ + public String getIhidNum() { + return ihidNum; + } + /** + * ihidNum attribute 값을 설정한다. + * @param ihidNum String + */ + public void setIhidNum(String ihidNum) { + this.ihidNum = ihidNum; + } + /** + * email attribute 를 리턴한다. + * @return String + */ + public String getEmail() { + return email; + } + /** + * email attribute 값을 설정한다. + * @param email String + */ + public void setEmail(String email) { + this.email = email; + } + /** + * password attribute 를 리턴한다. + * @return String + */ + public String getPassword() { + return password; + } + /** + * password attribute 값을 설정한다. + * @param password String + */ + public void setPassword(String password) { + this.password = password; + } + /** + * passwordHint attribute 를 리턴한다. + * @return String + */ + public String getPasswordHint() { + return passwordHint; + } + /** + * passwordHint attribute 값을 설정한다. + * @param passwordHint String + */ + public void setPasswordHint(String passwordHint) { + this.passwordHint = passwordHint; + } + /** + * passwordCnsr attribute 를 리턴한다. + * @return String + */ + public String getPasswordCnsr() { + return passwordCnsr; + } + /** + * passwordCnsr attribute 값을 설정한다. + * @param passwordCnsr String + */ + public void setPasswordCnsr(String passwordCnsr) { + this.passwordCnsr = passwordCnsr; + } + /** + * userSe attribute 를 리턴한다. + * @return String + */ + public String getUserSe() { + return userSe; + } + /** + * userSe attribute 값을 설정한다. + * @param userSe String + */ + public void setUserSe(String userSe) { + this.userSe = userSe; + } + /** + * orgnztId attribute 를 리턴한다. + * @return String + */ + public String getOrgnztId() { + return orgnztId; + } + /** + * orgnztId attribute 값을 설정한다. + * @param orgnztId String + */ + public void setOrgnztId(String orgnztId) { + this.orgnztId = orgnztId; + } + /** + * uniqId attribute 를 리턴한다. + * @return String + */ + public String getUniqId() { + return uniqId; + } + /** + * uniqId attribute 값을 설정한다. + * @param uniqId String + */ + public void setUniqId(String uniqId) { + this.uniqId = uniqId; + } + /** + * url attribute 를 리턴한다. + * @return String + */ + public String getUrl() { + return url; + } + /** + * url attribute 값을 설정한다. + * @param url String + */ + public void setUrl(String url) { + this.url = url; + } + /** + * ip attribute 를 리턴한다. + * @return String + */ + public String getIp() { + return ip; + } + /** + * ip attribute 값을 설정한다. + * @param ip String + */ + public void setIp(String ip) { + this.ip = ip; + } + /** + * dn attribute 를 리턴한다. + * @return String + */ + public String getDn() { + return dn; + } + /** + * dn attribute 값을 설정한다. + * @param dn String + */ + public void setDn(String dn) { + this.dn = dn; + } + /** + * @return the orgnztNm + */ + public String getOrgnztNm() { + return orgnztNm; + } + /** + * @param orgnztNm the orgnztNm to set + */ + public void setOrgnztNm(String orgnztNm) { + this.orgnztNm = orgnztNm; + } + + /** + * 디지털원패스 사용자키를 리턴한다. + * @return onepassUserkey + */ + public String getOnepassUserkey() { + return onepassUserkey; + } + /** + * 디지털원패스 사용자키를 설정한다. + * @param onepassUserkey + */ + public void setOnepassUserkey(String onepassUserkey) { + this.onepassUserkey = onepassUserkey; + } + /** + * 디지털원패스 사용자세션값을 리턴한다. + * @return + */ + public String getOnepassIntfToken() { + return onepassIntfToken; + } + /** + * 디지털원패스 사용자세션값을 설정한다. + * @param onepassIntfToken + */ + public void setOnepassIntfToken(String onepassIntfToken) { + this.onepassIntfToken = onepassIntfToken; + } + +} diff --git a/src/main/java/egovframework/com/cmm/RegacyPaginationRenderer.java b/src/main/java/egovframework/com/cmm/RegacyPaginationRenderer.java new file mode 100644 index 0000000..2515936 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/RegacyPaginationRenderer.java @@ -0,0 +1,48 @@ +package egovframework.com.cmm; + +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.AbstractPaginationRenderer; + +import javax.servlet.ServletContext; + +import org.springframework.web.context.ServletContextAware; +/** + * ImagePaginationRenderer.java 클래스 + * + * @author 서준식 + * @since 2011. 9. 16. + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    -------------    ----------------------
    + *   2011. 9. 16.   서준식       이미지 경로에 ContextPath추가
    + *   2016. 6. 17.   장동한       표준프레임워크 v3.6 리뉴얼
    + * 
    + */ +public class RegacyPaginationRenderer extends AbstractPaginationRenderer implements ServletContextAware{ + + private ServletContext servletContext; + + public RegacyPaginationRenderer() { + + } + + public void initVariables(){ + + firstPageLabel = "\"처음\" "; + previousPageLabel = "\"이전\" "; + currentPageLabel = "{0} "; + otherPageLabel = "{2} "; + nextPageLabel = "\"다음\" "; + lastPageLabel = "\"마지막\" "; + } + + public void setServletContext(ServletContext servletContext) { + this.servletContext = servletContext; + initVariables(); + } + +} diff --git a/src/main/java/egovframework/com/cmm/SessionVO.java b/src/main/java/egovframework/com/cmm/SessionVO.java new file mode 100644 index 0000000..b6fd62c --- /dev/null +++ b/src/main/java/egovframework/com/cmm/SessionVO.java @@ -0,0 +1,120 @@ +package egovframework.com.cmm; + +import java.io.Serializable; + +/** + * 세션 VO 클래스 + * @author 공통서비스 개발팀 박지욱 + * @since 2009.03.06 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + * 
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2009.03.06  박지욱          최초 생성 
    + *  
    + *  
    + */ +@SuppressWarnings("serial") +public class SessionVO implements Serializable { + + /** 아이디 */ + private String sUserId; + /** 이름 */ + private String sUserNm; + /** 이메일 */ + private String sEmail; + /** 사용자구분 */ + private String sUserSe; + /** 조직(부서)ID */ + private String orgnztId; + /** 고유아이디 */ + private String uniqId; + /** + * sUserId attribute 를 리턴한다. + * @return String + */ + public String getSUserId() { + return sUserId; + } + /** + * sUserId attribute 값을 설정한다. + * @param sUserId String + */ + public void setSUserId(String userId) { + sUserId = userId; + } + /** + * sUserNm attribute 를 리턴한다. + * @return String + */ + public String getSUserNm() { + return sUserNm; + } + /** + * sUserNm attribute 값을 설정한다. + * @param sUserNm String + */ + public void setSUserNm(String userNm) { + sUserNm = userNm; + } + /** + * sEmail attribute 를 리턴한다. + * @return String + */ + public String getSEmail() { + return sEmail; + } + /** + * sEmail attribute 값을 설정한다. + * @param sEmail String + */ + public void setSEmail(String email) { + sEmail = email; + } + /** + * sUserSe attribute 를 리턴한다. + * @return String + */ + public String getSUserSe() { + return sUserSe; + } + /** + * sUserSe attribute 값을 설정한다. + * @param sUserSe String + */ + public void setSUserSe(String userSe) { + sUserSe = userSe; + } + /** + * orgnztId attribute 를 리턴한다. + * @return String + */ + public String getOrgnztId() { + return orgnztId; + } + /** + * orgnztId attribute 값을 설정한다. + * @param orgnztId String + */ + public void setOrgnztId(String orgnztId) { + this.orgnztId = orgnztId; + } + /** + * uniqId attribute 를 리턴한다. + * @return String + */ + public String getUniqId() { + return uniqId; + } + /** + * uniqId attribute 값을 설정한다. + * @param uniqId String + */ + public void setUniqId(String uniqId) { + this.uniqId = uniqId; + } +} diff --git a/src/main/java/egovframework/com/cmm/annotation/IncludedInfo.java b/src/main/java/egovframework/com/cmm/annotation/IncludedInfo.java new file mode 100644 index 0000000..a88f458 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/annotation/IncludedInfo.java @@ -0,0 +1,33 @@ +package egovframework.com.cmm.annotation; + +/** + * 컴포넌트의 포함 정보 표현을 위한 annotation 클래스 + * 기본적으로 Controller 클래스에 annotation을 부여하되, + * 하나의 Controller에 여러 개의 목록성 url mapping이 제공되는 경우에는 + * 메소드에 annotation을 부여한다. + * @author 공통컴포넌트 정진오 + * @since 2011.08.26 + * @version 2.0.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *  수정일		수정자		수정내용
    + *  -------    	--------    ---------------------------
    + *  2011.08.26	정진오 		최초 생성
    + *
    + * 
    + */ + + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.RUNTIME) +public @interface IncludedInfo { + String name() default ""; // 컴포넌트의 한글 이름 + String listUrl() default ""; // 컴포넌트의 목록정보조회를 위한 URL + int order() default 0; // 자동 생성되는 메뉴 목록에 표시되는 순서 + int gid() default 0; // 컴포넌트의 Group ID(대분류 구분) +} diff --git a/src/main/java/egovframework/com/cmm/config/EgovLoginConfig.java b/src/main/java/egovframework/com/cmm/config/EgovLoginConfig.java new file mode 100644 index 0000000..c419389 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/config/EgovLoginConfig.java @@ -0,0 +1,46 @@ +package egovframework.com.cmm.config; + +/** + * EgovLoginConfig 클래스 + * + * 사용자 인증수행제한에 대한 설정을 관리하는 클래스 + * + * N/A + * + * @author 장동한 + * @since 2017.07.17 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일        수정자           수정내용
    + *  -------      -------------  ----------------------
    + *   2016.07.17  장동한           최초 생성
    + * 
    + */ + + +public class EgovLoginConfig { + //로그인 인증 제한 여부 + boolean lock = false; + //로그인 인증 제한 횟수 + int lockCount = 0; + + public boolean isLock() { + return lock; + } + + public void setLock(boolean lock) { + this.lock = lock; + } + + public int getLockCount() { + return lockCount; + } + + public void setLockCount(int lockCount) { + this.lockCount = lockCount; + } +} diff --git a/src/main/java/egovframework/com/cmm/config/EgovWebApplicationInitializer.java b/src/main/java/egovframework/com/cmm/config/EgovWebApplicationInitializer.java new file mode 100644 index 0000000..47a2fb9 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/config/EgovWebApplicationInitializer.java @@ -0,0 +1,202 @@ +package egovframework.com.cmm.config; + +import javax.servlet.FilterRegistration; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.ServletRegistration; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.WebApplicationInitializer; +import org.springframework.web.context.ContextLoaderListener; +import org.springframework.web.context.support.XmlWebApplicationContext; +import org.springframework.web.filter.DelegatingFilterProxy; +import org.springframework.web.filter.HiddenHttpMethodFilter; +import org.springframework.web.multipart.support.MultipartFilter; +import org.springframework.web.servlet.DispatcherServlet; + +import egovframework.com.cmm.filter.HTMLTagFilter; +import egovframework.com.cmm.filter.SessionTimeoutCookieFilter; +import egovframework.com.cmm.service.EgovProperties; +import egovframework.com.sec.security.filter.EgovSpringSecurityLoginFilter; +import egovframework.com.sec.security.filter.EgovSpringSecurityLogoutFilter; +import egovframework.com.uat.uap.filter.EgovLoginPolicyFilter; +import egovframework.com.utl.wed.filter.CkFilter; + + +/** + * EgovWebApplicationInitializer 클래스 + * + * 사용자 인증 권한처리를 분리(session, spring security) 하기 위해서 web.xml의 기능을 + * Servlet3.x WebApplicationInitializer 기능으로 처리 + * + * N/A + * + * @author 장동한 + * @since 2016.06.23 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일        수정자           수정내용
    + *  -------      -------------  ----------------------
    + *   2016.06.23  장동한           최초 생성
    + *   2018.10.02  신용호           Facebook 관련 HiddenHttpMethodFilter 추가
    + *   2018.10.26  신용호           EgovLoginPolicyFilter 추가 (IP접근처리)
    + *   2018.12.03  신용호           springMultipartFilter,HTMLTagFilter 추가 (XSS방지처리)
    + * 
    + */ + + +public class EgovWebApplicationInitializer implements WebApplicationInitializer { + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovWebApplicationInitializer.class); + @Override + public void onStartup(ServletContext servletContext) throws ServletException { + LOGGER.debug("EgovWebApplicationInitializer START-============================================"); + + //------------------------------------------------------------- + // Egov Web ServletContextListener 설정 + //------------------------------------------------------------- + servletContext.addListener(new egovframework.com.cmm.context.EgovWebServletContextListener()); + + //------------------------------------------------------------- + // Spring CharacterEncodingFilter 설정 + //------------------------------------------------------------- + FilterRegistration.Dynamic characterEncoding = servletContext.addFilter("encodingFilter", new org.springframework.web.filter.CharacterEncodingFilter()); + characterEncoding.setInitParameter("encoding", "UTF-8"); + characterEncoding.setInitParameter("forceEncoding", "true"); + characterEncoding.addMappingForUrlPatterns(null, false, "*.do"); + //characterEncoding.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true, "*.do"); + + //------------------------------------------------------------- + // Spring ServletContextListener 설정 + //------------------------------------------------------------- + XmlWebApplicationContext rootContext = new XmlWebApplicationContext(); + rootContext.setConfigLocations(new String[] { "classpath*:egovframework/spring/com/**/context-*.xml" }); + //rootContext.setConfigLocations(new String[] { "classpath*:egovframework/spring/com/context-*.xml","classpath*:egovframework/spring/com/*/context-*.xml" }); + rootContext.refresh(); + rootContext.start(); + + servletContext.addListener(new ContextLoaderListener(rootContext)); + + //------------------------------------------------------------- + // Spring ServletContextListener 설정 + //------------------------------------------------------------- + XmlWebApplicationContext xmlWebApplicationContext = new XmlWebApplicationContext(); + xmlWebApplicationContext.setConfigLocation("/WEB-INF/config/egovframework/springmvc/egov-com-*.xml"); + ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcher", new DispatcherServlet(xmlWebApplicationContext)); + //dispatcher.addMapping("*.do"); + dispatcher.addMapping("/"); // Facebook OAuth 사용시 변경 + dispatcher.setLoadOnStartup(1); + + /* + * if("security".equals(EgovProperties.getProperty("Globals.Auth").trim())) { + * + * //------------------------------------------------------------- // + * springSecurityFilterChain 설정 + * //------------------------------------------------------------- + * FilterRegistration.Dynamic springSecurityFilterChain = + * servletContext.addFilter("springSecurityFilterChain", new + * DelegatingFilterProxy()); + * springSecurityFilterChain.addMappingForUrlPatterns(null, false, "*"); + * //servletContext.addFilter("springSecurityFilterChain", new + * DelegatingFilterProxy("springSecurityFilterChain")).addMappingForUrlPatterns( + * null, false, "/*"); + * + * //------------------------------------------------------------- // + * HttpSessionEventPublisher 설정 + * //------------------------------------------------------------- + * servletContext.addListener(new + * org.springframework.security.web.session.HttpSessionEventPublisher()); + * + * //------------------------------------------------------------- // + * EgovSpringSecurityLoginFilter 설정 + * //------------------------------------------------------------- + * FilterRegistration.Dynamic egovSpringSecurityLoginFilter = + * servletContext.addFilter("egovSpringSecurityLoginFilter", new + * EgovSpringSecurityLoginFilter()); //로그인 실패시 반활 될 URL설정 + * egovSpringSecurityLoginFilter.setInitParameter("loginURL", + * "/uat/uia/egovLoginUsr.do"); //로그인 처리 URL설정 + * egovSpringSecurityLoginFilter.setInitParameter("loginProcessURL", + * "/uat/uia/actionLogin.do"); //처리 Url Pattern + * egovSpringSecurityLoginFilter.addMappingForUrlPatterns(null, false, "*.do"); + * + * //------------------------------------------------------------- // + * EgovSpringSecurityLogoutFilter 설정 + * //------------------------------------------------------------- + * FilterRegistration.Dynamic egovSpringSecurityLogoutFilter = + * servletContext.addFilter("egovSpringSecurityLogoutFilter", new + * EgovSpringSecurityLogoutFilter()); + * egovSpringSecurityLogoutFilter.addMappingForUrlPatterns(null, false, + * "/uat/uia/actionLogout.do"); + * + * } else + * if("session".equals(EgovProperties.getProperty("Globals.Auth").trim())) { + * //------------------------------------------------------------- // + * EgovLoginPolicyFilter 설정 + * //------------------------------------------------------------- + * FilterRegistration.Dynamic egovLoginPolicyFilter = + * servletContext.addFilter("LoginPolicyFilter", new EgovLoginPolicyFilter()); + * egovLoginPolicyFilter.addMappingForUrlPatterns(null, false, + * "/uat/uia/actionLogin.do"); + * + * } + */ + + //------------------------------------------------------------- + // 스프링 Security 필터 설정 추가 JWKIM + //------------------------------------------------------------- + FilterRegistration.Dynamic springSecurityFilterChain = servletContext.addFilter("springSecurityFilterChain", new org.springframework.web.filter.DelegatingFilterProxy()); + springSecurityFilterChain.addMappingForUrlPatterns(null, false, "/*"); + + //------------------------------------------------------------- + // CkFilter 설정 (CKEditor 사용시 설정) + //------------------------------------------------------------- + FilterRegistration.Dynamic regCkFilter = servletContext.addFilter("CKFilter", new CkFilter()); + regCkFilter.setInitParameter("properties", "egovframework/egovProps/ck.properties"); + regCkFilter.addMappingForUrlPatterns(null, false, "/ckUploadImage"); + + //------------------------------------------------------------- + // HiddenHttpMethodFilter 설정 (Facebook OAuth 사용시 설정) + //------------------------------------------------------------- + FilterRegistration.Dynamic hiddenHttpMethodFilter = servletContext.addFilter("hiddenHttpMethodFilter", new HiddenHttpMethodFilter()); + hiddenHttpMethodFilter.addMappingForUrlPatterns(null, false, "/*"); + + //------------------------------------------------------------- + // Tomcat의 경우 allowCasualMultipartParsing="true" 추가 + // + //------------------------------------------------------------- + MultipartFilter springMultipartFilter = new MultipartFilter(); + springMultipartFilter.setMultipartResolverBeanName("multipartResolver"); + FilterRegistration.Dynamic multipartFilter = servletContext.addFilter("springMultipartFilter", springMultipartFilter); + multipartFilter.addMappingForUrlPatterns(null, false, "*.do"); + + //------------------------------------------------------------- + // HTMLTagFilter의 경우는 파라미터에 대하여 XSS 오류 방지를 위한 변환을 처리합니다. + //------------------------------------------------------------- + // HTMLTagFIlter의 경우는 JSP의 등을 사용하지 못하는 특수한 상황에서 사용하시면 됩니다. + // (의 경우 뷰단에서 데이터 출력시 XSS 방지 처리가 됨) + FilterRegistration.Dynamic htmlTagFilter = servletContext.addFilter("htmlTagFilter", new HTMLTagFilter()); + htmlTagFilter.addMappingForUrlPatterns(null, false, "*.do"); + + //------------------------------------------------------------- + // SessionTimeoutCookieFilter는 쿠키에 타임아웃 시간을 기록한다. + //------------------------------------------------------------- + // latestServerTime - 서버 최근 시간 + // expireSessionTime - 세션이 만료되는 시간 + FilterRegistration.Dynamic sessionTimeoutFilter = servletContext.addFilter("sessionTimeoutFilter", new SessionTimeoutCookieFilter()); + sessionTimeoutFilter.addMappingForUrlPatterns(null, false, "*.do"); + + //------------------------------------------------------------- + // Spring RequestContextListener 설정 + //------------------------------------------------------------- + servletContext.addListener(new org.springframework.web.context.request.RequestContextListener()); + + LOGGER.debug("EgovWebApplicationInitializer END-============================================"); + + } + +} diff --git a/src/main/java/egovframework/com/cmm/context/EgovWebServletContextListener.java b/src/main/java/egovframework/com/cmm/context/EgovWebServletContextListener.java new file mode 100644 index 0000000..2240c22 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/context/EgovWebServletContextListener.java @@ -0,0 +1,68 @@ +package egovframework.com.cmm.context; + +import javax.servlet.ServletContextEvent; +import javax.servlet.ServletContextListener; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import egovframework.com.cmm.service.EgovProperties; + +/** + * EgovWebServletContextListener 클래스 + * + * 데이터베이스 설정을 spring.profiles.active 방식으로 처리 + * (공통컴포넌트 특성상 데이터베이스별 분리/개발,검증,운영서버로 분리 가능) + * + * N/A + * + * @author 장동한 + * @since 2016.06.23 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일        수정자           수정내용
    + *  -------      -------------  ----------------------
    + *   2016.06.23  장동한           최초 생성
    + *   2017.03.03     조성원 	시큐어코딩(ES)-오류 메시지를 통한 정보노출[CWE-209]
    + * 
    + */ + +public class EgovWebServletContextListener implements ServletContextListener { + private static final Logger LOGGER = LoggerFactory.getLogger(EgovWebServletContextListener.class); + + public EgovWebServletContextListener(){ + setEgovProfileSetting(); + } + + @Override + public void contextInitialized(ServletContextEvent event){ + if(System.getProperty("spring.profiles.active") == null){ + setEgovProfileSetting(); + } + } + + @Override + public void contextDestroyed(ServletContextEvent event) { + if(System.getProperty("spring.profiles.active") != null){ + System.clearProperty("spring.profiles.active"); + } + } + + public void setEgovProfileSetting(){ + try { + LOGGER.debug("===========================Start EgovServletContextLoad START ==========="); + System.setProperty("spring.profiles.active", EgovProperties.getProperty("Globals.DbType")+","+EgovProperties.getProperty("Globals.Auth")); + LOGGER.debug("Setting spring.profiles.active>"+System.getProperty("spring.profiles.active")); + LOGGER.debug("===========================END EgovServletContextLoad END ==========="); + //2017.03.03 조성원 시큐어코딩(ES)-오류 메시지를 통한 정보노출[CWE-209] + } catch(IllegalArgumentException e) { + LOGGER.error("[IllegalArgumentException] Try/Catch...usingParameters Runing : "+ e.getMessage()); + } catch (Exception e) { + LOGGER.error("[" + e.getClass() +"] search fail : " + e.getMessage()); + } + } +} diff --git a/src/main/java/egovframework/com/cmm/exception/EgovXssException.java b/src/main/java/egovframework/com/cmm/exception/EgovXssException.java new file mode 100644 index 0000000..d540ac1 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/exception/EgovXssException.java @@ -0,0 +1,39 @@ +package egovframework.com.cmm.exception; + +import org.egovframe.rte.fdl.cmmn.exception.BaseRuntimeException; + +/** + * EgovXssException 클래스 + * + * @author 장동한 + * @since 2016.10.27 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일        수정자           수정내용
    + *  -------      -------------  ----------------------
    + *   2016.10.17  장동한           최초 생성
    + * 
    + */ + +public class EgovXssException extends BaseRuntimeException { + + private static final long serialVersionUID = 1L; + + /** + * EgovXssException 생성자. + * + * @param defaultMessage 메세지 지정 + * @param wrappedException 원인 Exception + */ + public EgovXssException(String message, String messageKey) { + this.messageKey = messageKey; + this.messageParameters = null; + this.message = message; + this.wrappedException = null; + } + +} diff --git a/src/main/java/egovframework/com/cmm/filter/HTMLTagFilter.java b/src/main/java/egovframework/com/cmm/filter/HTMLTagFilter.java new file mode 100644 index 0000000..551d57a --- /dev/null +++ b/src/main/java/egovframework/com/cmm/filter/HTMLTagFilter.java @@ -0,0 +1,46 @@ +/* + * Copyright 2008-2009 MOPAS(MINISTRY OF SECURITY AND PUBLIC ADMINISTRATION). + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package egovframework.com.cmm.filter; + +import java.io.IOException; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; + +public class HTMLTagFilter implements Filter{ + + @SuppressWarnings("unused") + private FilterConfig config; + + public void doFilter(ServletRequest request, ServletResponse response, + FilterChain chain) throws IOException, ServletException { + + chain.doFilter(new HTMLTagFilterRequestWrapper((HttpServletRequest)request), response); + } + + public void init(FilterConfig config) throws ServletException { + this.config = config; + } + + public void destroy() { + + } +} diff --git a/src/main/java/egovframework/com/cmm/filter/HTMLTagFilterRequestWrapper.java b/src/main/java/egovframework/com/cmm/filter/HTMLTagFilterRequestWrapper.java new file mode 100644 index 0000000..b88437c --- /dev/null +++ b/src/main/java/egovframework/com/cmm/filter/HTMLTagFilterRequestWrapper.java @@ -0,0 +1,187 @@ +/* + * Copyright 2008-2009 MOPAS(MINISTRY OF SECURITY AND PUBLIC ADMINISTRATION). + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package egovframework.com.cmm.filter; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletRequestWrapper; + +/** +* +* HTMLTagFilterRequestWrapper +* @author 공통컴포넌트 팀 신용호 +* @since 2018.03.21 +* @version 1.0 +* @see +* +*
    +* << 개정이력(Modification Information) >>
    +*
    +*   수정일              수정자              수정내용
    +*  -------      --------    ---------------------------
    +*   2018.03.21  신용호              getParameterMap()구현 추가
    +*   2019.01.31  신용호              whiteList 태그 추가
    +*
    +*/
    +
    +public class HTMLTagFilterRequestWrapper extends HttpServletRequestWrapper {
    +
    +	// Tag 화이트 리스트 ( 허용할 태그 등록 )
    +	static private String[] whiteListTag = { "

    ","
    ","
    ","

    ", "" }; + + public HTMLTagFilterRequestWrapper(HttpServletRequest request) { + super(request); + } + + public String[] getParameterValues(String parameter) { + + String[] values = super.getParameterValues(parameter); + + if(values==null){ + return null; + } + + for (int i = 0; i < values.length; i++) { + if (values[i] != null) { + values[i] = getSafeParamData(values[i]); + //System.out.println( "[HTMLTagFilter getParameterValues] "+ parameter + "===>>>"+values[i] ); + } else { + values[i] = null; + } + } + + return values; + } + + public String getParameter(String parameter) { + + String value = super.getParameter(parameter); + + if(value==null){ + return null; + } + + value = getSafeParamData(value); + //System.out.println( "[HTMLTagFilter getParameter] "+ parameter + "===>>>"+value ); + return value; + } + + /** + * Map으로 바인딩된 경우를 처리한다. + * + * @return Map - String Type Key / String배열타입 값 + */ + public Map getParameterMap() { + Map valueMap = super.getParameterMap(); + + String[] values; + for( String key : valueMap.keySet() ){ + values = valueMap.get(key); + + for (int i = 0; i < values.length; i++) { + if (values[i] != null) { + values[i] = getSafeParamData(values[i]); + //System.out.println( "[HTMLTagFilter getParameterMap] "+ key + "===>>>"+values[i] ); + } else { + values[i] = null; + } + } + + //System.out.println( String.format("키 : %s, 값 : %s", key, valueMap.get(key)) ); + } + + return valueMap; + } + + private String getSafeParamData(String value) { + StringBuffer strBuff = new StringBuffer(); + + for (int i = 0; i < value.length(); i++) { + char c = value.charAt(i); + switch (c) { + case '<': + if ( checkNextWhiteListTag(i, value) == false ) + strBuff.append("<"); + else + strBuff.append(c); + //System.out.println("checkNextWhiteListTag = "+checkNextWhiteListTag(i, value)); + break; + case '>': + if ( checkPrevWhiteListTag(i, value) == false ) + strBuff.append(">"); + else + strBuff.append(c); + //System.out.println("checkPrevWhiteListTag = "+checkPrevWhiteListTag(i, value)); + break; + //case '&': + // strBuff.append("&"); + // break; + case '"': + strBuff.append("""); + break; + case '\'': + strBuff.append("'"); + break; + default: + strBuff.append(c); + break; + } + } + + value = strBuff.toString(); + return value; + } + + private boolean checkNextWhiteListTag(int index, String data) { + String extractData = ""; + //int beginIndex = 0; + int endIndex = 0; + for(String whiteListData: whiteListTag) { + //System.out.println("===>>> whiteListData="+whiteListData); + endIndex = index+whiteListData.length(); + if ( data.length() > endIndex ) + extractData = data.substring(index, endIndex); + else + extractData = ""; + //System.out.println("extractData="+extractData); + if ( whiteListData.equals(extractData) ) return true; // whiteList 대상으로 판정 + } + + return false; + } + + private boolean checkPrevWhiteListTag(int index, String data) { + String extractData = ""; + int beginIndex = 0; + int endIndex = 0; + for(String whiteListData: whiteListTag) { + //System.out.println("===>>> whiteListData="+whiteListData); + beginIndex = index-whiteListData.length()+1; + endIndex = index+1; + //System.out.println(" range ["+beginIndex+" ~ "+endIndex+"]"); + if ( beginIndex >= 0 ) + extractData = data.substring(beginIndex, endIndex); + else + extractData = ""; + //System.out.println("extractData="+extractData); + if ( whiteListData.equals(extractData) ) return true; // whiteList 대상으로 판정 + } + + return false; + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/cmm/filter/SessionTimeoutCookieFilter.java b/src/main/java/egovframework/com/cmm/filter/SessionTimeoutCookieFilter.java new file mode 100644 index 0000000..95e6a10 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/filter/SessionTimeoutCookieFilter.java @@ -0,0 +1,90 @@ +/* + * Copyright 2008-2009 MOPAS(MINISTRY OF SECURITY AND PUBLIC ADMINISTRATION). + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package egovframework.com.cmm.filter; + +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** +* +* SessionTimeoutCookieFilter +* @author 공통컴포넌트 팀 신용호 +* @since 2020.06.17 +* @version 1.0 +* @see +* +*
    +* << 개정이력(Modification Information) >>
    +*
    +*  수정일               수정자           수정내용
    +*  ----------   --------   ---------------------------
    +*  2020.06.17   신용호            최초 생성
    +*
    +*/
    +
    +public class SessionTimeoutCookieFilter implements Filter{
    +
    +	@SuppressWarnings("unused")
    +	private FilterConfig config;
    +
    +	public void doFilter(ServletRequest request, ServletResponse response,
    +			FilterChain chain) throws IOException, ServletException {
    +		HttpServletResponse httpResponse = (HttpServletResponse) response;
    +        HttpServletRequest httpRequest = (HttpServletRequest) request;
    +        long serverTime = System.currentTimeMillis();
    +        long sessionExpireTime = serverTime + httpRequest.getSession().getMaxInactiveInterval() * 1000;
    +        Cookie cookie = new Cookie("egovLatestServerTime", "" + serverTime);
    +        //cookie.setSecure(true);
    +        cookie.setPath("/");
    +        httpResponse.addCookie(cookie);
    +        cookie = new Cookie("egovExpireSessionTime", "" + sessionExpireTime);
    +        cookie.setPath("/");
    +        
    +        Date dateServer = new Date(serverTime);
    +        Date dateExpiry = new Date(sessionExpireTime);
    +        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    +
    +        String serverYMD = format.format(dateServer);
    +        String expiryYMD = format.format(dateExpiry);
    +        //System.out.println("=====>>> serverYMD = "+serverYMD);
    +        //System.out.println("=====>>> expiryYMD = "+expiryYMD);
    +        //System.out.println("=====>>> server TimeStamp = "+serverTime);
    +        //System.out.println("=====>>> expire TimeStamp = "+sessionExpireTime);
    +        
    +        httpResponse.addCookie(cookie);
    +
    +        chain.doFilter(request, response);
    +	}
    +
    +	public void init(FilterConfig config) throws ServletException {
    +		this.config = config;
    +	}
    +
    +	public void destroy() {
    +
    +	}
    +}
    diff --git a/src/main/java/egovframework/com/cmm/interceptor/AuthenticInterceptor.java b/src/main/java/egovframework/com/cmm/interceptor/AuthenticInterceptor.java
    new file mode 100644
    index 0000000..1100617
    --- /dev/null
    +++ b/src/main/java/egovframework/com/cmm/interceptor/AuthenticInterceptor.java
    @@ -0,0 +1,92 @@
    +package egovframework.com.cmm.interceptor;
    +
    +import java.util.List;
    +
    +import javax.servlet.http.HttpServletRequest;
    +import javax.servlet.http.HttpServletResponse;
    +
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +import org.springframework.beans.factory.annotation.Autowired;
    +import org.springframework.core.env.Environment;
    +import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
    +import org.springframework.web.servlet.ModelAndView;
    +import org.springframework.web.servlet.ModelAndViewDefiningException;
    +import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
    +
    +import egovframework.com.cmm.util.EgovUserDetailsHelper;
    +
    +/**
    + * 인증여부 체크 인터셉터
    + * @author 공통서비스 개발팀 서준식
    + * @since 2011.07.01
    + * @version 1.0
    + * @see
    + *
    + * 
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2011.07.01  서준식          최초 생성
    + *  2011.09.07  서준식          인증이 필요없는 URL을 패스하는 로직 추가
    + *  2017.08.31  장동한          인증된 사용자 체크로직 변경 및 관리자 권한 체크 로직 추가 
    + *  2021.08.27  신용호          dummy모드 사용시 "60. 권한관리" 접근오류 수정
    + *  
    + */ + + +public class AuthenticInterceptor extends HandlerInterceptorAdapter { + + @Autowired + private Environment environment; + + /** log */ + private static final Logger LOGGER = LoggerFactory.getLogger(AuthenticInterceptor.class); + + /** 관리자 접근 권한 패턴 목록 */ + private List adminAuthPatternList; + + public List getAdminAuthPatternList() { + return adminAuthPatternList; + } + + public void setAdminAuthPatternList(List adminAuthPatternList) { + this.adminAuthPatternList = adminAuthPatternList; + } + + /** + * 인증된 사용자 여부로 인증 여부를 체크한다. + * 관리자 권한에 따라 접근 페이지 권한을 체크한다. + */ + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { + //인증된사용자 여부 + boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + //미민증사용자 체크 + if(!isAuthenticated) { + ModelAndView modelAndView = new ModelAndView("redirect:/uat/uia/egovLoginUsr.do"); + throw new ModelAndViewDefiningException(modelAndView); + } + //인증된 권한 목록 + List authList = (List)EgovUserDetailsHelper.getAuthorities(); + //관리자인증여부 + boolean adminAuthUrlPatternMatcher = false; + //AntPathRequestMatcher + AntPathRequestMatcher antPathRequestMatcher = null; + //관리자가 아닐때 체크함 + for(String adminAuthPattern : adminAuthPatternList){ + antPathRequestMatcher = new AntPathRequestMatcher(adminAuthPattern); + if(antPathRequestMatcher.matches(request)){ + adminAuthUrlPatternMatcher = true; + } + } + //관리자 권한 체크 + if(adminAuthUrlPatternMatcher && !authList.contains("ROLE_ADMIN")){ + ModelAndView modelAndView = new ModelAndView("redirect:/uat/uia/egovLoginUsr.do?auth_error=1"); + throw new ModelAndViewDefiningException(modelAndView); + } + return true; + } + +} diff --git a/src/main/java/egovframework/com/cmm/interceptor/IpObtainInterceptor.java b/src/main/java/egovframework/com/cmm/interceptor/IpObtainInterceptor.java new file mode 100644 index 0000000..f4b89a4 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/interceptor/IpObtainInterceptor.java @@ -0,0 +1,42 @@ +package egovframework.com.cmm.interceptor; + +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.util.EgovUserDetailsHelper; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; + +/** + * 사용자IP 체크 인터셉터 + * @author 유지보수팀 이기하 + * @since 2013.03.28 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + * 
    + *   수정일     수정자          수정내용
    + *  ----------  --------    ---------------------------
    + *  2013.03.28	이기하          최초 생성 
    + *  
    + */ + +public class IpObtainInterceptor extends HandlerInterceptorAdapter { + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { + + String clientIp = request.getRemoteAddr(); + + LoginVO loginVO = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser(); + + if (loginVO != null) { + loginVO.setIp(clientIp); + } + + return true; + } +} diff --git a/src/main/java/egovframework/com/cmm/service/CmmnDetailCode.java b/src/main/java/egovframework/com/cmm/service/CmmnDetailCode.java new file mode 100644 index 0000000..7d16307 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/service/CmmnDetailCode.java @@ -0,0 +1,217 @@ +package egovframework.com.cmm.service; + +import java.io.Serializable; + +/** + * 공통상세코드 모델 클래스 + * @author 공통서비스 개발팀 이중호 + * @since 2009.04.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.01  이중호          최초 생성
    + *   2017.09.07	이정은		표준프레임워크 v3.7 개선(clCode 추가)
    + *
    + * 
    + */ +public class CmmnDetailCode implements Serializable { + + private static final long serialVersionUID = 1L; + + /* + * 분류코드 + */ + private String clCode = ""; + + /* + * 코드ID + */ + private String codeId = ""; + + /* + * 코드ID명 + */ + private String codeIdNm = ""; + + /* + * 상세코드 + */ + private String code = ""; + + /* + * 상세코드명 + */ + private String codeNm = ""; + + /* + * 상세코드설명 + */ + private String codeDc = ""; + + /* + * 사용여부 + */ + private String useAt = ""; + + /* + * 최초등록자ID + */ + private String frstRegisterId = ""; + + /* + * 최종수정자ID + */ + private String lastUpdusrId = ""; + + + /** + * clCode attribute 를 리턴한다. + * @return String + */ + public String getClCode() { + return clCode; + } + + /** + * clCode attribute 값을 설정한다. + * @param clCode String + */ + public void setClCode(String clCode) { + this.clCode = clCode; + } + + /** + * codeId attribute 를 리턴한다. + * @return String + */ + public String getCodeId() { + return codeId; + } + + /** + * codeId attribute 값을 설정한다. + * @param codeId String + */ + public void setCodeId(String codeId) { + this.codeId = codeId; + } + + /** + * codeIdNm attribute 를 리턴한다. + * @return String + */ + public String getCodeIdNm() { + return codeIdNm; + } + + /** + * codeIdNm attribute 값을 설정한다. + * @param codeIdNm String + */ + public void setCodeIdNm(String codeIdNm) { + this.codeIdNm = codeIdNm; + } + + /** + * code attribute 를 리턴한다. + * @return String + */ + public String getCode() { + return code; + } + + /** + * code attribute 값을 설정한다. + * @param code String + */ + public void setCode(String code) { + this.code = code; + } + + /** + * codeNm attribute 를 리턴한다. + * @return String + */ + public String getCodeNm() { + return codeNm; + } + + /** + * codeNm attribute 값을 설정한다. + * @param codeNm String + */ + public void setCodeNm(String codeNm) { + this.codeNm = codeNm; + } + + /** + * codeDc attribute 를 리턴한다. + * @return String + */ + public String getCodeDc() { + return codeDc; + } + + /** + * codeDc attribute 값을 설정한다. + * @param codeDc String + */ + public void setCodeDc(String codeDc) { + this.codeDc = codeDc; + } + + /** + * useAt attribute 를 리턴한다. + * @return String + */ + public String getUseAt() { + return useAt; + } + + /** + * useAt attribute 값을 설정한다. + * @param useAt String + */ + public void setUseAt(String useAt) { + this.useAt = useAt; + } + + /** + * frstRegisterId attribute 를 리턴한다. + * @return String + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * frstRegisterId attribute 값을 설정한다. + * @param frstRegisterId String + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * lastUpdusrId attribute 를 리턴한다. + * @return String + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * lastUpdusrId attribute 값을 설정한다. + * @param lastUpdusrId String + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + +} diff --git a/src/main/java/egovframework/com/cmm/service/EgovCmmUseService.java b/src/main/java/egovframework/com/cmm/service/EgovCmmUseService.java new file mode 100644 index 0000000..0751039 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/service/EgovCmmUseService.java @@ -0,0 +1,85 @@ +package egovframework.com.cmm.service; + +import java.util.List; +import java.util.Map; + +import egovframework.com.cmm.ComDefaultCodeVO; +import kccf.cmm.vo.CmmCodeVO; + + + +/** + * + * 공통코드등 전체 업무에서 공용해서 사용해야 하는 서비스를 정의하기 위한 서비스 인터페이스 + * @author 공통서비스 개발팀 이삼섭 + * @since 2009.04.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.11  이삼섭          최초 생성
    + *
    + * 
    + */ +public interface EgovCmmUseService { + + /** + * (문화원) 공통코드를 조회한다. + * + * @param vo + * @return List(코드) + * @throws Exception + */ + public List selectCmmCode(CmmCodeVO cmmCode) throws Exception; + + /** + * (문화원) 공통코드를 조회한다. + * + * @param vo + * @return List(코드) + * @throws Exception + */ + public List selectAditCodeItem(String bbsId) throws Exception; + + /** + * 공통코드를 조회한다. + * + * @param vo + * @return List(코드) + * @throws Exception + */ + public List selectCmmCodeDetail(ComDefaultCodeVO vo) throws Exception; + + /** + * ComDefaultCodeVO의 리스트를 받아서 여러개의 코드 리스트를 맵에 담아서 리턴한다. + * + * @param voList + * @return Map(코드) + * @throws Exception + */ + public Map> selectCmmCodeDetails(List voList) throws Exception; + + /** + * 조직정보를 코드형태로 리턴한다. + * + * @param 조회조건정보 vo + * @return 조직정보 List + * @throws Exception + */ + public List selectOgrnztIdDetail(ComDefaultCodeVO vo) throws Exception; + + /** + * 그룹정보를 코드형태로 리턴한다. + * + * @param 조회조건정보 vo + * @return 그룹정보 List + * @throws Exception + */ + public List selectGroupIdDetail(ComDefaultCodeVO vo) throws Exception; + + +} diff --git a/src/main/java/egovframework/com/cmm/service/EgovFileMngService.java b/src/main/java/egovframework/com/cmm/service/EgovFileMngService.java new file mode 100644 index 0000000..71c1621 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/service/EgovFileMngService.java @@ -0,0 +1,147 @@ +package egovframework.com.cmm.service; + +import java.util.List; +import java.util.Map; + +import kccf.bbs.vo.AttachmentVO; + +/** + * @Class Name : EgovFileMngService.java + * @Description : 파일정보의 관리를 위한 서비스 인터페이스 + * @Modification Information + * + * 수정일 수정자 수정내용 + * ------- ------- ------------------- + * 2009. 3. 25. 이삼섭 최초생성 + * + * @author 공통 서비스 개발팀 이삼섭 + * @since 2009. 3. 25. + * @version + * @see + * + */ +public interface EgovFileMngService { + + /** + * 문화원 파일에 대한 목록을 조회한다. + * + * @param fvo + * @return + * @throws Exception + */ + public List selectFileListByCntntsId(AttachmentVO attachmentVO) throws Exception; + + /** + * 문화원 파일에 대한 상세정보를 조회한다. + * + * @param fvo + * @return + * @throws Exception + */ + public AttachmentVO selectFileDetailByKF(AttachmentVO attachmentVO) throws Exception; + + /** + * 문화원 여러 개의 파일을 삭제한다. + * + * @param attachment + * @throws Exception + */ + public void deleteFileInfsByKF(List deleteFiles) throws Exception; + + + /** + * 파일에 대한 목록을 조회한다. + * + * @param fvo + * @return + * @throws Exception + */ + public List selectFileInfs(FileVO fvo) throws Exception; + + /** + * 하나의 파일에 대한 정보(속성 및 상세)를 등록한다. + * + * @param fvo + * @throws Exception + */ + public String insertFileInf(FileVO fvo) throws Exception; + + /** + * 여러 개의 파일에 대한 정보(속성 및 상세)를 등록한다. + * + * @param fvoList + * @throws Exception + */ + public String insertFileInfs(List fvoList) throws Exception; + + + + /** + * 여러 개의 파일에 대한 정보(속성 및 상세)를 수정한다. + * + * @param fvoList + * @throws Exception + */ + public void updateFileInfs(List fvoList) throws Exception; + + /** + * 여러 개의 파일을 삭제한다. + * + * @param fvoList + * @throws Exception + */ + public void deleteFileInfs(List fvoList) throws Exception; + + /** + * 하나의 파일을 삭제한다. + * + * @param fvo + * @throws Exception + */ + public void deleteFileInf(FileVO fvo) throws Exception; + + /** + * 파일에 대한 상세정보를 조회한다. + * + * @param fvo + * @return + * @throws Exception + */ + public FileVO selectFileInf(FileVO fvo) throws Exception; + + /** + * 파일 구분자에 대한 최대값을 구한다. + * + * @param fvo + * @return + * @throws Exception + */ + public int getMaxFileSN(FileVO fvo) throws Exception; + + /** + * 전체 파일을 삭제한다. + * + * @param fvo + * @throws Exception + */ + public void deleteAllFileInf(FileVO fvo) throws Exception; + + /** + * 파일명 검색에 대한 목록을 조회한다. + * + * @param fvo + * @return + * @throws Exception + */ + public Map selectFileListByFileNm(FileVO fvo) throws Exception; + + /** + * 이미지 파일에 대한 목록을 조회한다. + * + * @param vo + * @return + * @throws Exception + */ + public List selectImageFileList(FileVO vo) throws Exception; + +} diff --git a/src/main/java/egovframework/com/cmm/service/EgovFileMngUtil.java b/src/main/java/egovframework/com/cmm/service/EgovFileMngUtil.java new file mode 100644 index 0000000..5a4df1e --- /dev/null +++ b/src/main/java/egovframework/com/cmm/service/EgovFileMngUtil.java @@ -0,0 +1,524 @@ +package egovframework.com.cmm.service; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Map.Entry; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; +import org.springframework.util.FileCopyUtils; +import org.springframework.web.multipart.MultipartFile; + +import egovframework.com.cmm.EgovWebUtil; +import egovframework.com.cmm.util.EgovResourceCloseHelper; + +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +/** + * @Class Name : EgovFileMngUtil.java + * @Description : 메시지 처리 관련 유틸리티 + * @Modification Information + * + * 수정일 수정자 수정내용 + * ---------- -------- --------------------------- + * 2009.02.13 이삼섭 최초 생성 + * 2011.08.09 서준식 utl.fcc패키지와 Dependency제거를 위해 getTimeStamp()메서드 추가 + * 2017.03.03 조성원 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + * 2020.10.26 신용호 parseFileInf(List files ...) 추가 + * + * @author 공통 서비스 개발팀 이삼섭 + * @since 2009. 02. 13 + * @version 1.0 + * @see + * + */ +@Component("EgovFileMngUtil") +public class EgovFileMngUtil { + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovFileMngUtil.class); + + public static final int BUFF_SIZE = 2048; + + @Resource(name = "egovFileIdGnrService") + private EgovIdGnrService idgenService; + + + /** + * 첨부파일에 대한 목록 정보를 취득한다. + * + * @param files + * @return + * @throws Exception + */ + public List parseFileInf(Map files, String KeyStr, int fileKeyParam, String atchFileId, String storePath) throws Exception { + int fileKey = fileKeyParam; + + String storePathString = ""; + String atchFileIdString = ""; + + if ("".equals(storePath) || storePath == null) { + storePathString = EgovProperties.getProperty("Globals.fileStorePath"); + } else { + storePathString = EgovProperties.getProperty(storePath); + } + + if ("".equals(atchFileId) || atchFileId == null) { + atchFileIdString = idgenService.getNextStringId(); + } else { + atchFileIdString = atchFileId; + } + + File saveFolder = new File(EgovWebUtil.filePathBlackList(storePathString)); + + if (!saveFolder.exists() || saveFolder.isFile()) { + //2017.03.03 조성원 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + if (saveFolder.mkdirs()){ + LOGGER.debug("[file.mkdirs] saveFolder : Creation Success "); + }else{ + LOGGER.error("[file.mkdirs] saveFolder : Creation Fail "); + } + } + + Iterator> itr = files.entrySet().iterator(); + MultipartFile file; + String filePath = ""; + List result = new ArrayList(); + FileVO fvo; + + while (itr.hasNext()) { + Entry entry = itr.next(); + + file = entry.getValue(); + String orginFileName = file.getOriginalFilename(); + + //-------------------------------------- + // 원 파일명이 없는 경우 처리 + // (첨부가 되지 않은 input file type) + //-------------------------------------- + if ("".equals(orginFileName)) { + continue; + } + ////------------------------------------ + + int index = orginFileName.lastIndexOf("."); + //String fileName = orginFileName.substring(0, index); + String fileExt = orginFileName.substring(index + 1); + String newName = KeyStr + getTimeStamp() + fileKey; + long size = file.getSize(); + + if (!"".equals(orginFileName)) { + filePath = storePathString + File.separator + newName; + file.transferTo(new File(EgovWebUtil.filePathBlackList(filePath))); + } + + fvo = new FileVO(); + fvo.setFileExtsn(fileExt); + fvo.setFileStreCours(storePathString); + fvo.setFileMg(Long.toString(size)); + fvo.setOrignlFileNm(orginFileName); + fvo.setStreFileNm(newName); + fvo.setAtchFileId(atchFileIdString); + fvo.setFileSn(String.valueOf(fileKey)); + + result.add(fvo); + + fileKey++; + } + + return result; + } + + /** + * 첨부파일에 대한 목록 정보를 취득한다. + * + * @param files + * @return + * @throws Exception + */ + public List parseFileInf(List files, String KeyStr, int fileKeyParam, String atchFileId, String storePath) throws Exception { + int fileKey = fileKeyParam; + + String storePathString = ""; + String atchFileIdString = ""; + + if ("".equals(storePath) || storePath == null) { + storePathString = EgovProperties.getProperty("Globals.fileStorePath"); + } else { + storePathString = EgovProperties.getProperty(storePath); + } + + if ("".equals(atchFileId) || atchFileId == null) { + atchFileIdString = idgenService.getNextStringId(); + } else { + atchFileIdString = atchFileId; + } + + File saveFolder = new File(EgovWebUtil.filePathBlackList(storePathString)); + + if (!saveFolder.exists() || saveFolder.isFile()) { + //2017.03.03 조성원 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + if (saveFolder.mkdirs()){ + LOGGER.debug("[file.mkdirs] saveFolder : Creation Success "); + }else{ + LOGGER.error("[file.mkdirs] saveFolder : Creation Fail "); + } + } + + String filePath = ""; + List result = new ArrayList(); + FileVO fvo; + + for (MultipartFile file : files ) { + + String orginFileName = file.getOriginalFilename(); + + //-------------------------------------- + // 원 파일명이 없는 경우 처리 + // (첨부가 되지 않은 input file type) + //-------------------------------------- + if ("".equals(orginFileName)) { + continue; + } + ////------------------------------------ + + int index = orginFileName.lastIndexOf("."); + //String fileName = orginFileName.substring(0, index); + String fileExt = orginFileName.substring(index + 1); + String newName = KeyStr + getTimeStamp() + fileKey; + long size = file.getSize(); + + if (!"".equals(orginFileName)) { + filePath = storePathString + File.separator + newName; + file.transferTo(new File(EgovWebUtil.filePathBlackList(filePath))); + } + + fvo = new FileVO(); + fvo.setFileExtsn(fileExt); + fvo.setFileStreCours(storePathString); + fvo.setFileMg(Long.toString(size)); + fvo.setOrignlFileNm(orginFileName); + fvo.setStreFileNm(newName); + fvo.setAtchFileId(atchFileIdString); + fvo.setFileSn(String.valueOf(fileKey)); + + result.add(fvo); + + fileKey++; + } + + return result; + } + + + + + /** + * 첨부파일을 서버에 저장한다. + * + * @param file + * @param newName + * @param stordFilePath + * @throws Exception + */ + protected void writeUploadedFile(MultipartFile file, String newName, String stordFilePath) throws Exception { + InputStream stream = null; + OutputStream bos = null; + + try { + stream = file.getInputStream(); + File cFile = new File(stordFilePath); + + if (!cFile.isDirectory()) { + boolean _flag = cFile.mkdir(); + if (!_flag) { + throw new IOException("Directory creation Failed "); + } + } + + bos = new FileOutputStream(stordFilePath + File.separator + newName); + + int bytesRead = 0; + byte[] buffer = new byte[BUFF_SIZE]; + + while ((bytesRead = stream.read(buffer, 0, BUFF_SIZE)) != -1) { + bos.write(buffer, 0, bytesRead); + } + } finally { + EgovResourceCloseHelper.close(bos, stream); + } + } + + /** + * 서버의 파일을 다운로드한다. + * + * @param request + * @param response + * @throws Exception + */ + public static void downFile(HttpServletRequest request, HttpServletResponse response) throws Exception { + + String downFileName = ""; + String orgFileName = ""; + + if ((String) request.getAttribute("downFile") == null) { + downFileName = ""; + } else { + downFileName = (String) request.getAttribute("downFile"); + } + + if ((String) request.getAttribute("orgFileName") == null) { + orgFileName = ""; + } else { + orgFileName = (String) request.getAttribute("orginFile"); + } + + orgFileName = orgFileName.replaceAll("\r", "").replaceAll("\n", ""); + + File file = new File(EgovWebUtil.filePathBlackList(downFileName)); + + if (!file.exists()) { + throw new FileNotFoundException(downFileName); + } + + if (!file.isFile()) { + throw new FileNotFoundException(downFileName); + } + + byte[] buffer = new byte[BUFF_SIZE]; //buffer size 2K. + + response.setContentType("application/x-msdownload"); + response.setHeader("Content-Disposition:", "attachment; filename=" + new String(orgFileName.getBytes(), "UTF-8")); + response.setHeader("Content-Transfer-Encoding", "binary"); + response.setHeader("Pragma", "no-cache"); + response.setHeader("Expires", "0"); + + BufferedInputStream fin = null; + BufferedOutputStream outs = null; + + try { + fin = new BufferedInputStream(new FileInputStream(file)); + outs = new BufferedOutputStream(response.getOutputStream()); + int read = 0; + + while ((read = fin.read(buffer)) != -1) { + outs.write(buffer, 0, read); + } + } finally { + EgovResourceCloseHelper.close(outs, fin); + } + } + + /** + * 첨부로 등록된 파일을 서버에 업로드한다. + * + * @param file + * @return + * @throws Exception + */ + public static HashMap uploadFile(MultipartFile file) throws Exception { + + HashMap map = new HashMap(); + //Write File 이후 Move File???? + String newName = ""; + String stordFilePath = EgovProperties.getProperty("Globals.fileStorePath"); + String orginFileName = file.getOriginalFilename(); + + int index = orginFileName.lastIndexOf("."); + //String fileName = orginFileName.substring(0, _index); + String fileExt = orginFileName.substring(index + 1); + long size = file.getSize(); + + //newName 은 Naming Convention에 의해서 생성 + newName = getTimeStamp(); // 2012.11 KISA 보안조치 + writeFile(file, newName, stordFilePath); + //storedFilePath는 지정 + map.put(Globals.ORIGIN_FILE_NM, orginFileName); + map.put(Globals.UPLOAD_FILE_NM, newName); + map.put(Globals.FILE_EXT, fileExt); + map.put(Globals.FILE_PATH, stordFilePath); + map.put(Globals.FILE_SIZE, String.valueOf(size)); + + return map; + } + + /** + * 파일을 실제 물리적인 경로에 생성한다. + * + * @param file + * @param newName + * @param stordFilePath + * @throws Exception + */ + protected static void writeFile(MultipartFile file, String newName, String stordFilePath) throws Exception { + InputStream stream = null; + OutputStream bos = null; + + try { + stream = file.getInputStream(); + File cFile = new File(EgovWebUtil.filePathBlackList(stordFilePath)); + + if (!cFile.isDirectory()){ + //2017.03.03 조성원 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + if (cFile.mkdirs()){ + LOGGER.debug("[file.mkdirs] saveFolder : Creation Success "); + }else{ + LOGGER.error("[file.mkdirs] saveFolder : Creation Fail "); + } + } + + bos = new FileOutputStream(EgovWebUtil.filePathBlackList(stordFilePath + File.separator + newName)); + + int bytesRead = 0; + byte[] buffer = new byte[BUFF_SIZE]; + + while ((bytesRead = stream.read(buffer, 0, BUFF_SIZE)) != -1) { + bos.write(buffer, 0, bytesRead); + } + } finally { + EgovResourceCloseHelper.close(bos, stream); + } + } + + /** + * 서버 파일에 대하여 다운로드를 처리한다. + * + * @param response + * @param streFileNm 파일저장 경로가 포함된 형태 + * @param orignFileNm + * @throws Exception + */ + public void downFile(HttpServletResponse response, String streFileNm, String orignFileNm) throws Exception { + String downFileName = streFileNm; + String orgFileName = orignFileNm; + + File file = new File(downFileName); + + if (!file.exists()) { + throw new FileNotFoundException(downFileName); + } + + if (!file.isFile()) { + throw new FileNotFoundException(downFileName); + } + + int fSize = (int) file.length(); + if (fSize > 0) { + BufferedInputStream in = null; + + try { + in = new BufferedInputStream(new FileInputStream(file)); + + String mimetype = "application/x-msdownload"; + + //response.setBufferSize(fSize); + response.setContentType(mimetype); + response.setHeader("Content-Disposition:", "attachment; filename=" + orgFileName); + response.setContentLength(fSize); + //response.setHeader("Content-Transfer-Encoding","binary"); + //response.setHeader("Pragma","no-cache"); + //response.setHeader("Expires","0"); + FileCopyUtils.copy(in, response.getOutputStream()); + } finally { + EgovResourceCloseHelper.close(in); + } + response.getOutputStream().flush(); + response.getOutputStream().close(); + } + + /* + String uploadPath = propertiesService.getString("fileDir"); + + File uFile = new File(uploadPath, requestedFile); + int fSize = (int) uFile.length(); + + if (fSize > 0) { + BufferedInputStream in = new BufferedInputStream(new FileInputStream(uFile)); + + String mimetype = "text/html"; + + //response.setBufferSize(fSize); + response.setContentType(mimetype); + response.setHeader("Content-Disposition", "attachment; filename=\"" + requestedFile + "\""); + response.setContentLength(fSize); + + FileCopyUtils.copy(in, response.getOutputStream()); + in.close(); + response.getOutputStream().flush(); + response.getOutputStream().close(); + } else { + response.setContentType("text/html"); + PrintWriter printwriter = response.getWriter(); + printwriter.println(""); + printwriter.println("


    Could not get file name:
    " + requestedFile + "

    "); + printwriter.println("


    Back

    "); + printwriter.println("


    © webAccess"); + printwriter.println(""); + printwriter.flush(); + printwriter.close(); + } + //*/ + + /* + response.setContentType("application/x-msdownload"); + response.setHeader("Content-Disposition:", "attachment; filename=" + new String(orgFileName.getBytes(),"UTF-8" )); + response.setHeader("Content-Transfer-Encoding","binary"); + response.setHeader("Pragma","no-cache"); + response.setHeader("Expires","0"); + + BufferedInputStream fin = new BufferedInputStream(new FileInputStream(file)); + BufferedOutputStream outs = new BufferedOutputStream(response.getOutputStream()); + int read = 0; + + while ((read = fin.read(b)) != -1) { + outs.write(b,0,read); + } + log.debug(this.getClass().getName()+" BufferedOutputStream Write Complete!!! "); + + outs.close(); + fin.close(); + //*/ + } + + /** + * 공통 컴포넌트 utl.fcc 패키지와 Dependency제거를 위해 내부 메서드로 추가 정의함 + * 응용어플리케이션에서 고유값을 사용하기 위해 시스템에서17자리의TIMESTAMP값을 구하는 기능 + * + * @param + * @return Timestamp 값 + * @see + */ + private static String getTimeStamp() { + + String rtnStr = null; + + // 문자열로 변환하기 위한 패턴 설정(년도-월-일 시:분:초:초(자정이후 초)) + String pattern = "yyyyMMddhhmmssSSS"; + + SimpleDateFormat sdfCurrent = new SimpleDateFormat(pattern, Locale.KOREA); + Timestamp ts = new Timestamp(System.currentTimeMillis()); + + rtnStr = sdfCurrent.format(ts.getTime()); + + return rtnStr; + } +} diff --git a/src/main/java/egovframework/com/cmm/service/EgovProperties.java b/src/main/java/egovframework/com/cmm/service/EgovProperties.java new file mode 100644 index 0000000..6e9bce9 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/service/EgovProperties.java @@ -0,0 +1,182 @@ +package egovframework.com.cmm.service; + +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import egovframework.com.cmm.EgovWebUtil; +import egovframework.com.utl.fcc.service.EgovStringUtil; + +/** + * Class Name : EgovProperties.java + * Description : properties값들을 파일로부터 읽어와 Globals클래스의 정적변수로 로드시켜주는 클래스로 + * 문자열 정보 기준으로 사용할 전역변수를 시스템 재시작으로 반영할 수 있도록 한다. + * Modification Information + * + * 수정일 수정자 수정내용 + * ---------- -------- --------------------------- + * 2009.01.19 박지욱 최초 생성 + * 2011.07.20 서준식 Globals파일의 상대경로를 읽은 메서드 추가 + * 2014.10.13 이기하 Globals.properties 값이 null일 경우 오류처리 + * 2019.04.26 신용호 RELATIVE_PATH_PREFIX Path 적용 방식 개선 + * 2022.01.21 윤주호 Try-catch-resource 조치 및 Method Refactoring + * + * @author 공통 서비스 개발팀 박지욱 + * @since 2009. 01. 19 + * @version 1.0 + * @see + * + */ + +public class EgovProperties { + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovProperties.class); + + //파일구분자 + final static String FILE_SEPARATOR = System.getProperty("file.separator"); + + //프로퍼티 파일의 물리적 위치 + //public static final String GLOBALS_PROPERTIES_FILE = System.getProperty("user.home") + FILE_SEPARATOR + "egovProps" +FILE_SEPARATOR + "globals.properties"; + + public static final String RELATIVE_PATH_PREFIX = EgovProperties.class.getResource("") == null ? "" + : EgovProperties.class.getResource("").getPath().substring(0, + EgovProperties.class.getResource("").getPath().lastIndexOf("com")); + //public static final String RELATIVE_PATH_PREFIX = EgovProperties.class.getProtectionDomain().getCodeSource().getLocation().getPath().substring(0,EgovProperties.class.getProtectionDomain().getCodeSource().getLocation().getPath().indexOf("WEB-INF/classes/")+"WEB-INF/classes/".length())+"egovframework/"; + + public static final String GLOBALS_PROPERTIES_FILE = RELATIVE_PATH_PREFIX + "egovProps" + FILE_SEPARATOR + + "globals.properties"; + + /** + * 인자로 주어진 문자열을 Key값으로 하는 프로퍼티 값을 반환한다(Globals.java 전용) + * @param keyName String + * @return String + */ + public static String getProperty(String keyName) { + LOGGER.debug("===>>> getProperty" + EgovProperties.class.getProtectionDomain().getCodeSource() == null ? "" + : EgovStringUtil + .isNullToString(EgovProperties.class.getProtectionDomain().getCodeSource().getLocation().getPath())); + LOGGER.debug("getProperty : {} = {}", GLOBALS_PROPERTIES_FILE, keyName); + + return getPropertyValueByKey(keyName); + } + + /** + * 인자로 주어진 문자열을 Key값으로 하는 상대경로 프로퍼티 값을 절대경로로 반환한다(Globals.java 전용) + * @param keyName String + * @return String + */ + public static String getPathProperty(String keyName) { + LOGGER.debug("getPathProperty : {} = {}", GLOBALS_PROPERTIES_FILE, keyName); + + return RELATIVE_PATH_PREFIX + "egovProps" + FILE_SEPARATOR + getProperty(keyName); + } + + /** + * 주어진 파일에서 인자로 주어진 문자열을 Key값으로 하는 프로퍼티 값을 반환한다 + * @param fileName String + * @param key String + * @return String + */ + public static String getProperty(String fileName, String keyName) { + return getPropertyValueByKey(fileName, keyName); + } + + /** + * 주어진 파일에서 인자로 주어진 문자열을 Key값으로 하는 프로퍼티 상대 경로값을 절대 경로값으로 반환한다 + * @param fileName String + * @param key String + * @return String + */ + public static String getPathProperty(String fileName, String keyName) { + return RELATIVE_PATH_PREFIX + "egovProps" + FILE_SEPARATOR + getProperty(fileName, keyName); + } + + /** + * 주어진 프로파일의 내용을 파싱하여 (key-value) 형태의 구조체 배열을 반환한다. + * @param property String + * @return ArrayList + */ + public static ArrayList> loadPropertyFile(String property) { + + // key - value 형태로 된 배열 결과 + ArrayList> keyList = new ArrayList>(); + + String src = property.replace('\\', File.separatorChar).replace('/', File.separatorChar); + + if (Files.exists(Paths.get(EgovWebUtil.filePathBlackList(src)))) { //2022.01 Potential Path Traversal + Properties props = loadPropertiesFromFile(src); + + Enumeration plist = props.propertyNames(); + if (plist != null) { + while (plist.hasMoreElements()) { + Map map = new HashMap(); + String key = (String)plist.nextElement(); + map.put(key, props.getProperty(key)); + keyList.add(map); + } + } + } + + return keyList; + } + + /** + * 기본 Property 에서 Property Key로 Property value 받아온다. + * @param keyName + * @return + */ + public static String getPropertyValueByKey(String keyName) { + return getPropertyValueByKey(GLOBALS_PROPERTIES_FILE, keyName); + } + + /** + * Property 파일을 지정하여 Property Key로 Property value 받아온다. + * @param fileName + * @param keyName + * @return + */ + public static String getPropertyValueByKey(String fileName, String keyName) { + String propertyValue = ""; + Properties props = loadPropertiesFromFile(fileName); + + if (props.containsKey(keyName)) { + propertyValue = props.getProperty(keyName).trim(); + } + + return propertyValue; + } + + /** + * Property 파일패스로 Properties 객체를 리턴한다. + * @param fileName + * @return + */ + private static Properties loadPropertiesFromFile(String fileName) { + Properties props = new Properties(); + + try (FileInputStream fis = new FileInputStream(EgovWebUtil.filePathBlackList(fileName)); + BufferedInputStream bis = new BufferedInputStream(fis);) { + props.load(bis); + } catch (FileNotFoundException fne) { + LOGGER.debug("Property file not found.", fne); + throw new RuntimeException("Property file not found", fne); + } catch (IOException ioe) { + LOGGER.debug("Property file IO exception", ioe); + throw new RuntimeException("Property file IO exception", ioe); + } + + return props; + } +} diff --git a/src/main/java/egovframework/com/cmm/service/EgovUserDetailsService.java b/src/main/java/egovframework/com/cmm/service/EgovUserDetailsService.java new file mode 100644 index 0000000..796f5ef --- /dev/null +++ b/src/main/java/egovframework/com/cmm/service/EgovUserDetailsService.java @@ -0,0 +1,26 @@ +package egovframework.com.cmm.service; + +import java.util.List; + +public interface EgovUserDetailsService { + + /** + * 인증된 사용자객체를 VO형식으로 가져온다. + * @return Object - 사용자 ValueObject + */ + public Object getAuthenticatedUser(); + + /** + * 인증된 사용자의 권한 정보를 가져온다. + * 예) [ROLE_ADMIN, ROLE_USER, ROLE_A, ROLE_B, ROLE_RESTRICTED, IS_AUTHENTICATED_FULLY, IS_AUTHENTICATED_REMEMBERED, IS_AUTHENTICATED_ANONYMOUSLY] + * @return List - 사용자 권한정보 목록 + */ + public List getAuthorities(); + + /** + * 인증된 사용자 여부를 체크한다. + * @return Boolean - 인증된 사용자 여부(TRUE / FALSE) + */ + public Boolean isAuthenticated(); + +} diff --git a/src/main/java/egovframework/com/cmm/service/FileResizeUtil.java b/src/main/java/egovframework/com/cmm/service/FileResizeUtil.java new file mode 100644 index 0000000..6c7a963 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/service/FileResizeUtil.java @@ -0,0 +1,148 @@ +package egovframework.com.cmm.service; + +import java.awt.image.BufferedImage; +import java.io.File; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; + +import javax.annotation.Resource; +import javax.imageio.ImageIO; + +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; +import org.imgscalr.Scalr; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; +import org.springframework.web.multipart.MultipartFile; + +import egovframework.com.cmm.EgovWebUtil; + +/** + * @Class Name : FileResizeUtil.java + * @Description : 파일 리사이즈 관련 유틸리티 + * @Modification Information + * + * 수정일 수정자 수정내용 + * ---------- -------- --------------------------- + * 2023.08.16 정진아 최초 생성 + * + * @author + * @since 2023.08.16 + * @version 1.0 + * @see + * + */ + +@Component("FileResizeUtil") +public class FileResizeUtil { + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovFileMngUtil.class); + + @Resource(name = "egovFileIdGnrService") + private EgovIdGnrService idgenService; + + public List parseFileInf(MultipartFile file, String KeyStr, int fileKeyParam, String atchFileId, String storePath, String resizeMode) throws Exception { + int fileKey = fileKeyParam; + + String storePathString = ""; + String atchFileIdString = ""; + + // 파일 저장 위치 설정 + if ("".equals(storePath) || storePath == null) { + storePathString = EgovProperties.getProperty("Globals.fileStorePath"); + } else { + storePathString = EgovProperties.getProperty(storePath); + } + + // 파일 아이디 생성 + if ("".equals(atchFileId) || atchFileId == null) { + atchFileIdString = idgenService.getNextStringId(); + } else { + atchFileIdString = atchFileId; + } + + File saveFolder = new File(EgovWebUtil.filePathBlackList(storePathString)); + if (!saveFolder.exists() || saveFolder.isFile()) { + if (saveFolder.mkdirs()) { + LOGGER.debug("[file.mkdirs] saveFolder : Creation Success "); + } else { + LOGGER.error("[file.mkdirs] saveFolder : Creation Fail "); + } + } + + String filePath = ""; + List result = new ArrayList<>(); + FileVO fvo; + + String orginFileName = file.getOriginalFilename(); + + BufferedImage bufferedImage = ImageIO.read(file.getInputStream()); + + // 이미지 리사이징 처리 + if ("width".equals(resizeMode)) { + bufferedImage = resizeWidthImage(bufferedImage, 300); + } else if ("height".equals(resizeMode)) { + bufferedImage = resizeHeightImage(bufferedImage, 300); + } else if ("both".equals(resizeMode)) { + bufferedImage = resizeImage(bufferedImage, 300, 300); + } + + if ("".equals(orginFileName)) { + // 원 파일명이 없는 경우 처리 + } + + int index = orginFileName.lastIndexOf("."); + String fileExt = orginFileName.substring(index + 1); + String newName = KeyStr + getTimeStamp() + fileKey; + + File outputFile = null; + + // 파일 생성 + if (!"".equals(orginFileName)) { + filePath = storePathString + File.separator + newName; + outputFile = new File(filePath); + ImageIO.write(bufferedImage, fileExt, outputFile); + } + + long fileSizeBytes = outputFile.length(); + + fvo = new FileVO(); + fvo.setFileExtsn(fileExt); + fvo.setFileStreCours(storePathString); + fvo.setFileMg(Long.toString(fileSizeBytes)); + fvo.setOrignlFileNm(orginFileName); + fvo.setStreFileNm(newName); + fvo.setAtchFileId(atchFileIdString); + fvo.setFileSn(String.valueOf(fileKey)); + + result.add(fvo); + + fileKey++; + + return result; + } + + private BufferedImage resizeImage(BufferedImage bufferedImage, int targetWidth, int targetHeight) throws Exception { + return Scalr.resize(bufferedImage, Scalr.Method.QUALITY, Scalr.Mode.FIT_EXACT, targetWidth, targetHeight, Scalr.OP_ANTIALIAS); + } + + private BufferedImage resizeWidthImage(BufferedImage bufferedImage, int targetWidth) throws Exception { + return Scalr.resize(bufferedImage, Scalr.Method.QUALITY, Scalr.Mode.FIT_TO_WIDTH, targetWidth); + } + + private BufferedImage resizeHeightImage(BufferedImage bufferedImage, int targetHeight) throws Exception { + return Scalr.resize(bufferedImage, Scalr.Method.QUALITY, Scalr.Mode.FIT_TO_HEIGHT, targetHeight); + } + + private static String getTimeStamp() { + String rtnStr = null; + String pattern = "yyyyMMddhhmmssSSS"; + SimpleDateFormat sdfCurrent = new SimpleDateFormat(pattern, Locale.KOREA); + Timestamp ts = new Timestamp(System.currentTimeMillis()); + rtnStr = sdfCurrent.format(ts.getTime()); + return rtnStr; + } +} diff --git a/src/main/java/egovframework/com/cmm/service/FileVO.java b/src/main/java/egovframework/com/cmm/service/FileVO.java new file mode 100644 index 0000000..6f5e0f3 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/service/FileVO.java @@ -0,0 +1,240 @@ +package egovframework.com.cmm.service; + +import java.io.Serializable; + +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * @Class Name : FileVO.java + * @Description : 파일정보 처리를 위한 VO 클래스 + * @Modification Information + * + * 수정일 수정자 수정내용 + * ------- ------- ------------------- + * 2009. 3. 25. 이삼섭 + * + * @author 공통 서비스 개발팀 이삼섭 + * @since 2009. 3. 25. + * @version + * @see + * + */ +@SuppressWarnings("serial") +public class FileVO implements Serializable { + + /** + * 첨부파일 아이디 + */ + public String atchFileId = ""; + /** + * 생성일자 + */ + public String creatDt = ""; + /** + * 파일내용 + */ + public String fileCn = ""; + /** + * 파일확장자 + */ + public String fileExtsn = ""; + /** + * 파일크기 + */ + public String fileMg = ""; + /** + * 파일연번 + */ + public String fileSn = ""; + /** + * 파일저장경로 + */ + public String fileStreCours = ""; + /** + * 원파일명 + */ + public String orignlFileNm = ""; + /** + * 저장파일명 + */ + public String streFileNm = ""; + + /** + * atchFileId attribute를 리턴한다. + * + * @return the atchFileId + */ + public String getAtchFileId() { + return atchFileId; + } + + /** + * atchFileId attribute 값을 설정한다. + * + * @param atchFileId + * the atchFileId to set + */ + public void setAtchFileId(String atchFileId) { + this.atchFileId = atchFileId; + } + + /** + * creatDt attribute를 리턴한다. + * + * @return the creatDt + */ + public String getCreatDt() { + return creatDt; + } + + /** + * creatDt attribute 값을 설정한다. + * + * @param creatDt + * the creatDt to set + */ + public void setCreatDt(String creatDt) { + this.creatDt = creatDt; + } + + /** + * fileCn attribute를 리턴한다. + * + * @return the fileCn + */ + public String getFileCn() { + return fileCn; + } + + /** + * fileCn attribute 값을 설정한다. + * + * @param fileCn + * the fileCn to set + */ + public void setFileCn(String fileCn) { + this.fileCn = fileCn; + } + + /** + * fileExtsn attribute를 리턴한다. + * + * @return the fileExtsn + */ + public String getFileExtsn() { + return fileExtsn; + } + + /** + * fileExtsn attribute 값을 설정한다. + * + * @param fileExtsn + * the fileExtsn to set + */ + public void setFileExtsn(String fileExtsn) { + this.fileExtsn = fileExtsn; + } + + /** + * fileMg attribute를 리턴한다. + * + * @return the fileMg + */ + public String getFileMg() { + return fileMg; + } + + /** + * fileMg attribute 값을 설정한다. + * + * @param fileMg + * the fileMg to set + */ + public void setFileMg(String fileMg) { + this.fileMg = fileMg; + } + + /** + * fileSn attribute를 리턴한다. + * + * @return the fileSn + */ + public String getFileSn() { + return fileSn; + } + + /** + * fileSn attribute 값을 설정한다. + * + * @param fileSn + * the fileSn to set + */ + public void setFileSn(String fileSn) { + this.fileSn = fileSn; + } + + /** + * fileStreCours attribute를 리턴한다. + * + * @return the fileStreCours + */ + public String getFileStreCours() { + return fileStreCours; + } + + /** + * fileStreCours attribute 값을 설정한다. + * + * @param fileStreCours + * the fileStreCours to set + */ + public void setFileStreCours(String fileStreCours) { + this.fileStreCours = fileStreCours; + } + + /** + * orignlFileNm attribute를 리턴한다. + * + * @return the orignlFileNm + */ + public String getOrignlFileNm() { + return orignlFileNm; + } + + /** + * orignlFileNm attribute 값을 설정한다. + * + * @param orignlFileNm + * the orignlFileNm to set + */ + public void setOrignlFileNm(String orignlFileNm) { + this.orignlFileNm = orignlFileNm; + } + + /** + * streFileNm attribute를 리턴한다. + * + * @return the streFileNm + */ + public String getStreFileNm() { + return streFileNm; + } + + /** + * streFileNm attribute 값을 설정한다. + * + * @param streFileNm + * the streFileNm to set + */ + public void setStreFileNm(String streFileNm) { + this.streFileNm = streFileNm; + } + + /** + * toString 메소드를 대치한다. + */ + public String toString() { + return ToStringBuilder.reflectionToString(this); + } + +} diff --git a/src/main/java/egovframework/com/cmm/service/Globals.java b/src/main/java/egovframework/com/cmm/service/Globals.java new file mode 100644 index 0000000..2b71770 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/service/Globals.java @@ -0,0 +1,59 @@ +package egovframework.com.cmm.service; + +/** + * Class Name : Globals.java + * Description : 시스템 구동 시 프로퍼티를 통해 사용될 전역변수를 정의한다. + * Modification Information + * + * 수정일 수정자 수정내용 + * ------- -------- --------------------------- + * 2009.01.19 박지욱 최초 생성 + * + * @author 공통 서비스 개발팀 박지욱 + * @since 2009. 01. 19 + * @version 1.0 + * @see + * + */ + +public class Globals { + //OS 유형 + public static final String OS_TYPE = EgovProperties.getProperty("Globals.OsType"); + //DB 유형 + public static final String DB_TYPE = EgovProperties.getProperty("Globals.DbType"); + //메인 페이지 + public static final String MAIN_PAGE = EgovProperties.getProperty("Globals.MainPage"); + //ShellFile 경로 + public static final String SHELL_FILE_PATH = EgovProperties.getPathProperty("Globals.ShellFilePath"); + //퍼로퍼티 파일 위치 + public static final String CONF_PATH = EgovProperties.getPathProperty("Globals.ConfPath"); + //Server정보 프로퍼티 위치 + public static final String SERVER_CONF_PATH = EgovProperties.getPathProperty("Globals.ServerConfPath"); + //Client정보 프로퍼티 위치 + public static final String CLIENT_CONF_PATH = EgovProperties.getPathProperty("Globals.ClientConfPath"); + //파일포맷 정보 프로퍼티 위치 + public static final String FILE_FORMAT_PATH = EgovProperties.getPathProperty("Globals.FileFormatPath"); + + //파일 업로드 원 파일명 + public static final String ORIGIN_FILE_NM = "originalFileName"; + //파일 확장자 + public static final String FILE_EXT = "fileExtension"; + //파일크기 + public static final String FILE_SIZE = "fileSize"; + //업로드된 파일명 + public static final String UPLOAD_FILE_NM = "uploadFileName"; + //파일경로 + public static final String FILE_PATH = "filePath"; + + //메일발송요청 XML파일경로 + public static final String MAIL_REQUEST_PATH = EgovProperties.getPathProperty("Globals.MailRequestPath"); + //메일발송응답 XML파일경로 + public static final String MAIL_RESPONSE_PATH = EgovProperties.getPathProperty("Globals.MailRResponsePath"); + + // G4C 연결용 IP (localhost) + public static final String LOCAL_IP = EgovProperties.getProperty("Globals.LocalIp"); + + //SMS 정보 프로퍼티 위치 + public static final String SMSDB_CONF_PATH = EgovProperties.getPathProperty("Globals.SmsDbConfPath"); + +} diff --git a/src/main/java/egovframework/com/cmm/service/impl/CmmUseDAO.java b/src/main/java/egovframework/com/cmm/service/impl/CmmUseDAO.java new file mode 100644 index 0000000..67a1b1b --- /dev/null +++ b/src/main/java/egovframework/com/cmm/service/impl/CmmUseDAO.java @@ -0,0 +1,87 @@ +package egovframework.com.cmm.service.impl; + +import java.util.List; + +import egovframework.com.cmm.ComDefaultCodeVO; +import egovframework.com.cmm.service.CmmnDetailCode; +import kccf.cmm.vo.CmmCodeVO; + +import org.springframework.stereotype.Repository; + +/** + * @Class Name : CmmUseDAO.java + * @Description : 공통코드등 전체 업무에서 공용해서 사용해야 하는 서비스를 정의하기위한 데이터 접근 클래스 + * @Modification Information + * + * 수정일 수정자 수정내용 + * ------- ------- ------------------- + * 2009. 3. 11. 이삼섭 + * + * @author 공통 서비스 개발팀 이삼섭 + * @since 2009. 3. 11. + * @version + * @see + * + */ +@Repository("cmmUseDAO") +public class CmmUseDAO extends EgovComAbstractDAO { + + /** + * (문화원) 주어진 조건에 따른 공통코드를 불러온다. + * + * @param vo + * @return + * @throws Exception + */ + public List selectCmmCode(CmmCodeVO cmmCode) { + return (List) list("CmmUseDAO.selectCmmCode",cmmCode); + } + + /** + * (문화원) 주어진 조건에 따른 공통코드를 불러온다. + * + * @param vo + * @return + * @throws Exception + */ + public List selectAditCodeItem(String bbsId) { + return selectList("CmmUseDAO.selectAditCodeItem", bbsId); + } + + /** + * 주어진 조건에 따른 공통코드를 불러온다. + * + * @param vo + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List selectCmmCodeDetail(ComDefaultCodeVO vo) throws Exception { + return (List) list("CmmUseDAO.selectCmmCodeDetail", vo); + } + + /** + * 공통코드로 사용할 조직정보를 를 불러온다. + * + * @param vo + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List selectOgrnztIdDetail(ComDefaultCodeVO vo) throws Exception { + return (List) list("CmmUseDAO.selectOgrnztIdDetail", vo); + } + + /** + * 공통코드로 사용할그룹정보를 를 불러온다. + * @param vo + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List selectGroupIdDetail(ComDefaultCodeVO vo) throws Exception { + return (List) list("CmmUseDAO.selectGroupIdDetail", vo); + } + + +} diff --git a/src/main/java/egovframework/com/cmm/service/impl/EgoDummyUserDetailsServiceImpl.java b/src/main/java/egovframework/com/cmm/service/impl/EgoDummyUserDetailsServiceImpl.java new file mode 100644 index 0000000..6d53fc6 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/service/impl/EgoDummyUserDetailsServiceImpl.java @@ -0,0 +1,70 @@ +package egovframework.com.cmm.service.impl; + +import java.util.ArrayList; +import java.util.List; + +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.service.EgovUserDetailsService; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +/** + * + * @author 공통서비스 개발팀 서준식 + * @since 2011. 8. 12. + * @version 1.0 + * @see + * + *
    + * 개정이력(Modification Information)
    + *
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2011. 8. 12.    서준식        최초생성
    + *  2017. 9. 04.    장동한        클래스 이름 변경(EgovTestUserDetailsServiceImpl > EgovUserDetailsService)
    + * 
    + *
    + *  
    + */ + +public class EgoDummyUserDetailsServiceImpl extends EgovAbstractServiceImpl implements + EgovUserDetailsService { + + //로그인 객체 + LoginVO loginVO = new LoginVO(); + //권한목록 객체 + List listAuth = new ArrayList(); + + @Override + public Object getAuthenticatedUser() { + loginVO.setId("TEST1"); + loginVO.setPassword("raHLBnHFcunwNzcDcfad4PhD11hHgXSUr7fc1Jk9uoQ="); + loginVO.setUserSe("USR"); + loginVO.setEmail("egovframe@nia.or.kr"); + loginVO.setIhidNum(""); + loginVO.setName("더미사용자"); + loginVO.setOrgnztId("ORGNZT_0000000000000"); + loginVO.setUniqId("USRCNFRM_00000000000"); + return loginVO; + } + + @Override + public List getAuthorities() { + // 권한 설정을 리턴한다. + listAuth.add("IS_AUTHENTICATED_ANONYMOUSLY"); + listAuth.add("IS_AUTHENTICATED_FULLY"); + listAuth.add("IS_AUTHENTICATED_REMEMBERED"); + listAuth.add("ROLE_ADMIN"); + listAuth.add("ROLE_ANONYMOUS"); + listAuth.add("ROLE_RESTRICTED"); + listAuth.add("ROLE_USER"); + return listAuth; + } + + @Override + public Boolean isAuthenticated() { + // 인증된 유저인지 확인한다. + return true; + } + +} diff --git a/src/main/java/egovframework/com/cmm/service/impl/EgovCmmUseServiceImpl.java b/src/main/java/egovframework/com/cmm/service/impl/EgovCmmUseServiceImpl.java new file mode 100644 index 0000000..a686fcc --- /dev/null +++ b/src/main/java/egovframework/com/cmm/service/impl/EgovCmmUseServiceImpl.java @@ -0,0 +1,118 @@ +package egovframework.com.cmm.service.impl; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import egovframework.com.cmm.ComDefaultCodeVO; +import egovframework.com.cmm.service.CmmnDetailCode; +import egovframework.com.cmm.service.EgovCmmUseService; +import kccf.cmm.vo.CmmCodeVO; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +/** + * @Class Name : EgovCmmUseServiceImpl.java + * @Description : 공통코드등 전체 업무에서 공용해서 사용해야 하는 서비스를 정의하기위한 서비스 구현 클래스 + * @Modification Information + * + * 수정일 수정자 수정내용 + * ------- ------- ------------------- + * 2009. 3. 11. 이삼섭 + * + * @author 공통 서비스 개발팀 이삼섭 + * @since 2009. 3. 11. + * @version + * @see + * + */ +@Service("EgovCmmUseService") +public class EgovCmmUseServiceImpl extends EgovAbstractServiceImpl implements EgovCmmUseService { + + @Resource(name = "cmmUseDAO") + private CmmUseDAO cmmUseDAO; + + /** + * (문화원) 공통코드를 조회한다. + * + * @param vo + * @return + * @throws Exception + */ + @Override + public List selectCmmCode(CmmCodeVO cmmCode) throws Exception { + return cmmUseDAO.selectCmmCode(cmmCode); + } + + /** + * (문화원) 공통코드를 조회한다. + * + * @param vo + * @return + * @throws Exception + */ + @Override + public List selectAditCodeItem(String bbsId) throws Exception { + return cmmUseDAO.selectAditCodeItem(bbsId); + } + + /** + * 공통코드를 조회한다. + * + * @param vo + * @return + * @throws Exception + */ + public List selectCmmCodeDetail(ComDefaultCodeVO vo) throws Exception { + return cmmUseDAO.selectCmmCodeDetail(vo); + } + + /** + * ComDefaultCodeVO의 리스트를 받아서 여러개의 코드 리스트를 맵에 담아서 리턴한다. + * + * @param voList + * @return + * @throws Exception + */ + public Map> selectCmmCodeDetails(List voList) throws Exception { + ComDefaultCodeVO vo; + Map> map = new HashMap>(); + + Iterator iter = voList.iterator(); + while (iter.hasNext()) { + vo = (ComDefaultCodeVO)iter.next(); + map.put(vo.getCodeId(), cmmUseDAO.selectCmmCodeDetail(vo)); + } + + return map; + } + + /** + * 조직정보를 코드형태로 리턴한다. + * + * @param 조회조건정보 vo + * @return 조직정보 List + * @throws Exception + */ + public List selectOgrnztIdDetail(ComDefaultCodeVO vo) throws Exception { + return cmmUseDAO.selectOgrnztIdDetail(vo); + } + + /** + * 그룹정보를 코드형태로 리턴한다. + * + * @param 조회조건정보 vo + * @return 그룹정보 List + * @throws Exception + */ + public List selectGroupIdDetail(ComDefaultCodeVO vo) throws Exception { + return cmmUseDAO.selectGroupIdDetail(vo); + } + + +} diff --git a/src/main/java/egovframework/com/cmm/service/impl/EgovComAbstractDAO.java b/src/main/java/egovframework/com/cmm/service/impl/EgovComAbstractDAO.java new file mode 100644 index 0000000..004f992 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/service/impl/EgovComAbstractDAO.java @@ -0,0 +1,306 @@ +/** + * + */ +package egovframework.com.cmm.service.impl; + +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import org.apache.ibatis.session.ResultHandler; +import org.apache.ibatis.session.RowBounds; +import org.apache.ibatis.session.SqlSessionFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.egovframe.rte.psl.dataaccess.EgovAbstractMapper; +/** + * EgovComAbstractDAO.java 클래스 + * + * @author 서준식 + * @since 2011. 9. 23. + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    -------------    ----------------------
    + *   2011. 9. 23.   서준식        최초 생성
    + *   2016. 5. 11.   장동한        myBatis 방식 적용
    + * 
    + */ +public abstract class EgovComAbstractDAO extends EgovAbstractMapper{ + + private final Logger LOGGER = LoggerFactory.getLogger(this.getClass()); + + @Resource(name="egov.sqlSession") + public void setSqlSessionFactory(SqlSessionFactory sqlSession) { + super.setSqlSessionFactory(sqlSession); + } + + /** + * 입력 처리 SQL mapping 을 실행한다. + * + * @param queryId - 입력 처리 SQL mapping 쿼리 ID + * + * @return DBMS가 지원하는 경우 insert 적용 결과 count + */ + @Override + public int insert(String queryId) { + LOGGER.debug("queryId = "+queryId); + return getSqlSession().insert(queryId); + } + + /** + * 입력 처리 SQL mapping 을 실행한다. + * + * @param queryId - 입력 처리 SQL mapping 쿼리 ID + * @param parameterObject - 입력 처리 SQL mapping 입력 데이터를 세팅한 파라메터 객체(보통 VO 또는 Map) + * + * @return DBMS가 지원하는 경우 insert 적용 결과 count + */ + @Override + public int insert(String queryId, Object parameterObject) { + LOGGER.debug("queryId = "+queryId); + return getSqlSession().insert(queryId, parameterObject); + } + + /** + * 수정 처리 SQL mapping 을 실행한다. + * + * @param queryId - 수정 처리 SQL mapping 쿼리 ID + * + * @return DBMS가 지원하는 경우 update 적용 결과 count + */ + @Override + public int update(String queryId) { + LOGGER.debug("queryId = "+queryId); + return getSqlSession().update(queryId); + } + + /** + * 수정 처리 SQL mapping 을 실행한다. + * + * @param queryId - 수정 처리 SQL mapping 쿼리 ID + * @param parameterObject - 수정 처리 SQL mapping 입력 데이터(key 조건 및 변경 데이터)를 세팅한 파라메터 객체(보통 VO 또는 Map) + * + * @return DBMS가 지원하는 경우 update 적용 결과 count + */ + @Override + public int update(String queryId, Object parameterObject) { + LOGGER.debug("queryId = "+queryId); + return getSqlSession().update(queryId, parameterObject); + } + + /** + * 삭제 처리 SQL mapping 을 실행한다. + * + * @param queryId - 삭제 처리 SQL mapping 쿼리 ID + * + * @return DBMS가 지원하는 경우 delete 적용 결과 count + */ + @Override + public int delete(String queryId) { + LOGGER.debug("queryId = "+queryId); + return getSqlSession().delete(queryId); + } + + /** + * 삭제 처리 SQL mapping 을 실행한다. + * + * @param queryId - 삭제 처리 SQL mapping 쿼리 ID + * @param parameterObject - 삭제 처리 SQL mapping 입력 데이터(일반적으로 key 조건)를 세팅한 파라메터 객체(보통 VO 또는 Map) + * + * @return DBMS가 지원하는 경우 delete 적용 결과 count + */ + @Override + public int delete(String queryId, Object parameterObject) { + LOGGER.debug("queryId = "+queryId); + return getSqlSession().delete(queryId, parameterObject); + } + + //CHECKSTYLE:OFF + /** + * 명명규칙에 맞춰 selectOne()로 변경한다. + * @deprecated select() 메소드로 대체 + * + * @see EgovAbstractMapper.selectOne() + */ + //CHECKSTYLE:ON + @Deprecated + public Object selectByPk(String queryId, Object parameterObject) { + LOGGER.debug("queryId = "+queryId); + return getSqlSession().selectOne(queryId, parameterObject); + } + + /** + * 단건조회 처리 SQL mapping 을 실행한다. + * + * @param queryId - 단건 조회 처리 SQL mapping 쿼리 ID + * + * @return 결과 객체 - SQL mapping 파일에서 지정한 resultType/resultMap 에 의한 단일 결과 객체(보통 VO 또는 Map) + */ + @Override + public T selectOne(String queryId) { + LOGGER.debug("queryId = "+queryId); + return getSqlSession().selectOne(queryId); + } + + /** + * 단건조회 처리 SQL mapping 을 실행한다. + * + * @param queryId - 단건 조회 처리 SQL mapping 쿼리 ID + * @param parameterObject - 단건 조회 처리 SQL mapping 입력 데이터(key)를 세팅한 파라메터 객체(보통 VO 또는 Map) + * + * @return 결과 객체 - SQL mapping 파일에서 지정한 resultType/resultMap 에 의한 단일 결과 객체(보통 VO 또는 Map) + */ + @Override + public T selectOne(String queryId, Object parameterObject) { + LOGGER.debug("queryId = "+queryId); + return getSqlSession().selectOne(queryId, parameterObject); + } + + /** + * 결과 목록을 Map 을 변환한다. + * 모든 구문이 파라미터를 필요로 하지는 않기 때문에, 파라미터 객체를 요구하지 않는 형태로 오버로드되었다. + * + * @param queryId - 단건 조회 처리 SQL mapping 쿼리 ID + * @param mapKey - 결과 객체의 프로퍼티 중 하나를 키로 사용 + * + * @return 결과 객체 - SQL mapping 파일에서 지정한 resultType/resultMap 에 의한 단일 결과 객체(보통 VO 또는 Map)의 Map + */ + @Override + public Map selectMap(String queryId, String mapKey) { + LOGGER.debug("queryId = "+queryId); + return getSqlSession().selectMap(queryId, mapKey); + } + + /** + * 결과 목록을 Map 을 변환한다. + * 모든 구문이 파라미터를 필요로 하지는 않기 때문에, 파라미터 객체를 요구하지 않는 형태로 오버로드되었다. + * + * @param queryId - 단건 조회 처리 SQL mapping 쿼리 ID + * @param parameterObject - 맵 조회 처리 SQL mapping 입력 데이터(조회 조건)를 세팅한 파라메터 객체(보통 VO 또는 Map) + * @param mapKey - 결과 객체의 프로퍼티 중 하나를 키로 사용 + * + * @return 결과 객체 - SQL mapping 파일에서 지정한 resultType/resultMap 에 의한 단일 결과 객체(보통 VO 또는 Map)의 Map + */ + @Override + public Map selectMap(String queryId, Object parameterObject, String mapKey) { + LOGGER.debug("queryId = "+queryId); + return getSqlSession().selectMap(queryId, parameterObject, mapKey); + } + + /** + * 결과 목록을 Map 을 변환한다. + * 모든 구문이 파라미터를 필요로 하지는 않기 때문에, 파라미터 객체를 요구하지 않는 형태로 오버로드되었다. + * + * @param queryId - 단건 조회 처리 SQL mapping 쿼리 ID + * @param parameterObject - 맵 조회 처리 SQL mapping 입력 데이터(조회 조건)를 세팅한 파라메터 객체(보통 VO 또는 Map) + * @param mapKey - 결과 객체의 프로퍼티 중 하나를 키로 사용 + * @param rowBounds - 특정 개수 만큼의 레코드를 건너띄게 함 + * + * @return 결과 객체 - SQL mapping 파일에서 지정한 resultType/resultMap 에 의한 단일 결과 객체(보통 VO 또는 Map)의 Map + */ + @Override + public Map selectMap(String queryId, Object parameterObject, String mapKey, RowBounds rowBounds) { + LOGGER.debug("queryId = "+queryId); + return getSqlSession().selectMap(queryId, parameterObject, mapKey, rowBounds); + } + + //CHECKSTYLE:OFF + /** + * 명명규칙에 맞춰 selectList()로 변경한다. + * + * @see EgovAbstractMapper.selectList() + * @deprecated List 메소드로 대체 + */ + //CHECKSTYLE:ON + @Deprecated + public List list(String queryId, Object parameterObject) { + LOGGER.debug("queryId = "+queryId); + return getSqlSession().selectList(queryId, parameterObject); + } + + /** + * 리스트 조회 처리 SQL mapping 을 실행한다. + * + * @param queryId - 리스트 조회 처리 SQL mapping 쿼리 ID + * + * @return 결과 List 객체 - SQL mapping 파일에서 지정한 resultType/resultMap 에 의한 결과 객체(보통 VO 또는 Map)의 List + */ + @Override + public List selectList(String queryId) { + LOGGER.debug("queryId = "+queryId); + return getSqlSession().selectList(queryId); + } + + /** + * 리스트 조회 처리 SQL mapping 을 실행한다. + * + * @param queryId - 리스트 조회 처리 SQL mapping 쿼리 ID + * @param parameterObject - 리스트 조회 처리 SQL mapping 입력 데이터(조회 조건)를 세팅한 파라메터 객체(보통 VO 또는 Map) + * + * @return 결과 List 객체 - SQL mapping 파일에서 지정한 resultType/resultMap 에 의한 결과 객체(보통 VO 또는 Map)의 List + */ + @Override + public List selectList(String queryId, Object parameterObject) { + LOGGER.debug("queryId = "+queryId); + return getSqlSession().selectList(queryId, parameterObject); + } + + /** + * 리스트 조회 처리 SQL mapping 을 실행한다. + * + * @param queryId - 리스트 조회 처리 SQL mapping 쿼리 ID + * @param parameterObject - 리스트 조회 처리 SQL mapping 입력 데이터(조회 조건)를 세팅한 파라메터 객체(보통 VO 또는 Map) + * @param rowBounds - 특정 개수 만큼의 레코드를 건너띄게 함 + * + * @return 결과 List 객체 - SQL mapping 파일에서 지정한 resultType/resultMap 에 의한 결과 객체(보통 VO 또는 Map)의 List + */ + @Override + public List selectList(String queryId, Object parameterObject, RowBounds rowBounds) { + LOGGER.debug("queryId = "+queryId); + return getSqlSession().selectList(queryId, parameterObject, rowBounds); + } + + /** + * 부분 범위 리스트 조회 처리 SQL mapping 을 실행한다. + * (부분 범위 - pageIndex 와 pageSize 기반으로 현재 부분 범위 조회를 위한 skipResults, maxResults 를 계산하여 ibatis 호출) + * + * @param queryId - 리스트 조회 처리 SQL mapping 쿼리 ID + * @param parameterObject - 리스트 조회 처리 SQL mapping 입력 데이터(조회 조건)를 세팅한 파라메터 객체(보통 VO 또는 Map) + * @param pageIndex - 현재 페이지 번호 + * @param pageSize - 한 페이지 조회 수(pageSize) + * + * @return 부분 범위 결과 List 객체 - SQL mapping 파일에서 지정한 resultType/resultMap 에 의한 부분 범위 결과 객체(보통 VO 또는 Map) List + */ + @Override + public List listWithPaging(String queryId, Object parameterObject, int pageIndex, int pageSize) { + LOGGER.debug("queryId = "+queryId); + int skipResults = pageIndex * pageSize; + //int maxResults = (pageIndex * pageSize) + pageSize; + + RowBounds rowBounds = new RowBounds(skipResults, pageSize); + + return getSqlSession().selectList(queryId, parameterObject, rowBounds); + } + + /** + * SQL 조회 결과를 ResultHandler를 이용해서 출력한다. + * ResultHandler를 상속해 구현한 커스텀 핸들러의 handleResult() 메서드에 따라 실행된다. + * + * @param queryId - 리스트 조회 처리 SQL mapping 쿼리 ID + * @param handler - 조회 결과를 제어하기 위해 구현한 ResultHandler + * @return + * + * @return 결과 List 객체 - SQL mapping 파일에서 지정한 resultType/resultMap 에 의한 결과 객체(보통 VO 또는 Map)의 List + */ + @Override + public void listToOutUsingResultHandler(String queryId, ResultHandler handler) { + LOGGER.debug("queryId = "+queryId); + getSqlSession().select(queryId, handler); + } +} diff --git a/src/main/java/egovframework/com/cmm/service/impl/EgovFileMngServiceImpl.java b/src/main/java/egovframework/com/cmm/service/impl/EgovFileMngServiceImpl.java new file mode 100644 index 0000000..ba75123 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/service/impl/EgovFileMngServiceImpl.java @@ -0,0 +1,193 @@ +package egovframework.com.cmm.service.impl; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import egovframework.com.cmm.service.EgovFileMngService; +import egovframework.com.cmm.service.FileVO; +import kccf.bbs.vo.AttachmentVO; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +/** + * @Class Name : EgovFileMngServiceImpl.java + * @Description : 파일정보의 관리를 위한 구현 클래스 + * @Modification Information + * + * 수정일 수정자 수정내용 + * ------- ------- ------------------- + * 2009. 3. 25. 이삼섭 최초생성 + * + * @author 공통 서비스 개발팀 이삼섭 + * @since 2009. 3. 25. + * @version + * @see + * + */ +@Service("EgovFileMngService") +public class EgovFileMngServiceImpl extends EgovAbstractServiceImpl implements EgovFileMngService { + + @Resource(name = "FileManageDAO") + private FileManageDAO fileMngDAO; + + /** + * 문화원 파일에 대한 목록 리스트를 조회한다. + * + */ + public List selectFileListByCntntsId(AttachmentVO attachmentVO) throws Exception { + if(attachmentVO.getCntntsGroupId()!=null) { + if(attachmentVO.getCntntsGroupId().equals("N000000000000000000020") || attachmentVO.getCntntsGroupId().equals("N000000000000000000021")) { + return fileMngDAO.selectViewFileListByCntntsId(attachmentVO); + } else { + return fileMngDAO.selectFileListByCntntsId(attachmentVO); + } + } else { + return fileMngDAO.selectFileListByCntntsId(attachmentVO); + } + + } + + /** + * 문화원 파일에 대한 상세정보를 조회한다. + * + */ + public AttachmentVO selectFileDetailByKF(AttachmentVO attachmentVO) throws Exception { + return fileMngDAO.selectFileDetailByKF(attachmentVO); + } + + /** + * 문화원 여러 개의 파일을 삭제한다. + * + * @see egovframework.com.cmm.service.EgovFileMngService#deleteFileInfs(java.util.List) + */ + public void deleteFileInfsByKF(List deleteFiles) throws Exception { + fileMngDAO.deleteFileInfsByKF(deleteFiles); + } + + + /** + * 여러 개의 파일을 삭제한다. + * + * @see egovframework.com.cmm.service.EgovFileMngService#deleteFileInfs(java.util.List) + */ + public void deleteFileInfs(List fvoList) throws Exception { + fileMngDAO.deleteFileInfs(fvoList); + } + + /** + * 하나의 파일에 대한 정보(속성 및 상세)를 등록한다. + * + * @see egovframework.com.cmm.service.EgovFileMngService#insertFileInf(egovframework.com.cmm.service.FileVO) + */ + public String insertFileInf(FileVO fvo) throws Exception { + String atchFileId = fvo.getAtchFileId(); + + fileMngDAO.insertFileInf(fvo); + + return atchFileId; + } + + /** + * 여러 개의 파일에 대한 정보(속성 및 상세)를 등록한다. + * + * @see egovframework.com.cmm.service.EgovFileMngService#insertFileInfs(java.util.List) + */ + public String insertFileInfs(List fvoList) throws Exception { + String atchFileId = ""; + + if (fvoList.size() != 0) { + atchFileId = fileMngDAO.insertFileInfsByKF(fvoList); + //atchFileId = fileMngDAO.insertFileInfs(fvoList); + } + if (atchFileId == "") { + atchFileId = null; + } + return atchFileId; + } + + /** + * 파일에 대한 목록을 조회한다. + * + * @see egovframework.com.cmm.service.EgovFileMngService#selectFileInfs(egovframework.com.cmm.service.FileVO) + */ + public List selectFileInfs(FileVO fvo) throws Exception { + return fileMngDAO.selectFileInfs(fvo); + } + + /** + * 여러 개의 파일에 대한 정보(속성 및 상세)를 수정한다. + * + * @see egovframework.com.cmm.service.EgovFileMngService#updateFileInfs(java.util.List) + */ + public void updateFileInfs(List fvoList) throws Exception { + //Delete & Insert + fileMngDAO.updateFileInfs(fvoList); + } + + /** + * 하나의 파일을 삭제한다. + * + * @see egovframework.com.cmm.service.EgovFileMngService#deleteFileInf(egovframework.com.cmm.service.FileVO) + */ + public void deleteFileInf(FileVO fvo) throws Exception { + fileMngDAO.deleteFileInf(fvo); + } + + /** + * 파일에 대한 상세정보를 조회한다. + * + * @see egovframework.com.cmm.service.EgovFileMngService#selectFileInf(egovframework.com.cmm.service.FileVO) + */ + public FileVO selectFileInf(FileVO fvo) throws Exception { + return fileMngDAO.selectFileInf(fvo); + } + + /** + * 파일 구분자에 대한 최대값을 구한다. + * + * @see egovframework.com.cmm.service.EgovFileMngService#getMaxFileSN(egovframework.com.cmm.service.FileVO) + */ + public int getMaxFileSN(FileVO fvo) throws Exception { + return fileMngDAO.getMaxFileSN(fvo); + } + + /** + * 전체 파일을 삭제한다. + * + * @see egovframework.com.cmm.service.EgovFileMngService#deleteAllFileInf(egovframework.com.cmm.service.FileVO) + */ + public void deleteAllFileInf(FileVO fvo) throws Exception { + fileMngDAO.deleteAllFileInf(fvo); + } + + /** + * 파일명 검색에 대한 목록을 조회한다. + * + * @see egovframework.com.cmm.service.EgovFileMngService#selectFileListByFileNm(egovframework.com.cmm.service.FileVO) + */ + public Map selectFileListByFileNm(FileVO fvo) throws Exception { + List result = fileMngDAO.selectFileListByFileNm(fvo); + int cnt = fileMngDAO.selectFileListCntByFileNm(fvo); + + Map map = new HashMap(); + + map.put("resultList", result); + map.put("resultCnt", Integer.toString(cnt)); + + return map; + } + + /** + * 이미지 파일에 대한 목록을 조회한다. + * + * @see egovframework.com.cmm.service.EgovFileMngService#selectImageFileList(egovframework.com.cmm.service.FileVO) + */ + public List selectImageFileList(FileVO vo) throws Exception { + return fileMngDAO.selectImageFileList(vo); + } +} diff --git a/src/main/java/egovframework/com/cmm/service/impl/EgovUserDetailsSessionServiceImpl.java b/src/main/java/egovframework/com/cmm/service/impl/EgovUserDetailsSessionServiceImpl.java new file mode 100644 index 0000000..a6844f2 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/service/impl/EgovUserDetailsSessionServiceImpl.java @@ -0,0 +1,54 @@ +package egovframework.com.cmm.service.impl; + +import java.util.ArrayList; +import java.util.List; + +import egovframework.com.cmm.service.EgovUserDetailsService; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.access.service.EgovUserDetailsHelper; + +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; + +/** + * + * @author 공통서비스 개발팀 서준식 + * @since 2011. 6. 25. + * @version 1.0 + * @see + * + *
    + * 개정이력(Modification Information) 
    + * 
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2011. 8. 12.    서준식        최초생성
    + *  
    + *  
    + */ + +public class EgovUserDetailsSessionServiceImpl extends EgovAbstractServiceImpl implements EgovUserDetailsService { + + /** + * 인증된 사용자객체를 VO형식으로 가져온다. + * @return Object - 사용자 ValueObject + */ + public Object getAuthenticatedUser() { + if (EgovUserDetailsHelper.isAuthenticated()) { + return EgovUserDetailsHelper.getAuthenticatedUser(); + } + return null; + } + + public List getAuthorities() { + // 권한 설정을 리턴한다. + return EgovUserDetailsHelper.getAuthorities(); + } + + public Boolean isAuthenticated() { + // 인증된 유저인지 확인한다. + return EgovUserDetailsHelper.isAuthenticated(); + } + +} diff --git a/src/main/java/egovframework/com/cmm/service/impl/FileManageDAO.java b/src/main/java/egovframework/com/cmm/service/impl/FileManageDAO.java new file mode 100644 index 0000000..d8cf5c9 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/service/impl/FileManageDAO.java @@ -0,0 +1,246 @@ +package egovframework.com.cmm.service.impl; + +import java.util.Iterator; +import java.util.List; + +import egovframework.com.cmm.service.FileVO; +import kccf.bbs.vo.AttachmentVO; + +import org.springframework.stereotype.Repository; + +/** + * @Class Name : EgovFileMngDAO.java + * @Description : 파일정보 관리를 위한 데이터 처리 클래스 + * @Modification Information + * + * 수정일 수정자 수정내용 + * ------- ------- ------------------- + * 2009. 3. 25. 이삼섭 최초생성 + * + * @author 공통 서비스 개발팀 이삼섭 + * @since 2009. 3. 25. + * @version + * @see + * + */ +@Repository("FileManageDAO") +public class FileManageDAO extends EgovComAbstractDAO { + + /** + * 문화원 파일에 대한 목록을 조회한다. + * + * @param attachmentVO + * @return + * @throws Exception + */ + public List selectFileListByCntntsId(AttachmentVO attachmentVO) throws Exception { + return selectList("FileManageDAO.selectFileListByCntntsId", attachmentVO); + } + + public List selectViewFileListByCntntsId(AttachmentVO attachmentVO) throws Exception { + return selectList("FileManageDAO.selectViewFileListByCntntsId", attachmentVO); + } + + /** + * 문화원 파일에 대한 상세정보를 조회한다. + * + * @param fvo + * @return + * @throws Exception + */ + public AttachmentVO selectFileDetailByKF(AttachmentVO attachmentVO) throws Exception { + return selectOne("FileManageDAO.selectFileDetailByKF", attachmentVO); + } + + /** + * 문화원 여러 개의 파일에 대한 정보(속성 및 상세)를 등록한다. + * + * @param fileList + * @return + * @throws Exception + */ + public String insertFileInfsByKF(List fileList) throws Exception { + AttachmentVO vo = (AttachmentVO) fileList.get(0); + String atchFileId = vo.getAtchmnflId(); + + + Iterator iter = fileList.iterator(); + while (iter.hasNext()) { + vo = (AttachmentVO) iter.next(); + + insert("FileManageDAO.insertFileDetailByKF", vo); + } + + return atchFileId; + } + + /** + * 문화원 여러 개의 파일을 삭제한다. + * + * @param fileList + * @throws Exception + */ + public void deleteFileInfsByKF(List deleteFiles) throws Exception { + Iterator iter = deleteFiles.iterator(); + AttachmentVO vo; + while (iter.hasNext()) { + vo = (AttachmentVO) iter.next(); + + update("FileManageDAO.deleteFileInfsByKF", vo); + } + } + + /** + * 여러 개의 파일에 대한 정보(속성 및 상세)를 등록한다. + * + * @param fileList + * @return + * @throws Exception + */ + public String insertFileInfs(List fileList) throws Exception { + FileVO vo = (FileVO) fileList.get(0); + String atchFileId = vo.getAtchFileId(); + + insert("FileManageDAO.insertFileMaster", vo); + + Iterator iter = fileList.iterator(); + while (iter.hasNext()) { + vo = (FileVO) iter.next(); + + insert("FileManageDAO.insertFileDetail", vo); + } + + return atchFileId; + } + + /** + * 하나의 파일에 대한 정보(속성 및 상세)를 등록한다. + * + * @param vo + * @throws Exception + */ + public void insertFileInf(FileVO vo) throws Exception { + insert("FileManageDAO.insertFileMaster", vo); + insert("FileManageDAO.insertFileDetail", vo); + } + + /** + * 여러 개의 파일에 대한 정보(속성 및 상세)를 수정한다. + * + * @param fileList + * @throws Exception + */ + public void updateFileInfs(List fileList) throws Exception { + FileVO vo; + Iterator iter = fileList.iterator(); + while (iter.hasNext()) { + vo = (FileVO) iter.next(); + insert("FileManageDAO.insertFileDetail", vo); + } + } + + /** + * 여러 개의 파일을 삭제한다. + * + * @param fileList + * @throws Exception + */ + public void deleteFileInfs(List fileList) throws Exception { + Iterator iter = fileList.iterator(); + AttachmentVO vo; + while (iter.hasNext()) { + vo = (AttachmentVO) iter.next(); + + update("FileManageDAO.deleteFileDetail", vo); + } + } + + /** + * 하나의 파일을 삭제한다. + * + * @param fvo + * @throws Exception + */ + public void deleteFileInf(FileVO fvo) throws Exception { + delete("FileManageDAO.deleteFileDetail", fvo); + } + + /** + * 파일에 대한 목록을 조회한다. + * + * @param vo + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List selectFileInfs(FileVO vo) throws Exception { + return (List) list("FileManageDAO.selectFileList", vo); + } + + /** + * 파일 구분자에 대한 최대값을 구한다. + * + * @param fvo + * @return + * @throws Exception + */ + public int getMaxFileSN(FileVO fvo) throws Exception { + return (Integer) selectOne("FileManageDAO.getMaxFileSN", fvo); + } + + /** + * 파일에 대한 상세정보를 조회한다. + * + * @param fvo + * @return + * @throws Exception + */ + public FileVO selectFileInf(FileVO fvo) throws Exception { + return (FileVO) selectOne("FileManageDAO.selectFileInf", fvo); + } + + /** + * 전체 파일을 삭제한다. + * + * @param fvo + * @throws Exception + */ + public void deleteAllFileInf(FileVO fvo) throws Exception { + update("FileManageDAO.deleteCOMTNFILE", fvo); + } + + /** + * 파일명 검색에 대한 목록을 조회한다. + * + * @param vo + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List selectFileListByFileNm(FileVO fvo) throws Exception { + return (List) list("FileManageDAO.selectFileListByFileNm", fvo); + } + + /** + * 파일명 검색에 대한 목록 전체 건수를 조회한다. + * + * @param fvo + * @return + * @throws Exception + */ + public int selectFileListCntByFileNm(FileVO fvo) throws Exception { + return (Integer) selectOne("FileManageDAO.selectFileListCntByFileNm", fvo); + } + + /** + * 이미지 파일에 대한 목록을 조회한다. + * + * @param vo + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List selectImageFileList(FileVO vo) throws Exception { + return (List) list("FileManageDAO.selectImageFileList", vo); + } +} diff --git a/src/main/java/egovframework/com/cmm/taglibs/DoubleSubmitTag.java b/src/main/java/egovframework/com/cmm/taglibs/DoubleSubmitTag.java new file mode 100644 index 0000000..95a750a --- /dev/null +++ b/src/main/java/egovframework/com/cmm/taglibs/DoubleSubmitTag.java @@ -0,0 +1,88 @@ +package egovframework.com.cmm.taglibs; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import egovframework.com.cmm.util.EgovDoubleSubmitHelper; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.JspTagException; +import javax.servlet.jsp.tagext.TagSupport; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * TagSupport to support to double submit preventer + * @author Vincent Han + * @since 2014.08.07 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일        수정자       수정내용
    + *  -------       --------    ---------------------------
    + *   2014.08.07	표준프레임워크센터	최초 생성
    + *
    + * 
    + */ +public class DoubleSubmitTag extends TagSupport { + private static final Logger LOGGER = LoggerFactory.getLogger(DoubleSubmitTag.class); + + /** + * Generated Serial Version UID + */ + private static final long serialVersionUID = 5242217605452312594L; + + private String tokenKey = EgovDoubleSubmitHelper.DEFAULT_TOKEN_KEY; + + public String getTokenKey() { + return tokenKey; + } + + public void setTokenKey(String tokenKey) { + this.tokenKey = tokenKey; + } + + @SuppressWarnings("unchecked") + public int doStartTag() throws JspException { + StringBuilder buffer = new StringBuilder(); + + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + HttpSession session = request.getSession(); + + Map map = null; + + if (session.getAttribute(EgovDoubleSubmitHelper.SESSION_TOKEN_KEY) == null) { + map = new HashMap(); + + session.setAttribute(EgovDoubleSubmitHelper.SESSION_TOKEN_KEY, map); + } else { + map = (Map) session.getAttribute(EgovDoubleSubmitHelper.SESSION_TOKEN_KEY); + } + + // First call (check session) + if (map.get(tokenKey) == null) { + + map.put(tokenKey, EgovDoubleSubmitHelper.getNewUUID()); + + LOGGER.debug("[Double Submit] session token created({}) : {}", tokenKey, map.get(tokenKey)); + } + + buffer.append(""); + + try { + pageContext.getOut().print(buffer.toString()); + } catch (IOException e) { + throw new JspTagException("Error: IOException while writing to the user"); + } + + return SKIP_BODY; + } + +} diff --git a/src/main/java/egovframework/com/cmm/util/EgovBasicLogger.java b/src/main/java/egovframework/com/cmm/util/EgovBasicLogger.java new file mode 100644 index 0000000..5911261 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/util/EgovBasicLogger.java @@ -0,0 +1,83 @@ +package egovframework.com.cmm.util; + +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * Utility class to support to logging information + * @author Vincent Han + * @since 2014.09.18 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일        수정자       수정내용
    + *  -------       --------    ---------------------------
    + *   2014.09.18	표준프레임워크센터	최초 생성
    + *
    + * 
    + */ +public class EgovBasicLogger { + private static final Level IGNORE_INFO_LEVEL = Level.OFF; + private static final Level DEBUG_INFO_LEVEL = Level.FINEST; + private static final Level INFO_INFO_LEVEL = Level.INFO; + + private static final Logger ignoreLogger = Logger.getLogger("ignore"); + private static final Logger debugLogger = Logger.getLogger("debug"); + private static final Logger infoLogger = Logger.getLogger("info"); + + /** + * 기록이나 처리가 불필요한 경우 사용. + * @param message + * @param exception + */ + public static void ignore(String message, Exception exception) { + if (exception == null) { + ignoreLogger.log(IGNORE_INFO_LEVEL, message); + } else { + ignoreLogger.log(IGNORE_INFO_LEVEL, message, exception); + } + } + + /** + * 기록이나 처리가 불필요한 경우 사용. + * @param message + * @param exception + */ + public static void ignore(String message) { + ignore(message, null); + } + + /** + * 디버그 정보를 기록하는 경우 사용. + * @param message + * @param exception + */ + public static void debug(String message, Exception exception) { + if (exception == null) { + debugLogger.log(DEBUG_INFO_LEVEL, message); + } else { + debugLogger.log(DEBUG_INFO_LEVEL, message, exception); + } + } + + /** + * 디버그 정보를 기록하는 경우 사용. + * @param message + * @param exception + */ + public static void debug(String message) { + debug(message, null); + } + + /** + * 일반적이 정보를 기록하는 경우 사용. + * @param message + * @param exception + */ + public static void info(String message) { + infoLogger.log(INFO_INFO_LEVEL, message); + } +} diff --git a/src/main/java/egovframework/com/cmm/util/EgovDoubleSubmitHelper.java b/src/main/java/egovframework/com/cmm/util/EgovDoubleSubmitHelper.java new file mode 100644 index 0000000..672087e --- /dev/null +++ b/src/main/java/egovframework/com/cmm/util/EgovDoubleSubmitHelper.java @@ -0,0 +1,80 @@ +package egovframework.com.cmm.util; + +import java.util.Map; +import java.util.UUID; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +/** + * Utility class to support to double submit preventer + * @author Vincent Han + * @since 2014.08.07 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일        수정자       수정내용
    + *  -------       --------    ---------------------------
    + *   2014.08.07	표준프레임워크센터	최초 생성
    + *
    + * 
    + */ +public class EgovDoubleSubmitHelper { + private static final Logger LOGGER = LoggerFactory.getLogger(EgovDoubleSubmitHelper.class); + + public final static String SESSION_TOKEN_KEY = "egovframework.double.submit.preventer.session.key"; + + public final static String PARAMETER_NAME = "egovframework.double.submit.preventer.parameter.name"; + + public final static String DEFAULT_TOKEN_KEY = "DEFAULT"; + + public static String getNewUUID() { + return UUID.randomUUID().toString().toUpperCase(); + } + + public static boolean checkAndSaveToken() { + return checkAndSaveToken(DEFAULT_TOKEN_KEY); + } + + public static boolean checkAndSaveToken(String tokenKey) { + + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + HttpSession session = request.getSession(); + + // check session... + if (session.getAttribute(EgovDoubleSubmitHelper.SESSION_TOKEN_KEY) == null) { + throw new RuntimeException("Double Submit Preventer TagLig isn't set. Check JSP."); + } + + String parameter = request.getParameter(EgovDoubleSubmitHelper.PARAMETER_NAME); + + // check parameter + if (parameter == null) { + throw new RuntimeException("Double Submit Preventer parameter isn't set. Check JSP."); + } + + @SuppressWarnings("unchecked") + Map map = (Map) session.getAttribute(EgovDoubleSubmitHelper.SESSION_TOKEN_KEY); + + if (parameter.equals(map.get(tokenKey))) { + + LOGGER.debug("[Double Submit] session token ({}) equals to parameter token.", tokenKey); + + map.put(tokenKey, getNewUUID()); + + return true; + } + + LOGGER.debug("[Double Submit] session token ({}) isn't equal to parameter token.", tokenKey); + + return false; + } +} diff --git a/src/main/java/egovframework/com/cmm/util/EgovHttpRequestHelper.java b/src/main/java/egovframework/com/cmm/util/EgovHttpRequestHelper.java new file mode 100644 index 0000000..4da5ef4 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/util/EgovHttpRequestHelper.java @@ -0,0 +1,56 @@ +package egovframework.com.cmm.util; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +/** + * @Class Name : EgovHttpRequestHelper.java + * @Description : HTTP Request 정보 취득 Helper 클래스 + * @Modification Information + * + * 수정일 수정자 수정내용 + * ------- ------- ------------------- + * 2014.09.11 표준프레임워크 최초생성 +* @author Vincent Han + * @since 2014.09.11 + * @version 3.5 + * @see
    + * web.xml 상에 다음과 같은 Listener 등록 필요
    + * <listener>
    + *	  <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
    + * </listener>
    + * 
    + */ +public class EgovHttpRequestHelper { + + public static boolean isInHttpRequest() { + try { + getCurrentRequest(); + } catch (IllegalStateException ise) { + return false; + } + + return true; + } + + public static HttpServletRequest getCurrentRequest() { + ServletRequestAttributes sra = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes(); + + return sra.getRequest(); + } + + public static String getRequestIp() { + return getCurrentRequest().getRemoteAddr(); + } + + public static String getRequestURI() { + return getCurrentRequest().getRequestURI(); + } + + public static HttpSession getCurrentSession() { + return getCurrentRequest().getSession(); + } +} diff --git a/src/main/java/egovframework/com/cmm/util/EgovMybaitsUtil.java b/src/main/java/egovframework/com/cmm/util/EgovMybaitsUtil.java new file mode 100644 index 0000000..542b669 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/util/EgovMybaitsUtil.java @@ -0,0 +1,135 @@ +package egovframework.com.cmm.util; + +import java.lang.reflect.Array; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * EgovMybaitsUtil 클래스 + * + * @author 장동한 + * @since 2016.06.07 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일        수정자           수정내용
    + *  -------      -------------  ----------------------
    + *   2016.06.07  장동한           최초 생성
    + *   2017.03.03     조성원 	  시큐어코딩(ES)-오류 메시지를 통한 정보노출[CWE-209]
    + *   2017.07.21  장동한 			isEquals에서 String Character 비교 가능하도록
    + *   
    + * 
    + */ + + +public class EgovMybaitsUtil { + + private static final Logger logger = LoggerFactory.getLogger(EgovMybaitsUtil.class); + + /** + * Empty 여부를 확인한다. + * @param o Object + * @return boolean + * @exception IllegalArgumentException + */ + public static boolean isEmpty(Object o) throws IllegalArgumentException { + try { + if(o == null) return true; + + if(o instanceof String) { + if(((String)o).length() == 0){ + return true; + } + } else if(o instanceof Collection) { + if(((Collection)o).isEmpty()){ + return true; + } + } else if(o.getClass().isArray()) { + if(Array.getLength(o) == 0){ + return true; + } + } else if(o instanceof Map) { + if(((Map)o).isEmpty()){ + return true; + } + }else { + return false; + } + + return false; + //2017.03.03 조성원 시큐어코딩(ES)-오류 메시지를 통한 정보노출[CWE-209] + } catch(IllegalArgumentException e) { + logger.error("[IllegalArgumentException] Try/Catch...usingParameters Runing : "+ e.getMessage()); + } catch(Exception e) { + logger.error("["+e.getClass()+"] Try/Catch...Exception : " + e.getMessage()); + } + return false; + } + + /** + * Not Empty 여부를 확인한다. + * @param o Object + * @return boolean + * @exception IllegalArgumentException + */ + public static boolean isNotEmpty(Object o) { + return !isEmpty(o); + } + + /** + * Equal 여부를 확인한다. + * @param obj Object, obj Object + * @return boolean + */ + + public static boolean isEquals(Object obj, Object obj2){ + if(isEmpty(obj)) return false; + + if(obj instanceof String && obj2 instanceof String) { + if( (String.valueOf(obj)).equals( String.valueOf(obj2) )){ + return true; + } + }else if(obj instanceof String && obj2 instanceof Character) { + if( (String.valueOf(obj) ).equals( String.valueOf(obj2) )){ + return true; + } + }else if(obj instanceof String && obj2 instanceof Integer) { + if( (String.valueOf(obj)).equals( String.valueOf((Integer)obj2) )){ + return true; + } + + }else if(obj instanceof Integer && obj2 instanceof String) { + if( (String.valueOf(obj2)).equals( String.valueOf((Integer)obj) )){ + return true; + } + } else if(obj instanceof Integer && obj instanceof Integer) { + if((Integer)obj == (Integer)obj2){ + return true; + } + } + + return false; + } + + /** + * String의 Equal 여부를 확인한다. + * @param obj Object, obj Object + * @return boolean + */ + public static boolean isEqualsStr(Object obj, String s){ + if(isEmpty(obj)) return false; + + if(s.equals(String.valueOf(obj))){ + return true; + } + return false; + } + +} diff --git a/src/main/java/egovframework/com/cmm/util/EgovResourceCloseHelper.java b/src/main/java/egovframework/com/cmm/util/EgovResourceCloseHelper.java new file mode 100644 index 0000000..4901b15 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/util/EgovResourceCloseHelper.java @@ -0,0 +1,146 @@ +package egovframework.com.cmm.util; + +import java.io.Closeable; +import java.io.IOException; +import java.net.ServerSocket; +import java.net.Socket; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Wrapper; + +/** + * Utility class to support to close resources + * @author Vincent Han + * @since 2014.09.18 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일        수정자       수정내용
    + *  -------       --------    ---------------------------
    + *   2014.09.18	표준프레임워크센터	최초 생성
    + *
    + * 
    + */ +public class EgovResourceCloseHelper { + /** + * Resource close 처리. + * @param resources + */ + public static void close(Closeable ... resources) { + for (Closeable resource : resources) { + if (resource != null) { + try { + resource.close(); + } catch (IOException ignore) {//KISA 보안약점 조치 (2018-10-29, 윤창원) + EgovBasicLogger.ignore("Occurred IOException to close resource is ingored!!"); + } catch (Exception ignore) { + EgovBasicLogger.ignore("Occurred Exception to close resource is ingored!!"); + } + } + } + } + + /** + * JDBC 관련 resource 객체 close 처리 + * @param objects + */ + public static void closeDBObjects(Wrapper ... objects) { + for (Object object : objects) { + if (object != null) { + if (object instanceof ResultSet) { + try { + ((ResultSet)object).close(); + } catch (SQLException ignore) {//KISA 보안약점 조치 (2018-10-29, 윤창원) + EgovBasicLogger.ignore("Occurred SQLException to close resource is ingored!!"); + } catch (Exception ignore) { + EgovBasicLogger.ignore("Occurred Exception to close resource is ingored!!"); + } + } else if (object instanceof Statement) { + try { + ((Statement)object).close(); + } catch (SQLException ignore) {//KISA 보안약점 조치 (2018-10-29, 윤창원) + EgovBasicLogger.ignore("Occurred SQLException to close resource is ingored!!"); + } catch (Exception ignore) { + EgovBasicLogger.ignore("Occurred Exception to close resource is ingored!!"); + } + } else if (object instanceof Connection) { + try { + ((Connection)object).close(); + } catch (SQLException ignore) { + EgovBasicLogger.ignore("Occurred SQLException to close resource is ingored!!"); + } catch (Exception ignore) { + EgovBasicLogger.ignore("Occurred Exception to close resource is ingored!!"); + } + } else { + throw new IllegalArgumentException("Wrapper type is not found : " + object.toString()); + } + } + } + } + + /** + * Socket 관련 resource 객체 close 처리 + * @param objects + */ + public static void closeSocketObjects(Socket socket, ServerSocket server) { + if (socket != null) { + try { + socket.shutdownOutput(); + } catch (IOException ignore) { + EgovBasicLogger.ignore("Occurred IOException to close resource is ingored!!"); + } catch (Exception ignore) { + EgovBasicLogger.ignore("Occurred Exception to shutdown ouput is ignored!!"); + } + + try { + socket.close(); + } catch (IOException ignore) { + EgovBasicLogger.ignore("Occurred IOException to close resource is ingored!!"); + } catch (Exception ignore) { + EgovBasicLogger.ignore("Occurred Exception to close resource is ignored!!"); + } + } + + if (server != null) { + try { + server.close(); + } catch (IOException ignore) { + EgovBasicLogger.ignore("Occurred IOException to close resource is ingored!!"); + } catch (Exception ignore) { + EgovBasicLogger.ignore("Occurred Exception to close resource is ignored!!"); + } + } + } + + /** + * Socket 관련 resource 객체 close 처리 + * + * @param sockets + */ + public static void closeSockets(Socket ... sockets) { + for (Socket socket : sockets) { + if (socket != null) { + try { + socket.shutdownOutput(); + } catch (IOException ignore) { + EgovBasicLogger.ignore("Occurred IOException to close resource is ingored!!"); + } catch (Exception ignore) { + EgovBasicLogger.ignore("Occurred Exception to shutdown ouput is ignored!!"); + } + + try { + socket.close(); + } catch (IOException ignore) { + EgovBasicLogger.ignore("Occurred IOException to close resource is ingored!!"); + } catch (Exception ignore) { + EgovBasicLogger.ignore("Occurred Exception to close resource is ignored!!"); + } + } + } + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/cmm/util/EgovUrlRewriteFilter.java b/src/main/java/egovframework/com/cmm/util/EgovUrlRewriteFilter.java new file mode 100644 index 0000000..323683d --- /dev/null +++ b/src/main/java/egovframework/com/cmm/util/EgovUrlRewriteFilter.java @@ -0,0 +1,112 @@ +package egovframework.com.cmm.util; + +import java.io.IOException; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.util.AntPathMatcher; + +import egovframework.com.cmm.EgovWebUtil; + +/** + * @Class Name : UrlRewriteFilter.java + * @Description : UrlRewriteFilter Class + * @Modification Information + * @ + * @ 수정일 수정자 수정내용 + * @ ---------- --------- ------------------------------- + * @ 2014.09.30 최초생성 + * @ 2020.11.02 신용호 KISA 보안약점 조치 (CRLF 제거 조치) + * + * @author 전자정부 표준프레임워크 유지보수 + * @since 2014. 09.30 + * @version 1.0 + * @see + * + * Copyright (C) by MOPAS All right reserved. + */ +public class EgovUrlRewriteFilter implements Filter { + + @SuppressWarnings("unused") + private FilterConfig config; + + private String targetURI; + private String httpsPort; + private String httpPort; + + private String[] uriPatterns; + + @Override + public void init(FilterConfig config) throws ServletException { + + String delimiter = ","; + this.config = config; + + this.targetURI = config.getInitParameter("targetURI"); + this.httpsPort = config.getInitParameter("httpsPort"); + this.httpPort = config.getInitParameter("httpPort"); + + this.uriPatterns = targetURI.split(delimiter); + + } + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException { + + HttpServletRequest req = (HttpServletRequest) request; + HttpServletResponse res = (HttpServletResponse) response; + + String uri = req.getRequestURI(); + String getProtocol = req.getScheme(); + String getDomain = req.getServerName(); + + AntPathMatcher pm = new AntPathMatcher(); + + for (String uriPattern : uriPatterns) { + + if (pm.match(uriPattern.trim(), uri)) { + + if (getProtocol.toLowerCase().equals("http")) { + + response.setContentType("text/html"); + + String httpsPath = "https" + "://" + getDomain + ":" + httpsPort + uri; + String site = new String(httpsPath); + res.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY); + res.setHeader("Location", EgovWebUtil.removeCRLF(site)); + + } + + }else if(getProtocol.toLowerCase().equals("https")){ + + response.setContentType("text/html"); + + String httpPath = "http" + "://" + getDomain + ":" + httpPort + uri; + + String site = new String(httpPath); + res.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY); + res.setHeader("Location", EgovWebUtil.removeCRLF(site)); + + } + } + + chain.doFilter(req, res); + + } + + @Override + public void destroy() { + this.targetURI = null; + this.httpsPort = null; + this.httpPort = null; + this.uriPatterns = null; + } + +} diff --git a/src/main/java/egovframework/com/cmm/util/EgovUserDetailsHelper.java b/src/main/java/egovframework/com/cmm/util/EgovUserDetailsHelper.java new file mode 100644 index 0000000..0f67b14 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/util/EgovUserDetailsHelper.java @@ -0,0 +1,61 @@ +package egovframework.com.cmm.util; + +import java.util.List; + +import egovframework.com.cmm.service.EgovUserDetailsService; + +/** + * EgovUserDetails Helper 클래스 + * + * @author sjyoon + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    -------------    ----------------------
    + *   2009.03.10  sjyoon         최초 생성
    + *   2011.07.01	 서준식          interface 생성후 상세 로직의 분리
    + * 
    + */ + +public class EgovUserDetailsHelper { + + static EgovUserDetailsService egovUserDetailsService; + + public EgovUserDetailsService getEgovUserDetailsService() { + return egovUserDetailsService; + } + + public void setEgovUserDetailsService(EgovUserDetailsService egovUserDetailsService) { + EgovUserDetailsHelper.egovUserDetailsService = egovUserDetailsService; + } + + /** + * 인증된 사용자객체를 VO형식으로 가져온다. + * @return Object - 사용자 ValueObject + */ + public static Object getAuthenticatedUser() { + return egovUserDetailsService.getAuthenticatedUser(); + } + + /** + * 인증된 사용자의 권한 정보를 가져온다. + * + * @return List - 사용자 권한정보 목록 + */ + public static List getAuthorities() { + return egovUserDetailsService.getAuthorities(); + } + + /** + * 인증된 사용자 여부를 체크한다. + * @return Boolean - 인증된 사용자 여부(TRUE / FALSE) + */ + public static Boolean isAuthenticated() { + return egovUserDetailsService.isAuthenticated(); + } +} diff --git a/src/main/java/egovframework/com/cmm/util/EgovWildcardReloadableResourceBundleMessageSource.java b/src/main/java/egovframework/com/cmm/util/EgovWildcardReloadableResourceBundleMessageSource.java new file mode 100644 index 0000000..fdbeb1a --- /dev/null +++ b/src/main/java/egovframework/com/cmm/util/EgovWildcardReloadableResourceBundleMessageSource.java @@ -0,0 +1,96 @@ +package egovframework.com.cmm.util; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang.StringUtils; +import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.FileSystemResource; +import org.springframework.core.io.Resource; +import org.springframework.core.io.UrlResource; +import org.springframework.core.io.support.PathMatchingResourcePatternResolver; +import org.springframework.core.io.support.ResourcePatternResolver; + +/** + * @Class Name : EgovWildcardReloadableResourceBundleMessageSource + * @Description : 다국어 properties 파일을 팩키지 구조의 폴더로 읽어드리는 MessageSource + * @Modification Information + * @ + * @ 수정일 수정자 수정내용 + * @ ------- -------- --------------------------- + * @ 2016.06.10 장동한 최초 생성 + * + * @author 2016 표준프레임워크 유지보수 장동한 + * @since 2016.06.10 + * @version 1.0 + * @see + * + */ + +public class EgovWildcardReloadableResourceBundleMessageSource extends + org.springframework.context.support.ReloadableResourceBundleMessageSource { + private ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver(); + + public void setEgovBasenames(String... basenames) { + if (basenames != null) { + List baseNames = new ArrayList(); + for (int i = 0; i < basenames.length; i++) { + + String basename = StringUtils.trimToEmpty(basenames[i]); + if(basename.indexOf("classpath:/") > -1 ){ + baseNames.add(basename); + }else if(StringUtils.isNotBlank(basename)) { + try { + + Resource[] resources = resourcePatternResolver.getResources(basename); + + for (int j = 0; j < resources.length; j++) { + Resource resource = resources[j]; + String uri = resource.getURI().toString(); + String baseName = null; + + if(uri.indexOf(".properties") == -1){continue;} + + if (resource instanceof FileSystemResource) { + baseName = "classpath:" + StringUtils.substringBetween(uri, "/classes/", ".properties"); + baseName = baseName.substring(0,baseName.indexOf("_")); + baseName = baseName.replaceAll("classpath:", "classpath:/"); + if(baseNames.indexOf(baseName) > -1){continue;}; + + } else if (resource instanceof ClassPathResource) { + baseName = StringUtils.substringBefore(uri, ".properties"); + baseName = baseName.substring(0,baseName.indexOf("_")); + baseName = baseName.replaceAll("classpath:", "classpath:/"); + } else if (resource instanceof UrlResource) { + baseName = "classpath:" + StringUtils.substringBetween(uri, ".jar!/", ".properties"); + baseName = baseName.substring(0,baseName.indexOf("_")); + baseName = baseName.replaceAll("classpath:", "classpath:/"); + } + if (baseName != null) { + String fullName = processBasename(baseName); + baseNames.add(fullName); + } + } + } catch (IOException e) { + logger.debug("No message source files found for basename " + basename + "."); + } + } + + + } + + logger.debug("EgovWildcardReloadableResourceBundleMessageSource>>basenames>["+baseNames+"}"); + setBasenames(baseNames.toArray(new String[baseNames.size()])); + } + } + + String processBasename(String baseName) { + String prefix = StringUtils.substringBeforeLast(baseName, "/"); + String name = StringUtils.substringAfterLast(baseName, "/"); + do { + name = StringUtils.substringBeforeLast(name, "_"); + } while (name.contains("_")); + return prefix + "/" + name; + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/cmm/util/EgovXssChecker.java b/src/main/java/egovframework/com/cmm/util/EgovXssChecker.java new file mode 100644 index 0000000..3db2a04 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/util/EgovXssChecker.java @@ -0,0 +1,89 @@ +package egovframework.com.cmm.util; + +import javax.servlet.http.HttpServletRequest; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.exception.EgovXssException; + +/** + * EgovXssChecker 클래스 + * + * @author 장동한 + * @since 2016.10.27 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일        수정자           수정내용
    + *  -------      -------------  ----------------------
    + *   2016.10.17  장동한           최초 생성
    + *   2017.03.03     조성원 	  시큐어코딩(ES)-오류 메시지를 통한 정보노출[CWE-209]
    + * 
    + */ + +public class EgovXssChecker { + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovXssChecker.class); + + /** + * 사용자에 대한 크로스사이트스크립트(Xss) 확인한다. + * 수정, 상세조회, 삭제시 사용 + * @param uniqId Stirng + * @return boolean + * @exception IllegalArgumentException + */ + public static boolean checkerUserXss(HttpServletRequest request, String sUniqId) throws Exception { + + boolean bLog = false; + + try { + //@ 공통모듈을 이용한 권한체크 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + if (loginVO != null) { + if (bLog) { + LOGGER.debug("@Step1. XSS Check uniqId : {}", sUniqId); + LOGGER.debug("Step2. XSS Session uniqId : {}", loginVO.getId()); + LOGGER.debug("Step3. XSS Session getUniqId : {}", loginVO.getUniqId()); + LOGGER.debug("Step4. XSS Session getAuthorities : {}", EgovUserDetailsHelper.getAuthorities()); + } + + //체크 값에 대한 무결성 체크 + // if(sUniqId == null || (loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())) == null){ + // throw new EgovXssException("XSS00001", "errors.xss.checkerUser"); + // } else if (loginVO.getUniqId().equals("")) { // KISA 보안약점 조치 (2018-12-11, 신용호) + // throw new EgovXssException("XSS00001", "errors.xss.checkerUser"); + // } + // + // //사용자에에 대한 Xss 체크 + // if(!sUniqId.equals(loginVO.getUniqId())){ + // throw new EgovXssException("XSS00002", "errors.xss.checkerUser"); + // } + + if (sUniqId == null || loginVO.getUniqId() == null || loginVO.getUniqId().equals("")) { + throw new EgovXssException("XSS00001", "errors.xss.checkerUser"); + } + + //사용자에에 대한 Xss 체크 + if (!sUniqId.equals(loginVO.getUniqId())) { + throw new EgovXssException("XSS00002", "errors.xss.checkerUser"); + } + } else { + throw new EgovXssException("XSS00001", "errors.xss.checkerUser"); + } + + //2017.03.03 조성원 시큐어코딩(ES)-오류 메시지를 통한 정보노출[CWE-209] + } catch (IllegalArgumentException e) { + LOGGER.error("[IllegalArgumentException] Try/Catch...usingParameters Runing : " + e.getMessage()); + } catch (Exception e) { + LOGGER.error("[" + e.getClass() + "] Try/Catch...Exception : " + e.getMessage()); + } + return true; + } + +} diff --git a/src/main/java/egovframework/com/cmm/util/URLEncodeUtil.java b/src/main/java/egovframework/com/cmm/util/URLEncodeUtil.java new file mode 100644 index 0000000..7d028dd --- /dev/null +++ b/src/main/java/egovframework/com/cmm/util/URLEncodeUtil.java @@ -0,0 +1,27 @@ +package egovframework.com.cmm.util; + +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.net.URLEncoder; + +public class URLEncodeUtil { + + public static String encode(String data) { + try { + return URLEncoder.encode(data, "UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + return null; + } + } + + public static String decode(String data) { + try { + return URLDecoder.decode(data, "UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + return null; + } + } + +} diff --git a/src/main/java/egovframework/com/cmm/web/EgovBindingInitializer.java b/src/main/java/egovframework/com/cmm/web/EgovBindingInitializer.java new file mode 100644 index 0000000..8fe89b1 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/web/EgovBindingInitializer.java @@ -0,0 +1,22 @@ +package egovframework.com.cmm.web; + +import java.text.SimpleDateFormat; +import java.util.Date; + +import org.springframework.beans.propertyeditors.CustomDateEditor; +import org.springframework.beans.propertyeditors.StringTrimmerEditor; +import org.springframework.web.bind.WebDataBinder; +import org.springframework.web.bind.support.WebBindingInitializer; +import org.springframework.web.context.request.WebRequest; + +public class EgovBindingInitializer implements WebBindingInitializer { + + + public void initBinder(WebDataBinder binder) { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + dateFormat.setLenient(false); + binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false)); + binder.registerCustomEditor(String.class, new StringTrimmerEditor(false)); + } + +} diff --git a/src/main/java/egovframework/com/cmm/web/EgovComIndexController.java b/src/main/java/egovframework/com/cmm/web/EgovComIndexController.java new file mode 100644 index 0000000..be480ec --- /dev/null +++ b/src/main/java/egovframework/com/cmm/web/EgovComIndexController.java @@ -0,0 +1,213 @@ +package egovframework.com.cmm.web; + +/** + * 컴포넌트 설치 후 설치된 컴포넌트들을 IncludedInfo annotation을 통해 찾아낸 후 + * 화면에 표시할 정보를 처리하는 Controller 클래스 + * + * 개발시 메뉴 구조가 잡히기 전에 배포파일들에 포함된 공통 컴포넌트들의 목록성 화면에 + * URL을 제공하여 개발자가 편하게 활용하도록 하기 위해 작성된 것으로, + * 실제 운영되는 시스템에서는 적용해서는 안 됨 + * 실 운영 시에는 삭제해서 배포해도 좋음 + * + * 운영시에 본 컨트롤을 사용하여 메뉴를 구성하는 경우 성능 문제를 일으키거나 + * 사용자별 메뉴 구성에 오류를 발생할 수 있음 + * @author 공통컴포넌트 정진오 + * @since 2011.08.26 + * @version 2.0.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *  수정일		  수정자		수정내용
    + *  ----------   --------   ---------------------------
    + *  2011.08.26   정진오            최초 생성
    + *  2011.09.16   서준식            컨텐츠 페이지 생성
    + *  2011.09.26     이기하		header, footer 페이지 생성
    + *  2019.12.04   신용호            KISA 보안코드 점검 : Map map를 지역변수로 수정
    + *  2020.07.08   신용호           비밀번호를 수정한후 경과한 날짜 조회
    + *  2020.08.28   정진호            표준프레임워크 v3.10 개선
    + * 
    + */ + +import java.lang.reflect.Method; +import java.util.Map; +import java.util.TreeMap; + +import javax.annotation.Resource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import egovframework.com.cmm.IncludedCompInfoVO; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.service.EgovProperties; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uat.uia.service.EgovLoginService; + +@Controller +public class EgovComIndexController implements ApplicationContextAware, InitializingBean { + + private ApplicationContext applicationContext; + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovComIndexController.class); + + @Override + public void afterPropertiesSet() throws Exception {} + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + this.applicationContext = applicationContext; + + LOGGER.info("EgovComIndexController setApplicationContext method has called!"); + } + + /** EgovLoginService */ + @Resource(name = "loginService") + private EgovLoginService loginService; + + + @RequestMapping("/EgovIndex.do") + public String index(ModelMap model) { + return "egovframework/com/cmm/EgovUnitMain"; + } + + @RequestMapping("/EgovTop.do") + public String top() { + return "egovframework/com/cmm/EgovUnitTop"; + } + + @RequestMapping("/EgovBottom.do") + public String bottom() { + return "egovframework/com/cmm/EgovUnitBottom"; + } + + @RequestMapping("/EgovContent.do") + public String setContent(ModelMap model) throws Exception { + + // 설정된 비밀번호 유효기간을 가져온다. ex) 180이면 비밀번호 변경후 만료일이 앞으로 180일 + String propertyExpirePwdDay = EgovProperties.getProperty("Globals.ExpirePwdDay"); + int expirePwdDay = 0 ; + try { + expirePwdDay = Integer.parseInt(propertyExpirePwdDay); + } catch (NumberFormatException Nfe) { + LOGGER.debug("convert expirePwdDay Err : "+Nfe.getMessage()); + } catch (Exception e) { + LOGGER.debug("convert expirePwdDay Err : "+e.getMessage()); + } + + model.addAttribute("expirePwdDay", expirePwdDay); + + // 비밀번호 설정일로부터 몇일이 지났는지 확인한다. ex) 3이면 비빌번호 설정후 3일 경과 + LoginVO loginVO = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser(); + model.addAttribute("loginVO", loginVO); + int passedDayChangePWD = 0; + if ( loginVO != null ) { + LOGGER.debug("===>>> loginVO.getId() = "+loginVO.getId()); + LOGGER.debug("===>>> loginVO.getUniqId() = "+loginVO.getUniqId()); + LOGGER.debug("===>>> loginVO.getUserSe() = "+loginVO.getUserSe()); + // 비밀번호 변경후 경과한 일수 + passedDayChangePWD = loginService.selectPassedDayChangePWD(loginVO); + LOGGER.debug("===>>> passedDayChangePWD = "+passedDayChangePWD); + model.addAttribute("passedDay", passedDayChangePWD); + } + + // 만료일자로부터 경과한 일수 => ex)1이면 만료일에서 1일 경과 + model.addAttribute("elapsedTimeExpiration", passedDayChangePWD - expirePwdDay); + + return "egovframework/com/cmm/EgovUnitContent"; + } + + @RequestMapping("/EgovLeft.do") + public String setLeftMenu(ModelMap model) { + + Map map = new TreeMap(); + RequestMapping rmAnnotation; + IncludedInfo annotation; + IncludedCompInfoVO zooVO; + + /* + * EgovLoginController가 AOP Proxy되는 바람에 클래스를 reflection으로 가져올 수 없음 + */ + try { + Class loginController = Class.forName("egovframework.com.uat.uia.web.EgovLoginController"); + Method[] methods = loginController.getMethods(); + for (int i = 0; i < methods.length; i++) { + annotation = methods[i].getAnnotation(IncludedInfo.class); + + if (annotation != null) { + LOGGER.debug("Found @IncludedInfo Method : {}", methods[i]); + zooVO = new IncludedCompInfoVO(); + zooVO.setName(annotation.name()); + zooVO.setOrder(annotation.order()); + zooVO.setGid(annotation.gid()); + + rmAnnotation = methods[i].getAnnotation(RequestMapping.class); + if ("".equals(annotation.listUrl()) && rmAnnotation != null) { + zooVO.setListUrl(rmAnnotation.value()[0]); + } else { + zooVO.setListUrl(annotation.listUrl()); + } + map.put(zooVO.getOrder(), zooVO); + } + } + } catch (ClassNotFoundException e) { + LOGGER.error("No egovframework.com.uat.uia.web.EgovLoginController!!"); + } + /* 여기까지 AOP Proxy로 인한 코드 */ + + /*@Controller Annotation 처리된 클래스를 모두 찾는다.*/ + Map myZoos = applicationContext.getBeansWithAnnotation(Controller.class); + LOGGER.debug("How many Controllers : ", myZoos.size()); + for (final Object myZoo : myZoos.values()) { + Class zooClass = myZoo.getClass(); + + Method[] methods = zooClass.getMethods(); + LOGGER.debug("Controller Detected {}", zooClass); + for (int i = 0; i < methods.length; i++) { + annotation = methods[i].getAnnotation(IncludedInfo.class); + + if (annotation != null) { + //LOG.debug("Found @IncludedInfo Method : " + methods[i] ); + zooVO = new IncludedCompInfoVO(); + zooVO.setName(annotation.name()); + zooVO.setOrder(annotation.order()); + zooVO.setGid(annotation.gid()); + /* + * 목록형 조회를 위한 url 매핑은 @IncludedInfo나 @RequestMapping에서 가져온다 + */ + rmAnnotation = methods[i].getAnnotation(RequestMapping.class); + if ("".equals(annotation.listUrl())) { + zooVO.setListUrl(rmAnnotation.value()[0]); + } else { + zooVO.setListUrl(annotation.listUrl()); + } + + map.put(zooVO.getOrder(), zooVO); + } + } + } + + model.addAttribute("resultList", map.values()); + + LOGGER.debug("EgovComIndexController index is called "); + + return "egovframework/com/cmm/EgovUnitLeft"; + } + + // context-security.xml 설정 + // csrf="true"인 경우 csrf Token이 없는경우 이동하는 페이지 + // csrfAccessDeniedUrl="/egovCSRFAccessDenied.do" + @RequestMapping("/egovCSRFAccessDenied.do") + public String egovCSRFAccessDenied() { + return "egovframework/com/cmm/error/csrfAccessDenied"; + } +} diff --git a/src/main/java/egovframework/com/cmm/web/EgovComUtlController.java b/src/main/java/egovframework/com/cmm/web/EgovComUtlController.java new file mode 100644 index 0000000..a338ea3 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/web/EgovComUtlController.java @@ -0,0 +1,93 @@ +package egovframework.com.cmm.web; + +import java.util.List; + +import javax.annotation.Resource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; + +import egovframework.com.cmm.EgovWebUtil; +import org.egovframe.rte.fdl.property.EgovPropertyService; + +/** + * @Class Name : EgovComUtlController.java + * @Description : 공통유틸리티성 작업을 위한 Controller + * @Modification Information + * @ + * @ 수정일 수정자 수정내용 + * @ ---------- -------- --------------------------- + * 2009.03.02 조재영 최초 생성 + * 2011.10.07 이기하 .action -> .do로 변경하면서 동일 매핑이 되어 삭제처리 + * 2015.11.12 김연호 한국인터넷진흥원 웹 취약점 개선 + * 2019.04.25 신용호 moveToPage() 화이트리스트 처리 + * + * @author 공통서비스 개발팀 조재영 + * @since 2009.03.02 + * @version 1.0 + * @see + * + */ +@Controller +public class EgovComUtlController { + + //@Resource(name = "egovUserManageService") + //private EgovUserManageService egovUserManageService; + private static final Logger LOGGER = LoggerFactory.getLogger(EgovComUtlController.class); + + @Resource(name = "egovPageLinkWhitelist") + protected List egovWhitelist; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** + * JSP 호출작업만 처리하는 공통 함수 + */ + @RequestMapping(value="/EgovPageLink.do") + public String moveToPage(@RequestParam("link") String linkPage){ + String link = linkPage; + link = link.replace(";", ""); + link = link.replace(".", ""); + + // service 사용하여 리턴할 결과값 처리하는 부분은 생략하고 단순 페이지 링크만 처리함 + if (linkPage==null || linkPage.equals("")){ + link="egovframework/com/cmm/egovError"; + } + + // 화이트 리스트 처리 + // whitelist목록에 있는 경우 결과가 true, 결과가 false인경우 FAIL처리 + if (egovWhitelist.contains(linkPage) == false) { + LOGGER.debug("Page Link WhiteList Error! Please check whitelist!"); + link="egovframework/com/cmm/egovError"; + } + + // 안전한 경로 문자열로 조치 + link = EgovWebUtil.filePathBlackList(link); + + return link; + } + + /** + * 모달조회 + * @return String + * @exception Exception + */ + @RequestMapping(value="/EgovModal.do") + public String selectUtlJsonInquire() throws Exception { + return "egovframework/com/cmm/EgovModal"; + } + + /** + * validato rule dynamic Javascript + */ + @RequestMapping("/validator.do") + public String validate(){ + return "egovframework/com/cmm/validator"; + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/cmm/web/EgovFileDownloadController.java b/src/main/java/egovframework/com/cmm/web/EgovFileDownloadController.java new file mode 100644 index 0000000..e207cd3 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/web/EgovFileDownloadController.java @@ -0,0 +1,156 @@ +package egovframework.com.cmm.web; + +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.RequestDispatcher; +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 egovframework.com.cmm.EgovBrowserUtil; +import egovframework.com.cmm.EgovWebUtil; +import egovframework.com.cmm.service.EgovFileMngService; +import egovframework.com.cmm.service.FileVO; +import egovframework.com.cmm.util.EgovBasicLogger; +import egovframework.com.cmm.util.EgovResourceCloseHelper; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import kccf.bbs.vo.AttachmentVO; + +/** + * 파일 다운로드를 위한 컨트롤러 클래스 + * @author 공통서비스개발팀 이삼섭 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *     수정일      	수정자           수정내용
    + *  ------------   --------    ---------------------------
    + *   2009.03.25  	이삼섭          최초 생성
    + *   2014.02.24		이기하          IE11 브라우저 한글 파일 다운로드시 에러 수정
    + *   2018.08.28		신용호          Safari, Chrome, Firefox, Opera 한글파일 다운로드 처리 수정 (macOS에서 확장자 exe붙는 문제 처리)
    + *
    + * Copyright (C) 2009 by MOPAS  All right reserved.
    + * 
    + */ +@Controller +public class EgovFileDownloadController { + + @Resource(name = "EgovFileMngService") + private EgovFileMngService fileService; + + /** + * 브라우저 구분 얻기. + * + * @param request + * @return + */ + private String getBrowser(HttpServletRequest request) { + String header = request.getHeader("User-Agent"); + if (header.indexOf("MSIE") > -1) { + return "MSIE"; + } else if (header.indexOf("Trident") > -1) { // IE11 문자열 깨짐 방지 + return "Trident"; + } else if (header.indexOf("Chrome") > -1) { + return "Chrome"; + } else if (header.indexOf("Opera") > -1) { + return "Opera"; + } + return "Firefox"; + } + + /** + * (문화원)첨부파일로 등록된 파일에 대하여 다운로드를 제공한다. + * + * @param commandMap + * @param response + * @throws Exception + */ + @RequestMapping(value = "/cmm/fms/FileDown.do") + public void cvplFileDownload(@RequestParam Map commandMap, HttpServletRequest request, + HttpServletResponse response) throws Exception { + + String atchFileId = (String)commandMap.get("atchFileId"); + String fileSn = (String)commandMap.get("fileSn"); + +// Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + +// if (isAuthenticated) { + +// FileVO fileVO = new FileVO(); +// fileVO.setAtchFileId(atchFileId); +// fileVO.setFileSn(fileSn); +// FileVO fvo = fileService.selectFileInf(fileVO); + +// File uFile = new File(fvo.getFileStreCours(), fvo.getStreFileNm()); +// long fSize = uFile.length(); + + AttachmentVO attachmentVO = new AttachmentVO(); + attachmentVO.setAtchmnflId(atchFileId); + //atchmnflVO.setSortSn(fileSn); + AttachmentVO fvo = fileService.selectFileDetailByKF(attachmentVO); + + File uFile = new File(fvo.getFlpth(), fvo.getFilePhysiclNm()); + 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.getFileLogicNm(), userAgent, "UTF-8"); + //String contentDisposition = EgovBrowserUtil.getDisposition(fvo.getOrignlFileNm(), userAgent, "UTF-8"); + //response.setBufferSize(fSize); // OutOfMemeory 발생 + response.setContentType(mimetype); + //response.setHeader("Content-Disposition", "attachment; filename=\"" + contentDisposition + "\""); + 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) { + // 다음 Exception 무시 처리 + // Connection reset by peer: socket write error + EgovBasicLogger.ignore("IO Exception", ex); + } finally { + EgovResourceCloseHelper.close(in, out); + } + + } else { + response.sendError(HttpServletResponse.SC_NOT_FOUND, "파일을 찾을 수 없습니다."); + + } +// } + } +} diff --git a/src/main/java/egovframework/com/cmm/web/EgovFileMngController.java b/src/main/java/egovframework/com/cmm/web/EgovFileMngController.java new file mode 100644 index 0000000..24daa57 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/web/EgovFileMngController.java @@ -0,0 +1,287 @@ +package egovframework.com.cmm.web; + +import java.util.List; +import java.util.Map; + +import egovframework.com.cmm.service.EgovFileMngService; +import egovframework.com.cmm.service.FileVO; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import kccf.bbs.vo.AttachmentVO; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +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; + +/** + * 파일 조회, 삭제, 다운로드 처리를 위한 컨트롤러 클래스 + * @author 공통서비스개발팀 이삼섭 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.3.25  이삼섭          최초 생성
    + *   2016.10.13 장동한           deleteFileInf 메소드 return 방식 수정
    + *
    + * 
    + */ +@Controller +public class EgovFileMngController { + + @Resource(name = "EgovFileMngService") + private EgovFileMngService fileService; + + /** + * 문화원 첨부파일에 대한 목록을 조회한다. + * + * @param fileVO + * @param atchFileId + * @param sessionVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cmm/fms/selectFileInfsByKF.do") + public String selectFileInfsByKF(@ModelAttribute("searchVO") AttachmentVO attachmentVO, @RequestParam Map commandMap, ModelMap model) throws Exception { + String nttId = (String)commandMap.get("param_nttId"); + String bbsId; + String locate; + if(commandMap.get("param_bbsId")!=null) { + bbsId = (String)commandMap.get("param_bbsId"); + attachmentVO.setCntntsGroupId(bbsId); + } + if(commandMap.get("param_locate")!=null) { + locate = (String)commandMap.get("param_locate"); + model.addAttribute("locate", locate); + } + String fileType = (String)commandMap.get("param_thumb"); + + attachmentVO.setCntntsId(nttId); + + List result = fileService.selectFileListByCntntsId(attachmentVO); + + model.addAttribute("fileList", result); + model.addAttribute("fileType", fileType); + model.addAttribute("updateFlag", "N"); + model.addAttribute("fileListCnt", result.size()); + model.addAttribute("nttId", nttId); + + return "egovframework/com/cmm/fms/EgovFileList"; + } + + + /** + * 문화원 첨부파일 변경을 위한 수정페이지로 이동한다. + * + * @param fileVO + * @param atchFileId + * @param sessionVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cmm/fms/selectFileInfsForUpdateByKF.do") + public String selectFileInfsForUpdateByKF(@ModelAttribute("searchVO") AttachmentVO attachmentVO, @RequestParam Map commandMap, + //SessionVO sessionVO, + ModelMap model) throws Exception { + + String nttId = (String)commandMap.get("param_nttId"); + String fileType = (String)commandMap.get("param_thumb"); + + attachmentVO.setCntntsId(nttId); + + List fileList = fileService.selectFileListByCntntsId(attachmentVO); + + model.addAttribute("fileList", fileList); + model.addAttribute("fileType", fileType); + model.addAttribute("updateFlag", "Y"); + model.addAttribute("fileListCnt", fileList.size()); + model.addAttribute("nttId", nttId); + + return "egovframework/com/cmm/fms/EgovFileList"; + } + + + /** + * 문화원 첨부파일에 대한 삭제를 처리한다. + * + * @param fileVO + * @param returnUrl + * @param sessionVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cmm/fms/deleteFileInfsByKF.do") + public String deleteFileInfsByKF(@RequestBody List deleteFiles, + HttpSession session, + HttpServletRequest request, + ModelMap model + ) throws Exception { + + //Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + //if (isAuthenticated) { + fileService.deleteFileInfsByKF(deleteFiles); + //} + + return "blank"; + + //-------------------------------------------- + // contextRoot가 있는 경우 제외 시켜야 함 + //-------------------------------------------- + ////return "forward:/cmm/fms/selectFileInfs.do"; + //return "forward:" + returnUrl; + /* ******************************************************* + * modify by jdh + ******************************************************* + if ("".equals(request.getContextPath()) || "/".equals(request.getContextPath())) { + return "forward:" + returnUrl; + } + + if (returnUrl.startsWith(request.getContextPath())) { + return "forward:" + returnUrl.substring(returnUrl.indexOf("/", 1)); + } else { + return "forward:" + returnUrl; + } + */ + ////------------------------------------------ + } + + + + /** + * 첨부파일에 대한 목록을 조회한다. + * + * @param fileVO + * @param atchFileId + * @param sessionVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cmm/fms/selectFileInfs.do") + public String selectFileInfs(@ModelAttribute("searchVO") FileVO fileVO, @RequestParam Map commandMap, ModelMap model) throws Exception { + String atchFileId = (String)commandMap.get("param_atchFileId"); + + fileVO.setAtchFileId(atchFileId); + List result = fileService.selectFileInfs(fileVO); + + model.addAttribute("fileList", result); + model.addAttribute("updateFlag", "N"); + model.addAttribute("fileListCnt", result.size()); + model.addAttribute("atchFileId", atchFileId); + + return "egovframework/com/cmm/fms/EgovFileList"; + } + + /** + * 첨부파일 변경을 위한 수정페이지로 이동한다. + * + * @param fileVO + * @param atchFileId + * @param sessionVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cmm/fms/selectFileInfsForUpdate.do") + public String selectFileInfsForUpdate(@ModelAttribute("searchVO") FileVO fileVO, @RequestParam Map commandMap, + //SessionVO sessionVO, + ModelMap model) throws Exception { + + String atchFileId = (String)commandMap.get("param_atchFileId"); + + fileVO.setAtchFileId(atchFileId); + + List result = fileService.selectFileInfs(fileVO); + + model.addAttribute("fileList", result); + model.addAttribute("updateFlag", "Y"); + model.addAttribute("fileListCnt", result.size()); + model.addAttribute("atchFileId", atchFileId); + + return "egovframework/com/cmm/fms/EgovFileList"; + } + + /** + * 첨부파일에 대한 삭제를 처리한다. + * + * @param fileVO + * @param returnUrl + * @param sessionVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cmm/fms/deleteFileInfs.do") + public String deleteFileInf(@ModelAttribute("searchVO") FileVO fileVO, + //SessionVO sessionVO, + HttpServletRequest request, + ModelMap model) throws Exception { + + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if (isAuthenticated) { + fileService.deleteFileInf(fileVO); + } + + return "blank"; + + //-------------------------------------------- + // contextRoot가 있는 경우 제외 시켜야 함 + //-------------------------------------------- + ////return "forward:/cmm/fms/selectFileInfs.do"; + //return "forward:" + returnUrl; + /* ******************************************************* + * modify by jdh + ******************************************************* + if ("".equals(request.getContextPath()) || "/".equals(request.getContextPath())) { + return "forward:" + returnUrl; + } + + if (returnUrl.startsWith(request.getContextPath())) { + return "forward:" + returnUrl.substring(returnUrl.indexOf("/", 1)); + } else { + return "forward:" + returnUrl; + } + */ + ////------------------------------------------ + } + + /** + * 이미지 첨부파일에 대한 목록을 조회한다. + * + * @param fileVO + * @param atchFileId + * @param sessionVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cmm/fms/selectImageFileInfs.do") + public String selectImageFileInfs(@ModelAttribute("searchVO") FileVO fileVO, @RequestParam Map commandMap, + //SessionVO sessionVO, + ModelMap model) throws Exception { + + String atchFileId = (String)commandMap.get("atchFileId"); + + fileVO.setAtchFileId(atchFileId); + List result = fileService.selectImageFileList(fileVO); + + model.addAttribute("fileList", result); + + return "egovframework/com/cmm/fms/EgovImgFileList"; + } +} diff --git a/src/main/java/egovframework/com/cmm/web/EgovImageProcessController.java b/src/main/java/egovframework/com/cmm/web/EgovImageProcessController.java new file mode 100644 index 0000000..ed5a096 --- /dev/null +++ b/src/main/java/egovframework/com/cmm/web/EgovImageProcessController.java @@ -0,0 +1,126 @@ +package egovframework.com.cmm.web; + +import java.io.BufferedInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.util.Map; + +import egovframework.com.cmm.EgovWebUtil; +import egovframework.com.cmm.SessionVO; +import egovframework.com.cmm.service.EgovFileMngService; +import egovframework.com.cmm.service.FileVO; +import egovframework.com.cmm.util.EgovResourceCloseHelper; +import kccf.bbs.vo.AttachmentVO; +import kccf.util.StrUtil; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletResponse; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; + + +/** + * @Class Name : EgovImageProcessController.java + * @Description : + * @Modification Information + * + * 수정일 수정자 수정내용 + * ---------- --------- ------------------- + * 2009.04.02 이삼섭 최초생성 + * 2014.03.31 유지보수 fileSn 오류수정 + * 2018.08.31 이정은 MimeType 중복설정 제거 + * 2019.11.29 신용호 KISA 보안약점 조치 : HTTP응답분할(HTTP_Response_Splitting,CRLF)취약점 조치 + * + * @author 공통 서비스 개발팀 이삼섭 + * @since 2009. 4. 2. + * @version + * @see + * + */ +@SuppressWarnings("serial") +@Controller +public class EgovImageProcessController extends HttpServlet { + + @Resource(name = "EgovFileMngService") + private EgovFileMngService fileService; + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovImageProcessController.class); + + /** + * 첨부된 이미지에 대한 미리보기 기능을 제공한다. + * + * @param atchFileId + * @param fileSn + * @param sessionVO + * @param model + * @param response + * @throws Exception + */ + @RequestMapping("/cmm/fms/getImage.do") + public void getImageInf(SessionVO sessionVO, ModelMap model, @RequestParam Map commandMap, HttpServletResponse response) throws Exception { + + //@RequestParam("atchFileId") String atchFileId, + //@RequestParam("fileSn") String fileSn, + String atchmnflId = StrUtil.ifEmpty((String)commandMap.get("atchmnflId"), (String)commandMap.get("atchFileId")) ; + //int fileSn = (int)commandMap.get("fileSn"); + + AttachmentVO attachVO = new AttachmentVO(); + + attachVO.setAtchmnflId(atchmnflId); + + AttachmentVO fvo = (AttachmentVO) fileService.selectFileDetailByKF(attachVO); + + //String fileLoaction = fvo.getFileStreCours() + fvo.getStreFileNm(); + + File file = null; + FileInputStream fis = null; + + BufferedInputStream in = null; + ByteArrayOutputStream bStream = null; + + try { + file = new File(fvo.getFlpth(), fvo.getFilePhysiclNm()); + fis = new FileInputStream(file); + + in = new BufferedInputStream(fis); + bStream = new ByteArrayOutputStream(); + + int imgByte; + while ((imgByte = in.read()) != -1) { + bStream.write(imgByte); + } + + String type = ""; + + if (fvo.getExtsn() != null && !"".equals(fvo.getExtsn())) { + if ("jpg".equals(fvo.getExtsn().toLowerCase())) { + type = "image/jpeg"; + } else { + type = "image/" + fvo.getExtsn().toLowerCase(); + } + /*type = "image/" + fvo.getFileExtsn().toLowerCase();*/ + + } else { + LOGGER.debug("Image fileType is null."); + } + + response.setHeader("Content-Type", EgovWebUtil.removeCRLF(type)); + response.setContentLength(bStream.size()); + + bStream.writeTo(response.getOutputStream()); + + response.getOutputStream().flush(); + response.getOutputStream().close(); + + } finally { + EgovResourceCloseHelper.close(bStream, in, fis); + } + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/cmm/web/EgovMultipartResolver.java b/src/main/java/egovframework/com/cmm/web/EgovMultipartResolver.java new file mode 100644 index 0000000..dd2935f --- /dev/null +++ b/src/main/java/egovframework/com/cmm/web/EgovMultipartResolver.java @@ -0,0 +1,151 @@ +package egovframework.com.cmm.web; + +/* + * Copyright 2001-2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the ";License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS"; BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.io.UnsupportedEncodingException; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.servlet.ServletContext; + +import org.apache.commons.fileupload.FileItem; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.util.StringUtils; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.commons.CommonsMultipartFile; +import org.springframework.web.multipart.commons.CommonsMultipartResolver; + +import egovframework.com.cmm.service.EgovProperties; +import egovframework.com.utl.fcc.service.EgovFileUploadUtil; + +/** + * 실행환경의 파일업로드 처리를 위한 기능 클래스 + * + * @author 공통서비스개발팀 이삼섭 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *  수정일                수정자             수정내용
    + *  ----------   --------    ---------------------------
    + *  2009.03.25   이삼섭              최초 생성
    + *  2011.06.11   서준식              스프링 3.0 업그레이드 API변경으로인한 수정
    + *  2020.10.27   신용호              예외처리 수정
    + *  2020.10.29   신용호              허용되지 않는 확장자 업로드 제한 (globals.properties > Globals.fileUpload.Extensions)
    + *
    + *      
    + */ +public class EgovMultipartResolver extends CommonsMultipartResolver { + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovMultipartResolver.class); + + public EgovMultipartResolver() { + } + + /** + * 첨부파일 처리를 위한 multipart resolver를 생성한다. + * + * @param servletContext + */ + public EgovMultipartResolver(ServletContext servletContext) { + super(servletContext); + } + + /** + * multipart에 대한 parsing을 처리한다. + */ + @Override + protected MultipartParsingResult parseFileItems(List fileItems, String encoding) { + + // 스프링 3.0변경으로 수정한 부분 + MultiValueMap multipartFiles = new LinkedMultiValueMap(); + Map multipartParameters = new HashMap(); + String whiteListFileUploadExtensions = EgovProperties.getProperty("Globals.fileUpload.Extensions"); + Map mpParamContentTypes = new HashMap(); + + // Extract multipart files and multipart parameters. + for (Iterator it = fileItems.iterator(); it.hasNext();) { + FileItem fileItem = it.next(); + + if (fileItem.isFormField()) { + + String value = null; + if (encoding != null) { + try { + value = fileItem.getString(encoding); + } catch (UnsupportedEncodingException ex) { + LOGGER.warn("Could not decode multipart item '{}' with encoding '{}': using platform default", + fileItem.getFieldName(), encoding); + value = fileItem.getString(); + } + } else { + value = fileItem.getString(); + } + String[] curParam = multipartParameters.get(fileItem.getFieldName()); + if (curParam == null) { + // simple form field + multipartParameters.put(fileItem.getFieldName(), new String[] { value }); + } else { + // array of simple form fields + String[] newParam = StringUtils.addStringToArray(curParam, value); + multipartParameters.put(fileItem.getFieldName(), newParam); + } + + //contentType 입력 + mpParamContentTypes.put(fileItem.getFieldName(), fileItem.getContentType()); + } else { + + CommonsMultipartFile file = createMultipartFile(fileItem); + multipartFiles.add(file.getName(), file); + + LOGGER.debug("Found multipart file [{" + file.getName() + "}] of size {" + file.getSize() + + "} bytes with original filename [{" + file.getOriginalFilename() + "}], stored {" + + file.getStorageDescription() + "}"); + + String fileName = file.getOriginalFilename(); + String fileExtension = EgovFileUploadUtil.getFileExtension(fileName); + LOGGER.debug("Found File Extension = "+fileExtension); + if (whiteListFileUploadExtensions == null || "".equals(whiteListFileUploadExtensions)) { + LOGGER.debug("The file extension whitelist has not been set."); + } else { + if (fileName == null || "".equals(fileName)) { + LOGGER.debug("No file name."); + } else { + if ("".equals(fileExtension)) { // 확장자 없는 경우 처리 불가 + throw new SecurityException("[No file extension] File extension not allowed."); + } + if ((whiteListFileUploadExtensions+".").contains("."+fileExtension.toLowerCase()+".")) { + LOGGER.debug("File extension allowed."); + } else { + throw new SecurityException("["+fileExtension+"] File extension not allowed."); + } + } + } + + } + } + + return new MultipartParsingResult(multipartFiles, multipartParameters, mpParamContentTypes);//2022.01. Method call passes null for non-null parameter 처리 + } +} diff --git a/src/main/java/egovframework/com/cop/bbs/service/Blog.java b/src/main/java/egovframework/com/cop/bbs/service/Blog.java new file mode 100644 index 0000000..7f5fcfb --- /dev/null +++ b/src/main/java/egovframework/com/cop/bbs/service/Blog.java @@ -0,0 +1,341 @@ +package egovframework.com.cop.bbs.service; + +import java.io.Serializable; + +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * 블로그게시판 관리를 위한 모델 클래스 + * @author 공통서비스개발팀 양희훈 + * @since 2017.09.12 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일            수정자           수정내용
    + *  -----------   --------   ---------------------------
    + *   2017.09.12  양희훈          최초 생성
    + *
    + * 
    + */ +@SuppressWarnings("serial") +public class Blog implements Serializable { + + /** 블로그 아이디 */ + private String blogId = ""; + + /** 게시판 아이디 */ + private String bbsId = ""; + + /** 블로그 소개 */ + private String blogIntrcn = ""; + + /** 블로그 명 */ + private String blogNm = ""; + + /** 최초등록자 아이디 */ + private String frstRegisterId = ""; + + /** 최초등록시점 */ + private String frstRegisterPnttm = ""; + + /** 최종수정자 아이디 */ + private String lastUpdusrId = ""; + + /** 최종수정시점 */ + private String lastUpdusrPnttm = ""; + + /** 등록구분코드 */ + private String registSeCode = ""; + + /** 템플릿 아이디 */ + private String tmplatId = ""; + + /** 템플릿 아이디 */ + private String useAt = ""; + + /** 사용자 아이디 */ + private String emplyrId = ""; + + /** 사용자명 */ + private String userNm = ""; + + /** 템플릿 명 */ + private String tmplatNm = ""; + + /** 블로그 게시판 여부 */ + private String blogAt = ""; + + /** + * blogId attribute를 리턴한다. + * + * @return the blogId + */ + public String getBlogId() { + return blogId; + } + + /** + * blogId attribute 값을 설정한다. + * + * @param blogId + * the blogId to set + */ + public void setBlogId(String blogId) { + this.blogId = blogId; + } + + public String getBbsId() { + return bbsId; + } + + public void setBbsId(String bbsId) { + this.bbsId = bbsId; + } + + /** + * blogIntrcn attribute를 리턴한다. + * + * @return the blogIntrcn + */ + public String getBlogIntrcn() { + return blogIntrcn; + } + + /** + * blogIntrcn attribute 값을 설정한다. + * + * @param blogIntrcn + * the blogIntrcn to set + */ + public void setBlogIntrcn(String blogIntrcn) { + this.blogIntrcn = blogIntrcn; + } + + /** + * blogNm attribute를 리턴한다. + * + * @return the blogNm + */ + public String getBlogNm() { + return blogNm; + } + + /** + * blogNm attribute 값을 설정한다. + * + * @param blogNm + * the blogNm to set + */ + public void setBlogNm(String blogNm) { + this.blogNm = blogNm; + } + + /** + * frstRegisterId attribute를 리턴한다. + * + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * frstRegisterId attribute 값을 설정한다. + * + * @param frstRegisterId + * the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * frstRegisterPnttm attribute를 리턴한다. + * + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * frstRegisterPnttm attribute 값을 설정한다. + * + * @param frstRegisterPnttm + * the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * lastUpdusrId attribute를 리턴한다. + * + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * lastUpdusrId attribute 값을 설정한다. + * + * @param lastUpdusrId + * the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + /** + * lastUpdusrPnttm attribute를 리턴한다. + * + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * lastUpdusrPnttm attribute 값을 설정한다. + * + * @param lastUpdusrPnttm + * the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * registSeCode attribute를 리턴한다. + * + * @return the registSeCode + */ + public String getRegistSeCode() { + return registSeCode; + } + + /** + * registSeCode attribute 값을 설정한다. + * + * @param registSeCode + * the registSeCode to set + */ + public void setRegistSeCode(String registSeCode) { + this.registSeCode = registSeCode; + } + + /** + * tmplatId attribute를 리턴한다. + * + * @return the tmplatId + */ + public String getTmplatId() { + return tmplatId; + } + + /** + * tmplatId attribute 값을 설정한다. + * + * @param tmplatId + * the tmplatId to set + */ + public void setTmplatId(String tmplatId) { + this.tmplatId = tmplatId; + } + + /** + * useAt attribute를 리턴한다. + * + * @return the useAt + */ + public String getUseAt() { + return useAt; + } + + /** + * useAt attribute 값을 설정한다. + * + * @param useAt + * the useAt to set + */ + public void setUseAt(String useAt) { + this.useAt = useAt; + } + + /** + * emplyrId attribute를 리턴한다. + * + * @return the emplyrId + */ + public String getEmplyrId() { + return emplyrId; + } + + /** + * emplyrId attribute 값을 설정한다. + * + * @param emplyrId + * the emplyrId to set + */ + public void setEmplyrId(String emplyrId) { + this.emplyrId = emplyrId; + } + + /** + * userNm attribute를 리턴한다. + * + * @return the userNm + */ + public String getUserNm() { + return userNm; + } + + /** + * userNm attribute 값을 설정한다. + * + * @param userNm + * the userNm to set + */ + public void setUserNm(String userNm) { + this.userNm = userNm; + } + + /** + * tmplatNm attribute를 리턴한다. + * + * @return the tmplatNm + */ + public String getTmplatNm() { + return tmplatNm; + } + + /** + * tmplatNm attribute 값을 설정한다. + * + * @param tmplatNm + * the tmplatNm to set + */ + public void setTmplatNm(String tmplatNm) { + this.tmplatNm = tmplatNm; + } + + public String getBlogAt() { + return blogAt; + } + + public void setBlogAt(String blogAt) { + this.blogAt = blogAt; + } + + /** + * toString 메소드를 대치한다. + */ + public String toString() { + return ToStringBuilder.reflectionToString(this); + } + +} diff --git a/src/main/java/egovframework/com/cop/bbs/service/BlogUser.java b/src/main/java/egovframework/com/cop/bbs/service/BlogUser.java new file mode 100644 index 0000000..17616e0 --- /dev/null +++ b/src/main/java/egovframework/com/cop/bbs/service/BlogUser.java @@ -0,0 +1,362 @@ +package egovframework.com.cop.bbs.service; + +import java.io.Serializable; + +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * 블로그게시판 관리를 위한 모델 클래스 + * @author 공통서비스개발팀 양희훈 + * @since 2017.09.12 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일            수정자           수정내용
    + *  -----------   --------   ---------------------------
    + *   2017.09.12  양희훈          최초 생성
    + *
    + * 
    + */ +@SuppressWarnings("serial") +public class BlogUser implements Serializable { + + /** 블로그아이디 */ + private String blogId = ""; + + /** 최초등록자 아이디 */ + private String frstRegisterId = ""; + + /** 최초등록시점 */ + private String frstRegisterPnttm = ""; + + /** 최종수정자 아이디 */ + private String lastUpdusrId = ""; + + /** 최종수정시점 */ + private String lastUpdusrPnttm = ""; + + /** 관리자여부 */ + private String mngrAt = ""; + + /** 탈퇴일 */ + private String secsnDe = ""; + + /** 가입일 */ + private String sbscrbDe = ""; + + /** 사용여부 */ + private String useAt = ""; + + /** 사용자 아이디 */ + private String emplyrId = ""; + + /** 사용자명 */ + private String emplyrNm = ""; + + /** 회원 ID */ + private String userId = ""; + + /** 회원 이메일 */ + private String userEmail = ""; + + /** 회원 상태 */ + private String mberSttus = ""; + + /** 회원 상태 코드명 */ + private String mberSttusNm = ""; + + /** + * blogId attribute를 리턴한다. + * + * @return the blogId + */ + public String getBlogId() { + return blogId; + } + + /** + * blogId attribute 값을 설정한다. + * + * @param blogId + * the blogId to set + */ + public void setBlogId(String blogId) { + this.blogId = blogId; + } + + /** + * frstRegisterId attribute를 리턴한다. + * + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * frstRegisterId attribute 값을 설정한다. + * + * @param frstRegisterId + * the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * frstRegisterPnttm attribute를 리턴한다. + * + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * frstRegisterPnttm attribute 값을 설정한다. + * + * @param frstRegisterPnttm + * the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * lastUpdusrId attribute를 리턴한다. + * + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * lastUpdusrId attribute 값을 설정한다. + * + * @param lastUpdusrId + * the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + /** + * lastUpdusrPnttm attribute를 리턴한다. + * + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * lastUpdusrPnttm attribute 값을 설정한다. + * + * @param lastUpdusrPnttm + * the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * mngrAt attribute를 리턴한다. + * + * @return the mngrAt + */ + public String getMngrAt() { + return mngrAt; + } + + /** + * mngrAt attribute 값을 설정한다. + * + * @param mngrAt + * the mngrAt to set + */ + public void setMngrAt(String mngrAt) { + this.mngrAt = mngrAt; + } + + /** + * secsnDe attribute를 리턴한다. + * + * @return the secsnDe + */ + public String getSecsnDe() { + return secsnDe; + } + + /** + * secsnDe attribute 값을 설정한다. + * + * @param secsnDe + * the secsnDe to set + */ + public void setSecsnDe(String secsnDe) { + this.secsnDe = secsnDe; + } + + /** + * sbscrbDe attribute를 리턴한다. + * + * @return the sbscrbDe + */ + public String getSbscrbDe() { + return sbscrbDe; + } + + /** + * sbscrbDe attribute 값을 설정한다. + * + * @param sbscrbDe + * the sbscrbDe to set + */ + public void setSbscrbDe(String sbscrbDe) { + this.sbscrbDe = sbscrbDe; + } + + /** + * useAt attribute를 리턴한다. + * + * @return the useAt + */ + public String getUseAt() { + return useAt; + } + + /** + * useAt attribute 값을 설정한다. + * + * @param useAt + * the useAt to set + */ + public void setUseAt(String useAt) { + this.useAt = useAt; + } + + /** + * emplyrId attribute를 리턴한다. + * + * @return the emplyrId + */ + public String getEmplyrId() { + return emplyrId; + } + + /** + * emplyrId attribute 값을 설정한다. + * + * @param emplyrId + * the emplyrId to set + */ + public void setEmplyrId(String emplyrId) { + this.emplyrId = emplyrId; + } + + /** + * emplyrNm attribute를 리턴한다. + * + * @return the emplyrNm + */ + public String getEmplyrNm() { + return emplyrNm; + } + + /** + * emplyrNm attribute 값을 설정한다. + * + * @param emplyrNm + * the emplyrNm to set + */ + public void setEmplyrNm(String emplyrNm) { + this.emplyrNm = emplyrNm; + } + + /** + * userId attribute를 리턴한다. + * + * @return the userId + */ + public String getUserId() { + return userId; + } + + /** + * userId attribute 값을 설정한다. + * + * @param userId + * the userId to set + */ + public void setUserId(String userId) { + this.userId = userId; + } + + /** + * userEmail attribute를 리턴한다. + * + * @return the userEmail + */ + public String getUserEmail() { + return userEmail; + } + + /** + * userEmail attribute 값을 설정한다. + * + * @param userEmail + * the userEmail to set + */ + public void setUserEmail(String userEmail) { + this.userEmail = userEmail; + } + + /** + * mberSttus attribute를 리턴한다. + * + * @return the mberSttus + */ + public String getMberSttus() { + return mberSttus; + } + + /** + * mberSttus attribute 값을 설정한다. + * + * @param mberSttus + * the mberSttus to set + */ + public void setMberSttus(String mberSttus) { + this.mberSttus = mberSttus; + } + + /** + * mberSttusNm attribute를 리턴한다. + * + * @return the mberSttusNm + */ + public String getMberSttusNm() { + return mberSttusNm; + } + + /** + * mberSttusNm attribute 값을 설정한다. + * + * @param mberSttusNm + * the mberSttusNm to set + */ + public void setMberSttusNm(String mberSttusNm) { + this.mberSttusNm = mberSttusNm; + } + + /** + * toString 메소드를 대치한다. + */ + public String toString() { + return ToStringBuilder.reflectionToString(this); + } +} diff --git a/src/main/java/egovframework/com/cop/bbs/service/BlogUserVO.java b/src/main/java/egovframework/com/cop/bbs/service/BlogUserVO.java new file mode 100644 index 0000000..91e39f1 --- /dev/null +++ b/src/main/java/egovframework/com/cop/bbs/service/BlogUserVO.java @@ -0,0 +1,319 @@ +package egovframework.com.cop.bbs.service; + +import java.io.Serializable; + +import org.apache.commons.lang3.builder.ToStringBuilder; + + +/** + * 블로그게시판 관리를 위한 VO 클래스 + * @author 공통서비스개발팀 양희훈 + * @since 2017.09.12 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일            수정자           수정내용
    + *  -----------   --------   ---------------------------
    + *   2017.09.12  양희훈          최초 생성
    + *
    + * 
    + */ +@SuppressWarnings("serial") +public class BlogUserVO extends BlogUser implements Serializable { + + /** 검색시작일 */ + private String searchBgnDe = ""; + + /** 검색조건 */ + private String searchCnd = ""; + + /** 검색종료일 */ + private String searchEndDe = ""; + + /** 검색단어 */ + private String searchWrd = ""; + + /** 정렬순서(DESC,ASC) */ + private long sortOrdr = 0L; + + /** 검색사용여부 */ + private String searchUseYn = ""; + + /** 현재페이지 */ + private int pageIndex = 1; + + /** 페이지갯수 */ + private int pageUnit = 10; + + /** 페이지사이즈 */ + private int pageSize = 10; + + /** 첫페이지 인덱스 */ + private int firstIndex = 1; + + /** 마지막페이지 인덱스 */ + private int lastIndex = 1; + + /** 페이지당 레코드 개수 */ + private int recordCountPerPage = 10; + + /** 레코드 번호 */ + private int rowNo = 0; + + /** + * searchBgnDe attribute를 리턴한다. + * + * @return the searchBgnDe + */ + public String getSearchBgnDe() { + return searchBgnDe; + } + + /** + * searchBgnDe attribute 값을 설정한다. + * + * @param searchBgnDe + * the searchBgnDe to set + */ + public void setSearchBgnDe(String searchBgnDe) { + this.searchBgnDe = searchBgnDe; + } + + /** + * searchCnd attribute를 리턴한다. + * + * @return the searchCnd + */ + public String getSearchCnd() { + return searchCnd; + } + + /** + * searchCnd attribute 값을 설정한다. + * + * @param searchCnd + * the searchCnd to set + */ + public void setSearchCnd(String searchCnd) { + this.searchCnd = searchCnd; + } + + /** + * searchEndDe attribute를 리턴한다. + * + * @return the searchEndDe + */ + public String getSearchEndDe() { + return searchEndDe; + } + + /** + * searchEndDe attribute 값을 설정한다. + * + * @param searchEndDe + * the searchEndDe to set + */ + public void setSearchEndDe(String searchEndDe) { + this.searchEndDe = searchEndDe; + } + + /** + * searchWrd attribute를 리턴한다. + * + * @return the searchWrd + */ + public String getSearchWrd() { + return searchWrd; + } + + /** + * searchWrd attribute 값을 설정한다. + * + * @param searchWrd + * the searchWrd to set + */ + public void setSearchWrd(String searchWrd) { + this.searchWrd = searchWrd; + } + + /** + * sortOrdr attribute를 리턴한다. + * + * @return the sortOrdr + */ + public long getSortOrdr() { + return sortOrdr; + } + + /** + * sortOrdr attribute 값을 설정한다. + * + * @param sortOrdr + * the sortOrdr to set + */ + public void setSortOrdr(long sortOrdr) { + this.sortOrdr = sortOrdr; + } + + /** + * searchUseYn attribute를 리턴한다. + * + * @return the searchUseYn + */ + public String getSearchUseYn() { + return searchUseYn; + } + + /** + * searchUseYn attribute 값을 설정한다. + * + * @param searchUseYn + * the searchUseYn to set + */ + public void setSearchUseYn(String searchUseYn) { + this.searchUseYn = searchUseYn; + } + + /** + * pageIndex attribute를 리턴한다. + * + * @return the pageIndex + */ + public int getPageIndex() { + return pageIndex; + } + + /** + * pageIndex attribute 값을 설정한다. + * + * @param pageIndex + * the pageIndex to set + */ + public void setPageIndex(int pageIndex) { + this.pageIndex = pageIndex; + } + + /** + * pageUnit attribute를 리턴한다. + * + * @return the pageUnit + */ + public int getPageUnit() { + return pageUnit; + } + + /** + * pageUnit attribute 값을 설정한다. + * + * @param pageUnit + * the pageUnit to set + */ + public void setPageUnit(int pageUnit) { + this.pageUnit = pageUnit; + } + + /** + * pageSize attribute를 리턴한다. + * + * @return the pageSize + */ + public int getPageSize() { + return pageSize; + } + + /** + * pageSize attribute 값을 설정한다. + * + * @param pageSize + * the pageSize to set + */ + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + /** + * firstIndex attribute를 리턴한다. + * + * @return the firstIndex + */ + public int getFirstIndex() { + return firstIndex; + } + + /** + * firstIndex attribute 값을 설정한다. + * + * @param firstIndex + * the firstIndex to set + */ + public void setFirstIndex(int firstIndex) { + this.firstIndex = firstIndex; + } + + /** + * lastIndex attribute를 리턴한다. + * + * @return the lastIndex + */ + public int getLastIndex() { + return lastIndex; + } + + /** + * lastIndex attribute 값을 설정한다. + * + * @param lastIndex + * the lastIndex to set + */ + public void setLastIndex(int lastIndex) { + this.lastIndex = lastIndex; + } + + /** + * recordCountPerPage attribute를 리턴한다. + * + * @return the recordCountPerPage + */ + public int getRecordCountPerPage() { + return recordCountPerPage; + } + + /** + * recordCountPerPage attribute 값을 설정한다. + * + * @param recordCountPerPage + * the recordCountPerPage to set + */ + public void setRecordCountPerPage(int recordCountPerPage) { + this.recordCountPerPage = recordCountPerPage; + } + + /** + * rowNo attribute를 리턴한다. + * + * @return the rowNo + */ + public int getRowNo() { + return rowNo; + } + + /** + * rowNo attribute 값을 설정한다. + * + * @param rowNo + * the rowNo to set + */ + public void setRowNo(int rowNo) { + this.rowNo = rowNo; + } + + /** + * toString 메소드를 대치한다. + */ + public String toString() { + return ToStringBuilder.reflectionToString(this); + } +} diff --git a/src/main/java/egovframework/com/cop/bbs/service/BlogVO.java b/src/main/java/egovframework/com/cop/bbs/service/BlogVO.java new file mode 100644 index 0000000..9fe2c3b --- /dev/null +++ b/src/main/java/egovframework/com/cop/bbs/service/BlogVO.java @@ -0,0 +1,443 @@ +package egovframework.com.cop.bbs.service; + +import java.io.Serializable; + +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * 커뮤니티 관리를 위한 VO 클래스 + * @author 공통서비스개발팀 이삼섭 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.4.2  이삼섭          최초 생성
    + *
    + * 
    + */ +@SuppressWarnings("serial") +public class BlogVO extends Blog implements Serializable { + + /** 검색시작일 */ + private String searchBgnDe = ""; + + /** 검색조건 */ + private String searchCnd = ""; + + /** 검색종료일 */ + private String searchEndDe = ""; + + /** 검색단어 */ + private String searchWrd = ""; + + /** 정렬순서(DESC,ASC) */ + private long sortOrdr = 0L; + + /** 검색사용여부 */ + private String searchUseYn = ""; + + /** 현재페이지 */ + private int pageIndex = 1; + + /** 페이지갯수 */ + private int pageUnit = 10; + + /** 페이지사이즈 */ + private int pageSize = 10; + + /** 첫페이지 인덱스 */ + private int firstIndex = 1; + + /** 마지막페이지 인덱스 */ + private int lastIndex = 1; + + /** 페이지당 레코드 개수 */ + private int recordCountPerPage = 10; + + /** 레코드 번호 */ + private int rowNo = 0; + + /** 등록구분 코드명 */ + private String registSeCodeNm = ""; + + /** 최초 등록자명 */ + private String frstRegisterNm = ""; + + /** 게시판 아이드 */ + private String bbsId = ""; + + /** 게시판 이름 */ + private String bbsNm = ""; + + /** 제공 URL */ + private String provdUrl = ""; + + private String blogId = ""; + + + /** + * searchBgnDe attribute를 리턴한다. + * + * @return the searchBgnDe + */ + public String getSearchBgnDe() { + return searchBgnDe; + } + + /** + * searchBgnDe attribute 값을 설정한다. + * + * @param searchBgnDe + * the searchBgnDe to set + */ + public void setSearchBgnDe(String searchBgnDe) { + this.searchBgnDe = searchBgnDe; + } + + /** + * searchCnd attribute를 리턴한다. + * + * @return the searchCnd + */ + public String getSearchCnd() { + return searchCnd; + } + + /** + * searchCnd attribute 값을 설정한다. + * + * @param searchCnd + * the searchCnd to set + */ + public void setSearchCnd(String searchCnd) { + this.searchCnd = searchCnd; + } + + /** + * searchEndDe attribute를 리턴한다. + * + * @return the searchEndDe + */ + public String getSearchEndDe() { + return searchEndDe; + } + + /** + * searchEndDe attribute 값을 설정한다. + * + * @param searchEndDe + * the searchEndDe to set + */ + public void setSearchEndDe(String searchEndDe) { + this.searchEndDe = searchEndDe; + } + + /** + * searchWrd attribute를 리턴한다. + * + * @return the searchWrd + */ + public String getSearchWrd() { + return searchWrd; + } + + /** + * searchWrd attribute 값을 설정한다. + * + * @param searchWrd + * the searchWrd to set + */ + public void setSearchWrd(String searchWrd) { + this.searchWrd = searchWrd; + } + + /** + * sortOrdr attribute를 리턴한다. + * + * @return the sortOrdr + */ + public long getSortOrdr() { + return sortOrdr; + } + + /** + * sortOrdr attribute 값을 설정한다. + * + * @param sortOrdr + * the sortOrdr to set + */ + public void setSortOrdr(long sortOrdr) { + this.sortOrdr = sortOrdr; + } + + /** + * searchUseYn attribute를 리턴한다. + * + * @return the searchUseYn + */ + public String getSearchUseYn() { + return searchUseYn; + } + + /** + * searchUseYn attribute 값을 설정한다. + * + * @param searchUseYn + * the searchUseYn to set + */ + public void setSearchUseYn(String searchUseYn) { + this.searchUseYn = searchUseYn; + } + + /** + * pageIndex attribute를 리턴한다. + * + * @return the pageIndex + */ + public int getPageIndex() { + return pageIndex; + } + + /** + * pageIndex attribute 값을 설정한다. + * + * @param pageIndex + * the pageIndex to set + */ + public void setPageIndex(int pageIndex) { + this.pageIndex = pageIndex; + } + + /** + * pageUnit attribute를 리턴한다. + * + * @return the pageUnit + */ + public int getPageUnit() { + return pageUnit; + } + + /** + * pageUnit attribute 값을 설정한다. + * + * @param pageUnit + * the pageUnit to set + */ + public void setPageUnit(int pageUnit) { + this.pageUnit = pageUnit; + } + + /** + * pageSize attribute를 리턴한다. + * + * @return the pageSize + */ + public int getPageSize() { + return pageSize; + } + + /** + * pageSize attribute 값을 설정한다. + * + * @param pageSize + * the pageSize to set + */ + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + /** + * firstIndex attribute를 리턴한다. + * + * @return the firstIndex + */ + public int getFirstIndex() { + return firstIndex; + } + + /** + * firstIndex attribute 값을 설정한다. + * + * @param firstIndex + * the firstIndex to set + */ + public void setFirstIndex(int firstIndex) { + this.firstIndex = firstIndex; + } + + /** + * lastIndex attribute를 리턴한다. + * + * @return the lastIndex + */ + public int getLastIndex() { + return lastIndex; + } + + /** + * lastIndex attribute 값을 설정한다. + * + * @param lastIndex + * the lastIndex to set + */ + public void setLastIndex(int lastIndex) { + this.lastIndex = lastIndex; + } + + /** + * recordCountPerPage attribute를 리턴한다. + * + * @return the recordCountPerPage + */ + public int getRecordCountPerPage() { + return recordCountPerPage; + } + + /** + * recordCountPerPage attribute 값을 설정한다. + * + * @param recordCountPerPage + * the recordCountPerPage to set + */ + public void setRecordCountPerPage(int recordCountPerPage) { + this.recordCountPerPage = recordCountPerPage; + } + + /** + * rowNo attribute를 리턴한다. + * + * @return the rowNo + */ + public int getRowNo() { + return rowNo; + } + + /** + * rowNo attribute 값을 설정한다. + * + * @param rowNo + * the rowNo to set + */ + public void setRowNo(int rowNo) { + this.rowNo = rowNo; + } + + /** + * registSeCodeNm attribute를 리턴한다. + * + * @return the registSeCodeNm + */ + public String getRegistSeCodeNm() { + return registSeCodeNm; + } + + /** + * registSeCodeNm attribute 값을 설정한다. + * + * @param registSeCodeNm + * the registSeCodeNm to set + */ + public void setRegistSeCodeNm(String registSeCodeNm) { + this.registSeCodeNm = registSeCodeNm; + } + + /** + * frstRegisterNm attribute를 리턴한다. + * + * @return the frstRegisterNm + */ + public String getFrstRegisterNm() { + return frstRegisterNm; + } + + /** + * frstRegisterNm attribute 값을 설정한다. + * + * @param frstRegisterNm + * the frstRegisterNm to set + */ + public void setFrstRegisterNm(String frstRegisterNm) { + this.frstRegisterNm = frstRegisterNm; + } + + /** + * bbsId attribute를 리턴한다. + * + * @return the bbsId + */ + public String getBbsId() { + return bbsId; + } + + /** + * bbsId attribute 값을 설정한다. + * + * @param bbsId + * the bbsId to set + */ + public void setBbsId(String bbsId) { + this.bbsId = bbsId; + } + + + public String getBlogId() { + return blogId; + } + + /** + * bbsId attribute 값을 설정한다. + * + * @param bbsId + * the bbsId to set + */ + public void setBlogId(String blogId) { + this.blogId = blogId; + } + + /** + * bbsNm attribute를 리턴한다. + * + * @return the bbsNm + */ + public String getBbsNm() { + return bbsNm; + } + + /** + * bbsNm attribute 값을 설정한다. + * + * @param bbsNm + * the bbsNm to set + */ + public void setBbsNm(String bbsNm) { + this.bbsNm = bbsNm; + } + + /** + * provdUrl attribute를 리턴한다. + * @return the provdUrl + */ + public String getProvdUrl() { + return provdUrl; + } + + /** + * provdUrl attribute 값을 설정한다. + * @param provdUrl the provdUrl to set + */ + public void setProvdUrl(String provdUrl) { + this.provdUrl = provdUrl; + } + + /** + * toString 메소드를 대치한다. + */ + public String toString() { + return ToStringBuilder.reflectionToString(this); + } +} diff --git a/src/main/java/egovframework/com/cop/bbs/service/Board.java b/src/main/java/egovframework/com/cop/bbs/service/Board.java new file mode 100644 index 0000000..fd158a3 --- /dev/null +++ b/src/main/java/egovframework/com/cop/bbs/service/Board.java @@ -0,0 +1,573 @@ +package egovframework.com.cop.bbs.service; + +import java.io.Serializable; + +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * @Class Name : Board.java + * @Description : 게시물에 대한 데이터 처리 모델 + * @Modification Information + * + * 수정일 수정자 수정내용 + * ------- -------- --------------------------- + * 2009.03.06 이삼섭 최초 생성 + * + * @author 공통 서비스 개발팀 이삼섭 + * @since 2009. 02. 13 + * @version 1.0 + * @see + * + */ +@SuppressWarnings("serial") +public class Board implements Serializable { + + /** + * 게시물 첨부파일 아이디 + */ + private String atchFileId = ""; + /** + * 게시판 아이디 + */ + private String bbsId = ""; + /** + * 최초등록자 아이디 + */ + private String frstRegisterId = ""; + /** + * 최초등록시점 + */ + private String frstRegisterPnttm = ""; + /** + * 최종수정자 아이디 + */ + private String lastUpdusrId = ""; + /** + * 최종수정시점 + */ + private String lastUpdusrPnttm = ""; + /** + * 게시시작일 + */ + private String ntceBgnde = ""; + /** + * 게시종료일 + */ + private String ntceEndde = ""; + /** + * 게시자 아이디 + */ + private String ntcrId = ""; + /** + * 게시자명 + */ + private String ntcrNm = ""; + /** + * 게시물 내용 + */ + private String nttCn = ""; + /** + * 게시물 아이디 + */ + private long nttId = 0L; + /** + * 게시물 번호 + */ + private long nttNo = 0L; + /** + * 게시물 제목 + */ + private String nttSj = ""; + /** + * 부모글번호 + */ + private String parnts = "0"; + /** + * 패스워드 + */ + private String password = ""; + /** + * 조회수 + */ + private int inqireCo = 0; + /** + * 답장여부 + */ + private String replyAt = ""; + /** + * 답장위치 + */ + private String replyLc = "0"; + /** + * 정렬순서 + */ + private long sortOrdr = 0L; + /** + * 사용여부 + */ + private String useAt = ""; + /** + * 게시 종료일 + */ + private String ntceEnddeView = ""; + /** + * 게시 시작일 + */ + private String ntceBgndeView = ""; + /** + * 공지사항 여부 + */ + private String noticeAt = ""; + /** + * 비밀글 여부 + */ + private String secretAt = ""; + /** + * 제목 Bold 여부 + */ + private String sjBoldAt = ""; + /** + * 블로그 게시판 여부 + */ + private String blogAt = ""; + /** 블로그 ID */ + private String blogId = ""; + /** + * atchFileId attribute를 리턴한다. + * @return the atchFileId + */ + public String getAtchFileId() { + return atchFileId; + } + + /** + * atchFileId attribute 값을 설정한다. + * @param atchFileId the atchFileId to set + */ + public void setAtchFileId(String atchFileId) { + this.atchFileId = atchFileId; + } + + /** + * bbsId attribute를 리턴한다. + * @return the bbsId + */ + public String getBbsId() { + return bbsId; + } + + /** + * bbsId attribute 값을 설정한다. + * @param bbsId the bbsId to set + */ + public void setBbsId(String bbsId) { + this.bbsId = bbsId; + } + + /** + * frstRegisterId attribute를 리턴한다. + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * frstRegisterId attribute 값을 설정한다. + * @param frstRegisterId the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * frstRegisterPnttm attribute를 리턴한다. + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * frstRegisterPnttm attribute 값을 설정한다. + * @param frstRegisterPnttm the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * lastUpdusrId attribute를 리턴한다. + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * lastUpdusrId attribute 값을 설정한다. + * @param lastUpdusrId the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + /** + * lastUpdusrPnttm attribute를 리턴한다. + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * lastUpdusrPnttm attribute 값을 설정한다. + * @param lastUpdusrPnttm the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * ntceBgnde attribute를 리턴한다. + * @return the ntceBgnde + */ + public String getNtceBgnde() { + return ntceBgnde; + } + + /** + * ntceBgnde attribute 값을 설정한다. + * @param ntceBgnde the ntceBgnde to set + */ + public void setNtceBgnde(String ntceBgnde) { + this.ntceBgnde = ntceBgnde; + } + + /** + * ntceEndde attribute를 리턴한다. + * @return the ntceEndde + */ + public String getNtceEndde() { + return ntceEndde; + } + + /** + * ntceEndde attribute 값을 설정한다. + * @param ntceEndde the ntceEndde to set + */ + public void setNtceEndde(String ntceEndde) { + this.ntceEndde = ntceEndde; + } + + /** + * ntcrId attribute를 리턴한다. + * @return the ntcrId + */ + public String getNtcrId() { + return ntcrId; + } + + /** + * ntcrId attribute 값을 설정한다. + * @param ntcrId the ntcrId to set + */ + public void setNtcrId(String ntcrId) { + this.ntcrId = ntcrId; + } + + /** + * ntcrNm attribute를 리턴한다. + * @return the ntcrNm + */ + public String getNtcrNm() { + return ntcrNm; + } + + /** + * ntcrNm attribute 값을 설정한다. + * @param ntcrNm the ntcrNm to set + */ + public void setNtcrNm(String ntcrNm) { + this.ntcrNm = ntcrNm; + } + + /** + * nttCn attribute를 리턴한다. + * @return the nttCn + */ + public String getNttCn() { + return nttCn; + } + + /** + * nttCn attribute 값을 설정한다. + * @param nttCn the nttCn to set + */ + public void setNttCn(String nttCn) { + this.nttCn = nttCn; + } + + /** + * nttId attribute를 리턴한다. + * @return the nttId + */ + public long getNttId() { + return nttId; + } + + /** + * nttId attribute 값을 설정한다. + * @param nttId the nttId to set + */ + public void setNttId(long nttId) { + this.nttId = nttId; + } + + /** + * nttNo attribute를 리턴한다. + * @return the nttNo + */ + public long getNttNo() { + return nttNo; + } + + /** + * nttNo attribute 값을 설정한다. + * @param nttNo the nttNo to set + */ + public void setNttNo(long nttNo) { + this.nttNo = nttNo; + } + + /** + * nttSj attribute를 리턴한다. + * @return the nttSj + */ + public String getNttSj() { + return nttSj; + } + + /** + * nttSj attribute 값을 설정한다. + * @param nttSj the nttSj to set + */ + public void setNttSj(String nttSj) { + this.nttSj = nttSj; + } + + /** + * parnts attribute를 리턴한다. + * @return the parnts + */ + public String getParnts() { + return parnts; + } + + /** + * parnts attribute 값을 설정한다. + * @param parnts the parnts to set + */ + public void setParnts(String parnts) { + this.parnts = parnts; + } + + /** + * password attribute를 리턴한다. + * @return the password + */ + public String getPassword() { + return password; + } + + /** + * password attribute 값을 설정한다. + * @param password the password to set + */ + public void setPassword(String password) { + this.password = password; + } + + /** + * inqireCo attribute를 리턴한다. + * @return the inqireCo + */ + public int getInqireCo() { + return inqireCo; + } + + /** + * inqireCo attribute 값을 설정한다. + * @param inqireCo the inqireCo to set + */ + public void setInqireCo(int inqireCo) { + this.inqireCo = inqireCo; + } + + /** + * replyAt attribute를 리턴한다. + * @return the replyAt + */ + public String getReplyAt() { + return replyAt; + } + + /** + * replyAt attribute 값을 설정한다. + * @param replyAt the replyAt to set + */ + public void setReplyAt(String replyAt) { + this.replyAt = replyAt; + } + + /** + * replyLc attribute를 리턴한다. + * @return the replyLc + */ + public String getReplyLc() { + return replyLc; + } + + /** + * replyLc attribute 값을 설정한다. + * @param replyLc the replyLc to set + */ + public void setReplyLc(String replyLc) { + this.replyLc = replyLc; + } + + /** + * sortOrdr attribute를 리턴한다. + * @return the sortOrdr + */ + public long getSortOrdr() { + return sortOrdr; + } + + /** + * sortOrdr attribute 값을 설정한다. + * @param sortOrdr the sortOrdr to set + */ + public void setSortOrdr(long sortOrdr) { + this.sortOrdr = sortOrdr; + } + + /** + * useAt attribute를 리턴한다. + * @return the useAt + */ + public String getUseAt() { + return useAt; + } + + /** + * useAt attribute 값을 설정한다. + * @param useAt the useAt to set + */ + public void setUseAt(String useAt) { + this.useAt = useAt; + } + + /** + * ntceEnddeView attribute를 리턴한다. + * @return the ntceEnddeView + */ + public String getNtceEnddeView() { + return ntceEnddeView; + } + + /** + * ntceEnddeView attribute 값을 설정한다. + * @param ntceEnddeView the ntceEnddeView to set + */ + public void setNtceEnddeView(String ntceEnddeView) { + this.ntceEnddeView = ntceEnddeView; + } + + /** + * ntceBgndeView attribute를 리턴한다. + * @return the ntceBgndeView + */ + public String getNtceBgndeView() { + return ntceBgndeView; + } + + /** + * ntceBgndeView attribute 값을 설정한다. + * @param ntceBgndeView the ntceBgndeView to set + */ + public void setNtceBgndeView(String ntceBgndeView) { + this.ntceBgndeView = ntceBgndeView; + } + + /** + * noticeAt attribute를 리턴한다. + * @return the noticeAt + */ + public String getNoticeAt() { + return noticeAt; + } + + /** + * noticeAt attribute 값을 설정한다. + * @param noticeAt the noticeAt to set + */ + public void setNoticeAt(String noticeAt) { + this.noticeAt = noticeAt; + } + + /** + * secretAt attribute를 리턴한다. + * @return the secretAt + */ + public String getSecretAt() { + return secretAt; + } + + /** + * secretAt attribute 값을 설정한다. + * @param secretAt the secretAt to set + */ + public void setSecretAt(String secretAt) { + this.secretAt = secretAt; + } + + /** + * sjBoldAt attribute를 리턴한다. + * @return the sjBoldAt + */ + public String getSjBoldAt() { + return sjBoldAt; + } + + /** + * sjBoldAt attribute 값을 설정한다. + * @param sjBoldAt the sjBoldAt to set + */ + public void setSjBoldAt(String sjBoldAt) { + this.sjBoldAt = sjBoldAt; + } + + public String getBlogAt() { + return blogAt; + } + + public void setBlogAt(String blogAt) { + this.blogAt = blogAt; + } + + public String getBlogId() { + return blogId; + } + + public void setBlogId(String blogId) { + this.blogId = blogId; + } + + /** + * toString 메소드를 대치한다. + */ + public String toString(){ + return ToStringBuilder.reflectionToString(this); + } +} diff --git a/src/main/java/egovframework/com/cop/bbs/service/BoardMaster.java b/src/main/java/egovframework/com/cop/bbs/service/BoardMaster.java new file mode 100644 index 0000000..be9f1c4 --- /dev/null +++ b/src/main/java/egovframework/com/cop/bbs/service/BoardMaster.java @@ -0,0 +1,553 @@ +package egovframework.com.cop.bbs.service; + +import java.io.Serializable; + +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * 게시판 속성정보를 담기위한 엔티티 클래스 + * @author 공통서비스개발팀 이삼섭 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.12  이삼섭          최초 생성
    + *   2009.06.26  한성곤		2단계 기능 추가 (댓글관리, 만족도조사)
    + *
    + * 
    + */ +@SuppressWarnings("serial") +public class BoardMaster implements Serializable { + + /** 게시판 아이디 */ + private String bbsId = ""; + + /** 게시판 소개 */ + private String bbsIntrcn = ""; + + /** 게시판 명 */ + private String bbsNm = ""; + + /** 게시판 유형코드 */ + private String bbsTyCode = ""; + + /** 파일첨부가능여부 */ + private String fileAtchPosblAt = ""; + + /** 최초등록자 아이디 */ + private String frstRegisterId = ""; + + /** 최초등록시점 */ + private String frstRegisterPnttm = ""; + + /** 최종수정자 아이디 */ + public String lastUpdusrId = ""; + + /** 최종수정시점 */ + private String lastUpdusrPnttm = ""; + + /** 첨부가능파일숫자 */ + private int atchPosblFileNumber = 0; + + /** 첨부가능파일사이즈 */ + private String atchPosblFileSize = ""; + + /** 답장가능여부 */ + private String replyPosblAt = ""; + + /** 템플릿 아이디 */ + private String tmplatId = ""; + + /** 사용여부 */ + private String useAt = ""; + + /** 사용플래그 */ + private String bbsUseFlag = ""; + + /** 대상 아이디 */ + private String trgetId = ""; + + /** 등록구분코드 */ + private String registSeCode = ""; + + /** 유일 아이디 */ + private String uniqId = ""; + + /** 템플릿 명 */ + private String tmplatNm = ""; + + /** 커뮤니티 ID */ + private String cmmntyId; + + /** 블로그 ID */ + private String blogId; + + /** 블로그 사용 유무 */ + private String blogAt; + + //--------------------------------- + // 2009.06.26 : 2단계 기능 추가 + //--------------------------------- + /** 추가 option (댓글-comment, 만족도조사-stsfdg) */ + private String option = ""; + + /** 댓글 여부 */ + private String commentAt = ""; + + /** 만족도조사 */ + private String stsfdgAt = ""; + ////------------------------------- + + /** + * bbsId attribute를 리턴한다. + * + * @return the bbsId + */ + public String getBbsId() { + return bbsId; + } + + /** + * bbsId attribute 값을 설정한다. + * + * @param bbsId + * the bbsId to set + */ + public void setBbsId(String bbsId) { + this.bbsId = bbsId; + } + + /** + * bbsIntrcn attribute를 리턴한다. + * + * @return the bbsIntrcn + */ + public String getBbsIntrcn() { + return bbsIntrcn; + } + + /** + * bbsIntrcn attribute 값을 설정한다. + * + * @param bbsIntrcn + * the bbsIntrcn to set + */ + public void setBbsIntrcn(String bbsIntrcn) { + this.bbsIntrcn = bbsIntrcn; + } + + /** + * bbsNm attribute를 리턴한다. + * + * @return the bbsNm + */ + public String getBbsNm() { + return bbsNm; + } + + /** + * bbsNm attribute 값을 설정한다. + * + * @param bbsNm + * the bbsNm to set + */ + public void setBbsNm(String bbsNm) { + this.bbsNm = bbsNm; + } + + /** + * bbsTyCode attribute를 리턴한다. + * + * @return the bbsTyCode + */ + public String getBbsTyCode() { + return bbsTyCode; + } + + /** + * bbsTyCode attribute 값을 설정한다. + * + * @param bbsTyCode + * the bbsTyCode to set + */ + public void setBbsTyCode(String bbsTyCode) { + this.bbsTyCode = bbsTyCode; + } + + /** + * fileAtchPosblAt attribute를 리턴한다. + * + * @return the fileAtchPosblAt + */ + public String getFileAtchPosblAt() { + return fileAtchPosblAt; + } + + /** + * fileAtchPosblAt attribute 값을 설정한다. + * + * @param fileAtchPosblAt + * the fileAtchPosblAt to set + */ + public void setFileAtchPosblAt(String fileAtchPosblAt) { + this.fileAtchPosblAt = fileAtchPosblAt; + } + + /** + * frstRegisterId attribute를 리턴한다. + * + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * frstRegisterId attribute 값을 설정한다. + * + * @param frstRegisterId + * the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * frstRegisterPnttm attribute를 리턴한다. + * + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * frstRegisterPnttm attribute 값을 설정한다. + * + * @param frstRegisterPnttm + * the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * lastUpdusrId attribute를 리턴한다. + * + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * lastUpdusrId attribute 값을 설정한다. + * + * @param lastUpdusrId + * the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + /** + * lastUpdusrPnttm attribute를 리턴한다. + * + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * lastUpdusrPnttm attribute 값을 설정한다. + * + * @param lastUpdusrPnttm + * the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * atchPosblFileNumber attribute를 리턴한다. + * + * @return the atchPosblFileNumber + */ + public int getAtchPosblFileNumber() { + return atchPosblFileNumber; + } + + /** + * atchPosblFileNumber attribute 값을 설정한다. + * + * @param atchPosblFileNumber + * the atchPosblFileNumber to set + */ + public void setAtchPosblFileNumber(int atchPosblFileNumber) { + this.atchPosblFileNumber = atchPosblFileNumber; + } + + /** + * atchPosblFileSize attribute를 리턴한다. + * + * @return the atchPosblFileSize + */ + public String getAtchPosblFileSize() { + return atchPosblFileSize; + } + + /** + * atchPosblFileSize attribute 값을 설정한다. + * + * @param atchPosblFileSize + * the atchPosblFileSize to set + */ + public void setAtchPosblFileSize(String atchPosblFileSize) { + this.atchPosblFileSize = atchPosblFileSize; + } + + /** + * replyPosblAt attribute를 리턴한다. + * + * @return the replyPosblAt + */ + public String getReplyPosblAt() { + return replyPosblAt; + } + + /** + * replyPosblAt attribute 값을 설정한다. + * + * @param replyPosblAt + * the replyPosblAt to set + */ + public void setReplyPosblAt(String replyPosblAt) { + this.replyPosblAt = replyPosblAt; + } + + /** + * tmplatId attribute를 리턴한다. + * + * @return the tmplatId + */ + public String getTmplatId() { + return tmplatId; + } + + /** + * tmplatId attribute 값을 설정한다. + * + * @param tmplatId + * the tmplatId to set + */ + public void setTmplatId(String tmplatId) { + this.tmplatId = tmplatId; + } + + /** + * useAt attribute를 리턴한다. + * + * @return the useAt + */ + public String getUseAt() { + return useAt; + } + + /** + * useAt attribute 값을 설정한다. + * + * @param useAt + * the useAt to set + */ + public void setUseAt(String useAt) { + this.useAt = useAt; + } + + /** + * bbsUseFlag attribute를 리턴한다. + * + * @return the bbsUseFlag + */ + public String getBbsUseFlag() { + return bbsUseFlag; + } + + /** + * bbsUseFlag attribute 값을 설정한다. + * + * @param bbsUseFlag + * the bbsUseFlag to set + */ + public void setBbsUseFlag(String bbsUseFlag) { + this.bbsUseFlag = bbsUseFlag; + } + + /** + * trgetId attribute를 리턴한다. + * + * @return the trgetId + */ + public String getTrgetId() { + return trgetId; + } + + /** + * trgetId attribute 값을 설정한다. + * + * @param trgetId + * the trgetId to set + */ + public void setTrgetId(String trgetId) { + this.trgetId = trgetId; + } + + /** + * registSeCode attribute를 리턴한다. + * + * @return the registSeCode + */ + public String getRegistSeCode() { + return registSeCode; + } + + /** + * registSeCode attribute 값을 설정한다. + * + * @param registSeCode + * the registSeCode to set + */ + public void setRegistSeCode(String registSeCode) { + this.registSeCode = registSeCode; + } + + /** + * uniqId attribute를 리턴한다. + * + * @return the uniqId + */ + public String getUniqId() { + return uniqId; + } + + /** + * uniqId attribute 값을 설정한다. + * + * @param uniqId + * the uniqId to set + */ + public void setUniqId(String uniqId) { + this.uniqId = uniqId; + } + + /** + * tmplatNm attribute를 리턴한다. + * + * @return the tmplatNm + */ + public String getTmplatNm() { + return tmplatNm; + } + + /** + * tmplatNm attribute 값을 설정한다. + * + * @param tmplatNm + * the tmplatNm to set + */ + public void setTmplatNm(String tmplatNm) { + this.tmplatNm = tmplatNm; + } + + /** + * option attribute를 리턴한다. + * @return the option + */ + public String getOption() { + return option; + } + + /** + * option attribute 값을 설정한다. + * @param option the option to set + */ + public void setOption(String option) { + this.option = option; + } + + /** + * commentAt attribute를 리턴한다. + * @return the commentAt + */ + public String getCommentAt() { + return commentAt; + } + + /** + * commentAt attribute 값을 설정한다. + * @param commentAt the commentAt to set + */ + public void setCommentAt(String commentAt) { + this.commentAt = commentAt; + } + + /** + * stsfdgAt attribute를 리턴한다. + * @return the stsfdgAt + */ + public String getStsfdgAt() { + return stsfdgAt; + } + + /** + * stsfdg attribute 값을 설정한다. + * @param stsfdgAt the stsfdgAt to set + */ + public void setStsfdgAt(String stsfdgAt) { + this.stsfdgAt = stsfdgAt; + } + + /** + * cmmntyId attribute를 리턴한다. + * @return the cmmntyId + */ + public String getCmmntyId() { + return cmmntyId; + } + + /** + * cmmntyId attribute 값을 설정한다. + * @param cmmntyId the cmmntyId to set + */ + public void setCmmntyId(String cmmntyId) { + this.cmmntyId = cmmntyId; + } + + public String getBlogId() { + return blogId; + } + + public void setBlogId(String blogId) { + this.blogId = blogId; + } + + public String getBlogAt() { + return blogAt; + } + + public void setBlogAt(String blogAt) { + this.blogAt = blogAt; + } + + /** + * toString 메소드를 대치한다. + */ + public String toString() { + return ToStringBuilder.reflectionToString(this); + } +} diff --git a/src/main/java/egovframework/com/cop/bbs/service/BoardMasterVO.java b/src/main/java/egovframework/com/cop/bbs/service/BoardMasterVO.java new file mode 100644 index 0000000..d14bf38 --- /dev/null +++ b/src/main/java/egovframework/com/cop/bbs/service/BoardMasterVO.java @@ -0,0 +1,450 @@ +package egovframework.com.cop.bbs.service; + +import java.io.Serializable; + +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * 게시판 속성 정보를 관리하기 위한 VO 클래스 + * @author 공통서비스개발팀 이삼섭 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.3.12  이삼섭          최초 생성
    + *
    + * 
    + */ +@SuppressWarnings("serial") +public class BoardMasterVO extends BoardMaster implements Serializable { + + /** 검색시작일 */ + private String searchBgnDe = ""; + + /** 검색조건 */ + private String searchCnd = ""; + + /** 검색종료일 */ + private String searchEndDe = ""; + + /** 검색단어 */ + private String searchWrd = ""; + + /** 정렬순서(DESC,ASC) */ + private String sortOrdr = ""; + + /** 검색사용여부 */ + private String searchUseYn = ""; + + /** 현재페이지 */ + private int pageIndex = 1; + + /** 페이지갯수 */ + private int pageUnit = 10; + + /** 페이지사이즈 */ + private int pageSize = 10; + + /** firstIndex */ + private int firstIndex = 1; + + /** lastIndex */ + private int lastIndex = 1; + + /** recordCountPerPage */ + private int recordCountPerPage = 10; + + /** rowNo */ + private int rowNo = 0; + + /** 최초 등록자명 */ + private String frstRegisterNm = ""; + + /** 게시판유형 코드명 */ + private String bbsTyCodeNm = ""; + + /** 템플릿 명 */ + private String tmplatNm = ""; + + /** 최종 수정자명 */ + private String lastUpdusrNm = ""; + + /** 권한지정 여부 */ + private String authFlag = ""; + + /** 템플릿경로 */ + private String tmplatCours = ""; + + /** + * searchBgnDe attribute를 리턴한다. + * + * @return the searchBgnDe + */ + public String getSearchBgnDe() { + return searchBgnDe; + } + + /** + * searchBgnDe attribute 값을 설정한다. + * + * @param searchBgnDe + * the searchBgnDe to set + */ + public void setSearchBgnDe(String searchBgnDe) { + this.searchBgnDe = searchBgnDe; + } + + /** + * searchCnd attribute를 리턴한다. + * + * @return the searchCnd + */ + public String getSearchCnd() { + return searchCnd; + } + + /** + * searchCnd attribute 값을 설정한다. + * + * @param searchCnd + * the searchCnd to set + */ + public void setSearchCnd(String searchCnd) { + this.searchCnd = searchCnd; + } + + /** + * searchEndDe attribute를 리턴한다. + * + * @return the searchEndDe + */ + public String getSearchEndDe() { + return searchEndDe; + } + + /** + * searchEndDe attribute 값을 설정한다. + * + * @param searchEndDe + * the searchEndDe to set + */ + public void setSearchEndDe(String searchEndDe) { + this.searchEndDe = searchEndDe; + } + + /** + * searchWrd attribute를 리턴한다. + * + * @return the searchWrd + */ + public String getSearchWrd() { + return searchWrd; + } + + /** + * searchWrd attribute 값을 설정한다. + * + * @param searchWrd + * the searchWrd to set + */ + public void setSearchWrd(String searchWrd) { + this.searchWrd = searchWrd; + } + + /** + * sortOrdr attribute를 리턴한다. + * + * @return the sortOrdr + */ + public String getSortOrdr() { + return sortOrdr; + } + + /** + * sortOrdr attribute 값을 설정한다. + * + * @param sortOrdr + * the sortOrdr to set + */ + public void setSortOrdr(String sortOrdr) { + this.sortOrdr = sortOrdr; + } + + /** + * searchUseYn attribute를 리턴한다. + * + * @return the searchUseYn + */ + public String getSearchUseYn() { + return searchUseYn; + } + + /** + * searchUseYn attribute 값을 설정한다. + * + * @param searchUseYn + * the searchUseYn to set + */ + public void setSearchUseYn(String searchUseYn) { + this.searchUseYn = searchUseYn; + } + + /** + * pageIndex attribute를 리턴한다. + * + * @return the pageIndex + */ + public int getPageIndex() { + return pageIndex; + } + + /** + * pageIndex attribute 값을 설정한다. + * + * @param pageIndex + * the pageIndex to set + */ + public void setPageIndex(int pageIndex) { + this.pageIndex = pageIndex; + } + + /** + * pageUnit attribute를 리턴한다. + * + * @return the pageUnit + */ + public int getPageUnit() { + return pageUnit; + } + + /** + * pageUnit attribute 값을 설정한다. + * + * @param pageUnit + * the pageUnit to set + */ + public void setPageUnit(int pageUnit) { + this.pageUnit = pageUnit; + } + + /** + * pageSize attribute를 리턴한다. + * + * @return the pageSize + */ + public int getPageSize() { + return pageSize; + } + + /** + * pageSize attribute 값을 설정한다. + * + * @param pageSize + * the pageSize to set + */ + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + /** + * firstIndex attribute를 리턴한다. + * + * @return the firstIndex + */ + public int getFirstIndex() { + return firstIndex; + } + + /** + * firstIndex attribute 값을 설정한다. + * + * @param firstIndex + * the firstIndex to set + */ + public void setFirstIndex(int firstIndex) { + this.firstIndex = firstIndex; + } + + /** + * lastIndex attribute를 리턴한다. + * + * @return the lastIndex + */ + public int getLastIndex() { + return lastIndex; + } + + /** + * lastIndex attribute 값을 설정한다. + * + * @param lastIndex + * the lastIndex to set + */ + public void setLastIndex(int lastIndex) { + this.lastIndex = lastIndex; + } + + /** + * recordCountPerPage attribute를 리턴한다. + * + * @return the recordCountPerPage + */ + public int getRecordCountPerPage() { + return recordCountPerPage; + } + + /** + * recordCountPerPage attribute 값을 설정한다. + * + * @param recordCountPerPage + * the recordCountPerPage to set + */ + public void setRecordCountPerPage(int recordCountPerPage) { + this.recordCountPerPage = recordCountPerPage; + } + + /** + * rowNo attribute를 리턴한다. + * + * @return the rowNo + */ + public int getRowNo() { + return rowNo; + } + + /** + * rowNo attribute 값을 설정한다. + * + * @param rowNo + * the rowNo to set + */ + public void setRowNo(int rowNo) { + this.rowNo = rowNo; + } + + /** + * frstRegisterNm attribute를 리턴한다. + * + * @return the frstRegisterNm + */ + public String getFrstRegisterNm() { + return frstRegisterNm; + } + + /** + * frstRegisterNm attribute 값을 설정한다. + * + * @param frstRegisterNm + * the frstRegisterNm to set + */ + public void setFrstRegisterNm(String frstRegisterNm) { + this.frstRegisterNm = frstRegisterNm; + } + + /** + * bbsTyCodeNm attribute를 리턴한다. + * + * @return the bbsTyCodeNm + */ + public String getBbsTyCodeNm() { + return bbsTyCodeNm; + } + + /** + * bbsTyCodeNm attribute 값을 설정한다. + * + * @param bbsTyCodeNm + * the bbsTyCodeNm to set + */ + public void setBbsTyCodeNm(String bbsTyCodeNm) { + this.bbsTyCodeNm = bbsTyCodeNm; + } + + /** + * tmplatNm attribute를 리턴한다. + * + * @return the tmplatNm + */ + public String getTmplatNm() { + return tmplatNm; + } + + /** + * tmplatNm attribute 값을 설정한다. + * + * @param tmplatNm + * the tmplatNm to set + */ + public void setTmplatNm(String tmplatNm) { + this.tmplatNm = tmplatNm; + } + + /** + * lastUpdusrNm attribute를 리턴한다. + * + * @return the lastUpdusrNm + */ + public String getLastUpdusrNm() { + return lastUpdusrNm; + } + + /** + * lastUpdusrNm attribute 값을 설정한다. + * + * @param lastUpdusrNm + * the lastUpdusrNm to set + */ + public void setLastUpdusrNm(String lastUpdusrNm) { + this.lastUpdusrNm = lastUpdusrNm; + } + + /** + * authFlag attribute를 리턴한다. + * + * @return the authFlag + */ + public String getAuthFlag() { + return authFlag; + } + + /** + * authFlag attribute 값을 설정한다. + * + * @param authFlag + * the authFlag to set + */ + public void setAuthFlag(String authFlag) { + this.authFlag = authFlag; + } + + /** + * tmplatCours attribute를 리턴한다. + * + * @return the tmplatCours + */ + public String getTmplatCours() { + return tmplatCours; + } + + /** + * tmplatCours attribute 값을 설정한다. + * + * @param tmplatCours + * the tmplatCours to set + */ + public void setTmplatCours(String tmplatCours) { + this.tmplatCours = tmplatCours; + } + + /** + * toString 메소드를 대치한다. + */ + public String toString() { + return ToStringBuilder.reflectionToString(this); + } +} diff --git a/src/main/java/egovframework/com/cop/bbs/service/BoardVO.java b/src/main/java/egovframework/com/cop/bbs/service/BoardVO.java new file mode 100644 index 0000000..9bcb519 --- /dev/null +++ b/src/main/java/egovframework/com/cop/bbs/service/BoardVO.java @@ -0,0 +1,675 @@ +package egovframework.com.cop.bbs.service; + +import java.io.Serializable; + +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * 게시물 관리를 위한 VO 클래스 + * @author 공통서비스개발팀 이삼섭 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------      --------    ---------------------------
    + *   2009.3.19  이삼섭          최초 생성
    + *   2009.06.29  한성곤		2단계 기능 추가 (댓글관리, 만족도조사)
    + *
    + * 
    + */ +@SuppressWarnings("serial") +public class BoardVO extends Board implements Serializable { + + /** 검색시작일 */ + private String searchBgnDe = ""; + + /** 검색조건 */ + private String searchCnd = ""; + + /** 검색종료일 */ + private String searchEndDe = ""; + + /** 검색단어 */ + private String searchWrd = ""; + + /** 정렬순서(DESC,ASC) */ + private long sortOrdr = 0L; + + /** 검색사용여부 */ + private String searchUseYn = ""; + + /** 현재페이지 */ + private int pageIndex = 1; + + /** 페이지갯수 */ + private int pageUnit = 10; + + /** 페이지사이즈 */ + private int pageSize = 10; + + /** 첫페이지 인덱스 */ + private int firstIndex = 1; + + /** 마지막페이지 인덱스 */ + private int lastIndex = 1; + + /** 페이지당 레코드 개수 */ + private int recordCountPerPage = 10; + + /** 레코드 번호 */ + private int rowNo = 0; + + /** 최초 등록자명 */ + private String frstRegisterNm = ""; + + /** 최종 수정자명 */ + private String lastUpdusrNm = ""; + + /** 유효여부 */ + private String isExpired = "N"; + + /** 상위 정렬 순서 */ + private String parntsSortOrdr = ""; + + /** 상위 답변 위치 */ + private String parntsReplyLc = ""; + + /** 게시판 유형코드 */ + private String bbsTyCode = ""; + + /** 게시판 속성코드 */ + private String bbsAttrbCode = ""; + + /** 게시판 명 */ + private String bbsNm = ""; + + /** 파일첨부가능여부 */ + private String fileAtchPosblAt = ""; + + /** 첨부가능파일숫자 */ + private int posblAtchFileNumber = 0; + + /** 답장가능여부 */ + private String replyPosblAt = ""; + + /** 조회 수 증가 여부 */ + private boolean plusCount = false; + + /** 익명등록 여부 */ + private String anonymousAt = ""; + + /** 하위 페이지 인덱스 (댓글 및 만족도 조사 여부 확인용) */ + private String subPageIndex = ""; + + /** 게시글 댓글갯수 */ + private String commentCo = ""; + + /** 볼드체 여부 */ + private String sjBoldAt; + + /** 공지 여부 */ + private String noticeAt; + + /** 비밀글 여부 */ + private String secretAt; + + /** + * searchBgnDe attribute를 리턴한다. + * + * @return the searchBgnDe + */ + public String getSearchBgnDe() { + return searchBgnDe; + } + + /** + * searchBgnDe attribute 값을 설정한다. + * + * @param searchBgnDe + * the searchBgnDe to set + */ + public void setSearchBgnDe(String searchBgnDe) { + this.searchBgnDe = searchBgnDe; + } + + /** + * searchCnd attribute를 리턴한다. + * + * @return the searchCnd + */ + public String getSearchCnd() { + return searchCnd; + } + + /** + * searchCnd attribute 값을 설정한다. + * + * @param searchCnd + * the searchCnd to set + */ + public void setSearchCnd(String searchCnd) { + this.searchCnd = searchCnd; + } + + /** + * searchEndDe attribute를 리턴한다. + * + * @return the searchEndDe + */ + public String getSearchEndDe() { + return searchEndDe; + } + + /** + * searchEndDe attribute 값을 설정한다. + * + * @param searchEndDe + * the searchEndDe to set + */ + public void setSearchEndDe(String searchEndDe) { + this.searchEndDe = searchEndDe; + } + + /** + * searchWrd attribute를 리턴한다. + * + * @return the searchWrd + */ + public String getSearchWrd() { + return searchWrd; + } + + /** + * searchWrd attribute 값을 설정한다. + * + * @param searchWrd + * the searchWrd to set + */ + public void setSearchWrd(String searchWrd) { + this.searchWrd = searchWrd; + } + + /** + * sortOrdr attribute를 리턴한다. + * + * @return the sortOrdr + */ + public long getSortOrdr() { + return sortOrdr; + } + + /** + * sortOrdr attribute 값을 설정한다. + * + * @param sortOrdr + * the sortOrdr to set + */ + public void setSortOrdr(long sortOrdr) { + this.sortOrdr = sortOrdr; + } + + /** + * searchUseYn attribute를 리턴한다. + * + * @return the searchUseYn + */ + public String getSearchUseYn() { + return searchUseYn; + } + + /** + * searchUseYn attribute 값을 설정한다. + * + * @param searchUseYn + * the searchUseYn to set + */ + public void setSearchUseYn(String searchUseYn) { + this.searchUseYn = searchUseYn; + } + + /** + * pageIndex attribute를 리턴한다. + * + * @return the pageIndex + */ + public int getPageIndex() { + return pageIndex; + } + + /** + * pageIndex attribute 값을 설정한다. + * + * @param pageIndex + * the pageIndex to set + */ + public void setPageIndex(int pageIndex) { + this.pageIndex = pageIndex; + } + + /** + * pageUnit attribute를 리턴한다. + * + * @return the pageUnit + */ + public int getPageUnit() { + return pageUnit; + } + + /** + * pageUnit attribute 값을 설정한다. + * + * @param pageUnit + * the pageUnit to set + */ + public void setPageUnit(int pageUnit) { + this.pageUnit = pageUnit; + } + + /** + * pageSize attribute를 리턴한다. + * + * @return the pageSize + */ + public int getPageSize() { + return pageSize; + } + + /** + * pageSize attribute 값을 설정한다. + * + * @param pageSize + * the pageSize to set + */ + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + /** + * firstIndex attribute를 리턴한다. + * + * @return the firstIndex + */ + public int getFirstIndex() { + return firstIndex; + } + + /** + * firstIndex attribute 값을 설정한다. + * + * @param firstIndex + * the firstIndex to set + */ + public void setFirstIndex(int firstIndex) { + this.firstIndex = firstIndex; + } + + /** + * lastIndex attribute를 리턴한다. + * + * @return the lastIndex + */ + public int getLastIndex() { + return lastIndex; + } + + /** + * lastIndex attribute 값을 설정한다. + * + * @param lastIndex + * the lastIndex to set + */ + public void setLastIndex(int lastIndex) { + this.lastIndex = lastIndex; + } + + /** + * recordCountPerPage attribute를 리턴한다. + * + * @return the recordCountPerPage + */ + public int getRecordCountPerPage() { + return recordCountPerPage; + } + + /** + * recordCountPerPage attribute 값을 설정한다. + * + * @param recordCountPerPage + * the recordCountPerPage to set + */ + public void setRecordCountPerPage(int recordCountPerPage) { + this.recordCountPerPage = recordCountPerPage; + } + + /** + * rowNo attribute를 리턴한다. + * + * @return the rowNo + */ + public int getRowNo() { + return rowNo; + } + + /** + * rowNo attribute 값을 설정한다. + * + * @param rowNo + * the rowNo to set + */ + public void setRowNo(int rowNo) { + this.rowNo = rowNo; + } + + /** + * frstRegisterNm attribute를 리턴한다. + * + * @return the frstRegisterNm + */ + public String getFrstRegisterNm() { + return frstRegisterNm; + } + + /** + * frstRegisterNm attribute 값을 설정한다. + * + * @param frstRegisterNm + * the frstRegisterNm to set + */ + public void setFrstRegisterNm(String frstRegisterNm) { + this.frstRegisterNm = frstRegisterNm; + } + + /** + * lastUpdusrNm attribute를 리턴한다. + * + * @return the lastUpdusrNm + */ + public String getLastUpdusrNm() { + return lastUpdusrNm; + } + + /** + * lastUpdusrNm attribute 값을 설정한다. + * + * @param lastUpdusrNm + * the lastUpdusrNm to set + */ + public void setLastUpdusrNm(String lastUpdusrNm) { + this.lastUpdusrNm = lastUpdusrNm; + } + + /** + * isExpired attribute를 리턴한다. + * + * @return the isExpired + */ + public String getIsExpired() { + return isExpired; + } + + /** + * isExpired attribute 값을 설정한다. + * + * @param isExpired + * the isExpired to set + */ + public void setIsExpired(String isExpired) { + this.isExpired = isExpired; + } + + /** + * parntsSortOrdr attribute를 리턴한다. + * + * @return the parntsSortOrdr + */ + public String getParntsSortOrdr() { + return parntsSortOrdr; + } + + /** + * parntsSortOrdr attribute 값을 설정한다. + * + * @param parntsSortOrdr + * the parntsSortOrdr to set + */ + public void setParntsSortOrdr(String parntsSortOrdr) { + this.parntsSortOrdr = parntsSortOrdr; + } + + /** + * parntsReplyLc attribute를 리턴한다. + * + * @return the parntsReplyLc + */ + public String getParntsReplyLc() { + return parntsReplyLc; + } + + /** + * parntsReplyLc attribute 값을 설정한다. + * + * @param parntsReplyLc + * the parntsReplyLc to set + */ + public void setParntsReplyLc(String parntsReplyLc) { + this.parntsReplyLc = parntsReplyLc; + } + + /** + * bbsTyCode attribute를 리턴한다. + * + * @return the bbsTyCode + */ + public String getBbsTyCode() { + return bbsTyCode; + } + + /** + * bbsTyCode attribute 값을 설정한다. + * + * @param bbsTyCode + * the bbsTyCode to set + */ + public void setBbsTyCode(String bbsTyCode) { + this.bbsTyCode = bbsTyCode; + } + + /** + * bbsAttrbCode attribute를 리턴한다. + * + * @return the bbsAttrbCode + */ + public String getBbsAttrbCode() { + return bbsAttrbCode; + } + + /** + * bbsAttrbCode attribute 값을 설정한다. + * + * @param bbsAttrbCode + * the bbsAttrbCode to set + */ + public void setBbsAttrbCode(String bbsAttrbCode) { + this.bbsAttrbCode = bbsAttrbCode; + } + + /** + * bbsNm attribute를 리턴한다. + * + * @return the bbsNm + */ + public String getBbsNm() { + return bbsNm; + } + + /** + * bbsNm attribute 값을 설정한다. + * + * @param bbsNm + * the bbsNm to set + */ + public void setBbsNm(String bbsNm) { + this.bbsNm = bbsNm; + } + + /** + * fileAtchPosblAt attribute를 리턴한다. + * + * @return the fileAtchPosblAt + */ + public String getFileAtchPosblAt() { + return fileAtchPosblAt; + } + + /** + * fileAtchPosblAt attribute 값을 설정한다. + * + * @param fileAtchPosblAt + * the fileAtchPosblAt to set + */ + public void setFileAtchPosblAt(String fileAtchPosblAt) { + this.fileAtchPosblAt = fileAtchPosblAt; + } + + /** + * posblAtchFileNumber attribute를 리턴한다. + * + * @return the posblAtchFileNumber + */ + public int getPosblAtchFileNumber() { + return posblAtchFileNumber; + } + + /** + * posblAtchFileNumber attribute 값을 설정한다. + * + * @param posblAtchFileNumber + * the posblAtchFileNumber to set + */ + public void setPosblAtchFileNumber(int posblAtchFileNumber) { + this.posblAtchFileNumber = posblAtchFileNumber; + } + + /** + * replyPosblAt attribute를 리턴한다. + * + * @return the replyPosblAt + */ + public String getReplyPosblAt() { + return replyPosblAt; + } + + /** + * replyPosblAt attribute 값을 설정한다. + * + * @param replyPosblAt + * the replyPosblAt to set + */ + public void setReplyPosblAt(String replyPosblAt) { + this.replyPosblAt = replyPosblAt; + } + + /** + * plusCount attribute를 리턴한다. + * @return the plusCount + */ + public boolean isPlusCount() { + return plusCount; + } + + /** + * plusCount attribute 값을 설정한다. + * @param plusCount the plusCount to set + */ + public void setPlusCount(boolean plusCount) { + this.plusCount = plusCount; + } + + /** + * subPageIndex attribute를 리턴한다. + * @return the subPageIndex + */ + public String getSubPageIndex() { + return subPageIndex; + } + + /** + * subPageIndex attribute 값을 설정한다. + * @param subPageIndex the subPageIndex to set + */ + public void setSubPageIndex(String subPageIndex) { + this.subPageIndex = subPageIndex; + } + + /** + * anonymousAt attribute를 리턴한다. + * @return the anonymousAt + */ + public String getAnonymousAt() { + return anonymousAt; + } + + /** + * anonymousAt attribute 값을 설정한다. + * @param anonymousAt the anonymousAt to set + */ + public void setAnonymousAt(String anonymousAt) { + this.anonymousAt = anonymousAt; + } + + /** + * toString 메소드를 대치한다. + */ + public String toString() { + return ToStringBuilder.reflectionToString(this); + } + + /** + * commentCo attribute를 리턴한다. + * @return the commentCo + */ + public String getCommentCo() { + return commentCo; + } + + + /** + * commentCo attribute 값을 설정한다. + * @param commentCo the commentCo to set + */ + + public void setCommentCo(String commentCo) { + this.commentCo = commentCo; + } + + public String getSjBoldAt() { + return sjBoldAt; + } + + public void setSjBoldAt(String sjBoldAt) { + this.sjBoldAt = sjBoldAt; + } + + public String getNoticeAt() { + return noticeAt; + } + + public void setNoticeAt(String noticeAt) { + this.noticeAt = noticeAt; + } + + public String getSecretAt() { + return secretAt; + } + + public void setSecretAt(String secretAt) { + this.secretAt = secretAt; + } + + + +} diff --git a/src/main/java/egovframework/com/cop/bbs/service/EgovArticleService.java b/src/main/java/egovframework/com/cop/bbs/service/EgovArticleService.java new file mode 100644 index 0000000..d5b9dea --- /dev/null +++ b/src/main/java/egovframework/com/cop/bbs/service/EgovArticleService.java @@ -0,0 +1,40 @@ +package egovframework.com.cop.bbs.service; + +import java.util.List; +import java.util.Map; + +import org.egovframe.rte.fdl.cmmn.exception.FdlException; + +public interface EgovArticleService { + + Map selectArticleList(BoardVO boardVO); + + BoardVO selectArticleDetail(BoardVO boardVO); + + void insertArticle(Board board) throws FdlException; + + void updateArticle(Board board); + + void deleteArticle(Board board) throws Exception; + + List selectNoticeArticleList(BoardVO boardVO); + + Map selectGuestArticleList(BoardVO vo); + + /* + * 블로그 관련 + */ + BoardVO selectArticleCnOne(BoardVO boardVO); + + List selectBlogNmList(BoardVO boardVO); + + Map selectBlogListManager(BoardVO boardVO); + + List selectArticleDetailDefault(BoardVO boardVO); + + int selectArticleDetailDefaultCnt(BoardVO boardVO); + + List selectArticleDetailCn(BoardVO boardVO); + + int selectLoginUser(BoardVO boardVO); +} diff --git a/src/main/java/egovframework/com/cop/bbs/service/EgovBBSMasterService.java b/src/main/java/egovframework/com/cop/bbs/service/EgovBBSMasterService.java new file mode 100644 index 0000000..4e39612 --- /dev/null +++ b/src/main/java/egovframework/com/cop/bbs/service/EgovBBSMasterService.java @@ -0,0 +1,44 @@ +package egovframework.com.cop.bbs.service; + +import java.util.List; +import java.util.Map; + +import egovframework.com.cop.bbs.service.BlogUser; +import egovframework.com.cop.bbs.service.BlogVO; +import egovframework.com.cop.bbs.service.Blog; +import org.egovframe.rte.fdl.cmmn.exception.FdlException; + +public interface EgovBBSMasterService { + + Map selectNotUsedBdMstrList(BoardMasterVO boardMasterVO); + + void deleteBBSMasterInf(BoardMaster boardMaster); + + void updateBBSMasterInf(BoardMaster boardMaster) throws Exception; + + BoardMasterVO selectBBSMasterInf(BoardMasterVO boardMasterVO) throws Exception; + + Map selectBBSMasterInfs(BoardMasterVO boardMasterVO); + + void insertBBSMasterInf(BoardMaster boardMaster) throws Exception; + + /* + * 블로그 관련 + */ + Map selectBlogMasterInfs(BoardMasterVO boardMasterVO); + + String checkBlogUser(BlogVO blogVO); + + BlogVO checkBlogUser2(BlogVO blogVO); + + void insertBoardBlogUserRqst(BlogUser blogUser); + + void insertBlogMaster(Blog blog) throws FdlException; + + BlogVO selectBlogDetail(BlogVO blogVO) throws Exception; + + List selectBlogListPortlet(BlogVO blogVO) throws Exception; + + List selectBBSListPortlet(BoardMasterVO boardMasterVO) throws Exception; + +} diff --git a/src/main/java/egovframework/com/cop/bbs/service/EgovBBSSatisfactionService.java b/src/main/java/egovframework/com/cop/bbs/service/EgovBBSSatisfactionService.java new file mode 100644 index 0000000..dbbb3fa --- /dev/null +++ b/src/main/java/egovframework/com/cop/bbs/service/EgovBBSSatisfactionService.java @@ -0,0 +1,81 @@ +package egovframework.com.cop.bbs.service; + +import java.util.Map; + +/** + * 만족도조사를 위한 서비스 인터페이스 클래스 + * @author 공통컴포넌트개발팀 한성곤 + * @since 2009.06.29 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.06.29  한성곤          최초 생성
    + *
    + * 
    + */ +public interface EgovBBSSatisfactionService { + /** + * 만족도조사 사용 가능 여부를 확인한다. + * + * @param bbsId + * @return + * @throws Exception + */ + public boolean canUseSatisfaction(String bbsId) throws Exception; + + /** + * 만족도조사에 대한 목록을 조회 한다. + * + * @param satisfactionVO + * @return + * @throws Exception + */ + public Map selectSatisfactionList(SatisfactionVO satisfactionVO) throws Exception; + + /** + * 만족도조사를 등록한다. + * + * @param satisfaction + * @throws Exception + */ + public void insertSatisfaction(Satisfaction satisfaction) throws Exception; + + /** + * 만족도조사를 삭제한다. + * + * @param satisfactionVO + * @throws Exception + */ + public void deleteSatisfaction(SatisfactionVO satisfactionVO) throws Exception; + + /** + * 만족도조사에 대한 내용을 조회한다. + * + * @param satisfactionVO + * @return + * @throws Exception + */ + public Satisfaction selectSatisfaction(SatisfactionVO satisfactionVO) throws Exception; + + /** + * 만족도조사에 대한 내용을 수정한다. + * + * @param satisfaction + * @throws Exception + */ + public void updateSatisfaction(Satisfaction satisfaction) throws Exception; + + /** + * 만족도조사 패스워드를 가져온다. + * + * @param satisfaction + * @return + * @throws Exception + */ + public String getSatisfactionPassword(Satisfaction satisfaction) throws Exception; +} diff --git a/src/main/java/egovframework/com/cop/bbs/service/Satisfaction.java b/src/main/java/egovframework/com/cop/bbs/service/Satisfaction.java new file mode 100644 index 0000000..fa5d7f4 --- /dev/null +++ b/src/main/java/egovframework/com/cop/bbs/service/Satisfaction.java @@ -0,0 +1,316 @@ +package egovframework.com.cop.bbs.service; + +import java.io.Serializable; + +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * 만족도조사 서비스 데이터 처리 모델 + * @author 공통컴포넌트개발팀 한성곤 + * @since 2009.06.29 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.06.29  한성곤          최초 생성
    + *
    + * 
    + */ +@SuppressWarnings("serial") +public class Satisfaction implements Serializable { + /** 만족도 번호 */ + private String stsfdgNo = ""; + + /** 게시판 ID */ + private String bbsId = ""; + + /** 게시물 번호 */ + private long nttId = 0L; + + /** 작성자 ID */ + private String wrterId = ""; + + /** 작성자명 */ + private String wrterNm = ""; + + /** 패스워드 */ + private String stsfdgPassword = ""; + + /** 만족도 내용 */ + private String stsfdgCn = ""; + + /** 만족도 */ + private int stsfdg = 0; + + /** 사용 여부 */ + private String useAt = ""; + + /** 최초등록자 아이디 */ + private String frstRegisterId = ""; + + /** 최초 등록자명 */ + private String frstRegisterNm = ""; + + /** 최초등록시점 */ + private String frstRegisterPnttm = ""; + + /** 최종수정자 아이디 */ + private String lastUpdusrId = ""; + + /** 최종수정시점 */ + private String lastUpdusrPnttm = ""; + + /** 확인 패스워드 */ + private String confirmPassword = ""; + + /** + * stsfdgNo attribute를 리턴한다. + * @return the stsfdgNo + */ + public String getStsfdgNo() { + return stsfdgNo; + } + + /** + * stsfdgNo attribute 값을 설정한다. + * @param stsfdgNo the stsfdgNo to set + */ + public void setStsfdgNo(String stsfdgNo) { + this.stsfdgNo = stsfdgNo; + } + + /** + * bbsId attribute를 리턴한다. + * @return the bbsId + */ + public String getBbsId() { + return bbsId; + } + + /** + * bbsId attribute 값을 설정한다. + * @param bbsId the bbsId to set + */ + public void setBbsId(String bbsId) { + this.bbsId = bbsId; + } + + /** + * nttId attribute를 리턴한다. + * @return the nttId + */ + public long getNttId() { + return nttId; + } + + /** + * nttId attribute 값을 설정한다. + * @param nttId the nttId to set + */ + public void setNttId(long nttId) { + this.nttId = nttId; + } + + /** + * wrterId attribute를 리턴한다. + * @return the wrterId + */ + public String getWrterId() { + return wrterId; + } + + /** + * wrterId attribute 값을 설정한다. + * @param wrterId the wrterId to set + */ + public void setWrterId(String wrterId) { + this.wrterId = wrterId; + } + + /** + * wrterNm attribute를 리턴한다. + * @return the wrterNm + */ + public String getWrterNm() { + return wrterNm; + } + + /** + * wrterNm attribute 값을 설정한다. + * @param wrterNm the wrterNm to set + */ + public void setWrterNm(String wrterNm) { + this.wrterNm = wrterNm; + } + + /** + * stsfdgPassword attribute를 리턴한다. + * @return the stsfdgPassword + */ + public String getStsfdgPassword() { + return stsfdgPassword; + } + + /** + * stsfdgPassword attribute 값을 설정한다. + * @param stsfdgPassword the stsfdgPassword to set + */ + public void setStsfdgPassword(String stsfdgPassword) { + this.stsfdgPassword = stsfdgPassword; + } + + /** + * stsfdgCn attribute를 리턴한다. + * @return the stsfdgCn + */ + public String getStsfdgCn() { + return stsfdgCn; + } + + /** + * stsfdgCn attribute 값을 설정한다. + * @param stsfdgCn the stsfdgCn to set + */ + public void setStsfdgCn(String stsfdgCn) { + this.stsfdgCn = stsfdgCn; + } + + /** + * stsfdg attribute를 리턴한다. + * @return the stsfdg + */ + public int getStsfdg() { + return stsfdg; + } + + /** + * stsfdg attribute 값을 설정한다. + * @param stsfdg the stsfdg to set + */ + public void setStsfdg(int stsfdg) { + this.stsfdg = stsfdg; + } + + /** + * useAt attribute를 리턴한다. + * @return the useAt + */ + public String getUseAt() { + return useAt; + } + + /** + * useAt attribute 값을 설정한다. + * @param useAt the useAt to set + */ + public void setUseAt(String useAt) { + this.useAt = useAt; + } + + /** + * frstRegisterId attribute를 리턴한다. + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * frstRegisterId attribute 값을 설정한다. + * @param frstRegisterId the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * frstRegisterNm attribute를 리턴한다. + * @return the frstRegisterNm + */ + public String getFrstRegisterNm() { + return frstRegisterNm; + } + + /** + * frstRegisterNm attribute 값을 설정한다. + * @param frstRegisterNm the frstRegisterNm to set + */ + public void setFrstRegisterNm(String frstRegisterNm) { + this.frstRegisterNm = frstRegisterNm; + } + + /** + * frstRegisterPnttm attribute를 리턴한다. + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * frstRegisterPnttm attribute 값을 설정한다. + * @param frstRegisterPnttm the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * lastUpdusrId attribute를 리턴한다. + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * lastUpdusrId attribute 값을 설정한다. + * @param lastUpdusrId the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + /** + * lastUpdusrPnttm attribute를 리턴한다. + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * lastUpdusrPnttm attribute 값을 설정한다. + * @param lastUpdusrPnttm the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * confirmPassword attribute를 리턴한다. + * @return the confirmPassword + */ + public String getConfirmPassword() { + return confirmPassword; + } + + /** + * confirmPassword attribute 값을 설정한다. + * @param confirmPassword the confirmPassword to set + */ + public void setConfirmPassword(String confirmPassword) { + this.confirmPassword = confirmPassword; + } + + /** + * toString 메소드를 대치한다. + */ + public String toString() { + return ToStringBuilder.reflectionToString(this); + } +} diff --git a/src/main/java/egovframework/com/cop/bbs/service/SatisfactionVO.java b/src/main/java/egovframework/com/cop/bbs/service/SatisfactionVO.java new file mode 100644 index 0000000..63eafc2 --- /dev/null +++ b/src/main/java/egovframework/com/cop/bbs/service/SatisfactionVO.java @@ -0,0 +1,219 @@ +package egovframework.com.cop.bbs.service; + +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * 만족도조사 서비스를 위한 VO 클래스 + * @author 공통컴포넌트개발팀 한성곤 + * @since 2009.06.29 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.06.29  한성곤          최초 생성
    + *
    + * 
    + */ +@SuppressWarnings("serial") +public class SatisfactionVO extends Satisfaction { + /** 정렬순서(DESC,ASC) */ + private long sortOrdr = 0L; + + /** 현재페이지 */ + private int subPageIndex = 1; + + /** 페이지갯수 */ + private int subPageUnit = 10; + + /** 페이지사이즈 */ + private int subPageSize = 10; + + /** 첫페이지 인덱스 */ + private int subFirstIndex = 1; + + /** 마지막페이지 인덱스 */ + private int subLastIndex = 1; + + /** 페이지당 레코드 개수 */ + private int subRecordCountPerPage = 10; + + /** 레코드 번호 */ + private int subRowNo = 0; + + /** 호출 TYPE (head or body)*/ + private String type = ""; + + /** 수정 처리 여부 */ + private boolean isModified = false; + + /** + * sortOrdr attribute를 리턴한다. + * @return the sortOrdr + */ + public long getSortOrdr() { + return sortOrdr; + } + + /** + * sortOrdr attribute 값을 설정한다. + * @param sortOrdr the sortOrdr to set + */ + public void setSortOrdr(long sortOrdr) { + this.sortOrdr = sortOrdr; + } + + /** + * subPageIndex attribute를 리턴한다. + * @return the subPageIndex + */ + public int getSubPageIndex() { + return subPageIndex; + } + + /** + * subPageIndex attribute 값을 설정한다. + * @param subPageIndex the subPageIndex to set + */ + public void setSubPageIndex(int subPageIndex) { + this.subPageIndex = subPageIndex; + } + + /** + * subPageUnit attribute를 리턴한다. + * @return the subPageUnit + */ + public int getSubPageUnit() { + return subPageUnit; + } + + /** + * subPageUnit attribute 값을 설정한다. + * @param subPageUnit the subPageUnit to set + */ + public void setSubPageUnit(int subPageUnit) { + this.subPageUnit = subPageUnit; + } + + /** + * subPageSize attribute를 리턴한다. + * @return the subPageSize + */ + public int getSubPageSize() { + return subPageSize; + } + + /** + * subPageSize attribute 값을 설정한다. + * @param subPageSize the subPageSize to set + */ + public void setSubPageSize(int subPageSize) { + this.subPageSize = subPageSize; + } + + /** + * subFirstIndex attribute를 리턴한다. + * @return the subFirstIndex + */ + public int getSubFirstIndex() { + return subFirstIndex; + } + + /** + * subFirstIndex attribute 값을 설정한다. + * @param subFirstIndex the subFirstIndex to set + */ + public void setSubFirstIndex(int subFirstIndex) { + this.subFirstIndex = subFirstIndex; + } + + /** + * subLastIndex attribute를 리턴한다. + * @return the subLastIndex + */ + public int getSubLastIndex() { + return subLastIndex; + } + + /** + * subLastIndex attribute 값을 설정한다. + * @param subLastIndex the subLastIndex to set + */ + public void setSubLastIndex(int subLastIndex) { + this.subLastIndex = subLastIndex; + } + + /** + * subRecordCountPerPage attribute를 리턴한다. + * @return the subRecordCountPerPage + */ + public int getSubRecordCountPerPage() { + return subRecordCountPerPage; + } + + /** + * subRecordCountPerPage attribute 값을 설정한다. + * @param subRecordCountPerPage the subRecordCountPerPage to set + */ + public void setSubRecordCountPerPage(int subRecordCountPerPage) { + this.subRecordCountPerPage = subRecordCountPerPage; + } + + /** + * subRowNo attribute를 리턴한다. + * @return the subRowNo + */ + public int getSubRowNo() { + return subRowNo; + } + + /** + * subRowNo attribute 값을 설정한다. + * @param subRowNo the subRowNo to set + */ + public void setSubRowNo(int subRowNo) { + this.subRowNo = subRowNo; + } + + /** + * type attribute를 리턴한다. + * @return the type + */ + public String getType() { + return type; + } + + /** + * type attribute 값을 설정한다. + * @param type the type to set + */ + public void setType(String type) { + this.type = type; + } + + /** + * isModified attribute를 리턴한다. + * @return the isModified + */ + public boolean isModified() { + return isModified; + } + + /** + * isModified attribute 값을 설정한다. + * @param isModified the isModified to set + */ + public void setModified(boolean isModified) { + this.isModified = isModified; + } + + /** + * toString 메소드를 대치한다. + */ + public String toString() { + return ToStringBuilder.reflectionToString(this); + } +} diff --git a/src/main/java/egovframework/com/cop/bbs/service/impl/BBSAddedOptionsDAO.java b/src/main/java/egovframework/com/cop/bbs/service/impl/BBSAddedOptionsDAO.java new file mode 100644 index 0000000..8be3b71 --- /dev/null +++ b/src/main/java/egovframework/com/cop/bbs/service/impl/BBSAddedOptionsDAO.java @@ -0,0 +1,54 @@ +package egovframework.com.cop.bbs.service.impl; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.cop.bbs.service.BoardMaster; +import egovframework.com.cop.bbs.service.BoardMasterVO; + +import org.springframework.stereotype.Repository; + +/** + * 2단계 기능 추가 (댓글관리, 만족도조사) 관리를 위한 데이터 접근 클래스 + * @author 공통컴포넌트개발팀 한성곤 + * @since 2009.06.26 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.06.26  한성곤          최초 생성
    + *
    + * 
    + */ +@Repository("BBSAddedOptionsDAO") +public class BBSAddedOptionsDAO extends EgovComAbstractDAO { + + /** + * 신규 게시판 추가기능 정보를 등록한다. + * + * @param BoardMaster + */ + public String insertAddedOptionsInf(BoardMaster boardMaster) throws Exception { + return Integer.toString(insert("BBSAddedOptions.insertAddedOptionsInf", boardMaster)); + } + + /** + * 게시판 추가기능 정보 한 건을 상세조회 한다. + * + * @param BoardMasterVO + */ + public BoardMasterVO selectAddedOptionsInf(BoardMaster vo) throws Exception { + return (BoardMasterVO)selectOne("BBSAddedOptions.selectAddedOptionsInf", vo); + } + + /** + * 게시판 추가기능 정보를 수정한다. + * + * @param BoardMaster + */ + public void updateAddedOptionsInf(BoardMaster boardMaster) throws Exception { + update("BBSAddedOptions.updateAddedOptionsInf", boardMaster); + } +} diff --git a/src/main/java/egovframework/com/cop/bbs/service/impl/EgovArticleDAO.java b/src/main/java/egovframework/com/cop/bbs/service/impl/EgovArticleDAO.java new file mode 100644 index 0000000..35db476 --- /dev/null +++ b/src/main/java/egovframework/com/cop/bbs/service/impl/EgovArticleDAO.java @@ -0,0 +1,100 @@ +package egovframework.com.cop.bbs.service.impl; + +import java.util.List; + +import org.springframework.stereotype.Repository; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.cop.bbs.service.Board; +import egovframework.com.cop.bbs.service.BoardMasterVO; +import egovframework.com.cop.bbs.service.BoardVO; + +@Repository("EgovArticleDAO") +public class EgovArticleDAO extends EgovComAbstractDAO { + + public List selectArticleList(BoardVO boardVO) { + return list("BBSArticle.selectArticleList", boardVO); + } + + public int selectArticleListCnt(BoardVO boardVO) { + return (Integer)selectOne("BBSArticle.selectArticleListCnt", boardVO); + } + + public int selectMaxInqireCo(BoardVO boardVO) { + return (Integer)selectOne("BBSArticle.selectMaxInqireCo", boardVO); + } + + public void updateInqireCo(BoardVO boardVO) { + update("BBSArticle.updateInqireCo", boardVO); + } + + public BoardVO selectArticleDetail(BoardVO boardVO) { + return (BoardVO) selectOne("BBSArticle.selectArticleDetail", boardVO); + } + + public void replyArticle(Board board) { + insert("BBSArticle.replyArticle", board); + } + + public void insertArticle(Board board) { + insert("BBSArticle.insertArticle", board); + } + + public void updateArticle(Board board) { + update("BBSArticle.updateArticle", board); + } + + public void deleteArticle(Board board) { + update("BBSArticle.deleteArticle", board); + + } + + public List selectNoticeArticleList(BoardVO boardVO) { + return (List) list("BBSArticle.selectNoticeArticleList", boardVO); + } + + public List selectGuestArticleList(BoardVO vo) { + return list("BBSArticle.selectGuestArticleList", vo); + } + + public int selectGuestArticleListCnt(BoardVO vo) { + return (Integer)selectOne("BBSArticle.selectGuestArticleListCnt", vo); + } + + /* + * 블로그 관련 + */ + public BoardVO selectArticleCnOne(BoardVO boardVO) { + return (BoardVO) selectOne("BBSArticle.selectArticleCnOne", boardVO); + } + + public List selectBlogNmList(BoardVO boardVO) { + return (List) list("BBSArticle.selectBlogNmList", boardVO); + } + + public List selectBlogListManager(BoardVO vo) { + return list("BBSArticle.selectBlogListManager", vo); + } + + public int selectBlogListManagerCnt(BoardVO vo) { + return (Integer)selectOne("BBSArticle.selectBlogListManagerCnt", vo); + } + + public List selectArticleDetailDefault(BoardVO boardVO) { + return (List) list("BBSArticle.selectArticleDetailDefault", boardVO); + } + + public int selectArticleDetailDefaultCnt(BoardVO boardVO) { + return (Integer)selectOne("BBSArticle.selectArticleDetailDefaultCnt", boardVO); + } + + public List selectArticleDetailCn(BoardVO boardVO) { + return (List) list("BBSArticle.selectArticleDetailCn", boardVO); + } + + public int selectLoginUser(BoardVO boardVO) { + return (Integer)selectOne("BBSArticle.selectLoginUser", boardVO); + } + + +} diff --git a/src/main/java/egovframework/com/cop/bbs/service/impl/EgovArticleServiceImpl.java b/src/main/java/egovframework/com/cop/bbs/service/impl/EgovArticleServiceImpl.java new file mode 100644 index 0000000..50bda59 --- /dev/null +++ b/src/main/java/egovframework/com/cop/bbs/service/impl/EgovArticleServiceImpl.java @@ -0,0 +1,166 @@ +package egovframework.com.cop.bbs.service.impl; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import egovframework.com.cmm.service.EgovFileMngService; +import egovframework.com.cmm.service.FileVO; +import egovframework.com.cop.bbs.service.Board; +import egovframework.com.cop.bbs.service.BoardVO; +import egovframework.com.cop.bbs.service.EgovArticleService; +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.cmmn.exception.FdlException; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; +import org.egovframe.rte.fdl.property.EgovPropertyService; + +@Service("EgovArticleService") +public class EgovArticleServiceImpl extends EgovAbstractServiceImpl implements EgovArticleService { + + @Resource(name = "EgovArticleDAO") + private EgovArticleDAO egovArticleDao; + + @Resource(name = "EgovFileMngService") + private EgovFileMngService fileService; + + @Resource(name = "propertiesService") + protected EgovPropertyService propertyService; + + @Resource(name = "egovNttIdGnrService") + private EgovIdGnrService nttIdgenService; + + @Override + public Map selectArticleList(BoardVO boardVO) { + List list = egovArticleDao.selectArticleList(boardVO); + + + int cnt = egovArticleDao.selectArticleListCnt(boardVO); + + Map map = new HashMap(); + + map.put("resultList", list); + map.put("resultCnt", Integer.toString(cnt)); + + return map; + } + + @Override + public BoardVO selectArticleDetail(BoardVO boardVO) { + int iniqireCo = egovArticleDao.selectMaxInqireCo(boardVO); + + boardVO.setInqireCo(iniqireCo); + egovArticleDao.updateInqireCo(boardVO); + + return egovArticleDao.selectArticleDetail(boardVO); + } + + @Override + public BoardVO selectArticleCnOne(BoardVO boardVO) { + return egovArticleDao.selectArticleCnOne(boardVO); + } + + @Override + public List selectArticleDetailDefault(BoardVO boardVO) { + return egovArticleDao.selectArticleDetailDefault(boardVO); + } + + @Override + public int selectArticleDetailDefaultCnt(BoardVO boardVO){ + return egovArticleDao.selectArticleDetailDefaultCnt(boardVO); + } + + @Override + public List selectArticleDetailCn(BoardVO boardVO) { + return egovArticleDao.selectArticleDetailCn(boardVO); + } + + @Override + public void insertArticle(Board board) throws FdlException { + + if ("Y".equals(board.getReplyAt())) { + // 답글인 경우 1. Parnts를 세팅, 2.Parnts의 sortOrdr을 현재글의 sortOrdr로 가져오도록, 3.nttNo는 현재 게시판의 순서대로 + // replyLc는 부모글의 ReplyLc + 1 + + board.setNttId(nttIdgenService.getNextIntegerId()); // 답글에 대한 nttId 생성 + egovArticleDao.replyArticle(board); + + } else { + // 답글이 아닌경우 Parnts = 0, replyLc는 = 0, sortOrdr = nttNo(Query에서 처리) + board.setParnts("0"); + board.setReplyLc("0"); + board.setReplyAt("N"); + board.setNttId(nttIdgenService.getNextIntegerId());//2011.09.22 + + egovArticleDao.insertArticle(board); + } + } + + @Override + public void updateArticle(Board board) { + egovArticleDao.updateArticle(board); + } + + @Override + public void deleteArticle(Board board) throws Exception { + FileVO fvo = new FileVO(); + + fvo.setAtchFileId(board.getAtchFileId()); + + board.setNttSj("이 글은 작성자에 의해서 삭제되었습니다."); + + egovArticleDao.deleteArticle(board); + + if (!"".equals(fvo.getAtchFileId()) || fvo.getAtchFileId() != null) { + fileService.deleteAllFileInf(fvo); + } + + } + + @Override + public List selectNoticeArticleList(BoardVO boardVO) { + return egovArticleDao.selectNoticeArticleList(boardVO); + } + + @Override + public List selectBlogNmList(BoardVO boardVO) { + return egovArticleDao.selectBlogNmList(boardVO); + } + + @Override + public Map selectGuestArticleList(BoardVO vo) { + List list = egovArticleDao.selectGuestArticleList(vo); + + + int cnt = egovArticleDao.selectGuestArticleListCnt(vo); + + Map map = new HashMap(); + + map.put("resultList", list); + map.put("resultCnt", Integer.toString(cnt)); + + return map; + } + + @Override + public int selectLoginUser(BoardVO boardVO){ + return egovArticleDao.selectLoginUser(boardVO); + } + + @Override + public Map selectBlogListManager(BoardVO vo) { + List result = egovArticleDao.selectBlogListManager(vo); + int cnt = egovArticleDao.selectBlogListManagerCnt(vo); + + Map map = new HashMap(); + + map.put("resultList", result); + map.put("resultCnt", Integer.toString(cnt)); + + return map; + } + +} diff --git a/src/main/java/egovframework/com/cop/bbs/service/impl/EgovBBSMasterDAO.java b/src/main/java/egovframework/com/cop/bbs/service/impl/EgovBBSMasterDAO.java new file mode 100644 index 0000000..57fa644 --- /dev/null +++ b/src/main/java/egovframework/com/cop/bbs/service/impl/EgovBBSMasterDAO.java @@ -0,0 +1,80 @@ +package egovframework.com.cop.bbs.service.impl; + +import java.util.List; + +import org.springframework.stereotype.Repository; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.cop.bbs.service.BoardMaster; +import egovframework.com.cop.bbs.service.BoardMasterVO; +import egovframework.com.cop.cmy.service.CommunityVO; +import egovframework.com.cop.bbs.service.BlogVO; +import egovframework.com.cop.bbs.service.Blog; +import egovframework.com.cop.bbs.service.BlogUser; + +@Repository("EgovBBSMasterDAO") +public class EgovBBSMasterDAO extends EgovComAbstractDAO { + + public List selectBBSMasterInfs(BoardMasterVO boardMasterVO) { + return list("BBSMaster.selectBBSMasterList", boardMasterVO); + } + + public int selectBBSMasterInfsCnt(BoardMasterVO boardMasterVO) { + return (Integer)selectOne("BBSMaster.selectBBSMasterListTotCnt", boardMasterVO); + } + + public BoardMasterVO selectBBSMasterDetail(BoardMasterVO boardMasterVO) { + return (BoardMasterVO) selectOne("BBSMaster.selectBBSMasterDetail", boardMasterVO); + } + + public void insertBBSMasterInf(BoardMaster boardMaster) { + insert("BBSMaster.insertBBSMaster", boardMaster); + } + + public void updateBBSMaster(BoardMaster boardMaster) { + update("BBSMaster.updateBBSMaster", boardMaster); + } + + public void deleteBBSMaster(BoardMaster boardMaster) { + update("BBSMaster.deleteBBSMaster", boardMaster); + } + + /* + * 블로그 관련 + */ + public List selectBlogMasterInfs(BoardMasterVO boardMasterVO) { + return list("BBSMaster.selectBlogMasterList", boardMasterVO); + } + + public int selectBlogMasterInfsCnt(BoardMasterVO boardMasterVO) { + return (Integer)selectOne("BBSMaster.selectBlogMasterListTotCnt", boardMasterVO); + } + + public int checkExistUser(BlogVO blogVO) { + return (Integer)selectOne("BBSMaster.checkExistUser", blogVO); + } + + public BlogVO checkExistUser2(BlogVO blogVO) { + return (BlogVO) selectOne("BBSMaster.checkExistUser2", blogVO); + } + + public void insertBoardBlogUserRqst(BlogUser blogUser) { + insert("BBSMaster.insertBoardBlogUserRqst", blogUser); + } + + public void insertBlogMaster(Blog blog) { + insert("BBSMaster.insertBlogMaster", blog); + } + + public BlogVO selectBlogDetail(BlogVO blogVO) { + return (BlogVO) selectOne("BBSMaster.selectBlogDetail", blogVO); + } + + public List selectBlogListPortlet(BlogVO blogVO) throws Exception{ + return (List) list("BBSMaster.selectBlogListPortlet", blogVO); + } + + public List selectBBSListPortlet(BoardMasterVO boardMasterVO) { + return (List) list("BBSMaster.selectBBSListPortlet", boardMasterVO); + } +} diff --git a/src/main/java/egovframework/com/cop/bbs/service/impl/EgovBBSMasterServiceImpl.java b/src/main/java/egovframework/com/cop/bbs/service/impl/EgovBBSMasterServiceImpl.java new file mode 100644 index 0000000..1f7d0f6 --- /dev/null +++ b/src/main/java/egovframework/com/cop/bbs/service/impl/EgovBBSMasterServiceImpl.java @@ -0,0 +1,177 @@ +package egovframework.com.cop.bbs.service.impl; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import egovframework.com.cop.bbs.service.BoardMaster; +import egovframework.com.cop.bbs.service.BoardMasterVO; +import egovframework.com.cop.bbs.service.EgovBBSMasterService; +import egovframework.com.cmm.EgovComponentChecker; +import egovframework.com.cop.bbs.service.Blog; +import egovframework.com.cop.bbs.service.BlogUser; +import egovframework.com.cop.bbs.service.BlogVO; +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.cmmn.exception.FdlException; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +@Service("EgovBBSMasterService") +public class EgovBBSMasterServiceImpl extends EgovAbstractServiceImpl implements EgovBBSMasterService { + + @Resource(name = "EgovBBSMasterDAO") + private EgovBBSMasterDAO egovBBSMasterDao; + + @Resource(name = "egovBBSMstrIdGnrService") + private EgovIdGnrService idgenService; + + //--------------------------------- + // 2009.06.26 : 2단계 기능 추가 + //--------------------------------- + @Resource(name = "BBSAddedOptionsDAO") + private BBSAddedOptionsDAO addedOptionsDAO; + ////------------------------------- + + @Override + public Map selectNotUsedBdMstrList(BoardMasterVO boardMasterVO) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void deleteBBSMasterInf(BoardMaster boardMaster) { + egovBBSMasterDao.deleteBBSMaster(boardMaster); + } + + @Override + public void updateBBSMasterInf(BoardMaster boardMaster) throws Exception { + egovBBSMasterDao.updateBBSMaster(boardMaster); + + //--------------------------------- + // 2009.06.26 : 2단계 기능 추가 + //--------------------------------- + if (boardMaster.getOption().equals("comment") || boardMaster.getOption().equals("stsfdg")) { + addedOptionsDAO.insertAddedOptionsInf(boardMaster); + } + + } + + @Override + public BoardMasterVO selectBBSMasterInf(BoardMasterVO boardMasterVO) throws Exception { + BoardMasterVO resultVO = egovBBSMasterDao.selectBBSMasterDetail(boardMasterVO); + if (resultVO == null) + throw processException("info.nodata.msg"); + + if(EgovComponentChecker.hasComponent("EgovBBSCommentService") || EgovComponentChecker.hasComponent("EgovBBSSatisfactionService")){//2011.09.15 + BoardMasterVO options = addedOptionsDAO.selectAddedOptionsInf(boardMasterVO); + + if (options != null) { + if (options.getCommentAt().equals("Y")) { + resultVO.setOption("comment"); + } + + if (options.getStsfdgAt().equals("Y")) { + resultVO.setOption("stsfdg"); + } + } else { + resultVO.setOption("na"); // 미지정 상태로 수정 가능 (이미 지정된 경우는 수정 불가로 처리) + } + } + + return resultVO; + } + + @Override + public Map selectBBSMasterInfs(BoardMasterVO boardMasterVO) { + List result = egovBBSMasterDao.selectBBSMasterInfs(boardMasterVO); + int cnt = egovBBSMasterDao.selectBBSMasterInfsCnt(boardMasterVO); + + Map map = new HashMap(); + + map.put("resultList", result); + map.put("resultCnt", Integer.toString(cnt)); + + return map; + } + + @Override + public Map selectBlogMasterInfs(BoardMasterVO boardMasterVO) { + List result = egovBBSMasterDao.selectBlogMasterInfs(boardMasterVO); + int cnt = egovBBSMasterDao.selectBlogMasterInfsCnt(boardMasterVO); + + Map map = new HashMap(); + + map.put("resultList", result); + map.put("resultCnt", Integer.toString(cnt)); + + return map; + } + + @Override + public void insertBBSMasterInf(BoardMaster boardMaster) throws Exception { + + //게시판 ID 채번 + String bbsId = idgenService.getNextStringId(); + boardMaster.setBbsId(bbsId); + + egovBBSMasterDao.insertBBSMasterInf(boardMaster); + + //--------------------------------- + // 2009.06.26 : 2단계 기능 추가 + //--------------------------------- + if (boardMaster.getOption().equals("comment") || boardMaster.getOption().equals("stsfdg")) { + addedOptionsDAO.insertAddedOptionsInf(boardMaster); + } + + } + + @Override + public String checkBlogUser(BlogVO blogVO) { + + int userCnt = egovBBSMasterDao.checkExistUser(blogVO); + + if (userCnt == 0) { + return ""; + } else { + return "EXIST"; + } + } + + @Override + public BlogVO checkBlogUser2(BlogVO blogVO) { + BlogVO userBlog = egovBBSMasterDao.checkExistUser2(blogVO); + return userBlog; + } + + @Override + public void insertBoardBlogUserRqst(BlogUser blogUser) { + egovBBSMasterDao.insertBoardBlogUserRqst(blogUser); + } + + @Override + public void insertBlogMaster(Blog blog) throws FdlException { + egovBBSMasterDao.insertBlogMaster(blog); + } + + @Override + public BlogVO selectBlogDetail(BlogVO blogVO) throws Exception { + BlogVO resultVO = egovBBSMasterDao.selectBlogDetail(blogVO); + if (resultVO == null) + throw processException("info.nodata.msg"); + return resultVO; + } + + @Override + public List selectBlogListPortlet(BlogVO blogVO) throws Exception{ + return egovBBSMasterDao.selectBlogListPortlet(blogVO); + } + + @Override + public List selectBBSListPortlet(BoardMasterVO boardMasterVO) throws Exception { + return egovBBSMasterDao.selectBBSListPortlet(boardMasterVO); + } + +} diff --git a/src/main/java/egovframework/com/cop/bbs/web/EgovArticleController.java b/src/main/java/egovframework/com/cop/bbs/web/EgovArticleController.java new file mode 100644 index 0000000..9abe9e6 --- /dev/null +++ b/src/main/java/egovframework/com/cop/bbs/web/EgovArticleController.java @@ -0,0 +1,1397 @@ +package egovframework.com.cop.bbs.web; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +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.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.EgovWebUtil; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.service.EgovFileMngService; +import egovframework.com.cmm.service.EgovFileMngUtil; +import egovframework.com.cmm.service.FileVO; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.cmm.util.EgovXssChecker; +import egovframework.com.cop.bbs.service.BlogVO; +import egovframework.com.cop.bbs.service.Board; +import egovframework.com.cop.bbs.service.BoardMaster; +import egovframework.com.cop.bbs.service.BoardMasterVO; +import egovframework.com.cop.bbs.service.BoardVO; +import egovframework.com.cop.bbs.service.EgovArticleService; +import egovframework.com.cop.bbs.service.EgovBBSMasterService; +import egovframework.com.cop.bbs.service.EgovBBSSatisfactionService; +import egovframework.com.cop.cmt.service.CommentVO; +import egovframework.com.cop.cmt.service.EgovArticleCommentService; +import egovframework.com.cop.tpl.service.EgovTemplateManageService; +import egovframework.com.cop.tpl.service.TemplateInfVO; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +/** + * 게시물 관리를 위한 컨트롤러 클래스 + * @author 공통서비스개발팀 이삼섭 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *  수정일               수정자            수정내용
    + *  ----------   -------    ---------------------------
    + *  2009.03.19   이삼섭            최초 생성
    + *  2009.06.29   한성곤            2단계 기능 추가 (댓글관리, 만족도조사)
    + *  2011.07.01   안민정            댓글, 스크랩, 만족도 조사 기능의 종속성 제거
    + *  2011.08.26   정진오            IncludedInfo annotation 추가
    + *  2011.09.07   서준식            유효 게시판 게시일 지나도 게시물이 조회되던 오류 수정
    + *  2016.06.13   김연호            표준프레임워크 3.6 개선
    + *  2019.05.17   신용호            KISA 취약점 조치 및 보완
    + *  2020.10.27   신용호            파일 업로드 수정 (multiRequest.getFiles)
    + *  
    + * 
    + */ + +@Controller +public class EgovArticleController { + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovArticleController.class); + + @Resource(name = "EgovArticleService") + private EgovArticleService egovArticleService; + + @Resource(name = "EgovBBSMasterService") + private EgovBBSMasterService egovBBSMasterService; + + @Resource(name = "EgovFileMngService") + private EgovFileMngService fileMngService; + + @Resource(name = "EgovFileMngUtil") + private EgovFileMngUtil fileUtil; + + @Resource(name = "propertiesService") + protected EgovPropertyService propertyService; + + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name = "EgovArticleCommentService") + protected EgovArticleCommentService egovArticleCommentService; + + @Resource(name = "EgovBBSSatisfactionService") + private EgovBBSSatisfactionService bbsSatisfactionService; + + @Resource(name = "EgovTemplateManageService") + private EgovTemplateManageService egovTemplateManageService; + + @Autowired + private DefaultBeanValidator beanValidator; + + //protected Logger log = Logger.getLogger(this.getClass()); + + /** + * 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(" map = egovArticleService.selectArticleList(boardVO); + int totCnt = Integer.parseInt((String)map.get("resultCnt")); + + //공지사항 추출 + List noticeList = egovArticleService.selectNoticeArticleList(boardVO); + + paginationInfo.setTotalRecordCount(totCnt); + + //------------------------------- + // 기본 BBS template 지정 + //------------------------------- + if (master.getTmplatCours() == null || master.getTmplatCours().equals("")) { + master.setTmplatCours("/css/egovframework/com/cop/tpl/egovBaseTemplate.css"); + } + ////----------------------------- + + if(user != null) { + model.addAttribute("sessionUniqId", user.getUniqId()); + } + + model.addAttribute("resultList", map.get("resultList")); + model.addAttribute("resultCnt", map.get("resultCnt")); + model.addAttribute("articleVO", boardVO); + model.addAttribute("boardMasterVO", master); + model.addAttribute("paginationInfo", paginationInfo); + model.addAttribute("noticeList", noticeList); + return "egovframework/com/cop/bbs/EgovArticleList"; + } + + + + /** + * 게시물에 대한 상세 정보를 조회한다. + * + * @param boardVO + * @param sessionVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/bbs/selectArticleDetail.do") + public String selectArticleDetail(@ModelAttribute("searchVO") BoardVO boardVO, ModelMap model) throws Exception { + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); //KISA 보안취약점 조치 (2018-12-10, 이정은) + + if(!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + + boardVO.setLastUpdusrId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + BoardVO vo = egovArticleService.selectArticleDetail(boardVO); + + model.addAttribute("result", vo); + model.addAttribute("sessionUniqId", (user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + + //비밀글은 작성자만 볼수 있음 + if(!EgovStringUtil.isEmpty(vo.getSecretAt()) && vo.getSecretAt().equals("Y") && !((user == null || user.getUniqId() == null) ? "" : user.getUniqId()).equals(vo.getFrstRegisterId())) + return"forward:/cop/bbs/selectArticleList.do"; + + //---------------------------- + // template 처리 (기본 BBS template 지정 포함) + //---------------------------- + BoardMasterVO master = new BoardMasterVO(); + + master.setBbsId(boardVO.getBbsId()); + master.setUniqId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + + BoardMasterVO masterVo = egovBBSMasterService.selectBBSMasterInf(master); + + if (masterVo.getTmplatCours() == null || masterVo.getTmplatCours().equals("")) { + masterVo.setTmplatCours("/css/egovframework/com/cop/tpl/egovBaseTemplate.css"); + } + + ////----------------------------- + + //---------------------------- + // 2009.06.29 : 2단계 기능 추가 + // 2011.07.01 : 댓글, 만족도 조사 기능의 종속성 제거 + //---------------------------- + if (egovArticleCommentService != null){ + if (egovArticleCommentService.canUseComment(boardVO.getBbsId())) { + model.addAttribute("useComment", "true"); + } + } + if (bbsSatisfactionService != null) { + if (bbsSatisfactionService.canUseSatisfaction(boardVO.getBbsId())) { + model.addAttribute("useSatisfaction", "true"); + } + } + ////-------------------------- + + model.addAttribute("boardMasterVO", masterVo); + + return "egovframework/com/cop/bbs/EgovArticleDetail"; + } + + /** + * 게시물 등록을 위한 등록페이지로 이동한다. + * + * @param boardVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/bbs/insertArticleView.do") + public String insertArticleView(@ModelAttribute("searchVO") BoardVO boardVO, ModelMap model) throws Exception { + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + BoardMasterVO bdMstr = new BoardMasterVO(); + BoardVO board = new BoardVO(); + if (isAuthenticated) { + + BoardMasterVO vo = new BoardMasterVO(); + vo.setBbsId(boardVO.getBbsId()); + vo.setUniqId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + + bdMstr = egovBBSMasterService.selectBBSMasterInf(vo); + } + + //---------------------------- + // 기본 BBS template 지정 + //---------------------------- + if (bdMstr.getTmplatCours() == null || bdMstr.getTmplatCours().equals("")) { + bdMstr.setTmplatCours("/css/egovframework/com/cop/tpl/egovBaseTemplate.css"); + } + + model.addAttribute("articleVO", boardVO); + model.addAttribute("boardMasterVO", bdMstr); + ////----------------------------- + + return "egovframework/com/cop/bbs/EgovArticleRegist"; + } + + /** + * 게시물을 등록한다. + * + * @param boardVO + * @param board + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/bbs/insertArticle.do") + public String insertArticle(final MultipartHttpServletRequest multiRequest, @ModelAttribute("searchVO") BoardVO boardVO, + @ModelAttribute("bdMstr") BoardMaster bdMstr, @ModelAttribute("board") BoardVO board, BindingResult bindingResult, + ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if(!isAuthenticated) { //KISA 보안취약점 조치 (2018-12-10, 이정은) + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + beanValidator.validate(board, bindingResult); + if (bindingResult.hasErrors()) { + + BoardMasterVO master = new BoardMasterVO(); + + master.setBbsId(boardVO.getBbsId()); + master.setUniqId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + + master = egovBBSMasterService.selectBBSMasterInf(master); + + + //---------------------------- + // 기본 BBS template 지정 + //---------------------------- + if (master.getTmplatCours() == null || master.getTmplatCours().equals("")) { + master.setTmplatCours("css/egovframework/com/cop/tpl/egovBaseTemplate.css"); + } + + model.addAttribute("boardMasterVO", master); + ////----------------------------- + + return "egovframework/com/cop/bbs/EgovArticleRegist"; + } + + if (isAuthenticated) { + List result = null; + String atchFileId = ""; + + //final Map files = multiRequest.getFileMap(); + final List files = multiRequest.getFiles("file_1"); + if (!files.isEmpty()) { + result = fileUtil.parseFileInf(files, "BBS_", 0, "", ""); + atchFileId = fileMngService.insertFileInfs(result); + } + board.setAtchFileId(atchFileId); + board.setFrstRegisterId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + board.setBbsId(boardVO.getBbsId()); + board.setBlogId(boardVO.getBlogId()); + + + //익명등록 처리 + if(board.getAnonymousAt() != null && board.getAnonymousAt().equals("Y")){ + board.setNtcrId("anonymous"); //게시물 통계 집계를 위해 등록자 ID 저장 + board.setNtcrNm("익명"); //게시물 통계 집계를 위해 등록자 Name 저장 + board.setFrstRegisterId("anonymous"); + + } else { + board.setNtcrId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); //게시물 통계 집계를 위해 등록자 ID 저장 + board.setNtcrNm((user == null || user.getName() == null) ? "" : user.getName()); //게시물 통계 집계를 위해 등록자 Name 저장 + + } + + board.setNttCn(unscript(board.getNttCn())); // XSS 방지 + egovArticleService.insertArticle(board); + } + //status.setComplete(); + if(boardVO.getBlogAt().equals("Y")){ + return "forward:/cop/bbs/selectArticleBlogList.do"; + }else{ + return "forward:/cop/bbs/selectArticleList.do"; + } + + } + + /** + * 게시물에 대한 답변 등록을 위한 등록페이지로 이동한다. + * + * @param boardVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/bbs/replyArticleView.do") + public String addReplyBoardArticle(@ModelAttribute("searchVO") BoardVO boardVO, ModelMap model) throws Exception { + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();//KISA 보안취약점 조치 (2018-12-10, 이정은) + + if(!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + BoardMasterVO master = new BoardMasterVO(); + BoardVO articleVO = new BoardVO(); + master.setBbsId(boardVO.getBbsId()); + master.setUniqId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + + master = egovBBSMasterService.selectBBSMasterInf(master); + boardVO = egovArticleService.selectArticleDetail(boardVO); + + //---------------------------- + // 기본 BBS template 지정 + //---------------------------- + if (master.getTmplatCours() == null || master.getTmplatCours().equals("")) { + master.setTmplatCours("/css/egovframework/com/cop/tpl/egovBaseTemplate.css"); + } + + model.addAttribute("boardMasterVO", master); + model.addAttribute("result", boardVO); + + model.addAttribute("articleVO", articleVO); + + if(boardVO.getBlogAt().equals("chkBlog")){ + return "egovframework/com/cop/bbs/EgovArticleBlogReply"; + }else{ + return "egovframework/com/cop/bbs/EgovArticleReply"; + } + } + + /** + * 게시물에 대한 답변을 등록한다. + * + * @param boardVO + * @param board + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/bbs/replyArticle.do") + public String replyBoardArticle(final MultipartHttpServletRequest multiRequest, @ModelAttribute("searchVO") BoardVO boardVO, + @ModelAttribute("bdMstr") BoardMaster bdMstr, @ModelAttribute("board") BoardVO board, BindingResult bindingResult, ModelMap model + ) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if(!isAuthenticated) { //KISA 보안취약점 조치 (2018-12-10, 이정은) + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + beanValidator.validate(board, bindingResult); + if (bindingResult.hasErrors()) { + BoardMasterVO master = new BoardMasterVO(); + + master.setBbsId(boardVO.getBbsId()); + master.setUniqId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + + master = egovBBSMasterService.selectBBSMasterInf(master); + + + //---------------------------- + // 기본 BBS template 지정 + //---------------------------- + if (master.getTmplatCours() == null || master.getTmplatCours().equals("")) { + master.setTmplatCours("/css/egovframework/com/cop/tpl/egovBaseTemplate.css"); + } + + model.addAttribute("articleVO", boardVO); + model.addAttribute("boardMasterVO", master); + ////----------------------------- + + return "egovframework/com/cop/bbs/EgovArticleReply"; + } + + if (isAuthenticated) { + //final Map files = multiRequest.getFileMap(); + final List files = multiRequest.getFiles("file_1"); + String atchFileId = ""; + + if (!files.isEmpty()) { + List result = fileUtil.parseFileInf(files, "BBS_", 0, "", ""); + atchFileId = fileMngService.insertFileInfs(result); + } + + board.setAtchFileId(atchFileId); + board.setReplyAt("Y"); + board.setFrstRegisterId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + board.setBbsId(board.getBbsId()); + board.setParnts(Long.toString(boardVO.getNttId())); + board.setSortOrdr(boardVO.getSortOrdr()); + board.setReplyLc(Integer.toString(Integer.parseInt(boardVO.getReplyLc()) + 1)); + + //익명등록 처리 + if(board.getAnonymousAt() != null && board.getAnonymousAt().equals("Y")){ + board.setNtcrId("anonymous"); //게시물 통계 집계를 위해 등록자 ID 저장 + board.setNtcrNm("익명"); //게시물 통계 집계를 위해 등록자 Name 저장 + board.setFrstRegisterId("anonymous"); + + } else { + board.setNtcrId((user == null || user.getId() == null) ? "" : user.getId()); //게시물 통계 집계를 위해 등록자 ID 저장 + board.setNtcrNm((user == null || user.getName() == null) ? "" : user.getName()); //게시물 통계 집계를 위해 등록자 Name 저장 + + } + board.setNttCn(unscript(board.getNttCn())); // XSS 방지 + + egovArticleService.insertArticle(board); + } + + return "forward:/cop/bbs/selectArticleList.do"; + } + + /** + * 게시물 수정을 위한 수정페이지로 이동한다. + * + * @param boardVO + * @param vo + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/bbs/updateArticleView.do") + public String updateArticleView(@ModelAttribute("searchVO") BoardVO boardVO, @ModelAttribute("board") BoardVO vo, ModelMap model) + throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + boardVO.setFrstRegisterId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + + BoardMasterVO bmvo = new BoardMasterVO(); + BoardVO bdvo = new BoardVO(); + + vo.setBbsId(boardVO.getBbsId()); + + bmvo.setBbsId(boardVO.getBbsId()); + bmvo.setUniqId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + + if (isAuthenticated) { + bmvo = egovBBSMasterService.selectBBSMasterInf(bmvo); + bdvo = egovArticleService.selectArticleDetail(boardVO); + } + + //---------------------------- + // 기본 BBS template 지정 + //---------------------------- + if (bmvo.getTmplatCours() == null || bmvo.getTmplatCours().equals("")) { + bmvo.setTmplatCours("/css/egovframework/com/cop/tpl/egovBaseTemplate.css"); + } + + //익명 등록글인 경우 수정 불가 + if(bdvo.getNtcrId().equals("anonymous")){ + model.addAttribute("result", bdvo); + model.addAttribute("boardMasterVO", bmvo); + return "egovframework/com/cop/bbs/EgovArticleDetail"; + } + + model.addAttribute("articleVO", bdvo); + model.addAttribute("boardMasterVO", bmvo); + + if(boardVO.getBlogAt().equals("chkBlog")){ + return "egovframework/com/cop/bbs/EgovArticleBlogUpdt"; + }else{ + return "egovframework/com/cop/bbs/EgovArticleUpdt"; + } + + } + + /** + * 게시물에 대한 내용을 수정한다. + * + * @param boardVO + * @param board + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/bbs/updateArticle.do") + public String updateBoardArticle(final MultipartHttpServletRequest multiRequest, @ModelAttribute("searchVO") BoardVO boardVO, + @ModelAttribute("bdMstr") BoardMaster bdMstr, @ModelAttribute("board") Board board, BindingResult bindingResult, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if(!isAuthenticated) { //KISA 보안취약점 조치 (2018-12-10, 이정은) + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + //-------------------------------------------------------------------------------------------- + // @ XSS 대응 권한체크 체크 START + // param1 : 사용자고유ID(uniqId,esntlId) + //-------------------------------------------------------- + LOGGER.debug("@ XSS 권한체크 START ----------------------------------------------"); + //step1 DB에서 해당 게시물의 uniqId 조회 + BoardVO vo = egovArticleService.selectArticleDetail(boardVO); + + //step2 EgovXssChecker 공통모듈을 이용한 권한체크 + EgovXssChecker.checkerUserXss(multiRequest, vo.getFrstRegisterId()); + LOGGER.debug("@ XSS 권한체크 END ------------------------------------------------"); + //-------------------------------------------------------- + // @ XSS 대응 권한체크 체크 END + //-------------------------------------------------------------------------------------------- + + String atchFileId = boardVO.getAtchFileId(); + + beanValidator.validate(board, bindingResult); + if (bindingResult.hasErrors()) { + + boardVO.setFrstRegisterId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + + BoardMasterVO bmvo = new BoardMasterVO(); + BoardVO bdvo = new BoardVO(); + + bmvo.setBbsId(boardVO.getBbsId()); + bmvo.setUniqId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + + bmvo = egovBBSMasterService.selectBBSMasterInf(bmvo); + bdvo = egovArticleService.selectArticleDetail(boardVO); + + model.addAttribute("articleVO", bdvo); + model.addAttribute("boardMasterVO", bmvo); + + return "egovframework/com/cop/bbs/EgovArticleUpdt"; + } + + if (isAuthenticated) { + + //final Map files = multiRequest.getFileMap(); + final List files = multiRequest.getFiles("file_1"); + if (!files.isEmpty()) { + if (atchFileId == null || "".equals(atchFileId)) { + List result = fileUtil.parseFileInf(files, "BBS_", 0, atchFileId, ""); + atchFileId = fileMngService.insertFileInfs(result); + board.setAtchFileId(atchFileId); + } else { + FileVO fvo = new FileVO(); + fvo.setAtchFileId(atchFileId); + int cnt = fileMngService.getMaxFileSN(fvo); + List _result = fileUtil.parseFileInf(files, "BBS_", cnt, atchFileId, ""); + fileMngService.updateFileInfs(_result); + } + } + + board.setLastUpdusrId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + + board.setNtcrNm(""); // dummy 오류 수정 (익명이 아닌 경우 validator 처리를 위해 dummy로 지정됨) + board.setPassword(""); // dummy 오류 수정 (익명이 아닌 경우 validator 처리를 위해 dummy로 지정됨) + + board.setNttCn(unscript(board.getNttCn())); // XSS 방지 + + egovArticleService.updateArticle(board); + } + + return "forward:/cop/bbs/selectArticleList.do"; + } + + /** + * 게시물에 대한 내용을 삭제한다. + * + * @param boardVO + * @param board + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/bbs/deleteArticle.do") + public String deleteBoardArticle(HttpServletRequest request, @ModelAttribute("searchVO") BoardVO boardVO, @ModelAttribute("board") Board board, + @ModelAttribute("bdMstr") BoardMaster bdMstr, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + //-------------------------------------------------------------------------------------------- + // @ XSS 대응 권한체크 체크 START + // param1 : 사용자고유ID(uniqId,esntlId) + //-------------------------------------------------------- + LOGGER.debug("@ XSS 권한체크 START ----------------------------------------------"); + //step1 DB에서 해당 게시물의 uniqId 조회 + BoardVO vo = egovArticleService.selectArticleDetail(boardVO); + + //step2 EgovXssChecker 공통모듈을 이용한 권한체크 + EgovXssChecker.checkerUserXss(request, vo.getFrstRegisterId()); + LOGGER.debug("@ XSS 권한체크 END ------------------------------------------------"); + //-------------------------------------------------------- + // @ XSS 대응 권한체크 체크 END + //-------------------------------------------------------------------------------------------- + + BoardVO bdvo = egovArticleService.selectArticleDetail(boardVO); + //익명 등록글인 경우 수정 불가 + if(bdvo.getNtcrId().equals("anonymous")){ + model.addAttribute("result", bdvo); + model.addAttribute("boardMasterVO", bdMstr); + return "egovframework/com/cop/bbs/EgovArticleDetail"; + } + + if (isAuthenticated) { + board.setLastUpdusrId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + + egovArticleService.deleteArticle(board); + } + + if(boardVO.getBlogAt().equals("chkBlog")){ + return "forward:/cop/bbs/selectArticleBlogList.do"; + }else{ + return "forward:/cop/bbs/selectArticleList.do"; + } + } + + /** + * 방명록에 대한 목록을 조회한다. + * + * @param boardVO + * @param sessionVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/bbs/selectGuestArticleList.do") + public String selectGuestArticleList(@ModelAttribute("searchVO") BoardVO boardVO, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if(!isAuthenticated) { //KISA 보안취약점 조치 (2018-12-10, 이정은) + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + // 수정 및 삭제 기능 제어를 위한 처리 + model.addAttribute("sessionUniqId", (user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + + BoardVO vo = new BoardVO(); + + vo.setBbsId(boardVO.getBbsId()); + vo.setBbsNm(boardVO.getBbsNm()); + vo.setNtcrNm((user == null || user.getName() == null) ? "" : user.getName()); + vo.setNtcrId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + + BoardMasterVO masterVo = new BoardMasterVO(); + + masterVo.setBbsId(vo.getBbsId()); + masterVo.setUniqId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + + BoardMasterVO mstrVO = egovBBSMasterService.selectBBSMasterInf(masterVo); + + vo.setPageIndex(boardVO.getPageIndex()); + vo.setPageUnit(propertyService.getInt("pageUnit")); + vo.setPageSize(propertyService.getInt("pageSize")); + + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(vo.getPageIndex()); + paginationInfo.setRecordCountPerPage(vo.getPageUnit()); + paginationInfo.setPageSize(vo.getPageSize()); + + vo.setFirstIndex(paginationInfo.getFirstRecordIndex()); + vo.setLastIndex(paginationInfo.getLastRecordIndex()); + vo.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + Map map = egovArticleService.selectGuestArticleList(vo); + int totCnt = Integer.parseInt((String)map.get("resultCnt")); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("user", user); + model.addAttribute("resultList", map.get("resultList")); + model.addAttribute("resultCnt", map.get("resultCnt")); + model.addAttribute("boardMasterVO", mstrVO); + model.addAttribute("articleVO", vo); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/cop/bbs/EgovGuestArticleList"; + } + + + /** + * 방명록에 대한 내용을 등록한다. + * + * @param boardVO + * @param board + * @param sessionVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/bbs/insertGuestArticle.do") + public String insertGuestList(@ModelAttribute("searchVO") BoardVO boardVO, @ModelAttribute("Board") Board board, BindingResult bindingResult, + ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if(!isAuthenticated) { //KISA 보안취약점 조치 (2018-12-10, 이정은) + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + beanValidator.validate(board, bindingResult); + if (bindingResult.hasErrors()) { + + BoardVO vo = new BoardVO(); + + vo.setBbsId(boardVO.getBbsId()); + vo.setBbsNm(boardVO.getBbsNm()); + vo.setNtcrNm(user == null ? "" : EgovStringUtil.isNullToString(user.getName())); + vo.setNtcrId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + + BoardMasterVO masterVo = new BoardMasterVO(); + + masterVo.setBbsId(vo.getBbsId()); + masterVo.setUniqId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + + BoardMasterVO mstrVO = egovBBSMasterService.selectBBSMasterInf(masterVo); + + vo.setPageUnit(propertyService.getInt("pageUnit")); + vo.setPageSize(propertyService.getInt("pageSize")); + + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(vo.getPageIndex()); + paginationInfo.setRecordCountPerPage(vo.getPageUnit()); + paginationInfo.setPageSize(vo.getPageSize()); + + vo.setFirstIndex(paginationInfo.getFirstRecordIndex()); + vo.setLastIndex(paginationInfo.getLastRecordIndex()); + vo.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + Map map = egovArticleService.selectGuestArticleList(vo); + int totCnt = Integer.parseInt((String)map.get("resultCnt")); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList", map.get("resultList")); + model.addAttribute("resultCnt", map.get("resultCnt")); + model.addAttribute("boardMasterVO", mstrVO); + model.addAttribute("articleVO", vo); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/cop/bbs/EgovGuestArticleList"; + + } + + if (isAuthenticated) { + board.setFrstRegisterId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + + egovArticleService.insertArticle(board); + + boardVO.setNttCn(""); + boardVO.setPassword(""); + boardVO.setNtcrId(""); + boardVO.setNttId(0); + } + + return "forward:/cop/bbs/selectGuestArticleList.do"; + } + + /** + * 방명록에 대한 내용을 삭제한다. + * + * @param boardVO + * @param sessionVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/bbs/deleteGuestArticle.do") + public String deleteGuestList(@ModelAttribute("searchVO") BoardVO boardVO, @ModelAttribute("articleVO") Board board, ModelMap model) throws Exception { + @SuppressWarnings("unused") + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if (isAuthenticated) { + egovArticleService.deleteArticle(boardVO); + } + + return "forward:/cop/bbs/selectGuestArticleList.do"; + } + + /** + * 방명록 수정을 위한 특정 내용을 조회한다. + * + * @param boardVO + * @param sessionVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/bbs/updateGuestArticleView.do") + public String updateGuestArticleView(@ModelAttribute("searchVO") BoardVO boardVO, @ModelAttribute("boardMasterVO") BoardMasterVO brdMstrVO, + ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if(!isAuthenticated) { //KISA 보안취약점 조치 (2018-12-10, 이정은) + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + // 수정 및 삭제 기능 제어를 위한 처리 + model.addAttribute("sessionUniqId", (user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + + BoardVO vo = egovArticleService.selectArticleDetail(boardVO); + + boardVO.setBbsId(boardVO.getBbsId()); + boardVO.setBbsNm(boardVO.getBbsNm()); + boardVO.setNtcrNm((user == null || user.getName() == null) ? "" : user.getName()); + + 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()); + + Map map = egovArticleService.selectGuestArticleList(boardVO); + int totCnt = Integer.parseInt((String)map.get("resultCnt")); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList", map.get("resultList")); + model.addAttribute("resultCnt", map.get("resultCnt")); + model.addAttribute("articleVO", vo); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/cop/bbs/EgovGuestArticleList"; + } + + /** + * 방명록을 수정하고 게시판 메인페이지를 조회한다. + * + * @param boardVO + * @param sessionVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/bbs/updateGuestArticle.do") + public String updateGuestArticle(@ModelAttribute("searchVO") BoardVO boardVO, @ModelAttribute Board board, BindingResult bindingResult, + ModelMap model) throws Exception { + + //BBST02, BBST04 + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if(!isAuthenticated) { //KISA 보안취약점 조치 (2018-12-10, 이정은) + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + beanValidator.validate(board, bindingResult); + if (bindingResult.hasErrors()) { + + BoardVO vo = new BoardVO(); + + vo.setBbsId(boardVO.getBbsId()); + vo.setBbsNm(boardVO.getBbsNm()); + vo.setNtcrNm((user == null || user.getName() == null) ? "" : user.getName()); + vo.setNtcrId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + + BoardMasterVO masterVo = new BoardMasterVO(); + + masterVo.setBbsId(vo.getBbsId()); + masterVo.setUniqId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + + BoardMasterVO mstrVO = egovBBSMasterService.selectBBSMasterInf(masterVo); + + vo.setPageUnit(propertyService.getInt("pageUnit")); + vo.setPageSize(propertyService.getInt("pageSize")); + + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(vo.getPageIndex()); + paginationInfo.setRecordCountPerPage(vo.getPageUnit()); + paginationInfo.setPageSize(vo.getPageSize()); + + vo.setFirstIndex(paginationInfo.getFirstRecordIndex()); + vo.setLastIndex(paginationInfo.getLastRecordIndex()); + vo.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + Map map = egovArticleService.selectGuestArticleList(vo); + int totCnt = Integer.parseInt((String)map.get("resultCnt")); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList", map.get("resultList")); + model.addAttribute("resultCnt", map.get("resultCnt")); + model.addAttribute("boardMasterVO", mstrVO); + model.addAttribute("articleVO", vo); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/cop/bbs/EgovGuestArticleList"; + } + + if (isAuthenticated) { + egovArticleService.updateArticle(board); + boardVO.setNttCn(""); + boardVO.setPassword(""); + boardVO.setNtcrId(""); + boardVO.setNttId(0); + } + + return "forward:/cop/bbs/selectGuestArticleList.do"; + } + + /********************* + * 블로그관련 + * ********************/ + + /** + * 블로그 게시판에 대한 목록을 조회한다. + * + * @param boardVO + * @param sessionVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/bbs/selectArticleBlogList.do") + public String selectArticleBlogList(@ModelAttribute("searchVO") BoardVO boardVO, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); //KISA 보안취약점 조치 (2018-12-10, 이정은) + + if(!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + BlogVO blogVo = new BlogVO(); + blogVo.setFrstRegisterId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + blogVo.setBbsId(boardVO.getBbsId()); + blogVo.setBlogId(boardVO.getBlogId()); + BlogVO master = egovBBSMasterService.selectBlogDetail(blogVo); + + boardVO.setFrstRegisterId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + + //블로그 카테고리관리 권한(로그인 한 사용자만 가능) + int loginUserCnt = egovArticleService.selectLoginUser(boardVO); + + //블로그 게시판 제목 추출 + List blogNameList = egovArticleService.selectBlogNmList(boardVO); + + if(user != null) { + model.addAttribute("sessionUniqId", (user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + } + + model.addAttribute("articleVO", boardVO); + model.addAttribute("boardMasterVO", master); + model.addAttribute("blogNameList", blogNameList); + model.addAttribute("loginUserCnt", loginUserCnt); + + return "egovframework/com/cop/bbs/EgovArticleBlogList"; + } + + /** + * 블로그 게시물에 대한 상세 타이틀을 조회한다. + * + * @param boardVO + * @param sessionVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/bbs/selectArticleBlogDetail.do") + public ModelAndView selectArticleBlogDetail(@ModelAttribute("searchVO") BoardVO boardVO, ModelMap model) throws Exception { + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); //KISA 보안취약점 조치 (2018-12-10, 이정은) + + if(!isAuthenticated) { + throw new IllegalAccessException("Login Required!"); + } + + BoardVO vo = new BoardVO(); + + boardVO.setLastUpdusrId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + + 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()); + + List blogSubJectList = egovArticleService.selectArticleDetailDefault(boardVO); + vo = egovArticleService.selectArticleCnOne(boardVO); + + int totCnt = egovArticleService.selectArticleDetailDefaultCnt(boardVO); + paginationInfo.setTotalRecordCount(totCnt); + + ModelAndView mav = new ModelAndView("jsonView"); + mav.addObject("blogSubJectList", blogSubJectList); + mav.addObject("paginationInfo", paginationInfo); + + if(vo.getNttCn() != null){ + mav.addObject("blogCnOne", vo); + } + + //비밀글은 작성자만 볼수 있음 + if(!EgovStringUtil.isEmpty(vo.getSecretAt()) && vo.getSecretAt().equals("Y") && !((user == null || user.getUniqId() == null) ? "" : user.getUniqId()).equals(vo.getFrstRegisterId())) + mav.setViewName("forward:/cop/bbs/selectArticleList.do"); + return mav; + } + + /** + * 블로그 게시물에 대한 상세 내용을 조회한다. + * + * @param boardVO + * @param sessionVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/bbs/selectArticleBlogDetailCn.do") + public ModelAndView selectArticleBlogDetailCn(@ModelAttribute("searchVO") BoardVO boardVO, @ModelAttribute("commentVO") CommentVO commentVO, ModelMap model) throws Exception { + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + boardVO.setLastUpdusrId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); //KISA 보안취약점 조치 (2018-12-10, 이정은) + + if(!isAuthenticated) { + throw new IllegalAccessException("Login Required!"); + } + + BoardVO vo = egovArticleService.selectArticleDetail(boardVO); + + //---------------------------- + // 댓글 처리 + //---------------------------- + CommentVO articleCommentVO = new CommentVO(); + commentVO.setWrterNm((user == null || user.getName() == null) ? "" : user.getName()); + + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(commentVO.getSubPageIndex()); + paginationInfo.setRecordCountPerPage(commentVO.getSubPageUnit()); + paginationInfo.setPageSize(commentVO.getSubPageSize()); + + commentVO.setSubFirstIndex(paginationInfo.getFirstRecordIndex()); + commentVO.setSubLastIndex(paginationInfo.getLastRecordIndex()); + commentVO.setSubRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + Map map = egovArticleCommentService.selectArticleCommentList(commentVO); + int totCnt = Integer.parseInt((String)map.get("resultCnt")); + + paginationInfo.setTotalRecordCount(totCnt); + + //댓글 처리 END + //---------------------------- + + List blogCnList = egovArticleService.selectArticleDetailCn(boardVO); + ModelAndView mav = new ModelAndView("jsonView"); + + // 수정 처리된 후 댓글 등록 화면으로 처리되기 위한 구현 + if (commentVO.isModified()) { + commentVO.setCommentNo(""); + commentVO.setCommentCn(""); + } + + // 수정을 위한 처리 + if (!commentVO.getCommentNo().equals("")) { + mav.setViewName ("forward:/cop/cmt/updateArticleCommentView.do"); + } + + mav.addObject("blogCnList", blogCnList); + mav.addObject("resultUnder", vo); + mav.addObject("paginationInfo", paginationInfo); + mav.addObject("resultList", map.get("resultList")); + mav.addObject("resultCnt", map.get("resultCnt")); + mav.addObject("articleCommentVO", articleCommentVO); // validator 용도 + + commentVO.setCommentCn(""); // 등록 후 댓글 내용 처리 + + //비밀글은 작성자만 볼수 있음 + if(!EgovStringUtil.isEmpty(vo.getSecretAt()) && vo.getSecretAt().equals("Y") && !((user == null || user.getUniqId() == null) ? "" : user.getUniqId()).equals(vo.getFrstRegisterId())) + mav.setViewName("forward:/cop/bbs/selectArticleList.do"); + return mav; + + } + + /** + * 개인블로그 관리 + * + * @param boardVO + * @param sessionVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/bbs/selectBlogListManager.do") + public String selectBlogMasterList(@ModelAttribute("searchVO") BoardVO boardVO, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + + 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()); + boardVO.setFrstRegisterId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + + Map map = egovArticleService.selectBlogListManager(boardVO); + int totCnt = Integer.parseInt((String)map.get("resultCnt")); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList", map.get("resultList")); + model.addAttribute("resultCnt", map.get("resultCnt")); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/cop/bbs/EgovBlogListManager"; + } + + /** + * 템플릿에 대한 미리보기용 게시물 목록을 조회한다. + * + * @param boardVO + * @param sessionVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/bbs/previewBoardList.do") + public String previewBoardArticles(@ModelAttribute("searchVO") BoardVO boardVO, ModelMap model) throws Exception { + //LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + String template = boardVO.getSearchWrd(); // 템플릿 URL + + BoardMasterVO master = new BoardMasterVO(); + + master.setBbsNm("미리보기 게시판"); + + 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()); + + BoardVO target = null; + List list = new ArrayList(); + + target = new BoardVO(); + target.setNttSj("게시판 기능 설명"); + target.setFrstRegisterId("ID"); + target.setFrstRegisterNm("관리자"); + target.setFrstRegisterPnttm("2019-01-01"); + target.setInqireCo(7); + target.setParnts("0"); + target.setReplyAt("N"); + target.setReplyLc("0"); + target.setUseAt("Y"); + + list.add(target); + + target = new BoardVO(); + target.setNttSj("게시판 부가 기능 설명"); + target.setFrstRegisterId("ID"); + target.setFrstRegisterNm("관리자"); + target.setFrstRegisterPnttm("2019-01-01"); + target.setInqireCo(7); + target.setParnts("0"); + target.setReplyAt("N"); + target.setReplyLc("0"); + target.setUseAt("Y"); + + list.add(target); + + boardVO.setSearchWrd(""); + + int totCnt = list.size(); + + //공지사항 추출 + List noticeList = egovArticleService.selectNoticeArticleList(boardVO); + + paginationInfo.setTotalRecordCount(totCnt); + + master.setTmplatCours(template); + + model.addAttribute("resultList", list); + model.addAttribute("resultCnt", Integer.toString(totCnt)); + model.addAttribute("articleVO", boardVO); + model.addAttribute("boardMasterVO", master); + model.addAttribute("paginationInfo", paginationInfo); + model.addAttribute("noticeList", noticeList); + + model.addAttribute("preview", "true"); + + return "egovframework/com/cop/bbs/EgovArticleList"; + } + + /** + * 미리보기 커뮤니티 메인페이지를 조회한다. + * + * @param cmmntyVO + * @param sessionVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/bbs/previewBlogMainPage.do") + public String previewBlogMainPage(@ModelAttribute("searchVO") BoardVO boardVO, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); //KISA 보안취약점 조치 (2018-12-10, 이정은) + + String tmplatCours = boardVO.getSearchWrd(); + + BlogVO master = new BlogVO(); + master.setBlogNm("미리보기 블로그"); + master.setBlogIntrcn("미리보기를 위한 블로그입니다."); + master.setUseAt("Y"); + master.setFrstRegisterId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + + boardVO.setFrstRegisterId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + + //블로그 카테고리관리 권한(로그인 한 사용자만 가능) + int loginUserCnt = egovArticleService.selectLoginUser(boardVO); + + //블로그 게시판 제목 추출 + List blogNameList = new ArrayList(); + + BoardVO target = null; + target = new BoardVO(); + target.setBbsNm("블로그게시판#1"); + + blogNameList.add(target); + + + if(user != null) { + model.addAttribute("sessionUniqId", user.getUniqId()); + } + + model.addAttribute("articleVO", boardVO); + model.addAttribute("boardMasterVO", master); + model.addAttribute("blogNameList", blogNameList); + model.addAttribute("loginUserCnt", 1); + + model.addAttribute("preview", "true"); + + // 안전한 경로 문자열로 조치 + tmplatCours = EgovWebUtil.filePathBlackList(tmplatCours); + + // 화이트 리스트 체크 + List templateWhiteList = egovTemplateManageService.selectTemplateWhiteList(); + LOGGER.debug("Template > WhiteList Count = {}",templateWhiteList.size()); + if ( tmplatCours == null ) tmplatCours = ""; + for(TemplateInfVO templateInfVO : templateWhiteList){ + LOGGER.debug("Template > whiteList TmplatCours = "+templateInfVO.getTmplatCours()); + if ( tmplatCours.equals(templateInfVO.getTmplatCours()) ) { + return tmplatCours; + } + } + + LOGGER.debug("Template > WhiteList mismatch! Please check Admin page!"); + return "egovframework/com/cmm/egovError"; + } + + +} diff --git a/src/main/java/egovframework/com/cop/bbs/web/EgovBBSMasterController.java b/src/main/java/egovframework/com/cop/bbs/web/EgovBBSMasterController.java new file mode 100644 index 0000000..2c8c568 --- /dev/null +++ b/src/main/java/egovframework/com/cop/bbs/web/EgovBBSMasterController.java @@ -0,0 +1,518 @@ +package egovframework.com.cop.bbs.web; + +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +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.springframework.web.servlet.ModelAndView; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import egovframework.com.cmm.ComDefaultCodeVO; +import egovframework.com.cmm.EgovComponentChecker; +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.service.EgovCmmUseService; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.cop.bbs.service.Blog; +import egovframework.com.cop.bbs.service.BlogUserVO; +import egovframework.com.cop.bbs.service.BlogVO; +import egovframework.com.cop.bbs.service.BoardMaster; +import egovframework.com.cop.bbs.service.BoardMasterVO; +import egovframework.com.cop.bbs.service.EgovBBSMasterService; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + + +/** + * 게시판 속성관리를 위한 컨트롤러 클래스 + * @author 공통서비스개발팀 이삼섭 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------       --------    ---------------------------
    + *   2009.3.12  이삼섭          최초 생성
    + *   2009.06.26	한성곤		    2단계 기능 추가 (댓글관리, 만족도조사)
    + *	 2011.07.21 안민정          커뮤니티 관련 메소드 분리 (->EgovBBSAttributeManageController)
    + *	 2011.8.26	정진오			IncludedInfo annotation 추가
    + *   2011.09.15 서준식           2단계 기능 추가 (댓글관리, 만족도조사) 적용방법 변경
    + *   2016.06.13 김연호          표준프레임워크 v3.6 개선
    + * 
    + */ + +@Controller +public class EgovBBSMasterController { + + @Resource(name = "EgovBBSMasterService") + private EgovBBSMasterService egovBBSMasterService; + + @Resource(name = "EgovCmmUseService") + private EgovCmmUseService cmmUseService; + + @Resource(name = "propertiesService") + protected EgovPropertyService propertyService; + + @Resource(name = "egovBBSMstrIdGnrService") + private EgovIdGnrService idgenServiceBbs; + + @Resource(name = "egovBlogIdGnrService") + private EgovIdGnrService idgenServiceBlog; + + /** EgovMessageSource */ + @Resource(name = "egovMessageSource") + EgovMessageSource egovMessageSource; + + + + @Autowired + private DefaultBeanValidator beanValidator; + + //Logger log = Logger.getLogger(this.getClass()); + + /** + * 신규 게시판 마스터 등록을 위한 등록페이지로 이동한다. + * + * @param boardMasterVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/bbs/insertBBSMasterView.do") + public String insertBBSMasterView(@ModelAttribute("searchVO") BoardMasterVO boardMasterVO, ModelMap model) throws Exception { + BoardMasterVO boardMaster = new BoardMasterVO(); + //공통코드(게시판유형) + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM101"); + List codeResult = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("bbsTyCode", codeResult); + model.addAttribute("boardMasterVO", boardMaster); + + + //--------------------------------- + // 2011.09.15 : 2단계 기능 추가 반영 방법 변경 + //--------------------------------- + + + if(EgovComponentChecker.hasComponent("EgovArticleCommentService")){ + model.addAttribute("useComment", "true"); + } + if(EgovComponentChecker.hasComponent("EgovBBSSatisfactionService")){ + model.addAttribute("useSatisfaction", "true"); + } + + return "egovframework/com/cop/bbs/EgovBBSMasterRegist"; + } + + /** + * 신규 게시판 마스터 정보를 등록한다. + * + * @param boardMasterVO + * @param boardMaster + * @param status + * @return + * @throws Exception + */ + @RequestMapping("/cop/bbs/insertBBSMaster.do") + public String insertBBSMaster(@ModelAttribute("searchVO") BoardMasterVO boardMasterVO, @ModelAttribute("boardMaster") BoardMaster boardMaster, + BindingResult bindingResult, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + beanValidator.validate(boardMaster, bindingResult); + if (bindingResult.hasErrors()) { + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + + //게시판유형코드 + vo.setCodeId("COM101"); + List codeResult = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("bbsTyCode", codeResult); + + return "egovframework/com/cop/bbs/EgovBBSMasterRegist"; + } + + if (isAuthenticated) { + boardMaster.setFrstRegisterId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + if((boardMasterVO == null ? "" : EgovStringUtil.isNullToString(boardMasterVO.getBlogAt())).equals("Y")){ + boardMaster.setBlogAt("Y"); + }else{ + boardMaster.setBlogAt("N"); + } + egovBBSMasterService.insertBBSMasterInf(boardMaster); + } + if(boardMaster.getBlogAt().equals("Y")){ + return "forward:/cop/bbs/selectArticleBlogList.do"; + }else{ + return "forward:/cop/bbs/selectBBSMasterInfs.do"; + } + + } + + /** + * 게시판 마스터 목록을 조회한다. + * + * @param boardMasterVO + * @param model + * @return + * @throws Exception + */ + @IncludedInfo(name="게시판관리",order = 180 ,gid = 40) + @RequestMapping("/cop/bbs/selectBBSMasterInfs.do") + public String selectBBSMasterInfs(@ModelAttribute("searchVO") BoardMasterVO boardMasterVO, ModelMap model) throws Exception { + 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 map = egovBBSMasterService.selectBBSMasterInfs(boardMasterVO); + int totCnt = Integer.parseInt((String)map.get("resultCnt")); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList", map.get("resultList")); + model.addAttribute("resultCnt", map.get("resultCnt")); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/cop/bbs/EgovBBSMasterList"; + } + + /** + * 블로그에 대한 목록을 조회한다. + * + * @param blogVO + * @param model + * @return + * @throws Exception + */ + @IncludedInfo(name="블로그관리", order = 170 ,gid = 40) + @RequestMapping("/cop/bbs/selectBlogList.do") + public String selectBlogMasterList(@ModelAttribute("searchVO") BoardMasterVO boardMasterVO, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + //KISA 보안취약점 조치 (2018-12-10, 신용호) + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if(!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + 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.setFrstRegisterId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + + Map map = egovBBSMasterService.selectBlogMasterInfs(boardMasterVO); + int totCnt = Integer.parseInt((String)map.get("resultCnt")); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList", map.get("resultList")); + model.addAttribute("resultCnt", map.get("resultCnt")); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/cop/bbs/EgovBlogList"; + } + + /** + * 블로그 등록을 위한 등록페이지로 이동한다. + * + * @param blogVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/bbs/insertBlogMasterView.do") + public String insertBlogMasterView(@ModelAttribute("searchVO") BlogVO blogVO, ModelMap model) throws Exception { + model.addAttribute("blogMasterVO", new BlogVO()); + return "egovframework/com/cop/bbs/EgovBlogRegist"; + } + + /** + * 블로그 생성 유무를 판단한다. + * + * @param blogVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/bbs/selectChkBloguser.do") + public ModelAndView chkBlogUser(@ModelAttribute("searchVO") BlogVO blogVO, ModelMap model) throws Exception { + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + // KISA 보안취약점 조치 (2018-12-10, 신용호) + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if(!isAuthenticated) { + throw new IllegalAccessException("Login Required!"); + } + + model.addAttribute("blogMasterVO", new BlogVO()); + + String userVal=""; + blogVO.setFrstRegisterId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + userVal = egovBBSMasterService.checkBlogUser(blogVO); + + ModelAndView mav = new ModelAndView("jsonView"); + mav.addObject("userChk", userVal); + return mav; + } + + /** + * 블로그 정보를 등록한다. + * + * @param blogVO + * @param blog + * @param status + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/bbs/insertBlogMaster.do") + public String insertBlogMaster(@ModelAttribute("searchVO") BlogVO blogVO, @ModelAttribute("blogMaster") Blog blog, + BindingResult bindingResult, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if(!isAuthenticated) { //KISA 보안약점 조치 (2018-12-10, 신용호) + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + blogVO.setFrstRegisterId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + BlogVO vo = egovBBSMasterService.checkBlogUser2(blogVO); + + if(vo != null) { + model.addAttribute("blogMasterVO", new BlogVO()); + model.addAttribute("message", egovMessageSource.getMessage("comCopBlog.validate.blogUserCheck")); + return "egovframework/com/cop/bbs/EgovBlogRegist"; + } + + beanValidator.validate(blog, bindingResult); + + if (bindingResult.hasErrors()) { + return "egovframework/com/cop/bbs/EgovBlogRegist"; + } + + String blogId = idgenServiceBlog.getNextStringId(); //블로그 아이디 채번 + String bbsId = idgenServiceBbs.getNextStringId(); //게시판 아이디 채번 + + blog.setRegistSeCode("REGC02"); + blog.setFrstRegisterId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + blog.setBbsId(bbsId); + blog.setBlogId(blogId); + blog.setBlogAt("Y"); + egovBBSMasterService.insertBlogMaster(blog); + + if (isAuthenticated) { + //블로그 개설자의 정보를 등록한다. + BlogUserVO blogUserVO = new BlogUserVO(); + blogUserVO.setBlogId(blogId); + blogUserVO.setEmplyrId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + blogUserVO.setMngrAt("Y"); + blogUserVO.setMberSttus("P"); + blogUserVO.setUseAt("Y"); + blogUserVO.setFrstRegisterId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + + egovBBSMasterService.insertBoardBlogUserRqst(blogUserVO); + } + return "forward:/cop/bbs/selectBlogList.do"; + } + + /** + * 게시판 마스터 상세내용을 조회한다. + * + * @param boardMasterVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/bbs/selectBBSMasterDetail.do") + public String selectBBSMasterDetail(@ModelAttribute("searchVO") BoardMasterVO searchVO, ModelMap model) throws Exception { + BoardMasterVO vo = egovBBSMasterService.selectBBSMasterInf(searchVO); + model.addAttribute("result", vo); + + //--------------------------------- + // 2011.09.15 : 2단계 기능 추가 반영 방법 변경 + //--------------------------------- + + if(EgovComponentChecker.hasComponent("EgovArticleCommentService")){ + model.addAttribute("useComment", "true"); + } + if(EgovComponentChecker.hasComponent("EgovBBSSatisfactionService")){ + model.addAttribute("useSatisfaction", "true"); + } + + return "egovframework/com/cop/bbs/EgovBBSMasterDetail"; + } + + /** + * 게시판 마스터정보를 수정하기 위한 전 처리 + * @param bbsId + * @param searchVO + * @param model + * @throws Exception + */ + @RequestMapping("/cop/bbs/updateBBSMasterView.do") + public String updateBBSMasterView(@RequestParam("bbsId") String bbsId , + @ModelAttribute("searchVO") BoardMaster searchVO, ModelMap model) + throws Exception { + + + BoardMasterVO boardMasterVO = new BoardMasterVO(); + + + //게시판유형코드 + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM101"); + List codeResult = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("bbsTyCode", codeResult); + + // Primary Key 값 세팅 + boardMasterVO.setBbsId(bbsId); + + model.addAttribute("boardMasterVO", egovBBSMasterService.selectBBSMasterInf(boardMasterVO)); + + //--------------------------------- + // 2011.09.15 : 2단계 기능 추가 반영 방법 변경 + //--------------------------------- + + if(EgovComponentChecker.hasComponent("EgovArticleCommentService")){ + model.addAttribute("useComment", "true"); + } + if(EgovComponentChecker.hasComponent("EgovBBSSatisfactionService")){ + model.addAttribute("useSatisfaction", "true"); + } + + return "egovframework/com/cop/bbs/EgovBBSMasterUpdt"; + } + + + /** + * 게시판 마스터 정보를 수정한다. + * + * @param boardMasterVO + * @param boardMaster + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/bbs/updateBBSMaster.do") + public String updateBBSMaster(@ModelAttribute("searchVO") BoardMasterVO boardMasterVO, @ModelAttribute("boardMaster") BoardMaster boardMaster, + BindingResult bindingResult, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + beanValidator.validate(boardMaster, bindingResult); + if (bindingResult.hasErrors()) { + BoardMasterVO vo = egovBBSMasterService.selectBBSMasterInf(boardMasterVO); + + model.addAttribute("result", vo); + + ComDefaultCodeVO comVo = new ComDefaultCodeVO(); + comVo.setCodeId("COM101"); + List codeResult = cmmUseService.selectCmmCodeDetail(comVo); + model.addAttribute("bbsTyCode", codeResult); + + return "egovframework/com/cop/bbs/EgovBBSMasterUpdt"; + } + + if (isAuthenticated) { + boardMaster.setLastUpdusrId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + egovBBSMasterService.updateBBSMasterInf(boardMaster); + } + + return "forward:/cop/bbs/selectBBSMasterInfs.do"; + } + + /** + * 게시판 마스터 정보를 삭제한다. + * + * @param boardMasterVO + * @param boardMaster + * @param status + * @return + * @throws Exception + */ + @RequestMapping("/cop/bbs/deleteBBSMaster.do") + public String deleteBBSMaster(@ModelAttribute("searchVO") BoardMasterVO boardMasterVO, @ModelAttribute("boardMaster") BoardMaster boardMaster + ) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if (isAuthenticated) { + boardMaster.setLastUpdusrId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + egovBBSMasterService.deleteBBSMasterInf(boardMaster); + } + // status.setComplete(); + return "forward:/cop/bbs/selectBBSMasterInfs.do"; + } + + /** + * 포트릿을 위한 블로그 목록 정보를 조회한다. + * + * @param blogVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/bbs/selectBlogListPortlet.do") + public String selectBlogListPortlet(@ModelAttribute("searchVO") BlogVO blogVO, ModelMap model) throws Exception { + List result = egovBBSMasterService.selectBlogListPortlet(blogVO); + + model.addAttribute("resultList", result); + + return "egovframework/com/cop/bbs/EgovBlogListPortlet"; + } + + /** + * 포트릿을 위한 게시판 목록 정보를 조회한다. + * + * @param blogVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/bbs/selectBBSListPortlet.do") + public String selectBBSListPortlet(@ModelAttribute("searchVO") BoardMasterVO boardMasterVO, ModelMap model) throws Exception { + List result = egovBBSMasterService.selectBBSListPortlet(boardMasterVO); + + model.addAttribute("resultList", result); + + return "egovframework/com/cop/bbs/EgovBBSListPortlet"; + } + + +} diff --git a/src/main/java/egovframework/com/cop/cmt/service/Comment.java b/src/main/java/egovframework/com/cop/cmt/service/Comment.java new file mode 100644 index 0000000..20ff495 --- /dev/null +++ b/src/main/java/egovframework/com/cop/cmt/service/Comment.java @@ -0,0 +1,297 @@ +package egovframework.com.cop.cmt.service; + +import java.io.Serializable; + +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * 댓글관리 서비스 데이터 처리 모델 + * @author 공통컴포넌트개발팀 한성곤 + * @since 2009.06.29 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.06.29  한성곤          최초 생성
    + *	
    + * 
    + */ +@SuppressWarnings("serial") +public class Comment implements Serializable { + /** 댓글번호 */ + private String commentNo = ""; + + /** 게시판 ID */ + private String bbsId = ""; + + /** 게시물 번호 */ + private long nttId = 0L; + + /** 작성자 ID */ + private String wrterId = ""; + + /** 작성자명 */ + private String wrterNm = ""; + + /** 패스워드 */ + private String commentPassword = ""; + + /** 댓글 내용 */ + private String commentCn = ""; + + /** 사용 여부 */ + private String useAt = ""; + + /** 최초등록자 아이디 */ + private String frstRegisterId = ""; + + /** 최초 등록자명 */ + private String frstRegisterNm = ""; + + /** 최초등록시점 */ + private String frstRegisterPnttm = ""; + + /** 최종수정자 아이디 */ + private String lastUpdusrId = ""; + + /** 최종수정시점 */ + private String lastUpdusrPnttm = ""; + + /** 확인 패스워드 */ + private String confirmPassword = ""; + + /** + * commentNo attribute를 리턴한다. + * @return the commentNo + */ + public String getCommentNo() { + return commentNo; + } + + /** + * commentNo attribute 값을 설정한다. + * @param commentNo the commentNo to set + */ + public void setCommentNo(String commentNo) { + this.commentNo = commentNo; + } + + /** + * bbsId attribute를 리턴한다. + * @return the bbsId + */ + public String getBbsId() { + return bbsId; + } + + /** + * bbsId attribute 값을 설정한다. + * @param bbsId the bbsId to set + */ + public void setBbsId(String bbsId) { + this.bbsId = bbsId; + } + + /** + * nttId attribute를 리턴한다. + * @return the nttId + */ + public long getNttId() { + return nttId; + } + + /** + * nttId attribute 값을 설정한다. + * @param nttId the nttId to set + */ + public void setNttId(long nttId) { + this.nttId = nttId; + } + + /** + * wrterId attribute를 리턴한다. + * @return the wrterId + */ + public String getWrterId() { + return wrterId; + } + + /** + * wrterId attribute 값을 설정한다. + * @param wrterId the wrterId to set + */ + public void setWrterId(String wrterId) { + this.wrterId = wrterId; + } + + /** + * wrterNm attribute를 리턴한다. + * @return the wrterNm + */ + public String getWrterNm() { + return wrterNm; + } + + /** + * wrterNm attribute 값을 설정한다. + * @param wrterNm the wrterNm to set + */ + public void setWrterNm(String wrterNm) { + this.wrterNm = wrterNm; + } + + /** + * commentPassword attribute를 리턴한다. + * @return the commentPassword + */ + public String getCommentPassword() { + return commentPassword; + } + + /** + * commentPassword attribute 값을 설정한다. + * @param commentPassword the commentPassword to set + */ + public void setCommentPassword(String commentPassword) { + this.commentPassword = commentPassword; + } + + /** + * commentCn attribute를 리턴한다. + * @return the commentCn + */ + public String getCommentCn() { + return commentCn; + } + + /** + * commentCn attribute 값을 설정한다. + * @param commentCn the commentCn to set + */ + public void setCommentCn(String commentCn) { + this.commentCn = commentCn; + } + + /** + * useAt attribute를 리턴한다. + * @return the useAt + */ + public String getUseAt() { + return useAt; + } + + /** + * useAt attribute 값을 설정한다. + * @param useAt the useAt to set + */ + public void setUseAt(String useAt) { + this.useAt = useAt; + } + + /** + * frstRegisterId attribute를 리턴한다. + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * frstRegisterId attribute 값을 설정한다. + * @param frstRegisterId the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * frstRegisterPnttm attribute를 리턴한다. + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * frstRegisterPnttm attribute 값을 설정한다. + * @param frstRegisterPnttm the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * lastUpdusrId attribute를 리턴한다. + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * lastUpdusrId attribute 값을 설정한다. + * @param lastUpdusrId the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + /** + * lastUpdusrPnttm attribute를 리턴한다. + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * lastUpdusrPnttm attribute 값을 설정한다. + * @param lastUpdusrPnttm the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * frstRegisterNm attribute를 리턴한다. + * @return the frstRegisterNm + */ + public String getFrstRegisterNm() { + return frstRegisterNm; + } + + /** + * frstRegisterNm attribute 값을 설정한다. + * @param frstRegisterNm the frstRegisterNm to set + */ + public void setFrstRegisterNm(String frstRegisterNm) { + this.frstRegisterNm = frstRegisterNm; + } + + /** + * confirmPassword attribute를 리턴한다. + * @return the confirmPassword + */ + public String getConfirmPassword() { + return confirmPassword; + } + + /** + * confirmPassword attribute 값을 설정한다. + * @param confirmPassword the confirmPassword to set + */ + public void setConfirmPassword(String confirmPassword) { + this.confirmPassword = confirmPassword; + } + + /** + * toString 메소드를 대치한다. + */ + public String toString() { + return ToStringBuilder.reflectionToString(this); + } +} diff --git a/src/main/java/egovframework/com/cop/cmt/service/CommentVO.java b/src/main/java/egovframework/com/cop/cmt/service/CommentVO.java new file mode 100644 index 0000000..7ee4501 --- /dev/null +++ b/src/main/java/egovframework/com/cop/cmt/service/CommentVO.java @@ -0,0 +1,219 @@ +package egovframework.com.cop.cmt.service; + +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * 댓글관리 서비스를 위한 VO 클래스 + * @author 공통컴포넌트개발팀 한성곤 + * @since 2009.06.29 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.06.29  한성곤          최초 생성
    + *
    + * 
    + */ +@SuppressWarnings("serial") +public class CommentVO extends Comment { + /** 정렬순서(DESC,ASC) */ + private long sortOrdr = 0L; + + /** 현재페이지 */ + private int subPageIndex = 1; + + /** 페이지갯수 */ + private int subPageUnit = 5; + + /** 페이지사이즈 */ + private int subPageSize = 5; + + /** 첫페이지 인덱스 */ + private int subFirstIndex = 1; + + /** 마지막페이지 인덱스 */ + private int subLastIndex = 1; + + /** 페이지당 레코드 개수 */ + private int subRecordCountPerPage = 5; + + /** 레코드 번호 */ + private int subRowNo = 0; + + /** 호출 TYPE (head or body)*/ + private String type = ""; + + /** 수정 처리 여부 */ + private boolean isModified = false; + + /** + * sortOrdr attribute를 리턴한다. + * @return the sortOrdr + */ + public long getSortOrdr() { + return sortOrdr; + } + + /** + * sortOrdr attribute 값을 설정한다. + * @param sortOrdr the sortOrdr to set + */ + public void setSortOrdr(long sortOrdr) { + this.sortOrdr = sortOrdr; + } + + /** + * subPageIndex attribute를 리턴한다. + * @return the subPageIndex + */ + public int getSubPageIndex() { + return subPageIndex; + } + + /** + * subPageIndex attribute 값을 설정한다. + * @param subPageIndex the subPageIndex to set + */ + public void setSubPageIndex(int subPageIndex) { + this.subPageIndex = subPageIndex; + } + + /** + * subPageUnit attribute를 리턴한다. + * @return the subPageUnit + */ + public int getSubPageUnit() { + return subPageUnit; + } + + /** + * subPageUnit attribute 값을 설정한다. + * @param subPageUnit the subPageUnit to set + */ + public void setSubPageUnit(int subPageUnit) { + this.subPageUnit = subPageUnit; + } + + /** + * subPageSize attribute를 리턴한다. + * @return the subPageSize + */ + public int getSubPageSize() { + return subPageSize; + } + + /** + * subPageSize attribute 값을 설정한다. + * @param subPageSize the subPageSize to set + */ + public void setSubPageSize(int subPageSize) { + this.subPageSize = subPageSize; + } + + /** + * subFirstIndex attribute를 리턴한다. + * @return the subFirstIndex + */ + public int getSubFirstIndex() { + return subFirstIndex; + } + + /** + * subFirstIndex attribute 값을 설정한다. + * @param subFirstIndex the subFirstIndex to set + */ + public void setSubFirstIndex(int subFirstIndex) { + this.subFirstIndex = subFirstIndex; + } + + /** + * subLastIndex attribute를 리턴한다. + * @return the subLastIndex + */ + public int getSubLastIndex() { + return subLastIndex; + } + + /** + * subLastIndex attribute 값을 설정한다. + * @param subLastIndex the subLastIndex to set + */ + public void setSubLastIndex(int subLastIndex) { + this.subLastIndex = subLastIndex; + } + + /** + * subRecordCountPerPage attribute를 리턴한다. + * @return the subRecordCountPerPage + */ + public int getSubRecordCountPerPage() { + return subRecordCountPerPage; + } + + /** + * subRecordCountPerPage attribute 값을 설정한다. + * @param subRecordCountPerPage the subRecordCountPerPage to set + */ + public void setSubRecordCountPerPage(int subRecordCountPerPage) { + this.subRecordCountPerPage = subRecordCountPerPage; + } + + /** + * subRowNo attribute를 리턴한다. + * @return the subRowNo + */ + public int getSubRowNo() { + return subRowNo; + } + + /** + * subRowNo attribute 값을 설정한다. + * @param subRowNo the subRowNo to set + */ + public void setSubRowNo(int subRowNo) { + this.subRowNo = subRowNo; + } + + /** + * type attribute를 리턴한다. + * @return the type + */ + public String getType() { + return type; + } + + /** + * type attribute 값을 설정한다. + * @param type the type to set + */ + public void setType(String type) { + this.type = type; + } + + /** + * isModified attribute를 리턴한다. + * @return the isModified + */ + public boolean isModified() { + return isModified; + } + + /** + * isModified attribute 값을 설정한다. + * @param isModified the isModified to set + */ + public void setModified(boolean isModified) { + this.isModified = isModified; + } + + /** + * toString 메소드를 대치한다. + */ + public String toString() { + return ToStringBuilder.reflectionToString(this); + } +} diff --git a/src/main/java/egovframework/com/cop/cmt/service/EgovArticleCommentService.java b/src/main/java/egovframework/com/cop/cmt/service/EgovArticleCommentService.java new file mode 100644 index 0000000..e1df72e --- /dev/null +++ b/src/main/java/egovframework/com/cop/cmt/service/EgovArticleCommentService.java @@ -0,0 +1,21 @@ +package egovframework.com.cop.cmt.service; + +import java.util.Map; + +import org.egovframe.rte.fdl.cmmn.exception.FdlException; + +public interface EgovArticleCommentService { + + public boolean canUseComment(String bbsId) throws Exception; + + Map selectArticleCommentList(CommentVO commentVO); + + void insertArticleComment(Comment comment) throws FdlException; + + void deleteArticleComment(CommentVO commentVO); + + CommentVO selectArticleCommentDetail(CommentVO commentVO); + + void updateArticleComment(Comment comment); + +} diff --git a/src/main/java/egovframework/com/cop/cmt/service/impl/EgovArticleCommentDAO.java b/src/main/java/egovframework/com/cop/cmt/service/impl/EgovArticleCommentDAO.java new file mode 100644 index 0000000..c07f75f --- /dev/null +++ b/src/main/java/egovframework/com/cop/cmt/service/impl/EgovArticleCommentDAO.java @@ -0,0 +1,38 @@ +package egovframework.com.cop.cmt.service.impl; + +import java.util.List; + +import org.springframework.stereotype.Repository; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.cop.cmt.service.Comment; +import egovframework.com.cop.cmt.service.CommentVO; + +@Repository("EgovArticleCommentDAO") +public class EgovArticleCommentDAO extends EgovComAbstractDAO{ + + public List selectArticleCommentList(CommentVO commentVO) { + return list("ArticleComment.selectArticleCommentList", commentVO); + } + + public int selectArticleCommentListCnt(CommentVO commentVO) { + return (Integer)selectOne("ArticleComment.selectArticleCommentListCnt", commentVO); + } + + public void insertArticleComment(Comment comment) { + insert("ArticleComment.insertArticleComment", comment); + } + + public void deleteArticleComment(CommentVO commentVO) { + update("ArticleComment.deleteArticleComment", commentVO); + } + + public CommentVO selectArticleCommentDetail(CommentVO commentVO) { + return (CommentVO) selectOne("ArticleComment.selectArticleCommentDetail", commentVO); + } + + public void updateArticleComment(Comment comment) { + update("ArticleComment.updateArticleComment", comment); + } + +} diff --git a/src/main/java/egovframework/com/cop/cmt/service/impl/EgovArticleCommentServiceImpl.java b/src/main/java/egovframework/com/cop/cmt/service/impl/EgovArticleCommentServiceImpl.java new file mode 100644 index 0000000..db565a3 --- /dev/null +++ b/src/main/java/egovframework/com/cop/cmt/service/impl/EgovArticleCommentServiceImpl.java @@ -0,0 +1,95 @@ +package egovframework.com.cop.cmt.service.impl; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import egovframework.com.cop.bbs.service.BoardMaster; +import egovframework.com.cop.bbs.service.BoardMasterVO; +import egovframework.com.cop.bbs.service.impl.BBSAddedOptionsDAO; +import egovframework.com.cop.cmt.service.Comment; +import egovframework.com.cop.cmt.service.CommentVO; +import egovframework.com.cop.cmt.service.EgovArticleCommentService; +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.cmmn.exception.FdlException; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +@Service("EgovArticleCommentService") +public class EgovArticleCommentServiceImpl extends EgovAbstractServiceImpl implements EgovArticleCommentService { + + @Resource(name = "BBSAddedOptionsDAO") + private BBSAddedOptionsDAO addedOptionsDAO; + + @Resource(name = "EgovArticleCommentDAO") + private EgovArticleCommentDAO egovArticleCommentDao; + + @Resource(name = "egovAnswerNoGnrService") + private EgovIdGnrService egovAnswerNoGnrService; + + /** + * 댓글 사용 가능 여부를 확인한다. + */ + public boolean canUseComment(String bbsId) throws Exception { + //String flag = EgovProperties.getProperty("Globals.addedOptions"); + //if (flag != null && flag.trim().equalsIgnoreCase("true")) {//2011.09.15 + BoardMaster vo = new BoardMaster(); + + vo.setBbsId(bbsId); + + BoardMasterVO options = addedOptionsDAO.selectAddedOptionsInf(vo); + + if (options == null) { + return false; + } + + if (options.getCommentAt().equals("Y")) { + return true; + } + //} + + return false; + } + + @Override + public Map selectArticleCommentList(CommentVO commentVO) { + List result = egovArticleCommentDao.selectArticleCommentList(commentVO); + int cnt = egovArticleCommentDao.selectArticleCommentListCnt(commentVO); + + Map map = new HashMap(); + + map.put("resultList", result); + map.put("resultCnt", Integer.toString(cnt)); + + return map; + } + + + @Override + public void insertArticleComment(Comment comment) throws FdlException { + comment.setCommentNo(egovAnswerNoGnrService.getNextLongId() + "");//2011.10.18 + egovArticleCommentDao.insertArticleComment(comment); + } + + + @Override + public void deleteArticleComment(CommentVO commentVO) { + egovArticleCommentDao.deleteArticleComment(commentVO); + } + + + @Override + public CommentVO selectArticleCommentDetail(CommentVO commentVO) { + return egovArticleCommentDao.selectArticleCommentDetail(commentVO); + } + + + @Override + public void updateArticleComment(Comment comment) { + egovArticleCommentDao.updateArticleComment(comment); + } + +} diff --git a/src/main/java/egovframework/com/cop/cmt/web/EgovArticleCommentController.java b/src/main/java/egovframework/com/cop/cmt/web/EgovArticleCommentController.java new file mode 100644 index 0000000..dddbd1b --- /dev/null +++ b/src/main/java/egovframework/com/cop/cmt/web/EgovArticleCommentController.java @@ -0,0 +1,298 @@ +package egovframework.com.cop.cmt.web; + +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Resource; + +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 egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.cop.cmt.service.Comment; +import egovframework.com.cop.cmt.service.CommentVO; +import egovframework.com.cop.cmt.service.EgovArticleCommentService; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +/** + * 댓글 관리를 위한 컨트롤러 클래스 + * @author 공통서비스개발팀 신용호 + * @since 2016.07.22 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------       --------    ---------------------------
    + *   2016.07.22   신용호              최초 생성
    + *   2018.06.27     신용호		    댓글 등록후 처리 예외 수정
    + * 
    + */ + +@Controller +public class EgovArticleCommentController { + + @Resource(name = "EgovArticleCommentService") + protected EgovArticleCommentService egovArticleCommentService; + + @Resource(name="propertiesService") + protected EgovPropertyService propertyService; + + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Autowired + private DefaultBeanValidator beanValidator; + + //protected Logger log = Logger.getLogger(this.getClass()); + + /** + * 댓글관리 목록 조회를 제공한다. + * + * @param boardVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/cmt/selectArticleCommentList.do") + public String selectArticleCommentList(@ModelAttribute("searchVO") CommentVO commentVO, ModelMap model) throws Exception { + + CommentVO articleCommentVO = new CommentVO(); + + // 수정 처리된 후 댓글 등록 화면으로 처리되기 위한 구현 + if (commentVO.isModified()) { + commentVO.setCommentNo(""); + commentVO.setCommentCn(""); + } + + // 수정을 위한 처리 + if (!commentVO.getCommentNo().equals("")) { + return "forward:/cop/cmt/updateArticleCommentView.do"; + } + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + // KISA 보안취약점 조치 (2018-12-10, 신용호) + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if(!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + model.addAttribute("sessionUniqId", user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + + commentVO.setWrterNm(user == null ? "" : EgovStringUtil.isNullToString(user.getName())); + +// commentVO.setSubPageUnit(propertyService.getInt("pageUnit")); +// commentVO.setSubPageSize(propertyService.getInt("pageSize")); + + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(commentVO.getSubPageIndex()); + paginationInfo.setRecordCountPerPage(commentVO.getSubPageUnit()); + paginationInfo.setPageSize(commentVO.getSubPageSize()); + + commentVO.setSubFirstIndex(paginationInfo.getFirstRecordIndex()); + commentVO.setSubLastIndex(paginationInfo.getLastRecordIndex()); + commentVO.setSubRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + Map map = egovArticleCommentService.selectArticleCommentList(commentVO); + int totCnt = Integer.parseInt((String)map.get("resultCnt")); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList", map.get("resultList")); + model.addAttribute("resultCnt", map.get("resultCnt")); + model.addAttribute("paginationInfo", paginationInfo); + model.addAttribute("type", "body"); // 댓글 페이지 body import용 + + model.addAttribute("articleCommentVO", articleCommentVO); // validator 용도 + + commentVO.setCommentCn(""); // 등록 후 댓글 내용 처리 + + return "egovframework/com/cop/cmt/EgovArticleCommentList"; + } + + + /** + * 댓글을 등록한다. + * + * @param commentVO + * @param comment + * @param bindingResult + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/cmt/insertArticleComment.do") + public String insertArticleComment(@ModelAttribute("searchVO") CommentVO commentVO, @ModelAttribute("comment") Comment comment, + BindingResult bindingResult, ModelMap model, @RequestParam HashMap map) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + beanValidator.validate(comment, bindingResult); + if (bindingResult.hasErrors()) { + model.addAttribute("msg", "댓글내용은 필수 입력값입니다."); + + return "forward:/cop/bbs/selectArticleDetail.do"; + } + + if (isAuthenticated) { + comment.setFrstRegisterId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + comment.setWrterId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + comment.setWrterNm(user == null ? "" : EgovStringUtil.isNullToString(user.getName())); + + + egovArticleCommentService.insertArticleComment(comment); + + commentVO.setCommentCn(""); + commentVO.setCommentNo(""); + } + + String chkBlog = map.get("blogAt"); + + if("Y".equals(chkBlog)){ + return "forward:/cop/bbs/selectArticleBlogList.do"; + }else{ + return "forward:/cop/bbs/selectArticleDetail.do"; + } + + } + + + /** + * 댓글을 삭제한다. + * + * @param commentVO + * @param comment + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/cmt/deleteArticleComment.do") + public String deleteArticleComment(@ModelAttribute("searchVO") CommentVO commentVO, @ModelAttribute("comment") Comment comment, + ModelMap model, @RequestParam HashMap map) throws Exception { + @SuppressWarnings("unused") + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if (isAuthenticated) { + egovArticleCommentService.deleteArticleComment(commentVO); + } + + commentVO.setCommentCn(""); + commentVO.setCommentNo(""); + + String chkBlog = map.get("blogAt"); + + if("Y".equals(chkBlog)){ + return "forward:/cop/bbs/selectArticleBlogList.do"; + }else{ + return "forward:/cop/bbs/selectArticleDetail.do"; + } + } + + + /** + * 댓글 수정 페이지로 이동한다. + * + * @param commentVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/cmt/updateArticleCommentView.do") + public String updateArticleCommentView(@ModelAttribute("searchVO") CommentVO commentVO, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + //KISA 보안취약점 조치 (2018-12-10, 신용호) + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if(!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + CommentVO articleCommentVO = new CommentVO(); + + commentVO.setWrterNm(user == null ? "" : EgovStringUtil.isNullToString(user.getName())); + + commentVO.setSubPageUnit(propertyService.getInt("pageUnit")); + commentVO.setSubPageSize(propertyService.getInt("pageSize")); + + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(commentVO.getSubPageIndex()); + paginationInfo.setRecordCountPerPage(commentVO.getSubPageUnit()); + paginationInfo.setPageSize(commentVO.getSubPageSize()); + + commentVO.setSubFirstIndex(paginationInfo.getFirstRecordIndex()); + commentVO.setSubLastIndex(paginationInfo.getLastRecordIndex()); + commentVO.setSubRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + Map map = egovArticleCommentService.selectArticleCommentList(commentVO); + int totCnt = Integer.parseInt((String)map.get("resultCnt")); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList", map.get("resultList")); + model.addAttribute("resultCnt", map.get("resultCnt")); + model.addAttribute("paginationInfo", paginationInfo); + model.addAttribute("type", "body"); // body import + + articleCommentVO = egovArticleCommentService.selectArticleCommentDetail(commentVO); + + model.addAttribute("articleCommentVO", articleCommentVO); + + + return "egovframework/com/cop/cmt/EgovArticleCommentList"; + } + + + /** + * 댓글을 수정한다. + * + * @param commentVO + * @param comment + * @param bindingResult + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/cmt/updateArticleComment.do") + public String updateArticleComment(@ModelAttribute("searchVO") CommentVO commentVO, @ModelAttribute("comment") Comment comment, + BindingResult bindingResult, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + beanValidator.validate(comment, bindingResult); + if (bindingResult.hasErrors()) { + model.addAttribute("msg", "내용은 필수 입력 값입니다."); + + return "forward:/cop/bbs/selectArticleDetail.do"; + } + + if (isAuthenticated) { + comment.setLastUpdusrId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + + egovArticleCommentService.updateArticleComment(comment); + + commentVO.setCommentCn(""); + commentVO.setCommentNo(""); + } + + return "forward:/cop/bbs/selectArticleDetail.do"; + } + + +} diff --git a/src/main/java/egovframework/com/cop/cmy/service/Community.java b/src/main/java/egovframework/com/cop/cmy/service/Community.java new file mode 100644 index 0000000..7ca408a --- /dev/null +++ b/src/main/java/egovframework/com/cop/cmy/service/Community.java @@ -0,0 +1,319 @@ +package egovframework.com.cop.cmy.service; + +import java.io.Serializable; + +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * 커뮤니티 관리를 위한 모델 클래스 + * @author 공통서비스개발팀 이삼섭 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.4.2  이삼섭          최초 생성
    + *
    + * 
    + */ +@SuppressWarnings("serial") +public class Community implements Serializable { + + /** 커뮤니티 아이디 */ + private String cmmntyId = ""; + + /** 커뮤니티 소개 */ + private String cmmntyIntrcn = ""; + + /** 커뮤니티 명 */ + private String cmmntyNm = ""; + + /** 최초등록자 아이디 */ + private String frstRegisterId = ""; + + /** 최초등록시점 */ + private String frstRegisterPnttm = ""; + + /** 최종수정자 아이디 */ + private String lastUpdusrId = ""; + + /** 최종수정시점 */ + private String lastUpdusrPnttm = ""; + + /** 등록구분코드 */ + private String registSeCode = ""; + + /** 템플릿 아이디 */ + private String tmplatId = ""; + + /** 템플릿 아이디 */ + private String useAt = ""; + + /** 사용자 아이디 */ + private String emplyrId = ""; + + /** 사용자명 */ + private String userNm = ""; + + /** 템플릿 명 */ + private String tmplatNm = ""; + + /** + * cmmntyId attribute를 리턴한다. + * + * @return the cmmntyId + */ + public String getCmmntyId() { + return cmmntyId; + } + + /** + * cmmntyId attribute 값을 설정한다. + * + * @param cmmntyId + * the cmmntyId to set + */ + public void setCmmntyId(String cmmntyId) { + this.cmmntyId = cmmntyId; + } + + /** + * cmmntyIntrcn attribute를 리턴한다. + * + * @return the cmmntyIntrcn + */ + public String getCmmntyIntrcn() { + return cmmntyIntrcn; + } + + /** + * cmmntyIntrcn attribute 값을 설정한다. + * + * @param cmmntyIntrcn + * the cmmntyIntrcn to set + */ + public void setCmmntyIntrcn(String cmmntyIntrcn) { + this.cmmntyIntrcn = cmmntyIntrcn; + } + + /** + * cmmntyNm attribute를 리턴한다. + * + * @return the cmmntyNm + */ + public String getCmmntyNm() { + return cmmntyNm; + } + + /** + * cmmntyNm attribute 값을 설정한다. + * + * @param cmmntyNm + * the cmmntyNm to set + */ + public void setCmmntyNm(String cmmntyNm) { + this.cmmntyNm = cmmntyNm; + } + + /** + * frstRegisterId attribute를 리턴한다. + * + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * frstRegisterId attribute 값을 설정한다. + * + * @param frstRegisterId + * the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * frstRegisterPnttm attribute를 리턴한다. + * + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * frstRegisterPnttm attribute 값을 설정한다. + * + * @param frstRegisterPnttm + * the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * lastUpdusrId attribute를 리턴한다. + * + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * lastUpdusrId attribute 값을 설정한다. + * + * @param lastUpdusrId + * the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + /** + * lastUpdusrPnttm attribute를 리턴한다. + * + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * lastUpdusrPnttm attribute 값을 설정한다. + * + * @param lastUpdusrPnttm + * the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * registSeCode attribute를 리턴한다. + * + * @return the registSeCode + */ + public String getRegistSeCode() { + return registSeCode; + } + + /** + * registSeCode attribute 값을 설정한다. + * + * @param registSeCode + * the registSeCode to set + */ + public void setRegistSeCode(String registSeCode) { + this.registSeCode = registSeCode; + } + + /** + * tmplatId attribute를 리턴한다. + * + * @return the tmplatId + */ + public String getTmplatId() { + return tmplatId; + } + + /** + * tmplatId attribute 값을 설정한다. + * + * @param tmplatId + * the tmplatId to set + */ + public void setTmplatId(String tmplatId) { + this.tmplatId = tmplatId; + } + + /** + * useAt attribute를 리턴한다. + * + * @return the useAt + */ + public String getUseAt() { + return useAt; + } + + /** + * useAt attribute 값을 설정한다. + * + * @param useAt + * the useAt to set + */ + public void setUseAt(String useAt) { + this.useAt = useAt; + } + + /** + * emplyrId attribute를 리턴한다. + * + * @return the emplyrId + */ + public String getEmplyrId() { + return emplyrId; + } + + /** + * emplyrId attribute 값을 설정한다. + * + * @param emplyrId + * the emplyrId to set + */ + public void setEmplyrId(String emplyrId) { + this.emplyrId = emplyrId; + } + + /** + * userNm attribute를 리턴한다. + * + * @return the userNm + */ + public String getUserNm() { + return userNm; + } + + /** + * userNm attribute 값을 설정한다. + * + * @param userNm + * the userNm to set + */ + public void setUserNm(String userNm) { + this.userNm = userNm; + } + + /** + * tmplatNm attribute를 리턴한다. + * + * @return the tmplatNm + */ + public String getTmplatNm() { + return tmplatNm; + } + + /** + * tmplatNm attribute 값을 설정한다. + * + * @param tmplatNm + * the tmplatNm to set + */ + public void setTmplatNm(String tmplatNm) { + this.tmplatNm = tmplatNm; + } + + /** + * toString 메소드를 대치한다. + */ + public String toString() { + return ToStringBuilder.reflectionToString(this); + } + +} diff --git a/src/main/java/egovframework/com/cop/cmy/service/CommunityUser.java b/src/main/java/egovframework/com/cop/cmy/service/CommunityUser.java new file mode 100644 index 0000000..8224b21 --- /dev/null +++ b/src/main/java/egovframework/com/cop/cmy/service/CommunityUser.java @@ -0,0 +1,362 @@ +package egovframework.com.cop.cmy.service; + +import java.io.Serializable; + +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * 커뮤티니 사용자 관리를 위한 모델 클래스 + * @author 공통서비스개발팀 이삼섭 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.4.2  이삼섭          최초 생성
    + *
    + * 
    + */ +@SuppressWarnings("serial") +public class CommunityUser implements Serializable { + + /** 커뮤니티아이디 */ + private String cmmntyId = ""; + + /** 최초등록자 아이디 */ + private String frstRegisterId = ""; + + /** 최초등록시점 */ + private String frstRegisterPnttm = ""; + + /** 최종수정자 아이디 */ + private String lastUpdusrId = ""; + + /** 최종수정시점 */ + private String lastUpdusrPnttm = ""; + + /** 관리자여부 */ + private String mngrAt = ""; + + /** 탈퇴일 */ + private String secsnDe = ""; + + /** 가입일 */ + private String sbscrbDe = ""; + + /** 사용여부 */ + private String useAt = ""; + + /** 사용자 아이디 */ + private String emplyrId = ""; + + /** 사용자명 */ + private String emplyrNm = ""; + + /** 회원 ID */ + private String userId = ""; + + /** 회원 이메일 */ + private String userEmail = ""; + + /** 회원 상태 */ + private String mberSttus = ""; + + /** 회원 상태 코드명 */ + private String mberSttusNm = ""; + + /** + * cmmntyId attribute를 리턴한다. + * + * @return the cmmntyId + */ + public String getCmmntyId() { + return cmmntyId; + } + + /** + * cmmntyId attribute 값을 설정한다. + * + * @param cmmntyId + * the cmmntyId to set + */ + public void setCmmntyId(String cmmntyId) { + this.cmmntyId = cmmntyId; + } + + /** + * frstRegisterId attribute를 리턴한다. + * + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * frstRegisterId attribute 값을 설정한다. + * + * @param frstRegisterId + * the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * frstRegisterPnttm attribute를 리턴한다. + * + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * frstRegisterPnttm attribute 값을 설정한다. + * + * @param frstRegisterPnttm + * the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * lastUpdusrId attribute를 리턴한다. + * + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * lastUpdusrId attribute 값을 설정한다. + * + * @param lastUpdusrId + * the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + /** + * lastUpdusrPnttm attribute를 리턴한다. + * + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * lastUpdusrPnttm attribute 값을 설정한다. + * + * @param lastUpdusrPnttm + * the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * mngrAt attribute를 리턴한다. + * + * @return the mngrAt + */ + public String getMngrAt() { + return mngrAt; + } + + /** + * mngrAt attribute 값을 설정한다. + * + * @param mngrAt + * the mngrAt to set + */ + public void setMngrAt(String mngrAt) { + this.mngrAt = mngrAt; + } + + /** + * secsnDe attribute를 리턴한다. + * + * @return the secsnDe + */ + public String getSecsnDe() { + return secsnDe; + } + + /** + * secsnDe attribute 값을 설정한다. + * + * @param secsnDe + * the secsnDe to set + */ + public void setSecsnDe(String secsnDe) { + this.secsnDe = secsnDe; + } + + /** + * sbscrbDe attribute를 리턴한다. + * + * @return the sbscrbDe + */ + public String getSbscrbDe() { + return sbscrbDe; + } + + /** + * sbscrbDe attribute 값을 설정한다. + * + * @param sbscrbDe + * the sbscrbDe to set + */ + public void setSbscrbDe(String sbscrbDe) { + this.sbscrbDe = sbscrbDe; + } + + /** + * useAt attribute를 리턴한다. + * + * @return the useAt + */ + public String getUseAt() { + return useAt; + } + + /** + * useAt attribute 값을 설정한다. + * + * @param useAt + * the useAt to set + */ + public void setUseAt(String useAt) { + this.useAt = useAt; + } + + /** + * emplyrId attribute를 리턴한다. + * + * @return the emplyrId + */ + public String getEmplyrId() { + return emplyrId; + } + + /** + * emplyrId attribute 값을 설정한다. + * + * @param emplyrId + * the emplyrId to set + */ + public void setEmplyrId(String emplyrId) { + this.emplyrId = emplyrId; + } + + /** + * emplyrNm attribute를 리턴한다. + * + * @return the emplyrNm + */ + public String getEmplyrNm() { + return emplyrNm; + } + + /** + * emplyrNm attribute 값을 설정한다. + * + * @param emplyrNm + * the emplyrNm to set + */ + public void setEmplyrNm(String emplyrNm) { + this.emplyrNm = emplyrNm; + } + + /** + * userId attribute를 리턴한다. + * + * @return the userId + */ + public String getUserId() { + return userId; + } + + /** + * userId attribute 값을 설정한다. + * + * @param userId + * the userId to set + */ + public void setUserId(String userId) { + this.userId = userId; + } + + /** + * userEmail attribute를 리턴한다. + * + * @return the userEmail + */ + public String getUserEmail() { + return userEmail; + } + + /** + * userEmail attribute 값을 설정한다. + * + * @param userEmail + * the userEmail to set + */ + public void setUserEmail(String userEmail) { + this.userEmail = userEmail; + } + + /** + * mberSttus attribute를 리턴한다. + * + * @return the mberSttus + */ + public String getMberSttus() { + return mberSttus; + } + + /** + * mberSttus attribute 값을 설정한다. + * + * @param mberSttus + * the mberSttus to set + */ + public void setMberSttus(String mberSttus) { + this.mberSttus = mberSttus; + } + + /** + * mberSttusNm attribute를 리턴한다. + * + * @return the mberSttusNm + */ + public String getMberSttusNm() { + return mberSttusNm; + } + + /** + * mberSttusNm attribute 값을 설정한다. + * + * @param mberSttusNm + * the mberSttusNm to set + */ + public void setMberSttusNm(String mberSttusNm) { + this.mberSttusNm = mberSttusNm; + } + + /** + * toString 메소드를 대치한다. + */ + public String toString() { + return ToStringBuilder.reflectionToString(this); + } +} diff --git a/src/main/java/egovframework/com/cop/cmy/service/CommunityUserVO.java b/src/main/java/egovframework/com/cop/cmy/service/CommunityUserVO.java new file mode 100644 index 0000000..4d4fb40 --- /dev/null +++ b/src/main/java/egovframework/com/cop/cmy/service/CommunityUserVO.java @@ -0,0 +1,319 @@ +package egovframework.com.cop.cmy.service; + +import java.io.Serializable; + +import org.apache.commons.lang3.builder.ToStringBuilder; + + +/** + * 커뮤티니 사용자 관리를 위한 VO 클래스 + * @author 공통서비스개발팀 이삼섭 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.4.2  이삼섭          최초 생성
    + *
    + * 
    + */ +@SuppressWarnings("serial") +public class CommunityUserVO extends CommunityUser implements Serializable { + + /** 검색시작일 */ + private String searchBgnDe = ""; + + /** 검색조건 */ + private String searchCnd = ""; + + /** 검색종료일 */ + private String searchEndDe = ""; + + /** 검색단어 */ + private String searchWrd = ""; + + /** 정렬순서(DESC,ASC) */ + private long sortOrdr = 0L; + + /** 검색사용여부 */ + private String searchUseYn = ""; + + /** 현재페이지 */ + private int pageIndex = 1; + + /** 페이지갯수 */ + private int pageUnit = 10; + + /** 페이지사이즈 */ + private int pageSize = 10; + + /** 첫페이지 인덱스 */ + private int firstIndex = 1; + + /** 마지막페이지 인덱스 */ + private int lastIndex = 1; + + /** 페이지당 레코드 개수 */ + private int recordCountPerPage = 10; + + /** 레코드 번호 */ + private int rowNo = 0; + + /** + * searchBgnDe attribute를 리턴한다. + * + * @return the searchBgnDe + */ + public String getSearchBgnDe() { + return searchBgnDe; + } + + /** + * searchBgnDe attribute 값을 설정한다. + * + * @param searchBgnDe + * the searchBgnDe to set + */ + public void setSearchBgnDe(String searchBgnDe) { + this.searchBgnDe = searchBgnDe; + } + + /** + * searchCnd attribute를 리턴한다. + * + * @return the searchCnd + */ + public String getSearchCnd() { + return searchCnd; + } + + /** + * searchCnd attribute 값을 설정한다. + * + * @param searchCnd + * the searchCnd to set + */ + public void setSearchCnd(String searchCnd) { + this.searchCnd = searchCnd; + } + + /** + * searchEndDe attribute를 리턴한다. + * + * @return the searchEndDe + */ + public String getSearchEndDe() { + return searchEndDe; + } + + /** + * searchEndDe attribute 값을 설정한다. + * + * @param searchEndDe + * the searchEndDe to set + */ + public void setSearchEndDe(String searchEndDe) { + this.searchEndDe = searchEndDe; + } + + /** + * searchWrd attribute를 리턴한다. + * + * @return the searchWrd + */ + public String getSearchWrd() { + return searchWrd; + } + + /** + * searchWrd attribute 값을 설정한다. + * + * @param searchWrd + * the searchWrd to set + */ + public void setSearchWrd(String searchWrd) { + this.searchWrd = searchWrd; + } + + /** + * sortOrdr attribute를 리턴한다. + * + * @return the sortOrdr + */ + public long getSortOrdr() { + return sortOrdr; + } + + /** + * sortOrdr attribute 값을 설정한다. + * + * @param sortOrdr + * the sortOrdr to set + */ + public void setSortOrdr(long sortOrdr) { + this.sortOrdr = sortOrdr; + } + + /** + * searchUseYn attribute를 리턴한다. + * + * @return the searchUseYn + */ + public String getSearchUseYn() { + return searchUseYn; + } + + /** + * searchUseYn attribute 값을 설정한다. + * + * @param searchUseYn + * the searchUseYn to set + */ + public void setSearchUseYn(String searchUseYn) { + this.searchUseYn = searchUseYn; + } + + /** + * pageIndex attribute를 리턴한다. + * + * @return the pageIndex + */ + public int getPageIndex() { + return pageIndex; + } + + /** + * pageIndex attribute 값을 설정한다. + * + * @param pageIndex + * the pageIndex to set + */ + public void setPageIndex(int pageIndex) { + this.pageIndex = pageIndex; + } + + /** + * pageUnit attribute를 리턴한다. + * + * @return the pageUnit + */ + public int getPageUnit() { + return pageUnit; + } + + /** + * pageUnit attribute 값을 설정한다. + * + * @param pageUnit + * the pageUnit to set + */ + public void setPageUnit(int pageUnit) { + this.pageUnit = pageUnit; + } + + /** + * pageSize attribute를 리턴한다. + * + * @return the pageSize + */ + public int getPageSize() { + return pageSize; + } + + /** + * pageSize attribute 값을 설정한다. + * + * @param pageSize + * the pageSize to set + */ + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + /** + * firstIndex attribute를 리턴한다. + * + * @return the firstIndex + */ + public int getFirstIndex() { + return firstIndex; + } + + /** + * firstIndex attribute 값을 설정한다. + * + * @param firstIndex + * the firstIndex to set + */ + public void setFirstIndex(int firstIndex) { + this.firstIndex = firstIndex; + } + + /** + * lastIndex attribute를 리턴한다. + * + * @return the lastIndex + */ + public int getLastIndex() { + return lastIndex; + } + + /** + * lastIndex attribute 값을 설정한다. + * + * @param lastIndex + * the lastIndex to set + */ + public void setLastIndex(int lastIndex) { + this.lastIndex = lastIndex; + } + + /** + * recordCountPerPage attribute를 리턴한다. + * + * @return the recordCountPerPage + */ + public int getRecordCountPerPage() { + return recordCountPerPage; + } + + /** + * recordCountPerPage attribute 값을 설정한다. + * + * @param recordCountPerPage + * the recordCountPerPage to set + */ + public void setRecordCountPerPage(int recordCountPerPage) { + this.recordCountPerPage = recordCountPerPage; + } + + /** + * rowNo attribute를 리턴한다. + * + * @return the rowNo + */ + public int getRowNo() { + return rowNo; + } + + /** + * rowNo attribute 값을 설정한다. + * + * @param rowNo + * the rowNo to set + */ + public void setRowNo(int rowNo) { + this.rowNo = rowNo; + } + + /** + * toString 메소드를 대치한다. + */ + public String toString() { + return ToStringBuilder.reflectionToString(this); + } +} diff --git a/src/main/java/egovframework/com/cop/cmy/service/CommunityVO.java b/src/main/java/egovframework/com/cop/cmy/service/CommunityVO.java new file mode 100644 index 0000000..4496d8b --- /dev/null +++ b/src/main/java/egovframework/com/cop/cmy/service/CommunityVO.java @@ -0,0 +1,425 @@ +package egovframework.com.cop.cmy.service; + +import java.io.Serializable; + +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * 커뮤니티 관리를 위한 VO 클래스 + * @author 공통서비스개발팀 이삼섭 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.4.2  이삼섭          최초 생성
    + *
    + * 
    + */ +@SuppressWarnings("serial") +public class CommunityVO extends Community implements Serializable { + + /** 검색시작일 */ + private String searchBgnDe = ""; + + /** 검색조건 */ + private String searchCnd = ""; + + /** 검색종료일 */ + private String searchEndDe = ""; + + /** 검색단어 */ + private String searchWrd = ""; + + /** 정렬순서(DESC,ASC) */ + private long sortOrdr = 0L; + + /** 검색사용여부 */ + private String searchUseYn = ""; + + /** 현재페이지 */ + private int pageIndex = 1; + + /** 페이지갯수 */ + private int pageUnit = 10; + + /** 페이지사이즈 */ + private int pageSize = 10; + + /** 첫페이지 인덱스 */ + private int firstIndex = 1; + + /** 마지막페이지 인덱스 */ + private int lastIndex = 1; + + /** 페이지당 레코드 개수 */ + private int recordCountPerPage = 10; + + /** 레코드 번호 */ + private int rowNo = 0; + + /** 등록구분 코드명 */ + private String registSeCodeNm = ""; + + /** 최초 등록자명 */ + private String frstRegisterNm = ""; + + /** 게시판 아이드 */ + private String bbsId = ""; + + /** 게시판 이름 */ + private String bbsNm = ""; + + /** 제공 URL */ + private String provdUrl = ""; + + /** + * searchBgnDe attribute를 리턴한다. + * + * @return the searchBgnDe + */ + public String getSearchBgnDe() { + return searchBgnDe; + } + + /** + * searchBgnDe attribute 값을 설정한다. + * + * @param searchBgnDe + * the searchBgnDe to set + */ + public void setSearchBgnDe(String searchBgnDe) { + this.searchBgnDe = searchBgnDe; + } + + /** + * searchCnd attribute를 리턴한다. + * + * @return the searchCnd + */ + public String getSearchCnd() { + return searchCnd; + } + + /** + * searchCnd attribute 값을 설정한다. + * + * @param searchCnd + * the searchCnd to set + */ + public void setSearchCnd(String searchCnd) { + this.searchCnd = searchCnd; + } + + /** + * searchEndDe attribute를 리턴한다. + * + * @return the searchEndDe + */ + public String getSearchEndDe() { + return searchEndDe; + } + + /** + * searchEndDe attribute 값을 설정한다. + * + * @param searchEndDe + * the searchEndDe to set + */ + public void setSearchEndDe(String searchEndDe) { + this.searchEndDe = searchEndDe; + } + + /** + * searchWrd attribute를 리턴한다. + * + * @return the searchWrd + */ + public String getSearchWrd() { + return searchWrd; + } + + /** + * searchWrd attribute 값을 설정한다. + * + * @param searchWrd + * the searchWrd to set + */ + public void setSearchWrd(String searchWrd) { + this.searchWrd = searchWrd; + } + + /** + * sortOrdr attribute를 리턴한다. + * + * @return the sortOrdr + */ + public long getSortOrdr() { + return sortOrdr; + } + + /** + * sortOrdr attribute 값을 설정한다. + * + * @param sortOrdr + * the sortOrdr to set + */ + public void setSortOrdr(long sortOrdr) { + this.sortOrdr = sortOrdr; + } + + /** + * searchUseYn attribute를 리턴한다. + * + * @return the searchUseYn + */ + public String getSearchUseYn() { + return searchUseYn; + } + + /** + * searchUseYn attribute 값을 설정한다. + * + * @param searchUseYn + * the searchUseYn to set + */ + public void setSearchUseYn(String searchUseYn) { + this.searchUseYn = searchUseYn; + } + + /** + * pageIndex attribute를 리턴한다. + * + * @return the pageIndex + */ + public int getPageIndex() { + return pageIndex; + } + + /** + * pageIndex attribute 값을 설정한다. + * + * @param pageIndex + * the pageIndex to set + */ + public void setPageIndex(int pageIndex) { + this.pageIndex = pageIndex; + } + + /** + * pageUnit attribute를 리턴한다. + * + * @return the pageUnit + */ + public int getPageUnit() { + return pageUnit; + } + + /** + * pageUnit attribute 값을 설정한다. + * + * @param pageUnit + * the pageUnit to set + */ + public void setPageUnit(int pageUnit) { + this.pageUnit = pageUnit; + } + + /** + * pageSize attribute를 리턴한다. + * + * @return the pageSize + */ + public int getPageSize() { + return pageSize; + } + + /** + * pageSize attribute 값을 설정한다. + * + * @param pageSize + * the pageSize to set + */ + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + /** + * firstIndex attribute를 리턴한다. + * + * @return the firstIndex + */ + public int getFirstIndex() { + return firstIndex; + } + + /** + * firstIndex attribute 값을 설정한다. + * + * @param firstIndex + * the firstIndex to set + */ + public void setFirstIndex(int firstIndex) { + this.firstIndex = firstIndex; + } + + /** + * lastIndex attribute를 리턴한다. + * + * @return the lastIndex + */ + public int getLastIndex() { + return lastIndex; + } + + /** + * lastIndex attribute 값을 설정한다. + * + * @param lastIndex + * the lastIndex to set + */ + public void setLastIndex(int lastIndex) { + this.lastIndex = lastIndex; + } + + /** + * recordCountPerPage attribute를 리턴한다. + * + * @return the recordCountPerPage + */ + public int getRecordCountPerPage() { + return recordCountPerPage; + } + + /** + * recordCountPerPage attribute 값을 설정한다. + * + * @param recordCountPerPage + * the recordCountPerPage to set + */ + public void setRecordCountPerPage(int recordCountPerPage) { + this.recordCountPerPage = recordCountPerPage; + } + + /** + * rowNo attribute를 리턴한다. + * + * @return the rowNo + */ + public int getRowNo() { + return rowNo; + } + + /** + * rowNo attribute 값을 설정한다. + * + * @param rowNo + * the rowNo to set + */ + public void setRowNo(int rowNo) { + this.rowNo = rowNo; + } + + /** + * registSeCodeNm attribute를 리턴한다. + * + * @return the registSeCodeNm + */ + public String getRegistSeCodeNm() { + return registSeCodeNm; + } + + /** + * registSeCodeNm attribute 값을 설정한다. + * + * @param registSeCodeNm + * the registSeCodeNm to set + */ + public void setRegistSeCodeNm(String registSeCodeNm) { + this.registSeCodeNm = registSeCodeNm; + } + + /** + * frstRegisterNm attribute를 리턴한다. + * + * @return the frstRegisterNm + */ + public String getFrstRegisterNm() { + return frstRegisterNm; + } + + /** + * frstRegisterNm attribute 값을 설정한다. + * + * @param frstRegisterNm + * the frstRegisterNm to set + */ + public void setFrstRegisterNm(String frstRegisterNm) { + this.frstRegisterNm = frstRegisterNm; + } + + /** + * bbsId attribute를 리턴한다. + * + * @return the bbsId + */ + public String getBbsId() { + return bbsId; + } + + /** + * bbsId attribute 값을 설정한다. + * + * @param bbsId + * the bbsId to set + */ + public void setBbsId(String bbsId) { + this.bbsId = bbsId; + } + + /** + * bbsNm attribute를 리턴한다. + * + * @return the bbsNm + */ + public String getBbsNm() { + return bbsNm; + } + + /** + * bbsNm attribute 값을 설정한다. + * + * @param bbsNm + * the bbsNm to set + */ + public void setBbsNm(String bbsNm) { + this.bbsNm = bbsNm; + } + + /** + * provdUrl attribute를 리턴한다. + * @return the provdUrl + */ + public String getProvdUrl() { + return provdUrl; + } + + /** + * provdUrl attribute 값을 설정한다. + * @param provdUrl the provdUrl to set + */ + public void setProvdUrl(String provdUrl) { + this.provdUrl = provdUrl; + } + + /** + * toString 메소드를 대치한다. + */ + public String toString() { + return ToStringBuilder.reflectionToString(this); + } +} diff --git a/src/main/java/egovframework/com/cop/cmy/service/EgovCommuBBSMasterService.java b/src/main/java/egovframework/com/cop/cmy/service/EgovCommuBBSMasterService.java new file mode 100644 index 0000000..02a4e48 --- /dev/null +++ b/src/main/java/egovframework/com/cop/cmy/service/EgovCommuBBSMasterService.java @@ -0,0 +1,11 @@ +package egovframework.com.cop.cmy.service; + +import java.util.List; + +import egovframework.com.cop.bbs.service.BoardMasterVO; + +public interface EgovCommuBBSMasterService { + + List selectCommuBBSMasterListMain(BoardMasterVO bbsVo); + +} diff --git a/src/main/java/egovframework/com/cop/cmy/service/EgovCommuManageService.java b/src/main/java/egovframework/com/cop/cmy/service/EgovCommuManageService.java new file mode 100644 index 0000000..e60283d --- /dev/null +++ b/src/main/java/egovframework/com/cop/cmy/service/EgovCommuManageService.java @@ -0,0 +1,25 @@ +package egovframework.com.cop.cmy.service; + +import java.util.Map; + +public interface EgovCommuManageService { + + Map selectCommuInf(CommunityVO cmmntyVO); + + String checkCommuUserDetail(CommunityUser cmmntyUser); + + void insertCommuUserRqst(CommunityUser cmmntyUser); + + Map selectCommuUserList(CommunityUserVO cmmntyUserVO); + + Boolean selectIsCommuAdmin(CommunityUserVO userVO); + + void insertCommuUser(CommunityUserVO cmmntyUserVO); + + void deleteCommuUser(CommunityUserVO cmmntyUserVO); + + void insertCommuUserAdmin(CommunityUserVO cmmntyUserVO); + + void deleteCommuUserAdmin(CommunityUserVO cmmntyUserVO); + +} diff --git a/src/main/java/egovframework/com/cop/cmy/service/EgovCommuMasterService.java b/src/main/java/egovframework/com/cop/cmy/service/EgovCommuMasterService.java new file mode 100644 index 0000000..96fa2e5 --- /dev/null +++ b/src/main/java/egovframework/com/cop/cmy/service/EgovCommuMasterService.java @@ -0,0 +1,21 @@ +package egovframework.com.cop.cmy.service; + +import java.util.List; +import java.util.Map; + +import org.egovframe.rte.fdl.cmmn.exception.FdlException; + +public interface EgovCommuMasterService { + + Map selectCommuMasterList(CommunityVO cmmntyVO); + + String insertCommuMaster(Community community) throws FdlException; + + CommunityVO selectCommuMaster(CommunityVO cmmntyVO) throws Exception; + + void updateCommuMaster(Community community); + + void deleteBBSMasterInf(Community community); + + List selectCommuMasterListPortlet(CommunityVO cmmntyVO) throws Exception; +} diff --git a/src/main/java/egovframework/com/cop/cmy/service/impl/EgovCommuBBSMasterDAO.java b/src/main/java/egovframework/com/cop/cmy/service/impl/EgovCommuBBSMasterDAO.java new file mode 100644 index 0000000..5f96af4 --- /dev/null +++ b/src/main/java/egovframework/com/cop/cmy/service/impl/EgovCommuBBSMasterDAO.java @@ -0,0 +1,17 @@ +package egovframework.com.cop.cmy.service.impl; + +import java.util.List; + +import org.springframework.stereotype.Repository; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.cop.bbs.service.BoardMasterVO; + +@Repository("EgovCommuBBSMasterDAO") +public class EgovCommuBBSMasterDAO extends EgovComAbstractDAO { + + public List selectCommuBBSMasterListMain(BoardMasterVO boardMasterVO) { + return selectList("CommuBBSMaster.selectCommuBBSMasterListMain", boardMasterVO); + } + +} diff --git a/src/main/java/egovframework/com/cop/cmy/service/impl/EgovCommuBBSMasterServiceImpl.java b/src/main/java/egovframework/com/cop/cmy/service/impl/EgovCommuBBSMasterServiceImpl.java new file mode 100644 index 0000000..8b3112f --- /dev/null +++ b/src/main/java/egovframework/com/cop/cmy/service/impl/EgovCommuBBSMasterServiceImpl.java @@ -0,0 +1,29 @@ +package egovframework.com.cop.cmy.service.impl; + +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import egovframework.com.cop.bbs.service.BoardMasterVO; +import egovframework.com.cop.cmy.service.EgovCommuBBSMasterService; +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +@Service("EgovCommuBBSMasterService") +public class EgovCommuBBSMasterServiceImpl extends EgovAbstractServiceImpl implements EgovCommuBBSMasterService { + + @Resource(name = "EgovCommuBBSMasterDAO") + private EgovCommuBBSMasterDAO egovCommuBBSMasterDao; + + @Resource(name = "egovBBSMstrIdGnrService") + private EgovIdGnrService idgenService; + + @Override + public List selectCommuBBSMasterListMain(BoardMasterVO boardMasterVO) { + return egovCommuBBSMasterDao.selectCommuBBSMasterListMain(boardMasterVO); + } + + +} diff --git a/src/main/java/egovframework/com/cop/cmy/service/impl/EgovCommuManageDAO.java b/src/main/java/egovframework/com/cop/cmy/service/impl/EgovCommuManageDAO.java new file mode 100644 index 0000000..759b918 --- /dev/null +++ b/src/main/java/egovframework/com/cop/cmy/service/impl/EgovCommuManageDAO.java @@ -0,0 +1,55 @@ +package egovframework.com.cop.cmy.service.impl; + +import java.util.List; + +import org.springframework.stereotype.Repository; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.cop.cmy.service.CommunityUser; +import egovframework.com.cop.cmy.service.CommunityUserVO; +import egovframework.com.cop.cmy.service.CommunityVO; + +@Repository("EgovCommuManageDAO") +public class EgovCommuManageDAO extends EgovComAbstractDAO{ + + public CommunityUser selectSingleCommuUserDetail(CommunityUser cmmntyUser) { + return (CommunityUser) selectOne("CommuManage.selectSingleCommuUserDetail", cmmntyUser); + } + + public List selectCommuManagerList(CommunityVO cmmntyVO) { + return selectList("CommuManage.selectCommuManagerList", cmmntyVO); + } + + public int checkExistUser(CommunityUser cmmntyUser) { + return (Integer)selectOne("CommuManage.checkExistUser", cmmntyUser); + } + + public void insertCommuUserRqst(CommunityUser cmmntyUser) { + insert("CommuManage.insertCommuUserRqst", cmmntyUser); + } + + public List selectCommuUserList(CommunityUserVO cmmntyUserVO) { + return list("CommuManage.selectCommuUserList", cmmntyUserVO); + } + + public int selectCommuUserListCnt(CommunityUserVO cmmntyUserVO) { + return (Integer)selectOne("CommuManage.selectCommuUserListCnt", cmmntyUserVO); + } + + public void insertCommuUser(CommunityUserVO cmmntyUserVO) { + update("CommuManage.insertCommuUser", cmmntyUserVO); + } + + public void deleteCommuUser(CommunityUserVO cmmntyUserVO) { + delete("CommuManage.deleteCommuUser", cmmntyUserVO); + } + + public void insertCommuUserAdmin(CommunityUserVO cmmntyUserVO) { + update("CommuManage.insertCommuUserAdmin", cmmntyUserVO); + } + + public void deleteCommuUserAdmin(CommunityUserVO cmmntyUserVO) { + update("CommuManage.deleteCommuUserAdmin", cmmntyUserVO); + } + +} diff --git a/src/main/java/egovframework/com/cop/cmy/service/impl/EgovCommuManageServiceImpl.java b/src/main/java/egovframework/com/cop/cmy/service/impl/EgovCommuManageServiceImpl.java new file mode 100644 index 0000000..a68fa0b --- /dev/null +++ b/src/main/java/egovframework/com/cop/cmy/service/impl/EgovCommuManageServiceImpl.java @@ -0,0 +1,144 @@ +package egovframework.com.cop.cmy.service.impl; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import egovframework.com.cop.cmy.service.CommunityUser; +import egovframework.com.cop.cmy.service.CommunityUserVO; +import egovframework.com.cop.cmy.service.CommunityVO; +import egovframework.com.cop.cmy.service.EgovCommuManageService; +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +@Service("EgovCommuManageService") +public class EgovCommuManageServiceImpl extends EgovAbstractServiceImpl implements EgovCommuManageService { + + @Resource(name = "EgovCommuMasterDAO") + EgovCommuMasterDAO egovCommuMasterDao; + + @Resource(name = "EgovCommuManageDAO") + EgovCommuManageDAO egovCommuManageDao; + + @Resource(name = "egovCmmntyIdGnrService") + private EgovIdGnrService idgenService; + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovCommuManageServiceImpl.class); + + @Override + public Map selectCommuInf(CommunityVO cmmntyVO) { + + //커뮤니티 기본정보 확인 + CommunityVO vo = egovCommuMasterDao.selectCommuMasterDetail(cmmntyVO); + + CommunityUser cmmntyUser = new CommunityUser(); + + cmmntyUser.setCmmntyId(cmmntyVO.getCmmntyId()); + cmmntyUser.setEmplyrId(cmmntyVO.getEmplyrId()); + + cmmntyUser = egovCommuManageDao.selectSingleCommuUserDetail(cmmntyUser); + + //----------------------------------------------------------------- + // 관리자 정보를 처리한다. (여러 명이 있을 수 있음 - DB 설계 문제상 문제) + // 위의 처리는 cmmntyVO.getEmplyrId()가 ""이기 때문에 의미 없음.. + //----------------------------------------------------------------- + List managers = egovCommuManageDao.selectCommuManagerList(cmmntyVO); + + if (cmmntyUser == null) { + cmmntyUser = new CommunityUser(); + } + if (managers.size() == 1) { + + cmmntyUser.setEmplyrId(managers.get(0).getEmplyrId()); + cmmntyUser.setEmplyrNm(managers.get(0).getEmplyrNm()); + } else if (managers.size() > 1) { + cmmntyUser.setEmplyrId(managers.get(0).getEmplyrId()); + cmmntyUser.setEmplyrNm(managers.get(0).getEmplyrNm() + "외 " + (managers.size() - 1) + "명"); + } else { + LOGGER.debug("No managers..."); + } + ////--------------------------------------------------------------- + + Map map = new HashMap(); + + map.put("cmmntyVO", vo); + map.put("cmmntyUser", cmmntyUser); + + return map; + } + + @Override + public String checkCommuUserDetail(CommunityUser cmmntyUser) { + + //cmmntyId + CommunityVO vo = new CommunityVO(); + vo.setCmmntyId(cmmntyUser.getCmmntyId()); + + int userCnt = egovCommuManageDao.checkExistUser(cmmntyUser); + + if (userCnt == 0) { + return ""; + } else { + return "EXIST"; + } + } + + @Override + public void insertCommuUserRqst(CommunityUser cmmntyUser) { + egovCommuManageDao.insertCommuUserRqst(cmmntyUser); + } + + @Override + public Map selectCommuUserList(CommunityUserVO cmmntyUserVO) { + List result = egovCommuManageDao.selectCommuUserList(cmmntyUserVO); + int cnt = egovCommuManageDao.selectCommuUserListCnt(cmmntyUserVO); + + Map map = new HashMap(); + + map.put("resultList", result); + map.put("resultCnt", Integer.toString(cnt)); + + return map; + } + + @Override + public Boolean selectIsCommuAdmin(CommunityUserVO userVO) { + + CommunityUser cmmntyUser = egovCommuManageDao.selectSingleCommuUserDetail(userVO); + + if(cmmntyUser==null) { + return false; + } else if(cmmntyUser.getMngrAt().equals("Y")) { + return true; + } else { + return false; + } + } + + @Override + public void insertCommuUser(CommunityUserVO cmmntyUserVO) { + egovCommuManageDao.insertCommuUser(cmmntyUserVO); + } + + @Override + public void deleteCommuUser(CommunityUserVO cmmntyUserVO) { + egovCommuManageDao.deleteCommuUser(cmmntyUserVO); + } + + @Override + public void insertCommuUserAdmin(CommunityUserVO cmmntyUserVO) { + egovCommuManageDao.insertCommuUserAdmin(cmmntyUserVO); + } + + @Override + public void deleteCommuUserAdmin(CommunityUserVO cmmntyUserVO) { + egovCommuManageDao.deleteCommuUserAdmin(cmmntyUserVO); + } + +} diff --git a/src/main/java/egovframework/com/cop/cmy/service/impl/EgovCommuMasterDAO.java b/src/main/java/egovframework/com/cop/cmy/service/impl/EgovCommuMasterDAO.java new file mode 100644 index 0000000..fb92782 --- /dev/null +++ b/src/main/java/egovframework/com/cop/cmy/service/impl/EgovCommuMasterDAO.java @@ -0,0 +1,52 @@ +package egovframework.com.cop.cmy.service.impl; + +import java.util.List; + +import org.springframework.stereotype.Repository; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.cop.bbs.service.BoardMasterVO; +import egovframework.com.cop.cmy.service.Community; +import egovframework.com.cop.cmy.service.CommunityVO; + +@Repository("EgovCommuMasterDAO") +public class EgovCommuMasterDAO extends EgovComAbstractDAO{ + + public List selectCommuMasterList(CommunityVO cmmntyVO) { + return list("CommuMaster.selectCommuMasterList", cmmntyVO); + } + + public int selectCommuMasterListCnt(CommunityVO cmmntyVO) { + return (Integer)selectOne("CommuMaster.selectCommuMasterListCnt", cmmntyVO); + } + + public void insertCommuMaster(Community community) { + insert("CommuMaster.insertCommuMaster", community); + + } + + public CommunityVO selectCommuMasterDetail(CommunityVO cmmntyVO) { + return (CommunityVO) selectOne("CommuMaster.selectCommuMasterDetail", cmmntyVO); + } + + public void updateCommuMaster(Community community) { + update("CommuMaster.updateCommuMaster", community); + } + + public void deleteCommuMaster(Community community) { + update("CommuMaster.deleteCommuMaster", community); + } + + /** + * 포트릿을 위한 커뮤니티 정보 목록 정보를 조회한다. + * + * @param cmmntyVO + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List selectCommuMasterListPortlet(CommunityVO cmmntyVO) throws Exception { + return (List) list("CommuMaster.selectCommuMasterListPortlet", cmmntyVO); + } + +} diff --git a/src/main/java/egovframework/com/cop/cmy/service/impl/EgovCommuMasterServiceImpl.java b/src/main/java/egovframework/com/cop/cmy/service/impl/EgovCommuMasterServiceImpl.java new file mode 100644 index 0000000..75da30a --- /dev/null +++ b/src/main/java/egovframework/com/cop/cmy/service/impl/EgovCommuMasterServiceImpl.java @@ -0,0 +1,76 @@ +package egovframework.com.cop.cmy.service.impl; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import egovframework.com.cop.bbs.service.BoardMasterVO; +import egovframework.com.cop.cmy.service.Community; +import egovframework.com.cop.cmy.service.CommunityVO; +import egovframework.com.cop.cmy.service.EgovCommuMasterService; +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.cmmn.exception.FdlException; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +@Service("EgovCommuMasterService") +public class EgovCommuMasterServiceImpl extends EgovAbstractServiceImpl implements EgovCommuMasterService{ + + @Resource(name = "EgovCommuMasterDAO") + private EgovCommuMasterDAO egovCommuMasterDAO; + + @Resource(name = "egovCmmntyIdGnrService") + private EgovIdGnrService idgenService; + + @Override + public Map selectCommuMasterList(CommunityVO cmmntyVO) { + + List result = egovCommuMasterDAO.selectCommuMasterList(cmmntyVO); + int cnt = egovCommuMasterDAO.selectCommuMasterListCnt(cmmntyVO); + + Map map = new HashMap(); + + map.put("resultList", result); + map.put("resultCnt", Integer.toString(cnt)); + + return map; + } + + @Override + public String insertCommuMaster(Community community) throws FdlException { + //게시판 ID 채번 + String cmmntyId = idgenService.getNextStringId(); + community.setCmmntyId(cmmntyId); + + egovCommuMasterDAO.insertCommuMaster(community); + + return cmmntyId; + } + + @Override + public CommunityVO selectCommuMaster(CommunityVO cmmntyVO) throws Exception { + CommunityVO resultVO = egovCommuMasterDAO.selectCommuMasterDetail(cmmntyVO); + if (resultVO == null) + throw processException("info.nodata.msg"); + return resultVO; + } + + @Override + public void updateCommuMaster(Community community) { + egovCommuMasterDAO.updateCommuMaster(community); + } + + @Override + public void deleteBBSMasterInf(Community community) { + egovCommuMasterDAO.deleteCommuMaster(community); + } + + @Override + public List selectCommuMasterListPortlet(CommunityVO cmmntyVO) throws Exception { + return egovCommuMasterDAO.selectCommuMasterListPortlet(cmmntyVO); + } + +} diff --git a/src/main/java/egovframework/com/cop/cmy/web/EgovCommuManageController.java b/src/main/java/egovframework/com/cop/cmy/web/EgovCommuManageController.java new file mode 100644 index 0000000..35e52f0 --- /dev/null +++ b/src/main/java/egovframework/com/cop/cmy/web/EgovCommuManageController.java @@ -0,0 +1,639 @@ +package egovframework.com.cop.cmy.web; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +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.springmodules.validation.commons.DefaultBeanValidator; + +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.EgovWebUtil; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.cop.bbs.service.BoardMasterVO; +import egovframework.com.cop.bbs.service.BoardVO; +import egovframework.com.cop.bbs.service.EgovArticleService; +import egovframework.com.cop.cmy.service.CommunityUser; +import egovframework.com.cop.cmy.service.CommunityUserVO; +import egovframework.com.cop.cmy.service.CommunityVO; +import egovframework.com.cop.cmy.service.EgovCommuBBSMasterService; +import egovframework.com.cop.cmy.service.EgovCommuManageService; +import egovframework.com.cop.cmy.service.EgovCommuMasterService; +import egovframework.com.cop.tpl.service.EgovTemplateManageService; +import egovframework.com.cop.tpl.service.TemplateInfVO; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +/** + * 커뮤니티 사용자관리, 커뮤니티 게시판을 관리하기 위한 컨트롤러 클래스 + * @author 공통서비스개발팀 김연호 + * @since 2016.08.01 + * @version 3.6 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일               수정자            수정내용
    + *   ----------   --------   ---------------------------
    + *   2016.06.13   김연호            최초 생성 - 표준프레임워크 v3.6 개선
    + *   2019.05.17   신용호            KISA 취약점 조치 및 보완
    + *   
    + * 
    + */ + +@Controller +public class EgovCommuManageController { + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovCommuManageController.class); + + @Resource(name = "EgovCommuManageService") + private EgovCommuManageService egovCommuManageService; + + @Resource(name = "EgovCommuBBSMasterService") + private EgovCommuBBSMasterService egovCommuBBSMasterService; + + @Resource(name = "EgovCommuMasterService") + private EgovCommuMasterService egovCommuMasterService; + + @Resource(name = "EgovArticleService") + private EgovArticleService egovArticleService; + + @Resource(name = "EgovTemplateManageService") + private EgovTemplateManageService egovTemplateManageService; + + @Resource(name = "propertiesService") + protected EgovPropertyService propertyService; + + @Autowired + private DefaultBeanValidator beanValidator; + + /** EgovMessageSource */ + @Resource(name = "egovMessageSource") + EgovMessageSource egovMessageSource; + + /** + * 커뮤니티 메인페이지를 조회한다. + * + * @param cmmntyVO + * @param sessionVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/cmy/cmmntyMain.do") + public String selectCmmntyMain(@ModelAttribute("searchVO") CommunityVO cmmntyVO + ,ModelMap model + ,HttpServletRequest request) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + // KISA 보안취약점 조치 (2018-12-10, 신용호) + if(!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + cmmntyVO.setEmplyrId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + +// String tmplatCours = cmmntyService.selectCmmntyTemplat(cmmntyVO); + String tmplatCours = ""; + if ("".equals(tmplatCours) || tmplatCours == null) { + tmplatCours = "egovframework/com/cop/tpl/EgovCmmntyBaseTmpl"; + } + Map map = egovCommuManageService.selectCommuInf(cmmntyVO); + + //model.addAttribute("cmmntyVO", cmmntyVO); + model.addAttribute("cmmntyVO", (CommunityVO)map.get("cmmntyVO")); + model.addAttribute("cmmntyUser", (CommunityUser)map.get("cmmntyUser")); + + //-------------------------------- + // 게시판 목록 정보 처리 + //-------------------------------- + BoardMasterVO bbsVo = new BoardMasterVO(); + + bbsVo.setCmmntyId(cmmntyVO.getCmmntyId()); + + List bbsResult = egovCommuBBSMasterService.selectCommuBBSMasterListMain(bbsVo); + + model.addAttribute("bbsList", bbsResult); + ////------------------------------ + + if (isAuthenticated) { + model.addAttribute("isAuthenticated", "Y"); + } else { + model.addAttribute("isAuthenticated", "N"); + } + model.addAttribute("returnMsg", request.getParameter("returnMsg")); + + return "egovframework/com/cop/cmy/EgovCommuMain"; + } + + /** + * 커뮤니티 메인페이지의 기본 내용(게시판 4개 표시) 조회한다. + * + * @param cmmntyVO + * @param sessionVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/cmy/cmmntyMainContents.do") + public String selectCmmntyMainContents(@ModelAttribute("searchVO") CommunityVO cmmntyVO, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + // KISA 보안취약점 조치 (2018-12-10, 신용호) + if(!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + cmmntyVO.setEmplyrId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + + //-------------------------------- + // 게시판 목록 정보 처리 + //-------------------------------- + BoardMasterVO bbsVo = new BoardMasterVO(); + + bbsVo.setCmmntyId(cmmntyVO.getCmmntyId()); + + List bbsResult = egovCommuBBSMasterService.selectCommuBBSMasterListMain(bbsVo); + + // 방명록 제외 처리 + for (int i = 0; i < bbsResult.size(); i++) { + if ("BBST04".equals(bbsResult.get(i).getBbsTyCode())) { + bbsResult.remove(i); + } + } + + model.addAttribute("bbsList", bbsResult); + + //-------------------------------- + // 게시물 목록 정보 처리 + //-------------------------------- + BoardVO boardVo = null; + BoardMasterVO masterVo = null; + + ArrayList target = new ArrayList(); // Object => List + for (int i = 0; i < bbsResult.size() && i < 4; i++) { + masterVo = bbsResult.get(i); + boardVo = new BoardVO(); + + boardVo.setBbsId(masterVo.getBbsId()); + boardVo.setBbsNm(masterVo.getBbsNm()); + + boardVo.setPageUnit(4); + boardVo.setPageSize(4); + + boardVo.setFirstIndex(0); + boardVo.setRecordCountPerPage(4); + + Map map = egovArticleService.selectArticleList(boardVo); + + target.add(map.get("resultList")); + } + + model.addAttribute("articleList", target); + + return "egovframework/com/cop/cmy/EgovCmmntyBaseTmplContents"; + } + + /** + * 커뮤니티 가입신청을 등록한다. + * + * @param cmmntyUser + * @param sessionVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/cmy/insertCommuUserBySelf.do") + public String insertCmmntyUserBySelf(@ModelAttribute("cmmntyUser") CommunityUser cmmntyUser, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + //KISA 보안취약점 조치 (2018-12-10, 신용호) + if(!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + String retVal = ""; + + if ("".equals(cmmntyUser.getMngrAt())) { + cmmntyUser.setMngrAt("N"); + } + cmmntyUser.setUseAt("Y"); + cmmntyUser.setFrstRegisterId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + cmmntyUser.setEmplyrId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + cmmntyUser.setMberSttus("A"); + + if (isAuthenticated) { + + //--------------------------------------------- + // 승인요청 처리 + //--------------------------------------------- + retVal = egovCommuManageService.checkCommuUserDetail(cmmntyUser); + + //요청건이 없을 경우 + if (!retVal.equals("EXIST")) { + + egovCommuManageService.insertCommuUserRqst(cmmntyUser); + retVal = egovMessageSource.getMessage("comCopCmy.commuMain.joinMember.info.success"); //가입신청이 정상처리되었습니다. + } else { + + retVal = egovMessageSource.getMessage("comCopCmy.commuMain.joinMember.info.fail"); //이미 가입처리가 되어 있습니다. + } + ////------------------------------------------- + } + model.addAttribute("returnMsg", retVal); + model.addAttribute("cmmntyId", cmmntyUser.getCmmntyId()); + + return "redirect:/cop/cmy/cmmntyMain.do"; + } + + /** + * 커뮤니티를 탈퇴한다. + * + * @param cmmntyUser + * @param sessionVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/cmy/deleteCommuUserBySelf.do") + public String deleteCmmntyUserBySelf(@ModelAttribute("cmmntyUser") CommunityUserVO cmmntyUserVO, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + //KISA 보안취약점 조치 (2018-12-10, 신용호) + if(!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + //로그인한 사용자가 관리자인지 확인한다. + CommunityUserVO userVO = new CommunityUserVO(); + userVO.setCmmntyId(cmmntyUserVO.getCmmntyId()); + userVO.setEmplyrId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + Boolean isCommuAdmin = egovCommuManageService.selectIsCommuAdmin(userVO); + + //관리자는 탈퇴할 수 없음. + String resultMsg = ""; + if(isAuthenticated && !isCommuAdmin) { + cmmntyUserVO.setEmplyrId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + egovCommuManageService.deleteCommuUser(cmmntyUserVO); + resultMsg = egovMessageSource.getMessage("comCopCmy.commuMain.deleteMember.info.success"); //탈퇴신청이 정상처리되었습니다. + } else { + resultMsg = egovMessageSource.getMessage("comCopCmy.commuMain.deleteMember.info.admin"); //관리자는 탈퇴할수 없습니다. + } + + model.addAttribute("cmmntyId", cmmntyUserVO.getCmmntyId()); + model.addAttribute("returnMsg", resultMsg); + + return "redirect:/cop/cmy/cmmntyMain.do"; + } + + /** + * 커뮤니티 사용자 목록을 조회한다. + * + * @param cmmntyUserVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/cmy/selectCommuUserList.do") + public String selectCommuUserList(@ModelAttribute("searchVO") CommunityUserVO cmmntyUserVO, ModelMap model) throws Exception { + cmmntyUserVO.setPageUnit(propertyService.getInt("pageUnit")); + cmmntyUserVO.setPageSize(propertyService.getInt("pageSize")); + + PaginationInfo paginationInfo = new PaginationInfo(); + + paginationInfo.setCurrentPageNo(cmmntyUserVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(cmmntyUserVO.getPageUnit()); + paginationInfo.setPageSize(cmmntyUserVO.getPageSize()); + + cmmntyUserVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + cmmntyUserVO.setLastIndex(paginationInfo.getLastRecordIndex()); + cmmntyUserVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + Map map = egovCommuManageService.selectCommuUserList(cmmntyUserVO); + int totCnt = Integer.parseInt((String)map.get("resultCnt")); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList", map.get("resultList")); + model.addAttribute("resultCnt", map.get("resultCnt")); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/cop/cmy/EgovCommuUserList"; + } + + /** + * 커뮤니티 사용자를 등록한다. + * + * @param cmmntyUserVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/cmy/insertCommuUser.do") + public String insertCommuUser(@ModelAttribute("searchVO") CommunityUserVO cmmntyUserVO, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + // KISA 보안취약점 조치 (2018-12-10, 신용호) + if(!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + //로그인한 사용자가 관리자인지 확인한다. + CommunityUserVO userVO = new CommunityUserVO(); + userVO.setCmmntyId(cmmntyUserVO.getCmmntyId()); + userVO.setEmplyrId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + Boolean isCommuAdmin = egovCommuManageService.selectIsCommuAdmin(userVO); + + + if(isAuthenticated && isCommuAdmin) { + cmmntyUserVO.setLastUpdusrId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + egovCommuManageService.insertCommuUser(cmmntyUserVO); + } + + + + return "forward:/cop/cmy/selectCommuUserList.do"; + } + + /** + * 커뮤니티 사용자를 탈퇴시킨다. (가입거절 포함) + * + * @param cmmntyUserVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/cmy/deleteCommuUser.do") + public String deleteCommuUser(@ModelAttribute("searchVO") CommunityUserVO cmmntyUserVO, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + // KISA 보안취약점 조치 (2018-12-10, 신용호) + if(!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + //로그인한 사용자가 관리자인지 확인한다. + CommunityUserVO userVO = new CommunityUserVO(); + userVO.setCmmntyId(cmmntyUserVO.getCmmntyId()); + userVO.setEmplyrId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + Boolean isCommuAdmin = egovCommuManageService.selectIsCommuAdmin(userVO); + + + if(isAuthenticated && isCommuAdmin) { + egovCommuManageService.deleteCommuUser(cmmntyUserVO); + } + + + + return "forward:/cop/cmy/selectCommuUserList.do"; + } + + /** + * 커뮤니티 관리자를 등록한다. + * + * @param cmmntyUserVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/cmy/insertCommuUserAdmin.do") + public String insertCommuUserAdmin(@ModelAttribute("searchVO") CommunityUserVO cmmntyUserVO, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + // KISA 보안취약점 조치 (2018-12-10, 신용호) + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if(!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + //로그인한 사용자가 관리자인지 확인한다. + CommunityUserVO userVO = new CommunityUserVO(); + userVO.setCmmntyId(cmmntyUserVO.getCmmntyId()); + userVO.setEmplyrId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + Boolean isCommuAdmin = egovCommuManageService.selectIsCommuAdmin(userVO); + + + if(isAuthenticated && isCommuAdmin) { + cmmntyUserVO.setLastUpdusrId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + egovCommuManageService.insertCommuUserAdmin(cmmntyUserVO); + } + + + + return "forward:/cop/cmy/selectCommuUserList.do"; + } + + /** + * 커뮤니티 관리자를 해제한다. + * + * @param cmmntyUserVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/cmy/deleteCommuUserAdmin.do") + public String deleteCommuUserAdmin(@ModelAttribute("searchVO") CommunityUserVO cmmntyUserVO, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + // KISA 보안취약점 조치 (2018-12-10, 신용호) + if(!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + //로그인한 사용자가 관리자인지 확인한다. + CommunityUserVO userVO = new CommunityUserVO(); + userVO.setCmmntyId(cmmntyUserVO.getCmmntyId()); + userVO.setEmplyrId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + Boolean isCommuAdmin = egovCommuManageService.selectIsCommuAdmin(userVO); + + + //커뮤니티 개설자는 관리자해제를 할 수 없음. + CommunityVO cmmntyVO = new CommunityVO(); + cmmntyVO.setCmmntyId(cmmntyUserVO.getCmmntyId()); + cmmntyVO = egovCommuMasterService.selectCommuMaster(cmmntyVO); + //커뮤니티 최초등록자를 확인한다. 일치할 경우 관리자 해제 불가. + if(cmmntyVO.getFrstRegisterId().equals(cmmntyUserVO.getEmplyrId())) { + return "forward:/cop/cmy/selectCommuUserList.do"; + } + + + + if(isAuthenticated && isCommuAdmin) { + cmmntyUserVO.setLastUpdusrId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + egovCommuManageService.deleteCommuUserAdmin(cmmntyUserVO); + } + + + + return "forward:/cop/cmy/selectCommuUserList.do"; + } + + /** + * 미리보기 커뮤니티 메인페이지를 조회한다. + * + * @param cmmntyVO + * @param sessionVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/cmy/previewCmmntyMainPage.do") + public String previewCmmntyMainPage(@ModelAttribute("searchVO") CommunityVO cmmntyVO, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + cmmntyVO.setEmplyrId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + + String tmplatCours = cmmntyVO.getSearchWrd(); + + CommunityVO vo = new CommunityVO(); + + vo.setCmmntyNm("미리보기 커뮤니티"); + vo.setCmmntyIntrcn("미리보기를 위한 커뮤니티입니다."); + vo.setUseAt("Y"); + vo.setFrstRegisterId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); // 본인 + + CommunityUser cmmntyUser = new CommunityUser(); + + cmmntyUser.setEmplyrId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + cmmntyUser.setEmplyrNm("관리자"); + + model.addAttribute("cmmntyVO", vo); + model.addAttribute("cmmntyUser", cmmntyUser); + + //-------------------------------- + // 게시판 목록 정보 처리 + //-------------------------------- + List bbsResult = new ArrayList(); + + BoardMasterVO target = null; + + target = new BoardMasterVO(); + target.setBbsNm("방명록"); + bbsResult.add(target); + + target = new BoardMasterVO(); + target.setBbsNm("공지게시판"); + bbsResult.add(target); + + target = new BoardMasterVO(); + target.setBbsNm("갤러리"); + bbsResult.add(target); + + target = new BoardMasterVO(); + target.setBbsNm("자유게시판"); + bbsResult.add(target); + + target = new BoardMasterVO(); + target.setBbsNm("자료실"); + bbsResult.add(target); + + model.addAttribute("bbsList", bbsResult); + ////------------------------------ + + if (isAuthenticated) { + model.addAttribute("isAuthenticated", "Y"); + } else { + model.addAttribute("isAuthenticated", "N"); + } + + model.addAttribute("preview", "true"); + + // 안전한 경로 문자열로 조치 + tmplatCours = EgovWebUtil.filePathBlackList(tmplatCours); + + // 화이트 리스트 체크 + List templateWhiteList = egovTemplateManageService.selectTemplateWhiteList(); + LOGGER.debug("Template > WhiteList Count = {}",templateWhiteList.size()); + if ( tmplatCours == null ) tmplatCours = ""; + for(TemplateInfVO templateInfVO : templateWhiteList){ + LOGGER.debug("Template > whiteList TmplatCours = "+templateInfVO.getTmplatCours()); + if ( tmplatCours.equals(templateInfVO.getTmplatCours()) ) { + return tmplatCours; + } + } + + LOGGER.debug("Template > WhiteList mismatch! Please check Admin page!"); + return "egovframework/com/cmm/egovError"; + } + + /** + * 커뮤니티 메인페이지의 기본 내용(게시판 4개 표시) 조회한다. + * + * @param cmmntyVO + * @param sessionVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/cmy/previewCmmntyMainContents.do") + public String previewCmmntyMainContents(@ModelAttribute("searchVO") CommunityVO cmmntyVO, ModelMap model) throws Exception { + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + @SuppressWarnings("unused") + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + cmmntyVO.setEmplyrId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + + //-------------------------------- + // 게시판 목록 정보 처리 + //-------------------------------- + List bbsResult = new ArrayList(); + + BoardMasterVO master = null; + + master = new BoardMasterVO(); + master.setBbsNm("공지게시판"); + bbsResult.add(master); + + master = new BoardMasterVO(); + master.setBbsNm("갤러리"); + bbsResult.add(master); + + master = new BoardMasterVO(); + master.setBbsNm("자유게시판"); + bbsResult.add(master); + + master = new BoardMasterVO(); + master.setBbsNm("자료실"); + bbsResult.add(master); + + model.addAttribute("bbsList", bbsResult); + + //-------------------------------- + // 게시물 목록 정보 처리 + //-------------------------------- + ArrayList target = new ArrayList(); // Object => List + for (int i = 0; i < bbsResult.size() && i < 4; i++) { + + target.add(null); + } + + model.addAttribute("boardList", target); + + model.addAttribute("preview", "true"); + + return "egovframework/com/cop/tpl/EgovCmmntyBaseTmplContents"; + } + + +} diff --git a/src/main/java/egovframework/com/cop/cmy/web/EgovCommuMasterController.java b/src/main/java/egovframework/com/cop/cmy/web/EgovCommuMasterController.java new file mode 100644 index 0000000..cccfd4c --- /dev/null +++ b/src/main/java/egovframework/com/cop/cmy/web/EgovCommuMasterController.java @@ -0,0 +1,287 @@ +package egovframework.com.cop.cmy.web; + +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +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.springmodules.validation.commons.DefaultBeanValidator; + +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.cop.cmy.service.Community; +import egovframework.com.cop.cmy.service.CommunityUserVO; +import egovframework.com.cop.cmy.service.CommunityVO; +import egovframework.com.cop.cmy.service.EgovCommuManageService; +import egovframework.com.cop.cmy.service.EgovCommuMasterService; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +/** + * 커뮤니티 정보를 관리하기 위한 컨트롤러 클래스 + * @author 공통서비스개발팀 이삼섭 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *   -------       --------    ---------------------------
    + *   2009.4.2	이삼섭          최초 생성
    + *   2011.8.26	정진오			IncludedInfo annotation 추가
    + *   2011.9.7	정진오			커뮤니티 탈퇴 요청이 정상적으로 이뤄지지 않은 사항 수정함
    + *   							커뮤니티 탈퇴 요청시 승인자를 선택하므로 탈퇴 승인자가 자신이 될 수 없음에도
    + *   							세션에서 가져온 값(탈퇴신청자)을 탈퇴승인자로 설정하도록 되어 있었음
    + *   2016.06.13 김연호          표준프레임워크 v3.6 개선
    + * 
    + */ + +@Controller +public class EgovCommuMasterController { + + @Resource(name = "EgovCommuMasterService") + private EgovCommuMasterService egovCommuMasterService; + + @Resource(name = "EgovCommuManageService") + private EgovCommuManageService egovCommuManageService; + + @Resource(name = "propertiesService") + protected EgovPropertyService propertyService; + + @Autowired + private DefaultBeanValidator beanValidator; + + //Logger log = Logger.getLogger(this.getClass()); + + /** + * 커뮤니티에 대한 목록을 조회한다. + * + * @param cmmntyVO + * @param model + * @return + * @throws Exception + */ + @IncludedInfo(name="커뮤니티관리", order = 270 ,gid = 40) + @RequestMapping("/cop/cmy/selectCommuMasterList.do") + public String selectCommuMasterList(@ModelAttribute("searchVO") CommunityVO cmmntyVO, ModelMap model) throws Exception { + cmmntyVO.setPageUnit(propertyService.getInt("pageUnit")); + cmmntyVO.setPageSize(propertyService.getInt("pageSize")); + + PaginationInfo paginationInfo = new PaginationInfo(); + + paginationInfo.setCurrentPageNo(cmmntyVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(cmmntyVO.getPageUnit()); + paginationInfo.setPageSize(cmmntyVO.getPageSize()); + + cmmntyVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + cmmntyVO.setLastIndex(paginationInfo.getLastRecordIndex()); + cmmntyVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + Map map = egovCommuMasterService.selectCommuMasterList(cmmntyVO); + int totCnt = Integer.parseInt((String)map.get("resultCnt")); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList", map.get("resultList")); + model.addAttribute("resultCnt", map.get("resultCnt")); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/cop/cmy/EgovCommuMasterList"; + } + + /** + * 커뮤니티 등록을 위한 등록페이지로 이동한다. + * + * @param cmmntyVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/cmy/insertCommuMasterView.do") + public String insertCommuMasterView(@ModelAttribute("searchVO") CommunityVO cmmntyVO, ModelMap model) throws Exception { + model.addAttribute("commuMasterVO", new CommunityVO()); + + return "egovframework/com/cop/cmy/EgovCommuMasterRegist"; + } + + /** + * 커뮤니티 정보를 등록한다. + * + * @param cmmntyVO + * @param cmmnty + * @param status + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/cmy/insertCommuMaster.do") + public String insertCommuMaster(@ModelAttribute("searchVO") CommunityVO cmmntyVO, @ModelAttribute("commuMaster") Community community, + BindingResult bindingResult, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + // KISA 보안취약점 조치 (2018-12-10, 신용호) + if(!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + beanValidator.validate(community, bindingResult); + + if (bindingResult.hasErrors()) { + return "egovframework/com/cop/cmy/EgovCommuMasterRegist"; + } + + community.setRegistSeCode("REGC02"); + community.setFrstRegisterId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + + String cmmntyId = ""; + if (isAuthenticated) { + cmmntyId = egovCommuMasterService.insertCommuMaster(community); + + //커뮤니티 개설자의 정보를 등록한다. + CommunityUserVO cmmntyUserVO = new CommunityUserVO(); + cmmntyUserVO.setCmmntyId(cmmntyId); + cmmntyUserVO.setEmplyrId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + cmmntyUserVO.setMngrAt("Y"); + cmmntyUserVO.setMberSttus("P"); + cmmntyUserVO.setUseAt("Y"); + cmmntyUserVO.setFrstRegisterId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + + egovCommuManageService.insertCommuUserRqst(cmmntyUserVO); + } + + + + return "forward:/cop/cmy/selectCommuMasterList.do"; + } + + /** + * 커뮤니티에 대한 상세정보를 조회한다. + * + * @param cmmntyVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/cmy/selectCommuMasterDetail.do") + public String selectCommuMasterDetail(@ModelAttribute("searchVO") CommunityVO cmmntyVO, ModelMap model, HttpServletRequest request) throws Exception { + CommunityVO result = egovCommuMasterService.selectCommuMaster(cmmntyVO); + + //----------------------- + // 제공 URL + //----------------------- + result.setProvdUrl(request.getContextPath()+ "/cop/cmy/CommuMainPage.do?cmmntyId=" + result.getCmmntyId()); + ////--------------------- + + model.addAttribute("result", result); + + return "egovframework/com/cop/cmy/EgovCommuMasterDetail"; + } + + /** + * 커뮤니티 정보 수정을 위한 수정페이지로 이동한다. + * + * @param cmmntyVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/cmy/updateCommuMasterView.do") + public String updateCommuMasterView(@ModelAttribute("searchVO") CommunityVO cmmntyVO, ModelMap model) + throws Exception { + + CommunityVO result = egovCommuMasterService.selectCommuMaster(cmmntyVO); + + model.addAttribute("commuMasterVO", result); + + return "egovframework/com/cop/cmy/EgovCommuMasterUpdt"; + } + + /** + * 커뮤니티 정보를 수정한다. + * + * @param cmmntyVO + * @param status + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/cmy/updateCommuMaster.do") + public String updateCommuMaster(@ModelAttribute("searchVO") CommunityVO cmmntyVO, @ModelAttribute("commuMaster") Community community, + BindingResult bindingResult, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + // KISA 보안취약점 조치 (2018-12-10, 신용호) + if(!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + beanValidator.validate(community, bindingResult); + if (bindingResult.hasErrors()) { + + CommunityVO result = egovCommuMasterService.selectCommuMaster(cmmntyVO); + model.addAttribute("result", result); + + return "egovframework/com/cop/cmy/EgovCommuMasterUpdt"; + } + + community.setLastUpdusrId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + + egovCommuMasterService.updateCommuMaster(community); + + return "forward:/cop/cmy/selectCommuMasterList.do"; + } + + /** + * 커뮤니티 정보를 삭제한다. + * + * @param cmmntyVO + * @param status + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/cmy/deleteCommuMaster.do") + public String deleteCommuMaster(@ModelAttribute("searchVO") CommunityVO cmmntyVO, @ModelAttribute("commuMaster") Community community, + BindingResult bindingResult, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if (isAuthenticated) { + community.setLastUpdusrId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + egovCommuMasterService.deleteBBSMasterInf(community); + } + return "forward:/cop/cmy/selectCommuMasterList.do"; + } + + /** + * 포트릿을 위한 커뮤니티 정보 목록 정보를 조회한다. + * + * @param cmmntyVO + * @param sessionVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/cmy/selectCommuMasterListPortlet.do") + public String selectCmmntyListPortlet(@ModelAttribute("searchVO") CommunityVO cmmntyVO, ModelMap model) throws Exception { + List result = egovCommuMasterService.selectCommuMasterListPortlet(cmmntyVO); + + model.addAttribute("resultList", result); + + return "egovframework/com/cop/cmy/EgovCommuMasterListPortlet"; + } +} diff --git a/src/main/java/egovframework/com/cop/com/service/EgovUserInfManageService.java b/src/main/java/egovframework/com/cop/com/service/EgovUserInfManageService.java new file mode 100644 index 0000000..6791032 --- /dev/null +++ b/src/main/java/egovframework/com/cop/com/service/EgovUserInfManageService.java @@ -0,0 +1,86 @@ +package egovframework.com.cop.com.service; + +import java.util.List; +import java.util.Map; + +/** + * 협업 기능에서 사용자 정보를 관리하기 위한 서비스 인터페이스 클래스 + * @author 공통서비스개발팀 이삼섭 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.4.6  이삼섭          최초 생성
    + *
    + * 
    + */ +public interface EgovUserInfManageService { + + /** + * 사용자 정보에 대한 목록을 조회한다. + * + * @param userVO + * @return + * @throws Exception + */ + public Map selectUserList(UserInfVO userVO) throws Exception; + + /** + * 커뮤니티 사용자 목록을 조회한다. + * + * @param userVO + * @return + * @throws Exception + */ + public Map selectCmmntyUserList(UserInfVO userVO) throws Exception; + + /** + * 커뮤니티 관리자 목록을 조회한다. + * + * @param userVO + * @return + * @throws Exception + */ + public Map selectCmmntyMngrList(UserInfVO userVO) throws Exception; + + /** + * 동호회 사용자 목록을 조회한다. + * + * @param userVO + * @return + * @throws Exception + */ + public Map selectClubUserList(UserInfVO userVO) throws Exception; + + /** + * 동호회 운영자 목록을 조회한다. + * + * @param userVO + * @return + * @throws Exception + */ + public Map selectClubOprtrList(UserInfVO userVO) throws Exception; + + /** + * 동호회에 대한 모든 사용자 목록을 조회한다. + * + * @param userVO + * @return + * @throws Exception + */ + public List selectAllClubUser(UserInfVO userVO) throws Exception; + + /** + * 커뮤니티에 대한 모든 사용자 목록을 조회한다. + * + * @param userVO + * @return + * @throws Exception + */ + public List selectAllCmmntyUser(UserInfVO userVO) throws Exception; +} diff --git a/src/main/java/egovframework/com/cop/com/service/UserInfVO.java b/src/main/java/egovframework/com/cop/com/service/UserInfVO.java new file mode 100644 index 0000000..b01b44c --- /dev/null +++ b/src/main/java/egovframework/com/cop/com/service/UserInfVO.java @@ -0,0 +1,561 @@ +package egovframework.com.cop.com.service; + +import java.io.Serializable; + +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * 사용자 정보 조회를 위한 VO 클래스 + * @author 공통서비스개발팀 이삼섭 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.4.6  이삼섭          최초 생성
    + *
    + * 
    + */ +@SuppressWarnings("serial") +public class UserInfVO implements Serializable { + + /** 유일 아이디 */ + private String uniqId = ""; + + /** 사용자 아이디 */ + private String userId = ""; + + /** 사용자 명 */ + private String userNm = ""; + + /** 사용자 우편번호 */ + private String userZip = ""; + + /** 사용자 주소 */ + private String userAdres = ""; + + /** 사용자 이메일 */ + private String userEmail = ""; + + /** 검색시작일 */ + private String searchBgnDe = ""; + + /** 검색조건 */ + private String searchCnd = ""; + + /** 검색종료일 */ + private String searchEndDe = ""; + + /** 검색단어 */ + private String searchWrd = ""; + + /** 정렬순서(DESC,ASC) */ + private String sortOrdr = ""; + + /** 검색사용여부 */ + private String searchUseYn = ""; + + /** 현재페이지 */ + private int pageIndex = 1; + + /** 페이지갯수 */ + private int pageUnit = 10; + + /** 페이지사이즈 */ + private int pageSize = 10; + + /** 첫페이지 인덱스 */ + private int firstIndex = 1; + + /** 마지막페이지 인덱스 */ + private int lastIndex = 1; + + /** 페이지당 레코드 개수 */ + private int recordCountPerPage = 10; + + /** 레코드 번호 */ + private int rowNo = 0; + + /** 대상 아이디 */ + private String trgetId = ""; + + /** 사용여부 */ + private String useAt = "Y"; + + /** 커뮤니티 아이디 */ + private String cmmntyId = ""; + + /** 동호회 아이디 */ + private String clubId = ""; + + /** 대상 중지 여부 (커뮤니티 또는 동호회) */ + private String deletedAt = "N"; + + /** + * uniqId attribute를 리턴한다. + * + * @return the uniqId + */ + public String getUniqId() { + return uniqId; + } + + /** + * uniqId attribute 값을 설정한다. + * + * @param uniqId + * the uniqId to set + */ + public void setUniqId(String uniqId) { + this.uniqId = uniqId; + } + + /** + * userId attribute를 리턴한다. + * + * @return the userId + */ + public String getUserId() { + return userId; + } + + /** + * userId attribute 값을 설정한다. + * + * @param userId + * the userId to set + */ + public void setUserId(String userId) { + this.userId = userId; + } + + /** + * userNm attribute를 리턴한다. + * + * @return the userNm + */ + public String getUserNm() { + return userNm; + } + + /** + * userNm attribute 값을 설정한다. + * + * @param userNm + * the userNm to set + */ + public void setUserNm(String userNm) { + this.userNm = userNm; + } + + /** + * userZip attribute를 리턴한다. + * + * @return the userZip + */ + public String getUserZip() { + return userZip; + } + + /** + * userZip attribute 값을 설정한다. + * + * @param userZip + * the userZip to set + */ + public void setUserZip(String userZip) { + this.userZip = userZip; + } + + /** + * userAdres attribute를 리턴한다. + * + * @return the userAdres + */ + public String getUserAdres() { + return userAdres; + } + + /** + * userAdres attribute 값을 설정한다. + * + * @param userAdres + * the userAdres to set + */ + public void setUserAdres(String userAdres) { + this.userAdres = userAdres; + } + + /** + * userEmail attribute를 리턴한다. + * + * @return the userEmail + */ + public String getUserEmail() { + return userEmail; + } + + /** + * userEmail attribute 값을 설정한다. + * + * @param userEmail + * the userEmail to set + */ + public void setUserEmail(String userEmail) { + this.userEmail = userEmail; + } + + /** + * searchBgnDe attribute를 리턴한다. + * + * @return the searchBgnDe + */ + public String getSearchBgnDe() { + return searchBgnDe; + } + + /** + * searchBgnDe attribute 값을 설정한다. + * + * @param searchBgnDe + * the searchBgnDe to set + */ + public void setSearchBgnDe(String searchBgnDe) { + this.searchBgnDe = searchBgnDe; + } + + /** + * searchCnd attribute를 리턴한다. + * + * @return the searchCnd + */ + public String getSearchCnd() { + return searchCnd; + } + + /** + * searchCnd attribute 값을 설정한다. + * + * @param searchCnd + * the searchCnd to set + */ + public void setSearchCnd(String searchCnd) { + this.searchCnd = searchCnd; + } + + /** + * searchEndDe attribute를 리턴한다. + * + * @return the searchEndDe + */ + public String getSearchEndDe() { + return searchEndDe; + } + + /** + * searchEndDe attribute 값을 설정한다. + * + * @param searchEndDe + * the searchEndDe to set + */ + public void setSearchEndDe(String searchEndDe) { + this.searchEndDe = searchEndDe; + } + + /** + * searchWrd attribute를 리턴한다. + * + * @return the searchWrd + */ + public String getSearchWrd() { + return searchWrd; + } + + /** + * searchWrd attribute 값을 설정한다. + * + * @param searchWrd + * the searchWrd to set + */ + public void setSearchWrd(String searchWrd) { + this.searchWrd = searchWrd; + } + + /** + * sortOrdr attribute를 리턴한다. + * + * @return the sortOrdr + */ + public String getSortOrdr() { + return sortOrdr; + } + + /** + * sortOrdr attribute 값을 설정한다. + * + * @param sortOrdr + * the sortOrdr to set + */ + public void setSortOrdr(String sortOrdr) { + this.sortOrdr = sortOrdr; + } + + /** + * searchUseYn attribute를 리턴한다. + * + * @return the searchUseYn + */ + public String getSearchUseYn() { + return searchUseYn; + } + + /** + * searchUseYn attribute 값을 설정한다. + * + * @param searchUseYn + * the searchUseYn to set + */ + public void setSearchUseYn(String searchUseYn) { + this.searchUseYn = searchUseYn; + } + + /** + * pageIndex attribute를 리턴한다. + * + * @return the pageIndex + */ + public int getPageIndex() { + return pageIndex; + } + + /** + * pageIndex attribute 값을 설정한다. + * + * @param pageIndex + * the pageIndex to set + */ + public void setPageIndex(int pageIndex) { + this.pageIndex = pageIndex; + } + + /** + * pageUnit attribute를 리턴한다. + * + * @return the pageUnit + */ + public int getPageUnit() { + return pageUnit; + } + + /** + * pageUnit attribute 값을 설정한다. + * + * @param pageUnit + * the pageUnit to set + */ + public void setPageUnit(int pageUnit) { + this.pageUnit = pageUnit; + } + + /** + * pageSize attribute를 리턴한다. + * + * @return the pageSize + */ + public int getPageSize() { + return pageSize; + } + + /** + * pageSize attribute 값을 설정한다. + * + * @param pageSize + * the pageSize to set + */ + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + /** + * firstIndex attribute를 리턴한다. + * + * @return the firstIndex + */ + public int getFirstIndex() { + return firstIndex; + } + + /** + * firstIndex attribute 값을 설정한다. + * + * @param firstIndex + * the firstIndex to set + */ + public void setFirstIndex(int firstIndex) { + this.firstIndex = firstIndex; + } + + /** + * lastIndex attribute를 리턴한다. + * + * @return the lastIndex + */ + public int getLastIndex() { + return lastIndex; + } + + /** + * lastIndex attribute 값을 설정한다. + * + * @param lastIndex + * the lastIndex to set + */ + public void setLastIndex(int lastIndex) { + this.lastIndex = lastIndex; + } + + /** + * recordCountPerPage attribute를 리턴한다. + * + * @return the recordCountPerPage + */ + public int getRecordCountPerPage() { + return recordCountPerPage; + } + + /** + * recordCountPerPage attribute 값을 설정한다. + * + * @param recordCountPerPage + * the recordCountPerPage to set + */ + public void setRecordCountPerPage(int recordCountPerPage) { + this.recordCountPerPage = recordCountPerPage; + } + + /** + * rowNo attribute를 리턴한다. + * + * @return the rowNo + */ + public int getRowNo() { + return rowNo; + } + + /** + * rowNo attribute 값을 설정한다. + * + * @param rowNo + * the rowNo to set + */ + public void setRowNo(int rowNo) { + this.rowNo = rowNo; + } + + /** + * trgetId attribute를 리턴한다. + * + * @return the trgetId + */ + public String getTrgetId() { + return trgetId; + } + + /** + * trgetId attribute 값을 설정한다. + * + * @param trgetId + * the trgetId to set + */ + public void setTrgetId(String trgetId) { + this.trgetId = trgetId; + } + + /** + * useAt attribute를 리턴한다. + * + * @return the useAt + */ + public String getUseAt() { + return useAt; + } + + /** + * useAt attribute 값을 설정한다. + * + * @param useAt + * the useAt to set + */ + public void setUseAt(String useAt) { + this.useAt = useAt; + } + + /** + * cmmntyId attribute를 리턴한다. + * + * @return the cmmntyId + */ + public String getCmmntyId() { + return cmmntyId; + } + + /** + * cmmntyId attribute 값을 설정한다. + * + * @param cmmntyId + * the cmmntyId to set + */ + public void setCmmntyId(String cmmntyId) { + this.cmmntyId = cmmntyId; + } + + /** + * clubId attribute를 리턴한다. + * + * @return the clubId + */ + public String getClubId() { + return clubId; + } + + /** + * clubId attribute 값을 설정한다. + * + * @param clubId + * the clubId to set + */ + public void setClubId(String clubId) { + this.clubId = clubId; + } + + /** + * deletedAt attribute를 리턴한다. + * + * @return the deletedAt + */ + public String getDeletedAt() { + return deletedAt; + } + + /** + * deletedAt attribute 값을 설정한다. + * + * @param deletedAt + * the deletedAt to set + */ + public void setDeletedAt(String deletedAt) { + this.deletedAt = deletedAt; + } + + /** + * toString 메소드를 대치한다. + */ + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this); + } +} diff --git a/src/main/java/egovframework/com/cop/com/service/impl/EgovUserInfManageDAO.java b/src/main/java/egovframework/com/cop/com/service/impl/EgovUserInfManageDAO.java new file mode 100644 index 0000000..5e1c922 --- /dev/null +++ b/src/main/java/egovframework/com/cop/com/service/impl/EgovUserInfManageDAO.java @@ -0,0 +1,167 @@ +package egovframework.com.cop.com.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.cop.com.service.UserInfVO; + +import org.springframework.stereotype.Repository; + +/** + * 협업 활용 사용자 정보 조회를 위한 데이터 접근 클래스 + * @author 공통서비스개발팀 이삼섭 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.4.6  이삼섭          최초 생성
    + *
    + * 
    + */ +@Repository("EgovUserInfManageDAO") +public class EgovUserInfManageDAO extends EgovComAbstractDAO { + + /** + * 사용자 정보에 대한 목록을 조회한다. + * + * @param userVO + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List selectUserList(UserInfVO userVO) throws Exception { + return selectList("EgovUserInfManageDAO.selectUserList", userVO); + } + + /** + * 사용자 정보에 대한 목록 전체 건수를 조회한다. + * + * @param userVO + * @return + * @throws Exception + */ + public int selectUserListCnt(UserInfVO userVO) throws Exception { + return (Integer) selectOne("EgovUserInfManageDAO.selectUserListCnt", userVO); + } + + /** + * 커뮤니티 사용자 목록을 조회한다. + * + * @param userVO + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List selectCmmntyUserList(UserInfVO userVO) throws Exception { + return selectList("EgovUserInfManageDAO.selectCmmntyUserList", userVO); + } + + /** + * 커뮤니티 사용자 목록에 대한 전체 건수를 조회한다. + * + * @param userVO + * @return + * @throws Exception + */ + public int selectCmmntyUserListCnt(UserInfVO userVO) throws Exception { + return (Integer) selectOne("EgovUserInfManageDAO.selectCmmntyUserListCnt", userVO); + } + + /** + * 커뮤니티 관리자 목록을 조회한다. + * + * @param userVO + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List selectCmmntyMngrList(UserInfVO userVO) throws Exception { + return selectList("EgovUserInfManageDAO.selectCmmntyMngrList", userVO); + } + + /** + * 커뮤니티 관리자 목록에 대한 전체 건수를 조회한다. + * + * @param userVO + * @return + * @throws Exception + */ + public int selectCmmntyMngrListCnt(UserInfVO userVO) throws Exception { + return (Integer) selectOne("EgovUserInfManageDAO.selectCmmntyMngrListCnt", userVO); + } + + /** + * 동호회 사용자 목록을 조회한다. + * + * @param userVO + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List selectClubUserList(UserInfVO userVO) throws Exception { + return selectList("EgovUserInfManageDAO.selectClubUserList", userVO); + } + + /** + * 동호회 사용자 목록에 대한 전체 건수를 조회한다. + * + * @param userVO + * @return + * @throws Exception + */ + public int selectClubUserListCnt(UserInfVO userVO) throws Exception { + return (Integer) selectOne("EgovUserInfManageDAO.selectClubUserListCnt", userVO); + } + + /** + * 동호회 운영자 목록을 조회한다. + * + * @param userVO + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List selectClubOprtrList(UserInfVO userVO) throws Exception { + return selectList("EgovUserInfManageDAO.selectClubOprtrList", userVO); + } + + /** + * 동호회 운영자 목록에 대한 전체 건수를 조회한다. + * + * @param userVO + * @return + * @throws Exception + */ + public int selectClubOprtrListCnt(UserInfVO userVO) throws Exception { + return (Integer) selectOne("EgovUserInfManageDAO.selectClubOprtrListCnt", userVO); + } + + /** + * 동호회에 대한 모든 사용자 목록을 조회한다. + * + * @param userVO + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List selectAllClubUser(UserInfVO userVO) throws Exception { + return selectList("EgovUserInfManageDAO.selectAllClubUser", userVO); + } + + /** + * 커뮤니티에 대한 모든 사용자 목록을 조회한다. + * + * @param userVO + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List selectAllCmmntyUser(UserInfVO userVO) throws Exception { + return selectList("EgovUserInfManageDAO.selectAllCmmntyUser", userVO); + } +} diff --git a/src/main/java/egovframework/com/cop/com/service/impl/EgovUserInfManageServiceImpl.java b/src/main/java/egovframework/com/cop/com/service/impl/EgovUserInfManageServiceImpl.java new file mode 100644 index 0000000..5ecce26 --- /dev/null +++ b/src/main/java/egovframework/com/cop/com/service/impl/EgovUserInfManageServiceImpl.java @@ -0,0 +1,147 @@ +package egovframework.com.cop.com.service.impl; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import egovframework.com.cop.com.service.EgovUserInfManageService; +import egovframework.com.cop.com.service.UserInfVO; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +/** + * 협업에서 사용할 사용자 조회 서비스 기능 구현 클래스 + * @author 공통서비스개발팀 이삼섭 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.4.6  이삼섭          최초 생성
    + *
    + * 
    + */ +@Service("EgovUserInfManageService") +public class EgovUserInfManageServiceImpl extends EgovAbstractServiceImpl implements EgovUserInfManageService { + + @Resource(name = "EgovUserInfManageDAO") + private EgovUserInfManageDAO userInfDAO; + + /** + * 동호회 운영자 목록을 조회한다. + * + * @see egovframework.com.cop.com.service.EgovUserInfManageService#selectClubOprtrList(egovframework.com.cop.com.service.UserInfVO) + */ + @Override + public Map selectClubOprtrList(UserInfVO userVO) throws Exception { + List result = userInfDAO.selectClubOprtrList(userVO); + int cnt = userInfDAO.selectClubOprtrListCnt(userVO); + + Map map = new HashMap(); + + map.put("resultList", result); + map.put("resultCnt", Integer.toString(cnt)); + + return map; + } + + /** + * 동호회 사용자 목록을 조회한다. + * + * @see egovframework.com.cop.com.service.EgovUserInfManageService#selectClubUserList(egovframework.com.cop.com.service.UserInfVO) + */ + @Override + public Map selectClubUserList(UserInfVO userVO) throws Exception { + List result = userInfDAO.selectClubUserList(userVO); + int cnt = userInfDAO.selectClubUserListCnt(userVO); + + Map map = new HashMap(); + + map.put("resultList", result); + map.put("resultCnt", Integer.toString(cnt)); + + return map; + } + + /** + * 커뮤니티 관리자 목록을 조회한다. + * + * @see egovframework.com.cop.com.service.EgovUserInfManageService#selectCmmntyMngrList(egovframework.com.cop.com.service.UserInfVO) + */ + @Override + public Map selectCmmntyMngrList(UserInfVO userVO) throws Exception { + List result = userInfDAO.selectCmmntyMngrList(userVO); + int cnt = userInfDAO.selectCmmntyMngrListCnt(userVO); + + Map map = new HashMap(); + + map.put("resultList", result); + map.put("resultCnt", Integer.toString(cnt)); + + return map; + } + + /** + * 커뮤니티 사용자 목록을 조회한다. + * + * @see egovframework.com.cop.com.service.EgovUserInfManageService#selectCmmntyUserList(egovframework.com.cop.com.service.UserInfVO) + */ + @Override + public Map selectCmmntyUserList(UserInfVO userVO) throws Exception { + List result = userInfDAO.selectCmmntyUserList(userVO); + int cnt = userInfDAO.selectCmmntyUserListCnt(userVO); + + Map map = new HashMap(); + + map.put("resultList", result); + map.put("resultCnt", Integer.toString(cnt)); + + return map; + } + + /** + * 사용자 정보에 대한 목록을 조회한다. + * + * @see egovframework.com.cop.com.service.EgovUserInfManageService#selectUserList(egovframework.com.cop.com.service.UserInfVO) + */ + @Override + public Map selectUserList(UserInfVO userVO) throws Exception { + List result = userInfDAO.selectUserList(userVO); + int cnt = userInfDAO.selectUserListCnt(userVO); + + Map map = new HashMap(); + + map.put("resultList", result); + map.put("resultCnt", Integer.toString(cnt)); + + return map; + } + + /** + * 동호회에 대한 모든 사용자 목록을 조회한다. + * + * @see egovframework.com.cop.com.service.EgovUserInfManageService#selectAllClubUser(egovframework.com.cop.com.service.UserInfVO) + */ + @Override + public List selectAllClubUser(UserInfVO userVO) throws Exception { + return userInfDAO.selectAllClubUser(userVO); + } + + /** + * 커뮤니티에 대한 모든 사용자 목록을 조회한다. + * + * @see egovframework.com.cop.com.service.EgovUserInfManageService#selectAllCmmntyUser(egovframework.com.cop.com.service.UserInfVO) + */ + @Override + public List selectAllCmmntyUser(UserInfVO userVO) throws Exception { + return userInfDAO.selectAllCmmntyUser(userVO); + } +} diff --git a/src/main/java/egovframework/com/cop/com/web/EgovCopUserInfController.java b/src/main/java/egovframework/com/cop/com/web/EgovCopUserInfController.java new file mode 100644 index 0000000..c24d366 --- /dev/null +++ b/src/main/java/egovframework/com/cop/com/web/EgovCopUserInfController.java @@ -0,0 +1,90 @@ +package egovframework.com.cop.com.web; + +import java.util.Map; + +import egovframework.com.cop.com.service.EgovUserInfManageService; +import egovframework.com.cop.com.service.UserInfVO; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +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; + +/** + * 협업기능에서 활용하는 사용자 정보 조회용 컨트롤러 클래스 + * @author 공통서비스개발팀 이삼섭 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.4.6   이삼섭          최초 생성
    + *	 2011.07.21 안민정          커뮤니티 관련 메소드 분리 (->EgovCmyUserInfController)
    + *
    + * 
    + */ +@Controller +public class EgovCopUserInfController { + + @Resource(name = "EgovUserInfManageService") + private EgovUserInfManageService userInfService; + + @Resource(name = "propertiesService") + protected EgovPropertyService propertyService; + + /** + * 사용자 정보에 대한 목록을 조회한다. + * + * @param userVO + * @param sessionVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/com/selectUserList.do") + public String selectUserList(@ModelAttribute("searchVO") UserInfVO userVO, @RequestParam Map commandMap, ModelMap model) throws Exception { + String popFlag = (String) commandMap.get("PopFlag"); + String returnUrl = "egovframework/com/cop/com/EgovUserList"; + + if ("Y".equals(popFlag)) { + returnUrl = "egovframework/com/cop/com/EgovUserListPop"; + } + + userVO.setPageUnit(propertyService.getInt("pageUnit")); + userVO.setPageSize(propertyService.getInt("pageSize")); + + PaginationInfo paginationInfo = new PaginationInfo(); + + paginationInfo.setCurrentPageNo(userVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(userVO.getPageUnit()); + paginationInfo.setPageSize(userVO.getPageSize()); + + userVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + userVO.setLastIndex(paginationInfo.getLastRecordIndex()); + userVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + Map map = userInfService.selectUserList(userVO); + int totCnt = Integer.parseInt((String) map.get("resultCnt")); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList", map.get("resultList")); + model.addAttribute("resultCnt", map.get("resultCnt")); + model.addAttribute("targetMethod", "selectUserList"); + model.addAttribute("trgetId", ""); + model.addAttribute("paginationInfo", paginationInfo); + + return returnUrl; + } + +} diff --git a/src/main/java/egovframework/com/cop/com/web/EgovCopViewController.java b/src/main/java/egovframework/com/cop/com/web/EgovCopViewController.java new file mode 100644 index 0000000..397660a --- /dev/null +++ b/src/main/java/egovframework/com/cop/com/web/EgovCopViewController.java @@ -0,0 +1,67 @@ +package egovframework.com.cop.com.web; + +import java.util.Map; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; + +/** + * 협업 비로그인 유저용 컨트롤러 클래스 + * @author 공통서비스개발팀 이삼섭 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.4.10  이삼섭          최초 생성
    + *
    + * 
    + */ +@Controller +public class EgovCopViewController { + + /** + * 팝업 페이지를 호출한다. + * + * @param userVO + * @param sessionVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/com/openPopup.do") + public String openPopupWindow(@RequestParam Map commandMap, ModelMap model) throws Exception { + + String requestUrl = (String) commandMap.get("requestUrl"); + String trgetId = (String) commandMap.get("trgetId"); + String width = (String) commandMap.get("width"); + String height = (String) commandMap.get("height"); + String typeFlag = (String) commandMap.get("typeFlag"); + + if (trgetId != null && trgetId != "") { + if (typeFlag != null && typeFlag != "") { + model.addAttribute("requestUrl", requestUrl + "?trgetId=" + trgetId + "&PopFlag=Y&typeFlag=" + typeFlag); + } else { + model.addAttribute("requestUrl", requestUrl + "?trgetId=" + trgetId + "&PopFlag=Y"); + } + } else { + if (typeFlag != null && typeFlag != "") { + model.addAttribute("requestUrl", requestUrl + "?PopFlag=Y&typeFlag=" + typeFlag); + } else { + model.addAttribute("requestUrl", requestUrl + "?PopFlag=Y"); + } + + } + + model.addAttribute("width", width); + model.addAttribute("height", height); + + return "egovframework/com/cop/com/EgovModalPopupFrame"; + } +} diff --git a/src/main/java/egovframework/com/cop/ems/service/AtchmnFileVO.java b/src/main/java/egovframework/com/cop/ems/service/AtchmnFileVO.java new file mode 100644 index 0000000..cff2fb2 --- /dev/null +++ b/src/main/java/egovframework/com/cop/ems/service/AtchmnFileVO.java @@ -0,0 +1,147 @@ +package egovframework.com.cop.ems.service; + +/** + * 발송메일에 첨부되는 파일 VO 클래스 + * @author 공통서비스 개발팀 박지욱 + * @since 2009.03.12 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2009.03.12  박지욱          최초 생성
    + *
    + *  
    + */ +public class AtchmnFileVO { + + /** 첨부파일ID */ + private String atchFileId; + /** 파일연번 */ + private String fileSn; + /** 원파일명 */ + private String orignlFileNm; + /** 저장파일명 */ + private String streFileNm; + /** 파일저장경로 */ + private String fileStreCours; + /** 파일확장자 */ + private String fileExtsn; + /** 파일크기 */ + private int fileMg; + + /** + * atchFileId attribute 를 리턴한다. + * @return String + */ + public String getAtchFileId() { + return atchFileId; + } + + /** + * atchFileId attribute 값을 설정한다. + * @param atchFileId String + */ + public void setAtchFileId(String atchFileId) { + this.atchFileId = atchFileId; + } + + /** + * fileSn attribute 를 리턴한다. + * @return String + */ + public String getFileSn() { + return fileSn; + } + + /** + * fileSn attribute 값을 설정한다. + * @param fileSn String + */ + public void setFileSn(String fileSn) { + this.fileSn = fileSn; + } + + /** + * orignlFileNm attribute 를 리턴한다. + * @return String + */ + public String getOrignlFileNm() { + return orignlFileNm; + } + + /** + * orignlFileNm attribute 값을 설정한다. + * @param orignlFileNm String + */ + public void setOrignlFileNm(String orignlFileNm) { + this.orignlFileNm = orignlFileNm; + } + + /** + * streFileNm attribute 를 리턴한다. + * @return String + */ + public String getStreFileNm() { + return streFileNm; + } + + /** + * streFileNm attribute 값을 설정한다. + * @param streFileNm String + */ + public void setStreFileNm(String streFileNm) { + this.streFileNm = streFileNm; + } + + /** + * fileStreCours attribute 를 리턴한다. + * @return String + */ + public String getFileStreCours() { + return fileStreCours; + } + + /** + * fileStreCours attribute 값을 설정한다. + * @param fileStreCours String + */ + public void setFileStreCours(String fileStreCours) { + this.fileStreCours = fileStreCours; + } + + /** + * fileExtsn attribute 를 리턴한다. + * @return String + */ + public String getFileExtsn() { + return fileExtsn; + } + + /** + * fileExtsn attribute 값을 설정한다. + * @param fileExtsn String + */ + public void setFileExtsn(String fileExtsn) { + this.fileExtsn = fileExtsn; + } + + /** + * fileMg attribute 를 리턴한다. + * @return int + */ + public int getFileMg() { + return fileMg; + } + + /** + * fileMg attribute 값을 설정한다. + * @param fileMg int + */ + public void setFileMg(int fileMg) { + this.fileMg = fileMg; + } +} diff --git a/src/main/java/egovframework/com/cop/ems/service/EgovMultiPartEmail.java b/src/main/java/egovframework/com/cop/ems/service/EgovMultiPartEmail.java new file mode 100644 index 0000000..3125e0f --- /dev/null +++ b/src/main/java/egovframework/com/cop/ems/service/EgovMultiPartEmail.java @@ -0,0 +1,129 @@ +package egovframework.com.cop.ems.service; + +import java.io.Serializable; + +import org.apache.commons.mail.DefaultAuthenticator; +import org.apache.commons.mail.EmailAttachment; +import org.apache.commons.mail.EmailException; +import org.apache.commons.mail.MultiPartEmail; + +/** + * 발송메일에 첨부파일용으로 사용되는 VO 클래스 + * @author 공통서비스 개발팀 이기하 + * @since 2011.12.06 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *    수정일      	수정자          수정내용
    + *  ----------     --------    ---------------------------
    + *  2011.12.06		이기하          최초 생성
    + *  2013.05.23		이기하          thread-safe 하게 변경
    + *
    + *  
    + */ + +public class EgovMultiPartEmail implements Serializable { + + private static final long serialVersionUID = -4322006921324597283L; + private String id; + private String password; + private int port; + private String host; + private String emailAddress; + private String senderName; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public int getPort() { + return port; + } + + public void setPort(int port) { + this.port = port; + } + + public String getHost() { + return host; + } + + public void setHost(String host) { + this.host = host; + } + + public String getEmailAddress() { + return emailAddress; + } + + public void setEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + } + + public String getSenderName() { + return senderName; + } + + public void setSenderName(String senderName) { + this.senderName = senderName; + } + + @Deprecated + public String send() throws EmailException { + MultiPartEmail email = new MultiPartEmail(); + + email.setCharset("UTF-8"); + email.setHostName(this.host); + email.setSmtpPort(this.port); + email.setStartTLSEnabled(true); + email.setAuthenticator(new DefaultAuthenticator(this.id, this.password)); + email.setSocketConnectionTimeout(60000); + email.setSocketTimeout(60000); + email.setFrom(this.emailAddress, this.senderName); + + return email.send(); + } + + public String send(String addTo, String subject, String msg) throws EmailException { + return send(addTo, subject, msg, null); + } + + public String send(String addTo, String subject, String msg, EmailAttachment attachment) throws EmailException { + MultiPartEmail email = new MultiPartEmail(); + + email.setCharset("UTF-8"); + email.setHostName(this.host); + email.setSmtpPort(this.port); + email.setStartTLSEnabled(true); + email.setAuthenticator(new DefaultAuthenticator(this.id, this.password)); + email.setSocketConnectionTimeout(60000); + email.setSocketTimeout(60000); + email.setFrom(this.emailAddress, this.senderName); + email.addTo(addTo); + email.setSubject(subject); + email.setMsg(msg); + + if (attachment != null) { + email.attach(attachment); + } + + return email.send(); + + } + +} diff --git a/src/main/java/egovframework/com/cop/ems/service/EgovSndngMailDetailService.java b/src/main/java/egovframework/com/cop/ems/service/EgovSndngMailDetailService.java new file mode 100644 index 0000000..ffb2d80 --- /dev/null +++ b/src/main/java/egovframework/com/cop/ems/service/EgovSndngMailDetailService.java @@ -0,0 +1,42 @@ +package egovframework.com.cop.ems.service; + +/** + * 발송메일을 상세 조회하는 비즈니스 인터페이스 클래스 + * @author 공통서비스 개발팀 박지욱 + * @since 2009.03.12 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2009.03.12  박지욱          최초 생성
    + *
    + *  
    + */ +public interface EgovSndngMailDetailService { + + /** + * 발송메일을 상세 조회한다. + * @param vo SndngMailVO + * @return SndngMailVO + * @exception Exception + */ + SndngMailVO selectSndngMail(SndngMailVO vo) throws Exception; + + /** + * 발송메일을 삭제한다. + * @param vo SndngMailVO + * @exception + */ + void deleteSndngMail(SndngMailVO vo) throws Exception; + + /** + * 첨부파일을 삭제한다. + * @param vo SndngMailVO + * @exception + */ + void deleteAtchmnFile(SndngMailVO vo) throws Exception; +} diff --git a/src/main/java/egovframework/com/cop/ems/service/EgovSndngMailDtlsService.java b/src/main/java/egovframework/com/cop/ems/service/EgovSndngMailDtlsService.java new file mode 100644 index 0000000..0dac5c2 --- /dev/null +++ b/src/main/java/egovframework/com/cop/ems/service/EgovSndngMailDtlsService.java @@ -0,0 +1,47 @@ +package egovframework.com.cop.ems.service; + +import java.util.List; + +import egovframework.com.cmm.ComDefaultVO; + +/** + * 발송메일 내역을 조회하는 비즈니스 인터페이스 클래스 + * @author 공통서비스 개발팀 박지욱 + * @since 2009.03.12 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2009.03.12  박지욱          최초 생성
    + *
    + *  
    + */ +public interface EgovSndngMailDtlsService { + + /** + * 발송메일 목록을 조회한다. + * @param vo ComDefaultVO + * @return List + * @exception Exception + */ + List selectSndngMailList(ComDefaultVO vo) throws Exception; + + /** + * 발송메일 총건수를 조회한다. + * @param vo ComDefaultVO + * @return int + * @exception + */ + int selectSndngMailListTotCnt(ComDefaultVO vo) throws Exception; + + /** + * 발송메일을 삭제한다. + * @param vo SndngMailVO + * @exception + */ + void deleteSndngMailList(SndngMailVO vo) throws Exception; +} diff --git a/src/main/java/egovframework/com/cop/ems/service/EgovSndngMailRegistService.java b/src/main/java/egovframework/com/cop/ems/service/EgovSndngMailRegistService.java new file mode 100644 index 0000000..1de0aa4 --- /dev/null +++ b/src/main/java/egovframework/com/cop/ems/service/EgovSndngMailRegistService.java @@ -0,0 +1,44 @@ +package egovframework.com.cop.ems.service; + +/** + * 발송메일등록, 발송요청XML파일 생성하는 비즈니스 인터페이스 클래스 + * @author 공통서비스 개발팀 박지욱 + * @since 2009.03.12 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2009.03.12  박지욱          최초 생성
    + *
    + *  
    + */ +public interface EgovSndngMailRegistService { + + /** + * 발송할 메일을 등록한다 + * @param vo SndngMailVO + * @return boolean + * @exception Exception + */ + boolean insertSndngMail(SndngMailVO vo) throws Exception; + + /** + * 발송할 메일을 XML파일로 만들어 저장한다. + * @param vo SndngMailVO + * @return boolean + * @exception Exception + */ + public boolean trnsmitXmlData(SndngMailVO vo) throws Exception; + + /** + * 발송메일 발송결과 XML파일을 읽어 발송결과코드에 수정한다. + * @param xml String + * @return boolean + * @exception Exception + */ + public boolean recptnXmlData(String xml) throws Exception; +} diff --git a/src/main/java/egovframework/com/cop/ems/service/EgovSndngMailService.java b/src/main/java/egovframework/com/cop/ems/service/EgovSndngMailService.java new file mode 100644 index 0000000..789eb7c --- /dev/null +++ b/src/main/java/egovframework/com/cop/ems/service/EgovSndngMailService.java @@ -0,0 +1,28 @@ +package egovframework.com.cop.ems.service; + +/** + * 메일 솔루션과 연동해서 이용해서 메일을 보내는 서비스 클래스 + * @since 2011.09.09 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2011.09.09  서준식       최초 작성
    + *
    + *  
    + */ + +public interface EgovSndngMailService { + + /** + * 메일을 발송한다 + * @param vo SndngMailVO + * @return boolean + * @exception Exception + */ + boolean sndngMail(SndngMailVO vo) throws Exception; +} diff --git a/src/main/java/egovframework/com/cop/ems/service/SndngMail.java b/src/main/java/egovframework/com/cop/ems/service/SndngMail.java new file mode 100644 index 0000000..8541db6 --- /dev/null +++ b/src/main/java/egovframework/com/cop/ems/service/SndngMail.java @@ -0,0 +1,147 @@ +package egovframework.com.cop.ems.service; + +/** + * 발송메일 모델 클래스 + * @author 공통서비스 개발팀 박지욱 + * @since 2009.03.12 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2009.03.12  박지욱          최초 생성
    + *
    + *  
    + */ +public class SndngMail { + + /** 발신자 */ + public String dsptchPerson; + /** 내용 */ + public String emailCn; + /** 메시지ID */ + public String mssageId; + /** 수신자 */ + public String recptnPerson; + /** 제목 */ + public String sj; + /** 발송결과코드 */ + public String sndngResultCode; + /** 발신일자 */ + private String sndngDe; + + /** + * dsptchPerson attribute 를 리턴한다. + * @return String + */ + public String getDsptchPerson() { + return dsptchPerson; + } + + /** + * dsptchPerson attribute 값을 설정한다. + * @param dsptchPerson String + */ + public void setDsptchPerson(String dsptchPerson) { + this.dsptchPerson = dsptchPerson; + } + + /** + * emailCn attribute 를 리턴한다. + * @return String + */ + public String getEmailCn() { + return emailCn; + } + + /** + * emailCn attribute 값을 설정한다. + * @param emailCn String + */ + public void setEmailCn(String emailCn) { + this.emailCn = emailCn; + } + + /** + * mssageId attribute 를 리턴한다. + * @return String + */ + public String getMssageId() { + return mssageId; + } + + /** + * mssageId attribute 값을 설정한다. + * @param mssageId String + */ + public void setMssageId(String mssageId) { + this.mssageId = mssageId; + } + + /** + * recptnPerson attribute 를 리턴한다. + * @return String + */ + public String getRecptnPerson() { + return recptnPerson; + } + + /** + * recptnPerson attribute 값을 설정한다. + * @param recptnPerson String + */ + public void setRecptnPerson(String recptnPerson) { + this.recptnPerson = recptnPerson; + } + + /** + * sj attribute 를 리턴한다. + * @return String + */ + public String getSj() { + return sj; + } + + /** + * sj attribute 값을 설정한다. + * @param sj String + */ + public void setSj(String sj) { + this.sj = sj; + } + + /** + * sndngResultCode attribute 를 리턴한다. + * @return String + */ + public String getSndngResultCode() { + return sndngResultCode; + } + + /** + * sndngResultCode attribute 값을 설정한다. + * @param sndngResultCode String + */ + public void setSndngResultCode(String sndngResultCode) { + this.sndngResultCode = sndngResultCode; + } + + /** + * sndngDe attribute 를 리턴한다. + * @return String + */ + public String getSndngDe() { + return sndngDe; + } + + /** + * sndngDe attribute 값을 설정한다. + * @param sndngDe String + */ + public void setSndngDe(String sndngDe) { + this.sndngDe = sndngDe; + } +} diff --git a/src/main/java/egovframework/com/cop/ems/service/SndngMailVO.java b/src/main/java/egovframework/com/cop/ems/service/SndngMailVO.java new file mode 100644 index 0000000..d5380f8 --- /dev/null +++ b/src/main/java/egovframework/com/cop/ems/service/SndngMailVO.java @@ -0,0 +1,240 @@ +package egovframework.com.cop.ems.service; + +/** + * 발송메일 VO 클래스 + * @author 공통서비스 개발팀 박지욱 + * @since 2009.03.12 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2009.03.12  박지욱          최초 생성
    + *  2011.12.06  이기하          첨부파일경로(fileStreCours), 첨부파일이름(orignlFileNm) 추가
    + *
    + *  
    + */ +public class SndngMailVO { + + /** 메세지ID */ + private String mssageId; + /** 발신자 */ + private String dsptchPerson; + /** 수신자 */ + private String recptnPerson; + /** 제목 */ + private String sj; + /** 발송결과코드 */ + private String sndngResultCode; + /** 메일내용 */ + private String emailCn; + /** 첨부파일ID */ + private String atchFileId; + /** 첨부파일경로 */ + private String fileStreCours; + /** 첨부파일이름 */ + private String orignlFileNm; + /** 발신일자 */ + private String sndngDe; + /** 첨부파일ID 리스트 */ + private String atchFileIdList; + /** 발송요청XML내용 */ + private String xmlContent; + /** 팝업링크여부(Y/N) */ + private String link; + + /** + * mssageId attribute 를 리턴한다. + * @return String + */ + public String getMssageId() { + return mssageId; + } + + /** + * mssageId attribute 값을 설정한다. + * @param mssageId String + */ + public void setMssageId(String mssageId) { + this.mssageId = mssageId; + } + + /** + * dsptchPerson attribute 를 리턴한다. + * @return String + */ + public String getDsptchPerson() { + return dsptchPerson; + } + + /** + * dsptchPerson attribute 값을 설정한다. + * @param dsptchPerson String + */ + public void setDsptchPerson(String dsptchPerson) { + this.dsptchPerson = dsptchPerson; + } + + /** + * recptnPerson attribute 를 리턴한다. + * @return String + */ + public String getRecptnPerson() { + return recptnPerson; + } + + /** + * recptnPerson attribute 값을 설정한다. + * @param recptnPerson String + */ + public void setRecptnPerson(String recptnPerson) { + this.recptnPerson = recptnPerson; + } + + /** + * sj attribute 를 리턴한다. + * @return String + */ + public String getSj() { + return sj; + } + + /** + * sj attribute 값을 설정한다. + * @param sj String + */ + public void setSj(String sj) { + this.sj = sj; + } + + /** + * sndngResultCode attribute 를 리턴한다. + * @return String + */ + public String getSndngResultCode() { + return sndngResultCode; + } + + /** + * sndngResultCode attribute 값을 설정한다. + * @param sndngResultCode String + */ + public void setSndngResultCode(String sndngResultCode) { + this.sndngResultCode = sndngResultCode; + } + + /** + * emailCn attribute 를 리턴한다. + * @return String + */ + public String getEmailCn() { + return emailCn; + } + + /** + * emailCn attribute 값을 설정한다. + * @param emailCn String + */ + public void setEmailCn(String emailCn) { + this.emailCn = emailCn; + } + + /** + * atchFileId attribute 를 리턴한다. + * @return String + */ + public String getAtchFileId() { + return atchFileId; + } + + /** + * atchFileId attribute 값을 설정한다. + * @param atchFileId String + */ + public void setAtchFileId(String atchFileId) { + this.atchFileId = atchFileId; + } + + public String getFileStreCours() { + return fileStreCours; + } + + public void setFileStreCours(String fileStreCours) { + this.fileStreCours = fileStreCours; + } + + public String getOrignlFileNm() { + return orignlFileNm; + } + + public void setOrignlFileNm(String orignlFileNm) { + this.orignlFileNm = orignlFileNm; + } + + /** + * sndngDe attribute 를 리턴한다. + * @return String + */ + public String getSndngDe() { + return sndngDe; + } + + /** + * sndngDe attribute 값을 설정한다. + * @param sndngDe String + */ + public void setSndngDe(String sndngDe) { + this.sndngDe = sndngDe; + } + + /** + * atchFileIdList attribute 를 리턴한다. + * @return String + */ + public String getAtchFileIdList() { + return atchFileIdList; + } + + /** + * atchFileIdList attribute 값을 설정한다. + * @param atchFileIdList String + */ + public void setAtchFileIdList(String atchFileIdList) { + this.atchFileIdList = atchFileIdList; + } + + /** + * xmlContent attribute 를 리턴한다. + * @return String + */ + public String getXmlContent() { + return xmlContent; + } + + /** + * xmlContent attribute 값을 설정한다. + * @param xmlContent String + */ + public void setXmlContent(String xmlContent) { + this.xmlContent = xmlContent; + } + + /** + * link attribute 를 리턴한다. + * @return String + */ + public String getLink() { + return link; + } + + /** + * link attribute 값을 설정한다. + * @param link String + */ + public void setLink(String link) { + this.link = link; + } +} diff --git a/src/main/java/egovframework/com/cop/ems/service/impl/EgovSndngMailDetailServiceImpl.java b/src/main/java/egovframework/com/cop/ems/service/impl/EgovSndngMailDetailServiceImpl.java new file mode 100644 index 0000000..b6933d2 --- /dev/null +++ b/src/main/java/egovframework/com/cop/ems/service/impl/EgovSndngMailDetailServiceImpl.java @@ -0,0 +1,90 @@ +package egovframework.com.cop.ems.service.impl; + +import java.io.File; + +import egovframework.com.cmm.service.EgovFileMngService; +import egovframework.com.cmm.service.FileVO; +import egovframework.com.cmm.service.Globals; +import egovframework.com.cop.ems.service.EgovSndngMailDetailService; +import egovframework.com.cop.ems.service.SndngMailVO; +import egovframework.com.utl.sim.service.EgovFileTool; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +/** + * 발송메일을 상세 조회하는 비즈니스 구현 클래스 + * @author 공통서비스 개발팀 박지욱 + * @since 2009.03.12 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2009.03.12  박지욱          최초 생성
    + *
    + *  
    + */ +@Service("sndngMailDetailService") +public class EgovSndngMailDetailServiceImpl extends EgovAbstractServiceImpl implements EgovSndngMailDetailService { + + // 파일구분자 + static final char FILE_SEPARATOR = File.separatorChar; + + @Resource(name = "sndngMailDetailDAO") + private SndngMailDetailDAO sndngMailDetailDAO; + + @Resource(name = "EgovFileMngService") + private EgovFileMngService egovFileMngService; + + /** + * 발송메일을 상세 조회한다. + * @param vo SndngMailVO + * @return SndngMailVO + * @exception Exception + */ + @Override + public SndngMailVO selectSndngMail(SndngMailVO vo) throws Exception { + + // 1. 발송메일 정보를 조회한다. + SndngMailVO resultMailVO = sndngMailDetailDAO.selectSndngMail(vo); + + return resultMailVO; + } + + /** + * 발송메일을 삭제한다. + * @param vo SndngMailVO + * @exception + */ + @Override + public void deleteSndngMail(SndngMailVO vo) throws Exception { + + // 1. 발송메일을 삭제한다. + sndngMailDetailDAO.deleteSndngMail(vo); + + // 2. 발송요청XML파일을 삭제한다. + String xmlFile = Globals.MAIL_REQUEST_PATH + vo.getMssageId() + ".xml"; + EgovFileTool.deleteFile(xmlFile); + } + + /** + * 첨부파일을 삭제한다. + * @param vo SndngMailVO + * @exception + */ + @Override + public void deleteAtchmnFile(SndngMailVO vo) throws Exception { + + // 1. 첨부파일 목록을 삭제한다. (이삼섭 책임 제공) + FileVO fileVO = new FileVO(); + fileVO.setAtchFileId(vo.getAtchFileId()); + egovFileMngService.deleteAllFileInf(fileVO); + } +} diff --git a/src/main/java/egovframework/com/cop/ems/service/impl/EgovSndngMailDtlsServiceImpl.java b/src/main/java/egovframework/com/cop/ems/service/impl/EgovSndngMailDtlsServiceImpl.java new file mode 100644 index 0000000..1f2bf48 --- /dev/null +++ b/src/main/java/egovframework/com/cop/ems/service/impl/EgovSndngMailDtlsServiceImpl.java @@ -0,0 +1,90 @@ +package egovframework.com.cop.ems.service.impl; + +import java.util.List; + +import egovframework.com.cmm.ComDefaultVO; +import egovframework.com.cop.ems.service.EgovSndngMailDetailService; +import egovframework.com.cop.ems.service.EgovSndngMailDtlsService; +import egovframework.com.cop.ems.service.SndngMailVO; +import egovframework.com.utl.fcc.service.EgovStringUtil; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +/** + * 발송메일 내역을 조회하는 비즈니스 구현 클래스 + * @author 공통서비스 개발팀 박지욱 + * @since 2009.03.12 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2009.03.12  박지욱          최초 생성
    + *
    + *  
    + */ +@Service("sndngMailDtlsService") +public class EgovSndngMailDtlsServiceImpl extends EgovAbstractServiceImpl implements EgovSndngMailDtlsService { + + @Resource(name = "sndngMailDtlsDAO") + private SndngMailDtlsDAO sndngMailDtlsDAO; + + @Resource(name = "sndngMailDetailService") + private EgovSndngMailDetailService sndngMailDetailService; + + /** + * 발송메일 목록을 조회한다. + * @param vo ComDefaultVO + * @return List + * @exception Exception + */ + @Override + public List selectSndngMailList(ComDefaultVO vo) throws Exception { + return sndngMailDtlsDAO.selectSndngMailList(vo); + } + + /** + * 발송메일 총건수를 조회한다. + * @param vo ComDefaultVO + * @return int + * @exception + */ + @Override + public int selectSndngMailListTotCnt(ComDefaultVO vo) throws Exception { + return sndngMailDtlsDAO.selectSndngMailListTotCnt(vo); + } + + /** + * 발송메일을 삭제한다. + * @param vo SndngMailVO + * @exception + */ + @Override + public void deleteSndngMailList(SndngMailVO vo) throws Exception { + + // 1. 발송메일을 삭제한다. + String[] sbuf = EgovStringUtil.split(vo.getMssageId(), ","); + for (int i = 0; i < sbuf.length; i++) { + SndngMailVO sndngMailVO = new SndngMailVO(); + sndngMailVO.setMssageId(sbuf[i]); + sndngMailDetailService.deleteSndngMail(sndngMailVO); + } + + // 2. 첨부파일을 삭제한다. + if (vo.getAtchFileIdList() != null) {//KISA 보안약점 조치 (2018-10-29, 윤창원) + String[] fbuf = EgovStringUtil.split(vo.getAtchFileIdList(), ","); + for (int i = 0; i < fbuf.length; i++) { + SndngMailVO sndngMailVO = new SndngMailVO(); + sndngMailVO.setAtchFileId(fbuf[i]); + sndngMailDetailService.deleteAtchmnFile(sndngMailVO); + } + } + } +} diff --git a/src/main/java/egovframework/com/cop/ems/service/impl/EgovSndngMailRegistServiceImpl.java b/src/main/java/egovframework/com/cop/ems/service/impl/EgovSndngMailRegistServiceImpl.java new file mode 100644 index 0000000..3145ce2 --- /dev/null +++ b/src/main/java/egovframework/com/cop/ems/service/impl/EgovSndngMailRegistServiceImpl.java @@ -0,0 +1,187 @@ +package egovframework.com.cop.ems.service.impl; + +import java.io.File; +import java.util.List; + +import egovframework.com.cmm.service.EgovFileMngService; +import egovframework.com.cmm.service.FileVO; +import egovframework.com.cmm.service.Globals; +import egovframework.com.cop.ems.service.AtchmnFileVO; +import egovframework.com.cop.ems.service.EgovSndngMailRegistService; +import egovframework.com.cop.ems.service.EgovSndngMailService; +import egovframework.com.cop.ems.service.SndngMailVO; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import egovframework.com.utl.sim.service.EgovXMLDoc; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +import javax.annotation.Resource; + +import noNamespace.SndngMailDocument; + +import org.springframework.stereotype.Service; + +/** + * 발송메일등록, 발송요청XML파일 생성하는 비즈니스 구현 클래스 + * @author 공통서비스 개발팀 박지욱 + * @since 2009.03.12 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2009.03.12  박지욱          최초 생성
    + *  2011.07.27  서준식          메일 발송내역 DB 저장시 첨부파일이 없으면 NULL로 변경
    + *  2011.12.06  이기하          메일 첨부파일이 기능 추가
    + *  2015.02.02  표준프레임워크  메일 첨부파일 오류 수정
    + *  
    + */ +@Service("sndngMailRegistService") +public class EgovSndngMailRegistServiceImpl extends EgovAbstractServiceImpl implements EgovSndngMailRegistService { + + /** SndngMailRegistDAO */ + @Resource(name = "sndngMailRegistDAO") + private SndngMailRegistDAO sndngMailRegistDAO; + + /** Message ID Generation */ + @Resource(name = "egovMailMsgIdGnrService") + private EgovIdGnrService egovMailMsgIdGnrService; + + @Resource(name = "egovSndngMailService") + private EgovSndngMailService egovSndngMailService; + + @Resource(name = "EgovFileMngService") + private EgovFileMngService fileService; + + /** + * 발송할 메일을 등록한다 + * @param vo SndngMailVO + * @return boolean + * @exception Exception + */ + @Override + public boolean insertSndngMail(SndngMailVO vo) throws Exception { + //KISA 보안약점 조치 (2018-10-29, 윤창원) + String recptnPersons = EgovStringUtil.isNullToString(vo.getRecptnPerson()).replaceAll(" ", ""); + String[] recptnPersonList = recptnPersons.split(";"); + + for (int j = 0; j < recptnPersonList.length; j++) { + + // 1-0.메세지ID를 생성한다. + String mssageId = egovMailMsgIdGnrService.getNextStringId(); + + // 1-1.발송메일 데이터를 만든다. + SndngMailVO mailVO = new SndngMailVO(); + mailVO.setMssageId(mssageId); + mailVO.setDsptchPerson(vo.getDsptchPerson()); + mailVO.setRecptnPerson(recptnPersonList[j]); + mailVO.setSj(vo.getSj()); + //mailVO.setEmailCn(EgovStringUtil.checkHtmlView(vo.getEmailCn())); + mailVO.setEmailCn(vo.getEmailCn()); + mailVO.setSndngResultCode("R"); // 발송결과 요청 + + if (vo.getAtchFileId() == null || vo.getAtchFileId().equals("")) { + mailVO.setAtchFileId(null); + mailVO.setFileStreCours(null); + mailVO.setOrignlFileNm(null); + } else { + FileVO fileVO = new FileVO(); + fileVO.setAtchFileId(vo.getAtchFileId()); + fileVO.setFileSn("0"); + FileVO fvo = fileService.selectFileInf(fileVO); + + File uFile = new File(fvo.getFileStreCours(), fvo.getStreFileNm()); + + mailVO.setAtchFileId(vo.getAtchFileId()); + mailVO.setFileStreCours(uFile.getPath()); + mailVO.setOrignlFileNm(vo.getOrignlFileNm()); + } + + // 1-3.발송메일을 등록한다. + sndngMailRegistDAO.insertSndngMail(mailVO); + + // 1-4.메일을 발송한다. + boolean sendingMailResult = egovSndngMailService.sndngMail(mailVO); + + if (!sendingMailResult) { + mailVO.setSndngResultCode("F"); // 발송결과 실패 + sndngMailRegistDAO.updateSndngMail(mailVO); // 발송상태를 DB에 업데이트 한다. + return false; + } + + // 1-5.발송메일 요청XML 파일을 생성한다. + trnsmitXmlData(mailVO); + } + return true; + } + + /** + * 발송할 메일을 XML파일로 만들어 저장한다. + * @param vo SndngMailVO + * @return boolean + * @exception Exception + */ + @Override + public boolean trnsmitXmlData(SndngMailVO vo) throws Exception { + + // 1. 첨부파일 목록 (원파일명, 저장파일명) + String orignlFileList = ""; + String streFileList = ""; + List atchmnFileList = sndngMailRegistDAO.selectAtchmnFileList(vo); + for (int i = 0; i < atchmnFileList.size(); i++) { + AtchmnFileVO fileVO = (AtchmnFileVO) atchmnFileList.get(i); + String orignlFile = fileVO.getOrignlFileNm(); + String streFile = fileVO.getFileStreCours() + fileVO.getStreFileNm(); + orignlFileList += orignlFile + ";"; + streFileList += streFile + ";"; + } + + // 2. XML데이터를 만든다. + SndngMailDocument mailDoc; + SndngMailDocument.SndngMail mailElement; + mailDoc = SndngMailDocument.Factory.newInstance(); + mailElement = mailDoc.addNewSndngMail(); + mailElement.setMssageId(vo.getMssageId()); + mailElement.setDsptchPerson(vo.getDsptchPerson()); + mailElement.setRecptnPerson(vo.getRecptnPerson()); + mailElement.setSj(vo.getSj()); + mailElement.setEmailCn(vo.getEmailCn()); + mailElement.setSndngResultCode(vo.getSndngResultCode()); + mailElement.setOrignlFileList(orignlFileList); + mailElement.setStreFileList(streFileList); + + // 2. XML파일로 저장한다. + String xmlFile = Globals.MAIL_REQUEST_PATH + vo.getMssageId() + ".xml"; + boolean result = EgovXMLDoc.getClassToXML(mailDoc, xmlFile); + if (result == true) { + recptnXmlData(xmlFile); + } + return result; + } + + /** + * 발송메일 발송결과 XML파일을 읽어 발송결과코드에 수정한다. + * @param xml String + * @return boolean + * @exception Exception + */ + @Override + public boolean recptnXmlData(String xmlFile) throws Exception { + + // 1. XML파일에서 발송결과코드를 가져온다. + SndngMailDocument mailDoc = EgovXMLDoc.getXMLToClass(xmlFile); + SndngMailDocument.SndngMail mailElement = mailDoc.getSndngMail(); + SndngMailVO sndngMailVO = new SndngMailVO(); + sndngMailVO.setMssageId(mailElement.getMssageId()); + sndngMailVO.setSndngResultCode("C"); // 발송결과 완료 + + // 2. DB에 업데이트 한다. + sndngMailRegistDAO.updateSndngMail(sndngMailVO); + + return true; + } +} diff --git a/src/main/java/egovframework/com/cop/ems/service/impl/EgovSndngMailServiceImpl.java b/src/main/java/egovframework/com/cop/ems/service/impl/EgovSndngMailServiceImpl.java new file mode 100644 index 0000000..61bda9c --- /dev/null +++ b/src/main/java/egovframework/com/cop/ems/service/impl/EgovSndngMailServiceImpl.java @@ -0,0 +1,112 @@ +package egovframework.com.cop.ems.service.impl; + +import egovframework.com.cop.ems.service.EgovMultiPartEmail; +import egovframework.com.cop.ems.service.EgovSndngMailService; +import egovframework.com.cop.ems.service.SndngMailVO; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import javax.annotation.Resource; + +import org.apache.commons.mail.EmailAttachment; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.mail.MailAuthenticationException; +import org.springframework.mail.MailParseException; +import org.springframework.mail.MailSendException; +import org.springframework.stereotype.Service; + +/** + * 메일 솔루션과 연동해서 이용해서 메일을 보내는 서비스 구현 클래스 + * @since 2011.09.09 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2011.09.09  서준식       최초 작성
    + *  2011.12.06  이기하       메일 첨부파일이 기능 추가
    + *  2013.05.23  이기하       메일 첨부파일이 없을 때 로직 추가
    + *
    + *  
    + */ +@Service("egovSndngMailService") +public class EgovSndngMailServiceImpl extends EgovAbstractServiceImpl implements EgovSndngMailService { + + @Resource(name = "egovMultiPartEmail") + private EgovMultiPartEmail egovMultiPartEmail; + + /** SndngMailRegistDAO */ + @Resource(name = "sndngMailRegistDAO") + private SndngMailRegistDAO sndngMailRegistDAO; + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovSndngMailServiceImpl.class); + + /** + * 메일을 발송한다 + * @param vo SndngMailVO + * @return boolean + * @exception Exception + */ + @Override + @SuppressWarnings("unused") + public boolean sndngMail(SndngMailVO sndngMailVO) throws Exception { + + String recptnPerson = (sndngMailVO.getRecptnPerson() == null) ? "" : sndngMailVO.getRecptnPerson(); // 수신자 + String subject = (sndngMailVO.getSj() == null) ? "" : sndngMailVO.getSj(); // 메일제목 + String emailCn = (sndngMailVO.getEmailCn() == null) ? "" : sndngMailVO.getEmailCn(); // 메일내용 + String atchmnFileNm = (sndngMailVO.getOrignlFileNm() == null) ? "" : sndngMailVO.getOrignlFileNm(); // 첨부파일이름 + String atchmnFilePath = (sndngMailVO.getFileStreCours() == null) ? "" : sndngMailVO.getFileStreCours(); // 첨부파일경로 + + try { + EmailAttachment attachment = new EmailAttachment(); + // 첨부파일이 있을 때 + if (atchmnFileNm != "" && atchmnFileNm != null && atchmnFilePath != "" && atchmnFilePath != null) { + // 첨부할 attachment 정보를 생성합니다 + attachment.setPath(atchmnFilePath); + attachment.setDisposition(EmailAttachment.ATTACHMENT); + attachment.setDescription("첨부파일입니다"); + //attachment.setName(new String(atchmnFileNm.getBytes("UTF-8"),"latin1")); // 구버전의 경우 필요 + attachment.setName(atchmnFileNm); + + // 2015.05.08 주석수정 - 첨부파일 정보를 포함한 메일을 전송합니다 + egovMultiPartEmail.send(recptnPerson, subject, emailCn, attachment); + } + else + { + // 메일을 전송합니다 + egovMultiPartEmail.send(recptnPerson, subject, emailCn); + } + + Throwable t = new Throwable(); + + } catch (MailParseException ex) { + sndngMailVO.setSndngResultCode("F"); // 발송결과 실패 + sndngMailRegistDAO.updateSndngMail(sndngMailVO); // 발송상태를 DB에 업데이트 한다. + LOGGER.error("Sending Mail Exception : {} [failure when parsing the message]", ex.getCause()); + return false; + } catch (MailAuthenticationException ex) { + sndngMailVO.setSndngResultCode("F"); // 발송결과 실패 + sndngMailRegistDAO.updateSndngMail(sndngMailVO); // 발송상태를 DB에 업데이트 한다. + LOGGER.error("Sending Mail Exception : {} [authentication failure]", ex.getCause()); + return false; + } catch (MailSendException ex) { + sndngMailVO.setSndngResultCode("F"); // 발송결과 실패 + sndngMailRegistDAO.updateSndngMail(sndngMailVO); // 발송상태를 DB에 업데이트 한다. + LOGGER.error("Sending Mail Exception : {} [failure when sending the message]", ex.getCause()); + return false; + } catch (Exception ex) { + sndngMailVO.setSndngResultCode("F"); // 발송결과 실패 + sndngMailRegistDAO.updateSndngMail(sndngMailVO); // 발송상태를 DB에 업데이트 한다. + LOGGER.error("Sending Mail Exception : {} [unknown Exception]", ex.getCause()); + LOGGER.debug(ex.getMessage()); + return false; + } + + return true; + } + +} diff --git a/src/main/java/egovframework/com/cop/ems/service/impl/SndngMailDetailDAO.java b/src/main/java/egovframework/com/cop/ems/service/impl/SndngMailDetailDAO.java new file mode 100644 index 0000000..3d5e3b7 --- /dev/null +++ b/src/main/java/egovframework/com/cop/ems/service/impl/SndngMailDetailDAO.java @@ -0,0 +1,48 @@ +package egovframework.com.cop.ems.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.cop.ems.service.SndngMailVO; + +import org.springframework.stereotype.Repository; + +/** + * 발송메일을 상세 조회하는 DAO 클래스 + * @author 공통서비스 개발팀 박지욱 + * @since 2009.03.12 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2009.03.12  박지욱          최초 생성
    + *
    + *  
    + */ +@Repository("sndngMailDetailDAO") +public class SndngMailDetailDAO extends EgovComAbstractDAO { + + /** + * 발송메일을 상세 조회한다. + * @param vo SndngMailVO + * @return SndngMailVO + * @exception Exception + */ + public SndngMailVO selectSndngMail(SndngMailVO vo) throws Exception { + return (SndngMailVO) selectOne("sndngMailDetailDAO.selectSndngMail", vo); + } + + /** + * 발송메일을 삭제한다. + * @param vo SndngMailVO + * @exception + */ + public void deleteSndngMail(SndngMailVO vo) throws Exception { + delete("sndngMailDetailDAO.deleteSndngMail", vo); + } + +} diff --git a/src/main/java/egovframework/com/cop/ems/service/impl/SndngMailDtlsDAO.java b/src/main/java/egovframework/com/cop/ems/service/impl/SndngMailDtlsDAO.java new file mode 100644 index 0000000..5d8a633 --- /dev/null +++ b/src/main/java/egovframework/com/cop/ems/service/impl/SndngMailDtlsDAO.java @@ -0,0 +1,48 @@ +package egovframework.com.cop.ems.service.impl; + +import java.util.List; + +import egovframework.com.cmm.ComDefaultVO; +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; + +import org.springframework.stereotype.Repository; + +/** + * 발송메일 내역을 조회하는 DAO 클래스 + * @author 공통서비스 개발팀 박지욱 + * @since 2009.03.12 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2009.03.12  박지욱          최초 생성
    + *
    + *  
    + */ +@Repository("sndngMailDtlsDAO") +public class SndngMailDtlsDAO extends EgovComAbstractDAO { + + /** + * 발송메일 목록을 조회한다. + * @param vo ComDefaultVO + * @return List + * @exception Exception + */ + public List selectSndngMailList(ComDefaultVO vo) throws Exception { + return list("SndngMailDtlsDAO.selectSndngMailList_D", vo); + } + + /** + * 발송메일 총건수를 조회한다. + * @param vo ComDefaultVO + * @return int + * @exception + */ + public int selectSndngMailListTotCnt(ComDefaultVO vo) { + return (Integer) selectOne("SndngMailDtlsDAO.selectSndngMailListTotCnt_S", vo); + } +} diff --git a/src/main/java/egovframework/com/cop/ems/service/impl/SndngMailRegistDAO.java b/src/main/java/egovframework/com/cop/ems/service/impl/SndngMailRegistDAO.java new file mode 100644 index 0000000..578f85a --- /dev/null +++ b/src/main/java/egovframework/com/cop/ems/service/impl/SndngMailRegistDAO.java @@ -0,0 +1,60 @@ +package egovframework.com.cop.ems.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.cop.ems.service.SndngMailVO; + +import org.springframework.stereotype.Repository; + +/** + * 발송메일을 등록하는 DAO 클래스 + * @author 공통서비스 개발팀 박지욱 + * @since 2009.03.12 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2009.03.12  박지욱          최초 생성
    + *
    + *  
    + */ +@Repository("sndngMailRegistDAO") +public class SndngMailRegistDAO extends EgovComAbstractDAO { + + /** + * 발송할 메일을 등록한다 + * @param vo SndngMailVO + * @return SndngMailVO + * @exception Exception + */ + public SndngMailVO insertSndngMail(SndngMailVO vo) throws Exception { + insert("sndngMailRegistDAO.insertSndngMail", vo); + return new SndngMailVO() ; + } + + /** + * 발송할 메일에 있는 첨부파일 목록을 조회한다. + * @param vo SndngMailVO + * @return List + * @exception Exception + */ + public List selectAtchmnFileList(SndngMailVO vo) throws Exception { + return selectList("sndngMailRegistDAO.selectAtchmnFileList", vo); + } + + /** + * 발송결과를 수정한다. + * @param vo SndngMailVO + * @return SndngMailVO + * @exception Exception + */ + public SndngMailVO updateSndngMail(SndngMailVO vo) throws Exception { + update("sndngMailRegistDAO.updateSndngMail", vo); + return new SndngMailVO(); + } +} diff --git a/src/main/java/egovframework/com/cop/ems/web/EgovSndngMailDetailController.java b/src/main/java/egovframework/com/cop/ems/web/EgovSndngMailDetailController.java new file mode 100644 index 0000000..8dd9abc --- /dev/null +++ b/src/main/java/egovframework/com/cop/ems/web/EgovSndngMailDetailController.java @@ -0,0 +1,164 @@ +package egovframework.com.cop.ems.web; + +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.PrintWriter; + +import egovframework.com.cmm.EgovWebUtil; +import egovframework.com.cmm.service.Globals; +import egovframework.com.cop.ems.service.EgovSndngMailDetailService; +import egovframework.com.cop.ems.service.SndngMailVO; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.util.FileCopyUtils; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; + +/** + * 발송메일을 상세 조회하는 컨트롤러 클래스 + * @author 공통서비스 개발팀 박지욱 + * @since 2009.03.12 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *  수정일                 수정자             수정내용
    + *  ----------    --------    ---------------------------
    + *  2009.03.12    박지욱              최초 생성
    + *  2011.10.10	   이기하		    보안점검 후속조치(교차접속 스크립트 공격 취약성 방지(파라미터 문자열 교체),
    + *  											  HTTP 응답분할 방지)
    + *  2017.03.03 	   조성원 	           시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754]
    + *  2019.11.29 	   신용호 	      KISA 보안약점 조치 : HTTP응답분할(HTTP_Response_Splitting,CRLF)취약점 조치
    + *
    + *  
    + */ +@Controller +public class EgovSndngMailDetailController { + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovSndngMailDetailController.class); + + /** EgovSndngMailDetailService */ + @Resource(name = "sndngMailDetailService") + private EgovSndngMailDetailService sndngMailDetailService; + + /** + * 발송메일을 상세 조회한다. + * @param sndngMailVO SndngMailVO + * @return String + * @exception Exception + */ + @RequestMapping(value = "/cop/ems/selectSndngMailDetail.do") + public String selectSndngMail(@ModelAttribute("sndngMailVO") SndngMailVO sndngMailVO, ModelMap model) throws Exception { + + if (sndngMailVO == null || sndngMailVO.getMssageId() == null || sndngMailVO.getMssageId().equals("")) { + return "egovframework/com/cmm/egovError"; + } + + // 1. 발송메일을 상세 조회한다. + SndngMailVO resultMailVO = sndngMailDetailService.selectSndngMail(sndngMailVO); + + // 2. 결과 리턴 + model.addAttribute("resultInfo", resultMailVO); + if (!resultMailVO.getMssageId().equals("")) { + // 발송메일 상세조회 화면 이동 + return "egovframework/com/cop/ems/EgovMailDetail"; + } else { + // 오류 페이지 이동 + return "egovframework/com/cmm/egovError"; + } + } + + /** + * 발송메일을 삭제한다. + * @param sndngMailVO SndngMailVO + * @return String + * @exception Exception + */ + @RequestMapping(value = "/cop/ems/deleteSndngMail.do") + public String deleteSndngMail(@ModelAttribute("sndngMailVO") SndngMailVO sndngMailVO, ModelMap model) throws Exception { + + if (sndngMailVO == null || sndngMailVO.getMssageId() == null || sndngMailVO.getMssageId().equals("")) { + return "egovframework/com/cmm/egovError"; + } + + // 1. 발송메일을 삭제한다. + sndngMailDetailService.deleteSndngMail(sndngMailVO); + + // 2. 첨부파일을 삭제한다. + sndngMailDetailService.deleteAtchmnFile(sndngMailVO); + + // 3. 발송메일 목록 페이지 이동 + return "redirect:/cop/ems/selectSndngMailList.do"; + } + + /** + * 발송메일 내용조회로 돌아간다. + * @param sndngMailVO SndngMailVO + * @return String + * @exception Exception + */ + @RequestMapping(value = "/cop/ems/backSndngMailDetail.do") + public String backSndngMailDtls(@ModelAttribute("sndngMailVO") SndngMailVO sndngMailVO, ModelMap model) throws Exception { + + return "redirect:/cop/ems/selectSndngMailList.do"; + } + + /** + * XML형태의 발송요청메일을 조회한다. + * @param sndngMailVO SndngMailVO + * @exception Exception + */ + @RequestMapping(value = "/cop/ems/selectSndngMailXml.do") + public void selectSndngMailXml(@ModelAttribute("sndngMailVO") SndngMailVO sndngMailVO, HttpServletResponse response, ModelMap model) throws Exception { + String xmlFile = Globals.MAIL_REQUEST_PATH + sndngMailVO.getMssageId() + ".xml"; + File uFile = new File(EgovWebUtil.filePathBlackList(xmlFile)); + int fSize = (int) uFile.length(); + + if (fSize > 0) { + String mimetype = "application/x-msdownload;charset=UTF-8"; + + response.setContentType(mimetype); + response.setHeader("Content-Disposition", "attachment; filename=\"" + EgovWebUtil.removeCRLF(uFile.getName()) + "\""); + response.setContentLength(fSize); + + BufferedInputStream in = null; + try { + in = new BufferedInputStream(new FileInputStream(uFile)); + FileCopyUtils.copy(in, response.getOutputStream()); + } finally { + if (in != null) { + try { + in.close(); + //2017.03.03 조성원 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + }catch (IOException ignore){ + LOGGER.error("[IOException] : Connection Close"); + } catch (Exception ignore) { + LOGGER.error("["+ ignore.getClass() +"] : Connection Close ", ignore.getMessage()); + } + } + } + response.getOutputStream().flush(); + response.getOutputStream().close(); + } else { + response.setContentType("application/x-msdownload"); + PrintWriter printwriter = response.getWriter(); + printwriter.println(""); + printwriter.println("


    Could not get file name:
    " + EgovWebUtil.clearXSSMinimum(xmlFile) + "

    "); + printwriter.println("


    Back

    "); + printwriter.println("


    © webAccess"); + printwriter.println(""); + printwriter.flush(); + printwriter.close(); + } + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/cop/ems/web/EgovSndngMailDtlsController.java b/src/main/java/egovframework/com/cop/ems/web/EgovSndngMailDtlsController.java new file mode 100644 index 0000000..1afc7fe --- /dev/null +++ b/src/main/java/egovframework/com/cop/ems/web/EgovSndngMailDtlsController.java @@ -0,0 +1,107 @@ +package egovframework.com.cop.ems.web; + +import java.util.List; + +import egovframework.com.cmm.ComDefaultVO; +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cop.ems.service.EgovSndngMailDtlsService; +import egovframework.com.cop.ems.service.SndngMailVO; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +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; + +/** + * 발송메일 내역을 조회하는 컨트롤러 클래스 + * @author 공통서비스 개발팀 박지욱 + * @since 2009.03.12 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2009.03.12  박지욱          최초 생성
    + *
    + *  
    + */ +@Controller +public class EgovSndngMailDtlsController { + + /** EgovSndngMailDtlsService */ + @Resource(name = "sndngMailDtlsService") + private EgovSndngMailDtlsService sndngMailDtlsService; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** EgovMessageSource */ + @Resource(name = "egovMessageSource") + EgovMessageSource egovMessageSource; + + /** + * 발송메일 내역을 조회한다 + * @param searchVO ComDefaultVO + * @return String + * @exception Exception + */ + @IncludedInfo(name = "발송메일내역", order = 361, gid = 40) + @RequestMapping(value = "/cop/ems/selectSndngMailList.do") + public String selectSndngMailList(@ModelAttribute("searchVO") ComDefaultVO searchVO, ModelMap model) throws Exception { + + // 발송메일 내역 조회 + /** 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()); + + List sndngMailList = sndngMailDtlsService.selectSndngMailList(searchVO); + model.addAttribute("resultList", sndngMailList); + + int totCnt = sndngMailDtlsService.selectSndngMailListTotCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/cop/ems/EgovMailDtls"; + } + + /** + * 발송메일을 삭제한다. + * @param sndngMailVO SndngMailVO + * @return String + * @exception + */ + @RequestMapping(value = "/cop/ems/deleteSndngMailList.do") + public String deleteSndngMailList(@ModelAttribute("sndngMailVO") SndngMailVO sndngMailVO, ModelMap model) throws Exception { + + if (sndngMailVO == null || sndngMailVO.getMssageId() == null || sndngMailVO.getMssageId().equals("")) { + return "egovframework/com/cmm/egovError"; + } + + // 1. 발송메일을 삭제한다. + sndngMailDtlsService.deleteSndngMailList(sndngMailVO); + + // 2. 발송메일 목록 페이지 이동 + return "redirect:/cop/ems/selectSndngMailList.do"; + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/cop/ems/web/EgovSndngMailRegistController.java b/src/main/java/egovframework/com/cop/ems/web/EgovSndngMailRegistController.java new file mode 100644 index 0000000..068f502 --- /dev/null +++ b/src/main/java/egovframework/com/cop/ems/web/EgovSndngMailRegistController.java @@ -0,0 +1,149 @@ +package egovframework.com.cop.ems.web; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +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.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; + +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.service.EgovFileMngService; +import egovframework.com.cmm.service.EgovFileMngUtil; +import egovframework.com.cmm.service.FileVO; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.cop.ems.service.EgovSndngMailRegistService; +import egovframework.com.cop.ems.service.SndngMailVO; +import egovframework.com.utl.fcc.service.EgovStringUtil; + +/** + * 발송메일등록, 발송요청XML파일 생성하는 컨트롤러 클래스 + * @author 공통서비스 개발팀 박지욱 + * @since 2009.03.12 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      	수정자          수정내용
    + *  ----------     --------    ---------------------------
    + *  2009.03.12  	박지욱          최초 생성
    + *  2011.12.06  	이기하          메일 첨부파일이 기능 추가
    + *  2015.05.08  	조정국          오류페이지 표시 경로 수정 - insertSndngMail()
    + *
    + *  
    + */ +@Controller +public class EgovSndngMailRegistController { + + /** EgovSndngMailRegistService */ + @Resource(name = "sndngMailRegistService") + private EgovSndngMailRegistService sndngMailRegistService; + + /** EgovFileMngService */ + @Resource(name = "EgovFileMngService") + private EgovFileMngService fileMngService; + + /** EgovFileMngUtil */ + @Resource(name = "EgovFileMngUtil") + private EgovFileMngUtil fileUtil; + + /** 파일구분자 */ + static final char FILE_SEPARATOR = File.separatorChar; + + /** + * 발송메일 등록화면으로 들어간다 + * @param sndngMailVO SndngMailVO + * @return String + * @exception Exception + */ + @IncludedInfo(name = "메일발송", order = 360, gid = 40) + @RequestMapping(value = "/cop/ems/insertSndngMailView.do") + public String insertSndngMailView(@ModelAttribute("sndngMailVO") SndngMailVO sndngMailVO, ModelMap model) throws Exception { + + model.addAttribute("resultInfo", sndngMailVO); + return "egovframework/com/cop/ems/EgovMailRegist"; + } + + /** + * 발송메일을 등록한다 + * @param multiRequest MultipartHttpServletRequest + * @param sndngMailVO SndngMailVO + * @return String + * @exception Exception + */ + @RequestMapping(value = "/cop/ems/insertSndngMail.do") + public String insertSndngMail(final MultipartHttpServletRequest multiRequest, @ModelAttribute("sndngMailVO") SndngMailVO sndngMailVO, ModelMap model, HttpServletRequest request) + throws Exception { + + String link = "N"; + if (sndngMailVO != null && sndngMailVO.getLink() != null && !sndngMailVO.getLink().equals("")) { + link = sndngMailVO.getLink(); + } + + LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser(); + // KISA 보안취약점 조치 (2018-12-10, 신용호) + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if(!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + List _result = new ArrayList(); + String _atchFileId = ""; + final Map files = multiRequest.getFileMap(); + if (!files.isEmpty()) { + _result = fileUtil.parseFileInf(files, "MSG_", 0, "", ""); + _atchFileId = fileMngService.insertFileInfs(_result); //파일이 생성되고나면 생성된 첨부파일 ID를 리턴한다. + + } + + String orignlFileList = ""; + + for (int i = 0; i < _result.size(); i++) { + FileVO fileVO = _result.get(i); + orignlFileList = fileVO.getOrignlFileNm(); + } + + if (sndngMailVO != null) { + sndngMailVO.setAtchFileId(_atchFileId); + sndngMailVO.setDsptchPerson(user == null ? "" : EgovStringUtil.isNullToString(user.getId())); + sndngMailVO.setOrignlFileNm(orignlFileList); + } + + // 발송메일을 등록한다. + boolean result = sndngMailRegistService.insertSndngMail(sndngMailVO); + if (result) { + if (link.equals("N")) { + return "redirect:/cop/ems/selectSndngMailList.do"; + } else { + model.addAttribute("closeYn", "Y"); + return "egovframework/com/cop/ems/EgovMailRegist"; + } + } else { + return "egovframework/com/cmm/error/egovError"; + } + } + + /** + * 발송메일 내용조회로 돌아간다. + * @param sndngMailVO SndngMailVO + * @return String + * @exception Exception + */ + @RequestMapping(value = "/cop/ems/backSndngMailRegist.do") + public String backSndngMailRegist(@ModelAttribute("sndngMailVO") SndngMailVO sndngMailVO, ModelMap model) throws Exception { + + return "redirect:/cop/ems/selectSndngMailList.do"; + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/cop/scp/service/EgovArticleScrapService.java b/src/main/java/egovframework/com/cop/scp/service/EgovArticleScrapService.java new file mode 100644 index 0000000..c4979f0 --- /dev/null +++ b/src/main/java/egovframework/com/cop/scp/service/EgovArticleScrapService.java @@ -0,0 +1,19 @@ +package egovframework.com.cop.scp.service; + +import java.util.Map; + +import org.egovframe.rte.fdl.cmmn.exception.FdlException; + +public interface EgovArticleScrapService { + + Map selectArticleScrapList(ScrapVO scrapVO); + + void insertArticleScrap(Scrap scrap) throws FdlException; + + ScrapVO selectArticleScrapDetail(ScrapVO scrapVO); + + void deleteArticleScrap(ScrapVO scrapVO); + + void updateArticleScrap(Scrap scrap); + +} diff --git a/src/main/java/egovframework/com/cop/scp/service/Scrap.java b/src/main/java/egovframework/com/cop/scp/service/Scrap.java new file mode 100644 index 0000000..f9be180 --- /dev/null +++ b/src/main/java/egovframework/com/cop/scp/service/Scrap.java @@ -0,0 +1,240 @@ +package egovframework.com.cop.scp.service; + +import java.io.Serializable; + +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * 스크랩 서비스 데이터 처리 모델 + * @author 공통컴포넌트개발팀 한성곤 + * @since 2009.07.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.10  한성곤          최초 생성
    + *
    + * 
    + */ +@SuppressWarnings("serial") +public class Scrap implements Serializable { + /** 스크랩 ID */ + private String scrapId = ""; + + /** 게시판 ID */ + private String bbsId = ""; + + /** 게시물 번호 */ + private long nttId = 0L; + + /** 스크랩명 */ + private String scrapNm = ""; + + /** 사용 여부 */ + private String useAt = ""; + + /** 유일 아이디 */ + private String uniqId = ""; + + /** 최초등록자 아이디 */ + private String frstRegisterId = ""; + + /** 최초 등록자명 */ + private String frstRegisterNm = ""; + + /** 최초등록시점 */ + private String frstRegisterPnttm = ""; + + /** 최종수정자 아이디 */ + private String lastUpdusrId = ""; + + /** 최종수정시점 */ + private String lastUpdusrPnttm = ""; + + /** + * scrapId attribute를 리턴한다. + * @return the scrapId + */ + public String getScrapId() { + return scrapId; + } + + /** + * scrapId attribute 값을 설정한다. + * @param scrapId the scrapId to set + */ + public void setScrapId(String scrapId) { + this.scrapId = scrapId; + } + + /** + * bbsId attribute를 리턴한다. + * @return the bbsId + */ + public String getBbsId() { + return bbsId; + } + + /** + * bbsId attribute 값을 설정한다. + * @param bbsId the bbsId to set + */ + public void setBbsId(String bbsId) { + this.bbsId = bbsId; + } + + /** + * nttId attribute를 리턴한다. + * @return the nttId + */ + public long getNttId() { + return nttId; + } + + /** + * nttId attribute 값을 설정한다. + * @param nttId the nttId to set + */ + public void setNttId(long nttId) { + this.nttId = nttId; + } + + /** + * scrapNm attribute를 리턴한다. + * @return the scrapNm + */ + public String getScrapNm() { + return scrapNm; + } + + /** + * scrapNm attribute 값을 설정한다. + * @param scrapNm the scrapNm to set + */ + public void setScrapNm(String scrapNm) { + this.scrapNm = scrapNm; + } + + /** + * useAt attribute를 리턴한다. + * @return the useAt + */ + public String getUseAt() { + return useAt; + } + + /** + * useAt attribute 값을 설정한다. + * @param useAt the useAt to set + */ + public void setUseAt(String useAt) { + this.useAt = useAt; + } + + /** + * frstRegisterId attribute를 리턴한다. + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * frstRegisterId attribute 값을 설정한다. + * @param frstRegisterId the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * frstRegisterNm attribute를 리턴한다. + * @return the frstRegisterNm + */ + public String getFrstRegisterNm() { + return frstRegisterNm; + } + + /** + * frstRegisterNm attribute 값을 설정한다. + * @param frstRegisterNm the frstRegisterNm to set + */ + public void setFrstRegisterNm(String frstRegisterNm) { + this.frstRegisterNm = frstRegisterNm; + } + + /** + * frstRegisterPnttm attribute를 리턴한다. + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * frstRegisterPnttm attribute 값을 설정한다. + * @param frstRegisterPnttm the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * lastUpdusrId attribute를 리턴한다. + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * lastUpdusrId attribute 값을 설정한다. + * @param lastUpdusrId the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + /** + * lastUpdusrPnttm attribute를 리턴한다. + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * lastUpdusrPnttm attribute 값을 설정한다. + * @param lastUpdusrPnttm the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * uniqId attribute를 리턴한다. + * @return the uniqId + */ + public String getUniqId() { + return uniqId; + } + + /** + * uniqId attribute 값을 설정한다. + * @param uniqId the uniqId to set + */ + public void setUniqId(String uniqId) { + this.uniqId = uniqId; + } + + /** + * toString 메소드를 대치한다. + */ + public String toString() { + return ToStringBuilder.reflectionToString(this); + } +} diff --git a/src/main/java/egovframework/com/cop/scp/service/ScrapVO.java b/src/main/java/egovframework/com/cop/scp/service/ScrapVO.java new file mode 100644 index 0000000..41d98fe --- /dev/null +++ b/src/main/java/egovframework/com/cop/scp/service/ScrapVO.java @@ -0,0 +1,276 @@ +package egovframework.com.cop.scp.service; + +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * 스크랩 서비스를 위한 VO 클래스 + * @author 공통컴포넌트개발팀 한성곤 + * @since 2009.07.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.10  한성곤          최초 생성
    + *
    + * 
    + */ +@SuppressWarnings("serial") +public class ScrapVO extends Scrap { + /** 검색조건 */ + private String searchCnd = ""; + + /** 검색단어 */ + private String searchWrd = ""; + + /** 정렬순서(DESC,ASC) */ + private long sortOrdr = 0L; + + /** 검색사용여부 */ + private String searchUseYn = ""; + + /** 현재페이지 */ + private int pageIndex = 1; + + /** 페이지갯수 */ + private int pageUnit = 10; + + /** 페이지사이즈 */ + private int pageSize = 10; + + /** 첫페이지 인덱스 */ + private int firstIndex = 1; + + /** 마지막페이지 인덱스 */ + private int lastIndex = 1; + + /** 페이지당 레코드 개수 */ + private int recordCountPerPage = 10; + + /** 레코드 번호 */ + private int rowNo = 0; + + /** 최초 등록자명 */ + private String frstRegisterNm = ""; + + /** 최종 수정자명 */ + private String lastUpdusrNm = ""; + + /** + * searchCnd attribute를 리턴한다. + * @return the searchCnd + */ + public String getSearchCnd() { + return searchCnd; + } + + /** + * searchCnd attribute 값을 설정한다. + * @param searchCnd the searchCnd to set + */ + public void setSearchCnd(String searchCnd) { + this.searchCnd = searchCnd; + } + + /** + * searchWrd attribute를 리턴한다. + * @return the searchWrd + */ + public String getSearchWrd() { + return searchWrd; + } + + /** + * searchWrd attribute 값을 설정한다. + * @param searchWrd the searchWrd to set + */ + public void setSearchWrd(String searchWrd) { + this.searchWrd = searchWrd; + } + + /** + * sortOrdr attribute를 리턴한다. + * @return the sortOrdr + */ + public long getSortOrdr() { + return sortOrdr; + } + + /** + * sortOrdr attribute 값을 설정한다. + * @param sortOrdr the sortOrdr to set + */ + public void setSortOrdr(long sortOrdr) { + this.sortOrdr = sortOrdr; + } + + /** + * searchUseYn attribute를 리턴한다. + * @return the searchUseYn + */ + public String getSearchUseYn() { + return searchUseYn; + } + + /** + * searchUseYn attribute 값을 설정한다. + * @param searchUseYn the searchUseYn to set + */ + public void setSearchUseYn(String searchUseYn) { + this.searchUseYn = searchUseYn; + } + + /** + * pageIndex attribute를 리턴한다. + * @return the pageIndex + */ + public int getPageIndex() { + return pageIndex; + } + + /** + * pageIndex attribute 값을 설정한다. + * @param pageIndex the pageIndex to set + */ + public void setPageIndex(int pageIndex) { + this.pageIndex = pageIndex; + } + + /** + * pageUnit attribute를 리턴한다. + * @return the pageUnit + */ + public int getPageUnit() { + return pageUnit; + } + + /** + * pageUnit attribute 값을 설정한다. + * @param pageUnit the pageUnit to set + */ + public void setPageUnit(int pageUnit) { + this.pageUnit = pageUnit; + } + + /** + * pageSize attribute를 리턴한다. + * @return the pageSize + */ + public int getPageSize() { + return pageSize; + } + + /** + * pageSize attribute 값을 설정한다. + * @param pageSize the pageSize to set + */ + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + /** + * firstIndex attribute를 리턴한다. + * @return the firstIndex + */ + public int getFirstIndex() { + return firstIndex; + } + + /** + * firstIndex attribute 값을 설정한다. + * @param firstIndex the firstIndex to set + */ + public void setFirstIndex(int firstIndex) { + this.firstIndex = firstIndex; + } + + /** + * lastIndex attribute를 리턴한다. + * @return the lastIndex + */ + public int getLastIndex() { + return lastIndex; + } + + /** + * lastIndex attribute 값을 설정한다. + * @param lastIndex the lastIndex to set + */ + public void setLastIndex(int lastIndex) { + this.lastIndex = lastIndex; + } + + /** + * recordCountPerPage attribute를 리턴한다. + * @return the recordCountPerPage + */ + public int getRecordCountPerPage() { + return recordCountPerPage; + } + + /** + * recordCountPerPage attribute 값을 설정한다. + * @param recordCountPerPage the recordCountPerPage to set + */ + public void setRecordCountPerPage(int recordCountPerPage) { + this.recordCountPerPage = recordCountPerPage; + } + + /** + * rowNo attribute를 리턴한다. + * @return the rowNo + */ + public int getRowNo() { + return rowNo; + } + + /** + * rowNo attribute 값을 설정한다. + * @param rowNo the rowNo to set + */ + public void setRowNo(int rowNo) { + this.rowNo = rowNo; + } + + /** + * frstRegisterNm attribute를 리턴한다. + * @return the frstRegisterNm + */ + public String getFrstRegisterNm() { + return frstRegisterNm; + } + + /** + * frstRegisterNm attribute 값을 설정한다. + * @param frstRegisterNm the frstRegisterNm to set + */ + public void setFrstRegisterNm(String frstRegisterNm) { + this.frstRegisterNm = frstRegisterNm; + } + + /** + * lastUpdusrNm attribute를 리턴한다. + * @return the lastUpdusrNm + */ + public String getLastUpdusrNm() { + return lastUpdusrNm; + } + + /** + * lastUpdusrNm attribute 값을 설정한다. + * @param lastUpdusrNm the lastUpdusrNm to set + */ + public void setLastUpdusrNm(String lastUpdusrNm) { + this.lastUpdusrNm = lastUpdusrNm; + } + + /** + * toString 메소드를 대치한다. + */ + public String toString() { + return ToStringBuilder.reflectionToString(this); + } +} diff --git a/src/main/java/egovframework/com/cop/scp/service/impl/EgovArticleScrapDAO.java b/src/main/java/egovframework/com/cop/scp/service/impl/EgovArticleScrapDAO.java new file mode 100644 index 0000000..75d5a02 --- /dev/null +++ b/src/main/java/egovframework/com/cop/scp/service/impl/EgovArticleScrapDAO.java @@ -0,0 +1,39 @@ +package egovframework.com.cop.scp.service.impl; + +import java.util.List; + +import org.springframework.stereotype.Repository; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.cop.bbs.service.BoardVO; +import egovframework.com.cop.scp.service.Scrap; +import egovframework.com.cop.scp.service.ScrapVO; + +@Repository("EgovArticleScrapDAO") +public class EgovArticleScrapDAO extends EgovComAbstractDAO{ + + public List selectArticleScrapList(ScrapVO scrapVO) { + return list("ArticleScrap.selectArticleScrapList", scrapVO); + } + + public int selectArticleScrapListCnt(ScrapVO scrapVO) { + return (Integer)selectOne("ArticleScrap.selectArticleScrapListCnt", scrapVO); + } + + public void insertArticleScrap(Scrap scrap) { + insert("ArticleScrap.insertArticleScrap", scrap); + } + + public ScrapVO selectArticleScrapDetail(ScrapVO scrapVO) { + return (ScrapVO) selectOne("ArticleScrap.selectArticleScrapDetail", scrapVO); + } + + public void deleteArticleScrap(ScrapVO scrapVO) { + update("ArticleScrap.deleteArticleScrap", scrapVO); + } + + public void updateArticleScrap(Scrap scrap) { + update("ArticleScrap.updateArticleScrap", scrap); + } + +} diff --git a/src/main/java/egovframework/com/cop/scp/service/impl/EgovArticleScrapServiceImpl.java b/src/main/java/egovframework/com/cop/scp/service/impl/EgovArticleScrapServiceImpl.java new file mode 100644 index 0000000..46a7d6c --- /dev/null +++ b/src/main/java/egovframework/com/cop/scp/service/impl/EgovArticleScrapServiceImpl.java @@ -0,0 +1,64 @@ +package egovframework.com.cop.scp.service.impl; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import egovframework.com.cop.scp.service.EgovArticleScrapService; +import egovframework.com.cop.scp.service.Scrap; +import egovframework.com.cop.scp.service.ScrapVO; +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.cmmn.exception.FdlException; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +@Service("EgovArticleScrapService") +public class EgovArticleScrapServiceImpl extends EgovAbstractServiceImpl implements EgovArticleScrapService{ + + @Resource(name = "EgovArticleScrapDAO") + private EgovArticleScrapDAO egovArticleScrapDao; + + @Resource(name="egovScrapIdGnrService") + private EgovIdGnrService idgenService; + + @Override + public Map selectArticleScrapList(ScrapVO scrapVO) { + List result = egovArticleScrapDao.selectArticleScrapList(scrapVO); + int cnt = egovArticleScrapDao.selectArticleScrapListCnt(scrapVO); + + Map map = new HashMap(); + + map.put("resultList", result); + map.put("resultCnt", Integer.toString(cnt)); + + return map; + } + + @Override + public void insertArticleScrap(Scrap scrap) throws FdlException { + + String scrapId = idgenService.getNextStringId(); + scrap.setScrapId(scrapId); + + egovArticleScrapDao.insertArticleScrap(scrap); + } + + @Override + public ScrapVO selectArticleScrapDetail(ScrapVO scrapVO) { + return egovArticleScrapDao.selectArticleScrapDetail(scrapVO); + } + + @Override + public void deleteArticleScrap(ScrapVO scrapVO) { + egovArticleScrapDao.deleteArticleScrap(scrapVO); + } + + @Override + public void updateArticleScrap(Scrap scrap) { + egovArticleScrapDao.updateArticleScrap(scrap); + } + +} diff --git a/src/main/java/egovframework/com/cop/scp/web/EgovArticleScrapController.java b/src/main/java/egovframework/com/cop/scp/web/EgovArticleScrapController.java new file mode 100644 index 0000000..e6e1b91 --- /dev/null +++ b/src/main/java/egovframework/com/cop/scp/web/EgovArticleScrapController.java @@ -0,0 +1,329 @@ +package egovframework.com.cop.scp.web; + +import java.util.Map; + +import javax.annotation.Resource; + +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.springmodules.validation.commons.DefaultBeanValidator; + +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.cop.bbs.service.BoardVO; +import egovframework.com.cop.bbs.service.EgovArticleService; +import egovframework.com.cop.scp.service.EgovArticleScrapService; +import egovframework.com.cop.scp.service.Scrap; +import egovframework.com.cop.scp.service.ScrapVO; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +/** + * 스크랩관리 서비스 컨트롤러 클래스 + * @author 공통컴포넌트개발팀 한성곤 + * @since 2009.07.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.10  한성곤          최초 생성
    + *   2016.06.13	김연호		표준프레임워크 3.6 개선
    + *
    + * 
    + */ + +@Controller +public class EgovArticleScrapController { + + + @Resource(name="EgovArticleScrapService") + protected EgovArticleScrapService egovArticleScrapService; + + @Resource(name = "EgovArticleService") + private EgovArticleService egovArticleService; + + @Resource(name="propertiesService") + protected EgovPropertyService propertyService; + + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Autowired + private DefaultBeanValidator beanValidator; + + //Logger log = Logger.getLogger(this.getClass()); + + /** + * 스크랩관리 목록 조회를 제공한다. + * + * @param scrapVO + * @param model + * @return + * @throws Exception + */ + @IncludedInfo(name="스크랩관리", order = 250 ,gid = 40) + @RequestMapping("/cop/scp/selectArticleScrapList.do") + public String selectArticleScrapList(@ModelAttribute("searchVO") ScrapVO scrapVO, ModelMap model) throws Exception { + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + // KISA 보안취약점 조치 (2018-12-10, 신용호) + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if(!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + scrapVO.setUniqId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + + scrapVO.setPageUnit(propertyService.getInt("pageUnit")); + scrapVO.setPageSize(propertyService.getInt("pageSize")); + + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(scrapVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(scrapVO.getPageUnit()); + paginationInfo.setPageSize(scrapVO.getPageSize()); + + scrapVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + scrapVO.setLastIndex(paginationInfo.getLastRecordIndex()); + scrapVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + Map map = egovArticleScrapService.selectArticleScrapList(scrapVO); + int totCnt = Integer.parseInt((String)map.get("resultCnt")); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList", map.get("resultList")); + model.addAttribute("resultCnt", map.get("resultCnt")); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/cop/scp/EgovArticleScrapList"; + } + + /** + * 스크랩에 대한 상세정보를 조회한다. + * + * @param scrapVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/scp/selectArticleScrapDetail.do") + public String selectArticleScrapDetail(@ModelAttribute("searchVO") ScrapVO scrapVO, ModelMap model) throws Exception { + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + // KISA 보안취약점 조치 (2018-12-10, 신용호) + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if(!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + ScrapVO scrap = egovArticleScrapService.selectArticleScrapDetail(scrapVO); + + model.addAttribute("sessionUniqId", user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + model.addAttribute("result", scrap); + + //게시판 내용 취득 + BoardVO vo = new BoardVO(); + vo.setNttId(scrap.getNttId()); + vo.setBbsId(scrap.getBbsId()); + vo = egovArticleService.selectArticleDetail(vo); + + model.addAttribute("articleVO", vo); + ////----------------------------------- + + return "egovframework/com/cop/scp/EgovArticleScrapDetail"; + } + + /** + * 스크랩 등록을 위한 등록 페이지로 이동한다. + * + * @param scrapVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/scp/insertArticleScrapView.do") + public String insertArticleScrapView(@ModelAttribute("searchVO") ScrapVO scrapVO, ModelMap model) throws Exception { + + ScrapVO scrap = new ScrapVO(); + + model.addAttribute("articleScrapVO", scrap); + + BoardVO vo = new BoardVO(); + vo.setNttId(scrapVO.getNttId()); + vo.setBbsId(scrapVO.getBbsId()); + + //게시판 내용 취득 + vo = egovArticleService.selectArticleDetail(vo); + + model.addAttribute("articleVO", vo); + ////----------------------------------- + + return "egovframework/com/cop/scp/EgovArticleScrapRegist"; + } + + + /** + * 스크랩을 등록한다. + * + * @param scrapVO + * @param scrap + * @param bindingResult + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/scp/insertArticleScrap.do") + public String insertArticleScrap(@ModelAttribute("searchVO") ScrapVO scrapVO, @ModelAttribute("scrap") Scrap scrap, + BindingResult bindingResult, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + beanValidator.validate(scrap, bindingResult); + if (bindingResult.hasErrors()) { + + //게시판 내용 취득 + BoardVO vo = new BoardVO(); + vo.setNttId(scrapVO.getNttId()); + vo.setBbsId(scrapVO.getBbsId()); + + model.addAttribute("articleScrapVO", scrap); + model.addAttribute("articleVO", vo); + + return "egovframework/com/cop/scp/EgovArticleScrapRegist"; + } + + if (isAuthenticated) { + scrap.setFrstRegisterId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + + egovArticleScrapService.insertArticleScrap(scrap); + } + + return "forward:/cop/scp/selectArticleScrapList.do"; + } + + /** + * 스크랩을 삭제한다. + * + * @param ScrapVO + * @param Scrap + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/scp/deleteArticleScrap.do") + public String deleteArticleScrap(@ModelAttribute("searchVO") ScrapVO scrapVO, @ModelAttribute("Scrap") Scrap scrap, ModelMap model) throws Exception { + @SuppressWarnings("unused") + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if (isAuthenticated) { + egovArticleScrapService.deleteArticleScrap(scrapVO); + } + + return "forward:/cop/scp/selectArticleScrapList.do"; + } + + /** + * 스크랩 수정 페이지로 이동한다. + * + * @param scrapVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/scp/updateArticleScrapView.do") + public String updateArticleScrapView(@ModelAttribute("searchVO") ScrapVO scrapVO, @ModelAttribute("scrap") Scrap scrap, ModelMap model) throws Exception { + Scrap vo = egovArticleScrapService.selectArticleScrapDetail(scrapVO); + + model.addAttribute("articleScrapVO", vo); + + //게시판 내용 취득 + BoardVO boardVO = new BoardVO(); + boardVO.setNttId(vo.getNttId()); + boardVO.setBbsId(vo.getBbsId()); + boardVO = egovArticleService.selectArticleDetail(boardVO); + + + model.addAttribute("articleVO", boardVO); + + + return "egovframework/com/cop/scp/EgovArticleScrapUpdt"; + } + + /** + * 스크랩을 수정한다. + * + * @param ScrapVO + * @param Scrap + * @param bindingResult + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/scp/updateArticleScrap.do") + public String updateArticleScrap(@ModelAttribute("searchVO") ScrapVO scrapVO, @ModelAttribute("Scrap") Scrap scrap, + BindingResult bindingResult, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + beanValidator.validate(scrap, bindingResult); + if (bindingResult.hasErrors()) { + + Scrap vo = egovArticleScrapService.selectArticleScrapDetail(scrapVO); + + model.addAttribute("result", vo); + + return "egovframework/com/cop/scp/EgovArticleScrapUpdt"; + } + + if (isAuthenticated) { + scrap.setLastUpdusrId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + + egovArticleScrapService.updateArticleScrap(scrap); + } + + return "forward:/cop/scp/selectArticleScrapList.do"; + } +// +// /** +// * 마이페이지용 스크랩관리 목록 조회를 제공한다. +// * +// * @param scrapVO +// * @param model +// * @return +// * @throws Exception +// */ +// @RequestMapping("/cop/scp/selectScrapMainList.do") +// public String selectScrapMainList(@ModelAttribute("searchVO") ScrapVO scrapVO, ModelMap model) throws Exception { +// LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); +// +// scrapVO.setUniqId(user.getUniqId()); +// +// scrapVO.setPageUnit(propertyService.getInt("pageUnit")); +// scrapVO.setPageSize(propertyService.getInt("pageSize")); +// +// scrapVO.setFirstIndex(0); +// scrapVO.setRecordCountPerPage(5); +// +// Map map = bbsScrapService.selectScrapList(scrapVO); +// +// model.addAttribute("resultList", map.get("resultList")); +// model.addAttribute("resultCnt", map.get("resultCnt")); +// +// return "egovframework/com/cop/scp/EgovScrapMainList"; +// } + +} diff --git a/src/main/java/egovframework/com/cop/stf/service/impl/BBSSatisfactionDAO.java b/src/main/java/egovframework/com/cop/stf/service/impl/BBSSatisfactionDAO.java new file mode 100644 index 0000000..7afa0ad --- /dev/null +++ b/src/main/java/egovframework/com/cop/stf/service/impl/BBSSatisfactionDAO.java @@ -0,0 +1,114 @@ +package egovframework.com.cop.stf.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.cop.bbs.service.Satisfaction; +import egovframework.com.cop.bbs.service.SatisfactionVO; + +import org.springframework.stereotype.Repository; + +/** + * 만족도조사를 위한 데이터 접근 클래스 + * @author 공통컴포넌트개발팀 한성곤 + * @since 2009.06.29 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.06.29  한성곤          최초 생성
    + *
    + * 
    + */ +@Repository("BBSSatisfactionDAO") +public class BBSSatisfactionDAO extends EgovComAbstractDAO { + + /** + * 만족도조사에 대한 목록을 조회 한다. + * + * @param satisfactionVO + * @return + * @throws Exception + */ + public List selectSatisfactionList(SatisfactionVO satisfactionVO) throws Exception { + return selectList("BBSSatisfactionDAO.selectSatisfactionList", satisfactionVO); + } + + /** + * 만족도조사에 대한 목록 건수를 조회 한다. + * + * @param satisfactionVO + * @return + * @throws Exception + */ + public int selectSatisfactionListCnt(SatisfactionVO satisfactionVO) throws Exception { + return (Integer)selectOne("BBSSatisfactionDAO.selectSatisfactionListCnt", satisfactionVO); + } + + /** + * 만족도조사를 등록한다. + * + * @param satisfaction + * @throws Exception + */ + public void insertSatisfaction(Satisfaction satisfaction) throws Exception { + insert("BBSSatisfactionDAO.insertSatisfaction", satisfaction); + } + + /** + * 만족도조사를 삭제한다. + * + * @param satisfactionVO + * @throws Exception + */ + public void deleteSatisfaction(SatisfactionVO satisfactionVO) throws Exception { + update("BBSSatisfactionDAO.deleteSatisfaction", satisfactionVO); + } + + /** + * 만족도조사에 대한 내용을 조회한다. + * + * @param satisfactionVO + * @return + * @throws Exception + */ + public Satisfaction selectSatisfaction(SatisfactionVO satisfactionVO) throws Exception { + return (Satisfaction)selectOne("BBSSatisfactionDAO.selectSatisfaction", satisfactionVO); + } + + /** + * 만족도조사에 대한 내용을 수정한다. + * + * @param satisfaction + * @throws Exception + */ + public void updateSatisfaction(Satisfaction satisfaction) throws Exception { + insert("BBSSatisfactionDAO.updateSatisfaction", satisfaction); + } + + /** + * 만족도조사에 대한 패스워드를 조회 한다. + * + * @param satisfaction + * @return + * @throws Exception + */ + public String getSatisfactionPassword(Satisfaction satisfaction) throws Exception { + return (String)selectOne("BBSSatisfactionDAO.getSatisfactionPassword", satisfaction); + } + + /** + * 만족도 전체 점수를 제공한다. + * + * @param satisfactionVO + * @return + * @throws Exception + */ + public Float getSummary(SatisfactionVO satisfactionVO) throws Exception { + return (Float)selectOne("BBSSatisfactionDAO.getSummary", satisfactionVO); + } +} diff --git a/src/main/java/egovframework/com/cop/stf/service/impl/EgovBBSSatisfactionServiceImpl.java b/src/main/java/egovframework/com/cop/stf/service/impl/EgovBBSSatisfactionServiceImpl.java new file mode 100644 index 0000000..e08a3e3 --- /dev/null +++ b/src/main/java/egovframework/com/cop/stf/service/impl/EgovBBSSatisfactionServiceImpl.java @@ -0,0 +1,127 @@ +package egovframework.com.cop.stf.service.impl; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import egovframework.com.cop.bbs.service.BoardMaster; +import egovframework.com.cop.bbs.service.BoardMasterVO; +import egovframework.com.cop.bbs.service.EgovBBSSatisfactionService; +import egovframework.com.cop.bbs.service.Satisfaction; +import egovframework.com.cop.bbs.service.SatisfactionVO; +import egovframework.com.cop.bbs.service.impl.BBSAddedOptionsDAO; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +/** + * 만족도조사를 위한 서비스 구현 클래스 + * @author 공통컴포넌트개발팀 한성곤 + * @since 2009.06.29 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.06.29  한성곤          최초 생성
    + *   2011.09.15  서준식          addedOptions 적용 방법 수정
    + *   2011.10.18  서준식          StsfdgNo 자동 생성 방식으로 변경
    + * 
    + */ +@Service("EgovBBSSatisfactionService") +public class EgovBBSSatisfactionServiceImpl extends EgovAbstractServiceImpl implements EgovBBSSatisfactionService { + + @Resource(name = "BBSAddedOptionsDAO") + private BBSAddedOptionsDAO addedOptionsDAO; + + @Resource(name = "BBSSatisfactionDAO") + private BBSSatisfactionDAO bbsSatisfactionDAO; + + @Resource(name = "egovStsfdgNoGnrService") + private EgovIdGnrService egovStsfdgNoGnrService; + + /** + * 만족도조사 사용 가능 여부를 확인한다. + */ + public boolean canUseSatisfaction(String bbsId) throws Exception { + //String flag = EgovProperties.getProperty("Globals.addedOptions"); + //if (flag != null && flag.trim().equalsIgnoreCase("true")) {//2011.09.15 + BoardMaster vo = new BoardMaster(); + + vo.setBbsId(bbsId); + + BoardMasterVO options = addedOptionsDAO.selectAddedOptionsInf(vo); + + if (options == null) { + return false; + } + + if (options.getStsfdgAt().equals("Y")) { + return true; + } + //} + + return false; + } + + /** + * 만족도조사에 대한 목록을 조회 한다. + */ + public Map selectSatisfactionList(SatisfactionVO satisfactionVO) throws Exception { + List result = bbsSatisfactionDAO.selectSatisfactionList(satisfactionVO); + int cnt = bbsSatisfactionDAO.selectSatisfactionListCnt(satisfactionVO); + float summary = bbsSatisfactionDAO.getSummary(satisfactionVO); + + Map map = new HashMap(); + + map.put("resultList", result); + map.put("resultCnt", Integer.toString(cnt)); + map.put("summary", Float.toString(summary)); + + return map; + } + + /** + * 만족도조사를 등록한다. + */ + public void insertSatisfaction(Satisfaction satisfaction) throws Exception { + + satisfaction.setStsfdgNo(egovStsfdgNoGnrService.getNextLongId() + "");//2011.10.18 + bbsSatisfactionDAO.insertSatisfaction(satisfaction); + } + + /** + * 만족도조사를 삭제한다. + */ + public void deleteSatisfaction(SatisfactionVO satisfactionVO) throws Exception { + bbsSatisfactionDAO.deleteSatisfaction(satisfactionVO); + } + + /** + * 만족도조사에 대한 내용을 조회한다. + */ + public Satisfaction selectSatisfaction(SatisfactionVO satisfactionVO) throws Exception { + return bbsSatisfactionDAO.selectSatisfaction(satisfactionVO); + } + + /** + * 만족도조사에 대한 내용을 수정한다. + */ + public void updateSatisfaction(Satisfaction satisfaction) throws Exception { + bbsSatisfactionDAO.updateSatisfaction(satisfaction); + } + + /** + * 만족도조사 패스워드를 가져온다. + */ + public String getSatisfactionPassword(Satisfaction satisfaction) throws Exception { + return bbsSatisfactionDAO.getSatisfactionPassword(satisfaction); + } +} diff --git a/src/main/java/egovframework/com/cop/stf/web/EgovBBSSatisfactionController.java b/src/main/java/egovframework/com/cop/stf/web/EgovBBSSatisfactionController.java new file mode 100644 index 0000000..b54dc65 --- /dev/null +++ b/src/main/java/egovframework/com/cop/stf/web/EgovBBSSatisfactionController.java @@ -0,0 +1,550 @@ +package egovframework.com.cop.stf.web; + +import java.util.Map; + +import javax.annotation.Resource; + +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.springmodules.validation.commons.DefaultBeanValidator; + +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.cop.bbs.service.EgovBBSSatisfactionService; +import egovframework.com.cop.bbs.service.Satisfaction; +import egovframework.com.cop.bbs.service.SatisfactionVO; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import egovframework.com.utl.sim.service.EgovFileScrty; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +/** + * 만족도 서비스 컨트롤러 클래스 + * @author 공통컴포넌트개발팀 한성곤 + * @since 2009.06.29 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.06.29  한성곤          최초 생성
    + *
    + * Copyright (C) 2009 by MOPAS  All right reserved.
    + * 
    + */ +@Controller +public class EgovBBSSatisfactionController { + + + + + + @Autowired(required=false) + protected EgovBBSSatisfactionService bbsSatisfactionService; + + @Resource(name="propertiesService") + protected EgovPropertyService propertyService; + + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Autowired + private DefaultBeanValidator beanValidator; + + //Logger log = Logger.getLogger(this.getClass()); + + /** + * 만족도조사 목록 조회를 제공한다. + * + * @param boardVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/stf/selectSatisfactionList.do") + public String selectSatisfactionList(@ModelAttribute("searchVO") SatisfactionVO satisfactionVO, ModelMap model) throws Exception { + + // 수정 처리된 후 만족도조사 등록 화면으로 처리되기 위한 구현 + if (satisfactionVO.isModified()) { + satisfactionVO.setStsfdgNo(""); + satisfactionVO.setStsfdgCn(""); + satisfactionVO.setStsfdg(0); + } + + // 수정을 위한 처리 + if (!satisfactionVO.getStsfdgNo().equals("")) { + return "forward:/cop/stf/selectSingleSatisfaction.do"; + } + + //------------------------------------------ + // JSP의 부분 처리 (javascript 생성) + //------------------------------------------ + model.addAttribute("type", satisfactionVO.getType()); // head or body + + if (satisfactionVO.getType().equals("head")) { + return "egovframework/com/cop/stf/EgovSatisfactionList"; + } + ////---------------------------------------- + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + model.addAttribute("sessionUniqId", user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + + satisfactionVO.setWrterNm(user == null ? "" : EgovStringUtil.isNullToString(user.getName())); + + satisfactionVO.setSubPageUnit(propertyService.getInt("pageUnit")); + satisfactionVO.setSubPageSize(propertyService.getInt("pageSize")); + + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(satisfactionVO.getSubPageIndex()); + paginationInfo.setRecordCountPerPage(satisfactionVO.getSubPageUnit()); + paginationInfo.setPageSize(satisfactionVO.getSubPageSize()); + + satisfactionVO.setSubFirstIndex(paginationInfo.getFirstRecordIndex()); + satisfactionVO.setSubLastIndex(paginationInfo.getLastRecordIndex()); + satisfactionVO.setSubRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + Map map = bbsSatisfactionService.selectSatisfactionList(satisfactionVO); + int totCnt = Integer.parseInt((String)map.get("resultCnt")); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList", map.get("resultList")); + model.addAttribute("resultCnt", map.get("resultCnt")); + model.addAttribute("summary", map.get("summary")); + model.addAttribute("paginationInfo", paginationInfo); + + satisfactionVO.setStsfdgCn(""); // 등록 후 만족도 내용 처리 + satisfactionVO.setStsfdg(0); // 등록 후 만족도 처리 + + return "egovframework/com/cop/stf/EgovSatisfactionList"; + } + + /** + * 익명용 만족도조사 목록 조회를 제공한다. + * + * @param boardVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/stf/anonymous/selectSatisfactionList.do") + public String selectAnonymousSatisfactionList(@ModelAttribute("searchVO") SatisfactionVO satisfactionVO, ModelMap model) throws Exception { + + // 수정 처리된 후 만족도조사 등록 화면으로 처리되기 위한 구현 + if (satisfactionVO.isModified()) { + satisfactionVO.setStsfdgNo(""); + satisfactionVO.setStsfdgCn(""); + satisfactionVO.setStsfdg(0); + satisfactionVO.setWrterNm(""); + } + + // 수정을 위한 처리 + if (!satisfactionVO.getStsfdgNo().equals("")) { + return "forward:/cop/stf/anonymous/selectSingleSatisfaction.do"; + } + + //------------------------------------------ + // JSP의 부분 처리 (javascript 생성) + //------------------------------------------ + model.addAttribute("type", satisfactionVO.getType()); // head or body + + if (satisfactionVO.getType().equals("head")) { + return "egovframework/com/cop/stf/EgovSatisfactionList"; + } + ////---------------------------------------- + + model.addAttribute("anonymous", "true"); + + satisfactionVO.setSubPageUnit(propertyService.getInt("pageUnit")); + satisfactionVO.setSubPageSize(propertyService.getInt("pageSize")); + + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(satisfactionVO.getSubPageIndex()); + paginationInfo.setRecordCountPerPage(satisfactionVO.getSubPageUnit()); + paginationInfo.setPageSize(satisfactionVO.getSubPageSize()); + + satisfactionVO.setSubFirstIndex(paginationInfo.getFirstRecordIndex()); + satisfactionVO.setSubLastIndex(paginationInfo.getLastRecordIndex()); + satisfactionVO.setSubRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + Map map = bbsSatisfactionService.selectSatisfactionList(satisfactionVO); + int totCnt = Integer.parseInt((String)map.get("resultCnt")); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList", map.get("resultList")); + model.addAttribute("resultCnt", map.get("resultCnt")); + model.addAttribute("summary", map.get("summary")); + model.addAttribute("paginationInfo", paginationInfo); + + satisfactionVO.setWrterNm(""); + satisfactionVO.setStsfdgCn(""); // 등록 후 만족도 내용 처리 + satisfactionVO.setStsfdg(0); // 등록 후 만족도 처리 + + return "egovframework/com/cop/stf/EgovSatisfactionList"; + } + + /** + * 만족도조사를 등록한다. + * + * @param satisfactionVO + * @param satisfaction + * @param bindingResult + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/stf/insertSatisfaction.do") + public String insertSatisfaction(@ModelAttribute("searchVO") SatisfactionVO satisfactionVO, @ModelAttribute("satisfaction") Satisfaction satisfaction, + BindingResult bindingResult, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + beanValidator.validate(satisfaction, bindingResult); + if (bindingResult.hasErrors()) { + model.addAttribute("msg", "작성자 및 만족도는 필수 입력값입니다."); + + return "forward:/cop/bbs/selectBoardArticle.do"; + } + + if (isAuthenticated) { + satisfaction.setFrstRegisterId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + satisfaction.setWrterId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + + satisfaction.setStsfdgPassword(""); // dummy + + bbsSatisfactionService.insertSatisfaction(satisfaction); + + satisfactionVO.setStsfdgCn(""); + satisfactionVO.setStsfdgNo(""); + satisfactionVO.setStsfdg(0); + } + + return "forward:/cop/bbs/selectArticleDetail.do"; + } + + /** + * 익명 만족도조사를 등록한다. + * + * @param satisfactionVO + * @param satisfaction + * @param bindingResult + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/stf/anonymous/insertSatisfaction.do") + public String insertAnonymousSatisfaction(@ModelAttribute("searchVO") SatisfactionVO satisfactionVO, @ModelAttribute("satisfaction") Satisfaction satisfaction, + BindingResult bindingResult, ModelMap model) throws Exception { + + beanValidator.validate(satisfaction, bindingResult); + if (bindingResult.hasErrors()) { + model.addAttribute("msg", "작성자 및 만족도는 필수 입력값입니다."); + + return "forward:/cop/stf/anonymous/selectBoardArticle.do"; + } + + satisfaction.setFrstRegisterId("ANONYMOUS"); + satisfaction.setWrterId(""); + satisfaction.setStsfdgPassword(EgovFileScrty.encryptPassword(satisfaction.getStsfdgPassword(), satisfaction.getStsfdgNo())); + + bbsSatisfactionService.insertSatisfaction(satisfaction); + + satisfactionVO.setStsfdgNo(""); + satisfactionVO.setStsfdgCn(""); + satisfactionVO.setStsfdg(0); + satisfactionVO.setWrterNm(""); + + return "forward:/cop/bbs/anonymous/selectArticleDetail.do"; + } + + /** + * 만족도조사를 삭제한다. + * + * @param satisfactionVO + * @param satisfaction + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/stf/deleteSatisfaction.do") + public String deleteSatisfaction(@ModelAttribute("searchVO") SatisfactionVO satisfactionVO, @ModelAttribute("satisfaction") Satisfaction satisfaction, ModelMap model) throws Exception { + @SuppressWarnings("unused") + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if (isAuthenticated) { + bbsSatisfactionService.deleteSatisfaction(satisfactionVO); + } + + satisfactionVO.setStsfdgCn(""); + satisfactionVO.setStsfdgNo(""); + satisfactionVO.setStsfdg(0); + + return "forward:/cop/bbs/selectArticleDetail.do"; + } + + /** + * 익명 만족도조사를 삭제한다. + * + * @param satisfactionVO + * @param satisfaction + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/stf/anonymous/deleteSatisfaction.do") + public String deleteAnonymousSatisfaction(@ModelAttribute("searchVO") SatisfactionVO satisfactionVO, @ModelAttribute("satisfaction") Satisfaction satisfaction, ModelMap model) throws Exception { + + //------------------------------- + // 패스워드 비교 + //------------------------------- + String dbpassword = bbsSatisfactionService.getSatisfactionPassword(satisfactionVO); + String enpassword = EgovFileScrty.encryptPassword(satisfactionVO.getConfirmPassword(), satisfaction.getStsfdgNo()); + + if (!dbpassword.equals(enpassword)) { + + model.addAttribute("subMsg", egovMessageSource.getMessage("cop.password.not.same.msg")); + + return "forward:/cop/bbs/anonymous/selectArticleDetail.do"; + } + ////----------------------------- + + bbsSatisfactionService.deleteSatisfaction(satisfactionVO); + + satisfactionVO.setStsfdgNo(""); + satisfactionVO.setStsfdgCn(""); + satisfactionVO.setStsfdg(0); + satisfactionVO.setWrterNm(""); + + return "forward:/cop/bbs/anonymous/selectBoardArticle.do"; + } + + /** + * 만족도조사 수정 페이지로 이동한다. + * + * @param satisfactionVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/stf/selectSingleSatisfaction.do") + public String selectSingleSatisfaction(@ModelAttribute("searchVO") SatisfactionVO satisfactionVO, ModelMap model) throws Exception { + + //------------------------------------------ + // JSP의 부분 처리 (javascript 생성) + //------------------------------------------ + model.addAttribute("type", satisfactionVO.getType()); // head or body + + if (satisfactionVO.getType().equals("head")) { + return "egovframework/com/cop/stf/EgovSatisfactionList"; + } + ////---------------------------------------- + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + satisfactionVO.setWrterNm(user == null ? "" : EgovStringUtil.isNullToString(user.getName())); + + satisfactionVO.setSubPageUnit(propertyService.getInt("pageUnit")); + satisfactionVO.setSubPageSize(propertyService.getInt("pageSize")); + + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(satisfactionVO.getSubPageIndex()); + paginationInfo.setRecordCountPerPage(satisfactionVO.getSubPageUnit()); + paginationInfo.setPageSize(satisfactionVO.getSubPageSize()); + + satisfactionVO.setSubFirstIndex(paginationInfo.getFirstRecordIndex()); + satisfactionVO.setSubLastIndex(paginationInfo.getLastRecordIndex()); + satisfactionVO.setSubRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + Map map = bbsSatisfactionService.selectSatisfactionList(satisfactionVO); + int totCnt = Integer.parseInt((String)map.get("resultCnt")); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList", map.get("resultList")); + model.addAttribute("resultCnt", map.get("resultCnt")); + model.addAttribute("summary", map.get("summary")); + model.addAttribute("paginationInfo", paginationInfo); + + Satisfaction data = bbsSatisfactionService.selectSatisfaction(satisfactionVO); + + satisfactionVO.setStsfdgNo(data.getStsfdgNo()); + satisfactionVO.setNttId(data.getNttId()); + satisfactionVO.setBbsId(data.getBbsId()); + satisfactionVO.setWrterId(data.getWrterId()); + satisfactionVO.setWrterNm(data.getWrterNm()); + satisfactionVO.setStsfdgPassword(data.getStsfdgPassword()); + satisfactionVO.setStsfdgCn(data.getStsfdgCn()); + satisfactionVO.setStsfdg(data.getStsfdg()); + satisfactionVO.setUseAt(data.getUseAt()); + satisfactionVO.setFrstRegisterPnttm(data.getFrstRegisterPnttm()); + satisfactionVO.setFrstRegisterNm(data.getFrstRegisterNm()); + + return "egovframework/com/cop/stf/EgovSatisfactionList"; + } + + /** + * 익명 만족도조사 수정 페이지로 이동한다. + * + * @param satisfactionVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/stf/anonymous/selectSingleSatisfaction.do") + public String selectAnonymousSingleSatisfaction(@ModelAttribute("searchVO") SatisfactionVO satisfactionVO, ModelMap model) throws Exception { + + //------------------------------------------ + // JSP의 부분 처리 (javascript 생성) + //------------------------------------------ + model.addAttribute("type", satisfactionVO.getType()); // head or body + + if (satisfactionVO.getType().equals("head")) { + return "egovframework/com/cop/stf/EgovSatisfactionList"; + } + ////---------------------------------------- + + model.addAttribute("anonymous", "true"); + + satisfactionVO.setSubPageUnit(propertyService.getInt("pageUnit")); + satisfactionVO.setSubPageSize(propertyService.getInt("pageSize")); + + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(satisfactionVO.getSubPageIndex()); + paginationInfo.setRecordCountPerPage(satisfactionVO.getSubPageUnit()); + paginationInfo.setPageSize(satisfactionVO.getSubPageSize()); + + satisfactionVO.setSubFirstIndex(paginationInfo.getFirstRecordIndex()); + satisfactionVO.setSubLastIndex(paginationInfo.getLastRecordIndex()); + satisfactionVO.setSubRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + Map map = bbsSatisfactionService.selectSatisfactionList(satisfactionVO); + int totCnt = Integer.parseInt((String)map.get("resultCnt")); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList", map.get("resultList")); + model.addAttribute("resultCnt", map.get("resultCnt")); + model.addAttribute("summary", map.get("summary")); + model.addAttribute("paginationInfo", paginationInfo); + + //------------------------------- + // 패스워드 비교 + //------------------------------- + String dbpassword = bbsSatisfactionService.getSatisfactionPassword(satisfactionVO); + String enpassword = EgovFileScrty.encryptPassword(satisfactionVO.getConfirmPassword(), satisfactionVO.getStsfdgNo()); + + if (!dbpassword.equals(enpassword)) { + + model.addAttribute("subMsg", egovMessageSource.getMessage("cop.password.not.same.msg")); + + satisfactionVO.setStsfdgNo(""); + satisfactionVO.setStsfdgCn(""); + satisfactionVO.setStsfdg(0); + satisfactionVO.setWrterNm(""); + + } else { + + Satisfaction data = bbsSatisfactionService.selectSatisfaction(satisfactionVO); + + satisfactionVO.setStsfdgNo(data.getStsfdgNo()); + satisfactionVO.setNttId(data.getNttId()); + satisfactionVO.setBbsId(data.getBbsId()); + satisfactionVO.setWrterId(data.getWrterId()); + satisfactionVO.setWrterNm(data.getWrterNm()); + satisfactionVO.setStsfdgPassword(data.getStsfdgPassword()); + satisfactionVO.setStsfdgCn(data.getStsfdgCn()); + satisfactionVO.setStsfdg(data.getStsfdg()); + satisfactionVO.setUseAt(data.getUseAt()); + satisfactionVO.setFrstRegisterPnttm(data.getFrstRegisterPnttm()); + satisfactionVO.setFrstRegisterNm(data.getFrstRegisterNm()); + } + ////----------------------------- + + return "egovframework/com/cop/stf/EgovSatisfactionList"; + } + + /** + * 만족도조사를 수정한다. + * + * @param satisfactionVO + * @param satisfaction + * @param bindingResult + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/stf/updateSatisfaction.do") + public String updateSatisfaction(@ModelAttribute("searchVO") SatisfactionVO satisfactionVO, @ModelAttribute("satisfaction") Satisfaction satisfaction, + BindingResult bindingResult, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + beanValidator.validate(satisfaction, bindingResult); + if (bindingResult.hasErrors()) { + model.addAttribute("msg", "작성자 및 만족도는 필수 입력값입니다."); + + return "forward:/cop/bbs/selectArticleDetail.do"; + } + + if (isAuthenticated) { + satisfaction.setLastUpdusrId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + + satisfaction.setStsfdgPassword(""); // dummy + + bbsSatisfactionService.updateSatisfaction(satisfaction); + + satisfactionVO.setStsfdgCn(""); + satisfactionVO.setStsfdgNo(""); + satisfactionVO.setStsfdg(0); + } + + return "forward:/cop/bbs/selectArticleDetail.do"; + } + + /** + * 익명 만족도조사를 수정한다. + * + * @param satisfactionVO + * @param satisfaction + * @param bindingResult + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/stf/anonymous/updateSatisfaction.do") + public String updateAnonymousSatisfaction(@ModelAttribute("searchVO") SatisfactionVO satisfactionVO, @ModelAttribute("satisfaction") Satisfaction satisfaction, + BindingResult bindingResult, ModelMap model) throws Exception { + + beanValidator.validate(satisfaction, bindingResult); + if (bindingResult.hasErrors()) { + model.addAttribute("msg", "작성자 및 만족도는 필수 입력값입니다."); + + return "forward:/cop/bbs/anonymous/selectBoardArticle.do"; + } + + satisfaction.setLastUpdusrId("ANONYMOUS"); + satisfaction.setStsfdgPassword(EgovFileScrty.encryptPassword(satisfaction.getStsfdgPassword(), satisfaction.getStsfdgNo())); + + bbsSatisfactionService.updateSatisfaction(satisfaction); + + satisfactionVO.setStsfdgNo(""); + satisfactionVO.setStsfdgCn(""); + satisfactionVO.setStsfdg(0); + satisfactionVO.setWrterNm(""); + + return "forward:/cop/bbs/anonymous/selectBoardArticle.do"; + } +} diff --git a/src/main/java/egovframework/com/cop/tpl/service/EgovTemplateManageService.java b/src/main/java/egovframework/com/cop/tpl/service/EgovTemplateManageService.java new file mode 100644 index 0000000..4ffc423 --- /dev/null +++ b/src/main/java/egovframework/com/cop/tpl/service/EgovTemplateManageService.java @@ -0,0 +1,94 @@ +package egovframework.com.cop.tpl.service; + +import java.util.List; +import java.util.Map; + + +/** + * 템플릿 관리를 위한 서비스 인터페이스 클래스 + * @author 공통서비스개발팀 이삼섭 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일              수정자           수정내용
    + *  ----------   --------   ---------------------------
    + *  2009.05.17   이삼섭           최초 생성
    + *  2019.05.17   신용호           selectTemplateWhiteList() 추가
    + *
    + * 
    + */ +public interface EgovTemplateManageService { + + /** + * 템플릿 정보를 삭제한다. + * + * @param tmplatInf + * @throws Exception + */ + public void deleteTemplateInf(TemplateInf tmplatInf) throws Exception; + + /** + * 템플릿 정보를 등록한다. + * + * @param tmplatInf + * @throws Exception + */ + public void insertTemplateInf(TemplateInf tmplatInf) throws Exception; + + /** + * 템플릿 정보를 수정한다. + * + * @param tmplatInf + * @throws Exception + */ + public void updateTemplateInf(TemplateInf tmplatInf) throws Exception; + + /** + * 템플릿에 대한 화이트리스트 목록을 조회한다. + * + * @param tmplatInfVO + * @return + * @throws Exception + */ + public List selectTemplateWhiteList() throws Exception; + + /** + * 템플릿에 대한 목록를 조회한다. + * + * @param tmplatInfVO + * @return + * @throws Exception + */ + public Map selectTemplateInfs(TemplateInfVO tmplatInfVO) throws Exception; + + /** + * 템플릿에 대한 상세정보를 조회한다. + * + * @param tmplatInfVO + * @return + * @throws Exception + */ + public TemplateInfVO selectTemplateInf(TemplateInfVO tmplatInfVO) throws Exception; + + /** + * 템플릿에 대한 미리보기 정보를 조회한다. + * + * @param tmplatInfVO + * @return + * @throws Exception + */ + public TemplateInfVO selectTemplatePreview(TemplateInfVO tmplatInfVO) throws Exception; + + /** + * 템플릿 구분에 따른 목록을 조회한다. + * + * @param tmplatInfVO + * @return + * @throws Exception + */ + public List selectTemplateInfsByCode(TemplateInfVO tmplatInfVO) throws Exception; +} diff --git a/src/main/java/egovframework/com/cop/tpl/service/TemplateInf.java b/src/main/java/egovframework/com/cop/tpl/service/TemplateInf.java new file mode 100644 index 0000000..4554c7e --- /dev/null +++ b/src/main/java/egovframework/com/cop/tpl/service/TemplateInf.java @@ -0,0 +1,230 @@ +package egovframework.com.cop.tpl.service; + +import java.io.Serializable; + +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * 템플릿 정보를 관리하기 위한 모델 클래스 + * @author 공통서비스개발팀 이삼섭 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.3.17  이삼섭          최초 생성
    + *
    + * 
    + */ +@SuppressWarnings("serial") +public class TemplateInf implements Serializable { + + /** 최초등록자 아이디 */ + private String frstRegisterId = ""; + + /** 최초등록시점 */ + private String frstRegisterPnttm = ""; + + /** 최종수정자 아이디 */ + private String lastUpdusrId = ""; + + /** 최종수정시점 */ + private String lastUpdusrPnttm = ""; + + /** 템플릿 경로 */ + private String tmplatCours = ""; + + /** 템플릿 아이디 */ + private String tmplatId = ""; + + /** 템플릿 명 */ + private String tmplatNm = ""; + + /** 탬플릿 구분코드 */ + private String tmplatSeCode = ""; + + /** 사용여부 */ + private String useAt = ""; + + /** + * frstRegisterId attribute를 리턴한다. + * + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * frstRegisterId attribute 값을 설정한다. + * + * @param frstRegisterId + * the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * frstRegisterPnttm attribute를 리턴한다. + * + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * frstRegisterPnttm attribute 값을 설정한다. + * + * @param frstRegisterPnttm + * the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * lastUpdusrId attribute를 리턴한다. + * + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * lastUpdusrId attribute 값을 설정한다. + * + * @param lastUpdusrId + * the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + /** + * lastUpdusrPnttm attribute를 리턴한다. + * + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * lastUpdusrPnttm attribute 값을 설정한다. + * + * @param lastUpdusrPnttm + * the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * tmplatCours attribute를 리턴한다. + * + * @return the tmplatCours + */ + public String getTmplatCours() { + return tmplatCours; + } + + /** + * tmplatCours attribute 값을 설정한다. + * + * @param tmplatCours + * the tmplatCours to set + */ + public void setTmplatCours(String tmplatCours) { + this.tmplatCours = tmplatCours; + } + + /** + * tmplatId attribute를 리턴한다. + * + * @return the tmplatId + */ + public String getTmplatId() { + return tmplatId; + } + + /** + * tmplatId attribute 값을 설정한다. + * + * @param tmplatId + * the tmplatId to set + */ + public void setTmplatId(String tmplatId) { + this.tmplatId = tmplatId; + } + + /** + * tmplatNm attribute를 리턴한다. + * + * @return the tmplatNm + */ + public String getTmplatNm() { + return tmplatNm; + } + + /** + * tmplatNm attribute 값을 설정한다. + * + * @param tmplatNm + * the tmplatNm to set + */ + public void setTmplatNm(String tmplatNm) { + this.tmplatNm = tmplatNm; + } + + /** + * tmplatSeCode attribute를 리턴한다. + * + * @return the tmplatSeCode + */ + public String getTmplatSeCode() { + return tmplatSeCode; + } + + /** + * tmplatSeCode attribute 값을 설정한다. + * + * @param tmplatSeCode + * the tmplatSeCode to set + */ + public void setTmplatSeCode(String tmplatSeCode) { + this.tmplatSeCode = tmplatSeCode; + } + + /** + * useAt attribute를 리턴한다. + * + * @return the useAt + */ + public String getUseAt() { + return useAt; + } + + /** + * useAt attribute 값을 설정한다. + * + * @param useAt + * the useAt to set + */ + public void setUseAt(String useAt) { + this.useAt = useAt; + } + + /** + * toString 메소드를 대치한다. + */ + public String toString() { + return ToStringBuilder.reflectionToString(this); + } +} diff --git a/src/main/java/egovframework/com/cop/tpl/service/TemplateInfVO.java b/src/main/java/egovframework/com/cop/tpl/service/TemplateInfVO.java new file mode 100644 index 0000000..20a3288 --- /dev/null +++ b/src/main/java/egovframework/com/cop/tpl/service/TemplateInfVO.java @@ -0,0 +1,407 @@ +package egovframework.com.cop.tpl.service; + +import java.io.Serializable; + +import org.apache.commons.lang3.builder.ToStringBuilder; + + +/** + * 템플릿 정보 관리를 위한 VO 클래스 + * @author 공통서비스개발팀 이삼섭 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.3.17  이삼섭          최초 생성
    + *
    + * 
    + */ +@SuppressWarnings("serial") +public class TemplateInfVO extends TemplateInf implements Serializable { + + /** 최초 등록자명 */ + private String frstRegisterNm = ""; + + /** 최종 수정자명 */ + private String lastUpdusrNm = ""; + + /** 템플릿 구분 코드명 */ + private String tmplatSeCodeNm = ""; + + /** 검색시작일 */ + private String searchBgnDe = ""; + + /** 검색조건 */ + private String searchCnd = ""; + + /** 검색종료일 */ + private String searchEndDe = ""; + + /** 검색단어 */ + private String searchWrd = ""; + + /** 정렬순서(DESC,ASC) */ + private String sortOrdr = ""; + + /** 검색사용여부 */ + private String searchUseYn = ""; + + /** 현재페이지 */ + private int pageIndex = 1; + + /** 페이지갯수 */ + private int pageUnit = 10; + + /** 페이지사이즈 */ + private int pageSize = 10; + + /** 첫페이지 인덱스 */ + private int firstIndex = 1; + + /** 마지막페이지 인덱스 */ + private int lastIndex = 1; + + /** 페이지당 레코드 개수 */ + private int recordCountPerPage = 10; + + /** 레코드 번호 */ + private int rowNo = 0; + + /** 구분 유형 */ + private String typeFlag = ""; + + /** + * frstRegisterNm attribute를 리턴한다. + * + * @return the frstRegisterNm + */ + public String getFrstRegisterNm() { + return frstRegisterNm; + } + + /** + * frstRegisterNm attribute 값을 설정한다. + * + * @param frstRegisterNm + * the frstRegisterNm to set + */ + public void setFrstRegisterNm(String frstRegisterNm) { + this.frstRegisterNm = frstRegisterNm; + } + + /** + * lastUpdusrNm attribute를 리턴한다. + * + * @return the lastUpdusrNm + */ + public String getLastUpdusrNm() { + return lastUpdusrNm; + } + + /** + * lastUpdusrNm attribute 값을 설정한다. + * + * @param lastUpdusrNm + * the lastUpdusrNm to set + */ + public void setLastUpdusrNm(String lastUpdusrNm) { + this.lastUpdusrNm = lastUpdusrNm; + } + + /** + * tmplatSeCodeNm attribute를 리턴한다. + * + * @return the tmplatSeCodeNm + */ + public String getTmplatSeCodeNm() { + return tmplatSeCodeNm; + } + + /** + * tmplatSeCodeNm attribute 값을 설정한다. + * + * @param tmplatSeCodeNm + * the tmplatSeCodeNm to set + */ + public void setTmplatSeCodeNm(String tmplatSeCodeNm) { + this.tmplatSeCodeNm = tmplatSeCodeNm; + } + + /** + * searchBgnDe attribute를 리턴한다. + * + * @return the searchBgnDe + */ + public String getSearchBgnDe() { + return searchBgnDe; + } + + /** + * searchBgnDe attribute 값을 설정한다. + * + * @param searchBgnDe + * the searchBgnDe to set + */ + public void setSearchBgnDe(String searchBgnDe) { + this.searchBgnDe = searchBgnDe; + } + + /** + * searchCnd attribute를 리턴한다. + * + * @return the searchCnd + */ + public String getSearchCnd() { + return searchCnd; + } + + /** + * searchCnd attribute 값을 설정한다. + * + * @param searchCnd + * the searchCnd to set + */ + public void setSearchCnd(String searchCnd) { + this.searchCnd = searchCnd; + } + + /** + * searchEndDe attribute를 리턴한다. + * + * @return the searchEndDe + */ + public String getSearchEndDe() { + return searchEndDe; + } + + /** + * searchEndDe attribute 값을 설정한다. + * + * @param searchEndDe + * the searchEndDe to set + */ + public void setSearchEndDe(String searchEndDe) { + this.searchEndDe = searchEndDe; + } + + /** + * searchWrd attribute를 리턴한다. + * + * @return the searchWrd + */ + public String getSearchWrd() { + return searchWrd; + } + + /** + * searchWrd attribute 값을 설정한다. + * + * @param searchWrd + * the searchWrd to set + */ + public void setSearchWrd(String searchWrd) { + this.searchWrd = searchWrd; + } + + /** + * sortOrdr attribute를 리턴한다. + * + * @return the sortOrdr + */ + public String getSortOrdr() { + return sortOrdr; + } + + /** + * sortOrdr attribute 값을 설정한다. + * + * @param sortOrdr + * the sortOrdr to set + */ + public void setSortOrdr(String sortOrdr) { + this.sortOrdr = sortOrdr; + } + + /** + * searchUseYn attribute를 리턴한다. + * + * @return the searchUseYn + */ + public String getSearchUseYn() { + return searchUseYn; + } + + /** + * searchUseYn attribute 값을 설정한다. + * + * @param searchUseYn + * the searchUseYn to set + */ + public void setSearchUseYn(String searchUseYn) { + this.searchUseYn = searchUseYn; + } + + /** + * pageIndex attribute를 리턴한다. + * + * @return the pageIndex + */ + public int getPageIndex() { + return pageIndex; + } + + /** + * pageIndex attribute 값을 설정한다. + * + * @param pageIndex + * the pageIndex to set + */ + public void setPageIndex(int pageIndex) { + this.pageIndex = pageIndex; + } + + /** + * pageUnit attribute를 리턴한다. + * + * @return the pageUnit + */ + public int getPageUnit() { + return pageUnit; + } + + /** + * pageUnit attribute 값을 설정한다. + * + * @param pageUnit + * the pageUnit to set + */ + public void setPageUnit(int pageUnit) { + this.pageUnit = pageUnit; + } + + /** + * pageSize attribute를 리턴한다. + * + * @return the pageSize + */ + public int getPageSize() { + return pageSize; + } + + /** + * pageSize attribute 값을 설정한다. + * + * @param pageSize + * the pageSize to set + */ + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + /** + * firstIndex attribute를 리턴한다. + * + * @return the firstIndex + */ + public int getFirstIndex() { + return firstIndex; + } + + /** + * firstIndex attribute 값을 설정한다. + * + * @param firstIndex + * the firstIndex to set + */ + public void setFirstIndex(int firstIndex) { + this.firstIndex = firstIndex; + } + + /** + * lastIndex attribute를 리턴한다. + * + * @return the lastIndex + */ + public int getLastIndex() { + return lastIndex; + } + + /** + * lastIndex attribute 값을 설정한다. + * + * @param lastIndex + * the lastIndex to set + */ + public void setLastIndex(int lastIndex) { + this.lastIndex = lastIndex; + } + + /** + * recordCountPerPage attribute를 리턴한다. + * + * @return the recordCountPerPage + */ + public int getRecordCountPerPage() { + return recordCountPerPage; + } + + /** + * recordCountPerPage attribute 값을 설정한다. + * + * @param recordCountPerPage + * the recordCountPerPage to set + */ + public void setRecordCountPerPage(int recordCountPerPage) { + this.recordCountPerPage = recordCountPerPage; + } + + /** + * rowNo attribute를 리턴한다. + * + * @return the rowNo + */ + public int getRowNo() { + return rowNo; + } + + /** + * rowNo attribute 값을 설정한다. + * + * @param rowNo + * the rowNo to set + */ + public void setRowNo(int rowNo) { + this.rowNo = rowNo; + } + + /** + * typeFlag attribute를 리턴한다. + * + * @return the typeFlag + */ + public String getTypeFlag() { + return typeFlag; + } + + /** + * typeFlag attribute 값을 설정한다. + * + * @param typeFlag + * the typeFlag to set + */ + public void setTypeFlag(String typeFlag) { + this.typeFlag = typeFlag; + } + + /** + * toString 메소드를 대치한다. + */ + public String toString() { + return ToStringBuilder.reflectionToString(this); + } +} diff --git a/src/main/java/egovframework/com/cop/tpl/service/impl/EgovTemplateManageServiceImpl.java b/src/main/java/egovframework/com/cop/tpl/service/impl/EgovTemplateManageServiceImpl.java new file mode 100644 index 0000000..c52cd0c --- /dev/null +++ b/src/main/java/egovframework/com/cop/tpl/service/impl/EgovTemplateManageServiceImpl.java @@ -0,0 +1,134 @@ +package egovframework.com.cop.tpl.service.impl; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import egovframework.com.cop.tpl.service.EgovTemplateManageService; +import egovframework.com.cop.tpl.service.TemplateInf; +import egovframework.com.cop.tpl.service.TemplateInfVO; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +/** + * 템플릿 정보관리를 위한 서비스 구현 클래스 + * @author 공통서비스개발팀 이삼섭 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *  수정일               수정자            수정내용
    + *  ----------   --------   ---------------------------
    + *  2009.03.17   이삼섭           최초 생성
    + *  2019.05.17   신용호           selectTemplateWhiteList() 추가
    + *
    + * 
    + */ +@Service("EgovTemplateManageService") +public class EgovTemplateManageServiceImpl extends EgovAbstractServiceImpl implements EgovTemplateManageService { + + @Resource(name = "TemplateManageDAO") + private TemplateManageDAO tmplatDAO; + + @Resource(name = "egovTmplatIdGnrService") + private EgovIdGnrService idgenService; + + /** + * 템플릿 정보를 삭제한다. + * + * @see egovframework.com.cop.bbs.com.service.EgovTemplateManageService#deleteTemplateInf(egovframework.com.cop.bbs.com.service.TemplateInf) + */ + public void deleteTemplateInf(TemplateInf tmplatInf) throws Exception { + tmplatDAO.deleteTemplateInf(tmplatInf); + } + + /** + * 템플릿 정보를 등록한다. + * + * @see egovframework.com.cop.bbs.com.service.EgovTemplateManageService#insertTemplateInf(egovframework.com.cop.bbs.com.service.TemplateInf) + */ + public void insertTemplateInf(TemplateInf tmplatInf) throws Exception { + + tmplatInf.setTmplatId(idgenService.getNextStringId()); + + tmplatDAO.insertTemplateInf(tmplatInf); + } + + /** + * 템플릿에 대한 상세정보를 조회한다. + * + * @see egovframework.com.cop.bbs.com.service.EgovTemplateManageService#selectTemplateInf(egovframework.com.cop.bbs.com.service.TemplateInfVO) + */ + public TemplateInfVO selectTemplateInf(TemplateInfVO tmplatInfVO) throws Exception { + TemplateInfVO vo = new TemplateInfVO(); + vo = tmplatDAO.selectTemplateInf(tmplatInfVO); + return vo; + } + + /** + * 템플릿에 대한 화이트리스트 목록을 조회한다. + * + * @see egovframework.com.cop.bbs.com.service.EgovTemplateManageService#selectTemplateInfs(egovframework.com.cop.bbs.com.service.TemplateInfVO) + */ + public List selectTemplateWhiteList() throws Exception { + List resultWhiteList = tmplatDAO.selectTemplateWhiteList(); + + return resultWhiteList; + } + + /** + * 템플릿에 대한 목록를 조회한다. + * + * @see egovframework.com.cop.bbs.com.service.EgovTemplateManageService#selectTemplateInfs(egovframework.com.cop.bbs.com.service.TemplateInfVO) + */ + public Map selectTemplateInfs(TemplateInfVO tmplatInfVO) throws Exception { + List result = tmplatDAO.selectTemplateInfs(tmplatInfVO); + int cnt = tmplatDAO.selectTemplateInfsCnt(tmplatInfVO); + + Map map = new HashMap(); + + map.put("resultList", result); + map.put("resultCnt", Integer.toString(cnt)); + + return map; + } + + /** + * 템플릿에 대한 미리보기 정보를 조회한다. + * + * @see egovframework.com.cop.bbs.com.service.EgovTemplateManageService#selectTemplatePreview(egovframework.com.cop.bbs.com.service.TemplateInfVO) + */ + public TemplateInfVO selectTemplatePreview(TemplateInfVO tmplatInfVO) throws Exception { + TemplateInfVO vo = new TemplateInfVO(); + + vo = tmplatDAO.selectTemplatePreview(tmplatInfVO); + + return vo; + } + + /** + * 템플릿 정보를 수정한다. + * + * @see egovframework.com.cop.bbs.com.service.EgovTemplateManageService#updateTemplateInf(egovframework.com.cop.bbs.com.service.TemplateInf) + */ + public void updateTemplateInf(TemplateInf tmplatInf) throws Exception { + tmplatDAO.updateTemplateInf(tmplatInf); + } + + /** + * 템플릿 구분에 따른 목록을 조회한다. + * + * @see egovframework.com.cop.bbs.com.service.EgovTemplateManageService#selectAllTemplateInfs(egovframework.com.cop.bbs.com.service.TemplateInfVO) + */ + public List selectTemplateInfsByCode(TemplateInfVO tmplatInfVO) throws Exception { + return tmplatDAO.selectTemplateInfsByCode(tmplatInfVO); + } +} diff --git a/src/main/java/egovframework/com/cop/tpl/service/impl/TemplateManageDAO.java b/src/main/java/egovframework/com/cop/tpl/service/impl/TemplateManageDAO.java new file mode 100644 index 0000000..20aba8f --- /dev/null +++ b/src/main/java/egovframework/com/cop/tpl/service/impl/TemplateManageDAO.java @@ -0,0 +1,128 @@ +package egovframework.com.cop.tpl.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.cop.tpl.service.TemplateInf; +import egovframework.com.cop.tpl.service.TemplateInfVO; + +import org.springframework.stereotype.Repository; + +/** + * 템플릿 정보관리를 위한 데이터 접근 클래스 + * @author 공통서비스개발팀 이삼섭 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *  수정일               수정자            수정내용
    + *  ----------   --------   ---------------------------
    + *  2009.03.17   이삼섭           최초 생성
    + *  2019.05.17   신용호           selectTemplateWhiteList() 추가
    + *
    + * 
    + */ +@Repository("TemplateManageDAO") +public class TemplateManageDAO extends EgovComAbstractDAO { + + /** + * 템플릿 정보를 삭제한다. + * + * @param tmplatInf + * @throws Exception + */ + public void deleteTemplateInf(TemplateInf tmplatInf) throws Exception { + update("TemplateManageDAO.deleteTemplateInf", tmplatInf); + } + + /** + * 템플릿 정보를 등록한다. + * + * @param tmplatInf + * @throws Exception + */ + public void insertTemplateInf(TemplateInf tmplatInf) throws Exception { + insert("TemplateManageDAO.insertTemplateInf", tmplatInf); + } + + /** + * 템플릿 정보를 수정한다. + * + * @param tmplatInf + * @throws Exception + */ + public void updateTemplateInf(TemplateInf tmplatInf) throws Exception { + update("TemplateManageDAO.updateTemplateInf", tmplatInf); + } + + /** + * 템플릿에 대한 화이트리스트 목록를 조회한다. + * + * @param tmplatInfVO + * @return + * @throws Exception + */ + public List selectTemplateWhiteList() throws Exception { + return selectList("TemplateManageDAO.selectTemplateWhiteList"); + } + + /** + * 템플릿에 대한 목록를 조회한다. + * + * @param tmplatInfVO + * @return + * @throws Exception + */ + public List selectTemplateInfs(TemplateInfVO tmplatInfVO) throws Exception { + return selectList("TemplateManageDAO.selectTemplateInfs", tmplatInfVO); + } + + /** + * 템플릿에 대한 목록 전체 건수를 조회한다. + * + * @param tmplatInfVO + * @return + * @throws Exception + */ + public int selectTemplateInfsCnt(TemplateInfVO tmplatInfVO) throws Exception { + return (Integer)selectOne("TemplateManageDAO.selectTemplateInfsCnt", tmplatInfVO); + } + + /** + * 템플릿에 대한 상세정보를 조회한다. + * + * @param tmplatInfVO + * @return + * @throws Exception + */ + public TemplateInfVO selectTemplateInf(TemplateInfVO tmplatInfVO) throws Exception { + return (TemplateInfVO)selectOne("TemplateManageDAO.selectTemplateInf", tmplatInfVO); + + } + + /** + * 템플릿에 대한 미리보기 정보를 조회한다. + * + * @param tmplatInfVO + * @return + * @throws Exception + */ + public TemplateInfVO selectTemplatePreview(TemplateInfVO tmplatInfVO) throws Exception { + return null; + } + + /** + * 템플릿 구분에 따른 목록을 조회한다. + * + * @param tmplatInfVO + * @return + * @throws Exception + */ + public List selectTemplateInfsByCode(TemplateInfVO tmplatInfVO) throws Exception { + return selectList("TemplateManageDAO.selectTemplateInfsByCode", tmplatInfVO); + } + +} diff --git a/src/main/java/egovframework/com/cop/tpl/web/EgovTemplateManageController.java b/src/main/java/egovframework/com/cop/tpl/web/EgovTemplateManageController.java new file mode 100644 index 0000000..bff10ab --- /dev/null +++ b/src/main/java/egovframework/com/cop/tpl/web/EgovTemplateManageController.java @@ -0,0 +1,302 @@ +package egovframework.com.cop.tpl.web; + +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +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.springframework.web.bind.support.SessionStatus; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import egovframework.com.cmm.ComDefaultCodeVO; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.service.EgovCmmUseService; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.cop.tpl.service.EgovTemplateManageService; +import egovframework.com.cop.tpl.service.TemplateInf; +import egovframework.com.cop.tpl.service.TemplateInfVO; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +/** + * 템플릿 관리를 위한 컨트롤러 클래스 + * @author 공통서비스개발팀 이삼섭 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------        --------    ---------------------------
    + *   2009. 3.18  이삼섭          최초 생성
    + *   2011.8.26	정진오			IncludedInfo annotation 추가
    + *
    + * 
    + */ + +@Controller +public class EgovTemplateManageController { + + @Resource(name = "EgovTemplateManageService") + private EgovTemplateManageService tmplatService; + + @Resource(name = "EgovCmmUseService") + private EgovCmmUseService cmmUseService; + + @Resource(name = "propertiesService") + protected EgovPropertyService propertyService; + + @Autowired + private DefaultBeanValidator beanValidator; + + //Logger log = Logger.getLogger(this.getClass()); + + /** + * 템플릿 목록을 조회한다. + * + * @param searchVO + * @param model + * @return + * @throws Exception + */ + @IncludedInfo(name = "템플릿관리", order = 200, gid = 40) + @RequestMapping("/cop/tpl/selectTemplateInfs.do") + public String selectTemplateInfs(@ModelAttribute("searchVO") TemplateInfVO tmplatInfVO, ModelMap model) throws Exception { + tmplatInfVO.setPageUnit(propertyService.getInt("pageUnit")); + tmplatInfVO.setPageSize(propertyService.getInt("pageSize")); + + PaginationInfo paginationInfo = new PaginationInfo(); + + paginationInfo.setCurrentPageNo(tmplatInfVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(tmplatInfVO.getPageUnit()); + paginationInfo.setPageSize(tmplatInfVO.getPageSize()); + + tmplatInfVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + tmplatInfVO.setLastIndex(paginationInfo.getLastRecordIndex()); + tmplatInfVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + Map map = tmplatService.selectTemplateInfs(tmplatInfVO); + int totCnt = Integer.parseInt((String) map.get("resultCnt")); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList", map.get("resultList")); + model.addAttribute("resultCnt", map.get("resultCnt")); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/cop/tpl/EgovTemplateList"; + } + + /** + * 템플릿에 대한 상세정보를 조회한다. + * + * @param searchVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/tpl/selectTemplateInf.do") + public String selectTemplateInf(@ModelAttribute("searchVO") TemplateInfVO tmplatInfVO, ModelMap model) throws Exception { + + ComDefaultCodeVO codeVO = new ComDefaultCodeVO(); + + codeVO.setCodeId("COM005"); + List result = cmmUseService.selectCmmCodeDetail(codeVO); + + TemplateInfVO vo = tmplatService.selectTemplateInf(tmplatInfVO); + + model.addAttribute("TemplateInfVO", vo); + model.addAttribute("resultList", result); + + return "egovframework/com/cop/tpl/EgovTemplateUpdt"; + } + + /** + * 템플릿 정보를 등록한다. + * + * @param searchVO + * @param tmplatInfo + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/tpl/insertTemplateInf.do") + public String insertTemplateInf(@ModelAttribute("searchVO") TemplateInfVO searchVO, @ModelAttribute("templateInf") TemplateInf templateInf, BindingResult bindingResult, + SessionStatus status, ModelMap model) throws Exception { + + LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + beanValidator.validate(templateInf, bindingResult); + + if (bindingResult.hasErrors()) { + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + + vo.setCodeId("COM005"); + + List result = cmmUseService.selectCmmCodeDetail(vo); + + model.addAttribute("resultList", result); + + return "egovframework/com/cop/tpl/EgovTemplateRegist"; + } + + templateInf.setFrstRegisterId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + + if (isAuthenticated) { + tmplatService.insertTemplateInf(templateInf); + } + + return "forward:/cop/tpl/selectTemplateInfs.do"; + } + + /** + * 템플릿 등록을 위한 등록페이지로 이동한다. + * + * @param searchVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/tpl/addTemplateInf.do") + public String addTemplateInf(@ModelAttribute("searchVO") TemplateInfVO searchVO, ModelMap model) throws Exception { + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + + vo.setCodeId("COM005"); + + List result = cmmUseService.selectCmmCodeDetail(vo); + + model.addAttribute("resultList", result); + + return "egovframework/com/cop/tpl/EgovTemplateRegist"; + } + + /** + * 템플릿 정보를 수정한다. + * + * @param searchVO + * @param tmplatInfo + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/tpl/updateTemplateInf.do") + public String updateTemplateInf(@ModelAttribute("searchVO") TemplateInfVO tmplatInfVO, @ModelAttribute("templateInf") TemplateInf templateInf, BindingResult bindingResult, + SessionStatus status, ModelMap model) throws Exception { + + LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + beanValidator.validate(templateInf, bindingResult); + + if (bindingResult.hasErrors()) { + ComDefaultCodeVO codeVO = new ComDefaultCodeVO(); + + codeVO.setCodeId("COM005"); + + List result = cmmUseService.selectCmmCodeDetail(codeVO); + + TemplateInfVO vo = tmplatService.selectTemplateInf(tmplatInfVO); + + model.addAttribute("TemplateInfVO", vo); + model.addAttribute("resultList", result); + + return "egovframework/com/cop/tpl/EgovTemplateUpdt"; + } + + templateInf.setLastUpdusrId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + + if (isAuthenticated) { + tmplatService.updateTemplateInf(templateInf); + } + + return "forward:/cop/tpl/selectTemplateInfs.do"; + } + + /** + * 템플릿 정보를 삭제한다. + * + * @param searchVO + * @param tmplatInfo + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/bbs/deleteTemplateInf.do") + public String deleteTemplateInf(@ModelAttribute("searchVO") TemplateInfVO searchVO, @ModelAttribute("tmplatInf") TemplateInf tmplatInf, SessionStatus status, ModelMap model) + throws Exception { + + LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + tmplatInf.setLastUpdusrId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + + if (isAuthenticated) { + tmplatService.deleteTemplateInf(tmplatInf); + } + + return "forward:/cop/tpl/selectTemplateInfs.do"; + } + + /** + * 팝업을 위한 템플릿 목록을 조회한다. + * + * @param searchVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cop/tpl/selectTemplateInfsPop.do") + public String selectTemplateInfsPop(@ModelAttribute("searchVO") TemplateInfVO tmplatInfVO, @RequestParam Map commandMap, ModelMap model) throws Exception { + + String typeFlag = (String) commandMap.get("typeFlag"); + + if ("CLB".equals(typeFlag)) { + tmplatInfVO.setTypeFlag(typeFlag); + tmplatInfVO.setTmplatSeCode("TMPT03"); + } else if ("CMY".equals(typeFlag)) { + tmplatInfVO.setTypeFlag(typeFlag); + tmplatInfVO.setTmplatSeCode("TMPT02"); + } else { + tmplatInfVO.setTypeFlag(typeFlag); + tmplatInfVO.setTmplatSeCode("TMPT01"); + } + + tmplatInfVO.setPageUnit(propertyService.getInt("pageUnit")); + tmplatInfVO.setPageSize(propertyService.getInt("pageSize")); + //CMY, CLB + + PaginationInfo paginationInfo = new PaginationInfo(); + + paginationInfo.setCurrentPageNo(tmplatInfVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(tmplatInfVO.getPageUnit()); + paginationInfo.setPageSize(tmplatInfVO.getPageSize()); + + tmplatInfVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + tmplatInfVO.setLastIndex(paginationInfo.getLastRecordIndex()); + tmplatInfVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + Map map = tmplatService.selectTemplateInfs(tmplatInfVO); + int totCnt = Integer.parseInt((String) map.get("resultCnt")); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList", map.get("resultList")); + model.addAttribute("resultCnt", map.get("resultCnt")); + model.addAttribute("typeFlag", typeFlag); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/cop/tpl/EgovTemplateInqirePopup"; + } +} diff --git a/src/main/java/egovframework/com/ext/oauth/service/EgovSignupService.java b/src/main/java/egovframework/com/ext/oauth/service/EgovSignupService.java new file mode 100644 index 0000000..6c43b31 --- /dev/null +++ b/src/main/java/egovframework/com/ext/oauth/service/EgovSignupService.java @@ -0,0 +1,52 @@ +/* + * eGovFrame OAuth + * Copyright The eGovFrame Open Community (http://open.egovframe.go.kr)). + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @author 이기하(슈퍼개발자K3) + */ +package egovframework.com.ext.oauth.service; + +import org.springframework.social.connect.UserProfile; +import org.springframework.web.context.request.WebRequest; + +/** + * 소셜 계정으로 일반회원 가입을 처리하는 비즈니스 인터페이스 클래스 + * @author 이기하 + * @since 2014.10.08 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일     	수정자          수정내용
    + *  -----------    --------    ---------------------------
    + *  2014.10.08		이기하          최초 생성
    + *  
    + */ + +public interface EgovSignupService { + + /** + * 소셜 계정으로 일반회원 가입을 처리한다 + * @param UserProfile profile + * @param WebRequest request + * @param String key + * @return String + * @exception Exception + */ + public String signup(UserProfile profile, WebRequest request, String key) throws Exception; + +} diff --git a/src/main/java/egovframework/com/ext/oauth/service/KakaoAPI20.java b/src/main/java/egovframework/com/ext/oauth/service/KakaoAPI20.java new file mode 100644 index 0000000..56ed622 --- /dev/null +++ b/src/main/java/egovframework/com/ext/oauth/service/KakaoAPI20.java @@ -0,0 +1,55 @@ +package egovframework.com.ext.oauth.service; + +import java.util.Map; + +import com.github.scribejava.core.builder.api.DefaultApi20; +import com.github.scribejava.core.model.OAuthConstants; +import com.github.scribejava.core.model.ParameterList; + +public class KakaoAPI20 extends DefaultApi20 implements OAuthConfig { + + private String apiKey = ""; + private KakaoAPI20() { + } + + private static class InstanceHolder { + private static final KakaoAPI20 INSTANCE = new KakaoAPI20(); + } + + public static KakaoAPI20 instance() { + return InstanceHolder.INSTANCE; + } + + @Override + public String getAccessTokenEndpoint() { + return KAKAO_ACCESS_TOKEN+apiKey; + } + + @Override + protected String getAuthorizationBaseUrl() { + return KAKAO_AUTH; + } + + public String getAuthorizationUrl(String responseType, String apiKey, String callback, String scope, String state, + Map additionalParams) { + this.apiKey = apiKey; + final ParameterList parameters = new ParameterList(additionalParams); + parameters.add(OAuthConstants.RESPONSE_TYPE, responseType); + parameters.add(OAuthConstants.CLIENT_ID, apiKey); + + if (callback != null) { + parameters.add(OAuthConstants.REDIRECT_URI, callback); + } + + if (scope != null) { + parameters.add(OAuthConstants.SCOPE, scope); + } + + if (state != null) { + parameters.add(OAuthConstants.STATE, state); + } + //System.out.println("===>>> "+parameters.appendTo("")); + return parameters.appendTo(getAuthorizationBaseUrl()); + } + +} diff --git a/src/main/java/egovframework/com/ext/oauth/service/NaverAPI20.java b/src/main/java/egovframework/com/ext/oauth/service/NaverAPI20.java new file mode 100644 index 0000000..f9223ef --- /dev/null +++ b/src/main/java/egovframework/com/ext/oauth/service/NaverAPI20.java @@ -0,0 +1,51 @@ +package egovframework.com.ext.oauth.service; + +import java.util.Map; + +import com.github.scribejava.core.builder.api.DefaultApi20; +import com.github.scribejava.core.model.OAuthConstants; +import com.github.scribejava.core.model.ParameterList; + +public class NaverAPI20 extends DefaultApi20 implements OAuthConfig { + private NaverAPI20() { + } + + private static class InstanceHolder { + private static final NaverAPI20 INSTANCE = new NaverAPI20(); + } + + public static NaverAPI20 instance() { + return InstanceHolder.INSTANCE; + } + + @Override + public String getAccessTokenEndpoint() { + return NAVER_ACCESS_TOKEN; + } + + @Override + protected String getAuthorizationBaseUrl() { + return NAVER_AUTH; + } + + public String getAuthorizationUrl(String responseType, String apiKey, String callback, String scope, String state, + Map additionalParams) { + final ParameterList parameters = new ParameterList(additionalParams); + parameters.add(OAuthConstants.RESPONSE_TYPE, responseType); + parameters.add(OAuthConstants.CLIENT_ID, apiKey); + + if (callback != null) { + parameters.add(OAuthConstants.REDIRECT_URI, callback); + } + + if (scope != null) { + parameters.add(OAuthConstants.SCOPE, scope); + } + + if (state != null) { + parameters.add(OAuthConstants.STATE, state); + } + //System.out.println("===>>> "+parameters.appendTo("")); + return parameters.appendTo(getAuthorizationBaseUrl()); + } +} diff --git a/src/main/java/egovframework/com/ext/oauth/service/OAuthConfig.java b/src/main/java/egovframework/com/ext/oauth/service/OAuthConfig.java new file mode 100644 index 0000000..a679bab --- /dev/null +++ b/src/main/java/egovframework/com/ext/oauth/service/OAuthConfig.java @@ -0,0 +1,18 @@ +package egovframework.com.ext.oauth.service; + +public interface OAuthConfig { + + static final String GOOGLE_PROFILE_URL = "https://www.googleapis.com/plus/v1/people/me"; + static final String NAVER_PROFILE_URL = "https://openapi.naver.com/v1/nid/me"; + static final String KAKAO_PROFILE_URL = "https://kapi.kakao.com/v2/user/me"; + + static final String NAVER_ACCESS_TOKEN = "https://nid.naver.com/oauth2.0/token?grant_type=authorization_code"; + static final String NAVER_AUTH = "https://nid.naver.com/oauth2.0/authorize"; + + static final String KAKAO_ACCESS_TOKEN = "https://kauth.kakao.com/oauth/token?client_id="; + static final String KAKAO_AUTH = "https://kauth.kakao.com/oauth/authorize"; + + static final String GOOGLE_SERVICE_NAME = "google"; + static final String NAVER_SERVICE_NAME = "naver"; + static final String KAKAO_SERVICE_NAME = "kakao"; +} diff --git a/src/main/java/egovframework/com/ext/oauth/service/OAuthLogin.java b/src/main/java/egovframework/com/ext/oauth/service/OAuthLogin.java new file mode 100644 index 0000000..e70a12f --- /dev/null +++ b/src/main/java/egovframework/com/ext/oauth/service/OAuthLogin.java @@ -0,0 +1,91 @@ +package egovframework.com.ext.oauth.service; + +import java.util.Iterator; + +import org.apache.commons.lang3.StringUtils; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.github.scribejava.core.builder.ServiceBuilder; +import com.github.scribejava.core.model.OAuth2AccessToken; +import com.github.scribejava.core.model.OAuthRequest; +import com.github.scribejava.core.model.Response; +import com.github.scribejava.core.model.Verb; +import com.github.scribejava.core.oauth.OAuth20Service; + + +public class OAuthLogin { + private OAuth20Service oauthService; + private OAuthVO oauthVO; + + public OAuthLogin(OAuthVO oauthVO) { + this.oauthService = new ServiceBuilder(oauthVO.getClientId()) + .apiSecret(oauthVO.getClientSecret()) + .callback(oauthVO.getRedirectUrl()) + .scope("profile") + .build(oauthVO.getApi20Instance()); + + this.oauthVO = oauthVO; + } + + public String getOAuthURL() { + return this.oauthService.getAuthorizationUrl(); + } + + public OAuthUniversalUser getUserProfile(String code) throws Exception { + //System.out.println("===>>> oauthService.getApiKey() = "+oauthService.getApiKey()); + //System.out.println("===>>> oauthService.getApiSecret() = "+oauthService.getApiSecret()); + OAuth2AccessToken accessToken = oauthService.getAccessToken(code); + + OAuthRequest request = new OAuthRequest(Verb.GET, this.oauthVO.getProfileUrl()); + oauthService.signRequest(accessToken, request); + + Response response = oauthService.execute(request); + return parseJson(response.getBody()); + } + + private OAuthUniversalUser parseJson(String body) throws Exception { + //System.out.println("============================\n" + body + "\n=================="); + OAuthUniversalUser user = new OAuthUniversalUser(); + + ObjectMapper mapper = new ObjectMapper(); + JsonNode rootNode = mapper.readTree(body); + + if (this.oauthVO.isGoogle()) { + String id = rootNode.get("id").asText(); + user.setServiceName(OAuthConfig.GOOGLE_SERVICE_NAME); + if (oauthVO.isGoogle()) + user.setUserId(id); + user.setNickName(rootNode.get("displayName").asText()); + JsonNode nameNode = rootNode.path("name"); + String uname = nameNode.get("familyName").asText() + nameNode.get("givenName").asText(); + user.setUserName(uname); + + Iterator iterEmails = rootNode.path("emails").elements(); + while(iterEmails.hasNext()) { + JsonNode emailNode = iterEmails.next(); + String type = emailNode.get("type").asText(); + if (StringUtils.equals(type, "account")) { + user.setEmail(emailNode.get("value").asText()); + break; + } + } + + } else if (this.oauthVO.isNaver()) { + user.setServiceName(OAuthConfig.NAVER_SERVICE_NAME); + JsonNode resNode = rootNode.get("response"); + user.setUserId(resNode.get("id").asText()); + user.setNickName(resNode.get("nickname").asText()); + user.setEmail(resNode.get("email").asText()); + + } else if (this.oauthVO.isKakao()) { + user.setServiceName(OAuthConfig.KAKAO_SERVICE_NAME); + JsonNode resNode = rootNode.get("properties"); + user.setUserId(rootNode.get("id").asText()); + user.setNickName(resNode.get("nickname").asText()); + } + + return user; + } + +} diff --git a/src/main/java/egovframework/com/ext/oauth/service/OAuthUniversalUser.java b/src/main/java/egovframework/com/ext/oauth/service/OAuthUniversalUser.java new file mode 100644 index 0000000..c36fa98 --- /dev/null +++ b/src/main/java/egovframework/com/ext/oauth/service/OAuthUniversalUser.java @@ -0,0 +1,82 @@ +package egovframework.com.ext.oauth.service; + +import java.util.Date; + +public class OAuthUniversalUser { + public String getUid() { + return uid; + } + + public void setUid(String uid) { + this.uid = uid; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getNickName() { + return nickName; + } + + public void setNickName(String nickName) { + this.nickName = nickName; + } + + public String getServiceName() { + return serviceName; + } + + public void setServiceName(String serviceName) { + this.serviceName = serviceName; + } + + public String getLoginip() { + return loginIp; + } + + public void setLoginip(String loginIp) { + this.loginIp = loginIp; + } + + public Date getLastlogin() { + return lastLogin; + } + + public void setLastlogin(Date lastLogin) { + this.lastLogin = lastLogin; + } + + private String uid; + + private String email; + private String userId; + private String userName; + private String nickName; + + private String serviceName; + + private String loginIp; + private Date lastLogin; + +} diff --git a/src/main/java/egovframework/com/ext/oauth/service/OAuthVO.java b/src/main/java/egovframework/com/ext/oauth/service/OAuthVO.java new file mode 100644 index 0000000..85aeece --- /dev/null +++ b/src/main/java/egovframework/com/ext/oauth/service/OAuthVO.java @@ -0,0 +1,114 @@ +package egovframework.com.ext.oauth.service; + +import org.apache.commons.lang3.StringUtils; + +import com.github.scribejava.apis.GoogleApi20; +import com.github.scribejava.core.builder.api.DefaultApi20; + +public class OAuthVO implements OAuthConfig { + public String getService() { + return serviceName; + } + + public void setService(String service) { + this.serviceName = service; + } + + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public String getClientSecret() { + return clientSecret; + } + + public void setClientSecret(String clientSecret) { + this.clientSecret = clientSecret; + } + + public String getRedirectUrl() { + return redirectUrl; + } + + public void setRedirectUrl(String redirectUrl) { + this.redirectUrl = redirectUrl; + } + + public DefaultApi20 getApi20Instance() { + return api20Instance; + } + + public void setApi20Instance(DefaultApi20 api20Instance) { + this.api20Instance = api20Instance; + } + + public String getProfileUrl() { + return profileUrl; + } + + public void setProfileUrl(String profileUrl) { + this.profileUrl = profileUrl; + } + + public boolean isGoogle() { + return isGoogle; + } + + public boolean isNaver() { + return isNaver; + } + + public boolean isKakao() { + return isKakao; + } + + public void setGoogle(boolean isGoogle) { + this.isGoogle = isGoogle; + } + + public void setNaver(boolean isNaver) { + this.isNaver = isNaver; + } + + public void setKakao(boolean isKakao) { + this.isKakao = isKakao; + } + + private String serviceName; + private String clientId; + private String clientSecret; + private String redirectUrl; + private DefaultApi20 api20Instance; + private String profileUrl; + + private boolean isNaver; + private boolean isGoogle; + private boolean isKakao; + + public OAuthVO(String serviceName, String clientId, String clientSecret, String redirectUrl) { + this.serviceName = serviceName; + this.clientId = clientId; + this.clientSecret = clientSecret; + this.redirectUrl = redirectUrl; + + this.isGoogle = StringUtils.equalsIgnoreCase(GOOGLE_SERVICE_NAME, serviceName); + this.isNaver = StringUtils.equalsIgnoreCase(NAVER_SERVICE_NAME, serviceName); + this.isKakao = StringUtils.equalsIgnoreCase(KAKAO_SERVICE_NAME, serviceName); + + if (isGoogle) { + this.api20Instance = GoogleApi20.instance(); + this.profileUrl = GOOGLE_PROFILE_URL; + } else if (isNaver) { + this.api20Instance = NaverAPI20.instance(); + this.profileUrl = NAVER_PROFILE_URL; + } else if (isKakao) { + this.api20Instance = KakaoAPI20.instance(); + this.profileUrl = KAKAO_PROFILE_URL; + } + } + +} diff --git a/src/main/java/egovframework/com/ext/oauth/service/impl/EgovSignInAdapterServiceImpl.java b/src/main/java/egovframework/com/ext/oauth/service/impl/EgovSignInAdapterServiceImpl.java new file mode 100644 index 0000000..f901474 --- /dev/null +++ b/src/main/java/egovframework/com/ext/oauth/service/impl/EgovSignInAdapterServiceImpl.java @@ -0,0 +1,73 @@ +/* + * eGovFrame OAuth + * Copyright The eGovFrame Open Community (http://open.egovframe.go.kr)). + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @author 이기하(슈퍼개발자K3) + */ +package egovframework.com.ext.oauth.service.impl; + +import egovframework.com.cmm.LoginVO; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import org.springframework.social.connect.Connection; +import org.springframework.social.connect.UserProfile; +import org.springframework.social.connect.web.SignInAdapter; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.NativeWebRequest; + +/** + * 소셜 로그인 구현 클래스 + * @author 이기하 + * @since 2014.10.08 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일     	수정자          수정내용
    + *  -----------    --------    ---------------------------
    + *  2014.10.08		이기하          최초 생성
    + *  
    + */ + +@Service +public class EgovSignInAdapterServiceImpl extends EgovAbstractServiceImpl implements SignInAdapter { + + @Override + public String signIn(String userId, Connection connection, NativeWebRequest request) { + + UserProfile profile = connection.fetchUserProfile(); + + // 1. 소셜 로그인 처리 + LoginVO resultVO = new LoginVO(); + resultVO.setId(userId); + + if (profile.getLastName() != null) { + resultVO.setName(profile.getFirstName() + " " + profile.getLastName()); + } else { + resultVO.setName(profile.getFirstName()); + } + + resultVO.setEmail(profile.getEmail()); + + // 2. 로그인 정보를 세션에 저장 + request.setAttribute("loginVO", resultVO, 1); + + return null; + } + +} diff --git a/src/main/java/egovframework/com/ext/oauth/service/impl/EgovSignupServiceImpl.java b/src/main/java/egovframework/com/ext/oauth/service/impl/EgovSignupServiceImpl.java new file mode 100644 index 0000000..bd8b3bf --- /dev/null +++ b/src/main/java/egovframework/com/ext/oauth/service/impl/EgovSignupServiceImpl.java @@ -0,0 +1,130 @@ +/* + * eGovFrame OAuth + * Copyright The eGovFrame Open Community (http://open.egovframe.go.kr)). + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @author 이기하(슈퍼개발자K3) + */ +package egovframework.com.ext.oauth.service.impl; + +import egovframework.com.cmm.LoginVO; +import egovframework.com.ext.oauth.service.EgovSignupService; +import egovframework.com.uss.umt.service.MberManageVO; +import egovframework.com.uss.umt.service.impl.MberManageDAO; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import egovframework.com.utl.sim.service.EgovFileScrty; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import javax.annotation.Resource; + +import org.springframework.social.connect.UserProfile; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.WebRequest; + +/** + * 소셜 계정으로 일반회원 가입을 처리하는 컨트롤러 클래스 + * @author 이기하 + * @since 2014.10.08 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일     	수정자          수정내용
    + *  -----------    --------    ---------------------------
    + *  2014.10.08		이기하          최초 생성
    + *  
    + */ + +@Service("signupService") +public class EgovSignupServiceImpl extends EgovAbstractServiceImpl implements EgovSignupService { + + @Resource(name="mberManageDAO") + private MberManageDAO mberManageDAO; + + /** + * 소셜 계정으로 일반회원 가입을 처리한다 + * @param UserProfile profile + * @param WebRequest request + * @param String key + * @return String + * @exception Exception + */ + @Override + public String signup(UserProfile profile, WebRequest request, String key) throws Exception { + + String result = null; + + key = EgovStringUtil.replace(key, "facebook", "F"); + key = EgovStringUtil.replace(key, "twitter", "T"); + + if (mberManageDAO.selectMber(key) == null) { + MberManageVO mberManageVO = new MberManageVO(); + + mberManageVO.setUniqId(key); + mberManageVO.setMberId(key); + + + if (profile.getLastName() != null) { + mberManageVO.setMberNm(profile.getFirstName() + " " + profile.getLastName()); + } else { + mberManageVO.setMberNm(profile.getFirstName()); + } + + // 필수사항 + mberManageVO.setPassword(EgovStringUtil.getRandomStr("a".charAt(0), "z".charAt(0))); + mberManageVO.setZip("000000"); + mberManageVO.setAdres("소셜로그인"); + mberManageVO.setAreaNo("00"); + mberManageVO.setMiddleTelno("000"); + mberManageVO.setMoblphonNo("0000-0000"); + mberManageVO.setEndTelno("0000"); + + // 선택사항 + mberManageVO.setMberSttus("P"); + mberManageVO.setMberEmailAdres(profile.getEmail()); // facebook만 가능 twitter은 불가 + mberManageVO.setGroupId("GROUP_00000000000000"); + + //패스워드 암호화 + String pass = EgovFileScrty.encryptPassword(mberManageVO.getPassword(), mberManageVO.getMberId()); + mberManageVO.setPassword(pass); + + result = mberManageDAO.insertMber(mberManageVO); + + + } else { + result = "true"; + } + + // 1. 소셜 로그인 처리 + LoginVO resultVO = new LoginVO(); + resultVO.setId(key); + + if (profile.getLastName() != null) { + resultVO.setName(profile.getFirstName() + " " + profile.getLastName()); + } else { + resultVO.setName(profile.getFirstName()); + } + + resultVO.setEmail(profile.getEmail()); + + // 2. 로그인 정보를 세션에 저장 + request.setAttribute("loginVO", resultVO, 1); + + return result; + } + +} diff --git a/src/main/java/egovframework/com/ext/oauth/web/EgovSignupController.java b/src/main/java/egovframework/com/ext/oauth/web/EgovSignupController.java new file mode 100644 index 0000000..6a11800 --- /dev/null +++ b/src/main/java/egovframework/com/ext/oauth/web/EgovSignupController.java @@ -0,0 +1,166 @@ +/* + * eGovFrame OAuth + * Copyright The eGovFrame Open Community (http://open.egovframe.go.kr)). + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @author 이기하(슈퍼개발자K3) + */ +package egovframework.com.ext.oauth.web; + +import javax.annotation.Resource; +import javax.inject.Inject; +import javax.servlet.http.HttpSession; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.social.connect.Connection; +import org.springframework.social.connect.ConnectionFactoryLocator; +import org.springframework.social.connect.UserProfile; +import org.springframework.social.connect.UsersConnectionRepository; +import org.springframework.social.connect.web.ProviderSignInUtils; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.context.request.WebRequest; + +import egovframework.com.ext.oauth.service.EgovSignupService; +import egovframework.com.ext.oauth.service.OAuthConfig; +import egovframework.com.ext.oauth.service.OAuthLogin; +import egovframework.com.ext.oauth.service.OAuthUniversalUser; +import egovframework.com.ext.oauth.service.OAuthVO; +import egovframework.com.utl.fcc.service.EgovStringUtil; + +/** + * 소셜 계정으로 일반회원 가입을 처리하는 컨트롤러 클래스 + * @author 이기하 + * @since 2014.10.08 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일     	수정자          수정내용
    + *  -----------    --------    ---------------------------
    + *  2014.10.08		이기하          최초 생성
    + *  2018.10.02		신용호          Facebook 관련 ProviderSignInUtils 초기화 수정
    + *  
    + */ + +@Controller +public class EgovSignupController { + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovSignupController.class); + + @Resource(name="signupService") + private EgovSignupService signupService; + + //private ConnectionRepository connectionRepository; + private final ProviderSignInUtils providerSignInUtils; + + @Inject + private OAuthVO naverAuthVO; + + @Inject + private OAuthVO googleAuthVO; + + @Inject + private OAuthVO kakaoAuthVO; + + @Inject + public EgovSignupController(ConnectionFactoryLocator connectionFactoryLocator,UsersConnectionRepository connectionRepository) { + //this.providerSignInUtils = new ProviderSignInUtils(); + this.providerSignInUtils = new ProviderSignInUtils(connectionFactoryLocator, connectionRepository); + } + + @RequestMapping(value="/signup", method=RequestMethod.GET) + public String signupForm(WebRequest request) throws Exception { + Connection connection = providerSignInUtils.getConnectionFromSession(request); + if (connection != null) { + UserProfile profile = connection.fetchUserProfile(); + + String key = EgovStringUtil.remove(connection.getKey().toString(), ':'); + String account = signupService.signup(profile, request, key); + if (account != null) { + providerSignInUtils.doPostSignUp(key, request); + return "redirect:/"; + } + } + return "redirect:/"; + } + + @RequestMapping(value = "/uat/uia/oauthLoginUsr", method = RequestMethod.GET) + public String login(Model model) throws Exception { + LOGGER.debug("===>>> OAuth Login ....."); + + OAuthLogin naverLogin = new OAuthLogin(naverAuthVO); + LOGGER.debug("naverLogin.getOAuthURL() = "+naverLogin.getOAuthURL()); + model.addAttribute("naver_url", naverLogin.getOAuthURL()); + + OAuthLogin googleLogin = new OAuthLogin(googleAuthVO); + LOGGER.debug("googleLogin.getOAuthURL() = "+googleLogin.getOAuthURL()); + model.addAttribute("google_url", googleLogin.getOAuthURL()); + + OAuthLogin kakaoLogin = new OAuthLogin(kakaoAuthVO); + LOGGER.debug("kakaoLogin.getOAuthURL() = "+kakaoLogin.getOAuthURL()); + model.addAttribute("kakao_url", kakaoLogin.getOAuthURL()); + + return "egovframework/com/uat/uia/EgovLoginUsrOauth"; + } + + @RequestMapping(value = "/auth/{oauthService}/callback", + method = { RequestMethod.GET, RequestMethod.POST}) + public String oauthLoginCallback(@PathVariable String oauthService, + Model model, @RequestParam String code, HttpSession session) throws Exception { + + LOGGER.debug("oauthLoginCallback: service={}", oauthService); + LOGGER.debug("===>>> code = "+ code); + OAuthVO oauthVO = null; + if (StringUtils.equals(OAuthConfig.GOOGLE_SERVICE_NAME, oauthService)) + oauthVO = googleAuthVO; + else if (StringUtils.equals(OAuthConfig.NAVER_SERVICE_NAME, oauthService)) + oauthVO = naverAuthVO; + else + oauthVO = kakaoAuthVO; + + // 1. code를 이용해서 Access Token 받기 + // 2. Access Token을 이용해서 사용자 제공정보 가져오기 + OAuthLogin oauthLogin = new OAuthLogin(oauthVO); + + OAuthUniversalUser oauthUser = oauthLogin.getUserProfile(code); // 1,2번 동시 + LOGGER.debug("Profile ===>>" + oauthUser); + + // ======================================================================== + // 다음 부분은 업무의 목적에 맞게 커스텀 코드를 작성한다. + // 3. 해당 유저가 DB에 존재하는지 체크 (google, naver, kakao에서 전달받은 ID가 존재하는지 체크) + String resultDBInfo = ""; // DB 체크 결과 + + if ( oauthUser == null || resultDBInfo == null) { + // 미존재시 가입페이지로!! + model.addAttribute("message", "This user does not exist. Please sign up."); + + } else { + // 존재시 로그인 처리 + model.addAttribute("message", "OAuth Sign-in succeeded."); + + } + + return "egovframework/com/uat/uia/EgovLoginUsrOauthResult"; + } + +} diff --git a/src/main/java/egovframework/com/sec/drm/service/DeptAuthor.java b/src/main/java/egovframework/com/sec/drm/service/DeptAuthor.java new file mode 100644 index 0000000..432f726 --- /dev/null +++ b/src/main/java/egovframework/com/sec/drm/service/DeptAuthor.java @@ -0,0 +1,193 @@ +package egovframework.com.sec.drm.service; + +import egovframework.com.cmm.ComDefaultVO; +import egovframework.com.sec.rgm.service.AuthorGroup; + +/** + * 부서권한에 대한 model 클래스를 정의한다. + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이문준          최초 생성
    + *
    + * 
    + */ + +public class DeptAuthor extends ComDefaultVO { + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + /** + * 권한그룹관리 + */ + private AuthorGroup authorGroup; + /** + * 설정대상 사용자 ID + */ + private String userId; + /** + * 설정대상 사용자 명 + */ + private String userNm; + /** + * 설정대상 그룹 ID + */ + private String groupId; + /** + * 설정대상 사용자 유형 코드 + */ + private String mberTyCode; + /** + * 설정대상 사용자 유형 명 + */ + private String mberTyNm; + /** + * 권한코드 + */ + private String authorCode; + /** + * 등록 여부 + */ + private String regYn; + /** + * Uniq ID + */ + private String uniqId; + + /** + * authorGroup attribute 를 리턴한다. + * @return AuthorGroup + */ + public AuthorGroup getAuthorGroup() { + return authorGroup; + } + /** + * authorGroup attribute 값을 설정한다. + * @param authorGroup AuthorGroup + */ + public void setAuthorGroup(AuthorGroup authorGroup) { + this.authorGroup = authorGroup; + } + /** + * userId attribute 를 리턴한다. + * @return String + */ + public String getUserId() { + return userId; + } + /** + * userId attribute 값을 설정한다. + * @param userId String + */ + public void setUserId(String userId) { + this.userId = userId; + } + /** + * userNm attribute 를 리턴한다. + * @return String + */ + public String getUserNm() { + return userNm; + } + /** + * userNm attribute 값을 설정한다. + * @param userNm String + */ + public void setUserNm(String userNm) { + this.userNm = userNm; + } + /** + * groupId attribute 를 리턴한다. + * @return String + */ + public String getGroupId() { + return groupId; + } + /** + * groupId attribute 값을 설정한다. + * @param groupId String + */ + public void setGroupId(String groupId) { + this.groupId = groupId; + } + /** + * mberTyCode attribute 를 리턴한다. + * @return String + */ + public String getMberTyCode() { + return mberTyCode; + } + /** + * mberTyCode attribute 값을 설정한다. + * @param mberTyCode String + */ + public void setMberTyCode(String mberTyCode) { + this.mberTyCode = mberTyCode; + } + /** + * mberTyNm attribute 를 리턴한다. + * @return String + */ + public String getMberTyNm() { + return mberTyNm; + } + /** + * mberTyNm attribute 값을 설정한다. + * @param mberTyNm String + */ + public void setMberTyNm(String mberTyNm) { + this.mberTyNm = mberTyNm; + } + /** + * authorCode attribute 를 리턴한다. + * @return String + */ + public String getAuthorCode() { + return authorCode; + } + /** + * authorCode attribute 값을 설정한다. + * @param authorCode String + */ + public void setAuthorCode(String authorCode) { + this.authorCode = authorCode; + } + /** + * regYn attribute 를 리턴한다. + * @return String + */ + public String getRegYn() { + return regYn; + } + /** + * regYn attribute 값을 설정한다. + * @param regYn String + */ + public void setRegYn(String regYn) { + this.regYn = regYn; + } + /** + * uniqId attribute 를 리턴한다. + * @return String + */ + public String getUniqId() { + return uniqId; + } + /** + * uniqId attribute 값을 설정한다. + * @param uniqId String + */ + public void setUniqId(String uniqId) { + this.uniqId = uniqId; + } + + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sec/drm/service/DeptAuthorVO.java b/src/main/java/egovframework/com/sec/drm/service/DeptAuthorVO.java new file mode 100644 index 0000000..3791d12 --- /dev/null +++ b/src/main/java/egovframework/com/sec/drm/service/DeptAuthorVO.java @@ -0,0 +1,102 @@ +package egovframework.com.sec.drm.service; + +import java.util.List; + + +/** + * 부서권한에 대한 Vo 클래스를 정의한다. + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이문준          최초 생성
    + *
    + * 
    + */ + +public class DeptAuthorVO extends DeptAuthor { + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + /** + * 부서권한목록 + */ + List deptAuthorList; + /** + * 부서목록 + */ + List deptList; + /** + * 부서코드 + */ + private String deptCode; + /** + * 부서 명 + */ + private String deptNm; + + /** + * deptAuthorList attribute 를 리턴한다. + * @return List + */ + public List getDeptAuthorList() { + return deptAuthorList; + } + /** + * deptAuthorList attribute 값을 설정한다. + * @param deptAuthorList List + */ + public void setDeptAuthorList(List deptAuthorList) { + this.deptAuthorList = deptAuthorList; + } + /** + * deptList attribute 를 리턴한다. + * @return List + */ + public List getDeptList() { + return deptList; + } + /** + * deptList attribute 값을 설정한다. + * @param deptList List + */ + public void setDeptList(List deptList) { + this.deptList = deptList; + } + /** + * deptCode attribute 를 리턴한다. + * @return String + */ + public String getDeptCode() { + return deptCode; + } + /** + * deptCode attribute 값을 설정한다. + * @param deptCode String + */ + public void setDeptCode(String deptCode) { + this.deptCode = deptCode; + } + /** + * deptNm attribute 를 리턴한다. + * @return String + */ + public String getDeptNm() { + return deptNm; + } + /** + * deptNm attribute 값을 설정한다. + * @param deptNm String + */ + public void setDeptNm(String deptNm) { + this.deptNm = deptNm; + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sec/drm/service/EgovDeptAuthorService.java b/src/main/java/egovframework/com/sec/drm/service/EgovDeptAuthorService.java new file mode 100644 index 0000000..3727f0f --- /dev/null +++ b/src/main/java/egovframework/com/sec/drm/service/EgovDeptAuthorService.java @@ -0,0 +1,77 @@ +package egovframework.com.sec.drm.service; + +import java.util.List; + + +/** + * 부서권한관리에 관한 서비스 인터페이스 클래스를 정의한다. + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이문준          최초 생성
    + *
    + * 
    + */ + +public interface EgovDeptAuthorService { + + /** + * 부서별 할당된 권한목록 조회 + * @param deptAuthorVO DeptAuthorVO + * @return List + * @exception Exception + */ + public List selectDeptAuthorList(DeptAuthorVO deptAuthorVO) throws Exception; + + /** + * 부서에 해당하는 사용자에게 시스템 메뉴/접근권한을 일괄 할당 + * @param deptAuthor DeptAuthor + * @exception Exception + */ + public void insertDeptAuthor(DeptAuthor deptAuthor) throws Exception; + + /** + * 부서별 시스템 메뉴 접근권한을 수정하여 항목의 정합성을 체크하고 수정된 데이터를 데이터베이스에 반영 + * @param deptAuthor + * @exception Exception + */ + public void updateDeptAuthor(DeptAuthor deptAuthor) throws Exception; + + /** + * 불필요한 부서권한를 조회하여 데이터베이스에서 삭제 + * @param deptAuthor DeptAuthor + * @exception Exception + */ + public void deleteDeptAuthor(DeptAuthor deptAuthor) throws Exception; + + /** + * 부서권한 목록조회 카운트를 반환한다 + * @param deptAuthorVO DeptAuthorVO + * @return int + * @exception Exception + */ + public int selectDeptAuthorListTotCnt(DeptAuthorVO deptAuthorVO) throws Exception; + + /** + * 부서목록 조회 + * @param deptAuthorVO DeptAuthorVO + * @return List + * @exception Exception + */ + public List selectDeptList(DeptAuthorVO deptAuthorVO) throws Exception; + + /** + * 부서 목록조회 카운트를 반환한다 + * @param deptAuthorVO DeptAuthorVO + * @return int + * @exception Exception + */ + public int selectDeptListTotCnt(DeptAuthorVO deptAuthorVO) throws Exception; +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sec/drm/service/impl/DeptAuthorDAO.java b/src/main/java/egovframework/com/sec/drm/service/impl/DeptAuthorDAO.java new file mode 100644 index 0000000..a174ea8 --- /dev/null +++ b/src/main/java/egovframework/com/sec/drm/service/impl/DeptAuthorDAO.java @@ -0,0 +1,99 @@ +package egovframework.com.sec.drm.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.sec.drm.service.DeptAuthor; +import egovframework.com.sec.drm.service.DeptAuthorVO; + +import org.springframework.stereotype.Repository; + +/** + * 부서권한에 대한 DAO 클래스를 정의한다. + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.11  이문준          최초 생성
    + *
    + * 
    + */ + +@Repository("deptAuthorDAO") +public class DeptAuthorDAO extends EgovComAbstractDAO { + + /** + * 부서별 할당된 권한목록 조회 + * @param deptAuthorVO DeptAuthorVO + * @return List + * @exception Exception + */ + @SuppressWarnings("unchecked") + public List selectDeptAuthorList(DeptAuthorVO deptAuthorVO) throws Exception { + return (List) list("deptAuthorDAO.selectDeptAuthorList", deptAuthorVO); + } + + /** + * 부서에 해당하는 사용자에게 시스템 메뉴/접근권한을 일괄 할당 + * @param deptAuthor DeptAuthor + * @exception Exception + */ + public void insertDeptAuthor(DeptAuthor deptAuthor) throws Exception { + insert("deptAuthorDAO.insertDeptAuthor", deptAuthor); + } + + /** + * 부서별 시스템 메뉴 접근권한을 수정하여 항목의 정합성을 체크하고 수정된 데이터를 데이터베이스에 반영 + * @param deptAuthor DeptAuthor + * @exception Exception + */ + public void updateDeptAuthor(DeptAuthor deptAuthor) throws Exception { + update("deptAuthorDAO.updateDeptAuthor", deptAuthor); + } + + /** + * 불필요한 부서권한를 조회하여 데이터베이스에서 삭제 + * @param deptAuthor DeptAuthor + * @exception Exception + */ + public void deleteDeptAuthor(DeptAuthor deptAuthor) throws Exception { + delete("deptAuthorDAO.deleteDeptAuthor", deptAuthor); + } + + /** + * 부서권한 목록조회 카운트를 반환한다 + * @param deptAuthorVO DeptAuthorVO + * @return int + * @exception Exception + */ + public int selectDeptAuthorListTotCnt(DeptAuthorVO deptAuthorVO) throws Exception { + return (Integer)selectOne("deptAuthorDAO.selectDeptAuthorListTotCnt", deptAuthorVO); + } + + /** + * 부서목록 조회 + * @param deptAuthorVO DeptAuthorVO + * @return List + * @exception Exception + */ + @SuppressWarnings("unchecked") + public List selectDeptList(DeptAuthorVO deptAuthorVO) throws Exception { + return (List) list("deptAuthorDAO.selectDeptList", deptAuthorVO); + } + + /** + * 부서목록 조회 카운트를 반환한다 + * @param deptAuthorVO DeptAuthorVO + * @return int + * @exception Exception + */ + public int selectDeptListTotCnt(DeptAuthorVO deptAuthorVO) throws Exception { + return (Integer)selectOne("deptAuthorDAO.selectDeptListTotCnt", deptAuthorVO); + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sec/drm/service/impl/EgovDeptAuthorServiceImpl.java b/src/main/java/egovframework/com/sec/drm/service/impl/EgovDeptAuthorServiceImpl.java new file mode 100644 index 0000000..052b579 --- /dev/null +++ b/src/main/java/egovframework/com/sec/drm/service/impl/EgovDeptAuthorServiceImpl.java @@ -0,0 +1,104 @@ +package egovframework.com.sec.drm.service.impl; + +import java.util.List; + +import egovframework.com.sec.drm.service.DeptAuthor; +import egovframework.com.sec.drm.service.DeptAuthorVO; +import egovframework.com.sec.drm.service.EgovDeptAuthorService; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +/** + * 부서권한에 관한 ServiceImpl 클래스를 정의한다. + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.11  이문준          최초 생성
    + *
    + * 
    + */ + +@Service("egovDeptAuthorService") +public class EgovDeptAuthorServiceImpl extends EgovAbstractServiceImpl implements EgovDeptAuthorService { + + @Resource(name="deptAuthorDAO") + private DeptAuthorDAO deptAuthorDAO; + + /** + * 부서별 할당된 권한목록 조회 + * @param deptAuthorVO DeptAuthorVO + * @return List + * @exception Exception + */ + public List selectDeptAuthorList(DeptAuthorVO deptAuthorVO) throws Exception { + return deptAuthorDAO.selectDeptAuthorList(deptAuthorVO); + } + + /** + * 부서에 해당하는 사용자에게 시스템 메뉴/접근권한을 일괄 할당 + * @param deptAuthor DeptAuthor + * @exception Exception + */ + public void insertDeptAuthor(DeptAuthor deptAuthor) throws Exception { + deptAuthorDAO.insertDeptAuthor(deptAuthor); + } + + /** + * 부서별 시스템 메뉴 접근권한을 수정하여 항목의 정합성을 체크하고 수정된 데이터를 데이터베이스에 반영 + * @param deptAuthor DeptAuthor + * @exception Exception + */ + public void updateDeptAuthor(DeptAuthor deptAuthor) throws Exception { + deptAuthorDAO.updateDeptAuthor(deptAuthor); + } + + /** + * 불필요한 부서권한를 조회하여 데이터베이스에서 삭제 + * @param deptAuthor DeptAuthor + * @exception Exception + */ + public void deleteDeptAuthor(DeptAuthor deptAuthor) throws Exception { + deptAuthorDAO.deleteDeptAuthor(deptAuthor); + } + + /** + * 부서권한 목록조회 카운트를 반환한다 + * @param deptAuthorVO DeptAuthorVO + * @return int + * @exception Exception + */ + public int selectDeptAuthorListTotCnt(DeptAuthorVO deptAuthorVO) throws Exception { + return deptAuthorDAO.selectDeptAuthorListTotCnt(deptAuthorVO); + } + + /** + * 부서목록 조회 + * @param deptAuthorVO DeptAuthorVO + * @return List + * @exception Exception + */ + public List selectDeptList(DeptAuthorVO deptAuthorVO) throws Exception { + return deptAuthorDAO.selectDeptList(deptAuthorVO); + } + + /** + * 부서 목록조회 카운트를 반환한다 + * @param deptAuthorVO DeptAuthorVO + * @return int + * @exception Exception + */ + public int selectDeptListTotCnt(DeptAuthorVO deptAuthorVO) throws Exception { + return deptAuthorDAO.selectDeptListTotCnt(deptAuthorVO); + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sec/drm/web/EgovDeptAuthorController.java b/src/main/java/egovframework/com/sec/drm/web/EgovDeptAuthorController.java new file mode 100644 index 0000000..177b345 --- /dev/null +++ b/src/main/java/egovframework/com/sec/drm/web/EgovDeptAuthorController.java @@ -0,0 +1,207 @@ +package egovframework.com.sec.drm.web; + +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.SessionVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.sec.drm.service.DeptAuthor; +import egovframework.com.sec.drm.service.DeptAuthorVO; +import egovframework.com.sec.drm.service.EgovDeptAuthorService; +import egovframework.com.sec.ram.service.AuthorManageVO; +import egovframework.com.sec.ram.service.EgovAuthorManageService; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +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 org.springframework.web.bind.annotation.SessionAttributes; + +/** + * 부서권한에 관한 controller 클래스를 정의한다. + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.11  이문준          최초 생성
    + *   2011.8.26	정진오			IncludedInfo annotation 추가
    + *
    + * 
    + */ + + +@Controller +@SessionAttributes(types=SessionVO.class) +public class EgovDeptAuthorController { + + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name = "egovDeptAuthorService") + private EgovDeptAuthorService egovDeptAuthorService; + + @Resource(name = "egovAuthorManageService") + private EgovAuthorManageService egovAuthorManageService; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** + * 권한 목록화면 이동 + * @return String + * @exception Exception + */ + @RequestMapping("/sec/drm/EgovDeptAuthorListView.do") + public String selectDeptAuthorListView() throws Exception { + return "egovframework/com/sec/drm/EgovDeptAuthorManage"; + } + + /** + * 부서별 할당된 권한목록 조회 + * + * @param deptAuthorVO DeptAuthorVO + * @param authorManageVO AuthorManageVO + * @return String + * @exception Exception + */ + @IncludedInfo(name="부서권한관리", listUrl="/sec/drm/EgovDeptAuthorList.do", order = 100,gid = 20) + @RequestMapping(value="/sec/drm/EgovDeptAuthorList.do") + public String selectDeptAuthorList(@ModelAttribute("deptAuthorVO") DeptAuthorVO deptAuthorVO, + @ModelAttribute("authorManageVO") AuthorManageVO authorManageVO, + ModelMap model) throws Exception { + + /** 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()); + + deptAuthorVO.setDeptAuthorList(egovDeptAuthorService.selectDeptAuthorList(deptAuthorVO)); + model.addAttribute("deptAuthorList", deptAuthorVO.getDeptAuthorList()); + + int totCnt = egovDeptAuthorService.selectDeptAuthorListTotCnt(deptAuthorVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + authorManageVO.setAuthorManageList(egovAuthorManageService.selectAuthorAllList(authorManageVO)); + model.addAttribute("authorManageList", authorManageVO.getAuthorManageList()); + + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/sec/drm/EgovDeptAuthorManage"; + } + + /** + * 부서에 권한정보를 할당하여 데이터베이스에 등록 + * + * @param userIds String + * @param authorCodes String + * @param regYns String + * @param deptAuthor DeptAuthor + * @return String + * @exception Exception + */ + @RequestMapping(value="/sec/drm/EgovDeptAuthorInsert.do") + public String insertDeptAuthor(@RequestParam("userIds") String userIds, + @RequestParam("authorCodes") String authorCodes, + @RequestParam("regYns") String regYns, + @ModelAttribute("deptAuthor") DeptAuthor deptAuthor, + ModelMap model) throws Exception { + + String [] strUserIds = userIds.split(";"); + String [] strAuthorCodes = authorCodes.split(";"); + String [] strRegYns = regYns.split(";"); + + for(int i=0; i + * << 개정이력(Modification Information) >> + * + * 수정일 수정자 수정내용 + * ------- -------- --------------------------- + * 2009.03.20 이문준 최초 생성 + * + * + */ + +public interface EgovGroupManageService { + + /** + * 검색조건에 따른 그룹정보를 조회 + * @param groupManageVO GroupManageVO + * @return GroupManageVO + * @exception Exception + */ + public GroupManageVO selectGroup(GroupManageVO groupManageVO) throws Exception; + + /** + * 시스템사용 목적별 그룹 목록 조회 + * @param groupManageVO GroupManageVO + * @return List + * @exception Exception + */ + public List selectGroupList(GroupManageVO groupManageVO) throws Exception; + + /** + * 그룹 기본정보를 화면에서 입력하여 항목의 정합성을 체크하고 데이터베이스에 저장 + * @param groupManage GroupManage + * @param groupManageVO GroupManageVO + * @return GroupManageVO + * @exception Exception + */ + public GroupManageVO insertGroup(GroupManage groupManage, GroupManageVO groupManageVO) throws Exception; + /** + * 화면에 조회된 그룹의 기본정보를 수정하여 항목의 정합성을 체크하고 수정된 데이터를 데이터베이스에 반영 + * @param groupManage GroupManage + * @exception Exception + */ + public void updateGroup(GroupManage groupManage) throws Exception; + + /** + * 불필요한 그룹정보를 화면에 조회하여 데이터베이스에서 삭제 + * @param groupManage GroupManage + * @exception Exception + */ + public void deleteGroup(GroupManage groupManage) throws Exception; + + /** + * 목록조회 카운트를 반환한다 + * @param groupManageVO GroupManageVO + * @return int + * @exception Exception + */ + public int selectGroupListTotCnt(GroupManageVO groupManageVO) throws Exception; +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sec/gmt/service/GroupManage.java b/src/main/java/egovframework/com/sec/gmt/service/GroupManage.java new file mode 100644 index 0000000..7aa1135 --- /dev/null +++ b/src/main/java/egovframework/com/sec/gmt/service/GroupManage.java @@ -0,0 +1,121 @@ +package egovframework.com.sec.gmt.service; + +import egovframework.com.cmm.ComDefaultVO; + +/** + * 그룹관리에 대한 model 클래스를 정의한다. + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이문준          최초 생성
    + *
    + * 
    + */ + +public class GroupManage extends ComDefaultVO { + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + /** + * 그룹 관리 + */ + private GroupManage groupManage; + /** + * 그룹 ID + */ + private String groupId; + /** + * 그룹명 + */ + private String groupNm; + /** + * 그룹등록일시 + */ + private String groupCreatDe; + /** + * 그룹설명 + */ + private String groupDc; + + /** + * groupManage attribute 를 리턴한다. + * @return GroupManage + */ + public GroupManage getGroupManage() { + return groupManage; + } + /** + * groupManage attribute 값을 설정한다. + * @param groupManage GroupManage + */ + public void setGroupManage(GroupManage groupManage) { + this.groupManage = groupManage; + } + /** + * groupId attribute 를 리턴한다. + * @return String + */ + public String getGroupId() { + return groupId; + } + /** + * groupId attribute 값을 설정한다. + * @param groupId String + */ + public void setGroupId(String groupId) { + this.groupId = groupId; + } + /** + * groupNm attribute 를 리턴한다. + * @return String + */ + public String getGroupNm() { + return groupNm; + } + /** + * groupNm attribute 값을 설정한다. + * @param groupNm String + */ + public void setGroupNm(String groupNm) { + this.groupNm = groupNm; + } + /** + * groupCreatDe attribute 를 리턴한다. + * @return String + */ + public String getGroupCreatDe() { + return groupCreatDe; + } + /** + * groupCreatDe attribute 값을 설정한다. + * @param groupCreatDe String + */ + public void setGroupCreatDe(String groupCreatDe) { + this.groupCreatDe = groupCreatDe; + } + /** + * groupDc attribute 를 리턴한다. + * @return String + */ + public String getGroupDc() { + return groupDc; + } + /** + * groupDc attribute 값을 설정한다. + * @param groupDc String + */ + public void setGroupDc(String groupDc) { + this.groupDc = groupDc; + } + + + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sec/gmt/service/GroupManageVO.java b/src/main/java/egovframework/com/sec/gmt/service/GroupManageVO.java new file mode 100644 index 0000000..66a2632 --- /dev/null +++ b/src/main/java/egovframework/com/sec/gmt/service/GroupManageVO.java @@ -0,0 +1,71 @@ +package egovframework.com.sec.gmt.service; + +import java.util.List; + + + +/** + * 그룹관리에 대한 Vo 클래스를 정의한다. + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이문준          최초 생성
    + *
    + * 
    + */ + +public class GroupManageVO extends GroupManage { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + /** + * 그룹 목록 + */ + List groupManageList; + /** + * 삭제대상 목록 + */ + String[] delYn; + + /** + * groupManageList attribute 를 리턴한다. + * @return List + */ + public List getGroupManageList() { + return groupManageList; + } + + /** + * groupManageList attribute 값을 설정한다. + * @param groupManageList List + */ + public void setGroupManageList(List groupManageList) { + this.groupManageList = groupManageList; + } + + /** + * delYn attribute 를 리턴한다. + * @return String[] + */ + public String[] getDelYn() { + return delYn; + } + + /** + * delYn attribute 값을 설정한다. + * @param delYn String[] + */ + public void setDelYn(String[] delYn) { + this.delYn = delYn; + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sec/gmt/service/impl/EgovGroupManageServiceImpl.java b/src/main/java/egovframework/com/sec/gmt/service/impl/EgovGroupManageServiceImpl.java new file mode 100644 index 0000000..bfa3bb6 --- /dev/null +++ b/src/main/java/egovframework/com/sec/gmt/service/impl/EgovGroupManageServiceImpl.java @@ -0,0 +1,98 @@ +package egovframework.com.sec.gmt.service.impl; + +import java.util.List; + +import egovframework.com.sec.gmt.service.EgovGroupManageService; +import egovframework.com.sec.gmt.service.GroupManage; +import egovframework.com.sec.gmt.service.GroupManageVO; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +/** + * 그룹관리에 관한 ServiceImpl 클래스를 정의한다. + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.11  이문준          최초 생성
    + *
    + * 
    + */ + +@Service("egovGroupManageService") +public class EgovGroupManageServiceImpl extends EgovAbstractServiceImpl implements EgovGroupManageService { + + @Resource(name="groupManageDAO") + private GroupManageDAO groupManageDAO; + + /** + * 시스템사용 목적별 그룹 목록 조회 + * @param groupManageVO GroupManageVO + * @return List + * @exception Exception + */ + public List selectGroupList(GroupManageVO groupManageVO) throws Exception { + return groupManageDAO.selectGroupList(groupManageVO); + } + + /** + * 검색조건에 따른 그룹정보를 조회 + * @param groupManageVO GroupManageVO + * @return GroupManageVO + * @exception Exception + */ + public GroupManageVO selectGroup(GroupManageVO groupManageVO) throws Exception { + return groupManageDAO.selectGroup(groupManageVO); + } + + /** + * 그룹 기본정보를 화면에서 입력하여 항목의 정합성을 체크하고 데이터베이스에 저장 + * @param groupManage GroupManage + * @param groupManageVO GroupManageVO + * @return GroupManageVO + * @exception Exception + */ + public GroupManageVO insertGroup(GroupManage groupManage, GroupManageVO groupManageVO) throws Exception { + groupManageDAO.insertGroup(groupManage); + groupManageVO.setGroupId(groupManage.getGroupId()); + return groupManageDAO.selectGroup(groupManageVO); + } + + /** + * 화면에 조회된 그룹의 기본정보를 수정하여 항목의 정합성을 체크하고 수정된 데이터를 데이터베이스에 반영 + * @param groupManage GroupManage + * @exception Exception + */ + public void updateGroup(GroupManage groupManage) throws Exception { + groupManageDAO.updateGroup(groupManage); + } + + /** + * 불필요한 그룹정보를 화면에 조회하여 데이터베이스에서 삭제 + * @param groupManage GroupManage + * @exception Exception + */ + public void deleteGroup(GroupManage groupManage) throws Exception { + groupManageDAO.deleteGroup(groupManage); + } + + /** + * 목록조회 카운트를 반환한다 + * @param groupManageVO GroupManageVO + * @return int + * @exception Exception + */ + public int selectGroupListTotCnt(GroupManageVO groupManageVO) throws Exception { + return groupManageDAO.selectGroupListTotCnt(groupManageVO); + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sec/gmt/service/impl/GroupManageDAO.java b/src/main/java/egovframework/com/sec/gmt/service/impl/GroupManageDAO.java new file mode 100644 index 0000000..f8eff59 --- /dev/null +++ b/src/main/java/egovframework/com/sec/gmt/service/impl/GroupManageDAO.java @@ -0,0 +1,88 @@ +package egovframework.com.sec.gmt.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.sec.gmt.service.GroupManage; +import egovframework.com.sec.gmt.service.GroupManageVO; + +import org.springframework.stereotype.Repository; + +/** + * 그룹관리에 대한 DAO 클래스를 정의한다. + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.11  이문준          최초 생성
    + *
    + * 
    + */ + +@Repository("groupManageDAO") +public class GroupManageDAO extends EgovComAbstractDAO { + + /** + * 검색조건에 따른 그룹정보를 조회 + * @param groupManageVO GroupManageVO + * @return GroupManageVO + * @exception Exception + */ + public GroupManageVO selectGroup(GroupManageVO groupManageVO) throws Exception { + return (GroupManageVO) selectOne("groupManageDAO.selectGroup", groupManageVO); + } + + /** + * 시스템사용 목적별 그룹 목록 조회 + * @param groupManageVO GroupManageVO + * @return GroupManageVO + * @exception Exception + */ + @SuppressWarnings("unchecked") + public List selectGroupList(GroupManageVO groupManageVO) throws Exception { + return (List) list("groupManageDAO.selectGroupList", groupManageVO); + } + + /** + * 그룹 기본정보를 화면에서 입력하여 항목의 정합성을 체크하고 데이터베이스에 저장 + * @param groupManage GroupManage + * @exception Exception + */ + public void insertGroup(GroupManage groupManage) throws Exception { + insert("groupManageDAO.insertGroup", groupManage); + } + + /** + * 화면에 조회된 그룹의 기본정보를 수정하여 항목의 정합성을 체크하고 수정된 데이터를 데이터베이스에 반영 + * @param groupManage GroupManage + * @exception Exception + */ + public void updateGroup(GroupManage groupManage) throws Exception { + update("groupManageDAO.updateGroup", groupManage); + } + + /** + * 불필요한 그룹정보를 화면에 조회하여 데이터베이스에서 삭제 + * @param groupManage GroupManage + * @exception Exception + */ + public void deleteGroup(GroupManage groupManage) throws Exception { + delete("groupManageDAO.deleteGroup", groupManage); + } + + /** + * 롤목록 총 갯수를 조회한다. + * @param groupManageVO GroupManageVO + * @return int + * @exception Exception + */ + public int selectGroupListTotCnt(GroupManageVO groupManageVO) throws Exception { + return (Integer)selectOne("groupManageDAO.selectGroupListTotCnt", groupManageVO); + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sec/gmt/web/EgovGroupManageController.java b/src/main/java/egovframework/com/sec/gmt/web/EgovGroupManageController.java new file mode 100644 index 0000000..2067e75 --- /dev/null +++ b/src/main/java/egovframework/com/sec/gmt/web/EgovGroupManageController.java @@ -0,0 +1,259 @@ +package egovframework.com.sec.gmt.web; + +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.SessionVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.sec.gmt.service.EgovGroupManageService; +import egovframework.com.sec.gmt.service.GroupManage; +import egovframework.com.sec.gmt.service.GroupManageVO; + +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +import javax.annotation.Resource; + +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.springframework.web.bind.annotation.SessionAttributes; +import org.springmodules.validation.commons.DefaultBeanValidator; + +/** + * 그룹관리에 관한 controller 클래스를 정의한다. + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.11  이문준          최초 생성
    + *   2011.8.26	정진오			IncludedInfo annotation 추가
    + *
    + * 
    + */ + + +@Controller +@SessionAttributes(types=SessionVO.class) +public class EgovGroupManageController { + + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name = "egovGroupManageService") + private EgovGroupManageService egovGroupManageService; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** Message ID Generation */ + @Resource(name="egovGroupIdGnrService") + private EgovIdGnrService egovGroupIdGnrService; + + @Autowired + private DefaultBeanValidator beanValidator; + + /** + * 그룹 목록화면 이동 + * @return String + * @exception Exception + */ + @RequestMapping("/sec/gmt/EgovGroupListView.do") + public String selectGroupListView() + throws Exception { + return "egovframework/com/sec/gmt/EgovGroupManage"; + } + + /** + * 시스템사용 목적별 그룹 목록 조회 + * @param groupManageVO GroupManageVO + * @return String + * @exception Exception + */ + @IncludedInfo(name="그룹관리", listUrl="/sec/gmt/EgovGroupList.do", order = 80,gid = 20) + @RequestMapping(value="/sec/gmt/EgovGroupList.do") + public String selectGroupList(@ModelAttribute("groupManageVO") GroupManageVO groupManageVO, + ModelMap model) throws Exception { + /** 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()); + + groupManageVO.setGroupManageList(egovGroupManageService.selectGroupList(groupManageVO)); + model.addAttribute("groupList", groupManageVO.getGroupManageList()); + + int totCnt = egovGroupManageService.selectGroupListTotCnt(groupManageVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/sec/gmt/EgovGroupManage"; + } + + /** + * 검색조건에 따른 그룹정보를 조회 + * @param groupManageVO GroupManageVO + * @return String + * @exception Exception + */ + @RequestMapping(value="/sec/gmt/EgovGroup.do") + public String selectGroup(@ModelAttribute("groupManageVO") GroupManageVO groupManageVO, + @ModelAttribute("groupManage") GroupManage groupManage, + ModelMap model) throws Exception { + + model.addAttribute("groupManage", egovGroupManageService.selectGroup(groupManageVO)); + return "egovframework/com/sec/gmt/EgovGroupUpdate"; + } + + /** + * 그룹 등록화면 이동 + * @return String + * @exception Exception + */ + @RequestMapping(value="/sec/gmt/EgovGroupInsertView.do") + public String insertGroupView(@ModelAttribute("groupManage") GroupManage groupManage) + throws Exception { + return "egovframework/com/sec/gmt/EgovGroupInsert"; + } + + /** + * 그룹 기본정보를 화면에서 입력하여 항목의 정합성을 체크하고 데이터베이스에 저장 + * @param groupManage GroupManage + * @param groupManageVO GroupManageVO + * @return String + * @exception Exception + */ + @RequestMapping(value="/sec/gmt/EgovGroupInsert.do") + public String insertGroup(@ModelAttribute("groupManage") GroupManage groupManage, + @ModelAttribute("groupManageVO") GroupManageVO groupManageVO, + BindingResult bindingResult, + ModelMap model) throws Exception { + + beanValidator.validate(groupManage, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + return "egovframework/com/sec/gmt/EgovGroupInsert"; + } else { + groupManage.setGroupId(egovGroupIdGnrService.getNextStringId()); + groupManageVO.setGroupId(groupManage.getGroupId()); + + model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); + model.addAttribute("groupManage", egovGroupManageService.insertGroup(groupManage, groupManageVO)); + return "forward:/sec/gmt/EgovGroupList.do"; + } + } + + /** + * 화면에 조회된 그룹의 기본정보를 수정하여 항목의 정합성을 체크하고 수정된 데이터를 데이터베이스에 반영 + * @param groupManage GroupManage + * @return String + * @exception Exception + */ + @RequestMapping(value="/sec/gmt/EgovGroupUpdate.do") + public String updateGroup(@ModelAttribute("groupManage") GroupManage groupManage, + BindingResult bindingResult, + Model model) throws Exception { + + beanValidator.validate(groupManage, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + return "egovframework/com/sec/gmt/EgovGroupUpdate"; + } else { + egovGroupManageService.updateGroup(groupManage); + model.addAttribute("message", egovMessageSource.getMessage("success.common.update")); + return "forward:/sec/gmt/EgovGroupList.do"; + } + } + + /** + * 불필요한 그룹정보를 화면에 조회하여 데이터베이스에서 삭제 + * @param groupManage GroupManage + * @return String + * @exception Exception + */ + @RequestMapping(value="/sec/gmt/EgovGroupDelete.do") + public String deleteGroup(@ModelAttribute("groupManage") GroupManage groupManage, + Model model) throws Exception { + egovGroupManageService.deleteGroup(groupManage); + model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); + return "forward:/sec/gmt/EgovGroupList.do"; + } + + /** + * 불필요한 그룹정보 목록을 화면에 조회하여 데이터베이스에서 삭제 + * @param groupIds String + * @param groupManage GroupManage + * @return String + * @exception Exception + */ + @RequestMapping(value="/sec/gmt/EgovGroupListDelete.do") + public String deleteGroupList(@RequestParam("groupIds") String groupIds, + @ModelAttribute("groupManage") GroupManage groupManage, + Model model) throws Exception { + String [] strGroupIds = groupIds.split(";"); + for(int i=0; i + * << 개정이력(Modification Information) >> + * + * 수정일 수정자 수정내용 + * ---------- -------- --------------------------- + * 2018.12.03 신용호 최초 생성 + * + */ + +@Controller +public class EgovCryptoController { + + /** 로그설정 */ + private static final Logger LOGGER = LoggerFactory.getLogger(EgovCryptoController.class); + + /** 암호화서비스 */ + @Resource(name = "egovEnvCryptoService") + EgovEnvCryptoService cryptoService; + + @Resource(name = "egovEnvPasswordEncoderService") + EgovPasswordEncoder egovPasswordEncoder; + + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + /** + * 암호화/복호화 입력 및 요청 페이지를 호출한다. + * + * @return + */ + @IncludedInfo(name="암호화/복호화", listUrl="/sec/pki/EgovCryptoInfo.do", order = 2200 ,gid = 90) + @RequestMapping(value="/sec/pki/EgovCryptoInfo.do") + public String displayCryptoInfo( @RequestParam Map commandMap, + ModelMap model) throws Exception { + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if(!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + String plainText = (String)commandMap.get("plainText"); + + if ( plainText != null ) { + + int plainTextLen = plainText.length(); + String cryptText = encrypt(plainText); + String decryptText = decrypt(cryptText); + int decryptTextLen = decryptText.length(); + + model.addAttribute("plainText", plainText); + model.addAttribute("plainTextLen", plainTextLen); + model.addAttribute("cryptText", cryptText); + model.addAttribute("decryptText", decryptText); + model.addAttribute("decryptTextLen", decryptTextLen); + } + + return "egovframework/com/sec/pki/EgovCryptoInfo"; + } + + /** + * 암호화 + * + * @param encrypt + */ + private String encrypt(String encrypt) { + + try { + //return cryptoService.encrypt(encrypt); // Handles URLEncoding. + return cryptoService.encryptNone(encrypt); // Does not handle URLEncoding. + } catch(IllegalArgumentException e) { + LOGGER.error("[IllegalArgumentException] Try/Catch...usingParameters Runing : "+ e.getMessage()); + } catch (Exception e) { + LOGGER.error("[" + e.getClass() +"] :" + e.getMessage()); + } + return encrypt; + } + + /** + * 복호화 + * + * @param decrypt + */ + private String decrypt(String decrypt){ + + try { + //return cryptoService.decrypt(decrypt); // Handles URLDecoding. + return cryptoService.decryptNone(decrypt); // Does not handle URLDecoding. + } catch(IllegalArgumentException e) { + LOGGER.error("[IllegalArgumentException] Try/Catch...usingParameters Runing : "+ e.getMessage()); + } catch (Exception e) { + LOGGER.error("[" + e.getClass() +"] :" + e.getMessage()); + } + return decrypt; + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sec/ram/service/AuthorManage.java b/src/main/java/egovframework/com/sec/ram/service/AuthorManage.java new file mode 100644 index 0000000..d5c6c43 --- /dev/null +++ b/src/main/java/egovframework/com/sec/ram/service/AuthorManage.java @@ -0,0 +1,124 @@ +package egovframework.com.sec.ram.service; + +import egovframework.com.cmm.ComDefaultVO; + +/** + * 권한관리에 대한 model 클래스를 정의한다. + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이문준          최초 생성
    + *
    + * 
    + */ + +public class AuthorManage extends ComDefaultVO { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + /** + * 권한관리 + */ + private AuthorManage authorManage; + /** + * 권한코드 + */ + private String authorCode; + /** + * 권한등록일자 + */ + private String authorCreatDe; + /** + * 권한코드설명 + */ + private String authorDc; + /** + * 권한 명 + */ + private String authorNm; + + /** + * authorManage attribute 를 리턴한다. + * @return AuthorManage + */ + public AuthorManage getAuthorManage() { + return authorManage; + } + /** + * authorManage attribute 값을 설정한다. + * @param authorManage AuthorManage + */ + public void setAuthorManage(AuthorManage authorManage) { + this.authorManage = authorManage; + } + /** + * authorCode attribute 를 리턴한다. + * @return String + */ + public String getAuthorCode() { + return authorCode; + } + /** + * authorCode attribute 값을 설정한다. + * @param authorCode String + */ + public void setAuthorCode(String authorCode) { + this.authorCode = authorCode; + } + /** + * authorCreatDe attribute 를 리턴한다. + * @return String + */ + public String getAuthorCreatDe() { + return authorCreatDe; + } + /** + * authorCreatDe attribute 값을 설정한다. + * @param authorCreatDe String + */ + public void setAuthorCreatDe(String authorCreatDe) { + this.authorCreatDe = authorCreatDe; + } + /** + * authorDc attribute 를 리턴한다. + * @return String + */ + public String getAuthorDc() { + return authorDc; + } + /** + * authorDc attribute 값을 설정한다. + * @param authorDc String + */ + public void setAuthorDc(String authorDc) { + this.authorDc = authorDc; + } + /** + * authorNm attribute 를 리턴한다. + * @return String + */ + public String getAuthorNm() { + return authorNm; + } + /** + * authorNm attribute 값을 설정한다. + * @param authorNm String + */ + public void setAuthorNm(String authorNm) { + this.authorNm = authorNm; + } + + + + + +} diff --git a/src/main/java/egovframework/com/sec/ram/service/AuthorManageVO.java b/src/main/java/egovframework/com/sec/ram/service/AuthorManageVO.java new file mode 100644 index 0000000..241281d --- /dev/null +++ b/src/main/java/egovframework/com/sec/ram/service/AuthorManageVO.java @@ -0,0 +1,47 @@ +package egovframework.com.sec.ram.service; + +import java.util.List; + +/** + * 권한관리에 대한 Vo 클래스를 정의한다. + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이문준          최초 생성
    + *
    + * 
    + */ + +public class AuthorManageVO extends AuthorManage { + + private static final long serialVersionUID = 1L; + + List authorManageList; + + + /** + * authorManageList attribute 를 리턴한다. + * @return List + */ + public List getAuthorManageList() { + return authorManageList; + } + + /** + * authorManageList attribute 값을 설정한다. + * @param authorManageList List + */ + public void setAuthorManageList(List authorManageList) { + this.authorManageList = authorManageList; + } + + + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sec/ram/service/AuthorRoleManage.java b/src/main/java/egovframework/com/sec/ram/service/AuthorRoleManage.java new file mode 100644 index 0000000..be70966 --- /dev/null +++ b/src/main/java/egovframework/com/sec/ram/service/AuthorRoleManage.java @@ -0,0 +1,210 @@ +package egovframework.com.sec.ram.service; + +import egovframework.com.cmm.ComDefaultVO; + +/** + * 권한별 롤 관리에 대한 model 클래스를 정의한다. + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이문준          최초 생성
    + *
    + * 
    + */ + +public class AuthorRoleManage extends ComDefaultVO { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + /** + * 권한 롤 관리 + */ + private AuthorRoleManage authorRole; + /** + * 권한코드 + */ + private String authorCode; + /** + * 롤코드 + */ + private String roleCode; + /** + * 롤명 + */ + private String roleNm; + /** + * 롤 패턴 + */ + private String rolePtn; + /** + * 롤 설명 + */ + private String roleDc; + /** + * 롤 타입 + */ + private String roleTyp; + /** + * 롤 순서정렬 + */ + private String roleSort; + /** + * 롤 등록여부 + */ + private String regYn; + /** + * 등록일자 + */ + private String creatDt; + /** + * authorRole attribute 를 리턴한다. + * @return AuthorRoleManage + */ + public AuthorRoleManage getAuthorRole() { + return authorRole; + } + /** + * authorRole attribute 값을 설정한다. + * @param authorRole AuthorRoleManage + */ + public void setAuthorRole(AuthorRoleManage authorRole) { + this.authorRole = authorRole; + } + /** + * authorCode attribute 를 리턴한다. + * @return String + */ + public String getAuthorCode() { + return authorCode; + } + /** + * authorCode attribute 값을 설정한다. + * @param authorCode String + */ + public void setAuthorCode(String authorCode) { + this.authorCode = authorCode; + } + /** + * roleCode attribute 를 리턴한다. + * @return String + */ + public String getRoleCode() { + return roleCode; + } + /** + * roleCode attribute 값을 설정한다. + * @param roleCode String + */ + public void setRoleCode(String roleCode) { + this.roleCode = roleCode; + } + /** + * roleNm attribute 를 리턴한다. + * @return String + */ + public String getRoleNm() { + return roleNm; + } + /** + * roleNm attribute 값을 설정한다. + * @param roleNm String + */ + public void setRoleNm(String roleNm) { + this.roleNm = roleNm; + } + /** + * rolePtn attribute 를 리턴한다. + * @return String + */ + public String getRolePtn() { + return rolePtn; + } + /** + * rolePtn attribute 값을 설정한다. + * @param rolePtn String + */ + public void setRolePtn(String rolePtn) { + this.rolePtn = rolePtn; + } + /** + * roleDc attribute 를 리턴한다. + * @return String + */ + public String getRoleDc() { + return roleDc; + } + /** + * roleDc attribute 값을 설정한다. + * @param roleDc String + */ + public void setRoleDc(String roleDc) { + this.roleDc = roleDc; + } + /** + * roleTyp attribute 를 리턴한다. + * @return String + */ + public String getRoleTyp() { + return roleTyp; + } + /** + * roleTyp attribute 값을 설정한다. + * @param roleTyp String + */ + public void setRoleTyp(String roleTyp) { + this.roleTyp = roleTyp; + } + /** + * roleSort attribute 를 리턴한다. + * @return String + */ + public String getRoleSort() { + return roleSort; + } + /** + * roleSort attribute 값을 설정한다. + * @param roleSort String + */ + public void setRoleSort(String roleSort) { + this.roleSort = roleSort; + } + /** + * regYn attribute 를 리턴한다. + * @return String + */ + public String getRegYn() { + return regYn; + } + /** + * regYn attribute 값을 설정한다. + * @param regYn String + */ + public void setRegYn(String regYn) { + this.regYn = regYn; + } + /** + * creatDt attribute 를 리턴한다. + * @return String + */ + public String getCreatDt() { + return creatDt; + } + /** + * creatDt attribute 값을 설정한다. + * @param creatDt String + */ + public void setCreatDt(String creatDt) { + this.creatDt = creatDt; + } + + +} diff --git a/src/main/java/egovframework/com/sec/ram/service/AuthorRoleManageVO.java b/src/main/java/egovframework/com/sec/ram/service/AuthorRoleManageVO.java new file mode 100644 index 0000000..de8da9e --- /dev/null +++ b/src/main/java/egovframework/com/sec/ram/service/AuthorRoleManageVO.java @@ -0,0 +1,46 @@ +package egovframework.com.sec.ram.service; + +import java.util.List; + +/** + * 권한별 롤 관리에 대한 Vo 클래스를 정의한다. + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이문준          최초 생성
    + *
    + * 
    + */ + +public class AuthorRoleManageVO extends AuthorRoleManage { + + private static final long serialVersionUID = 1L; + + List authorRoleList; + + /** + * authorRoleList attribute 를 리턴한다. + * @return List + */ + public List getAuthorRoleList() { + return authorRoleList; + } + + /** + * authorRoleList attribute 값을 설정한다. + * @param authorRoleList List + */ + public void setAuthorRoleList(List authorRoleList) { + this.authorRoleList = authorRoleList; + } + + + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sec/ram/service/EgovAuthorManageService.java b/src/main/java/egovframework/com/sec/ram/service/EgovAuthorManageService.java new file mode 100644 index 0000000..4388119 --- /dev/null +++ b/src/main/java/egovframework/com/sec/ram/service/EgovAuthorManageService.java @@ -0,0 +1,75 @@ +package egovframework.com.sec.ram.service; + +import java.util.List; + +/** + * 권한관리에 관한 서비스 인터페이스 클래스를 정의한다. + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이문준          최초 생성
    + *
    + * 
    + */ + +public interface EgovAuthorManageService { + /** + * 모든 권한목록을 조회한다. + * @param authorManageVO AuthorManageVO + * @return List + * @exception Exception + */ + public List selectAuthorAllList(AuthorManageVO authorManageVO) throws Exception; + + /** + * 시스템 사용자중 불필요한 시스템권한정보를 화면에 조회하여 데이터베이스에서 삭제 + * @param authorManage AuthorManage + * @exception Exception + */ + public void deleteAuthor(AuthorManage authorManage) throws Exception; + + /** + * 사용자의 시스테접근권한를 화면에서 입력하여 입력항목의 정합성을 체크하고 데이터베이스에 저장 + * @param authorManage AuthorManage + * @exception Exception + */ + public void insertAuthor(AuthorManage authorManage) throws Exception; + + /** + * 개별사용자에게 할당된 권한 조회 + * @param authorManageVO AuthorManageVO + * @exception Exception + */ + public AuthorManageVO selectAuthor(AuthorManageVO authorManageVO) throws Exception; + + /** + * 개별사용자에게 할당된 권한리스트 조회 + * @param authorManageVO AuthorManageVO + * @return List + * @exception Exception + */ + public List selectAuthorList(AuthorManageVO authorManageVO) throws Exception; + + /** + * 화면에 조회된 사용자권한정보를 수정하여 항목의 정합성을 체크하고 수정된 데이터를 데이터베이스에 반영 + * @param authorManage AuthorManage + * @exception Exception + */ + public void updateAuthor(AuthorManage authorManage) throws Exception; + + /** + * 목록조회 카운트를 반환한다 + * @param authorManageVO AuthorManageVO + * @return int + * @exception Exception + */ + public int selectAuthorListTotCnt(AuthorManageVO authorManageVO) throws Exception; + +} diff --git a/src/main/java/egovframework/com/sec/ram/service/EgovAuthorRoleManageService.java b/src/main/java/egovframework/com/sec/ram/service/EgovAuthorRoleManageService.java new file mode 100644 index 0000000..b287419 --- /dev/null +++ b/src/main/java/egovframework/com/sec/ram/service/EgovAuthorRoleManageService.java @@ -0,0 +1,55 @@ +package egovframework.com.sec.ram.service; + +import java.util.List; + +/** + * 권한별 롤 관리에 관한 서비스 인터페이스 클래스를 정의한다. + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *  수정일                수정자             수정내용
    + *  ----------   ---------   ---------------------------
    + *  2009.03.20   이문준              최초 생성
    + *  2021.02-09   신용호              updateAuthorRole 삭제
    + *
    + * 
    + */ + +public interface EgovAuthorRoleManageService { + + /** + * 권한 롤 관계정보 목록 조회 + * @param authorRoleManageVO AuthorRoleManageVO + * @return List + * @exception Exception + */ + public List selectAuthorRoleList(AuthorRoleManageVO authorRoleManageVO) throws Exception; + + /** + * 권한 롤 관계정보를 화면에서 입력하여 입력항목의 정합성을 체크하고 데이터베이스에 저장 + * @param authorRoleManage AuthorRoleManage + * @exception Exception + */ + public void insertAuthorRole(AuthorRoleManage authorRoleManage) throws Exception; + + /** + * 권한 롤 관계정보를 화면에 조회하여 데이터베이스에서 삭제 + * @param authorRoleManage AuthorRoleManage + * @exception Exception + */ + public void deleteAuthorRole(AuthorRoleManage authorRoleManage) throws Exception; + + /** + * 목록조회 카운트를 반환한다 + * @param authorRoleManageVO AuthorRoleManageVO + * @return int + * @exception Exception + */ + public int selectAuthorRoleListTotCnt(AuthorRoleManageVO authorRoleManageVO) throws Exception; + +} diff --git a/src/main/java/egovframework/com/sec/ram/service/impl/AuthorManageDAO.java b/src/main/java/egovframework/com/sec/ram/service/impl/AuthorManageDAO.java new file mode 100644 index 0000000..708b8d1 --- /dev/null +++ b/src/main/java/egovframework/com/sec/ram/service/impl/AuthorManageDAO.java @@ -0,0 +1,99 @@ +package egovframework.com.sec.ram.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.sec.ram.service.AuthorManage; +import egovframework.com.sec.ram.service.AuthorManageVO; + +import org.springframework.stereotype.Repository; + +/** + * 권한관리에 대한 DAO 클래스를 정의한다. + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.11  이문준          최초 생성
    + *
    + * 
    + */ + +@Repository("authorManageDAO") +public class AuthorManageDAO extends EgovComAbstractDAO { + + /** + * 권한목록을 조회한다. + * @param authorManageVO AuthorManageVO + * @return List + * @exception Exception + */ + @SuppressWarnings("unchecked") + public List selectAuthorList(AuthorManageVO authorManageVO) throws Exception { + return (List) list("authorManageDAO.selectAuthorList", authorManageVO); + } + + /** + * 권한을 등록한다. + * @param authorManage AuthorManage + * @exception Exception + */ + public void insertAuthor(AuthorManage authorManage) throws Exception { + insert("authorManageDAO.insertAuthor", authorManage); + } + + /** + * 권한을 수정한다. + * @param authorManage AuthorManage + * @exception Exception + */ + public void updateAuthor(AuthorManage authorManage) throws Exception { + update("authorManageDAO.updateAuthor", authorManage); + } + + /** + * 권한을 삭제한다. + * @param authorManage AuthorManage + * @exception Exception + */ + public void deleteAuthor(AuthorManage authorManage) throws Exception { + delete("authorManageDAO.deleteAuthor", authorManage); + } + + /** + * 권한을 조회한다. + * @param authorManageVO AuthorManageVO + * @return AuthorManageVO + * @exception Exception + */ + public AuthorManageVO selectAuthor(AuthorManageVO authorManageVO) throws Exception { + return (AuthorManageVO) selectOne("authorManageDAO.selectAuthor", authorManageVO); + } + + /** + * 권한목록 총 갯수를 조회한다. + * @param authorManageVO AuthorManageVO + * @return int + * @exception Exception + */ + public int selectAuthorListTotCnt(AuthorManageVO authorManageVO) throws Exception { + return (Integer)selectOne("authorManageDAO.selectAuthorListTotCnt", authorManageVO); + } + + /** + * 모든 권한목록을 조회한다. + * @param authorManageVO AuthorManageVO + * @return List + * @exception Exception + */ + @SuppressWarnings("unchecked") + public List selectAuthorAllList(AuthorManageVO authorManageVO) throws Exception { + return (List) list("authorManageDAO.selectAuthorAllList", authorManageVO); + } +} diff --git a/src/main/java/egovframework/com/sec/ram/service/impl/AuthorRoleManageDAO.java b/src/main/java/egovframework/com/sec/ram/service/impl/AuthorRoleManageDAO.java new file mode 100644 index 0000000..197d902 --- /dev/null +++ b/src/main/java/egovframework/com/sec/ram/service/impl/AuthorRoleManageDAO.java @@ -0,0 +1,71 @@ +package egovframework.com.sec.ram.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.sec.ram.service.AuthorRoleManage; +import egovframework.com.sec.ram.service.AuthorRoleManageVO; + +import org.springframework.stereotype.Repository; + +/** + * 권한별 롤관리에 대한 DAO 클래스를 정의한다. + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *  수정일               수정자               수정내용
    + *  ----------   ---------   ---------------------------
    + *  2009.03.11   이문준              최초 생성
    + *  2021.02-09   신용호              updateAuthorRole 삭제
    + *
    + * 
    + */ + +@Repository("authorRoleManageDAO") +public class AuthorRoleManageDAO extends EgovComAbstractDAO { + + /** + * 권한 롤 관계정보 목록 조회 + * @param authorRoleManageVO AuthorRoleManageVO + * @return List + * @exception Exception + */ + @SuppressWarnings("unchecked") + public List selectAuthorRoleList(AuthorRoleManageVO authorRoleManageVO) throws Exception { + return (List) list("authorRoleManageDAO.selectAuthorRoleList", authorRoleManageVO); + } + + /** + * 권한 롤 관계정보를 화면에서 입력하여 입력항목의 정합성을 체크하고 데이터베이스에 저장 + * @param authorRoleManage AuthorRoleManage + * @exception Exception + */ + public void insertAuthorRole(AuthorRoleManage authorRoleManage) throws Exception { + insert("authorRoleManageDAO.insertAuthorRole", authorRoleManage); + } + + /** + * 권한 롤 관계정보를 화면에 조회하여 데이터베이스에서 삭제 + * @param authorRoleManage AuthorRoleManage + * @exception Exception + */ + public void deleteAuthorRole(AuthorRoleManage authorRoleManage) throws Exception { + delete("authorRoleManageDAO.deleteAuthorRole", authorRoleManage); + } + + /** + * 목록조회 카운트를 반환한다 + * @param authorRoleManageVO AuthorRoleManageVO + * @return int + * @exception Exception + */ + public int selectAuthorRoleListTotCnt(AuthorRoleManageVO authorRoleManageVO) throws Exception { + return (Integer)selectOne("authorRoleManageDAO.selectAuthorRoleListTotCnt", authorRoleManageVO); + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sec/ram/service/impl/EgovAuthorManageServiceImpl.java b/src/main/java/egovframework/com/sec/ram/service/impl/EgovAuthorManageServiceImpl.java new file mode 100644 index 0000000..3ad1bb1 --- /dev/null +++ b/src/main/java/egovframework/com/sec/ram/service/impl/EgovAuthorManageServiceImpl.java @@ -0,0 +1,107 @@ +package egovframework.com.sec.ram.service.impl; + +import java.util.List; + +import egovframework.com.sec.ram.service.AuthorManage; +import egovframework.com.sec.ram.service.AuthorManageVO; +import egovframework.com.sec.ram.service.EgovAuthorManageService; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +/** + * 권한관리에 관한 ServiceImpl 클래스를 정의한다. + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.11  이문준          최초 생성
    + *
    + * 
    + */ + +@Service("egovAuthorManageService") +public class EgovAuthorManageServiceImpl extends EgovAbstractServiceImpl implements EgovAuthorManageService { + + @Resource(name="authorManageDAO") + private AuthorManageDAO authorManageDAO; + + /** + * 권한 목록을 조회한다. + * @param authorManageVO AuthorManageVO + * @return List + * @exception Exception + */ + public List selectAuthorList(AuthorManageVO authorManageVO) throws Exception { + return authorManageDAO.selectAuthorList(authorManageVO); + } + + /** + * 권한을 등록한다. + * @param authorManage AuthorManage + * @exception Exception + */ + public void insertAuthor(AuthorManage authorManage) throws Exception { + authorManageDAO.insertAuthor(authorManage); + } + + /** + * 권한을 수정한다. + * @param authorManage AuthorManage + * @exception Exception + */ + public void updateAuthor(AuthorManage authorManage) throws Exception { + authorManageDAO.updateAuthor(authorManage); + } + + /** + * 권한을 삭제한다. + * @param authorManage AuthorManage + * @exception Exception + */ + public void deleteAuthor(AuthorManage authorManage) throws Exception { + authorManageDAO.deleteAuthor(authorManage); + } + + /** + * 권한을 조회한다. + * @param authorManageVO AuthorManageVO + * @return AuthorManageVO + * @exception Exception + */ + public AuthorManageVO selectAuthor(AuthorManageVO authorManageVO) throws Exception { + AuthorManageVO resultVO = authorManageDAO.selectAuthor(authorManageVO); + if (resultVO == null) + throw processException("info.nodata.msg"); + return resultVO; + } + + /** + * 권한 목록 카운트를 조회한다. + * @param authorManageVO AuthorManageVO + * @return int + * @exception Exception + */ + public int selectAuthorListTotCnt(AuthorManageVO authorManageVO) throws Exception { + return authorManageDAO.selectAuthorListTotCnt(authorManageVO); + } + + /** + * 모든 권한목록을 조회한다. + * @param authorManageVO AuthorManageVO + * @return List + * @exception Exception + */ + public List selectAuthorAllList(AuthorManageVO authorManageVO) throws Exception { + return authorManageDAO.selectAuthorAllList(authorManageVO); + } +} diff --git a/src/main/java/egovframework/com/sec/ram/service/impl/EgovAuthorRoleManageServiceImpl.java b/src/main/java/egovframework/com/sec/ram/service/impl/EgovAuthorRoleManageServiceImpl.java new file mode 100644 index 0000000..9e60273 --- /dev/null +++ b/src/main/java/egovframework/com/sec/ram/service/impl/EgovAuthorRoleManageServiceImpl.java @@ -0,0 +1,76 @@ +package egovframework.com.sec.ram.service.impl; + +import java.util.List; + +import egovframework.com.sec.ram.service.AuthorRoleManage; +import egovframework.com.sec.ram.service.AuthorRoleManageVO; +import egovframework.com.sec.ram.service.EgovAuthorRoleManageService; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +/** + * 권한별 롤관리에 대한 DAO 클래스를 정의한다. + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *  수정일               수정자              수정내용
    + *  ----------   ---------   ---------------------------
    + *  2009.03.11   이문준              최초 생성
    + *  2021.02-09   신용호              updateAuthorRole 삭제
    + *
    + * 
    + */ + +@Service("egovAuthorRoleManageService") +public class EgovAuthorRoleManageServiceImpl extends EgovAbstractServiceImpl implements EgovAuthorRoleManageService { + + @Resource(name="authorRoleManageDAO") + private AuthorRoleManageDAO authorRoleManageDAO; + + /** + * 권한 롤 관계정보 목록 조회 + * @param authorRoleManageVO AuthorRoleManageVO + * @return List + * @exception Exception + */ + public List selectAuthorRoleList(AuthorRoleManageVO authorRoleManageVO) throws Exception { + return authorRoleManageDAO.selectAuthorRoleList(authorRoleManageVO); + } + + /** + * 권한 롤 관계정보를 화면에서 입력하여 입력항목의 정합성을 체크하고 데이터베이스에 저장 + * @param authorRoleManage AuthorRoleManage + * @exception Exception + */ + public void insertAuthorRole(AuthorRoleManage authorRoleManage) throws Exception { + authorRoleManageDAO.insertAuthorRole(authorRoleManage); + } + + /** + * 권한 롤 관계정보를 화면에 조회하여 데이터베이스에서 삭제 + * @param authorRoleManage AuthorRoleManage + * @exception Exception + */ + public void deleteAuthorRole(AuthorRoleManage authorRoleManage) throws Exception { + authorRoleManageDAO.deleteAuthorRole(authorRoleManage); + } + + /** + * 목록조회 카운트를 반환한다 + * @param authorRoleManageVO AuthorRoleManageVO + * @return int + * @exception Exception + */ + public int selectAuthorRoleListTotCnt(AuthorRoleManageVO authorRoleManageVO) throws Exception { + return authorRoleManageDAO.selectAuthorRoleListTotCnt(authorRoleManageVO); + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sec/ram/service/impl/EgovUserDetailsSecurityServiceImpl.java b/src/main/java/egovframework/com/sec/ram/service/impl/EgovUserDetailsSecurityServiceImpl.java new file mode 100644 index 0000000..26fd0c3 --- /dev/null +++ b/src/main/java/egovframework/com/sec/ram/service/impl/EgovUserDetailsSecurityServiceImpl.java @@ -0,0 +1,65 @@ +package egovframework.com.sec.ram.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.EgovUserDetailsService; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.security.userdetails.util.EgovUserDetailsHelper; + +/** + *권한관리 인증에 대한 ServiceImpl 클래스를 정의한다. + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.11  이문준          최초 생성
    + *
    + * 
    + */ + +public class EgovUserDetailsSecurityServiceImpl extends EgovAbstractServiceImpl implements EgovUserDetailsService { + + + /** + * 인증된 사용자객체를 VO형식으로 가져온다. + * @return Object - 사용자 ValueObject + */ + public Object getAuthenticatedUser() { + + // 이 메소드의 경우 인증이 되지 않더라고 null을 리턴하지 않기 때문에 + // 명시적으로 인증되지 않은 경우 null을 리턴하도록 수정함 + + if (EgovUserDetailsHelper.isAuthenticated()) { + return EgovUserDetailsHelper.getAuthenticatedUser(); + } + + return null; + } + + + /** + * 인증된 사용자의 권한 정보를 가져온다. + * 예) [ROLE_ADMIN, ROLE_USER, ROLE_A, ROLE_B, ROLE_RESTRICTED, IS_AUTHENTICATED_FULLY, IS_AUTHENTICATED_REMEMBERED, IS_AUTHENTICATED_ANONYMOUSLY] + * @return List - 사용자 권한정보 목록 + */ + public List getAuthorities() { + return EgovUserDetailsHelper.getAuthorities(); + } + + /** + * 인증된 사용자 여부를 체크한다. + * @return Boolean - 인증된 사용자 여부(TRUE / FALSE) + */ + + public Boolean isAuthenticated() { + return EgovUserDetailsHelper.isAuthenticated(); + } + +} diff --git a/src/main/java/egovframework/com/sec/ram/web/EgovAuthorManageController.java b/src/main/java/egovframework/com/sec/ram/web/EgovAuthorManageController.java new file mode 100644 index 0000000..e0b8340 --- /dev/null +++ b/src/main/java/egovframework/com/sec/ram/web/EgovAuthorManageController.java @@ -0,0 +1,232 @@ +package egovframework.com.sec.ram.web; + +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.SessionVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.sec.ram.service.AuthorManage; +import egovframework.com.sec.ram.service.AuthorManageVO; +import egovframework.com.sec.ram.service.EgovAuthorManageService; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +import javax.annotation.Resource; + +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.springframework.web.bind.annotation.SessionAttributes; +import org.springmodules.validation.commons.DefaultBeanValidator; + +/** + * 권한관리에 관한 controller 클래스를 정의한다. + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.11  이문준          최초 생성
    + *   2011.8.26	정진오			IncludedInfo annotation 추가s
    + *
    + * 
    + */ + + +@Controller +@SessionAttributes(types=SessionVO.class) +public class EgovAuthorManageController { + + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name = "egovAuthorManageService") + private EgovAuthorManageService egovAuthorManageService; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + @Autowired + private DefaultBeanValidator beanValidator; + + /** + * 권한 목록화면 이동 + * @return String + * @exception Exception + */ + @RequestMapping("/sec/ram/EgovAuthorListView.do") + public String selectAuthorListView() + throws Exception { + return "egovframework/com/sec/ram/EgovAuthorManage"; + } + + /** + * 권한 목록을 조회한다 + * @param authorManageVO AuthorManageVO + * @return String + * @exception Exception + */ + @IncludedInfo(name="권한관리", listUrl="/sec/ram/EgovAuthorList.do", order = 60,gid = 20) + @RequestMapping(value="/sec/ram/EgovAuthorList.do") + public String selectAuthorList(@ModelAttribute("authorManageVO") AuthorManageVO authorManageVO, + ModelMap model) + throws Exception { + + /** EgovPropertyService.sample */ + //authorManageVO.setPageUnit(propertiesService.getInt("pageUnit")); + //authorManageVO.setPageSize(propertiesService.getInt("pageSize")); + + /** 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()); + + authorManageVO.setAuthorManageList(egovAuthorManageService.selectAuthorList(authorManageVO)); + model.addAttribute("authorList", authorManageVO.getAuthorManageList()); + + int totCnt = egovAuthorManageService.selectAuthorListTotCnt(authorManageVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/sec/ram/EgovAuthorManage"; + } + + /** + * 권한 세부정보를 조회한다. + * @param authorCode String + * @param authorManageVO AuthorManageVO + * @return String + * @exception Exception + */ + @RequestMapping(value="/sec/ram/EgovAuthor.do") + public String selectAuthor(@RequestParam("authorCode") String authorCode, + @ModelAttribute("authorManageVO") AuthorManageVO authorManageVO, + ModelMap model) throws Exception { + + authorManageVO.setAuthorCode(authorCode); + + model.addAttribute("authorManage", egovAuthorManageService.selectAuthor(authorManageVO)); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + return "egovframework/com/sec/ram/EgovAuthorUpdate"; + } + + /** + * 권한 등록화면 이동 + * @return String + * @exception Exception + */ + @RequestMapping("/sec/ram/EgovAuthorInsertView.do") + public String insertAuthorView(@ModelAttribute("authorManage") AuthorManage authorManage) + throws Exception { + return "egovframework/com/sec/ram/EgovAuthorInsert"; + } + + /** + * 권한 세부정보를 등록한다. + * @param authorManage AuthorManage + * @param bindingResult BindingResult + * @return String + * @exception Exception + */ + @RequestMapping(value="/sec/ram/EgovAuthorInsert.do") + public String insertAuthor(@ModelAttribute("authorManage") AuthorManage authorManage, + BindingResult bindingResult, + ModelMap model) throws Exception { + + beanValidator.validate(authorManage, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + return "egovframework/com/sec/ram/EgovAuthorInsert"; + } else { + egovAuthorManageService.insertAuthor(authorManage); + model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); + return "forward:/sec/ram/EgovAuthorList.do"; + } + } + + /** + * 권한 세부정보를 수정한다. + * @param authorManage AuthorManage + * @param bindingResult BindingResult + * @return String + * @exception Exception + */ + @RequestMapping(value="/sec/ram/EgovAuthorUpdate.do") + public String updateAuthor(@ModelAttribute("authorManage") AuthorManage authorManage, + BindingResult bindingResult, + Model model) throws Exception { + + beanValidator.validate(authorManage, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + return "egovframework/com/sec/ram/EgovAuthorUpdate"; + } else { + egovAuthorManageService.updateAuthor(authorManage); + model.addAttribute("message", egovMessageSource.getMessage("success.common.update")); + return "forward:/sec/ram/EgovAuthorList.do"; + } + } + + /** + * 권한 세부정보를 삭제한다. + * @param authorManage AuthorManage + * @return String + * @exception Exception + */ + @RequestMapping(value="/sec/ram/EgovAuthorDelete.do") + public String deleteAuthor(@ModelAttribute("authorManage") AuthorManage authorManage, + Model model) throws Exception { + + egovAuthorManageService.deleteAuthor(authorManage); + model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); + return "forward:/sec/ram/EgovAuthorList.do"; + } + + /** + * 권한목록을 삭제한다. + * @param authorCodes String + * @param authorManage AuthorManage + * @return String + * @exception Exception + */ + @RequestMapping(value="/sec/ram/EgovAuthorListDelete.do") + public String deleteAuthorList(@RequestParam("authorCodes") String authorCodes, + @ModelAttribute("authorManage") AuthorManage authorManage, + Model model) throws Exception { + + String [] strAuthorCodes = authorCodes.split(";"); + for(int i=0; i + * << 개정이력(Modification Information) >> + * + * 수정일 수정자 수정내용 + * ------- -------- --------------------------- + * 2009.03.11 이문준 최초 생성 + * 2011.09.07 서준식 롤 등록시 이미 등록된 경우 데이터 중복 에러 발생 문제 수정 + * + */ +@Controller +public class EgovAuthorRoleController { + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovAuthorRoleController.class); + + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name = "egovAuthorRoleManageService") + private EgovAuthorRoleManageService egovAuthorRoleManageService; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** + * 권한 롤 관계 화면 이동 + * @return "egovframework/com/sec/ram/EgovDeptAuthorList" + * @exception Exception + */ + @RequestMapping("/sec/ram/EgovAuthorRoleListView.do") + public String selectAuthorRoleListView() throws Exception { + + return "egovframework/com/sec/ram/EgovAuthorRoleManage"; + } + + /** + * 권한별 할당된 롤 목록 조회 + * + * @param authorRoleManageVO AuthorRoleManageVO + * @return String + * @exception Exception + */ + @RequestMapping(value="/sec/ram/EgovAuthorRoleList.do") + public String selectAuthorRoleList(@ModelAttribute("authorRoleManageVO") AuthorRoleManageVO authorRoleManageVO, + ModelMap model) throws Exception { + + /** 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()); + + authorRoleManageVO.setAuthorRoleList(egovAuthorRoleManageService.selectAuthorRoleList(authorRoleManageVO)); + model.addAttribute("authorRoleList", authorRoleManageVO.getAuthorRoleList()); + model.addAttribute("searchVO", authorRoleManageVO); + + int totCnt = egovAuthorRoleManageService.selectAuthorRoleListTotCnt(authorRoleManageVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/sec/ram/EgovAuthorRoleManage"; + } + + /** + * 권한정보에 롤을 할당하여 데이터베이스에 등록 + * @param authorCode String + * @param roleCodes String + * @param regYns String + * @param authorRoleManage AuthorRoleManage + * @return String + * @exception Exception + */ + @RequestMapping(value="/sec/ram/EgovAuthorRoleInsert.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 { + + String [] strRoleCodes = roleCodes.split(";"); + String [] strRegYns = regYns.split(";"); + + authorRoleManage.setRoleCode(authorCode); + + for(int i=0; i + * @exception Exception + */ + @SuppressWarnings("unchecked") + public List selectAuthorGroupList(AuthorGroupVO authorGroupVO) throws Exception { + return (List) list("authorGroupDAO.selectAuthorGroupList", authorGroupVO); + } + + /** + * 그룹에 권한정보를 할당하여 데이터베이스에 등록 + * @param authorGroup AuthorGroup + * @exception Exception + */ + public void insertAuthorGroup(AuthorGroup authorGroup) throws Exception { + insert("authorGroupDAO.insertAuthorGroup", authorGroup); + } + + /** + * 화면에 조회된 그룹권한정보를 수정하여 항목의 정합성을 체크하고 수정된 데이터를 데이터베이스에 반영 + * @param authorGroup AuthorGroup + * @exception Exception + */ + public void updateAuthorGroup(AuthorGroup authorGroup) throws Exception { + update("authorGroupDAO.updateAuthorGroup", authorGroup); + } + + /** + * 그룹별 할당된 시스템 메뉴 접근권한을 삭제 + * @param authorGroup AuthorGroup + * @exception Exception + */ + public void deleteAuthorGroup(AuthorGroup authorGroup) throws Exception { + delete("authorGroupDAO.deleteAuthorGroup", authorGroup); + } + + /** + * 그룹권한목록 총 갯수를 조회한다. + * @param authorGroupVO AuthorGroupVO + * @return int + * @exception Exception + */ + public int selectAuthorGroupListTotCnt(AuthorGroupVO authorGroupVO) throws Exception { + return (Integer)selectOne("authorGroupDAO.selectAuthorGroupListTotCnt", authorGroupVO); + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sec/rgm/service/impl/EgovAuthorGroupServiceImpl.java b/src/main/java/egovframework/com/sec/rgm/service/impl/EgovAuthorGroupServiceImpl.java new file mode 100644 index 0000000..f0ff3ec --- /dev/null +++ b/src/main/java/egovframework/com/sec/rgm/service/impl/EgovAuthorGroupServiceImpl.java @@ -0,0 +1,85 @@ +package egovframework.com.sec.rgm.service.impl; + +import java.util.List; + +import egovframework.com.sec.rgm.service.AuthorGroup; +import egovframework.com.sec.rgm.service.AuthorGroupVO; +import egovframework.com.sec.rgm.service.EgovAuthorGroupService; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +/** + * 권한그룹에 관한 ServiceImpl 클래스를 정의한다. + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.11  이문준          최초 생성
    + *
    + * 
    + */ + +@Service("egovAuthorGroupService") +public class EgovAuthorGroupServiceImpl extends EgovAbstractServiceImpl implements EgovAuthorGroupService { + + @Resource(name="authorGroupDAO") + private AuthorGroupDAO authorGroupDAO; + + /** + * 그룹별 할당된 권한 목록 조회 + * @param authorGroupVO AuthorGroupVO + * @return List + * @exception Exception + */ + public List selectAuthorGroupList(AuthorGroupVO authorGroupVO) throws Exception{ + return authorGroupDAO.selectAuthorGroupList(authorGroupVO); + } + + /** + * 그룹에 권한정보를 할당하여 데이터베이스에 등록 + * @param authorGroup AuthorGroup + * @exception Exception + */ + public void insertAuthorGroup(AuthorGroup authorGroup) throws Exception{ + authorGroupDAO.insertAuthorGroup(authorGroup); + } + + /** + * 화면에 조회된 그룹권한정보를 수정하여 항목의 정합성을 체크하고 수정된 데이터를 데이터베이스에 반영 + * @param authorGroup AuthorGroup + * @exception Exception + */ + public void updateAuthorGroup(AuthorGroup authorGroup) throws Exception{ + authorGroupDAO.updateAuthorGroup(authorGroup); + } + + /** + * 그룹별 할당된 시스템 메뉴 접근권한을 삭제 + * @param authorGroup AuthorGroup + * @exception Exception + */ + public void deleteAuthorGroup(AuthorGroup authorGroup) throws Exception { + authorGroupDAO.deleteAuthorGroup(authorGroup); + } + + /** + * 목록조회 카운트를 반환한다 + * @param authorGroupVO AuthorGroupVO + * @return int + * @exception Exception + */ + public int selectAuthorGroupListTotCnt(AuthorGroupVO authorGroupVO) throws Exception { + return authorGroupDAO.selectAuthorGroupListTotCnt(authorGroupVO); + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sec/rgm/web/EgovAuthorGroupController.java b/src/main/java/egovframework/com/sec/rgm/web/EgovAuthorGroupController.java new file mode 100644 index 0000000..16a80e5 --- /dev/null +++ b/src/main/java/egovframework/com/sec/rgm/web/EgovAuthorGroupController.java @@ -0,0 +1,168 @@ +package egovframework.com.sec.rgm.web; + +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.SessionVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.sec.ram.service.AuthorManageVO; +import egovframework.com.sec.ram.service.EgovAuthorManageService; +import egovframework.com.sec.rgm.service.AuthorGroup; +import egovframework.com.sec.rgm.service.AuthorGroupVO; +import egovframework.com.sec.rgm.service.EgovAuthorGroupService; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +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 org.springframework.web.bind.annotation.SessionAttributes; +/** + * 권한그룹에 관한 controller 클래스를 정의한다. + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.11  이문준          최초 생성
    + *   2011.08.04  서준식          mberTyCodes 구분자 부분 추가
    + *   2011.8.26	정진오			IncludedInfo annotation 추가
    + * 
    + */ + + +@Controller +@SessionAttributes(types=SessionVO.class) +public class EgovAuthorGroupController { + + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name = "egovAuthorGroupService") + private EgovAuthorGroupService egovAuthorGroupService; + + @Resource(name = "egovAuthorManageService") + private EgovAuthorManageService egovAuthorManageService; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** + * 권한 목록화면 이동 + * @return String + * @exception Exception + */ + @RequestMapping("/sec/rgm/EgovAuthorGroupListView.do") + public String selectAuthorGroupListView() throws Exception { + + return "egovframework/com/sec/rgm/EgovAuthorGroupManage"; + } + + /** + * 그룹별 할당된 권한 목록 조회 + * @param authorGroupVO AuthorGroupVO + * @param authorManageVO AuthorManageVO + * @return String + * @exception Exception + */ + @IncludedInfo(name="권한그룹관리", listUrl="/sec/rgm/EgovAuthorGroupList.do", order = 70,gid = 20) + @RequestMapping(value="/sec/rgm/EgovAuthorGroupList.do") + public String selectAuthorGroupList(@ModelAttribute("authorGroupVO") AuthorGroupVO authorGroupVO, + @ModelAttribute("authorManageVO") AuthorManageVO authorManageVO, + ModelMap model) throws Exception { + + /** 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()); + + authorGroupVO.setAuthorGroupList(egovAuthorGroupService.selectAuthorGroupList(authorGroupVO)); + model.addAttribute("authorGroupList", authorGroupVO.getAuthorGroupList()); + + int totCnt = egovAuthorGroupService.selectAuthorGroupListTotCnt(authorGroupVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + authorManageVO.setAuthorManageList(egovAuthorManageService.selectAuthorAllList(authorManageVO)); + model.addAttribute("authorManageList", authorManageVO.getAuthorManageList()); + + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/sec/rgm/EgovAuthorGroupManage"; + } + + /** + * 그룹에 권한정보를 할당하여 데이터베이스에 등록 + * @param userIds String + * @param authorCodes String + * @param regYns String + * @param authorGroup AuthorGroup + * @return String + * @exception Exception + */ + @RequestMapping(value="/sec/rgm/EgovAuthorGroupInsert.do") + public String insertAuthorGroup(@RequestParam("userIds") String userIds, + @RequestParam("authorCodes") String authorCodes, + @RequestParam("regYns") String regYns, + @RequestParam("mberTyCodes") String mberTyCodes,// 2011.08.04 수정 부분 + @ModelAttribute("authorGroup") AuthorGroup authorGroup, + ModelMap model) throws Exception { + + String [] strUserIds = userIds.split(";"); + String [] strAuthorCodes = authorCodes.split(";"); + String [] strRegYns = regYns.split(";"); + String [] strMberTyCodes = mberTyCodes.split(";");// 2011.08.04 수정 부분 + + for(int i=0; i + * << 개정이력(Modification Information) >> + * + * 수정일 수정자 수정내용 + * ------- -------- --------------------------- + * 2009.03.20 이문준 최초 생성 + * + * + */ + +public interface EgovRoleManageService { + + /** + * 등록된 롤 정보 조회 + * @param roleManageVO RoleManageVO + * @return RoleManageVO + * @exception Exception + */ + public RoleManageVO selectRole(RoleManageVO roleManageVO) throws Exception; + + /** + * 등록된 롤 정보 목록 조회 + * @param roleManageVO RoleManageVO + * @return List + * @exception Exception + */ + public List selectRoleList(RoleManageVO roleManageVO) throws Exception; + + /** + * 불필요한 롤정보를 화면에 조회하여 데이터베이스에서 삭제 + * @param roleManage RoleManage + * @exception Exception + */ + public void deleteRole(RoleManage roleManage) throws Exception; + + /** + * 시스템 메뉴에 따른 접근권한, 데이터 입력, 수정, 삭제의 권한 롤을 수정 + * @param roleManage RoleManage + * @exception Exception + */ + public void updateRole(RoleManage roleManage) throws Exception; + + /** + * 시스템 메뉴에 따른 접근권한, 데이터 입력, 수정, 삭제의 권한 롤을 등록 + * @param roleManage RoleManage + * @param roleManageVO RoleManageVO + * @return RoleManageVO + * @exception Exception + */ + public RoleManageVO insertRole(RoleManage roleManage, RoleManageVO roleManageVO) throws Exception; + + /** + * 목록조회 카운트를 반환한다 + * @param roleManageVO RoleManageVO + * @return int + * @exception Exception + */ + public int selectRoleListTotCnt(RoleManageVO roleManageVO) throws Exception; + + /** + * 등록된 모든 롤 정보 목록 조회 + * @param roleManageVO RoleManageVO + * @return List + * @exception Exception + */ + public List selectRoleAllList(RoleManageVO roleManageVO) throws Exception; + + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sec/rmt/service/RoleManage.java b/src/main/java/egovframework/com/sec/rmt/service/RoleManage.java new file mode 100644 index 0000000..fb4f31c --- /dev/null +++ b/src/main/java/egovframework/com/sec/rmt/service/RoleManage.java @@ -0,0 +1,192 @@ +package egovframework.com.sec.rmt.service; + +import egovframework.com.cmm.ComDefaultVO; + +/** + * 롤관리에 대한 model 클래스를 정의한다. + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이문준          최초 생성
    + *
    + * 
    + */ + +public class RoleManage extends ComDefaultVO { + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + /** + * 롤 관리 + */ + private RoleManage roleManage; + /** + * 롤코드 + */ + private String roleCode; + /** + * 롤명 + */ + private String roleNm; + /** + * 롤패턴 + */ + private String rolePtn; + /** + * 롤 설명 + */ + private String roleDc; + /** + * 롤 타입 + */ + private String roleTyp; + /** + * 롤 Sort + */ + private String roleSort; + /** + * 롤 등록일시 + */ + private String roleCreatDe; + /** + * 권한 코드 + */ + private String authorCode; + + /** + * roleManage attribute 를 리턴한다. + * @return RoleManage + */ + public RoleManage getRoleManage() { + return roleManage; + } + /** + * roleManage attribute 값을 설정한다. + * @param roleManage RoleManage + */ + public void setRoleManage(RoleManage roleManage) { + this.roleManage = roleManage; + } + /** + * roleCode attribute 를 리턴한다. + * @return String + */ + public String getRoleCode() { + return roleCode; + } + /** + * roleCode attribute 값을 설정한다. + * @param roleCode String + */ + public void setRoleCode(String roleCode) { + this.roleCode = roleCode; + } + /** + * roleNm attribute 를 리턴한다. + * @return String + */ + public String getRoleNm() { + return roleNm; + } + /** + * roleNm attribute 값을 설정한다. + * @param roleNm String + */ + public void setRoleNm(String roleNm) { + this.roleNm = roleNm; + } + /** + * rolePtn attribute 를 리턴한다. + * @return String + */ + public String getRolePtn() { + return rolePtn; + } + /** + * rolePtn attribute 값을 설정한다. + * @param rolePtn String + */ + public void setRolePtn(String rolePtn) { + this.rolePtn = rolePtn; + } + /** + * roleDc attribute 를 리턴한다. + * @return String + */ + public String getRoleDc() { + return roleDc; + } + /** + * roleDc attribute 값을 설정한다. + * @param roleDc String + */ + public void setRoleDc(String roleDc) { + this.roleDc = roleDc; + } + /** + * roleTyp attribute 를 리턴한다. + * @return String + */ + public String getRoleTyp() { + return roleTyp; + } + /** + * roleTyp attribute 값을 설정한다. + * @param roleTyp String + */ + public void setRoleTyp(String roleTyp) { + this.roleTyp = roleTyp; + } + /** + * roleSort attribute 를 리턴한다. + * @return String + */ + public String getRoleSort() { + return roleSort; + } + /** + * roleSort attribute 값을 설정한다. + * @param roleSort String + */ + public void setRoleSort(String roleSort) { + this.roleSort = roleSort; + } + /** + * roleCreatDe attribute 를 리턴한다. + * @return String + */ + public String getRoleCreatDe() { + return roleCreatDe; + } + /** + * roleCreatDe attribute 값을 설정한다. + * @param roleCreatDe String + */ + public void setRoleCreatDe(String roleCreatDe) { + this.roleCreatDe = roleCreatDe; + } + /** + * authorCode attribute 를 리턴한다. + * @return String + */ + public String getAuthorCode() { + return authorCode; + } + /** + * authorCode attribute 값을 설정한다. + * @param authorCode String + */ + public void setAuthorCode(String authorCode) { + this.authorCode = authorCode; + } + + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sec/rmt/service/RoleManageVO.java b/src/main/java/egovframework/com/sec/rmt/service/RoleManageVO.java new file mode 100644 index 0000000..c2af72d --- /dev/null +++ b/src/main/java/egovframework/com/sec/rmt/service/RoleManageVO.java @@ -0,0 +1,66 @@ +package egovframework.com.sec.rmt.service; + +import java.util.List; + +/** + * 롤관리에 대한 Vo 클래스를 정의한다. + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이문준          최초 생성
    + *
    + * 
    + */ + +public class RoleManageVO extends RoleManage { + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + /** + * 롤 목록 + */ + List roleManageList; + /** + * 삭제대상 목록 + */ + String[] delYn; + + /** + * roleManageList attribute 를 리턴한다. + * @return List + */ + public List getRoleManageList() { + return roleManageList; + } + /** + * roleManageList attribute 값을 설정한다. + * @param roleManageList List + */ + public void setRoleManageList(List roleManageList) { + this.roleManageList = roleManageList; + } + /** + * delYn attribute 를 리턴한다. + * @return String[] + */ + public String[] getDelYn() { + return delYn; + } + /** + * delYn attribute 값을 설정한다. + * @param delYn String[] + */ + public void setDelYn(String[] delYn) { + this.delYn = delYn; + } + + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sec/rmt/service/impl/EgovRoleManageServiceImpl.java b/src/main/java/egovframework/com/sec/rmt/service/impl/EgovRoleManageServiceImpl.java new file mode 100644 index 0000000..d1942c3 --- /dev/null +++ b/src/main/java/egovframework/com/sec/rmt/service/impl/EgovRoleManageServiceImpl.java @@ -0,0 +1,109 @@ +package egovframework.com.sec.rmt.service.impl; + +import java.util.List; + +import egovframework.com.sec.rmt.service.EgovRoleManageService; +import egovframework.com.sec.rmt.service.RoleManage; +import egovframework.com.sec.rmt.service.RoleManageVO; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +/** + * 롤관리에 관한 ServiceImpl 클래스를 정의한다. + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.11  이문준          최초 생성
    + *
    + * 
    + */ + +@Service("egovRoleManageService") +public class EgovRoleManageServiceImpl extends EgovAbstractServiceImpl implements EgovRoleManageService { + + @Resource(name="roleManageDAO") + public RoleManageDAO roleManageDAO; + + /** + * 등록된 롤 정보 조회 + * @param roleManageVO RoleManageVO + * @return RoleManageVO + * @exception Exception + */ + public RoleManageVO selectRole(RoleManageVO roleManageVO) throws Exception { + return roleManageDAO.selectRole(roleManageVO); + } + + /** + * 등록된 롤 정보 목록 조회 + * @param roleManageVO RoleManageVO + * @return List + * @exception Exception + */ + public List selectRoleList(RoleManageVO roleManageVO) throws Exception { + return roleManageDAO.selectRoleList(roleManageVO); + } + + /** + * 불필요한 롤정보를 화면에 조회하여 데이터베이스에서 삭제 + * @param roleManage RoleManage + * @exception Exception + */ + public void deleteRole(RoleManage roleManage) throws Exception { + roleManageDAO.deleteRole(roleManage); + } + + /** + * 시스템 메뉴에 따른 접근권한, 데이터 입력, 수정, 삭제의 권한 롤을 수정 + * @param roleManage RoleManage + * @exception Exception + */ + public void updateRole(RoleManage roleManage) throws Exception { + roleManageDAO.updateRole(roleManage); + } + + /** + * 시스템 메뉴에 따른 접근권한, 데이터 입력, 수정, 삭제의 권한 롤을 등록 + * @param roleManage RoleManage + * @param roleManageVO RoleManageVO + * @return RoleManageVO + * @exception Exception + */ + public RoleManageVO insertRole(RoleManage roleManage, RoleManageVO roleManageVO) throws Exception { + roleManageDAO.insertRole(roleManage); + roleManageVO.setRoleCode(roleManage.getRoleCode()); + return roleManageDAO.selectRole(roleManageVO); + } + + /** + * 목록조회 카운트를 반환한다 + * @param roleManageVO RoleManageVO + * @return int + * @exception Exception + */ + public int selectRoleListTotCnt(RoleManageVO roleManageVO) throws Exception { + return roleManageDAO.selectRoleListTotCnt(roleManageVO); + } + + /** + * 등록된 모든 롤 정보 목록 조회 + * @param roleManageVO - 등록할 정보가 담긴 RoleManageVO + * @return List + * @exception Exception + */ + public List selectRoleAllList(RoleManageVO roleManageVO) throws Exception { + return roleManageDAO.selectRoleAllList(roleManageVO); + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sec/rmt/service/impl/RoleManageDAO.java b/src/main/java/egovframework/com/sec/rmt/service/impl/RoleManageDAO.java new file mode 100644 index 0000000..4279b1d --- /dev/null +++ b/src/main/java/egovframework/com/sec/rmt/service/impl/RoleManageDAO.java @@ -0,0 +1,98 @@ +package egovframework.com.sec.rmt.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.sec.rmt.service.RoleManage; +import egovframework.com.sec.rmt.service.RoleManageVO; + +import org.springframework.stereotype.Repository; + +/** + * 롤관리에 대한 DAO 클래스를 정의한다. + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.11  이문준          최초 생성
    + *
    + * 
    + */ + +@Repository("roleManageDAO") +public class RoleManageDAO extends EgovComAbstractDAO { + + /** + * 등록된 롤 정보 조회 + * @param roleManageVO RoleManageVO + * @return RoleManageVO + * @exception Exception + */ + public RoleManageVO selectRole(RoleManageVO roleManageVO) throws Exception { + return (RoleManageVO) selectOne("roleManageDAO.selectRole", roleManageVO); + } + + /** + * 등록된 롤 정보 목록 조회 + * @param roleManageVO RoleManageVO + * @return List + * @exception Exception + */ + @SuppressWarnings("unchecked") + public List selectRoleList(RoleManageVO roleManageVO) throws Exception { + return (List) list("roleManageDAO.selectRoleList", roleManageVO); + } + + /** + * 시스템 메뉴에 따른 접근권한, 데이터 입력, 수정, 삭제의 권한 롤을 등록 + * @param roleManage RoleManage + * @exception Exception + */ + public void insertRole(RoleManage roleManage) throws Exception { + insert("roleManageDAO.insertRole", roleManage); + } + /** + * 시스템 메뉴에 따른 접근권한, 데이터 입력, 수정, 삭제의 권한 롤을 수정 + * @param roleManage RoleManage + * @exception Exception + */ + public void updateRole(RoleManage roleManage) throws Exception { + update("roleManageDAO.updateRole", roleManage); + } + /** + * 불필요한 롤정보를 화면에 조회하여 데이터베이스에서 삭제 + * @param roleManage RoleManage + * @exception Exception + */ + public void deleteRole(RoleManage roleManage) throws Exception { + delete("roleManageDAO.deleteRole", roleManage); + } + + /** + * 롤목록 총 갯수를 조회한다. + * @param roleManageVO RoleManageVO + * @return int + * @exception Exception + */ + public int selectRoleListTotCnt(RoleManageVO roleManageVO) throws Exception { + return (Integer)selectOne("roleManageDAO.selectAuthorListTotCnt", roleManageVO); + } + + /** + * 등록된 모든 롤 정보 목록 조회 + * @param roleManageVO RoleManageVO + * @return List + * @exception Exception + */ + @SuppressWarnings("unchecked") + public List selectRoleAllList(RoleManageVO roleManageVO) throws Exception { + return (List) list("roleManageDAO.selectRoleAllList", roleManageVO); + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sec/rmt/web/EgovRoleManageController.java b/src/main/java/egovframework/com/sec/rmt/web/EgovRoleManageController.java new file mode 100644 index 0000000..13273a4 --- /dev/null +++ b/src/main/java/egovframework/com/sec/rmt/web/EgovRoleManageController.java @@ -0,0 +1,273 @@ +package egovframework.com.sec.rmt.web; + +import java.util.List; + +import egovframework.com.cmm.ComDefaultCodeVO; +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.SessionVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.service.EgovCmmUseService; +import egovframework.com.sec.ram.service.AuthorManageVO; +import egovframework.com.sec.ram.service.EgovAuthorManageService; +import egovframework.com.sec.rmt.service.EgovRoleManageService; +import egovframework.com.sec.rmt.service.RoleManage; +import egovframework.com.sec.rmt.service.RoleManageVO; + +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +import javax.annotation.Resource; + +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.springframework.web.bind.annotation.SessionAttributes; +import org.springmodules.validation.commons.DefaultBeanValidator; + +/** + * 롤관리에 관한 controller 클래스를 정의한다. + * @author 공통서비스 개발팀 이문준 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.11  이문준          최초 생성
    + *   2011.8.26	정진오			IncludedInfo annotation 추가
    + *
    + * 
    + */ + + +@Controller +@SessionAttributes(types=SessionVO.class) +public class EgovRoleManageController { + + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name = "egovRoleManageService") + private EgovRoleManageService egovRoleManageService; + + @Resource(name = "EgovCmmUseService") + EgovCmmUseService egovCmmUseService; + + @Resource(name = "egovAuthorManageService") + private EgovAuthorManageService egovAuthorManageService; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** Message ID Generation */ + @Resource(name="egovRoleIdGnrService") + private EgovIdGnrService egovRoleIdGnrService; + + @Autowired + private DefaultBeanValidator beanValidator; + + /** + * 롤 목록화면 이동 + * @return String + * @exception Exception + */ + @RequestMapping("/sec/rmt/EgovRoleListView.do") + public String selectRoleListView() + throws Exception { + return "egovframework/com/sec/rmt/EgovRoleManage"; + } + + /** + * 등록된 롤 정보 목록 조회 + * @param roleManageVO RoleManageVO + * @return String + * @exception Exception + */ + @IncludedInfo(name="롤관리", listUrl="/sec/rmt/EgovRoleList.do", order = 90,gid = 20) + @RequestMapping(value="/sec/rmt/EgovRoleList.do") + public String selectRoleList(@ModelAttribute("roleManageVO") RoleManageVO roleManageVO, + ModelMap model) throws Exception { + + /** 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()); + + roleManageVO.setRoleManageList(egovRoleManageService.selectRoleList(roleManageVO)); + model.addAttribute("roleList", roleManageVO.getRoleManageList()); + + int totCnt = egovRoleManageService.selectRoleListTotCnt(roleManageVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/sec/rmt/EgovRoleManage"; + } + + /** + * 등록된 롤 정보 조회 + * @param roleCode String + * @param roleManageVO RoleManageVO + * @param authorManageVO AuthorManageVO + * @return String + * @exception Exception + */ + @RequestMapping(value="/sec/rmt/EgovRole.do") + public String selectRole(@RequestParam("roleCode") String roleCode, + @ModelAttribute("roleManageVO") RoleManageVO roleManageVO, + @ModelAttribute("authorManageVO") AuthorManageVO authorManageVO, + ModelMap model) throws Exception { + + roleManageVO.setRoleCode(roleCode); + + authorManageVO.setAuthorManageList(egovAuthorManageService.selectAuthorAllList(authorManageVO)); + + model.addAttribute("roleManage", egovRoleManageService.selectRole(roleManageVO)); + model.addAttribute("authorManageList", authorManageVO.getAuthorManageList()); + model.addAttribute("cmmCodeDetailList", getCmmCodeDetailList(new ComDefaultCodeVO(),"COM029")); + + return "egovframework/com/sec/rmt/EgovRoleUpdate"; + } + + /** + * 롤 등록화면 이동 + * @param authorManageVO AuthorManageVO + * @return String + * @exception Exception + */ + @RequestMapping("/sec/rmt/EgovRoleInsertView.do") + public String insertRoleView(@ModelAttribute("authorManageVO") AuthorManageVO authorManageVO, + @ModelAttribute("roleManage") RoleManage roleManage, + ModelMap model) throws Exception { + + authorManageVO.setAuthorManageList(egovAuthorManageService.selectAuthorAllList(authorManageVO)); + model.addAttribute("authorManageList", authorManageVO.getAuthorManageList()); + model.addAttribute("cmmCodeDetailList", getCmmCodeDetailList(new ComDefaultCodeVO(),"COM029")); + + return "egovframework/com/sec/rmt/EgovRoleInsert"; + } + + /** + * 공통코드 호출 + * @param comDefaultCodeVO ComDefaultCodeVO + * @param codeId String + * @return List + * @exception Exception + */ + public List getCmmCodeDetailList(ComDefaultCodeVO comDefaultCodeVO, String codeId) throws Exception { + comDefaultCodeVO.setCodeId(codeId); + return egovCmmUseService.selectCmmCodeDetail(comDefaultCodeVO); + } + + /** + * 시스템 메뉴에 따른 접근권한, 데이터 입력, 수정, 삭제의 권한 롤을 등록 + * @param roleManage RoleManage + * @param roleManageVO RoleManageVO + * @return String + * @exception Exception + */ + @RequestMapping(value="/sec/rmt/EgovRoleInsert.do") + public String insertRole(@ModelAttribute("roleManage") RoleManage roleManage, + @ModelAttribute("roleManageVO") RoleManageVO roleManageVO, + BindingResult bindingResult, + ModelMap model) throws Exception { + + beanValidator.validate(roleManage, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + return "egovframework/com/sec/rmt/EgovRoleInsert"; + } else { + String roleTyp = roleManage.getRoleTyp(); + if("method".equals(roleTyp))//KISA 보안약점 조치 (2018-10-29, 윤창원) + roleTyp = "mtd"; + else if("pointcut".equals(roleTyp))//KISA 보안약점 조치 (2018-10-29, 윤창원) + roleTyp = "pct"; + else roleTyp = "web"; + + roleManage.setRoleCode(roleTyp.concat("-").concat(egovRoleIdGnrService.getNextStringId())); + roleManageVO.setRoleCode(roleManage.getRoleCode()); + + model.addAttribute("cmmCodeDetailList", getCmmCodeDetailList(new ComDefaultCodeVO(),"COM029")); + model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); + model.addAttribute("roleManage", egovRoleManageService.insertRole(roleManage, roleManageVO)); + + //return "egovframework/com/sec/rmt/EgovRoleUpdate"; + return "forward:/sec/rmt/EgovRoleList.do"; + } + } + + /** + * 시스템 메뉴에 따른 접근권한, 데이터 입력, 수정, 삭제의 권한 롤을 수정 + * @param roleManage RoleManage + * @param bindingResult BindingResult + * @return String + * @exception Exception + */ + @RequestMapping(value="/sec/rmt/EgovRoleUpdate.do") + public String updateRole(@ModelAttribute("roleManage") RoleManage roleManage, + BindingResult bindingResult, + ModelMap model) throws Exception { + + beanValidator.validate(roleManage, bindingResult); //validation 수행 + if (bindingResult.hasErrors()) { + return "egovframework/com/sec/rmt/EgovRoleUpdate"; + } else { + egovRoleManageService.updateRole(roleManage); + model.addAttribute("message", egovMessageSource.getMessage("success.common.update")); + //return "forward:/sec/rmt/EgovRole.do"; + return "forward:/sec/rmt/EgovRoleList.do"; + } + } + + /** + * 불필요한 롤정보를 화면에 조회하여 데이터베이스에서 삭제 + * @param roleManage RoleManage + * @return String + * @exception Exception + */ + @RequestMapping(value="/sec/rmt/EgovRoleDelete.do") + public String deleteRole(@ModelAttribute("roleManage") RoleManage roleManage, + ModelMap model) throws Exception { + egovRoleManageService.deleteRole(roleManage); + model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); + return "forward:/sec/rmt/EgovRoleList.do"; + + } + + /** + * 불필요한 그룹정보 목록을 화면에 조회하여 데이터베이스에서 삭제 + * @param roleCodes String + * @param roleManage RoleManage + * @return String + * @exception Exception + */ + @RequestMapping(value="/sec/rmt/EgovRoleListDelete.do") + public String deleteRoleList(@RequestParam("roleCodes") String roleCodes, + @ModelAttribute("roleManage") RoleManage roleManage, + Model model) throws Exception { + String [] strRoleCodes = roleCodes.split(";"); + for(int i=0; i + * << 개정이력(Modification Information) >> + * + * 수정일 수정자 수정내용 + * ------- -------- --------------------------- + * 2009.04.10 조재영 최초 생성 + * + * + */ +public interface EgovRlnmManageService { + + /** + * 실명인증확인화면 호출(주민번호) + * @param ihidnum 주민등록번호 + * @param realname 실명 + * @param sbscrbTy 사용자 유형 + * @return result 결과메시지코드 + * @throws Exception + */ + + public String rlnmCnfirm(String ihidnum, String realname, String sbscrbTy)throws Exception; + + /** + * 실명인증확인화면 호출(GPIN) + * @param pinId 공공아이핀 아이디 + * @param pinPassword 공공아이핀 패스워드 + * @param sbscrbTy 사용자 유형 + * @return result 결과메시지코드 + * @throws Exception + */ + public String rlnmPinCnfirm(String pinId, String pinPassword, String sbscrbTy)throws Exception; +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sec/rnc/service/EgovSocketClient.java b/src/main/java/egovframework/com/sec/rnc/service/EgovSocketClient.java new file mode 100644 index 0000000..c2e5fe3 --- /dev/null +++ b/src/main/java/egovframework/com/sec/rnc/service/EgovSocketClient.java @@ -0,0 +1,196 @@ +package egovframework.com.sec.rnc.service; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.IOException; +import java.net.Socket; + +import egovframework.com.cmm.service.Globals; +import egovframework.com.cmm.util.EgovResourceCloseHelper; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * G4C 연계용 배포파일- SocketClient.java + * @author 공통서비스 개발팀 조재영 + * @since 2009.04.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.10  조재영          최초 생성
    + *   2011.10.10	 이기하			 보안점검 후속초치(디버거코드 주석처리)
    + *
    + * 
    + */ +public class EgovSocketClient { + private static final int MAX_SIZE_OF_MESSAGE = 1024 * 1024; + private BufferedInputStream inStream = null; + private BufferedOutputStream outStream = null; + + /** log */ + private static final Logger LOGGER = LoggerFactory.getLogger(EgovSocketClient.class); + + public EgovSocketClient() { + } + + public byte[] execute(String pm_sData) { + Socket socket = null; + byte[] lm_bRecvData = null; + try { + socket = EgovTimedSocket.getSocketClient(Globals.LOCAL_IP, 1235, 5000); + socket.setSoTimeout(5000); + inStream = new BufferedInputStream(socket.getInputStream(), 512); + outStream = new BufferedOutputStream(socket.getOutputStream(), 512); + sendHeader(pm_sData.getBytes()); + sendData(pm_sData.getBytes()); + int lm_iRecvDataLength = recvHeader(); + lm_bRecvData = new byte[lm_iRecvDataLength]; + readAllByte(lm_bRecvData, 0, lm_iRecvDataLength, inStream); + } catch (IOException e) { + LOGGER.error("IO Exception", e); + } finally { + EgovResourceCloseHelper.close(outStream, inStream); + EgovResourceCloseHelper.closeSockets(socket); + } + return lm_bRecvData; + } + + private int recvHeader() { + int dataLength = 0; + + try { + // 정보 받기 + // 헤더정보 받기, 뒤에 따라올 데이터의 길이를 알려준다. + byte[] recvHeader = new byte[4]; + + if (inStream.read(recvHeader, 0, recvHeader.length) < 4) { + //System.out.println("받은 데이터 헤더가 형식에 맞지 않습니다."); + dataLength = -1; + } + + int b1 = recvHeader[0]; + int b2 = recvHeader[1]; + int b3 = recvHeader[2]; + int b4 = recvHeader[3]; + + b1 = b1 & 0xFF; + b2 = b2 & 0xFF; + b3 = b3 & 0xFF; + b4 = b4 & 0xFF; + + dataLength = (b1 << 24) | (b2 << 16) | (b3 << 8) | b4; + + if (MAX_SIZE_OF_MESSAGE < dataLength) { + dataLength = -1; + } + } catch (IOException e) { + dataLength = -1; + } + + return dataLength; + } + + /** + * 서버에서 보낸 정보를 읽어들인다. + * + * @param buf 데이터를 읽어들일 버퍼 + * @param offset 데이터를 읽어들일 시작위치 + * @param length 읽어들일 데이터의 길이 + * @param in 데이터를 읽어들일 입력 스트림 + * @throws IOException 데이터를 읽을때 발생하는 오류 + */ + public void readAllByte(byte[] buf, int offset, int length, BufferedInputStream in) throws IOException { + + // 읽어 들인 전체 바이트 + int totalReadByteNum = 0; + + //처음으로 읽기를 시작한다. + int tempReadByte = in.read(buf, offset, length); + + //읽은 결과가 -1이면 + if (tempReadByte == -1) { + return; + } + + //읽은 바이트수를 계산한다. + totalReadByteNum += tempReadByte; + + //읽은 바이트 의 수가 받으려하는 바이트보다 작다면 다받을 때까지 받는다. + while (totalReadByteNum < length) { + int reReadToByteNum = length - totalReadByteNum; + int reReadByteNum = in.read(buf, totalReadByteNum, reReadToByteNum); + + //읽은 결과가 -1이면 + if (reReadByteNum == -1) { + break; + } + + totalReadByteNum += reReadByteNum; + } + } + + /** + * 데이터의 길이를 소켓을 통해 전송한다. + * + * @param data 길이를 전송할 데이터의 byte 배열 + */ + private void sendHeader(byte[] data) throws IOException { + byte[] sendHeader = new byte[4]; + + int value = data.length; + int b1 = (value >>> 24) & 0xFF; + int b2 = (value >>> 16) & 0xFF; + int b3 = (value >>> 8) & 0xFF; + int b4 = (value >>> 0) & 0xFF; + + sendHeader[0] = (byte) b1; + sendHeader[1] = (byte) b2; + sendHeader[2] = (byte) b3; + sendHeader[3] = (byte) b4; + outStream.write(sendHeader, 0, sendHeader.length); + outStream.flush(); + } + + /** + * 소켓을 이용하여 데이터를 전송한다. + * + * @param data 전송할 데이터의 byte 배열 + */ + private void sendData(byte[] data) throws IOException { + outStream.write(data); + outStream.flush(); + } + + /** + * 배포된 파일을 로컬에서 직접테스트시 참조할 수 있는 코드(직접실행시 사용) + */ + /** 2011.10.10 cmd 라인상에서 편의제공을 위해 제공, 필요없을시 삭제하여도 무방함 + public static void main(String agrs[]) + { + EgovSocketClient lm_oSocketClient = new EgovSocketClient(); + try + { + /* + * 서비스구분코드|인증서CN|이름|주민번호 + * + * 인증서 파일 에서 숫자에 해당하는 값:예) SVR1310000001_***.*** + * 1310000001이 인증서CN 값 이다 + */ + /** + byte[] lm_bResult1 = lm_oSocketClient.execute("12|1310000001|홍길동|주민번호"); + //System.out.println("결과:"+new String(lm_bResult1)); + } + catch(Exception e) + { + //e.printStackTrace() + System.out.println(e); + } + } + */ +} diff --git a/src/main/java/egovframework/com/sec/rnc/service/EgovTimedSocket.java b/src/main/java/egovframework/com/sec/rnc/service/EgovTimedSocket.java new file mode 100644 index 0000000..bdeb2db --- /dev/null +++ b/src/main/java/egovframework/com/sec/rnc/service/EgovTimedSocket.java @@ -0,0 +1,226 @@ +package egovframework.com.sec.rnc.service; + +import java.io.IOException; +import java.io.InterruptedIOException; +import java.net.InetAddress; +import java.net.Socket; + +import javax.net.ssl.SSLSocketFactory; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import egovframework.com.cmm.EgovWebUtil; + +/** + * G4C 연계용 배포파일- TimedSocket.java + * @author 공통서비스 개발팀 조재영 + * @since 2009.04.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.10  조재영          최초 생성
    + *   2011.10.10	 이기하			 보안점검 후속초치(디버거코드 주석처리)
    + *
    + * 
    + */ +public class EgovTimedSocket +{ + private static final Logger LOGGER = LoggerFactory.getLogger(EgovTimedSocket.class); + + /** + * 특정주소로 연결시도한다.(InetAdress로 연결) + * + * @param iaddr hostaddress + * @param connectPort service port + * @param delayTime Delay(milliseconds) + */ + public static Socket getSocketClient ( InetAddress iaddr, int connectPort, int delayTime) throws InterruptedIOException, IOException + { + SocketAction sa = new SocketAction( iaddr, connectPort ); + sa.start(); + + int timeCheck = 0; + Socket socket = null; + + for (;;) + { + if (sa.isConnected()){ + socket = sa.getSocketThread(); + break; + } + else + { + if (sa.isFail()){ + sa.getException(); + } + + try{ + Thread.sleep ( TIME_DELAY ); + } + catch (InterruptedException ine) { + // 2011.10.10 보안점검 후속조치 + LOGGER.error("Exception: {}", ine.getClass().getName()); + LOGGER.error("Exception Message: {}", ine.getMessage()); + } + + timeCheck += TIME_DELAY; + + if (timeCheck > delayTime){ + throw new InterruptedIOException("connect fail , time over : " + delayTime); + } + } + } + + return socket; + } + + /** + * 특정주소로 연결시도한다.(주소로 직접 연결) + * + * @param ihost hostname + * @param connectPort Port of service + * @param delayTime Delay in milliseconds + */ + public static Socket getSocketClient ( String ihost, int connectPort, int delayTime) throws InterruptedIOException, IOException + { + if (!EgovWebUtil.isIPAddress(ihost)) { // 2011.10.25 보안점검 후속조치 + throw new RuntimeException("IP is needed. (" + ihost + ")"); + } + + InetAddress inetAddr = InetAddress.getByName (ihost); + return getSocketClient ( inetAddr, connectPort, delayTime ); + } + + /** + * 배포된 파일을 로컬에서 직접테스트시 참조할 수 있는 코드(직접실행시 사용) + */ + /** 2011.10.10 cmd 라인상에서 편의제공을 위해 제공, 필요없을시 삭제하여도 무방함 + public static void main(String args[]) throws Exception + { + try + { + Socket s = EgovTimedSocket.getSocketClient ("192.168.100.21", 80, 5000); + s.close(); + } + catch (IOException ioe) + { + //ioe.printStackTrace(); + LOG.error("Exception: " + ioe.getClass().getName()); + LOG.error("Exception Message: " + ioe.getMessage()); + } + + } + */ + + // Inner class + static class SocketAction extends Thread + { + volatile private Socket threadSocket = null; + private String threadHost = null; + private InetAddress threadInetAddr = null; + private int threadPort = 0; + private IOException threadException = null; + + public SocketAction ( String host, int port) + { + threadHost = host; + threadPort = port; + } + + public SocketAction ( InetAddress inetAddr, int port ) + { + threadInetAddr = inetAddr; + threadPort = port; + } + + public SocketAction ( InetAddress inetAddr, String host, int port ) + { + if(host!=null){ + threadHost = host; + threadPort = port; + }else if(inetAddr!=null){ + threadInetAddr = inetAddr; + threadPort = port; + } + } + + @Override + public void run() + { + Socket sock = null; + + try + { + if (threadHost != null) { + sock = SSLSocketFactory.getDefault().createSocket(threadHost, threadPort);//2022.01. Unencrypted Socket 처리 + + } + else{ + sock = SSLSocketFactory.getDefault().createSocket(threadInetAddr, threadPort); //2022.01. Unencrypted Socket 처리 + } + } + catch (IOException ioe) + { + threadException = ioe; + return; + } + threadSocket = sock; + } + + public Socket getSocketThread() + { + return threadSocket; + } + + public boolean isFail() + { + if (threadException == null) { + return false; + } else { + return true; + } + } + + public boolean isConnected() + { + if (threadSocket == null) { + return false; + } else { + return true; + } + } + + public String getThreadSocket() + { + if (threadSocket == null) { + return ""; + } else { + return threadHost; + } + } + + public String getThreadInetAddr() + { + if (threadInetAddr == null) { + return ""; + } else + if (!EgovWebUtil.isIPAddress(threadInetAddr.getHostAddress())) { // 2011.10.25 보안점검 후속조치 + throw new RuntimeException("IP is needed. (" + threadInetAddr.getHostAddress() + ")"); + } + return threadInetAddr.getHostAddress(); + } + + public IOException getException() + { + return threadException; + } + } + + private static final int TIME_DELAY = 100; +} diff --git a/src/main/java/egovframework/com/sec/rnc/service/impl/EgovRlnmManageServiceImpl.java b/src/main/java/egovframework/com/sec/rnc/service/impl/EgovRlnmManageServiceImpl.java new file mode 100644 index 0000000..07e8d30 --- /dev/null +++ b/src/main/java/egovframework/com/sec/rnc/service/impl/EgovRlnmManageServiceImpl.java @@ -0,0 +1,84 @@ +package egovframework.com.sec.rnc.service.impl; + +import egovframework.com.sec.rnc.service.EgovRlnmManageService; +import egovframework.com.sec.rnc.service.EgovSocketClient; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import org.springframework.stereotype.Service; + +/** + * 실명인증관리에 관한비지니스클래스를 정의한다. + * @author 공통서비스 개발팀 조재영 + * @since 2009.04.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.10  조재영          최초 생성
    + *
    + * 
    + */ +@Service("rlnmManageService") +public class EgovRlnmManageServiceImpl extends EgovAbstractServiceImpl implements EgovRlnmManageService { + + //private static final Logger LOGGER = LoggerFactory.getLogger(EgovRlnmManageServiceImpl.class); + + /** + * 실명인증확인화면 호출(주민번호) + * @param ihidnum 주민등록번호 + * @param realname 실명 + * @param sbscrbTy 사용자 유형 + * @return result 결과메시지코드 + * @throws Exception + */ + @Override + public String rlnmCnfirm(String ihidnum, String realname, String sbscrbTy) { + String result = "ERR"; + + EgovSocketClient lm_oSocketClient = new EgovSocketClient(); + + /* + * 서비스구분코드|인증서CN|이름|주민번호 + * + * 인증서 파일 에서 숫자에 해당하는 값:예) SVR1310000001_***.*** + * 1310000001이 인증서CN 값 이다 + */ + String str = "99|1311000011|" + realname + "|" + ihidnum; + //String str = "99|1311000011|홍길동|주민번호"; + byte[] lm_bResult1 = lm_oSocketClient.execute(str); + result = new String(lm_bResult1); + + return result; + } + + /** + * 실명인증확인화면 호출(GPIN) + * @param pinId 공공아이핀 아이디 + * @param pinPassword 공공아이핀 패스워드 + * @param sbscrbTy 사용자 유형 + * @return result 결과메시지코드 + * @throws Exception + */ + @Override + public String rlnmPinCnfirm(String pinId, String pinPassword, String sbscrbTy) { + String result = "ERR"; + + /* + try { + // 공공아이핀 센터를 통해 pinId, pinPassword를 검증한다. + result = "result message"; + } catch (Exception e) { + LOGGER.error("Exception: {}", e.getClass().getName()); + LOGGER.error("Exception Message: {}", e.getMessage()); + } + */ + + return result; + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sec/rnc/web/EgovRlnmManageController.java b/src/main/java/egovframework/com/sec/rnc/web/EgovRlnmManageController.java new file mode 100644 index 0000000..3514e6d --- /dev/null +++ b/src/main/java/egovframework/com/sec/rnc/web/EgovRlnmManageController.java @@ -0,0 +1,198 @@ +package egovframework.com.sec.rnc.web; + +import java.net.URLDecoder; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; + +import egovframework.com.cmm.EgovWebUtil; +import egovframework.com.sec.rnc.service.EgovRlnmManageService; + +/** + * 실명인증관련 요청을 비지니스 클래스로 전달하고 처리된결과를 해당 웹 화면으로 전달하는 Controller를 정의한다 + * @author 공통서비스 개발팀 조재영 + * @since 2009.04.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *  수정일              수정자          수정내용
    + *  ----------  --------  ---------------------------
    + *  2009.04.10  조재영          최초 생성
    + *  2019.04.25  신용호          moveToPage() 화이트리스트 처리
    + *
    + * 
    + */ +@Controller +public class EgovRlnmManageController { + + /** rlnmManageService */ + @Resource(name = "rlnmManageService") + private EgovRlnmManageService rlnmManageService; + + @Resource(name = "egovPageLinkWhitelist") + protected List egovWhitelist; + + @Resource(name = "egovNextUrlWhitelist") + protected List nextUrlWhitelist; + + /** Log Info */ + private static final Logger LOGGER = LoggerFactory.getLogger(EgovRlnmManageController.class); + + /** + * 실명인증확인화면 호출(주민번호) + * @param model 모델 + * @return "egovframework/com/uss/umt/EgovStplatCnfirm" + * @exception Exception + */ + @RequestMapping("/sec/rnc/EgovRlnmCnfirm.do") + public String rlnmCnfirm(Model model, @RequestParam Map commandMap) throws Exception { + + model.addAttribute("ihidnum", (String) commandMap.get("ihidnum")); //주민번호 + model.addAttribute("realname", (String) commandMap.get("realname")); //사용자이름 + model.addAttribute("sbscrbTy", (String) commandMap.get("sbscrbTy")); //사용자유형 + model.addAttribute("nextUrlName", (String) commandMap.get("nextUrlName")); //다음단계버튼명(이동할 URL에 따른) + String nextUrl = (String) commandMap.get("nextUrl"); + if ( nextUrl == null ) nextUrl = ""; + model.addAttribute("nextUrl", nextUrl); //다음단계로 이동할 URL + String result = ""; + +// if ("".equals((String) commandMap.get("ihidnum"))) { +// result = "info.user.rlnmCnfirm"; +// model.addAttribute("result", result); //실명확인 결과 +// return "egovframework/com/sec/rnc/EgovRlnmCnfirm"; +// } +// +// try { +// result = rlnmManageService.rlnmCnfirm((String) commandMap.get("ihidnum"), (String) commandMap.get("realname"), (String) commandMap.get("sbscrbTy")); +// } finally { +// model.addAttribute("result_tmp", result + "__" + result.substring(0, 2)); +// if (result.substring(0, 2).equals("00")) { +// result = "success.user.rlnmCnfirm"; +// } else if (result.substring(0, 2).equals("01")) { +// result = "fail.user.rlnmCnfirm"; +// } else { +// result = "fail.user.connectFail"; +// } +// model.addAttribute("result", result); //실명확인 결과 +// +// } + + // 화이트 리스트 처리 + // whitelist목록에 있는 경우 결과가 true, 결과가 false인경우 FAIL처리 + if (nextUrlWhitelist.contains(nextUrl) == false) { + LOGGER.debug("nextUrl WhiteList Error! Please check whitelist!"); + nextUrl="egovframework/com/cmm/egovError"; + } + + // 안전한 경로 문자열로 조치 + nextUrl = EgovWebUtil.filePathBlackList(nextUrl); + + +// return "egovframework/com/sec/rnc/EgovRlnmCnfirm"; + // 실명인증기능 미탑재로 바로 회원가입 페이지로 이동. + return "forward:" + nextUrl; + } + + /** + * 실명인증확인화면 호출(GPIN) + * @param model 모델 + * @return "egovframework/com/uss/umt/EgovStplatCnfirm" + * @exception Exception + */ + @RequestMapping("/sec/rnc/EgovRlnmPinCnfirm.do") + public String rlnmPinCnfirm(Model model, @RequestParam Map commandMap, HttpServletRequest request) throws Exception { + model.addAttribute("sbscrbTy", (String) commandMap.get("sbscrbTy")); //사용자유형 + model.addAttribute("nextUrlName", (String) commandMap.get("nextUrlName")); //다음단계버튼명(이동할 URL에 따른) + model.addAttribute("nextUrl", (String) commandMap.get("nextUrl")); //다음단계로 이동할 URL + String realName = (String) commandMap.get("realName"); //결과_최초는 블랭크 + String result = (String) commandMap.get("result"); //결과_최초는 블랭크 + + LOGGER.debug("realName: {}", realName); + + if ("".equals(result) && "".equals(realName)) { + result = "info.user.rlnmPinCnfirm"; + model.addAttribute("result", result); //실명확인 결과 + } else { + if (!realName.equals("null") && !realName.equals("")) { + result = "success.user.rlnmPinCnfirm"; + model.addAttribute("result", result); //실명확인 결과 메시지 + realName = URLDecoder.decode(realName, "UTF-8"); // gpin배포샘플은 기본인코딩이 euc-kr + model.addAttribute("realName", realName); //실명확인 결과 이름 + //return "forward:"+(String)commandMap.get("nextUrl"); 성공시만 체크하여 직접 다음 URL로 이동할수도 있음 + } else { + result = "fail.user.rlnmPinCnfirm"; + model.addAttribute("result", result); //실명확인 결과 메시지 + realName = new String(realName.getBytes("UTF-8"), "EUC-KR"); // gpin배포샘플은 기본인코딩이 euc-kr + model.addAttribute("realName", realName); //실명확인 결과 이름 + } + } + LOGGER.debug("result: {}", result); + + return "egovframework/com/sec/rnc/EgovRlnmPinCnfirm"; + } + + /** + * 실명인증확인화면 호출(GPIN) + * @param model 모델 + * @return "egovframework/com/uss/umt/EgovStplatCnfirm" + * @exception Exception + */ + @RequestMapping("/sec/rnc/EgovGPinCall.do") + public String gpinCall(Model model, @RequestParam Map commandMap) throws Exception { + model.addAttribute("gpinId", (String) commandMap.get("gpinId")); //GPIN 아이디 + model.addAttribute("gpinPassword", (String) commandMap.get("gpinPassword")); //GPIN 패스워드 + model.addAttribute("sbscrbTy", (String) commandMap.get("sbscrbTy")); //사용자유형 + //model.addAttribute("urlName", (String)commandMap.get("urlName")); //다음단계버튼명(이동할 URL에 따른) + //model.addAttribute("urlInfo", (String)commandMap.get("urlInfo")); //다음단계로 이동할 URL + model.addAttribute("nextUrlName", (String) commandMap.get("nextUrlName")); //다음단계버튼명(이동할 URL에 따른) + model.addAttribute("nextUrl", (String) commandMap.get("nextUrl")); //다음단계로 이동할 URL + + return "egovframework/com/sec/rnc/gpin/Sample-AuthRequest"; + } + + /** + * validato rule dynamic Javascript + */ + @RequestMapping("/sec/rnc/validator.do") + public String validate() { + return "egovframework/com/cmm/validator"; + } + + /** + * JSP 호출작업만 처리하는 공통 함수 + */ + @RequestMapping(value = "/sec/rnc/EgovPageLink.do") + public String moveToPage(@RequestParam("link") String linkPage) { + // service 사용하여 리턴할 결과값 처리하는 부분은 생략하고 단순 페이지 링크만 처리함 + String link = linkPage; + link = link.replace(";", ""); + link = link.replace(".", ""); + if (link == null || link.equals("")) { + link = "egovframework/com/cmm/egovError"; + } + + // 화이트 리스트 처리 + // whitelist목록에 있는 경우 결과가 true, 결과가 false인경우 FAIL처리 + if (egovWhitelist.contains(link) == false) { + LOGGER.debug("Page Link WhiteList Error! Please check whitelist!"); + link="egovframework/com/cmm/egovError"; + } + + // 안전한 경로 문자열로 조치 + link = EgovWebUtil.filePathBlackList(link); + + return link; + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sec/security/common/EgovSessionMapping.java b/src/main/java/egovframework/com/sec/security/common/EgovSessionMapping.java new file mode 100644 index 0000000..e87ff35 --- /dev/null +++ b/src/main/java/egovframework/com/sec/security/common/EgovSessionMapping.java @@ -0,0 +1,82 @@ +package egovframework.com.sec.security.common; + +import java.sql.ResultSet; +import java.sql.SQLException; + +import egovframework.com.cmm.LoginVO; + +import org.egovframe.rte.fdl.security.userdetails.EgovUserDetails; +import org.egovframe.rte.fdl.security.userdetails.jdbc.EgovUsersByUsernameMapping; + +import javax.sql.DataSource; + +/** + * mapRow 결과를 사용자 EgovUserDetails Object 에 정의한다. + * + * @author ByungHun Woo + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    -------------    ----------------------
    + *   2009.03.10  ByungHun Woo    최초 생성
    + *   2009.03.20  이문준          UPDATE
    + *
    + * 
    + */ + +public class EgovSessionMapping extends EgovUsersByUsernameMapping { + + /** + * 사용자정보를 테이블에서 조회하여 EgovUsersByUsernameMapping 에 매핑한다. + * @param ds DataSource + * @param usersByUsernameQuery String + */ + public EgovSessionMapping(DataSource ds, String usersByUsernameQuery) { + super(ds, usersByUsernameQuery); + } + + /** + * mapRow Override + * @param rs ResultSet 결과 + * @param rownum row num + * @return Object EgovUserDetails + * @exception SQLException + */ + @Override + protected EgovUserDetails mapRow(ResultSet rs, int rownum) throws SQLException { + logger.debug("## EgovUsersByUsernameMapping mapRow ##"); + + String strUserId = rs.getString("user_id"); + String strPassWord = rs.getString("password"); + boolean strEnabled = rs.getBoolean("enabled"); + + String strUserNm = rs.getString("user_nm"); + String strUserSe = rs.getString("user_se"); + String strUserEmail = rs.getString("user_email"); + String strOrgnztId = rs.getString("orgnzt_id"); + String strUniqId = rs.getString("esntl_id"); + /**2010.06.30 *이용 *조직명 추가 */ + String strOrgnztNm = rs.getString("orgnzt_nm"); + + + + // 세션 항목 설정 + LoginVO loginVO = new LoginVO(); + loginVO.setId(strUserId); + loginVO.setPassword(strPassWord); + loginVO.setName(strUserNm); + loginVO.setUserSe(strUserSe); + loginVO.setEmail(strUserEmail); + loginVO.setOrgnztId(strOrgnztId); + loginVO.setUniqId(strUniqId); + /**2010.06.30 *이용 *조직명 추가 */ + loginVO.setOrgnztNm(strOrgnztNm); + + return new EgovUserDetails(strUserId, strPassWord, strEnabled, loginVO); + } +} diff --git a/src/main/java/egovframework/com/sec/security/filter/EgovSpringSecurityLoginFilter.java b/src/main/java/egovframework/com/sec/security/filter/EgovSpringSecurityLoginFilter.java new file mode 100644 index 0000000..9b02b13 --- /dev/null +++ b/src/main/java/egovframework/com/sec/security/filter/EgovSpringSecurityLoginFilter.java @@ -0,0 +1,322 @@ +package egovframework.com.sec.security.filter; + +import java.io.IOException; +import java.util.Map; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletRequestWrapper; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.ApplicationContext; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; +import org.springframework.security.web.util.matcher.AntPathRequestMatcher; +import org.springframework.web.context.support.WebApplicationContextUtils; + +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.config.EgovLoginConfig; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uat.uia.service.EgovLoginService; +import org.egovframe.rte.psl.dataaccess.util.EgovMap; + +/** + * + * @author 공통서비스 개발팀 서준식 + * @since 2011. 8. 29. + * @version 1.0 + * @see + * + *
    + * 개정이력(Modification Information)
    + *
    + *  수정일               수정자        	 수정내용
    + *  ----------   --------   ---------------------------
    + *  2011.08.29   서준식            최초생성
    + *  2011.12.12   유지보수         사용자 로그인 정보 간섭 가능성 문제(멤버 변수 EgovUserDetails userDetails를 로컬변수로 변경)
    + *  2014.03.07   유지보수         로그인된 상태에서 다시 로그인 시 미처리 되는 문제 수정 (로그인 처리 URL 파라미터화)
    + *  2017.03.03 	  조성원 	       시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754]
    + *  2017.07.10   장동한            실행환경 v3.7(Spring Security 4.0.3 적용)
    + *  2017.07.21 	  장동한 		로그인인증제한 작업
    + *  2020.06.25 	  신용호 		로그인 메시지 처리 수정
    + *
    + *  
    + */ + +public class EgovSpringSecurityLoginFilter implements Filter { + + private FilterConfig config; + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovSpringSecurityLoginFilter.class); + + public void destroy() { + } + + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { + + LOGGER.info("EgovSpringSecurityLoginFilter called..."); + + // 로그인 URL + String loginURL = config.getInitParameter("loginURL"); + loginURL = loginURL.replaceAll("\r", "").replaceAll("\n", ""); + + String loginProcessURL = config.getInitParameter("loginProcessURL"); + loginProcessURL = loginProcessURL.replaceAll("\r", "").replaceAll("\n", ""); + + ApplicationContext act = WebApplicationContextUtils.getRequiredWebApplicationContext(config.getServletContext()); + EgovLoginService loginService = (EgovLoginService) act.getBean("loginService"); + EgovLoginConfig egovLoginConfig = (EgovLoginConfig) act.getBean("egovLoginConfig"); + + EgovMessageSource egovMessageSource = (EgovMessageSource) act.getBean("egovMessageSource"); + + HttpServletRequest httpRequest = (HttpServletRequest) request; + HttpServletResponse httpResponse = (HttpServletResponse) response; + HttpSession session = httpRequest.getSession(); + //String isLocallyAuthenticated = (String)session.getAttribute("isLocallyAuthenticated"); + String isRemotelyAuthenticated = (String) session.getAttribute("isRemotelyAuthenticated"); + + String requestURL = ((HttpServletRequest) request).getRequestURI(); + + //스프링 시큐리티 인증이 처리 되었는지 EgovUserDetailsHelper.getAuthenticatedUser() 메서드를 통해 확인한다. + //context-common.xml 빈 설정에 egovUserDetailsSecurityService를 등록 해서 사용해야 정상적으로 동작한다. + if (EgovUserDetailsHelper.getAuthenticatedUser() == null || requestURL.contains(loginProcessURL)) + { + + if (isRemotelyAuthenticated != null && isRemotelyAuthenticated.equals("true")) + { + try { + //세션 토큰 정보를 가지고 DB로부터 사용자 정보를 가져옴 + LoginVO loginVO = (LoginVO) session.getAttribute("loginVOForDBAuthentication"); + loginVO = loginService.actionLoginByEsntlId(loginVO); + + if (loginVO != null && loginVO.getId() != null && !loginVO.getId().equals("")) { + //세션 로그인 + session.setAttribute("loginVO", loginVO); + + //로컬 인증결과 세션에 저장 + session.setAttribute("isLocallyAuthenticated", "true"); + + //스프링 시큐리티 로그인 + //httpResponse.sendRedirect(httpRequest.getContextPath() + "/j_spring_security_check?j_username=" + loginVO.getUserSe() + loginVO.getId() + "&j_password=" + loginVO.getUniqId()); + + UsernamePasswordAuthenticationFilter springSecurity = null; + + Map beans = act.getBeansOfType(UsernamePasswordAuthenticationFilter.class); + if (beans.size() > 0) { + springSecurity = (UsernamePasswordAuthenticationFilter) beans.values().toArray()[0]; + springSecurity.setUsernameParameter("egov_security_username"); + springSecurity.setPasswordParameter("egov_security_password"); + springSecurity.setRequiresAuthenticationRequestMatcher(new AntPathRequestMatcher(request.getServletContext().getContextPath() +"/egov_security_login", "POST")); + } else { + LOGGER.error("No AuthenticationProcessingFilter"); + throw new IllegalStateException("No AuthenticationProcessingFilter"); + } + //springSecurity.setContinueChainBeforeSuccessfulAuthentication(false); // false 이면 chain 처리 되지 않음.. (filter가 아닌 경우 false로...) + + LOGGER.debug("before security filter call...."); + springSecurity.doFilter(new RequestWrapperForSecurity(httpRequest, loginVO.getUserSe() + loginVO.getId(), loginVO.getUniqId()), httpResponse, chain); + LOGGER.debug("after security filter call...."); + + } + //2017.03.03 조성원 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + } + catch(IllegalArgumentException e) { + LOGGER.error("[IllegalArgumentException] Try/Catch...usingParameters Runing : "+ e.getMessage()); + } catch(Exception e) { + LOGGER.error("["+e.getClass()+"] Try/Catch...Exception : " + e.getMessage()); + } + + } + else if (isRemotelyAuthenticated == null) + { + if (requestURL.contains(loginProcessURL)) { + + String password = httpRequest.getParameter("password"); + String id = httpRequest.getParameter("id"); + + // 보안점검 후속 조치(Password 검증) + if ((id == null || "".equals(id)) && (password == null || "".equals(password))) { + RequestDispatcher dispatcher = httpRequest.getRequestDispatcher(loginURL); + httpRequest.setAttribute("loginMessage", ""); + dispatcher.forward(httpRequest, httpResponse); + //chain.doFilter(request, response); + return; + } + else if (password == null || password.equals("") || password.length() < 8 || password.length() > 20) { + httpRequest.setAttribute("loginMessage", egovMessageSource.getMessage("fail.common.login.password",request.getLocale())); + RequestDispatcher dispatcher = httpRequest.getRequestDispatcher(loginURL); + + dispatcher.forward(httpRequest, httpResponse); + //chain.doFilter(request, response); + return; + } + + LoginVO loginVO = new LoginVO(); + + loginVO.setId(httpRequest.getParameter("id")); + loginVO.setPassword(password); + loginVO.setUserSe(httpRequest.getParameter("userSe")); + + //------------------------------------------------------------------ + // 로그인시 로그인인증제한 활성화 처리 + //------------------------------------------------------------------ + if(egovLoginConfig.isLock()) + { + try + { + Map mapLockUserInfo = (EgovMap)loginService.selectLoginIncorrect(loginVO); + if(mapLockUserInfo != null) + { + // 로그인인증제한 처리 + String sLoginIncorrectCode = loginService.processLoginIncorrect(loginVO, mapLockUserInfo); + if(!sLoginIncorrectCode.equals("E")) + { + if(sLoginIncorrectCode.equals("L")) + { + request.setAttribute("loginMessage", egovMessageSource.getMessageArgs("fail.common.loginIncorrect", new Object[] {egovLoginConfig.getLockCount(),request.getLocale()})); + } + else if(sLoginIncorrectCode.equals("C")) + { + request.setAttribute("loginMessage", egovMessageSource.getMessage("fail.common.login",request.getLocale())); + } + httpRequest.getRequestDispatcher(loginURL).forward(request, response); + return; + } + } + else + { + request.setAttribute("loginMessage", egovMessageSource.getMessage("fail.common.login",request.getLocale())); + httpRequest.getRequestDispatcher(loginURL).forward(request, response); + return; + } + } + catch(IllegalArgumentException e) + { + LOGGER.error("[IllegalArgumentException] : "+ e.getMessage()); + } + catch(Exception ex) + { + LOGGER.error("Login Exception : {}", ex.getCause(), ex); + httpRequest.setAttribute("loginMessage", egovMessageSource.getMessage("fail.common.login",request.getLocale())); + RequestDispatcher dispatcher = httpRequest.getRequestDispatcher(loginURL); + dispatcher.forward(httpRequest, httpResponse); + } + } + + //------------------------------------------------------------------ + // 사용자 로그인 처리 + //------------------------------------------------------------------ + try { + //사용자 입력 id, password로 DB 인증을 실행함 + loginVO = loginService.actionLogin(loginVO); + //사용자 IP 기록 + loginVO.setIp(request.getRemoteAddr()); + if (loginVO != null && loginVO.getId() != null && !loginVO.getId().equals("")) { + //세션 로그인 + session.setAttribute("loginVO", loginVO); + + //로컬 인증결과 세션에 저장 + session.setAttribute("isLocallyAuthenticated", "true"); + + //스프링 시큐리티 로그인 + //httpResponse.sendRedirect(httpRequest.getContextPath() + "/j_spring_security_check?j_username=" + loginVO.getUserSe() + loginVO.getId() + "&j_password=" + loginVO.getUniqId()); + + UsernamePasswordAuthenticationFilter springSecurity = null; + + Map beans = act.getBeansOfType(UsernamePasswordAuthenticationFilter.class); + if (beans.size() > 0) { + springSecurity = (UsernamePasswordAuthenticationFilter) beans.values().toArray()[0]; + springSecurity.setUsernameParameter("egov_security_username"); + springSecurity.setPasswordParameter("egov_security_password"); + springSecurity.setRequiresAuthenticationRequestMatcher(new AntPathRequestMatcher(request.getServletContext().getContextPath() +"/egov_security_login", "POST")); + } else { + LOGGER.error("No AuthenticationProcessingFilter"); + throw new IllegalStateException("No AuthenticationProcessingFilter"); + } + //springSecurity.setContinueChainBeforeSuccessfulAuthentication(false); // false 이면 chain 처리 되지 않음.. (filter가 아닌 경우 false로...) + + LOGGER.debug("before security filter call...."); + springSecurity.doFilter(new RequestWrapperForSecurity(httpRequest, loginVO.getUserSe() + loginVO.getId(), loginVO.getUniqId()), httpResponse, chain); + LOGGER.debug("after security filter call...."); + + } else { + //사용자 정보가 없는 경우 로그인 화면으로 redirect 시킴 + httpRequest.setAttribute("loginMessage", egovMessageSource.getMessage("fail.common.login",request.getLocale())); + RequestDispatcher dispatcher = httpRequest.getRequestDispatcher(loginURL); + dispatcher.forward(httpRequest, httpResponse); + + //chain.doFilter(request, response); + + return; + + } + } catch(IllegalArgumentException e) { + LOGGER.error("[IllegalArgumentException] : "+ e.getMessage()); + } catch (Exception ex) { + //DB인증 예외가 발생할 경우 로그인 화면으로 redirect 시킴 + LOGGER.error("Login Exception : {}", ex.getCause(), ex); + httpRequest.setAttribute("loginMessage", egovMessageSource.getMessage("fail.common.login",request.getLocale())); + RequestDispatcher dispatcher = httpRequest.getRequestDispatcher(loginURL); + dispatcher.forward(httpRequest, httpResponse); + //chain.doFilter(request, response); + + return; + + } + return; + } + + } + } + + chain.doFilter(request, response); + } + + public void init(FilterConfig filterConfig) throws ServletException { + this.config = filterConfig; + } +} + +class RequestWrapperForSecurity extends HttpServletRequestWrapper { + private String username = null; + private String password = null; + + public RequestWrapperForSecurity(HttpServletRequest request, String username, String password) { + super(request); + + this.username = username; + this.password = password; + } + + @Override + public String getServletPath() { + return ((HttpServletRequest) super.getRequest()).getContextPath() + "/egov_security_login"; + } + + @Override + public String getRequestURI() { + return ((HttpServletRequest) super.getRequest()).getContextPath() + "/egov_security_login"; + } + + @Override + public String getParameter(String name) { + if (name.equals("egov_security_username")) { + return username; + } + + if (name.equals("egov_security_password")) { + return password; + } + + return super.getParameter(name); + } +} diff --git a/src/main/java/egovframework/com/sec/security/filter/EgovSpringSecurityLogoutFilter.java b/src/main/java/egovframework/com/sec/security/filter/EgovSpringSecurityLogoutFilter.java new file mode 100644 index 0000000..f53b784 --- /dev/null +++ b/src/main/java/egovframework/com/sec/security/filter/EgovSpringSecurityLogoutFilter.java @@ -0,0 +1,62 @@ +package egovframework.com.sec.security.filter; + +import java.io.IOException; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * + * @author 공통서비스 개발팀 서준식 + * @since 2011. 8. 29. + * @version 1.0 + * @see + * + *
    + * 개정이력(Modification Information)
    + *
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2011. 8. 29.    서준식        최초생성
    + *  2017.07.10      장동한       실행환경 v3.7(Spring Security 4.0.3 적용)
    + *
    + *  
    + */ + +public class EgovSpringSecurityLogoutFilter implements Filter{ + + @SuppressWarnings("unused") + private FilterConfig config; + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovSpringSecurityLogoutFilter.class); + + public void destroy() {} + + + public void doFilter(ServletRequest request, ServletResponse response, + FilterChain chain) throws IOException, ServletException { + + String requestURL = ((HttpServletRequest)request).getRequestURI(); + LOGGER.debug(requestURL); + + ((HttpServletRequest)request).getSession().setAttribute("loginVO", null); + ((HttpServletResponse)response).sendRedirect(((HttpServletRequest)request).getContextPath() + "/egov_security_logout"); + + } + + public void init(FilterConfig filterConfig) throws ServletException { + + this.config = filterConfig; + + } +} diff --git a/src/main/java/egovframework/com/sym/cal/service/EgovCalRestdeManageService.java b/src/main/java/egovframework/com/sym/cal/service/EgovCalRestdeManageService.java new file mode 100644 index 0000000..1e3af27 --- /dev/null +++ b/src/main/java/egovframework/com/sym/cal/service/EgovCalRestdeManageService.java @@ -0,0 +1,132 @@ +package egovframework.com.sym.cal.service; + +import java.util.List; + +/** + * + * 휴일에 관한 서비스 인터페이스 클래스를 정의한다 + * @author 공통서비스 개발팀 이중호 + * @since 2009.04.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.01  이중호          최초 생성
    + *
    + * 
    + */ +public interface EgovCalRestdeManageService { + + /** + * 일반달력 팝업 정보를 조회한다. + * @param restde + * @return List(일반달력 팝업 날짜정보) + * @throws Exception + */ + List selectNormalRestdePopup(Restde restde) throws Exception; + + /** + * 행정달력 팝업 정보를 조회한다. + * @param restde + * @return List(행정달력 팝업 날짜정보) + * @throws Exception + */ + List selectAdministRestdePopup(Restde restde) throws Exception; + + /** + * 일반달력 일간 정보를 조회한다. + * @param restde + * @return List(일반달력 일간 날짜정보) + * @throws Exception + */ + List selectNormalDayCal(Restde restde) throws Exception; + + /** + * 일반달력 일간 휴일을 조회한다. + * @param restde + * @return List(일반달력 일간 휴일정보) + * @throws Exception + */ + List selectNormalDayRestde(Restde restde) throws Exception; + + /** + * 일반달력 월간 휴일을 조회한다. + * @param restde + * @return List(일반달력 월간 휴일정보) + * @throws Exception + */ + List selectNormalMonthRestde(Restde restde) throws Exception; + + /** + * 행정달력 일간 정보를 조회한다. + * @param restde + * @return List(행정달력 일간 날짜정보) + * @throws Exception + */ + List selectAdministDayCal(Restde restde) throws Exception; + + /** + * 행정달력 일간 휴일을 조회한다. + * @param restde + * @return List(행정달력 일간 휴일정보) + * @throws Exception + */ + List selectAdministDayRestde(Restde restde) throws Exception; + + /** + * 행정달력 월간 휴일을 조회한다. + * @param restde + * @return List(행정달력 월간 휴일정보) + * @throws Exception + */ + List selectAdministMonthRestde(Restde restde) throws Exception; + + /** + * 휴일을 삭제한다. + * @param restde + * @throws Exception + */ + void deleteRestde(Restde restde) throws Exception; + + /** + * 휴일을 등록한다. + * @param restde + * @throws Exception + */ + void insertRestde(Restde restde) throws Exception; + + /** + * 휴일 상세항목을 조회한다. + * @param restde + * @return Restde(휴일) + * @throws Exception + */ + Restde selectRestdeDetail(Restde restde) throws Exception; + + /** + * 휴일 목록을 조회한다. + * @param searchVO + * @return List(휴일 목록) + * @throws Exception + */ + List selectRestdeList(RestdeVO searchVO) throws Exception; + + /** + * 휴일 총 갯수를 조회한다. + * @param searchVO + * @return int(휴일 총 갯수) + */ + int selectRestdeListTotCnt(RestdeVO searchVO) throws Exception; + + /** + * 휴일을 수정한다. + * @param restde + * @throws Exception + */ + void updateRestde(Restde restde) throws Exception; + +} diff --git a/src/main/java/egovframework/com/sym/cal/service/Restde.java b/src/main/java/egovframework/com/sym/cal/service/Restde.java new file mode 100644 index 0000000..dde9021 --- /dev/null +++ b/src/main/java/egovframework/com/sym/cal/service/Restde.java @@ -0,0 +1,404 @@ +package egovframework.com.sym.cal.service; + +import java.io.Serializable; + +/** + * 휴일 모델 클래스 + * @author 공통서비스 개발팀 이중호 + * @since 2009.04.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.01  이중호          최초 생성
    + *
    + * 
    + */ +public class Restde implements Serializable { + + private static final long serialVersionUID = -8509545779844669658L; + + /* + * 휴일번호 + */ + private int restdeNo = 0; + + /* + * 휴일일자 + */ + private String restdeDe = ""; + + /* + * 휴일명 + */ + private String restdeNm = ""; + + /* + * 휴일설명 + */ + private String restdeDc = ""; + + /* + * 휴일구분 + */ + private String restdeSe = ""; + + /* + * 휴일구분코드 + */ + private String restdeSeCode = ""; + + /* + * 최초등록자ID + */ + private String frstRegisterId = ""; + + /* + * 최종수정자ID + */ + private String lastUpdusrId = ""; + + /* + * 년 + */ + private String year = ""; + + /* + * 월 + */ + private String month = ""; + + /* + * 일 + */ + private String day = ""; + + /* + * 휴일여부 + */ + private String restdeAt = ""; + + /* + * 달력셀 + */ + private int cellNum = 0; + + /* + * 월별 주순위 + */ + private int weeks = 0; + + /* + * 월 주수 + */ + private int maxWeeks = 0; + + /* + * 요일 + */ + private int week = 0; + + /* + * 시작요일 + */ + private int startWeekMonth = 0; + + /* + * 마지막 일자 + */ + private int lastDayMonth = 0; + + /** + * restdeNo attribute 를 리턴한다. + * @return int + */ + public int getRestdeNo() { + return restdeNo; + } + + /** + * restdeNo attribute 값을 설정한다. + * @param restdeNo int + */ + public void setRestdeNo(int restdeNo) { + this.restdeNo = restdeNo; + } + + /** + * restdeDe attribute 를 리턴한다. + * @return String + */ + public String getRestdeDe() { + return restdeDe; + } + + /** + * restdeDe attribute 값을 설정한다. + * @param restdeDe String + */ + public void setRestdeDe(String restdeDe) { + this.restdeDe = restdeDe; + } + + /** + * restdeNm attribute 를 리턴한다. + * @return String + */ + public String getRestdeNm() { + return restdeNm; + } + + /** + * restdeNm attribute 값을 설정한다. + * @param restdeNm String + */ + public void setRestdeNm(String restdeNm) { + this.restdeNm = restdeNm; + } + + /** + * restdeDc attribute 를 리턴한다. + * @return String + */ + public String getRestdeDc() { + return restdeDc; + } + + /** + * restdeDc attribute 값을 설정한다. + * @param restdeDc String + */ + public void setRestdeDc(String restdeDc) { + this.restdeDc = restdeDc; + } + + /** + * restdeSe attribute 를 리턴한다. + * @return String + */ + public String getRestdeSe() { + return restdeSe; + } + + /** + * restdeSe attribute 값을 설정한다. + * @param restdeSe String + */ + public void setRestdeSe(String restdeSe) { + this.restdeSe = restdeSe; + } + + /** + * restdeSeCode attribute 를 리턴한다. + * @return String + */ + public String getRestdeSeCode() { + return restdeSeCode; + } + + /** + * restdeSeCode attribute 값을 설정한다. + * @param restdeSeCode String + */ + public void setRestdeSeCode(String restdeSeCode) { + this.restdeSeCode = restdeSeCode; + } + + /** + * frstRegisterId attribute 를 리턴한다. + * @return String + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * frstRegisterId attribute 값을 설정한다. + * @param frstRegisterId String + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * lastUpdusrId attribute 를 리턴한다. + * @return String + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * lastUpdusrId attribute 값을 설정한다. + * @param lastUpdusrId String + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + /** + * year attribute 를 리턴한다. + * @return String + */ + public String getYear() { + return year; + } + + /** + * year attribute 값을 설정한다. + * @param year String + */ + public void setYear(String year) { + this.year = year; + } + + /** + * month attribute 를 리턴한다. + * @return String + */ + public String getMonth() { + return month; + } + + /** + * month attribute 값을 설정한다. + * @param month String + */ + public void setMonth(String month) { + this.month = month; + } + + /** + * day attribute 를 리턴한다. + * @return String + */ + public String getDay() { + return day; + } + + /** + * day attribute 값을 설정한다. + * @param day String + */ + public void setDay(String day) { + this.day = day; + } + + /** + * restdeAt attribute 를 리턴한다. + * @return String + */ + public String getRestdeAt() { + return restdeAt; + } + + /** + * restdeAt attribute 값을 설정한다. + * @param restdeAt String + */ + public void setRestdeAt(String restdeAt) { + this.restdeAt = restdeAt; + } + + /** + * cellNum attribute 를 리턴한다. + * @return int + */ + public int getCellNum() { + return cellNum; + } + + /** + * cellNum attribute 값을 설정한다. + * @param cellNum int + */ + public void setCellNum(int cellNum) { + this.cellNum = cellNum; + } + + /** + * weeks attribute 를 리턴한다. + * @return int + */ + public int getWeeks() { + return weeks; + } + + /** + * weeks attribute 값을 설정한다. + * @param weeks int + */ + public void setWeeks(int weeks) { + this.weeks = weeks; + } + + /** + * maxWeeks attribute 를 리턴한다. + * @return int + */ + public int getMaxWeeks() { + return maxWeeks; + } + + /** + * maxWeeks attribute 값을 설정한다. + * @param maxWeeks int + */ + public void setMaxWeeks(int maxWeeks) { + this.maxWeeks = maxWeeks; + } + + /** + * week attribute 를 리턴한다. + * @return int + */ + public int getWeek() { + return week; + } + + /** + * week attribute 값을 설정한다. + * @param week int + */ + public void setWeek(int week) { + this.week = week; + } + + /** + * startWeekMonth attribute 를 리턴한다. + * @return int + */ + public int getStartWeekMonth() { + return startWeekMonth; + } + + /** + * startWeekMonth attribute 값을 설정한다. + * @param startWeekMonth int + */ + public void setStartWeekMonth(int startWeekMonth) { + this.startWeekMonth = startWeekMonth; + } + + /** + * lastDayMonth attribute 를 리턴한다. + * @return int + */ + public int getLastDayMonth() { + return lastDayMonth; + } + + /** + * lastDayMonth attribute 값을 설정한다. + * @param lastDayMonth int + */ + public void setLastDayMonth(int lastDayMonth) { + this.lastDayMonth = lastDayMonth; + } + + +} diff --git a/src/main/java/egovframework/com/sym/cal/service/RestdeVO.java b/src/main/java/egovframework/com/sym/cal/service/RestdeVO.java new file mode 100644 index 0000000..5e732a4 --- /dev/null +++ b/src/main/java/egovframework/com/sym/cal/service/RestdeVO.java @@ -0,0 +1,199 @@ +package egovframework.com.sym.cal.service; + +import java.io.Serializable; + +/** + * + * 휴일 VO 클래스 + * @author 공통서비스 개발팀 이중호 + * @since 2009.04.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.01  이중호          최초 생성
    + *
    + * 
    + */ +public class RestdeVO extends Restde implements Serializable { + + private static final long serialVersionUID = 2548377950888283294L; + + /** 검색조건 */ + private String searchCondition = ""; + + /** 검색Keyword */ + private String searchKeyword = ""; + + /** 검색사용여부 */ + private String searchUseYn = ""; + + /** 현재페이지 */ + private int pageIndex = 1; + + /** 페이지갯수 */ + private int pageUnit = 10; + + /** 페이지사이즈 */ + private int pageSize = 10; + + /** firstIndex */ + private int firstIndex = 1; + + /** lastIndex */ + private int lastIndex = 1; + + /** recordCountPerPage */ + private int recordCountPerPage = 10; + + /** + * searchCondition attribute 를 리턴한다. + * @return String + */ + public String getSearchCondition() { + return searchCondition; + } + + /** + * searchCondition attribute 값을 설정한다. + * @param searchCondition String + */ + public void setSearchCondition(String searchCondition) { + this.searchCondition = searchCondition; + } + + /** + * searchKeyword attribute 를 리턴한다. + * @return String + */ + public String getSearchKeyword() { + return searchKeyword; + } + + /** + * searchKeyword attribute 값을 설정한다. + * @param searchKeyword String + */ + public void setSearchKeyword(String searchKeyword) { + this.searchKeyword = searchKeyword; + } + + /** + * searchUseYn attribute 를 리턴한다. + * @return String + */ + public String getSearchUseYn() { + return searchUseYn; + } + + /** + * searchUseYn attribute 값을 설정한다. + * @param searchUseYn String + */ + public void setSearchUseYn(String searchUseYn) { + this.searchUseYn = searchUseYn; + } + + /** + * pageIndex attribute 를 리턴한다. + * @return int + */ + public int getPageIndex() { + return pageIndex; + } + + /** + * pageIndex attribute 값을 설정한다. + * @param pageIndex int + */ + public void setPageIndex(int pageIndex) { + this.pageIndex = pageIndex; + } + + /** + * pageUnit attribute 를 리턴한다. + * @return int + */ + public int getPageUnit() { + return pageUnit; + } + + /** + * pageUnit attribute 값을 설정한다. + * @param pageUnit int + */ + public void setPageUnit(int pageUnit) { + this.pageUnit = pageUnit; + } + + /** + * pageSize attribute 를 리턴한다. + * @return int + */ + public int getPageSize() { + return pageSize; + } + + /** + * pageSize attribute 값을 설정한다. + * @param pageSize int + */ + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + /** + * firstIndex attribute 를 리턴한다. + * @return int + */ + public int getFirstIndex() { + return firstIndex; + } + + /** + * firstIndex attribute 값을 설정한다. + * @param firstIndex int + */ + public void setFirstIndex(int firstIndex) { + this.firstIndex = firstIndex; + } + + /** + * lastIndex attribute 를 리턴한다. + * @return int + */ + public int getLastIndex() { + return lastIndex; + } + + /** + * lastIndex attribute 값을 설정한다. + * @param lastIndex int + */ + public void setLastIndex(int lastIndex) { + this.lastIndex = lastIndex; + } + + /** + * recordCountPerPage attribute 를 리턴한다. + * @return int + */ + public int getRecordCountPerPage() { + return recordCountPerPage; + } + + /** + * recordCountPerPage attribute 값을 설정한다. + * @param recordCountPerPage int + */ + public void setRecordCountPerPage(int recordCountPerPage) { + this.recordCountPerPage = recordCountPerPage; + } + + + +} diff --git a/src/main/java/egovframework/com/sym/cal/service/impl/EgovCalRestdeManageServiceImpl.java b/src/main/java/egovframework/com/sym/cal/service/impl/EgovCalRestdeManageServiceImpl.java new file mode 100644 index 0000000..5f26f4e --- /dev/null +++ b/src/main/java/egovframework/com/sym/cal/service/impl/EgovCalRestdeManageServiceImpl.java @@ -0,0 +1,153 @@ +package egovframework.com.sym.cal.service.impl; + +import java.util.List; + +import egovframework.com.sym.cal.service.EgovCalRestdeManageService; +import egovframework.com.sym.cal.service.Restde; +import egovframework.com.sym.cal.service.RestdeVO; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + + + +/** + * + * 휴일에 대한 서비스 구현클래스를 정의한다 + * @author 공통서비스 개발팀 이중호 + * @since 2009.04.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.01  이중호          최초 생성
    + *
    + * 
    + */ +@Service("RestdeManageService") +public class EgovCalRestdeManageServiceImpl extends EgovAbstractServiceImpl implements EgovCalRestdeManageService { + + @Resource(name="RestdeManageDAO") + private RestdeManageDAO restdeManageDAO; + + /** + * 일반달력 팝업 정보를 조회한다. + */ + @Override + public List selectNormalRestdePopup(Restde restde) throws Exception { + return restdeManageDAO.selectNormalRestdePopup(restde); + } + + /** + * 행정달력 팝업 정보를 조회한다. + */ + @Override + public List selectAdministRestdePopup(Restde restde) throws Exception { + return restdeManageDAO.selectAdministRestdePopup(restde); + } + + /** + * 일반달력 일간 정보를 조회한다. + */ + @Override + public List selectNormalDayCal(Restde restde) throws Exception { + return restdeManageDAO.selectNormalDayCal(restde); + } + + /** + * 일반달력 일간 휴일을 조회한다. + */ + @Override + public List selectNormalDayRestde(Restde restde) throws Exception { + return restdeManageDAO.selectNormalDayRestde(restde); + } + + /** + * 일반달력 월간 휴일을 조회한다. + */ + @Override + public List selectNormalMonthRestde(Restde restde) throws Exception { + return restdeManageDAO.selectNormalMonthRestde(restde); + } + + /** + * 행정달력 일간 정보를 조회한다. + */ + @Override + public List selectAdministDayCal(Restde restde) throws Exception { + return restdeManageDAO.selectAdministDayCal(restde); + } + + /** + * 행정달력 일간 휴일을 조회한다. + */ + @Override + public List selectAdministDayRestde(Restde restde) throws Exception { + return restdeManageDAO.selectAdministDayRestde(restde); + } + + /** + * 행정달력 월간 휴일을 조회한다. + */ + @Override + public List selectAdministMonthRestde(Restde restde) throws Exception { + return restdeManageDAO.selectAdministMonthRestde(restde); + } + + /** + * 휴일을 삭제한다. + */ + @Override + public void deleteRestde(Restde restde) throws Exception { + restdeManageDAO.deleteRestde(restde); + } + + /** + * 휴일을 등록한다. + */ + @Override + public void insertRestde(Restde restde) throws Exception { + restdeManageDAO.insertRestde(restde); + } + + /** + * 휴일 상세항목을 조회한다. + */ + @Override + public Restde selectRestdeDetail(Restde restde) throws Exception { + Restde ret = restdeManageDAO.selectRestdeDetail(restde); + return ret; + } + + /** + * 휴일 목록을 조회한다. + */ + @Override + public List selectRestdeList(RestdeVO searchVO) throws Exception { + return restdeManageDAO.selectRestdeList(searchVO); + } + + /** + * 휴일 총 갯수를 조회한다. + */ + @Override + public int selectRestdeListTotCnt(RestdeVO searchVO) throws Exception { + return restdeManageDAO.selectRestdeListTotCnt(searchVO); + } + + /** + * 휴일을 수정한다. + */ + @Override + public void updateRestde(Restde restde) throws Exception { + restdeManageDAO.updateRestde(restde); + } + +} diff --git a/src/main/java/egovframework/com/sym/cal/service/impl/RestdeManageDAO.java b/src/main/java/egovframework/com/sym/cal/service/impl/RestdeManageDAO.java new file mode 100644 index 0000000..76a2e44 --- /dev/null +++ b/src/main/java/egovframework/com/sym/cal/service/impl/RestdeManageDAO.java @@ -0,0 +1,170 @@ +package egovframework.com.sym.cal.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.sym.cal.service.Restde; +import egovframework.com.sym.cal.service.RestdeVO; + +import org.springframework.stereotype.Repository; + +/** + * + * 휴일에 대한 데이터 접근 클래스를 정의한다 + * @author 공통서비스 개발팀 이중호 + * @since 2009.04.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.01  이중호          최초 생성
    + *
    + * 
    + */ +@Repository("RestdeManageDAO") +public class RestdeManageDAO extends EgovComAbstractDAO { + + /** + * 일반달력 팝업 정보를 조회한다. + * @param restde + * @return List(일반달력 팝업 날짜정보) + * @throws Exception + */ + public List selectNormalRestdePopup(Restde restde) throws Exception { + return selectList("RestdeManageDAO.selectNormalRestdePopup", restde); + } + + /** + * 행정달력 팝업 정보를 조회한다. + * @param restde + * @return List(행정달력 팝업 날짜정보) + * @throws Exception + */ + public List selectAdministRestdePopup(Restde restde) throws Exception { + return selectList("RestdeManageDAO.selectAdministRestdePopup", restde); + } + + /** + * 일반달력 일간 정보를 조회한다. + * @param restde + * @return List(일반달력 일간 날짜정보) + * @throws Exception + */ + public List selectNormalDayCal(Restde restde) throws Exception { + return selectList("RestdeManageDAO.selectNormalDayCal", restde); + } + + /** + * 일반달력 일간 휴일을 조회한다. + * @param restde + * @return List(일반달력 일간 휴일정보) + * @throws Exception + */ + public List selectNormalDayRestde(Restde restde) throws Exception { + return selectList("RestdeManageDAO.selectNormalDayRestde", restde); + } + + /** + * 일반달력 월간 휴일을 조회한다. + * @param restde + * @return List(일반달력 월간 휴일정보) + * @throws Exception + */ + public List selectNormalMonthRestde(Restde restde) throws Exception { + return selectList("RestdeManageDAO.selectNormalMonthRestde", restde); + } + + /** + * 행정달력 일간 정보를 조회한다. + * @param restde + * @return List(행정달력 일간 날짜정보) + * @throws Exception + */ + public List selectAdministDayCal(Restde restde) throws Exception { + return selectList("RestdeManageDAO.selectAdministDayCal", restde); + } + + /** + * 행정달력 일간 휴일을 조회한다. + * @param restde + * @return List(행정달력 일간 휴일정보) + * @throws Exception + */ + public List selectAdministDayRestde(Restde restde) throws Exception { + return selectList("RestdeManageDAO.selectAdministDayRestde", restde); + } + + /** + * 행정달력 월간 휴일을 조회한다. + * @param restde + * @return List(행정달력 월간 휴일정보) + * @throws Exception + */ + public List selectAdministMonthRestde(Restde restde) throws Exception { + return selectList("RestdeManageDAO.selectAdministMonthRestde", restde); + } + + /** + * 휴일을 삭제한다. + * @param restde + * @throws Exception + */ + public void deleteRestde(Restde restde) throws Exception { + delete("RestdeManageDAO.deleteRestde", restde); + } + + + /** + * 휴일을 등록한다. + * @param restde + * @throws Exception + */ + public void insertRestde(Restde restde) throws Exception { + insert("RestdeManageDAO.insertRestde", restde); + } + + /** + * 휴일 상세항목을 조회한다. + * @param restde + * @return Restde(휴일) + * @throws Exception + */ + public Restde selectRestdeDetail(Restde restde) throws Exception { + return (Restde) selectOne("RestdeManageDAO.selectRestdeDetail", restde); + } + + + /** + * 휴일 목록을 조회한다. + * @param searchVO + * @return List(휴일 목록) + * @throws Exception + */ + public List selectRestdeList(RestdeVO searchVO) throws Exception { + return selectList("RestdeManageDAO.selectRestdeList", searchVO); + } + + /** + * 글 총 갯수를 조회한다. + * @param searchVO + * @return int(휴일 총 갯수) + * @throws Exception + */ + public int selectRestdeListTotCnt(RestdeVO searchVO) throws Exception { + return (Integer)selectOne("RestdeManageDAO.selectRestdeListTotCnt", searchVO); + } + + /** + * 휴일을 수정한다. + * @param restde + * @throws Exception + */ + public void updateRestde(Restde restde) throws Exception { + update("RestdeManageDAO.updateRestde", restde); + } + +} diff --git a/src/main/java/egovframework/com/sym/cal/web/EgovCalRestdeManageController.java b/src/main/java/egovframework/com/sym/cal/web/EgovCalRestdeManageController.java new file mode 100644 index 0000000..8a902a6 --- /dev/null +++ b/src/main/java/egovframework/com/sym/cal/web/EgovCalRestdeManageController.java @@ -0,0 +1,1531 @@ +package egovframework.com.sym.cal.web; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; +import java.util.Map; + +import egovframework.com.cmm.ComDefaultCodeVO; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.service.EgovCmmUseService; +import egovframework.com.sym.cal.service.EgovCalRestdeManageService; +import egovframework.com.sym.cal.service.Restde; +import egovframework.com.sym.cal.service.RestdeVO; + +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +import javax.annotation.Resource; + +import org.apache.commons.collections.map.ListOrderedMap; +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; + + +/** + * + * 공휴일에 관한 요청을 받아 서비스 클래스로 요청을 전달하고 서비스클래스에서 처리한 결과를 웹 화면으로 전달을 위한 Controller를 정의한다 + * @author 공통서비스 개발팀 이중호 + * @since 2009.04.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.01  이중호          최초 생성
    + *   2011.8.26	  정진오	   IncludedInfo annotation 추가
    + *   2011.10.18  서준식          보안점검 조치 사항으로 sql injection에 대비한 파라미터 체크(달력 출력을 위한 숫자만 가능하도록)
    + * 
    + */ + +@Controller +public class EgovCalRestdeManageController { + + @Resource(name = "RestdeManageService") + private EgovCalRestdeManageService restdeManageService; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + @Resource(name="egovRestDeIdGnrService") + private EgovIdGnrService idgenService; + + @Resource(name="EgovCmmUseService") + private EgovCmmUseService cmmUseService; + + @Autowired + private DefaultBeanValidator beanValidator; + + public BindingResult checkRestdeWithValidator(Restde restde, BindingResult bindingResult){ + + restde.setRestdeDe("dummy"); + restde.setRestdeNm("dummy"); + restde.setRestdeDc("dummy"); + restde.setRestdeSeCode("dummy"); + + beanValidator.validate(restde, bindingResult); + + return bindingResult; + } + + /** + * 달력 메인창을 호출한다. + * @param model + * @return "egovframework/com/sym/cal/EgovNormalCalPopup" + * @throws Exception + */ + @RequestMapping(value="/sym/cal/callCalPopup.do") + public String callCalendar (ModelMap model + ) throws Exception { + return "egovframework/com/sym/cal/EgovCalPopup"; + } + + /** + * 달력을 호출한다. + * @param model + * @return "egovframework/com/sym/cal/EgovNormalCalPopup" + * @throws Exception + */ + @SuppressWarnings("unused") + @RequestMapping(value="/sym/cal/callCal.do") + public String callCal (Restde restde, BindingResult bindingResult + , ModelMap model + ) throws Exception { + + //2011.10.18 달력 출력을 위해 필요한 숫자 이외의 값을 사용하는 경우 체크 + bindingResult = checkRestdeWithValidator(restde, bindingResult); + + if(bindingResult.hasErrors()){ + + return "egovframework/com/cmm/error/dataAccessFailure"; + + } + + + Calendar cal = Calendar.getInstance(); + + if(restde.getYear()==null || restde.getYear().equals("")){ + restde.setYear(Integer.toString(cal.get(Calendar.YEAR))); + } + if(restde.getMonth()==null || restde.getMonth().equals("")){ + restde.setMonth(Integer.toString(cal.get(Calendar.MONTH)+1)); + } + int iYear = Integer.parseInt(restde.getYear()); + int iMonth = Integer.parseInt(restde.getMonth()); + + if (iMonth<1){ + iYear--; + iMonth = 12; + } + if (iMonth>12){ + iYear++; + iMonth = 1; + } + if (iYear<1){ + iYear = 1; + iMonth = 1; + } + if (iYear>9999){ + iYear = 9999; + iMonth = 12; + } + + cal.set(iYear,iMonth-1,1); + + int firstWeek = cal.get(Calendar.DAY_OF_WEEK); + int lastDay = cal.getActualMaximum(Calendar.DATE); + int week = cal.get(Calendar.DAY_OF_WEEK); + + String year = Integer.toString(iYear); + String month = Integer.toString(iMonth); + String day = Integer.toString(cal.get(Calendar.DAY_OF_MONTH)); + + restde.setStartWeekMonth(firstWeek); + restde.setLastDayMonth(lastDay); + restde.setYear(year); + restde.setMonth(month); + + List CalInfoList = new ArrayList(); + String tmpDay = ""; + + /** + * 계산... START + */ + for(int i=0; i<42;i++) { + ListOrderedMap map = new ListOrderedMap(); + int cc = i + 1; + int dd = cc-firstWeek+1; + + if (dd > 0 && dd <= lastDay) { + tmpDay = Integer.toString(dd); + } else { + tmpDay = ""; + } + + map.put("year", year); + map.put("month", month); + map.put("day", tmpDay); + map.put("cellNum", cc); + map.put("weeks", (cc - 1) / 7 + 1); + map.put("week", (week-1) % 7 + 1); + map.put("restAt", ((week-1) % 7 + 1==1) ? "Y" : "N"); + + if (dd > 0 && dd <= lastDay) { + week ++; + } + CalInfoList.add(map); + + } + /** + * 계산... END + */ + + model.addAttribute("resultList", CalInfoList); + + return "egovframework/com/sym/cal/EgovCalendar"; + } + + /** + * 일반달력 팝업 메인창을 호출한다. + * @param model + * @return "egovframework/com/sym/cal/EgovNormalCalPopup" + * @throws Exception + */ + @RequestMapping(value="/sym/cal/EgovNormalCalPopup.do") + public String callNormalCalPopup (ModelMap model + ) throws Exception { + return "egovframework/com/sym/cal/EgovNormalCalPopup"; + } + + /** + * 일반달력 팝업 정보를 조회한다. + * @param restde + * @param model + * @return "egovframework/com/sym/cal/EgovNormalCalendar" + * @throws Exception + */ + @RequestMapping(value="/sym/cal/EgovselectNormalCalendar.do") + public String selectNormalRestdePopup (Restde restde, BindingResult bindingResult + , ModelMap model + ) throws Exception { + + //2011.10.18 달력 출력을 위해 필요한 숫자 이외의 값을 사용하는 경우 체크 + bindingResult = checkRestdeWithValidator(restde, bindingResult); + + if(bindingResult.hasErrors()){ + + return "egovframework/com/cmm/error/dataAccessFailure"; + + } + + Calendar cal = Calendar.getInstance(); + + if(restde.getYear()==null || restde.getYear().equals("")){ + restde.setYear(Integer.toString(cal.get(Calendar.YEAR))); + } + if(restde.getMonth()==null || restde.getMonth().equals("")){ + restde.setMonth(Integer.toString(cal.get(Calendar.MONTH)+1)); + } + int iYear = Integer.parseInt(restde.getYear()); + int iMonth = Integer.parseInt(restde.getMonth()); + + if (iMonth<1){ + iYear--; + iMonth = 12; + } + if (iMonth>12){ + iYear++; + iMonth = 1; + } + if (iYear<1){ + iYear = 1; + iMonth = 1; + } + if (iYear>9999){ + iYear = 9999; + iMonth = 12; + } + restde.setYear(Integer.toString(iYear)); + restde.setMonth(Integer.toString(iMonth)); + + cal.set(iYear,iMonth-1,1); + + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DATE)); + + List CalInfoList = restdeManageService.selectNormalRestdePopup(restde); + + model.addAttribute("resultList", CalInfoList); + + return "egovframework/com/sym/cal/EgovNormalCalendar"; + } + + + /** + * 행정달력 팝업 메인창을 호출한다. + * @param model + * @return "egovframework/com/sym/cal/EgovAdministCalPopup" + * @throws Exception + */ + @RequestMapping(value="/sym/cal/EgovAdministCalPopup.do") + public String callAdministCalPopup (ModelMap model + ) throws Exception { + return "egovframework/com/sym/cal/EgovAdministCalPopup"; + } + + /** + * 행정달력 팝업 정보를 조회한다. + * @param restde + * @param model + * @return "egovframework/com/sym/cal/EgovAdministCalendar" + * @throws Exception + */ + @RequestMapping(value="/sym/cal/EgovselectAdministCalendar.do") + public String selectAdministRestdePopup (Restde restde, BindingResult bindingResult + , ModelMap model + ) throws Exception { + + //2011.10.18 달력 출력을 위해 필요한 숫자 이외의 값을 사용하는 경우 체크 + bindingResult = checkRestdeWithValidator(restde, bindingResult); + + if(bindingResult.hasErrors()){ + + return "egovframework/com/cmm/error/dataAccessFailure"; + + } + + Calendar cal = Calendar.getInstance(); + + if(restde.getYear()==null || restde.getYear().equals("")){ + restde.setYear(Integer.toString(cal.get(Calendar.YEAR))); + } + if(restde.getMonth()==null || restde.getMonth().equals("")){ + restde.setMonth(Integer.toString(cal.get(Calendar.MONTH)+1)); + } + int iYear = Integer.parseInt(restde.getYear()); + int iMonth = Integer.parseInt(restde.getMonth()); + + if (iMonth<1){ + iYear--; + iMonth = 12; + } + if (iMonth>12){ + iYear++; + iMonth = 1; + } + if (iYear<1){ + iYear = 1; + iMonth = 1; + } + if (iYear>9999){ + iYear = 9999; + iMonth = 12; + } + restde.setYear(Integer.toString(iYear)); + restde.setMonth(Integer.toString(iMonth)); + + cal.set(iYear,iMonth-1,1); + + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DATE)); + + List CalInfoList = restdeManageService.selectAdministRestdePopup(restde); + + model.addAttribute("resultList", CalInfoList); + + return "egovframework/com/sym/cal/EgovAdministCalendar"; + } + + /** + * 일반달력 일간 + * @param restde + * @param model + * @return "egovframework/com/sym/cal/EgovNormalDayCalendar" + * @throws Exception + */ + @SuppressWarnings("static-access") + @RequestMapping(value="/sym/cal/EgovNormalDayCalendar.do") + public String selectNormalDayCalendar (Restde restde, BindingResult bindingResult + , ModelMap model + ) throws Exception { + + //2011.10.18 달력 출력을 위해 필요한 숫자 이외의 값을 사용하는 경우 체크 + bindingResult = checkRestdeWithValidator(restde, bindingResult); + + if(bindingResult.hasErrors()){ + + return "egovframework/com/cmm/error/dataAccessFailure"; + + } + + Calendar cal = Calendar.getInstance(); + + + if(restde.getYear()==null || restde.getYear().equals("")){ + restde.setYear(Integer.toString(cal.get(Calendar.YEAR))); + } + if(restde.getMonth()==null || restde.getMonth().equals("")){ + restde.setMonth(Integer.toString(cal.get(Calendar.MONTH)+1)); + } + if(restde.getDay()==null || restde.getDay().equals("")){ + restde.setDay(Integer.toString(cal.get(Calendar.DATE))); + } + + int iYear = Integer.parseInt(restde.getYear()); + int iMonth = Integer.parseInt(restde.getMonth()); + int iDay = Integer.parseInt(restde.getDay()); + + if (iMonth<1){ + iYear--; + iMonth = 12; + } + if (iMonth>12){ + iYear++; + iMonth = 1; + } + if (iYear<1){ + iYear = 1; + iMonth = 1; + } + if (iYear>9999){ + iYear = 9999; + iMonth = 12; + } + restde.setYear(Integer.toString(iYear)); + restde.setMonth(Integer.toString(iMonth)); + + cal.set(iYear,iMonth-1,iDay); + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + + cal.set(iYear,iMonth-1,Integer.parseInt(restde.getDay())); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DAY_OF_MONTH)); + + restde.setYear(Integer.toString(cal.get(cal.YEAR))); + restde.setMonth(Integer.toString(cal.get(cal.MONTH)+1)); + restde.setDay(Integer.toString(cal.get(cal.DAY_OF_MONTH))); + restde.setWeek(cal.get(cal.DAY_OF_WEEK)); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DATE)); + + List CalInfoList = restdeManageService.selectNormalDayCal(restde); + List NormalWeekRestdeList = restdeManageService.selectNormalDayRestde(restde); + + model.addAttribute("resultList", CalInfoList); + model.addAttribute("RestdeList", NormalWeekRestdeList); + + return "egovframework/com/sym/cal/EgovNormalDayCalendar"; + } + + /** + * 일반달력 주간 + * @param restde + * @param model + * @return "egovframework/com/sym/cal/EgovNormalWeekCalendar" + * @throws Exception + */ + @SuppressWarnings("static-access") + @RequestMapping(value="/sym/cal/EgovNormalWeekCalendar.do") + public String selectNormalWeekCalendar (Restde restde, BindingResult bindingResult + , ModelMap model + ) throws Exception { + + //2011.10.18 달력 출력을 위해 필요한 숫자 이외의 값을 사용하는 경우 체크 + bindingResult = checkRestdeWithValidator(restde, bindingResult); + + if(bindingResult.hasErrors()){ + + return "egovframework/com/cmm/error/dataAccessFailure"; + + } + + Calendar cal = Calendar.getInstance(); + + if(restde.getYear()==null || restde.getYear().equals("")){ + restde.setYear(Integer.toString(cal.get(Calendar.YEAR))); + } + if(restde.getMonth()==null || restde.getMonth().equals("")){ + restde.setMonth(Integer.toString(cal.get(Calendar.MONTH)+1)); + } + if(restde.getDay()==null || restde.getDay().equals("")){ + restde.setDay(Integer.toString(cal.get(Calendar.DATE))); + } + + int iYear = Integer.parseInt(restde.getYear()); + int iMonth = Integer.parseInt(restde.getMonth()); + + if (iMonth<1){ + iYear--; + iMonth = 12; + } + if (iMonth>12){ + iYear++; + iMonth = 1; + } + if (iYear<1){ + iYear = 1; + iMonth = 1; + } + if (iYear>9999){ + iYear = 9999; + iMonth = 12; + } + restde.setYear(Integer.toString(iYear)); + restde.setMonth(Integer.toString(iMonth)); + + cal.set(iYear,iMonth-1,1); + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + + cal.set(iYear,iMonth-1,Integer.parseInt(restde.getDay())); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DAY_OF_MONTH)); + + int iStartWeek = restde.getStartWeekMonth(); + int iLastDate = restde.getLastDayMonth(); + int iDayWeek = cal.get(Calendar.DAY_OF_WEEK); + + int iMaxWeeks = (int)Math.floor(iLastDate/7); + iMaxWeeks = iMaxWeeks + (int)Math.ceil(((iLastDate - iMaxWeeks * 7) + iStartWeek - 1) / 7.0); + restde.setMaxWeeks(iMaxWeeks); + + if (iMaxWeeks < restde.getWeeks()) { + restde.setWeeks(iMaxWeeks); + } + + Restde vo = new Restde(); + Calendar weekCal = Calendar.getInstance(); + weekCal.setTime(cal.getTime()); + + if(restde.getWeeks()!=0){ + weekCal.set(weekCal.DATE, (restde.getWeeks() - 1) * 7 + 1); + if(restde.getWeeks()>1){ + iDayWeek = weekCal.get(weekCal.DAY_OF_WEEK); + weekCal.add(weekCal.DATE, (-1)*(iDayWeek-1)); + } + restde.setDay(Integer.toString(weekCal.get(weekCal.DAY_OF_MONTH)+1)); + } + + iDayWeek = weekCal.get(weekCal.DAY_OF_WEEK); + + // 일요일 + weekCal.add(weekCal.DATE, (-1)*(iDayWeek-1)); + vo.setYear(Integer.toString(weekCal.get(weekCal.YEAR))); + vo.setMonth(Integer.toString(weekCal.get(weekCal.MONTH)+1)); + vo.setDay(Integer.toString(weekCal.get(weekCal.DAY_OF_MONTH))); + vo.setWeek(weekCal.get(weekCal.DAY_OF_WEEK)); + List CalInfoList_1 = restdeManageService.selectNormalDayCal(vo); + List NormalWeekRestdeList_1 = restdeManageService.selectNormalDayRestde(vo); + + // 월요일 + weekCal.add(weekCal.DATE, 1); + vo.setYear(Integer.toString(weekCal.get(weekCal.YEAR))); + vo.setMonth(Integer.toString(weekCal.get(weekCal.MONTH)+1)); + vo.setDay(Integer.toString(weekCal.get(weekCal.DAY_OF_MONTH))); + vo.setWeek(weekCal.get(weekCal.DAY_OF_WEEK)); + List CalInfoList_2 = restdeManageService.selectNormalDayCal(vo); + List NormalWeekRestdeList_2 = restdeManageService.selectNormalDayRestde(vo); + + // 화요일 + weekCal.add(weekCal.DATE, 1); + vo.setYear(Integer.toString(weekCal.get(weekCal.YEAR))); + vo.setMonth(Integer.toString(weekCal.get(weekCal.MONTH)+1)); + vo.setDay(Integer.toString(weekCal.get(weekCal.DAY_OF_MONTH))); + vo.setWeek(weekCal.get(weekCal.DAY_OF_WEEK)); + List CalInfoList_3 = restdeManageService.selectNormalDayCal(vo); + List NormalWeekRestdeList_3 = restdeManageService.selectNormalDayRestde(vo); + + // 수요일 + weekCal.add(weekCal.DATE, 1); + vo.setYear(Integer.toString(weekCal.get(weekCal.YEAR))); + vo.setMonth(Integer.toString(weekCal.get(weekCal.MONTH)+1)); + vo.setDay(Integer.toString(weekCal.get(weekCal.DAY_OF_MONTH))); + vo.setWeek(weekCal.get(weekCal.DAY_OF_WEEK)); + List CalInfoList_4 = restdeManageService.selectNormalDayCal(vo); + List NormalWeekRestdeList_4 = restdeManageService.selectNormalDayRestde(vo); + + // 목요일 + weekCal.add(weekCal.DATE, 1); + vo.setYear(Integer.toString(weekCal.get(weekCal.YEAR))); + vo.setMonth(Integer.toString(weekCal.get(weekCal.MONTH)+1)); + vo.setDay(Integer.toString(weekCal.get(weekCal.DAY_OF_MONTH))); + vo.setWeek(weekCal.get(weekCal.DAY_OF_WEEK)); + List CalInfoList_5 = restdeManageService.selectNormalDayCal(vo); + List NormalWeekRestdeList_5 = restdeManageService.selectNormalDayRestde(vo); + + // 금요일 + weekCal.add(weekCal.DATE, 1); + vo.setYear(Integer.toString(weekCal.get(weekCal.YEAR))); + vo.setMonth(Integer.toString(weekCal.get(weekCal.MONTH)+1)); + vo.setDay(Integer.toString(weekCal.get(weekCal.DAY_OF_MONTH))); + vo.setWeek(weekCal.get(weekCal.DAY_OF_WEEK)); + List CalInfoList_6 = restdeManageService.selectNormalDayCal(vo); + List NormalWeekRestdeList_6 = restdeManageService.selectNormalDayRestde(vo); + + // 토요일 + weekCal.add(weekCal.DATE, 1); + vo.setYear(Integer.toString(weekCal.get(weekCal.YEAR))); + vo.setMonth(Integer.toString(weekCal.get(weekCal.MONTH)+1)); + vo.setDay(Integer.toString(weekCal.get(weekCal.DAY_OF_MONTH))); + vo.setWeek(weekCal.get(weekCal.DAY_OF_WEEK)); + List CalInfoList_7 = restdeManageService.selectNormalDayCal(vo); + List NormalWeekRestdeList_7 = restdeManageService.selectNormalDayRestde(vo); + + model.addAttribute("resultList_1", CalInfoList_1); + model.addAttribute("resultList_2", CalInfoList_2); + model.addAttribute("resultList_3", CalInfoList_3); + model.addAttribute("resultList_4", CalInfoList_4); + model.addAttribute("resultList_5", CalInfoList_5); + model.addAttribute("resultList_6", CalInfoList_6); + model.addAttribute("resultList_7", CalInfoList_7); + model.addAttribute("RestdeList_1", NormalWeekRestdeList_1); + model.addAttribute("RestdeList_2", NormalWeekRestdeList_2); + model.addAttribute("RestdeList_3", NormalWeekRestdeList_3); + model.addAttribute("RestdeList_4", NormalWeekRestdeList_4); + model.addAttribute("RestdeList_5", NormalWeekRestdeList_5); + model.addAttribute("RestdeList_6", NormalWeekRestdeList_6); + model.addAttribute("RestdeList_7", NormalWeekRestdeList_7); + + List CalInfoList = restdeManageService.selectNormalDayCal(restde); + model.addAttribute("resultList", CalInfoList); + + return "egovframework/com/sym/cal/EgovNormalWeekCalendar"; + } + + /** + * 일반달력 월간 + * @param restde + * @param model + * @return "egovframework/com/sym/cal/EgovNormalMonthCalendar" + * @throws Exception + */ + @RequestMapping(value="/sym/cal/EgovNormalMonthCalendar.do") + public String selectNormalMonthCalendar (Restde restde, BindingResult bindingResult + , ModelMap model + ) throws Exception { + + //2011.10.18 달력 출력을 위해 필요한 숫자 이외의 값을 사용하는 경우 체크 + bindingResult = checkRestdeWithValidator(restde, bindingResult); + + if(bindingResult.hasErrors()){ + + return "egovframework/com/cmm/error/dataAccessFailure"; + + } + + Calendar cal = Calendar.getInstance(); + + if(restde.getYear()==null || restde.getYear().equals("")){ + restde.setYear(Integer.toString(cal.get(Calendar.YEAR))); + } + if(restde.getMonth()==null || restde.getMonth().equals("")){ + restde.setMonth(Integer.toString(cal.get(Calendar.MONTH)+1)); + } + int iYear = Integer.parseInt(restde.getYear()); + int iMonth = Integer.parseInt(restde.getMonth()); + + if (iMonth<1){ + iYear--; + iMonth = 12; + } + if (iMonth>12){ + iYear++; + iMonth = 1; + } + if (iYear<1){ + iYear = 1; + iMonth = 1; + } + if (iYear>9999){ + iYear = 9999; + iMonth = 12; + } + restde.setYear(Integer.toString(iYear)); + restde.setMonth(Integer.toString(iMonth)); + + cal.set(iYear,iMonth-1,1); + + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DATE)); + + List CalInfoList = restdeManageService.selectNormalRestdePopup(restde); + + + List NormalMonthRestdeList = restdeManageService.selectNormalMonthRestde(restde); + + model.addAttribute("resultList", CalInfoList); + model.addAttribute("RestdeList", NormalMonthRestdeList); + + return "egovframework/com/sym/cal/EgovNormalMonthCalendar"; + } + + /** + * 일반달력 연간 + * @param restde + * @param model + * @return "egovframework/com/sym/cal/EgovNormalYearCalendar" + * @throws Exception + */ + @RequestMapping(value="/sym/cal/EgovNormalYearCalendar.do") + public String selectNormalYearCalendar (Restde restde, BindingResult bindingResult + , ModelMap model + ) throws Exception { + + //2011.10.18 달력 출력을 위해 필요한 숫자 이외의 값을 사용하는 경우 체크 + bindingResult = checkRestdeWithValidator(restde, bindingResult); + + if(bindingResult.hasErrors()){ + + return "egovframework/com/cmm/error/dataAccessFailure"; + + } + + Calendar cal = Calendar.getInstance(); + + if(restde.getYear()==null || restde.getYear().equals("")){ + restde.setYear(Integer.toString(cal.get(Calendar.YEAR))); + } + if(restde.getMonth()==null || restde.getMonth().equals("")){ + restde.setMonth(Integer.toString(cal.get(Calendar.MONTH)+1)); + } + int iYear = Integer.parseInt(restde.getYear()); + int iMonth = Integer.parseInt(restde.getMonth()); + + if (iMonth<1){ + iYear--; + iMonth = 12; + } + if (iMonth>12){ + iYear++; + iMonth = 1; + } + if (iYear<1){ + iYear = 1; + iMonth = 1; + } + if (iYear>9999){ + iYear = 9999; + iMonth = 12; + } + restde.setYear(Integer.toString(iYear)); + + /* 월별확인 */ + + /* 1월 */ + iMonth = 1; + restde.setMonth(Integer.toString(iMonth)); + cal.set(iYear,iMonth-1,1); + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DATE)); + List CalInfoList_1 = restdeManageService.selectNormalRestdePopup(restde); + List NormalMonthRestdeList_1 = restdeManageService.selectNormalMonthRestde(restde); + + /* 2월 */ + iMonth = 2; + restde.setMonth(Integer.toString(iMonth)); + cal.set(iYear,iMonth-1,1); + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DATE)); + List CalInfoList_2 = restdeManageService.selectNormalRestdePopup(restde); + List NormalMonthRestdeList_2 = restdeManageService.selectNormalMonthRestde(restde); + + /* 3월 */ + iMonth = 3; + restde.setMonth(Integer.toString(iMonth)); + cal.set(iYear,iMonth-1,1); + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DATE)); + List CalInfoList_3 = restdeManageService.selectNormalRestdePopup(restde); + List NormalMonthRestdeList_3 = restdeManageService.selectNormalMonthRestde(restde); + + /* 4월 */ + iMonth = 4; + restde.setMonth(Integer.toString(iMonth)); + cal.set(iYear,iMonth-1,1); + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DATE)); + List CalInfoList_4 = restdeManageService.selectNormalRestdePopup(restde); + List NormalMonthRestdeList_4 = restdeManageService.selectNormalMonthRestde(restde); + + /* 5월 */ + iMonth = 5; + restde.setMonth(Integer.toString(iMonth)); + cal.set(iYear,iMonth-1,1); + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DATE)); + List CalInfoList_5 = restdeManageService.selectNormalRestdePopup(restde); + List NormalMonthRestdeList_5 = restdeManageService.selectNormalMonthRestde(restde); + + /* 6월 */ + iMonth = 6; + restde.setMonth(Integer.toString(iMonth)); + cal.set(iYear,iMonth-1,1); + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DATE)); + List CalInfoList_6 = restdeManageService.selectNormalRestdePopup(restde); + List NormalMonthRestdeList_6 = restdeManageService.selectNormalMonthRestde(restde); + + /* 7월 */ + iMonth = 7; + restde.setMonth(Integer.toString(iMonth)); + cal.set(iYear,iMonth-1,1); + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DATE)); + List CalInfoList_7 = restdeManageService.selectNormalRestdePopup(restde); + List NormalMonthRestdeList_7 = restdeManageService.selectNormalMonthRestde(restde); + + /* 8월 */ + iMonth = 8; + restde.setMonth(Integer.toString(iMonth)); + cal.set(iYear,iMonth-1,1); + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DATE)); + List CalInfoList_8 = restdeManageService.selectNormalRestdePopup(restde); + List NormalMonthRestdeList_8 = restdeManageService.selectNormalMonthRestde(restde); + + /* 9월 */ + iMonth = 9; + restde.setMonth(Integer.toString(iMonth)); + cal.set(iYear,iMonth-1,1); + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DATE)); + List CalInfoList_9 = restdeManageService.selectNormalRestdePopup(restde); + List NormalMonthRestdeList_9 = restdeManageService.selectNormalMonthRestde(restde); + + /* 10월 */ + iMonth = 10; + restde.setMonth(Integer.toString(iMonth)); + cal.set(iYear,iMonth-1,1); + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DATE)); + List CalInfoList_10 = restdeManageService.selectNormalRestdePopup(restde); + List NormalMonthRestdeList_10 = restdeManageService.selectNormalMonthRestde(restde); + + /* 11월 */ + iMonth = 11; + restde.setMonth(Integer.toString(iMonth)); + cal.set(iYear,iMonth-1,1); + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DATE)); + List CalInfoList_11 = restdeManageService.selectNormalRestdePopup(restde); + List NormalMonthRestdeList_11 = restdeManageService.selectNormalMonthRestde(restde); + + /* 12월 */ + iMonth = 12; + restde.setMonth(Integer.toString(iMonth)); + cal.set(iYear,iMonth-1,1); + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DATE)); + List CalInfoList_12 = restdeManageService.selectNormalRestdePopup(restde); + List NormalMonthRestdeList_12 = restdeManageService.selectNormalMonthRestde(restde); + + model.addAttribute("resultList_1" , CalInfoList_1 ); + model.addAttribute("resultList_2" , CalInfoList_2 ); + model.addAttribute("resultList_3" , CalInfoList_3 ); + model.addAttribute("resultList_4" , CalInfoList_4 ); + model.addAttribute("resultList_5" , CalInfoList_5 ); + model.addAttribute("resultList_6" , CalInfoList_6 ); + model.addAttribute("resultList_7" , CalInfoList_7 ); + model.addAttribute("resultList_8" , CalInfoList_8 ); + model.addAttribute("resultList_9" , CalInfoList_9 ); + model.addAttribute("resultList_10", CalInfoList_10); + model.addAttribute("resultList_11", CalInfoList_11); + model.addAttribute("resultList_12", CalInfoList_12); + model.addAttribute("RestdeList_1" , NormalMonthRestdeList_1 ); + model.addAttribute("RestdeList_2" , NormalMonthRestdeList_2 ); + model.addAttribute("RestdeList_3" , NormalMonthRestdeList_3 ); + model.addAttribute("RestdeList_4" , NormalMonthRestdeList_4 ); + model.addAttribute("RestdeList_5" , NormalMonthRestdeList_5 ); + model.addAttribute("RestdeList_6" , NormalMonthRestdeList_6 ); + model.addAttribute("RestdeList_7" , NormalMonthRestdeList_7 ); + model.addAttribute("RestdeList_8" , NormalMonthRestdeList_8 ); + model.addAttribute("RestdeList_9" , NormalMonthRestdeList_9 ); + model.addAttribute("RestdeList_10", NormalMonthRestdeList_10); + model.addAttribute("RestdeList_11", NormalMonthRestdeList_11); + model.addAttribute("RestdeList_12", NormalMonthRestdeList_12); + + return "egovframework/com/sym/cal/EgovNormalYearCalendar"; + } + + + /** + * 행정달력 일간 + * @param restde + * @param model + * @return "egovframework/com/sym/cal/EgovAdministDayCalendar" + * @throws Exception + */ + @SuppressWarnings("static-access") + @RequestMapping(value="/sym/cal/EgovAdministDayCalendar.do") + public String selectAdministDayCalendar (Restde restde, BindingResult bindingResult + , ModelMap model + ) throws Exception { + + //2011.10.18 달력 출력을 위해 필요한 숫자 이외의 값을 사용하는 경우 체크 + bindingResult = checkRestdeWithValidator(restde, bindingResult); + + if(bindingResult.hasErrors()){ + + return "egovframework/com/cmm/error/dataAccessFailure"; + + } + + Calendar cal = Calendar.getInstance(); + + + if(restde.getYear()==null || restde.getYear().equals("")){ + restde.setYear(Integer.toString(cal.get(Calendar.YEAR))); + } + if(restde.getMonth()==null || restde.getMonth().equals("")){ + restde.setMonth(Integer.toString(cal.get(Calendar.MONTH)+1)); + } + if(restde.getDay()==null || restde.getDay().equals("")){ + restde.setDay(Integer.toString(cal.get(Calendar.DATE))); + } + + int iYear = Integer.parseInt(restde.getYear()); + int iMonth = Integer.parseInt(restde.getMonth()); + int iDay = Integer.parseInt(restde.getDay()); + + if (iMonth<1){ + iYear--; + iMonth = 12; + } + if (iMonth>12){ + iYear++; + iMonth = 1; + } + if (iYear<1){ + iYear = 1; + iMonth = 1; + } + if (iYear>9999){ + iYear = 9999; + iMonth = 12; + } + restde.setYear(Integer.toString(iYear)); + restde.setMonth(Integer.toString(iMonth)); + + cal.set(iYear,iMonth-1,iDay); + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + + cal.set(iYear,iMonth-1,Integer.parseInt(restde.getDay())); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DAY_OF_MONTH)); + + restde.setYear(Integer.toString(cal.get(cal.YEAR))); + restde.setMonth(Integer.toString(cal.get(cal.MONTH)+1)); + restde.setDay(Integer.toString(cal.get(cal.DAY_OF_MONTH))); + restde.setWeek(cal.get(cal.DAY_OF_WEEK)); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DATE)); + + List CalInfoList = restdeManageService.selectAdministDayCal(restde); + List AdministWeekRestdeList = restdeManageService.selectAdministDayRestde(restde); + + model.addAttribute("resultList", CalInfoList); + model.addAttribute("RestdeList", AdministWeekRestdeList); + + return "egovframework/com/sym/cal/EgovAdministDayCalendar"; + } + + + /** + * 행정달력 주간 + * @param restde + * @param model + * @return "egovframework/com/sym/cal/EgovAdministWeekCalendar" + * @throws Exception + */ + @SuppressWarnings("static-access") + @RequestMapping(value="/sym/cal/EgovAdministWeekCalendar.do") + public String selectAdministWeekCalendar (Restde restde, BindingResult bindingResult + , ModelMap model + ) throws Exception { + + //2011.10.18 달력 출력을 위해 필요한 숫자 이외의 값을 사용하는 경우 체크 + bindingResult = checkRestdeWithValidator(restde, bindingResult); + + if(bindingResult.hasErrors()){ + + return "egovframework/com/cmm/error/dataAccessFailure"; + + } + + Calendar cal = Calendar.getInstance(); + + if(restde.getYear()==null || restde.getYear().equals("")){ + restde.setYear(Integer.toString(cal.get(Calendar.YEAR))); + } + if(restde.getMonth()==null || restde.getMonth().equals("")){ + restde.setMonth(Integer.toString(cal.get(Calendar.MONTH)+1)); + } + if(restde.getDay()==null || restde.getDay().equals("")){ + restde.setDay(Integer.toString(cal.get(Calendar.DATE))); + } + + int iYear = Integer.parseInt(restde.getYear()); + int iMonth = Integer.parseInt(restde.getMonth()); + + if (iMonth<1){ + iYear--; + iMonth = 12; + } + if (iMonth>12){ + iYear++; + iMonth = 1; + } + if (iYear<1){ + iYear = 1; + iMonth = 1; + } + if (iYear>9999){ + iYear = 9999; + iMonth = 12; + } + restde.setYear(Integer.toString(iYear)); + restde.setMonth(Integer.toString(iMonth)); + + cal.set(iYear,iMonth-1,1); + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + + cal.set(iYear,iMonth-1,Integer.parseInt(restde.getDay())); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DAY_OF_MONTH)); + + int iStartWeek = restde.getStartWeekMonth(); + int iLastDate = restde.getLastDayMonth(); + int iDayWeek = cal.get(Calendar.DAY_OF_WEEK); + + int iMaxWeeks = (int)Math.floor(iLastDate/7); + iMaxWeeks = iMaxWeeks + (int)Math.ceil(((iLastDate - iMaxWeeks * 7) + iStartWeek - 1) / 7.0); + restde.setMaxWeeks(iMaxWeeks); + + if (iMaxWeeks < restde.getWeeks()) { + restde.setWeeks(iMaxWeeks); + } + + Restde vo = new Restde(); + Calendar weekCal = Calendar.getInstance(); + weekCal.setTime(cal.getTime()); + + if(restde.getWeeks()!=0){ + weekCal.set(weekCal.DATE, (restde.getWeeks() - 1) * 7 + 1); + if(restde.getWeeks()>1){ + iDayWeek = weekCal.get(weekCal.DAY_OF_WEEK); + weekCal.add(weekCal.DATE, (-1)*(iDayWeek-1)); + } + restde.setDay(Integer.toString(weekCal.get(weekCal.DAY_OF_MONTH)+1)); + } + List CalInfoList = restdeManageService.selectAdministDayCal(restde); + + iDayWeek = weekCal.get(weekCal.DAY_OF_WEEK); + + // 일요일 + weekCal.add(weekCal.DATE, (-1)*(iDayWeek-1)); + vo.setYear(Integer.toString(weekCal.get(weekCal.YEAR))); + vo.setMonth(Integer.toString(weekCal.get(weekCal.MONTH)+1)); + vo.setDay(Integer.toString(weekCal.get(weekCal.DAY_OF_MONTH))); + vo.setWeek(weekCal.get(weekCal.DAY_OF_WEEK)); + List CalInfoList_1 = restdeManageService.selectAdministDayCal(vo); + List AdministWeekRestdeList_1 = restdeManageService.selectAdministDayRestde(vo); + + // 월요일 + weekCal.add(weekCal.DATE, 1); + vo.setYear(Integer.toString(weekCal.get(weekCal.YEAR))); + vo.setMonth(Integer.toString(weekCal.get(weekCal.MONTH)+1)); + vo.setDay(Integer.toString(weekCal.get(weekCal.DAY_OF_MONTH))); + vo.setWeek(weekCal.get(weekCal.DAY_OF_WEEK)); + List CalInfoList_2 = restdeManageService.selectAdministDayCal(vo); + List AdministWeekRestdeList_2 = restdeManageService.selectAdministDayRestde(vo); + + // 화요일 + weekCal.add(weekCal.DATE, 1); + vo.setYear(Integer.toString(weekCal.get(weekCal.YEAR))); + vo.setMonth(Integer.toString(weekCal.get(weekCal.MONTH)+1)); + vo.setDay(Integer.toString(weekCal.get(weekCal.DAY_OF_MONTH))); + vo.setWeek(weekCal.get(weekCal.DAY_OF_WEEK)); + List CalInfoList_3 = restdeManageService.selectAdministDayCal(vo); + List AdministWeekRestdeList_3 = restdeManageService.selectAdministDayRestde(vo); + + // 수요일 + weekCal.add(weekCal.DATE, 1); + vo.setYear(Integer.toString(weekCal.get(weekCal.YEAR))); + vo.setMonth(Integer.toString(weekCal.get(weekCal.MONTH)+1)); + vo.setDay(Integer.toString(weekCal.get(weekCal.DAY_OF_MONTH))); + vo.setWeek(weekCal.get(weekCal.DAY_OF_WEEK)); + List CalInfoList_4 = restdeManageService.selectAdministDayCal(vo); + List AdministWeekRestdeList_4 = restdeManageService.selectAdministDayRestde(vo); + + // 목요일 + weekCal.add(weekCal.DATE, 1); + vo.setYear(Integer.toString(weekCal.get(weekCal.YEAR))); + vo.setMonth(Integer.toString(weekCal.get(weekCal.MONTH)+1)); + vo.setDay(Integer.toString(weekCal.get(weekCal.DAY_OF_MONTH))); + vo.setWeek(weekCal.get(weekCal.DAY_OF_WEEK)); + List CalInfoList_5 = restdeManageService.selectAdministDayCal(vo); + List AdministWeekRestdeList_5 = restdeManageService.selectAdministDayRestde(vo); + + // 금요일 + weekCal.add(weekCal.DATE, 1); + vo.setYear(Integer.toString(weekCal.get(weekCal.YEAR))); + vo.setMonth(Integer.toString(weekCal.get(weekCal.MONTH)+1)); + vo.setDay(Integer.toString(weekCal.get(weekCal.DAY_OF_MONTH))); + vo.setWeek(weekCal.get(weekCal.DAY_OF_WEEK)); + List CalInfoList_6 = restdeManageService.selectAdministDayCal(vo); + List AdministWeekRestdeList_6 = restdeManageService.selectAdministDayRestde(vo); + + // 토요일 + weekCal.add(weekCal.DATE, 1); + vo.setYear(Integer.toString(weekCal.get(weekCal.YEAR))); + vo.setMonth(Integer.toString(weekCal.get(weekCal.MONTH)+1)); + vo.setDay(Integer.toString(weekCal.get(weekCal.DAY_OF_MONTH))); + vo.setWeek(weekCal.get(weekCal.DAY_OF_WEEK)); + List CalInfoList_7 = restdeManageService.selectAdministDayCal(vo); + List AdministWeekRestdeList_7 = restdeManageService.selectAdministDayRestde(vo); + + model.addAttribute("resultList_1", CalInfoList_1); + model.addAttribute("resultList_2", CalInfoList_2); + model.addAttribute("resultList_3", CalInfoList_3); + model.addAttribute("resultList_4", CalInfoList_4); + model.addAttribute("resultList_5", CalInfoList_5); + model.addAttribute("resultList_6", CalInfoList_6); + model.addAttribute("resultList_7", CalInfoList_7); + model.addAttribute("RestdeList_1", AdministWeekRestdeList_1); + model.addAttribute("RestdeList_2", AdministWeekRestdeList_2); + model.addAttribute("RestdeList_3", AdministWeekRestdeList_3); + model.addAttribute("RestdeList_4", AdministWeekRestdeList_4); + model.addAttribute("RestdeList_5", AdministWeekRestdeList_5); + model.addAttribute("RestdeList_6", AdministWeekRestdeList_6); + model.addAttribute("RestdeList_7", AdministWeekRestdeList_7); + + model.addAttribute("resultList", CalInfoList); + + return "egovframework/com/sym/cal/EgovAdministWeekCalendar"; + } + + /** + * 행정달력 월간 + * @param restde + * @param model + * @return "egovframework/com/sym/cal/EgovAdministMonthCalendar" + * @throws Exception + */ + @RequestMapping(value="/sym/cal/EgovAdministMonthCalendar.do") + public String selectAdministMonthCalendar (Restde restde, BindingResult bindingResult + , ModelMap model + ) throws Exception { + + //2011.10.18 달력 출력을 위해 필요한 숫자 이외의 값을 사용하는 경우 체크 + bindingResult = checkRestdeWithValidator(restde, bindingResult); + + if(bindingResult.hasErrors()){ + + return "egovframework/com/cmm/error/dataAccessFailure"; + + } + + Calendar cal = Calendar.getInstance(); + + if(restde.getYear()==null || restde.getYear().equals("")){ + restde.setYear(Integer.toString(cal.get(Calendar.YEAR))); + } + if(restde.getMonth()==null || restde.getMonth().equals("")){ + restde.setMonth(Integer.toString(cal.get(Calendar.MONTH)+1)); + } + int iYear = Integer.parseInt(restde.getYear()); + int iMonth = Integer.parseInt(restde.getMonth()); + + if (iMonth<1){ + iYear--; + iMonth = 12; + } + if (iMonth>12){ + iYear++; + iMonth = 1; + } + if (iYear<1){ + iYear = 1; + iMonth = 1; + } + if (iYear>9999){ + iYear = 9999; + iMonth = 12; + } + restde.setYear(Integer.toString(iYear)); + restde.setMonth(Integer.toString(iMonth)); + + cal.set(iYear,iMonth-1,1); + + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DATE)); + + List CalInfoList = restdeManageService.selectAdministRestdePopup(restde); + + + List AdministMonthRestdeList = restdeManageService.selectAdministMonthRestde(restde); + + model.addAttribute("resultList", CalInfoList); + model.addAttribute("RestdeList", AdministMonthRestdeList); + + return "egovframework/com/sym/cal/EgovAdministMonthCalendar"; + } + + + /** + * 행정달력 연간 + * @param restde + * @param model + * @return "egovframework/com/sym/cal/EgovAdministYearCalendar" + * @throws Exception + */ + @RequestMapping(value="/sym/cal/EgovAdministYearCalendar.do") + public String selectAdministYearCalendar (Restde restde, BindingResult bindingResult + , ModelMap model + ) throws Exception { + + //2011.10.18 달력 출력을 위해 필요한 숫자 이외의 값을 사용하는 경우 체크 + bindingResult = checkRestdeWithValidator(restde, bindingResult); + + if(bindingResult.hasErrors()){ + + return "egovframework/com/cmm/error/dataAccessFailure"; + + } + + Calendar cal = Calendar.getInstance(); + + if(restde.getYear()==null || restde.getYear().equals("")){ + restde.setYear(Integer.toString(cal.get(Calendar.YEAR))); + } + if(restde.getMonth()==null || restde.getMonth().equals("")){ + restde.setMonth(Integer.toString(cal.get(Calendar.MONTH)+1)); + } + int iYear = Integer.parseInt(restde.getYear()); + int iMonth = Integer.parseInt(restde.getMonth()); + + if (iMonth<1){ + iYear--; + iMonth = 12; + } + if (iMonth>12){ + iYear++; + iMonth = 1; + } + if (iYear<1){ + iYear = 1; + iMonth = 1; + } + if (iYear>9999){ + iYear = 9999; + iMonth = 12; + } + restde.setYear(Integer.toString(iYear)); + + /* 월별확인 */ + + /* 1월 */ + iMonth = 1; + restde.setMonth(Integer.toString(iMonth)); + cal.set(iYear,iMonth-1,1); + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DATE)); + List CalInfoList_1 = restdeManageService.selectAdministRestdePopup(restde); + List AdministMonthRestdeList_1 = restdeManageService.selectAdministMonthRestde(restde); + + /* 2월 */ + iMonth = 2; + restde.setMonth(Integer.toString(iMonth)); + cal.set(iYear,iMonth-1,1); + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DATE)); + List CalInfoList_2 = restdeManageService.selectAdministRestdePopup(restde); + List AdministMonthRestdeList_2 = restdeManageService.selectAdministMonthRestde(restde); + + /* 3월 */ + iMonth = 3; + restde.setMonth(Integer.toString(iMonth)); + cal.set(iYear,iMonth-1,1); + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DATE)); + List CalInfoList_3 = restdeManageService.selectAdministRestdePopup(restde); + List AdministMonthRestdeList_3 = restdeManageService.selectAdministMonthRestde(restde); + + /* 4월 */ + iMonth = 4; + restde.setMonth(Integer.toString(iMonth)); + cal.set(iYear,iMonth-1,1); + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DATE)); + List CalInfoList_4 = restdeManageService.selectAdministRestdePopup(restde); + List AdministMonthRestdeList_4 = restdeManageService.selectAdministMonthRestde(restde); + + /* 5월 */ + iMonth = 5; + restde.setMonth(Integer.toString(iMonth)); + cal.set(iYear,iMonth-1,1); + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DATE)); + List CalInfoList_5 = restdeManageService.selectAdministRestdePopup(restde); + List AdministMonthRestdeList_5 = restdeManageService.selectAdministMonthRestde(restde); + + /* 6월 */ + iMonth = 6; + restde.setMonth(Integer.toString(iMonth)); + cal.set(iYear,iMonth-1,1); + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DATE)); + List CalInfoList_6 = restdeManageService.selectAdministRestdePopup(restde); + List AdministMonthRestdeList_6 = restdeManageService.selectAdministMonthRestde(restde); + + /* 7월 */ + iMonth = 7; + restde.setMonth(Integer.toString(iMonth)); + cal.set(iYear,iMonth-1,1); + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DATE)); + List CalInfoList_7 = restdeManageService.selectAdministRestdePopup(restde); + List AdministMonthRestdeList_7 = restdeManageService.selectAdministMonthRestde(restde); + + /* 8월 */ + iMonth = 8; + restde.setMonth(Integer.toString(iMonth)); + cal.set(iYear,iMonth-1,1); + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DATE)); + List CalInfoList_8 = restdeManageService.selectAdministRestdePopup(restde); + List AdministMonthRestdeList_8 = restdeManageService.selectAdministMonthRestde(restde); + + /* 9월 */ + iMonth = 9; + restde.setMonth(Integer.toString(iMonth)); + cal.set(iYear,iMonth-1,1); + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DATE)); + List CalInfoList_9 = restdeManageService.selectAdministRestdePopup(restde); + List AdministMonthRestdeList_9 = restdeManageService.selectAdministMonthRestde(restde); + + /* 10월 */ + iMonth = 10; + restde.setMonth(Integer.toString(iMonth)); + cal.set(iYear,iMonth-1,1); + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DATE)); + List CalInfoList_10 = restdeManageService.selectAdministRestdePopup(restde); + List AdministMonthRestdeList_10 = restdeManageService.selectAdministMonthRestde(restde); + + /* 11월 */ + iMonth = 11; + restde.setMonth(Integer.toString(iMonth)); + cal.set(iYear,iMonth-1,1); + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DATE)); + List CalInfoList_11 = restdeManageService.selectAdministRestdePopup(restde); + List AdministMonthRestdeList_11 = restdeManageService.selectAdministMonthRestde(restde); + + /* 12월 */ + iMonth = 12; + restde.setMonth(Integer.toString(iMonth)); + cal.set(iYear,iMonth-1,1); + restde.setStartWeekMonth(cal.get(Calendar.DAY_OF_WEEK)); + restde.setLastDayMonth(cal.getActualMaximum(Calendar.DATE)); + List CalInfoList_12 = restdeManageService.selectAdministRestdePopup(restde); + List AdministMonthRestdeList_12 = restdeManageService.selectAdministMonthRestde(restde); + + model.addAttribute("resultList_1" , CalInfoList_1 ); + model.addAttribute("resultList_2" , CalInfoList_2 ); + model.addAttribute("resultList_3" , CalInfoList_3 ); + model.addAttribute("resultList_4" , CalInfoList_4 ); + model.addAttribute("resultList_5" , CalInfoList_5 ); + model.addAttribute("resultList_6" , CalInfoList_6 ); + model.addAttribute("resultList_7" , CalInfoList_7 ); + model.addAttribute("resultList_8" , CalInfoList_8 ); + model.addAttribute("resultList_9" , CalInfoList_9 ); + model.addAttribute("resultList_10", CalInfoList_10); + model.addAttribute("resultList_11", CalInfoList_11); + model.addAttribute("resultList_12", CalInfoList_12); + model.addAttribute("RestdeList_1" , AdministMonthRestdeList_1 ); + model.addAttribute("RestdeList_2" , AdministMonthRestdeList_2 ); + model.addAttribute("RestdeList_3" , AdministMonthRestdeList_3 ); + model.addAttribute("RestdeList_4" , AdministMonthRestdeList_4 ); + model.addAttribute("RestdeList_5" , AdministMonthRestdeList_5 ); + model.addAttribute("RestdeList_6" , AdministMonthRestdeList_6 ); + model.addAttribute("RestdeList_7" , AdministMonthRestdeList_7 ); + model.addAttribute("RestdeList_8" , AdministMonthRestdeList_8 ); + model.addAttribute("RestdeList_9" , AdministMonthRestdeList_9 ); + model.addAttribute("RestdeList_10", AdministMonthRestdeList_10); + model.addAttribute("RestdeList_11", AdministMonthRestdeList_11); + model.addAttribute("RestdeList_12", AdministMonthRestdeList_12); + + return "egovframework/com/sym/cal/EgovAdministYearCalendar"; + } + + + /** + * 휴일을 삭제한다. + * @param loginVO + * @param restde + * @param model + * @return "forward:/sym/cal/EgovRestdeList.do" + * @throws Exception + */ + @RequestMapping(value="/sym/cal/EgovRestdeRemove.do") + public String deleteRestde (@ModelAttribute("loginVO") LoginVO loginVO + , Restde restde + , ModelMap model + ) throws Exception { + restdeManageService.deleteRestde(restde); + return "forward:/sym/cal/EgovRestdeList.do"; + } + + + /** + * 휴일을 등록한다. + * @param loginVO + * @param restde + * @param bindingResult + * @param model + * @return "egovframework/com/sym/cal/EgovRestdeRegist" + * @throws Exception + */ + @RequestMapping(value="/sym/cal/EgovRestdeRegist.do") + public String insertRestde (@ModelAttribute("loginVO") LoginVO loginVO + , @ModelAttribute("restde") Restde restde + , BindingResult bindingResult + , ModelMap model + ) throws Exception { + if (restde.getRestdeDe() == null + ||restde.getRestdeDe().equals("")) { + + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM017"); + List restdeCodeList = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("restdeCode", restdeCodeList); + + return "egovframework/com/sym/cal/EgovRestdeRegist"; + } + + beanValidator.validate(restde, bindingResult); + if (bindingResult.hasErrors()){ + return "egovframework/com/sym/cal/EgovRestdeRegist"; + } + + restde.setRestdeNo(idgenService.getNextIntegerId()%1000000); + restde.setFrstRegisterId(loginVO.getUniqId()); + + restdeManageService.insertRestde(restde); + return "forward:/sym/cal/EgovRestdeList.do"; + } + + + /** + * 휴일 세부내역을 조회한다. + * @param loginVO + * @param restde + * @param model + * @return "egovframework/com/sym/cal/EgovRestdeDetail" + * @throws Exception + */ + @RequestMapping(value="/sym/cal/EgovRestdeDetail.do") + public String selectRestdeDetail (@ModelAttribute("loginVO") LoginVO loginVO + , Restde restde + , ModelMap model + ) throws Exception { + Restde vo = restdeManageService.selectRestdeDetail(restde); + model.addAttribute("result", vo); + + return "egovframework/com/sym/cal/EgovRestdeDetail"; + } + + /** + * 휴일 리스트를 조회한다. + * @param loginVO + * @param searchVO + * @param model + * @return "egovframework/com/sym/cal/EgovRestdeList" + * @throws Exception + */ + @IncludedInfo(name="공휴일관리(달력)", listUrl="/sym/cal/EgovRestdeList.do", order = 1300 ,gid = 90) + @RequestMapping(value="/sym/cal/EgovRestdeList.do") + public String selectRestdeList (@ModelAttribute("loginVO") LoginVO loginVO + , @ModelAttribute("searchVO") RestdeVO searchVO + , ModelMap model + ) throws Exception { + /** 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()); + + List CmmnCodeList = restdeManageService.selectRestdeList(searchVO); + model.addAttribute("resultList", CmmnCodeList); + + int totCnt = restdeManageService.selectRestdeListTotCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/sym/cal/EgovRestdeList"; + } + + /** + * 휴일을 수정한다. + * @param loginVO + * @param restde + * @param bindingResult + * @param commandMap + * @param model + * @return "egovframework/com/sym/cal/EgovRestdeModify" + * @throws Exception + */ + @RequestMapping(value="/sym/cal/EgovRestdeModify.do") + public String updateRestde (@ModelAttribute("loginVO") LoginVO loginVO + , @ModelAttribute("restde") Restde restde + , BindingResult bindingResult + , @RequestParam Map commandMap + , ModelMap model + ) throws Exception { + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); + if (sCmd.equals("")) { + Restde vo = restdeManageService.selectRestdeDetail(restde); + model.addAttribute("restde", vo); + + ComDefaultCodeVO CodeVO = new ComDefaultCodeVO(); + CodeVO.setCodeId("COM017"); + List restdeCodeList = cmmUseService.selectCmmCodeDetail(CodeVO); + model.addAttribute("restdeCode", restdeCodeList); + + return "egovframework/com/sym/cal/EgovRestdeModify"; + } else if (sCmd.equals("Modify")) { + beanValidator.validate(restde, bindingResult); + if (bindingResult.hasErrors()){ + ComDefaultCodeVO CodeVO = new ComDefaultCodeVO(); + CodeVO.setCodeId("COM017"); + List restdeCodeList = cmmUseService.selectCmmCodeDetail(CodeVO); + model.addAttribute("restdeCode", restdeCodeList); + + return "egovframework/com/sym/cal/EgovRestdeModify"; + } + + restde.setLastUpdusrId(loginVO.getUniqId()); + restdeManageService.updateRestde(restde); + return "forward:/sym/cal/EgovRestdeList.do"; + } else { + return "forward:/sym/cal/EgovRestdeList.do"; + } + } + + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sym/ccm/cca/service/CmmnCode.java b/src/main/java/egovframework/com/sym/ccm/cca/service/CmmnCode.java new file mode 100644 index 0000000..389515b --- /dev/null +++ b/src/main/java/egovframework/com/sym/ccm/cca/service/CmmnCode.java @@ -0,0 +1,195 @@ +package egovframework.com.sym.ccm.cca.service; + +import java.io.Serializable; + +/** +* 공통코드 모델 클래스 +* @author 공통서비스 개발팀 이중호 +* @since 2009.04.01 +* @version 1.0 +* @see +* +*
    +* << 개정이력(Modification Information) >>
    +*
    +*   수정일      수정자           수정내용
    +*  -------    --------    ---------------------------
    +*   2009.04.01  이중호          최초 생성
    +*
    +* 
    +*/ + +public class CmmnCode implements Serializable { + + private static final long serialVersionUID = 638950577710720796L; + + /* + * 코드ID + */ + private String codeId = ""; + + /* + * 코드ID명 + */ + private String codeIdNm = ""; + + /* + * 코드ID설명 + */ + private String codeIdDc = ""; + + /* + * 분류코드 + */ + private String clCode = ""; + + /* + * 분류코드명 + */ + private String clCodeNm = ""; + + /* + * 사용여부 + */ + private String useAt = ""; + + /* + * 최초등록자ID + */ + private String frstRegisterId = ""; + + /* + * 최종수정자ID + */ + private String lastUpdusrId = ""; + + /** + * codeId attribute 를 리턴한다. + * @return String + */ + public String getCodeId() { + return codeId; + } + + /** + * codeId attribute 값을 설정한다. + * @param codeId String + */ + public void setCodeId(String codeId) { + this.codeId = codeId; + } + + /** + * codeIdNm attribute 를 리턴한다. + * @return String + */ + public String getCodeIdNm() { + return codeIdNm; + } + + /** + * codeIdNm attribute 값을 설정한다. + * @param codeIdNm String + */ + public void setCodeIdNm(String codeIdNm) { + this.codeIdNm = codeIdNm; + } + + /** + * codeIdDc attribute 를 리턴한다. + * @return String + */ + public String getCodeIdDc() { + return codeIdDc; + } + + /** + * codeIdDc attribute 값을 설정한다. + * @param codeIdDc String + */ + public void setCodeIdDc(String codeIdDc) { + this.codeIdDc = codeIdDc; + } + + /** + * clCode attribute 를 리턴한다. + * @return String + */ + public String getClCode() { + return clCode; + } + + /** + * clCode attribute 값을 설정한다. + * @param clCode String + */ + public void setClCode(String clCode) { + this.clCode = clCode; + } + + /** + * clCodeNm attribute 를 리턴한다. + * @return String + */ + public String getClCodeNm() { + return clCodeNm; + } + + /** + * clCodeNm attribute 값을 설정한다. + * @param clCodeNm String + */ + public void setClCodeNm(String clCodeNm) { + this.clCodeNm = clCodeNm; + } + + /** + * useAt attribute 를 리턴한다. + * @return String + */ + public String getUseAt() { + return useAt; + } + + /** + * useAt attribute 값을 설정한다. + * @param useAt String + */ + public void setUseAt(String useAt) { + this.useAt = useAt; + } + + /** + * frstRegisterId attribute 를 리턴한다. + * @return String + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * frstRegisterId attribute 값을 설정한다. + * @param frstRegisterId String + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * lastUpdusrId attribute 를 리턴한다. + * @return String + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * lastUpdusrId attribute 값을 설정한다. + * @param lastUpdusrId String + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + +} diff --git a/src/main/java/egovframework/com/sym/ccm/cca/service/CmmnCodeVO.java b/src/main/java/egovframework/com/sym/ccm/cca/service/CmmnCodeVO.java new file mode 100644 index 0000000..4956c82 --- /dev/null +++ b/src/main/java/egovframework/com/sym/ccm/cca/service/CmmnCodeVO.java @@ -0,0 +1,198 @@ +package egovframework.com.sym.ccm.cca.service; + +import java.io.Serializable; + +/** +* +* 공통코드 VO 클래스 +* @author 공통서비스 개발팀 이중호 +* @since 2009.04.01 +* @version 1.0 +* @see +* +*
    +* << 개정이력(Modification Information) >>
    +*
    +*   수정일      수정자           수정내용
    +*  -------    --------    ---------------------------
    +*   2009.04.01  이중호          최초 생성
    +*
    +* 
    +*/ + +public class CmmnCodeVO extends CmmnCode implements Serializable { + + private static final long serialVersionUID = -4184057693049713450L; + + /** 검색조건 */ + private String searchCondition = ""; + + /** 검색Keyword */ + private String searchKeyword = ""; + + /** 검색사용여부 */ + private String searchUseYn = ""; + + /** 현재페이지 */ + private int pageIndex = 1; + + /** 페이지갯수 */ + private int pageUnit = 10; + + /** 페이지사이즈 */ + private int pageSize = 10; + + /** firstIndex */ + private int firstIndex = 1; + + /** lastIndex */ + private int lastIndex = 1; + + /** recordCountPerPage */ + private int recordCountPerPage = 10; + + /** + * searchCondition attribute 를 리턴한다. + * @return String + */ + public String getSearchCondition() { + return searchCondition; + } + + /** + * searchCondition attribute 값을 설정한다. + * @param searchCondition String + */ + public void setSearchCondition(String searchCondition) { + this.searchCondition = searchCondition; + } + + /** + * searchKeyword attribute 를 리턴한다. + * @return String + */ + public String getSearchKeyword() { + return searchKeyword; + } + + /** + * searchKeyword attribute 값을 설정한다. + * @param searchKeyword String + */ + public void setSearchKeyword(String searchKeyword) { + this.searchKeyword = searchKeyword; + } + + /** + * searchUseYn attribute 를 리턴한다. + * @return String + */ + public String getSearchUseYn() { + return searchUseYn; + } + + /** + * searchUseYn attribute 값을 설정한다. + * @param searchUseYn String + */ + public void setSearchUseYn(String searchUseYn) { + this.searchUseYn = searchUseYn; + } + + /** + * pageIndex attribute 를 리턴한다. + * @return int + */ + public int getPageIndex() { + return pageIndex; + } + + /** + * pageIndex attribute 값을 설정한다. + * @param pageIndex int + */ + public void setPageIndex(int pageIndex) { + this.pageIndex = pageIndex; + } + + /** + * pageUnit attribute 를 리턴한다. + * @return int + */ + public int getPageUnit() { + return pageUnit; + } + + /** + * pageUnit attribute 값을 설정한다. + * @param pageUnit int + */ + public void setPageUnit(int pageUnit) { + this.pageUnit = pageUnit; + } + + /** + * pageSize attribute 를 리턴한다. + * @return int + */ + public int getPageSize() { + return pageSize; + } + + /** + * pageSize attribute 값을 설정한다. + * @param pageSize int + */ + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + /** + * firstIndex attribute 를 리턴한다. + * @return int + */ + public int getFirstIndex() { + return firstIndex; + } + + /** + * firstIndex attribute 값을 설정한다. + * @param firstIndex int + */ + public void setFirstIndex(int firstIndex) { + this.firstIndex = firstIndex; + } + + /** + * lastIndex attribute 를 리턴한다. + * @return int + */ + public int getLastIndex() { + return lastIndex; + } + + /** + * lastIndex attribute 값을 설정한다. + * @param lastIndex int + */ + public void setLastIndex(int lastIndex) { + this.lastIndex = lastIndex; + } + + /** + * recordCountPerPage attribute 를 리턴한다. + * @return int + */ + public int getRecordCountPerPage() { + return recordCountPerPage; + } + + /** + * recordCountPerPage attribute 값을 설정한다. + * @param recordCountPerPage int + */ + public void setRecordCountPerPage(int recordCountPerPage) { + this.recordCountPerPage = recordCountPerPage; + } + +} diff --git a/src/main/java/egovframework/com/sym/ccm/cca/service/EgovCcmCmmnCodeManageService.java b/src/main/java/egovframework/com/sym/ccm/cca/service/EgovCcmCmmnCodeManageService.java new file mode 100644 index 0000000..dad3a88 --- /dev/null +++ b/src/main/java/egovframework/com/sym/ccm/cca/service/EgovCcmCmmnCodeManageService.java @@ -0,0 +1,72 @@ +package egovframework.com.sym.ccm.cca.service; + +import java.util.List; + +/** +* +* 공통코드에 관한 서비스 인터페이스 클래스를 정의한다 +* @author 공통서비스 개발팀 이중호 +* @since 2009.04.01 +* @version 1.0 +* @see +* +*
    +* << 개정이력(Modification Information) >>
    +*
    +*   수정일      수정자           수정내용
    +*  -------    --------    ---------------------------
    +*   2009.04.01  이중호          최초 생성
    +*
    +* 
    +*/ + +public interface EgovCcmCmmnCodeManageService { + + /** + * 공통분류코드 총 갯수를 조회한다. + * + * @param searchVO + * @return int(공통분류코드 총 갯수) + * @throws Exception + */ + int selectCmmnCodeListTotCnt(CmmnCodeVO searchVO) throws Exception; + + /** + * 공통코드 목록을 조회한다. + * + * @param searchVO + * @return List(공통분류코드 목록) + * @throws Exception + */ + List selectCmmnCodeList(CmmnCodeVO searchVO) throws Exception; + + /** + * 공통코드 상세항목을 조회한다. + * @param cmmnCode + * @return CmmnCode(공통코드) + * @throws Exception + */ + CmmnCodeVO selectCmmnCodeDetail(CmmnCodeVO cmmnCodeVO) throws Exception; + + /** + * 공통코드를 수정한다. + * @param cmmnCodeVO + * @throws Exception + */ + void updateCmmnCode(CmmnCodeVO cmmnCodeVO) throws Exception; + + /** + * 공통코드를 등록한다. + * @param cmmnCode + * @throws Exception + */ + void insertCmmnCode(CmmnCode cmmnCode) throws Exception; + + /** + * 공통코드를 삭제한다. + * @param cmmnCode + * @throws Exception + */ + void deleteCmmnCode(CmmnCode cmmnCode) throws Exception; + +} diff --git a/src/main/java/egovframework/com/sym/ccm/cca/service/impl/CmmnCodeManageDAO.java b/src/main/java/egovframework/com/sym/ccm/cca/service/impl/CmmnCodeManageDAO.java new file mode 100644 index 0000000..7c57799 --- /dev/null +++ b/src/main/java/egovframework/com/sym/ccm/cca/service/impl/CmmnCodeManageDAO.java @@ -0,0 +1,87 @@ +package egovframework.com.sym.ccm.cca.service.impl; + +import java.util.List; + +import org.springframework.stereotype.Repository; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.sym.ccm.cca.service.CmmnCode; +import egovframework.com.sym.ccm.cca.service.CmmnCodeVO; + +/** +* +* 공통코드에 대한 데이터 접근 클래스를 정의한다 +* @author 공통서비스 개발팀 이중호 +* @since 2009.04.01 +* @version 1.0 +* @see +* +*
    +* << 개정이력(Modification Information) >>
    +*
    +*   수정일      수정자           수정내용
    +*  -------    --------    ---------------------------
    +*   2009.04.01  이중호          최초 생성
    +*
    +* 
    +*/ + +@Repository("CmmnCodeManageDAO") +public class CmmnCodeManageDAO extends EgovComAbstractDAO { + + /** + * 공통코드 총 갯수를 조회한다. + * @param searchVO + * @return int(공통코드 총 갯수) + */ + public int selectCmmnCodeListTotCnt(CmmnCodeVO searchVO) throws Exception{ + return (Integer)selectOne("CmmnCodeManage.selectCmmnCodeListTotCnt", searchVO); + } + + /** + * 공통코드 목록을 조회한다. + * @param searchVO + * @return List(공통코드 목록) + * @throws Exception + */ + public List selectCmmnCodeList(CmmnCodeVO searchVO) throws Exception{ + return list("CmmnCodeManage.selectCmmnCodeList", searchVO); + } + + /** + * 공통코드 상세항목을 조회한다. + * @param cmmnCode + * @return CmmnCode(공통코드) + */ + public CmmnCodeVO selectCmmnCodeDetail(CmmnCodeVO cmmnCodeVO) throws Exception{ + return selectOne("CmmnCodeManage.selectCmmnCodeDetail", cmmnCodeVO); +} + + /** + * 공통코드를 수정한다. + * @param cmmnCode + * @throws Exception + */ + public void updateCmmnCode(CmmnCode cmmnCode) throws Exception{ + update("CmmnCodeManage.updateCmmnCode", cmmnCode); + } + + /** + * 공통코드를 등록한다. + * @param cmmnCode + * @throws Exception + */ + public void insertCmmnCode(CmmnCode cmmnCode) throws Exception{ + insert("CmmnCodeManage.insertCmmnCode", cmmnCode); + } + + /** + * 공통코드를 삭제한다. + * @param cmmnCode + * @throws Exception + */ + public void deleteCmmnCode(CmmnCode cmmnCode) { + delete("CmmnCodeManage.deleteCmmnCode", cmmnCode); + } + +} diff --git a/src/main/java/egovframework/com/sym/ccm/cca/service/impl/EgovCcmCmmnCodeManageServiceImpl.java b/src/main/java/egovframework/com/sym/ccm/cca/service/impl/EgovCcmCmmnCodeManageServiceImpl.java new file mode 100644 index 0000000..d07cb40 --- /dev/null +++ b/src/main/java/egovframework/com/sym/ccm/cca/service/impl/EgovCcmCmmnCodeManageServiceImpl.java @@ -0,0 +1,88 @@ +package egovframework.com.sym.ccm.cca.service.impl; + +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import egovframework.com.sym.ccm.cca.service.CmmnCode; +import egovframework.com.sym.ccm.cca.service.CmmnCodeVO; +import egovframework.com.sym.ccm.cca.service.EgovCcmCmmnCodeManageService; +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +/** +* +* 공통코드에 대한 서비스 구현클래스를 정의한다 +* @author 공통서비스 개발팀 이중호 +* @since 2009.04.01 +* @version 1.0 +* @see +* +*
    +* << 개정이력(Modification Information) >>
    +*
    +*   수정일      수정자           수정내용
    +*  -------    --------    ---------------------------
    +*   2009.04.01  이중호          최초 생성
    +*
    +* 
    +*/ + +@Service("CmmnCodeManageService") +public class EgovCcmCmmnCodeManageServiceImpl extends EgovAbstractServiceImpl implements EgovCcmCmmnCodeManageService{ + + @Resource(name="CmmnCodeManageDAO") + private CmmnCodeManageDAO cmmnCodeManageDAO; + + /** + * 공통코드 총 갯수를 조회한다. + */ + @Override + public int selectCmmnCodeListTotCnt(CmmnCodeVO searchVO) throws Exception { + return cmmnCodeManageDAO.selectCmmnCodeListTotCnt(searchVO); + } + + /** + * 공통코드 목록을 조회한다. + */ + @Override + public List selectCmmnCodeList(CmmnCodeVO searchVO) throws Exception { + return cmmnCodeManageDAO.selectCmmnCodeList(searchVO); + } + + /** + * 공통코드 상세항목을 조회한다. + */ + @Override + public CmmnCodeVO selectCmmnCodeDetail(CmmnCodeVO cmmnCodeVO) throws Exception{ + CmmnCodeVO ret = cmmnCodeManageDAO.selectCmmnCodeDetail(cmmnCodeVO); + return ret; + } + + /** + * 공통코드를 수정한다. + */ + @Override + public void updateCmmnCode(CmmnCodeVO cmmnCodeVO) throws Exception { + cmmnCodeManageDAO.updateCmmnCode(cmmnCodeVO); + } + + /** + * 공통코드를 등록한다. + */ + @Override + public void insertCmmnCode(CmmnCode cmmnCode) throws Exception { + cmmnCodeManageDAO.insertCmmnCode(cmmnCode); + + } + + /** + * 공통코드를 삭제한다. + */ + @Override + public void deleteCmmnCode(CmmnCode cmmnCode) throws Exception { + cmmnCodeManageDAO.deleteCmmnCode(cmmnCode); + } + +} diff --git a/src/main/java/egovframework/com/sym/ccm/cca/web/EgovCcmCmmnCodeManageController.java b/src/main/java/egovframework/com/sym/ccm/cca/web/EgovCcmCmmnCodeManageController.java new file mode 100644 index 0000000..e4c30c4 --- /dev/null +++ b/src/main/java/egovframework/com/sym/ccm/cca/web/EgovCcmCmmnCodeManageController.java @@ -0,0 +1,262 @@ +package egovframework.com.sym.ccm.cca.web; + +import java.util.List; + +import javax.annotation.Resource; + +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.springmodules.validation.commons.DefaultBeanValidator; + +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.sym.ccm.cca.service.CmmnCode; +import egovframework.com.sym.ccm.cca.service.CmmnCodeVO; +import egovframework.com.sym.ccm.cca.service.EgovCcmCmmnCodeManageService; +import egovframework.com.sym.ccm.ccc.service.CmmnClCodeVO; +import egovframework.com.sym.ccm.ccc.service.EgovCcmCmmnClCodeManageService; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +/** +* +* 공통코드에 관한 요청을 받아 서비스 클래스로 요청을 전달하고 서비스클래스에서 처리한 결과를 웹 화면으로 전달을 위한 Controller를 정의한다 +* @author 공통서비스 개발팀 이중호 +* @since 2009.04.01 +* @version 1.0 +* @see +* +*
    +* << 개정이력(Modification Information) >>
    +*
    +*   수정일      수정자           수정내용
    +*  -------    --------    ---------------------------
    +*   2009.04.01  이중호          최초 생성
    +*   2011.8.26	정진오			IncludedInfo annotation 추가
    +*   2017.08.16	이정은	표준프레임워크 v3.7 개선
    +*
    +* 
    +*/ + +@Controller +public class EgovCcmCmmnCodeManageController { + + @Resource(name = "CmmnCodeManageService") + private EgovCcmCmmnCodeManageService cmmnCodeManageService; + + @Resource(name = "CmmnClCodeManageService") + private EgovCcmCmmnClCodeManageService cmmnClCodeManageService; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** EgovMessageSource */ + @Resource(name = "egovMessageSource") + EgovMessageSource egovMessageSource; + + @Autowired + private DefaultBeanValidator beanValidator; + + + + /** + * 공통분류코드 목록을 조회한다. + * + * @param searchVO + * @param model + * @return "egovframework/com/sym/ccm/cca/EgovCcmCmmnCodeList" + * @throws Exception + */ + @IncludedInfo(name = "공통코드", listUrl = "/sym/ccm/cca/SelectCcmCmmnCodeList.do", order = 980, gid = 60) + @RequestMapping(value = "/sym/ccm/cca/SelectCcmCmmnCodeList.do") + public String selectCmmnCodeList(@ModelAttribute("searchVO") CmmnCodeVO searchVO, ModelMap model) + throws Exception { + /** 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()); + + List CmmnCodeList = cmmnCodeManageService.selectCmmnCodeList(searchVO); + model.addAttribute("resultList", CmmnCodeList); + + int totCnt = cmmnCodeManageService.selectCmmnCodeListTotCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/sym/ccm/cca/EgovCcmCmmnCodeList"; + } + + /** + * 공통코드 상세항목을 조회한다. + * + * @param loginVO + * @param cmmnCodeVO + * @param model + * @return "egovframework/com/sym/ccm/cca/EgovCcmCmmnCodeDetail" + * @throws Exception + */ + @RequestMapping(value = "/sym/ccm/cca/SelectCcmCmmnCodeDetail.do") + public String selectCmmnCodeDetail(@ModelAttribute("loginVO") LoginVO loginVO, CmmnCodeVO cmmnCodeVO, ModelMap model) throws Exception { + + CmmnCodeVO vo = cmmnCodeManageService.selectCmmnCodeDetail(cmmnCodeVO); + + model.addAttribute("result", vo); + + return "egovframework/com/sym/ccm/cca/EgovCcmCmmnCodeDetail"; + } + + /** + * 공통코드 등록을 위한 등록페이지로 이동한다. + * + * @param cmmnCodeVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/sym/ccm/cca/RegistCcmCmmnCodeView.do") + public String insertCmmnCodeView(@ModelAttribute("cmmnCodeVO")CmmnCodeVO cmmnCodeVO, ModelMap model) throws Exception { + + CmmnClCodeVO searchVO = new CmmnClCodeVO(); + searchVO.setFirstIndex(0); + List CmmnCodeList = cmmnClCodeManageService.selectCmmnClCodeList(searchVO); + + model.addAttribute("clCodeList", CmmnCodeList); + + return "egovframework/com/sym/ccm/cca/EgovCcmCmmnCodeRegist"; + } + + /** + * 공통코드를 등록한다. + * + * @param CmmnCodeVO + * @param CmmnCodeVO + * @param status + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/sym/ccm/cca/RegistCcmCmmnCode.do") + public String insertCmmnCode(@ModelAttribute("searchVO") CmmnCodeVO cmmnCode, @ModelAttribute("cmmnCodeVO") CmmnCodeVO cmmnCodeVO, + BindingResult bindingResult, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + CmmnClCodeVO searchVO = new CmmnClCodeVO(); + + beanValidator.validate(cmmnCodeVO, bindingResult); + + if (bindingResult.hasErrors()) { + + List CmmnCodeList = cmmnClCodeManageService.selectCmmnClCodeList(searchVO); + model.addAttribute("clCodeList", CmmnCodeList); + + return "egovframework/com/sym/ccm/cca/EgovCcmCmmnCodeRegist"; + } + + if(cmmnCode.getCodeId() != null){ + CmmnCode vo = cmmnCodeManageService.selectCmmnCodeDetail(cmmnCode); + if(vo != null){ + model.addAttribute("message", egovMessageSource.getMessage("comSymCcmCca.validate.codeCheck")); + + searchVO.setFirstIndex(0); + List CmmnCodeList = cmmnClCodeManageService.selectCmmnClCodeList(searchVO); + model.addAttribute("clCodeList", CmmnCodeList); + + return "egovframework/com/sym/ccm/cca/EgovCcmCmmnCodeRegist"; + } + } + + cmmnCodeVO.setFrstRegisterId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + cmmnCodeManageService.insertCmmnCode(cmmnCodeVO); + + return "forward:/sym/ccm/cca/SelectCcmCmmnCodeList.do"; + } + + /** + * 공통코드를 삭제한다. + * + * @param cmmnCodeVO + * @param status + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/sym/ccm/cca/RemoveCcmCmmnCode.do") + public String deleteCmmnCode(@ModelAttribute("cmmnCodeVO") CmmnCodeVO cmmnCodeVO, + BindingResult bindingResult, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + cmmnCodeVO.setLastUpdusrId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + cmmnCodeManageService.deleteCmmnCode(cmmnCodeVO); + + return "forward:/sym/ccm/cca/SelectCcmCmmnCodeList.do"; + } + + /** + * 공통코드 수정을 위한 수정페이지로 이동한다. + * + * @param cmmnCodeVO + * @param model + * @return "egovframework/com/sym/ccm/cca/EgovCcmCmmnCodeUpdt" + * @throws Exception + */ + @RequestMapping("/sym/ccm/cca/UpdateCcmCmmnCodeView.do") + public String updateCmmnCodeView(@ModelAttribute("cmmnCodeVO") CmmnCodeVO cmmnCodeVO, ModelMap model) + throws Exception { + + CmmnCode result = cmmnCodeManageService.selectCmmnCodeDetail(cmmnCodeVO); + + model.addAttribute("cmmnCodeVO", result); + + return "egovframework/com/sym/ccm/cca/EgovCcmCmmnCodeUpdt"; + } + + /** + * 공통코드를 수정한다. + * + * @param cmmnCodeVO + * @param status + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/sym/ccm/cca/UpdateCcmCmmnCode.do") + public String updateCmmnCode(@ModelAttribute("searchVO") CmmnCodeVO cmmnCode, @ModelAttribute("cmmnCodeVO") CmmnCodeVO cmmnCodeVO, + BindingResult bindingResult, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + beanValidator.validate(cmmnCodeVO, bindingResult); + if (bindingResult.hasErrors()) { + + CmmnCode result = cmmnCodeManageService.selectCmmnCodeDetail(cmmnCode); + model.addAttribute("cmmnCodeVO", result); + + return "egovframework/com/sym/ccm/cca/EgovCcmCmmnCodeUpdt"; + } + + cmmnCodeVO.setLastUpdusrId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + cmmnCodeManageService.updateCmmnCode(cmmnCodeVO); + + return "forward:/sym/ccm/cca/SelectCcmCmmnCodeList.do"; + } + + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sym/ccm/ccc/service/CmmnClCode.java b/src/main/java/egovframework/com/sym/ccm/ccc/service/CmmnClCode.java new file mode 100644 index 0000000..09b3503 --- /dev/null +++ b/src/main/java/egovframework/com/sym/ccm/ccc/service/CmmnClCode.java @@ -0,0 +1,152 @@ +package egovframework.com.sym.ccm.ccc.service; + +import java.io.Serializable; + +/** + * 공통분류코드 모델 클래스 + * @author 공통서비스 개발팀 이중호 + * @since 2009.04.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.01  이중호          최초 생성
    + *
    + * 
    + */ +public class CmmnClCode implements Serializable { + + private static final long serialVersionUID = 4861619118930452502L; + + /* + * 분류코드 + */ + private String clCode = ""; + + /* + * 분류코드명 + */ + private String clCodeNm = ""; + + /* + * 분류코드설명 + */ + private String clCodeDc = ""; + + /* + * 사용여부 + */ + private String useAt = ""; + + /* + * 최초등록자ID + */ + private String frstRegisterId = ""; + + /* + * 최종수정자ID + */ + private String lastUpdusrId = ""; + + /** + * clCode attribute 를 리턴한다. + * @return String + */ + public String getClCode() { + return clCode; + } + + /** + * clCode attribute 값을 설정한다. + * @param clCode String + */ + public void setClCode(String clCode) { + this.clCode = clCode; + } + + /** + * clCodeNm attribute 를 리턴한다. + * @return String + */ + public String getClCodeNm() { + return clCodeNm; + } + + /** + * clCodeNm attribute 값을 설정한다. + * @param clCodeNm String + */ + public void setClCodeNm(String clCodeNm) { + this.clCodeNm = clCodeNm; + } + + /** + * clCodeDc attribute 를 리턴한다. + * @return String + */ + public String getClCodeDc() { + return clCodeDc; + } + + /** + * clCodeDc attribute 값을 설정한다. + * @param clCodeDc String + */ + public void setClCodeDc(String clCodeDc) { + this.clCodeDc = clCodeDc; + } + + /** + * useAt attribute 를 리턴한다. + * @return String + */ + public String getUseAt() { + return useAt; + } + + /** + * useAt attribute 값을 설정한다. + * @param useAt String + */ + public void setUseAt(String useAt) { + this.useAt = useAt; + } + + /** + * frstRegisterId attribute 를 리턴한다. + * @return String + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * frstRegisterId attribute 값을 설정한다. + * @param frstRegisterId String + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * lastUpdusrId attribute 를 리턴한다. + * @return String + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * lastUpdusrId attribute 값을 설정한다. + * @param lastUpdusrId String + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + +} diff --git a/src/main/java/egovframework/com/sym/ccm/ccc/service/CmmnClCodeVO.java b/src/main/java/egovframework/com/sym/ccm/ccc/service/CmmnClCodeVO.java new file mode 100644 index 0000000..c1d5ed3 --- /dev/null +++ b/src/main/java/egovframework/com/sym/ccm/ccc/service/CmmnClCodeVO.java @@ -0,0 +1,198 @@ +package egovframework.com.sym.ccm.ccc.service; + +import java.io.Serializable; + +/** + * + * 공통분류코드 VO 클래스 + * @author 공통서비스 개발팀 이중호 + * @since 2009.04.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.01  이중호          최초 생성
    + *
    + * 
    + */ +public class CmmnClCodeVO extends CmmnClCode implements Serializable { + + private static final long serialVersionUID = 442842373959722378L; + + /** 검색조건 */ + private String searchCondition = ""; + + /** 검색Keyword */ + private String searchKeyword = ""; + + /** 검색사용여부 */ + private String searchUseYn = ""; + + /** 현재페이지 */ + private int pageIndex = 1; + + /** 페이지갯수 */ + private int pageUnit = 10; + + /** 페이지사이즈 */ + private int pageSize = 10; + + /** firstIndex */ + private int firstIndex = 1; + + /** lastIndex */ + private int lastIndex = 1; + + /** recordCountPerPage */ + private int recordCountPerPage = 10; + + /** + * searchCondition attribute 를 리턴한다. + * @return String + */ + public String getSearchCondition() { + return searchCondition; + } + + /** + * searchCondition attribute 값을 설정한다. + * @param searchCondition String + */ + public void setSearchCondition(String searchCondition) { + this.searchCondition = searchCondition; + } + + /** + * searchKeyword attribute 를 리턴한다. + * @return String + */ + public String getSearchKeyword() { + return searchKeyword; + } + + /** + * searchKeyword attribute 값을 설정한다. + * @param searchKeyword String + */ + public void setSearchKeyword(String searchKeyword) { + this.searchKeyword = searchKeyword; + } + + /** + * searchUseYn attribute 를 리턴한다. + * @return String + */ + public String getSearchUseYn() { + return searchUseYn; + } + + /** + * searchUseYn attribute 값을 설정한다. + * @param searchUseYn String + */ + public void setSearchUseYn(String searchUseYn) { + this.searchUseYn = searchUseYn; + } + + /** + * pageIndex attribute 를 리턴한다. + * @return int + */ + public int getPageIndex() { + return pageIndex; + } + + /** + * pageIndex attribute 값을 설정한다. + * @param pageIndex int + */ + public void setPageIndex(int pageIndex) { + this.pageIndex = pageIndex; + } + + /** + * pageUnit attribute 를 리턴한다. + * @return int + */ + public int getPageUnit() { + return pageUnit; + } + + /** + * pageUnit attribute 값을 설정한다. + * @param pageUnit int + */ + public void setPageUnit(int pageUnit) { + this.pageUnit = pageUnit; + } + + /** + * pageSize attribute 를 리턴한다. + * @return int + */ + public int getPageSize() { + return pageSize; + } + + /** + * pageSize attribute 값을 설정한다. + * @param pageSize int + */ + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + /** + * firstIndex attribute 를 리턴한다. + * @return int + */ + public int getFirstIndex() { + return firstIndex; + } + + /** + * firstIndex attribute 값을 설정한다. + * @param firstIndex int + */ + public void setFirstIndex(int firstIndex) { + this.firstIndex = firstIndex; + } + + /** + * lastIndex attribute 를 리턴한다. + * @return int + */ + public int getLastIndex() { + return lastIndex; + } + + /** + * lastIndex attribute 값을 설정한다. + * @param lastIndex int + */ + public void setLastIndex(int lastIndex) { + this.lastIndex = lastIndex; + } + + /** + * recordCountPerPage attribute 를 리턴한다. + * @return int + */ + public int getRecordCountPerPage() { + return recordCountPerPage; + } + + /** + * recordCountPerPage attribute 값을 설정한다. + * @param recordCountPerPage int + */ + public void setRecordCountPerPage(int recordCountPerPage) { + this.recordCountPerPage = recordCountPerPage; + } + + +} diff --git a/src/main/java/egovframework/com/sym/ccm/ccc/service/EgovCcmCmmnClCodeManageService.java b/src/main/java/egovframework/com/sym/ccm/ccc/service/EgovCcmCmmnClCodeManageService.java new file mode 100644 index 0000000..e6c2ed4 --- /dev/null +++ b/src/main/java/egovframework/com/sym/ccm/ccc/service/EgovCcmCmmnClCodeManageService.java @@ -0,0 +1,71 @@ +package egovframework.com.sym.ccm.ccc.service; + +import java.util.List; + +/** + * + * 공통분류코드에 관한 서비스 인터페이스 클래스를 정의한다 + * @author 공통서비스 개발팀 이중호 + * @since 2009.04.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.01  이중호          최초 생성
    + *
    + * 
    + */ + + +public interface EgovCcmCmmnClCodeManageService { + + /** + * 공통분류코드 총 갯수를 조회한다. + * + * @param searchVO + * @return int(공통분류코드 총 갯수) + */ + int selectCmmnClCodeListTotCnt(CmmnClCodeVO searchVO) throws Exception; + + /** + * 공통분류코드 목록을 조회한다. + * @param searchVO + * @return List(공통분류코드 목록) + * @throws Exception + */ + List selectCmmnClCodeList(CmmnClCodeVO searchVO) throws Exception; + + /** + * 공통분류코드 상세항목을 조회한다. + * @param cmmnClCode + * @return CmmnClCode(공통분류코드) + * @throws Exception + */ + CmmnClCode selectCmmnClCodeDetail(CmmnClCodeVO cmmnClCodeVO) throws Exception; + + /** + * 공통분류코드를 등록한다. + * @param cmmnClCodeVO + * @throws Exception + */ + void insertCmmnClCode(CmmnClCodeVO cmmnClCodeVO) throws Exception; + + /** + * 공통분류코드를 삭제한다. + * @param cmmnClCodeVO + * @throws Exception + */ + void deleteCmmnClCode(CmmnClCodeVO cmmnClCodeVO) throws Exception; + + /** + * 공통분류코드를 수정한다. + * @param cmmnClCodeVO + * @throws Exception + */ + void updateCmmnClCode(CmmnClCodeVO cmmnClCodeVO) throws Exception; + +} diff --git a/src/main/java/egovframework/com/sym/ccm/ccc/service/impl/CmmnClCodeManageDAO.java b/src/main/java/egovframework/com/sym/ccm/ccc/service/impl/CmmnClCodeManageDAO.java new file mode 100644 index 0000000..ac7fcae --- /dev/null +++ b/src/main/java/egovframework/com/sym/ccm/ccc/service/impl/CmmnClCodeManageDAO.java @@ -0,0 +1,89 @@ +package egovframework.com.sym.ccm.ccc.service.impl; + +import java.util.List; + +import org.springframework.stereotype.Repository; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.sym.ccm.ccc.service.CmmnClCode; +import egovframework.com.sym.ccm.ccc.service.CmmnClCodeVO; + +/** +* +* 공통분류코드에 대한 데이터 접근 클래스를 정의한다 +* @author 공통서비스 개발팀 이중호 +* @since 2009.04.01 +* @version 1.0 +* @see +* +*
    +* << 개정이력(Modification Information) >>
    +*
    +*   수정일      수정자           수정내용
    +*  -------    --------    ---------------------------
    +*   2009.04.01  이중호          최초 생성
    +*
    +* 
    +*/ +@Repository("CmmnClCodeManageDAO") +public class CmmnClCodeManageDAO extends EgovComAbstractDAO { + + /** + * 공통분류코드 총 갯수를 조회한다. + * @param searchVO + * @return int(공통분류코드 총 갯수) + */ + public int selectCmmnClCodeListTotCnt(CmmnClCodeVO searchVO) throws Exception { + return (Integer)selectOne("CmmnClCodeManage.selectCmmnClCodeListTotCnt", searchVO); + } + + /** + * 공통분류코드 목록을 조회한다. + * @param searchVO + * @return List(공통분류코드 목록) + * @throws Exception + */ + public List selectCmmnClCodeList(CmmnClCodeVO searchVO) throws Exception { + return list("CmmnClCodeManage.selectCmmnClCodeList", searchVO); + } + + /** + * 공통분류코드 상세항목을 조회한다. + * @param cmmnClCode + * @return CmmnClCode(공통분류코드) + */ + public CmmnClCode selectCmmnClCodeDetail(CmmnClCode cmmnClCode) throws Exception { + return (CmmnClCode)selectOne("CmmnClCodeManage.selectCmmnClCodeDetail", cmmnClCode); + } + + /** + * 공통분류코드를 등록한다. + * @param cmmnClCodeVO + * @throws Exception + */ + public void insertCmmnClCode(CmmnClCodeVO cmmnClCodeVO) throws Exception{ + System.out.println("TEST5 : 등록 DAO"); + insert("CmmnClCodeManage.insertCmmnClCode", cmmnClCodeVO); + } + + /** + * 공통분류코드를 삭제한다. + * @param cmmnClCodeVO + * @throws Exception + */ + public void deleteCmmnClCode(CmmnClCodeVO cmmnClCodeVO) throws Exception { + delete("CmmnClCodeManage.deleteCmmnClCode", cmmnClCodeVO); + + } + + /** + * 공통분류코드를 수정한다. + * @param cmmnClCodeVO + * @throws Exception + */ + public void updateCmmnClCode(CmmnClCodeVO cmmnClCodeVO) throws Exception{ + update("CmmnClCodeManage.updateCmmnClCode", cmmnClCodeVO); + + } + +} diff --git a/src/main/java/egovframework/com/sym/ccm/ccc/service/impl/EgovCcmCmmnClCodeManageServiceImpl.java b/src/main/java/egovframework/com/sym/ccm/ccc/service/impl/EgovCcmCmmnClCodeManageServiceImpl.java new file mode 100644 index 0000000..b35d350 --- /dev/null +++ b/src/main/java/egovframework/com/sym/ccm/ccc/service/impl/EgovCcmCmmnClCodeManageServiceImpl.java @@ -0,0 +1,89 @@ +package egovframework.com.sym.ccm.ccc.service.impl; + +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import egovframework.com.sym.ccm.ccc.service.CmmnClCode; +import egovframework.com.sym.ccm.ccc.service.CmmnClCodeVO; +import egovframework.com.sym.ccm.ccc.service.EgovCcmCmmnClCodeManageService; +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +/** +* +* 공통분류코드에 대한 서비스 구현클래스를 정의한다 +* +* @author 공통서비스 개발팀 이중호 +* @since 2009.04.01 +* @version 1.0 +* @see +* +*
    +* << 개정이력(Modification Information) >>
    +* 
    +*   수정일      수정자           수정내용
    +*  -------    --------    ---------------------------
    +*   2009.04.01  이중호          최초 생성
    +*
    +* 
    +*/ +@Service("CmmnClCodeManageService") +public class EgovCcmCmmnClCodeManageServiceImpl extends EgovAbstractServiceImpl implements EgovCcmCmmnClCodeManageService { + + @Resource(name = "CmmnClCodeManageDAO") + private CmmnClCodeManageDAO cmmnClCodeManageDAO; + + /** + * 공통분류코드 총 갯수를 조회한다. + */ + @Override + public int selectCmmnClCodeListTotCnt(CmmnClCodeVO searchVO) throws Exception { + return cmmnClCodeManageDAO.selectCmmnClCodeListTotCnt(searchVO); + } + + /** + * 공통분류코드 목록을 조회한다. + */ + @Override + public List selectCmmnClCodeList(CmmnClCodeVO searchVO) throws Exception { + return cmmnClCodeManageDAO.selectCmmnClCodeList(searchVO); + } + + /** + * 공통분류코드 상세항목을 조회한다. + */ + @Override + public CmmnClCode selectCmmnClCodeDetail(CmmnClCodeVO cmmnClCodeVO) throws Exception { + CmmnClCode ret = cmmnClCodeManageDAO.selectCmmnClCodeDetail(cmmnClCodeVO); + return ret; + } + + /** + * 공통분류코드를 등록한다. + */ + @Override + public void insertCmmnClCode(CmmnClCodeVO cmmnClCodeVO) throws Exception { + System.out.println("TEST4 : 등록 Serviceimpl"); + cmmnClCodeManageDAO.insertCmmnClCode(cmmnClCodeVO); + } + + /** + * 공통분류코드를 삭제한다. + */ + @Override + public void deleteCmmnClCode(CmmnClCodeVO cmmnClCodeVO) throws Exception { + cmmnClCodeManageDAO.deleteCmmnClCode(cmmnClCodeVO); + } + + /** + * 공통분류코드를 수정한다. + */ + @Override + public void updateCmmnClCode(CmmnClCodeVO cmmnClCodeVO) throws Exception { + cmmnClCodeManageDAO.updateCmmnClCode(cmmnClCodeVO); + + } + +} diff --git a/src/main/java/egovframework/com/sym/ccm/ccc/web/EgovCcmCmmnClCodeManageController.java b/src/main/java/egovframework/com/sym/ccm/ccc/web/EgovCcmCmmnClCodeManageController.java new file mode 100644 index 0000000..70c3786 --- /dev/null +++ b/src/main/java/egovframework/com/sym/ccm/ccc/web/EgovCcmCmmnClCodeManageController.java @@ -0,0 +1,241 @@ +package egovframework.com.sym.ccm.ccc.web; + +import java.util.List; + +import javax.annotation.Resource; + +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.springmodules.validation.commons.DefaultBeanValidator; + +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.sym.ccm.ccc.service.CmmnClCode; +import egovframework.com.sym.ccm.ccc.service.CmmnClCodeVO; +import egovframework.com.sym.ccm.ccc.service.EgovCcmCmmnClCodeManageService; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +/** + * + * 공통분류코드에 관한 요청을 받아 서비스 클래스로 요청을 전달하고 서비스클래스에서 처리한 결과를 웹 화면으로 전달을 위한 Controller를 정의한다 + * + * @author 공통서비스 개발팀 이중호 + * @since 2009.04.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *	     수정일		수정자          			 수정내용
    + *  ---------  -------   ---------------------------
    + *  2009.04.01	이중호         최초 생성
    + *  2011.8.26	정진오	 IncludedInfo annotation 추가
    + *  2017.06.08	이정은	 표준프레임워크 v3.7 개선
    + *
    + *      
    + */ + +@Controller +public class EgovCcmCmmnClCodeManageController { + @Resource(name = "CmmnClCodeManageService") + private EgovCcmCmmnClCodeManageService cmmnClCodeManageService; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** EgovMessageSource */ + @Resource(name = "egovMessageSource") + EgovMessageSource egovMessageSource; + + @Autowired + private DefaultBeanValidator beanValidator; + + /** + * 공통분류코드 목록을 조회한다. + * + * @param loginVO + * @param searchVO + * @param model + * @return "egovframework/com/sym/ccm/ccc/SelectCcmCmmnClCodeList" + * @throws Exception + */ + @IncludedInfo(name = "공통분류코드", listUrl = "/sym/ccm/ccc/SelectCcmCmmnClCodeList.do", order = 960, gid = 60) + @RequestMapping(value = "/sym/ccm/ccc/SelectCcmCmmnClCodeList.do") + public String selectCmmnClCodeList(@ModelAttribute("searchVO") CmmnClCodeVO searchVO, ModelMap model) throws Exception { + + /** 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()); + + List CmmnCodeList = cmmnClCodeManageService.selectCmmnClCodeList(searchVO); + model.addAttribute("resultList", CmmnCodeList); + + int totCnt = cmmnClCodeManageService.selectCmmnClCodeListTotCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/sym/ccm/ccc/EgovCcmCmmnClCodeList"; + } + + /** + * 공통분류코드 상세항목을 조회한다. + * + * @param loginVO + * @param cmmnClCode + * @param model + * @return "egovframework/com/sym/ccm/ccc/SelectCcmCmmnClCodeDetail.do" + * @throws Exception + */ + @RequestMapping(value = "/sym/ccm/ccc/SelectCcmCmmnClCodeDetail.do") + public String selectCmmnClCodeDetail(@ModelAttribute("loginVO") LoginVO loginVO, CmmnClCodeVO cmmnClCodeVO, + ModelMap model) throws Exception { + + CmmnClCode vo = cmmnClCodeManageService.selectCmmnClCodeDetail(cmmnClCodeVO); + + model.addAttribute("result", vo); + + return "egovframework/com/sym/ccm/ccc/EgovCcmCmmnClCodeDetail"; + } + + /** + * 공통분류코드 등록을 위한 등록페이지로 이동한다. + * + * @param cmmnClCodeVO + * @param model + * @return "egovframework/com/sym/ccm/ccc/EgovCcmCmmnClCodeRegist"; + * @throws Exception + */ + @RequestMapping("/sym/ccm/ccc/RegistCcmCmmnClCodeView.do") + public String insertCmmnClCodeView(@ModelAttribute("searchVO")CmmnClCodeVO cmmnClCodeVO, ModelMap model) throws Exception { + model.addAttribute("cmmnClCodeVO", new CmmnClCodeVO()); + + return "egovframework/com/sym/ccm/ccc/EgovCcmCmmnClCodeRegist"; + } + + /** + * 공통분류코드를 등록한다. + * + * @param CmmnClCodeVO + * @param CmmnClCodeVO + * @param status + * @param model + * @return /sym/ccm/ccc/SelectCcmCmmnClCodeList.do"; + * @throws Exception + */ + @RequestMapping("/sym/ccm/ccc/RegistCcmCmmnClCode.do") + public String insertCmmnClCode(@ModelAttribute("cmmnClCodeVO") CmmnClCodeVO cmmnClCodeVO, + BindingResult bindingResult, ModelMap model) throws Exception { + + // 로그인VO에서 사용자 정보 가져오기 + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + beanValidator.validate(cmmnClCodeVO, bindingResult); + + if (bindingResult.hasErrors()) { + return "egovframework/com/sym/ccm/ccc/EgovCcmCmmnClCodeRegist"; + } + + if(cmmnClCodeVO.getClCode() != null){ + CmmnClCode vo = cmmnClCodeManageService.selectCmmnClCodeDetail(cmmnClCodeVO); + if(vo != null){ + model.addAttribute("message", egovMessageSource.getMessage("comSymCcmCcc.validate.codeCheck")); + return "egovframework/com/sym/ccm/ccc/EgovCcmCmmnClCodeRegist"; + } + } + + cmmnClCodeVO.setFrstRegisterId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + cmmnClCodeManageService.insertCmmnClCode(cmmnClCodeVO); + + return "forward:/sym/ccm/ccc/SelectCcmCmmnClCodeList.do"; + } + + /** + * 공통분류코드를 삭제한다. + * + * @param cmmnClCodeVO + * @param status + * @param model + * @return /sym/ccm/ccc/SelectCcmCmmnClCodeList.do"; + * @throws Exception + */ + @RequestMapping("/sym/ccm/ccc/RemoveCcmCmmnClCode.do") + public String deleteCmmnClCode(@ModelAttribute("searchVO") CmmnClCodeVO cmmnClCode, @ModelAttribute("cmmnClCodeVO") CmmnClCodeVO cmmnClCodeVO, + BindingResult bindingResult, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + cmmnClCodeVO.setLastUpdusrId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + cmmnClCodeManageService.deleteCmmnClCode(cmmnClCodeVO); + + return "forward:/sym/ccm/ccc/SelectCcmCmmnClCodeList.do"; + } + + /** + * 공통분류코드 수정을 위한 수정페이지로 이동한다. + * + * @param cmmnClCodeVO + * @param model + * @return "egovframework/com/sym/ccm/ccc/EgovCcmCmmnClCodeUpdt"; + * @throws Exception + */ + @RequestMapping("/sym/ccm/ccc/UpdateCcmCmmnClCodeView.do") + public String updateCmmnClCodeView(@ModelAttribute("searchVO") CmmnClCodeVO cmmnClCodeVO, ModelMap model) + throws Exception { + + CmmnClCode result = cmmnClCodeManageService.selectCmmnClCodeDetail(cmmnClCodeVO); + + model.addAttribute("cmmnClCodeVO", result); + + return "egovframework/com/sym/ccm/ccc/EgovCcmCmmnClCodeUpdt"; + } + + /** + * 공통분류코드를 수정한다. + * + * @param cmmnClCodeVO + * @param status + * @param model + * @return /sym/ccm/ccc/SelectCcmCmmnClCodeList.do" + * @throws Exception + */ + @RequestMapping("/sym/ccm/ccc/UpdateCcmCmmnClCode.do") + public String updateCmmnClCode(@ModelAttribute("searchVO") CmmnClCodeVO cmmnClCode, @ModelAttribute("cmmnClCodeVO") CmmnClCodeVO cmmnClCodeVO, + BindingResult bindingResult, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + beanValidator.validate(cmmnClCodeVO, bindingResult); + if (bindingResult.hasErrors()) { + + CmmnClCode result = cmmnClCodeManageService.selectCmmnClCodeDetail(cmmnClCode); + model.addAttribute("cmmnClCodeVO", result); + + return "egovframework/com/sym/ccm/ccc/EgovCcmCmmnClCodeUpdt"; + } + + cmmnClCodeVO.setLastUpdusrId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + cmmnClCodeManageService.updateCmmnClCode(cmmnClCodeVO); + + return "forward:/sym/ccm/ccc/SelectCcmCmmnClCodeList.do"; + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sym/ccm/cde/service/CmmnDetailCodeVO.java b/src/main/java/egovframework/com/sym/ccm/cde/service/CmmnDetailCodeVO.java new file mode 100644 index 0000000..3a9e507 --- /dev/null +++ b/src/main/java/egovframework/com/sym/ccm/cde/service/CmmnDetailCodeVO.java @@ -0,0 +1,199 @@ +package egovframework.com.sym.ccm.cde.service; + +import java.io.Serializable; + +import egovframework.com.cmm.service.CmmnDetailCode; + +/** +* +* 공통상세코드 VO 클래스 +* @author 공통서비스 개발팀 이중호 +* @since 2009.04.01 +* @version 1.0 +* @see +* +*
    +* << 개정이력(Modification Information) >>
    +*
    +*   수정일      수정자           수정내용
    +*  -------    --------    ---------------------------
    +*   2009.04.01  이중호          최초 생성
    +*
    +* 
    +*/ + +public class CmmnDetailCodeVO extends CmmnDetailCode implements Serializable{ + + private static final long serialVersionUID = 9137280036724974467L; + + /** 검색조건 */ + private String searchCondition = ""; + + /** 검색Keyword */ + private String searchKeyword = ""; + + /** 검색사용여부 */ + private String searchUseYn = ""; + + /** 현재페이지 */ + private int pageIndex = 1; + + /** 페이지갯수 */ + private int pageUnit = 10; + + /** 페이지사이즈 */ + private int pageSize = 10; + + /** firstIndex */ + private int firstIndex = 1; + + /** lastIndex */ + private int lastIndex = 1; + + /** recordCountPerPage */ + private int recordCountPerPage = 10; + + /** + * searchCondition attribute 를 리턴한다. + * @return String + */ + public String getSearchCondition() { + return searchCondition; + } + + /** + * searchCondition attribute 값을 설정한다. + * @param searchCondition String + */ + public void setSearchCondition(String searchCondition) { + this.searchCondition = searchCondition; + } + + /** + * searchKeyword attribute 를 리턴한다. + * @return String + */ + public String getSearchKeyword() { + return searchKeyword; + } + + /** + * searchKeyword attribute 값을 설정한다. + * @param searchKeyword String + */ + public void setSearchKeyword(String searchKeyword) { + this.searchKeyword = searchKeyword; + } + + /** + * searchUseYn attribute 를 리턴한다. + * @return String + */ + public String getSearchUseYn() { + return searchUseYn; + } + + /** + * searchUseYn attribute 값을 설정한다. + * @param searchUseYn String + */ + public void setSearchUseYn(String searchUseYn) { + this.searchUseYn = searchUseYn; + } + + /** + * pageIndex attribute 를 리턴한다. + * @return int + */ + public int getPageIndex() { + return pageIndex; + } + + /** + * pageIndex attribute 값을 설정한다. + * @param pageIndex int + */ + public void setPageIndex(int pageIndex) { + this.pageIndex = pageIndex; + } + + /** + * pageUnit attribute 를 리턴한다. + * @return int + */ + public int getPageUnit() { + return pageUnit; + } + + /** + * pageUnit attribute 값을 설정한다. + * @param pageUnit int + */ + public void setPageUnit(int pageUnit) { + this.pageUnit = pageUnit; + } + + /** + * pageSize attribute 를 리턴한다. + * @return int + */ + public int getPageSize() { + return pageSize; + } + + /** + * pageSize attribute 값을 설정한다. + * @param pageSize int + */ + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + /** + * firstIndex attribute 를 리턴한다. + * @return int + */ + public int getFirstIndex() { + return firstIndex; + } + + /** + * firstIndex attribute 값을 설정한다. + * @param firstIndex int + */ + public void setFirstIndex(int firstIndex) { + this.firstIndex = firstIndex; + } + + /** + * lastIndex attribute 를 리턴한다. + * @return int + */ + public int getLastIndex() { + return lastIndex; + } + + /** + * lastIndex attribute 값을 설정한다. + * @param lastIndex int + */ + public void setLastIndex(int lastIndex) { + this.lastIndex = lastIndex; + } + + /** + * recordCountPerPage attribute 를 리턴한다. + * @return int + */ + public int getRecordCountPerPage() { + return recordCountPerPage; + } + + /** + * recordCountPerPage attribute 값을 설정한다. + * @param recordCountPerPage int + */ + public void setRecordCountPerPage(int recordCountPerPage) { + this.recordCountPerPage = recordCountPerPage; + } +} diff --git a/src/main/java/egovframework/com/sym/ccm/cde/service/EgovCcmCmmnDetailCodeManageService.java b/src/main/java/egovframework/com/sym/ccm/cde/service/EgovCcmCmmnDetailCodeManageService.java new file mode 100644 index 0000000..0b3db56 --- /dev/null +++ b/src/main/java/egovframework/com/sym/ccm/cde/service/EgovCcmCmmnDetailCodeManageService.java @@ -0,0 +1,73 @@ +package egovframework.com.sym.ccm.cde.service; + +import java.util.List; + +import egovframework.com.cmm.service.CmmnDetailCode; +import egovframework.com.sym.ccm.cde.service.CmmnDetailCodeVO; + +/** +* +* 공통상세코드에 관한 서비스 인터페이스 클래스를 정의한다 +* @author 공통서비스 개발팀 이중호 +* @since 2009.04.01 +* @version 1.0 +* @see +* +*
    +* << 개정이력(Modification Information) >>
    +*
    +*   수정일      수정자           수정내용
    +*  -------    --------    ---------------------------
    +*   2009.04.01  이중호          최초 생성
    +*
    +* 
    +*/ + +public interface EgovCcmCmmnDetailCodeManageService { + /** + * 공통상세코드 총 갯수를 조회한다. + * @param searchVO + * @return int(공통상세코드 총 갯수) + */ + int selectCmmnDetailCodeListTotCnt(CmmnDetailCodeVO searchVO) throws Exception; + + /** + * 공통상세코드 목록을 조회한다. + * @param searchVO + * @return List(공통상세코드 목록) + * @throws Exception + */ + List selectCmmnDetailCodeList(CmmnDetailCodeVO searchVO) throws Exception; + + /** + * 공통상세코드 상세항목을 조회한다. + * @param cmmnDetailCodeVO + * @return CmmnDetailCode(공통상세코드) + * @throws Exception + */ + CmmnDetailCode selectCmmnDetailCodeDetail(CmmnDetailCodeVO cmmnDetailCodeVO) throws Exception; + + /** + * 공통상세코드를 삭제한다. + * @param cmmnDetailCodeVO + * @throws Exception + */ + void deleteCmmnDetailCode(CmmnDetailCodeVO cmmnDetailCodeVO) throws Exception; + + /** + * 공통상세코드를 등록한다. + * @param cmmnDetailCodeVO + * @throws Exception + */ + void insertCmmnDetailCode(CmmnDetailCodeVO cmmnDetailCodeVO) throws Exception; + + /** + * 공통상세코드를 수정한다. + * @param cmmnDetailCodeVO + * @throws Exception + */ + void updateCmmnDetailCode(CmmnDetailCodeVO cmmnDetailCodeVO) throws Exception; + + + +} diff --git a/src/main/java/egovframework/com/sym/ccm/cde/service/impl/CmmnDetailCodeManageDAO.java b/src/main/java/egovframework/com/sym/ccm/cde/service/impl/CmmnDetailCodeManageDAO.java new file mode 100644 index 0000000..c6fa64d --- /dev/null +++ b/src/main/java/egovframework/com/sym/ccm/cde/service/impl/CmmnDetailCodeManageDAO.java @@ -0,0 +1,90 @@ +package egovframework.com.sym.ccm.cde.service.impl; + +import java.util.List; + +import org.springframework.stereotype.Repository; + +import egovframework.com.cmm.service.CmmnDetailCode; +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.sym.ccm.cde.service.CmmnDetailCodeVO; + +/** +* +* 공통상세코드에 대한 데이터 접근 클래스를 정의한다 +* @author 공통서비스 개발팀 이중호 +* @since 2009.04.01 +* @version 1.0 +* @see +* +*
    +* << 개정이력(Modification Information) >>
    +*
    +*   수정일      수정자           수정내용
    +*  -------    --------    ---------------------------
    +*   2009.04.01  이중호          최초 생성
    +*
    +* 
    +*/ + +@Repository("CmmnDetailCodeManageDAO") +public class CmmnDetailCodeManageDAO extends EgovComAbstractDAO { + + /** + * 공통상세코드 총 갯수를 조회한다. + * @param searchVO + * @return int(공통상세코드 총 갯수) + */ + public int selectCmmnDetailCodeListTotCnt(CmmnDetailCodeVO searchVO) throws Exception { + return (Integer)selectOne("CmmnDetailCodeManage.selectCmmnDetailCodeListTotCnt", searchVO); + } + + /** + * 공통상세코드 목록을 조회한다. + * @param searchVO + * @return List(공통상세코드 목록) + * @throws Exception + */ + public List selectCmmnDetailCodeList(CmmnDetailCodeVO searchVO) throws Exception { + return list("CmmnDetailCodeManage.selectCmmnDetailCodeList", searchVO); + } + + /** + * 공통상세코드 상세항목을 조회한다. + * @param cmmnDetailCodeVO + * @return CmmnDetailCodeVO(공통상세코드) + */ + public CmmnDetailCode selectCmmnDetailCodeDetail(CmmnDetailCodeVO cmmnDetailCodeVO) throws Exception{ + return (CmmnDetailCode) selectOne("CmmnDetailCodeManage.selectCmmnDetailCodeDetail", cmmnDetailCodeVO); + } + + /** + * 공통상세코드를 삭제한다. + * @param cmmnDetailCodeVO + * @throws Exception + */ + public void deleteCmmnDetailCode(CmmnDetailCodeVO cmmnDetailCodeVO) throws Exception{ + delete("CmmnDetailCodeManage.deleteCmmnDetailCode", cmmnDetailCodeVO); + + } + + /** + * 공통상세코드를 등록한다. + * @param cmmnDetailCodeVO + * @throws Exception + */ + public void insertCmmnDetailCode(CmmnDetailCodeVO cmmnDetailCodeVO) throws Exception{ + insert("CmmnDetailCodeManage.insertCmmnDetailCode", cmmnDetailCodeVO); + + } + + /** + * 공통상세코드를 수정한다. + * @param cmmnDetailCodeVO + * @throws Exception + */ + public void updateCmmnDetailCode(CmmnDetailCodeVO cmmnDetailCodeVO) throws Exception{ + insert("CmmnDetailCodeManage.updateCmmnDetailCode", cmmnDetailCodeVO); + + } + +} diff --git a/src/main/java/egovframework/com/sym/ccm/cde/service/impl/EgovCcmCmmnDetailCodeManageServiceImpl.java b/src/main/java/egovframework/com/sym/ccm/cde/service/impl/EgovCcmCmmnDetailCodeManageServiceImpl.java new file mode 100644 index 0000000..9ef7526 --- /dev/null +++ b/src/main/java/egovframework/com/sym/ccm/cde/service/impl/EgovCcmCmmnDetailCodeManageServiceImpl.java @@ -0,0 +1,91 @@ +package egovframework.com.sym.ccm.cde.service.impl; + +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import egovframework.com.cmm.service.CmmnDetailCode; +import egovframework.com.sym.ccm.cde.service.CmmnDetailCodeVO; +import egovframework.com.sym.ccm.cde.service.EgovCcmCmmnDetailCodeManageService; +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +/** +* +* 공통상세코드에 대한 서비스 구현클래스를 정의한다 +* @author 공통서비스 개발팀 이중호 +* @since 2009.04.01 +* @version 1.0 +* @see +* +*
    +* << 개정이력(Modification Information) >>
    +*
    +*   수정일      수정자           수정내용
    +*  -------    --------    ---------------------------
    +*   2009.04.01  이중호          최초 생성
    +*
    +* 
    +*/ +@Service("CmmnDetailCodeManageService") +public class EgovCcmCmmnDetailCodeManageServiceImpl extends EgovAbstractServiceImpl implements EgovCcmCmmnDetailCodeManageService{ + + @Resource(name="CmmnDetailCodeManageDAO") + private CmmnDetailCodeManageDAO cmmnDetailCodeManageDAO; + + /** + * 공통상세코드 총 갯수를 조회한다. + */ + @Override + public int selectCmmnDetailCodeListTotCnt(CmmnDetailCodeVO searchVO) throws Exception { + return cmmnDetailCodeManageDAO.selectCmmnDetailCodeListTotCnt(searchVO); + } + + /** + * 공통상세코드 목록을 조회한다. + */ + @Override + public List selectCmmnDetailCodeList(CmmnDetailCodeVO searchVO) throws Exception { + return cmmnDetailCodeManageDAO.selectCmmnDetailCodeList(searchVO); + } + + /** + * 공통상세코드 상세항목을 조회한다. + * @throws Exception + */ + @Override + public CmmnDetailCode selectCmmnDetailCodeDetail(CmmnDetailCodeVO cmmnDetailCodeVO) throws Exception { + CmmnDetailCode ret = cmmnDetailCodeManageDAO.selectCmmnDetailCodeDetail(cmmnDetailCodeVO); + return ret; + } + + /** + * 공통상세코드를 삭제한다. + * @throws Exception + */ + @Override + public void deleteCmmnDetailCode(CmmnDetailCodeVO cmmnDetailCodeVO) throws Exception { + cmmnDetailCodeManageDAO.deleteCmmnDetailCode(cmmnDetailCodeVO); + + } + + /** + * 공통상세코드를 등록한다. + */ + @Override + public void insertCmmnDetailCode(CmmnDetailCodeVO cmmnDetailCodeVO) throws Exception { + cmmnDetailCodeManageDAO.insertCmmnDetailCode(cmmnDetailCodeVO); + + } + + /** + * 공통상세코드를 수정한다. + */ + @Override + public void updateCmmnDetailCode(CmmnDetailCodeVO cmmnDetailCodeVO) throws Exception { + cmmnDetailCodeManageDAO.updateCmmnDetailCode(cmmnDetailCodeVO); + + } + +} diff --git a/src/main/java/egovframework/com/sym/ccm/cde/web/EgovCcmCmmnDetailCodeManageController.java b/src/main/java/egovframework/com/sym/ccm/cde/web/EgovCcmCmmnDetailCodeManageController.java new file mode 100644 index 0000000..9b5c1bf --- /dev/null +++ b/src/main/java/egovframework/com/sym/ccm/cde/web/EgovCcmCmmnDetailCodeManageController.java @@ -0,0 +1,275 @@ +package egovframework.com.sym.ccm.cde.web; + +import java.util.List; + +import javax.annotation.Resource; + +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.springmodules.validation.commons.DefaultBeanValidator; + +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.service.CmmnDetailCode; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.sym.ccm.cca.service.CmmnCodeVO; +import egovframework.com.sym.ccm.cca.service.EgovCcmCmmnCodeManageService; +import egovframework.com.sym.ccm.ccc.service.CmmnClCodeVO; +import egovframework.com.sym.ccm.ccc.service.EgovCcmCmmnClCodeManageService; +import egovframework.com.sym.ccm.cde.service.CmmnDetailCodeVO; +import egovframework.com.sym.ccm.cde.service.EgovCcmCmmnDetailCodeManageService; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +/** +* +* 공통상세코드에 관한 요청을 받아 서비스 클래스로 요청을 전달하고 서비스클래스에서 처리한 결과를 웹 화면으로 전달을 위한 Controller를 정의한다 +* @author 공통서비스 개발팀 이중호 +* @since 2009.04.01 +* @version 1.0 +* @see +* +*
    +* << 개정이력(Modification Information) >>
    +*
    +*   수정일      수정자           수정내용
    +*  -------    --------    ---------------------------
    +*   2009.04.01  이중호       최초 생성
    +*   2011.08.26	정진오	IncludedInfo annotation 추가
    +*   2017.08.08	이정은	표준프레임워크 v3.7 개선
    +*
    +* 
    +*/ + +@Controller +public class EgovCcmCmmnDetailCodeManageController { + + @Resource(name = "CmmnDetailCodeManageService") + private EgovCcmCmmnDetailCodeManageService cmmnDetailCodeManageService; + + @Resource(name = "CmmnClCodeManageService") + private EgovCcmCmmnClCodeManageService cmmnClCodeManageService; + + @Resource(name = "CmmnCodeManageService") + private EgovCcmCmmnCodeManageService cmmnCodeManageService; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** EgovMessageSource */ + @Resource(name = "egovMessageSource") + EgovMessageSource egovMessageSource; + + @Autowired + private DefaultBeanValidator beanValidator; + + /** + * 공통상세코드 목록을 조회한다. + * @param loginVO + * @param searchVO + * @param model + * @return "egovframework/com/sym/ccm/cde/EgovCcmCmmnDetailCodeList" + * @throws Exception + */ + @IncludedInfo(name = "공통상세코드", listUrl = "/sym/ccm/cde/SelectCcmCmmnDetailCodeList.do", order = 970, gid = 60) + @RequestMapping(value = "/sym/ccm/cde/SelectCcmCmmnDetailCodeList.do") + public String selectCmmnDetailCodeList(@ModelAttribute("loginVO") LoginVO loginVO, + @ModelAttribute("searchVO") CmmnDetailCodeVO searchVO, ModelMap model) throws Exception { + + /** 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()); + + List CmmnCodeList = cmmnDetailCodeManageService.selectCmmnDetailCodeList(searchVO); + model.addAttribute("resultList", CmmnCodeList); + + int totCnt = cmmnDetailCodeManageService.selectCmmnDetailCodeListTotCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/sym/ccm/cde/EgovCcmCmmnDetailCodeList"; + } + + /** + * 공통상세코드 상세항목을 조회한다. + * @param loginVO + * @param cmmnDetailCodeVO + * @param model + * @return "egovframework/com/sym/ccm/cde/EgovCcmCmmnDetailCodeDetail" + * @throws Exception + */ + @RequestMapping(value = "/sym/ccm/cde/SelectCcmCmmnDetailCodeDetail.do") + public String selectCmmnDetailCodeDetail(@ModelAttribute("loginVO") LoginVO loginVO, + CmmnDetailCodeVO cmmnDetailCodeVO, ModelMap model) throws Exception { + CmmnDetailCode vo = cmmnDetailCodeManageService.selectCmmnDetailCodeDetail(cmmnDetailCodeVO); + model.addAttribute("result", vo); + + return "egovframework/com/sym/ccm/cde/EgovCcmCmmnDetailCodeDetail"; + } + + /** + * 공통상세코드를 삭제한다. + * @param loginVO + * @param cmmnDetailCodeVO + * @param model + * @return "forward:/sym/ccm/cde/EgovCcmCmmnDetailCodeList.do" + * @throws Exception + */ + @RequestMapping(value = "/sym/ccm/cde/RemoveCcmCmmnDetailCode.do") + public String deleteCmmnDetailCode(@ModelAttribute("loginVO") LoginVO loginVO, CmmnDetailCodeVO cmmnDetailCodeVO, + ModelMap model) throws Exception { + cmmnDetailCodeManageService.deleteCmmnDetailCode(cmmnDetailCodeVO); + + return "forward:/sym/ccm/cde/SelectCcmCmmnDetailCodeList.do"; + } + + /** + * 공통상세코드 등록을 위한 등록페이지로 이동한다. + * + * @param cmmnDetailCodeVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/sym/ccm/cde/RegistCcmCmmnDetailCodeView.do") + public String insertCmmnDetailCodeView(@ModelAttribute("loginVO") LoginVO loginVO, + @ModelAttribute("cmmnCodeVO") CmmnCodeVO cmmnCodeVO, + @ModelAttribute("cmmnDetailCodeVO") CmmnDetailCodeVO cmmnDetailCodeVO, ModelMap model) throws Exception { + + CmmnClCodeVO searchClCodeVO = new CmmnClCodeVO(); + searchClCodeVO.setFirstIndex(0); + List CmmnClCodeList = cmmnClCodeManageService.selectCmmnClCodeList(searchClCodeVO); + model.addAttribute("clCodeList", CmmnClCodeList); + + CmmnCodeVO clCode = new CmmnCodeVO(); + clCode.setClCode(cmmnCodeVO.getClCode()); + + if (!cmmnCodeVO.getClCode().equals("")) { + + CmmnCodeVO searchCodeVO = new CmmnCodeVO(); + searchCodeVO.setRecordCountPerPage(999999); + searchCodeVO.setFirstIndex(0); + searchCodeVO.setSearchCondition("clCode"); + searchCodeVO.setSearchKeyword(cmmnCodeVO.getClCode()); + + List CmmnCodeList = cmmnCodeManageService.selectCmmnCodeList(searchCodeVO); + model.addAttribute("codeList", CmmnCodeList); + } + + return "egovframework/com/sym/ccm/cde/EgovCcmCmmnDetailCodeRegist"; + } + + /** + * 공통상세코드를 등록한다. + * + * @param CmmnDetailCodeVO + * @param CmmnDetailCodeVO + * @param status + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/sym/ccm/cde/RegistCcmCmmnDetailCode.do") + public String insertCmmnDetailCode(@ModelAttribute("cmmnDetailCodeVO") CmmnDetailCodeVO cmmnDetailCodeVO, + BindingResult bindingResult, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + CmmnClCodeVO searchClCodeVO = new CmmnClCodeVO(); + + beanValidator.validate(cmmnDetailCodeVO, bindingResult); + + if (bindingResult.hasErrors()) { + + List CmmnClCodeList = cmmnClCodeManageService.selectCmmnClCodeList(searchClCodeVO); + model.addAttribute("clCodeList", CmmnClCodeList); + + return "egovframework/com/sym/ccm/cde/EgovCcmCmmnDetailCodeRegist"; + } + + if (cmmnDetailCodeVO.getCodeId() != null) { + + CmmnDetailCode vo = cmmnDetailCodeManageService.selectCmmnDetailCodeDetail(cmmnDetailCodeVO); + if (vo != null) { + model.addAttribute("message", egovMessageSource.getMessage("comSymCcmCde.validate.codeCheck")); + + List CmmnClCodeList = cmmnClCodeManageService.selectCmmnClCodeList(searchClCodeVO); + model.addAttribute("clCodeList", CmmnClCodeList); + + return "egovframework/com/sym/ccm/cde/EgovCcmCmmnDetailCodeRegist"; + } + } + + cmmnDetailCodeVO.setFrstRegisterId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + cmmnDetailCodeManageService.insertCmmnDetailCode(cmmnDetailCodeVO); + + return "forward:/sym/ccm/cde/SelectCcmCmmnDetailCodeList.do"; + } + + /** + * 공통상세코드 수정을 위한 수정페이지로 이동한다. + * + * @param cmmnDetailCodeVO + * @param model + * @return "egovframework/com/sym/ccm/cde/EgovCcmCmmnDetailCodeUpdt" + * @throws Exception + */ + @RequestMapping("/sym/ccm/cde/UpdateCcmCmmnDetailCodeView.do") + public String updateCmmnDetailCodeView(@ModelAttribute("loginVO") LoginVO loginVO, + @ModelAttribute("cmmnDetailCodeVO") CmmnDetailCodeVO cmmnDetailCodeVO, ModelMap model) + throws Exception { + + CmmnDetailCode result = cmmnDetailCodeManageService.selectCmmnDetailCodeDetail(cmmnDetailCodeVO); + model.addAttribute("cmmnDetailCodeVO", result); + + return "egovframework/com/sym/ccm/cde/EgovCcmCmmnDetailCodeUpdt"; + } + + /** + * 공통상세코드를 수정한다. + * + * @param cmmnDetailCodeVO + * @param model + * @return "egovframework/com/sym/ccm/cde/EgovCcmCmmnDetailCodeUpdt", "/sym/ccm/cde/SelectCcmCmmnDetailCodeList.do" + * @throws Exception + */ + @RequestMapping("/sym/ccm/cde/UpdateCcmCmmnDetailCode.do") + public String updateCmmnDetailCode(@ModelAttribute("cmmnDetailCodeVO") CmmnDetailCodeVO cmmnDetailCodeVO, + ModelMap model, BindingResult bindingResult) + throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + beanValidator.validate(cmmnDetailCodeVO, bindingResult); + + if (bindingResult.hasErrors()) { + CmmnDetailCode result = cmmnDetailCodeManageService.selectCmmnDetailCodeDetail(cmmnDetailCodeVO); + model.addAttribute("cmmnDetailCodeVO", result); + + return "egovframework/com/sym/ccm/cde/EgovCcmCmmnDetailCodeUpdt"; + } + + cmmnDetailCodeVO.setLastUpdusrId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + cmmnDetailCodeManageService.updateCmmnDetailCode(cmmnDetailCodeVO); + + return "forward:/sym/ccm/cde/SelectCcmCmmnDetailCodeList.do"; + } + +} diff --git a/src/main/java/egovframework/com/sym/ccm/zip/service/EgovCcmRdnmadZipManageService.java b/src/main/java/egovframework/com/sym/ccm/zip/service/EgovCcmRdnmadZipManageService.java new file mode 100644 index 0000000..315dcb7 --- /dev/null +++ b/src/main/java/egovframework/com/sym/ccm/zip/service/EgovCcmRdnmadZipManageService.java @@ -0,0 +1,83 @@ +package egovframework.com.sym.ccm.zip.service; + +import java.io.InputStream; +import java.util.List; + + +/** + * + * 우편번호에 관한 서비스 인터페이스 클래스를 정의한다 + * @author 공통서비스 개발팀 이기하 + * @since 2011.11.21 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *     수정일      	수정자           수정내용
    + *  -----------    --------    ---------------------------
    + *   2011.11.21		이기하           도로명주소 최초 생성
    + *
    + * 
    + */ +public interface EgovCcmRdnmadZipManageService { + + /** + * 우편번호를 삭제한다. + * @param zip + * @throws Exception + */ + void deleteZip(Zip zip) throws Exception; + + /** + * 우편번호 전체를 삭제한다. + * @throws Exception + */ + void deleteAllZip() throws Exception; + + /** + * 우편번호를 등록한다. + * @param zip + * @throws Exception + */ + void insertZip(Zip zip) throws Exception; + + /** + * 우편번호 엑셀파일을 등록한다. + * @param zip + * @throws Exception + */ + void insertExcelZip(InputStream file) throws Exception; + + /** + * 우편번호 상세항목을 조회한다. + * @param zip + * @return Zip(우편번호) + * @throws Exception + */ + Zip selectZipDetail(Zip zip) throws Exception; + + /** + * 우편번호 목록을 조회한다. + * @param searchVO + * @return List(우편번호 목록) + * @throws Exception + */ + List selectZipList(ZipVO searchVO) throws Exception; + + /** + * 우편번호 총 갯수를 조회한다. + * @param searchVO + * @return int(우편번호 총 갯수) + */ + int selectZipListTotCnt(ZipVO searchVO) throws Exception; + + /** + * 우편번호를 수정한다. + * @param zip + * @throws Exception + */ + void updateZip(Zip zip) throws Exception; + +} diff --git a/src/main/java/egovframework/com/sym/ccm/zip/service/EgovCcmZipManageService.java b/src/main/java/egovframework/com/sym/ccm/zip/service/EgovCcmZipManageService.java new file mode 100644 index 0000000..6a525d0 --- /dev/null +++ b/src/main/java/egovframework/com/sym/ccm/zip/service/EgovCcmZipManageService.java @@ -0,0 +1,83 @@ +package egovframework.com.sym.ccm.zip.service; + +import java.io.InputStream; +import java.util.List; + + +/** + * + * 우편번호에 관한 서비스 인터페이스 클래스를 정의한다 + * @author 공통서비스 개발팀 이중호 + * @since 2009.04.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.01  이중호          최초 생성
    + *
    + * 
    + */ +public interface EgovCcmZipManageService { + + /** + * 우편번호를 삭제한다. + * @param zip + * @throws Exception + */ + void deleteZip(Zip zip) throws Exception; + + /** + * 우편번호 전체를 삭제한다. + * @throws Exception + */ + void deleteAllZip() throws Exception; + + /** + * 우편번호를 등록한다. + * @param zip + * @throws Exception + */ + void insertZip(Zip zip) throws Exception; + + /** + * 우편번호 엑셀파일을 등록한다. + * @param zip + * @throws Exception + */ + void insertExcelZip(InputStream file) throws Exception; + + /** + * 우편번호 상세항목을 조회한다. + * @param zip + * @return Zip(우편번호) + * @throws Exception + */ + Zip selectZipDetail(Zip zip) throws Exception; + + /** + * 우편번호 목록을 조회한다. + * @param searchVO + * @return List(우편번호 목록) + * @throws Exception + */ + List selectZipList(ZipVO searchVO) throws Exception; + + /** + * 우편번호 총 갯수를 조회한다. + * @param searchVO + * @return int(우편번호 총 갯수) + */ + int selectZipListTotCnt(ZipVO searchVO) throws Exception; + + /** + * 우편번호를 수정한다. + * @param zip + * @throws Exception + */ + void updateZip(Zip zip) throws Exception; + +} diff --git a/src/main/java/egovframework/com/sym/ccm/zip/service/Zip.java b/src/main/java/egovframework/com/sym/ccm/zip/service/Zip.java new file mode 100644 index 0000000..6f3cc53 --- /dev/null +++ b/src/main/java/egovframework/com/sym/ccm/zip/service/Zip.java @@ -0,0 +1,292 @@ +package egovframework.com.sym.ccm.zip.service; + +import java.io.Serializable; + +/** + * 우편번호 모델 클래스 + * @author 공통서비스 개발팀 이중호 + * @since 2009.04.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.01  이중호          최초 생성
    + *   2011.11.21  이기하          도로명주소 추가(rdmn, bdnbrMnnm, bdnbrSlno, buldNm, detailBuldNm)
    + *
    + * 
    + */ +public class Zip implements Serializable { + + private static final long serialVersionUID = -8767083970521429218L; + + /* + * 우편번호 + */ + private String zip = ""; + + /* + * 일련번호 + */ + private int sn = 0; + + /* + * 시도명 + */ + private String ctprvnNm = ""; + + /* + * 시군구명 + */ + private String signguNm = ""; + + /* + * 읍면동명 + */ + private String emdNm = ""; + + /* + * 리건물명 + */ + private String liBuldNm = ""; + + /* + * 도로명코드 + */ + private String rdmnCode = ""; + + /* + * 도로명 + */ + private String rdmn = ""; + + /* + * 건물번호본번 + */ + private String bdnbrMnnm = ""; + + /* + * 건물번호부번 + */ + private String bdnbrSlno = ""; + + /* + * 건물명 + */ + private String buldNm = ""; + + /* + * 상세건물명 + */ + private String detailBuldNm = ""; + + /* + * 번지동호 + */ + private String lnbrDongHo = ""; + + /* + * 최초등록자ID + */ + private String frstRegisterId = ""; + + /* + * 최종수정자ID + */ + private String lastUpdusrId = ""; + + /** + * zip attribute 를 리턴한다. + * @return String + */ + public String getZip() { + return zip; + } + + /** + * zip attribute 값을 설정한다. + * @param zip String + */ + public void setZip(String zip) { + this.zip = zip; + } + + /** + * sn attribute 를 리턴한다. + * @return int + */ + public int getSn() { + return sn; + } + + /** + * sn attribute 값을 설정한다. + * @param sn int + */ + public void setSn(int sn) { + this.sn = sn; + } + + /** + * ctprvnNm attribute 를 리턴한다. + * @return String + */ + public String getCtprvnNm() { + return ctprvnNm; + } + + /** + * ctprvnNm attribute 값을 설정한다. + * @param ctprvnNm String + */ + public void setCtprvnNm(String ctprvnNm) { + this.ctprvnNm = ctprvnNm; + } + + /** + * signguNm attribute 를 리턴한다. + * @return String + */ + public String getSignguNm() { + return signguNm; + } + + /** + * signguNm attribute 값을 설정한다. + * @param signguNm String + */ + public void setSignguNm(String signguNm) { + this.signguNm = signguNm; + } + + /** + * emdNm attribute 를 리턴한다. + * @return String + */ + public String getEmdNm() { + return emdNm; + } + + /** + * emdNm attribute 값을 설정한다. + * @param emdNm String + */ + public void setEmdNm(String emdNm) { + this.emdNm = emdNm; + } + + /** + * liBuldNm attribute 를 리턴한다. + * @return String + */ + public String getLiBuldNm() { + return liBuldNm; + } + + /** + * liBuldNm attribute 값을 설정한다. + * @param liBuldNm String + */ + public void setLiBuldNm(String liBuldNm) { + this.liBuldNm = liBuldNm; + } + + /** + * lnbrDongHo attribute 를 리턴한다. + * @return String + */ + public String getLnbrDongHo() { + return lnbrDongHo; + } + + /** + * lnbrDongHo attribute 값을 설정한다. + * @param lnbrDongHo String + */ + public void setLnbrDongHo(String lnbrDongHo) { + this.lnbrDongHo = lnbrDongHo; + } + + /** + * frstRegisterId attribute 를 리턴한다. + * @return String + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * frstRegisterId attribute 값을 설정한다. + * @param frstRegisterId String + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * lastUpdusrId attribute 를 리턴한다. + * @return String + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * lastUpdusrId attribute 값을 설정한다. + * @param lastUpdusrId String + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + public String getRdmn() { + return rdmn; + } + + public void setRdmn(String rdmn) { + this.rdmn = rdmn; + } + + public String getBdnbrMnnm() { + return bdnbrMnnm; + } + + public void setBdnbrMnnm(String bdnbrMnnm) { + this.bdnbrMnnm = bdnbrMnnm; + } + + public String getBdnbrSlno() { + return bdnbrSlno; + } + + public void setBdnbrSlno(String bdnbrSlno) { + this.bdnbrSlno = bdnbrSlno; + } + + public String getBuldNm() { + return buldNm; + } + + public void setBuldNm(String buldNm) { + this.buldNm = buldNm; + } + + public String getDetailBuldNm() { + return detailBuldNm; + } + + public void setDetailBuldNm(String detailBuldNm) { + this.detailBuldNm = detailBuldNm; + } + + public String getRdmnCode() { + return rdmnCode; + } + + public void setRdmnCode(String rdmnCode) { + this.rdmnCode = rdmnCode; + } +} diff --git a/src/main/java/egovframework/com/sym/ccm/zip/service/ZipVO.java b/src/main/java/egovframework/com/sym/ccm/zip/service/ZipVO.java new file mode 100644 index 0000000..f29f98c --- /dev/null +++ b/src/main/java/egovframework/com/sym/ccm/zip/service/ZipVO.java @@ -0,0 +1,233 @@ +package egovframework.com.sym.ccm.zip.service; + +import java.io.Serializable; + +/** + * + * 우편번호 VO 클래스 + * @author 공통서비스 개발팀 이중호 + * @since 2009.04.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.01  이중호          최초 생성
    + *   2011.11.21  이기하          도로명주소 추가(searchList, searchCondition, searchCondition2)
    + *
    + * 
    + */ +public class ZipVO extends Zip implements Serializable { + + private static final long serialVersionUID = -1884618301732456348L; + + /** 일반주소와 도로명주소 구분 */ + private String searchList = ""; + + /** 일반주소 검색조건 */ + private String searchCondition = ""; + + /** 도로명주소 검색조건 */ + private String searchCondition2 = ""; + + /** 검색Keyword */ + private String searchKeyword = ""; + + /** 검색사용여부 */ + private String searchUseYn = ""; + + /** 현재페이지 */ + private int pageIndex = 1; + + /** 페이지갯수 */ + private int pageUnit = 10; + + /** 페이지사이즈 */ + private int pageSize = 10; + + /** firstIndex */ + private int firstIndex = 1; + + /** lastIndex */ + private int lastIndex = 1; + + /** recordCountPerPage */ + private int recordCountPerPage = 10; + + /** + * searchList attribute 를 리턴한다. + * @return String + */ + public String getSearchList() { + return searchList; + } + + /** + * searchList attribute 값을 설정한다. + * @param searchList String + */ + public void setSearchList(String searchList) { + this.searchList = searchList; + } + + /** + * searchCondition attribute 를 리턴한다. + * @return String + */ + public String getsearchCondition() { + return searchCondition; + } + + /** + * searchCondition attribute 값을 설정한다. + * @param searchCondition String + */ + public void setsearchCondition(String searchCondition) { + this.searchCondition = searchCondition; + } + + public String getSearchCondition2() { + return searchCondition2; + } + + /** + * searchCondition attribute 값을 설정한다. + * @param searchCondition String + */ + public void setSearchCondition2(String searchCondition2) { + this.searchCondition2 = searchCondition2; + } + + /** + * searchKeyword attribute 를 리턴한다. + * @return String + */ + public String getSearchKeyword() { + return searchKeyword; + } + + /** + * searchKeyword attribute 값을 설정한다. + * @param searchKeyword String + */ + public void setSearchKeyword(String searchKeyword) { + this.searchKeyword = searchKeyword; + } + + /** + * searchUseYn attribute 를 리턴한다. + * @return String + */ + public String getSearchUseYn() { + return searchUseYn; + } + + /** + * searchUseYn attribute 값을 설정한다. + * @param searchUseYn String + */ + public void setSearchUseYn(String searchUseYn) { + this.searchUseYn = searchUseYn; + } + + /** + * pageIndex attribute 를 리턴한다. + * @return int + */ + public int getPageIndex() { + return pageIndex; + } + + /** + * pageIndex attribute 값을 설정한다. + * @param pageIndex int + */ + public void setPageIndex(int pageIndex) { + this.pageIndex = pageIndex; + } + + /** + * pageUnit attribute 를 리턴한다. + * @return int + */ + public int getPageUnit() { + return pageUnit; + } + + /** + * pageUnit attribute 값을 설정한다. + * @param pageUnit int + */ + public void setPageUnit(int pageUnit) { + this.pageUnit = pageUnit; + } + + /** + * pageSize attribute 를 리턴한다. + * @return int + */ + public int getPageSize() { + return pageSize; + } + + /** + * pageSize attribute 값을 설정한다. + * @param pageSize int + */ + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + /** + * firstIndex attribute 를 리턴한다. + * @return int + */ + public int getFirstIndex() { + return firstIndex; + } + + /** + * firstIndex attribute 값을 설정한다. + * @param firstIndex int + */ + public void setFirstIndex(int firstIndex) { + this.firstIndex = firstIndex; + } + + /** + * lastIndex attribute 를 리턴한다. + * @return int + */ + public int getLastIndex() { + return lastIndex; + } + + /** + * lastIndex attribute 값을 설정한다. + * @param lastIndex int + */ + public void setLastIndex(int lastIndex) { + this.lastIndex = lastIndex; + } + + /** + * recordCountPerPage attribute 를 리턴한다. + * @return int + */ + public int getRecordCountPerPage() { + return recordCountPerPage; + } + + /** + * recordCountPerPage attribute 값을 설정한다. + * @param recordCountPerPage int + */ + public void setRecordCountPerPage(int recordCountPerPage) { + this.recordCountPerPage = recordCountPerPage; + } + + +} diff --git a/src/main/java/egovframework/com/sym/ccm/zip/service/impl/EgovCcmExcelRdnmadZipMapping.java b/src/main/java/egovframework/com/sym/ccm/zip/service/impl/EgovCcmExcelRdnmadZipMapping.java new file mode 100644 index 0000000..28e0df7 --- /dev/null +++ b/src/main/java/egovframework/com/sym/ccm/zip/service/impl/EgovCcmExcelRdnmadZipMapping.java @@ -0,0 +1,64 @@ +package egovframework.com.sym.ccm.zip.service.impl; + +import egovframework.com.sym.ccm.zip.service.Zip; + +import org.egovframe.rte.fdl.excel.EgovExcelMapping; +import org.egovframe.rte.fdl.excel.util.EgovExcelUtil; + +import org.apache.poi.hssf.usermodel.HSSFCell; +import org.apache.poi.ss.usermodel.Row; + +/** + * + * Excel 우편번호 매핑 클래스 + * @author 공통서비스 개발팀 이기하 + * @since 2011.11.21 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *     수정일      	수정자           수정내용
    + *  -----------    --------    ---------------------------
    + *   2011.11.21		이기하           도로명주소 최초 생성
    + *
    + * 
    + */ +public class EgovCcmExcelRdnmadZipMapping extends EgovExcelMapping { + + /** + * 우편번호 엑셀파일 맵핑 + */ + @Override + public Object mappingColumn(Row row) { + HSSFCell cell0 = (HSSFCell) row.getCell(0); + HSSFCell cell1 = (HSSFCell) row.getCell(1); + HSSFCell cell2 = (HSSFCell) row.getCell(2); + HSSFCell cell3 = (HSSFCell) row.getCell(3); + HSSFCell cell4 = (HSSFCell) row.getCell(4); + HSSFCell cell5 = (HSSFCell) row.getCell(5); + HSSFCell cell6 = (HSSFCell) row.getCell(6); + HSSFCell cell7 = (HSSFCell) row.getCell(7); + HSSFCell cell8 = (HSSFCell) row.getCell(8); + HSSFCell cell9 = (HSSFCell) row.getCell(9); + HSSFCell cell10 = (HSSFCell) row.getCell(10); + + Zip vo = new Zip(); + + vo.setRdmnCode (EgovExcelUtil.getValue(cell0)); + vo.setSn (Integer.parseInt(EgovExcelUtil.getValue(cell1))); + vo.setCtprvnNm (EgovExcelUtil.getValue(cell2)); + vo.setSignguNm (EgovExcelUtil.getValue(cell3)); + vo.setRdmn (EgovExcelUtil.getValue(cell4)); + vo.setBdnbrMnnm (EgovExcelUtil.getValue(cell5)); + vo.setBdnbrSlno (EgovExcelUtil.getValue(cell6)); + vo.setZip (EgovExcelUtil.getValue(cell9)); + vo.setFrstRegisterId (EgovExcelUtil.getValue(cell10)); + + if (cell6 != null) {vo.setBuldNm (EgovExcelUtil.getValue(cell7));} + if (cell7 != null) {vo.setDetailBuldNm (EgovExcelUtil.getValue(cell8));} + + return vo; + } +} diff --git a/src/main/java/egovframework/com/sym/ccm/zip/service/impl/EgovCcmExcelZipMapping.java b/src/main/java/egovframework/com/sym/ccm/zip/service/impl/EgovCcmExcelZipMapping.java new file mode 100644 index 0000000..1f2cac4 --- /dev/null +++ b/src/main/java/egovframework/com/sym/ccm/zip/service/impl/EgovCcmExcelZipMapping.java @@ -0,0 +1,59 @@ +package egovframework.com.sym.ccm.zip.service.impl; + +import egovframework.com.sym.ccm.zip.service.Zip; + +import org.egovframe.rte.fdl.excel.EgovExcelMapping; +import org.egovframe.rte.fdl.excel.util.EgovExcelUtil; + +import org.apache.poi.hssf.usermodel.HSSFCell; +import org.apache.poi.ss.usermodel.Row; + +/** + * + * Excel 우편번호 매핑 클래스 + * @author 공통서비스 개발팀 이중호 + * @since 2009.04.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.01  이중호          최초 생성
    + *
    + * 
    + */ +public class EgovCcmExcelZipMapping extends EgovExcelMapping { + + /** + * 우편번호 엑셀파일 맵핑 + */ + @Override + public Object mappingColumn(Row row) { + HSSFCell cell0 = (HSSFCell) row.getCell(0); + HSSFCell cell1 = (HSSFCell) row.getCell(1); + HSSFCell cell2 = (HSSFCell) row.getCell(2); + HSSFCell cell3 = (HSSFCell) row.getCell(3); + HSSFCell cell4 = (HSSFCell) row.getCell(4); + HSSFCell cell5 = (HSSFCell) row.getCell(5); + HSSFCell cell6 = (HSSFCell) row.getCell(6); + HSSFCell cell7 = (HSSFCell) row.getCell(7); + + Zip vo = new Zip(); + + vo.setZip (EgovExcelUtil.getValue(cell0)); + vo.setSn (Integer.parseInt(EgovExcelUtil.getValue(cell1))); + vo.setCtprvnNm (EgovExcelUtil.getValue(cell2)); + vo.setSignguNm (EgovExcelUtil.getValue(cell3)); + vo.setEmdNm (EgovExcelUtil.getValue(cell4)); + vo.setFrstRegisterId (EgovExcelUtil.getValue(cell7)); + + if (cell5 != null) {vo.setLiBuldNm (EgovExcelUtil.getValue(cell5));} + if (cell6 != null) {vo.setLnbrDongHo (EgovExcelUtil.getValue(cell6));} + + + return vo; + } +} diff --git a/src/main/java/egovframework/com/sym/ccm/zip/service/impl/EgovCcmRdnmadZipServiceImpl.java b/src/main/java/egovframework/com/sym/ccm/zip/service/impl/EgovCcmRdnmadZipServiceImpl.java new file mode 100644 index 0000000..c235d18 --- /dev/null +++ b/src/main/java/egovframework/com/sym/ccm/zip/service/impl/EgovCcmRdnmadZipServiceImpl.java @@ -0,0 +1,112 @@ +package egovframework.com.sym.ccm.zip.service.impl; + +import java.io.InputStream; +import java.util.List; + +import egovframework.com.sym.ccm.zip.service.EgovCcmRdnmadZipManageService; +import egovframework.com.sym.ccm.zip.service.Zip; +import egovframework.com.sym.ccm.zip.service.ZipVO; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.excel.EgovExcelService; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + + +/** + * + * 우편번호에 대한 서비스 구현클래스를 정의한다 + * @author 공통서비스 개발팀 이기하 + * @since 2011.11.21 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *     수정일      	수정자           수정내용
    + *  -----------    --------    ---------------------------
    + *   2011.11.21		이기하           도로명주소 최초 생성
    + *
    + * 
    + */ +@Service("RdnmadZipService") +public class EgovCcmRdnmadZipServiceImpl extends EgovAbstractServiceImpl implements EgovCcmRdnmadZipManageService { + + @Resource(name="RdnmadZipDAO") + private RdnmadZipDAO rdnmadZipDAO; + + @Resource(name = "excelRdnmadZipService") + private EgovExcelService excelRdnmadZipService; + + /** + * 우편번호를 삭제한다. + */ + @Override + public void deleteZip(Zip zip) throws Exception { + rdnmadZipDAO.deleteZip(zip); + } + + /** + * 우편번호 전체를 삭제한다. + */ + @Override + public void deleteAllZip() throws Exception { + rdnmadZipDAO.deleteAllZip(); + } + + /** + * 우편번호를 등록한다. + */ + @Override + public void insertZip(Zip zip) throws Exception { + rdnmadZipDAO.insertZip(zip); + } + + /** + * 우편번호 엑셀파일을 등록한다. + * @param zip + * @throws Exception + */ + @Override + public void insertExcelZip(InputStream file) throws Exception { + rdnmadZipDAO.insertExcelZip(); + excelRdnmadZipService.uploadExcel("RdnmadZipDAO.insertExcelZip", file, 1, 5000); + } + + /** + * 우편번호 상세항목을 조회한다. + */ + @Override + public Zip selectZipDetail(Zip zip) throws Exception { + Zip ret = rdnmadZipDAO.selectZipDetail(zip); + return ret; + } + + /** + * 우편번호 목록을 조회한다. + */ + @Override + public List selectZipList(ZipVO searchVO) throws Exception { + return rdnmadZipDAO.selectZipList(searchVO); + } + + /** + * 우편번호 총 갯수를 조회한다. + */ + @Override + public int selectZipListTotCnt(ZipVO searchVO) throws Exception { + return rdnmadZipDAO.selectZipListTotCnt(searchVO); + } + + /** + * 우편번호를 수정한다. + */ + @Override + public void updateZip(Zip zip) throws Exception { + rdnmadZipDAO.updateZip(zip); + } + +} diff --git a/src/main/java/egovframework/com/sym/ccm/zip/service/impl/EgovCcmZipManageServiceImpl.java b/src/main/java/egovframework/com/sym/ccm/zip/service/impl/EgovCcmZipManageServiceImpl.java new file mode 100644 index 0000000..a7da7cf --- /dev/null +++ b/src/main/java/egovframework/com/sym/ccm/zip/service/impl/EgovCcmZipManageServiceImpl.java @@ -0,0 +1,113 @@ +package egovframework.com.sym.ccm.zip.service.impl; + +import java.io.InputStream; +import java.util.List; + +import egovframework.com.sym.ccm.zip.service.EgovCcmZipManageService; +import egovframework.com.sym.ccm.zip.service.Zip; +import egovframework.com.sym.ccm.zip.service.ZipVO; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.excel.EgovExcelService; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + + +/** + * + * 우편번호에 대한 서비스 구현클래스를 정의한다 + * @author 공통서비스 개발팀 이중호 + * @since 2009.04.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.01  이중호          최초 생성
    + *   2011.11.22  이기하          엑셀업로드 시작위치 수정(2 -> 1)
    + *
    + * 
    + */ +@Service("ZipManageService") +public class EgovCcmZipManageServiceImpl extends EgovAbstractServiceImpl implements EgovCcmZipManageService { + + @Resource(name="ZipManageDAO") + private ZipManageDAO zipManageDAO; + + @Resource(name = "excelZipService") + private EgovExcelService excelZipService; + + /** + * 우편번호를 삭제한다. + */ + @Override + public void deleteZip(Zip zip) throws Exception { + zipManageDAO.deleteZip(zip); + } + + /** + * 우편번호 전체를 삭제한다. + */ + @Override + public void deleteAllZip() throws Exception { + zipManageDAO.deleteAllZip(); + } + + /** + * 우편번호를 등록한다. + */ + @Override + public void insertZip(Zip zip) throws Exception { + zipManageDAO.insertZip(zip); + } + + /** + * 우편번호 엑셀파일을 등록한다. + * @param zip + * @throws Exception + */ + @Override + public void insertExcelZip(InputStream file) throws Exception { + zipManageDAO.insertExcelZip(); + excelZipService.uploadExcel("ZipManageDAO.insertExcelZip", file, 1, 5000); + } + + /** + * 우편번호 상세항목을 조회한다. + */ + @Override + public Zip selectZipDetail(Zip zip) throws Exception { + Zip ret = zipManageDAO.selectZipDetail(zip); + return ret; + } + + /** + * 우편번호 목록을 조회한다. + */ + @Override + public List selectZipList(ZipVO searchVO) throws Exception { + return zipManageDAO.selectZipList(searchVO); + } + + /** + * 우편번호 총 갯수를 조회한다. + */ + @Override + public int selectZipListTotCnt(ZipVO searchVO) throws Exception { + return zipManageDAO.selectZipListTotCnt(searchVO); + } + + /** + * 우편번호를 수정한다. + */ + @Override + public void updateZip(Zip zip) throws Exception { + zipManageDAO.updateZip(zip); + } + +} diff --git a/src/main/java/egovframework/com/sym/ccm/zip/service/impl/RdnmadZipDAO.java b/src/main/java/egovframework/com/sym/ccm/zip/service/impl/RdnmadZipDAO.java new file mode 100644 index 0000000..2aedf6b --- /dev/null +++ b/src/main/java/egovframework/com/sym/ccm/zip/service/impl/RdnmadZipDAO.java @@ -0,0 +1,105 @@ +package egovframework.com.sym.ccm.zip.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.sym.ccm.zip.service.Zip; +import egovframework.com.sym.ccm.zip.service.ZipVO; + +import org.springframework.stereotype.Repository; + +/** + * + * 우편번호에 대한 데이터 접근 클래스를 정의한다 + * @author 공통서비스 개발팀 이기하 + * @since 2011.11.21 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *     수정일      	수정자           수정내용
    + *  -----------    --------    ---------------------------
    + *   2011.11.21		이기하           도로명주소 최초 생성
    + *
    + * 
    + */ +@Repository("RdnmadZipDAO") +public class RdnmadZipDAO extends EgovComAbstractDAO { + + /** + * 우편번호를 삭제한다. + * @param zip + * @throws Exception + */ + public void deleteZip(Zip zip) throws Exception { + delete("RdnmadZipDAO.deleteZip", zip); + } + + /** + * 우편번호 전체를 삭제한다. + * @throws Exception + */ + public void deleteAllZip() throws Exception { + delete("RdnmadZipDAO.deleteAllZip", new Object()); + } + + /** + * 우편번호를 등록한다. + * @param zip + * @throws Exception + */ + public void insertZip(Zip zip) throws Exception { + insert("RdnmadZipDAO.insertZip", zip); + } + + /** + * 우편번호 엑셀파일을 등록한다. + * @param zip + * @throws Exception + */ + public void insertExcelZip() throws Exception { + delete("RdnmadZipDAO.deleteAllZip", new Object()); + } + + + /** + * 우편번호 상세항목을 조회한다. + * @param zip + * @return Zip(우편번호) + */ + public Zip selectZipDetail(Zip zip) throws Exception { + return (Zip) selectOne("RdnmadZipDAO.selectZipDetail", zip); + } + + + /** + * 우편번호 목록을 조회한다. + * @param searchVO + * @return List(우편번호 목록) + * @throws Exception + */ + public List selectZipList(ZipVO searchVO) throws Exception { + return selectList("RdnmadZipDAO.selectZipList", searchVO); + } + + /** + * 우편번호 총 갯수를 조회한다. + * @param searchVO + * @return int(우편번호 총 갯수) + */ + public int selectZipListTotCnt(ZipVO searchVO) throws Exception { + return (Integer)selectOne("RdnmadZipDAO.selectZipListTotCnt", searchVO); + } + + /** + * 우편번호를 수정한다. + * @param zip + * @throws Exception + */ + public void updateZip(Zip zip) throws Exception { + update("RdnmadZipDAO.updateZip", zip); + } + +} diff --git a/src/main/java/egovframework/com/sym/ccm/zip/service/impl/ZipManageDAO.java b/src/main/java/egovframework/com/sym/ccm/zip/service/impl/ZipManageDAO.java new file mode 100644 index 0000000..34957cd --- /dev/null +++ b/src/main/java/egovframework/com/sym/ccm/zip/service/impl/ZipManageDAO.java @@ -0,0 +1,105 @@ +package egovframework.com.sym.ccm.zip.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.sym.ccm.zip.service.Zip; +import egovframework.com.sym.ccm.zip.service.ZipVO; + +import org.springframework.stereotype.Repository; + +/** + * + * 우편번호에 대한 데이터 접근 클래스를 정의한다 + * @author 공통서비스 개발팀 이중호 + * @since 2009.04.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.01  이중호          최초 생성
    + *
    + * 
    + */ +@Repository("ZipManageDAO") +public class ZipManageDAO extends EgovComAbstractDAO { + + /** + * 우편번호를 삭제한다. + * @param zip + * @throws Exception + */ + public void deleteZip(Zip zip) throws Exception { + delete("ZipManageDAO.deleteZip", zip); + } + + /** + * 우편번호 전체를 삭제한다. + * @throws Exception + */ + public void deleteAllZip() throws Exception { + delete("ZipManageDAO.deleteAllZip", new Object()); + } + + /** + * 우편번호를 등록한다. + * @param zip + * @throws Exception + */ + public void insertZip(Zip zip) throws Exception { + insert("ZipManageDAO.insertZip", zip); + } + + /** + * 우편번호 엑셀파일을 등록한다. + * @param zip + * @throws Exception + */ + public void insertExcelZip() throws Exception { + delete("ZipManageDAO.deleteAllZip", new Object()); + } + + + /** + * 우편번호 상세항목을 조회한다. + * @param zip + * @return Zip(우편번호) + */ + public Zip selectZipDetail(Zip zip) throws Exception { + return (Zip) selectOne("ZipManageDAO.selectZipDetail", zip); + } + + + /** + * 우편번호 목록을 조회한다. + * @param searchVO + * @return List(우편번호 목록) + * @throws Exception + */ + public List selectZipList(ZipVO searchVO) throws Exception { + return selectList("ZipManageDAO.selectZipList", searchVO); + } + + /** + * 우편번호 총 갯수를 조회한다. + * @param searchVO + * @return int(우편번호 총 갯수) + */ + public int selectZipListTotCnt(ZipVO searchVO) throws Exception { + return (Integer)selectOne("ZipManageDAO.selectZipListTotCnt", searchVO); + } + + /** + * 우편번호를 수정한다. + * @param zip + * @throws Exception + */ + public void updateZip(Zip zip) throws Exception { + update("ZipManageDAO.updateZip", zip); + } + +} diff --git a/src/main/java/egovframework/com/sym/ccm/zip/web/EgovCcmZipManageController.java b/src/main/java/egovframework/com/sym/ccm/zip/web/EgovCcmZipManageController.java new file mode 100644 index 0000000..0b0a6a0 --- /dev/null +++ b/src/main/java/egovframework/com/sym/ccm/zip/web/EgovCcmZipManageController.java @@ -0,0 +1,395 @@ +package egovframework.com.sym.ccm.zip.web; + +import java.io.InputStream; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +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.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.util.WebUtils; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.util.EgovResourceCloseHelper; +import egovframework.com.sym.ccm.zip.service.EgovCcmRdnmadZipManageService; +import egovframework.com.sym.ccm.zip.service.EgovCcmZipManageService; +import egovframework.com.sym.ccm.zip.service.Zip; +import egovframework.com.sym.ccm.zip.service.ZipVO; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +/** + * + * 우편번호에 관한 요청을 받아 서비스 클래스로 요청을 전달하고 서비스클래스에서 처리한 결과를 웹 화면으로 전달을 위한 Controller를 정의한다 + * @author 공통서비스 개발팀 이중호 + * @since 2009.04.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *  수정일               수정자            수정내용
    + *  ----------   --------   ---------------------------
    + *  2009.04.01   이중호            최초 생성
    + *  2011.08.26   정진오            IncludedInfo annotation 추가
    + *  2011.10.07   이기하            보안취약점 수정(파일 업로드시 엑셀파일만 가능하도록 추가)
    + *  2011.11.21   이기하            도로명주소 추가(rdnmadZip)
    + *  2021.02.16   신용호            WebUtils.getNativeRequest(request,MultipartHttpServletRequest.class);
    + *
    + * 
    + */ + +@Controller +public class EgovCcmZipManageController { + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovCcmZipManageController.class); + + @Resource(name = "ZipManageService") + private EgovCcmZipManageService zipManageService; + + @Resource(name = "RdnmadZipService") + private EgovCcmRdnmadZipManageService rdnmadZipService; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + @Autowired + private DefaultBeanValidator beanValidator; + + /** + * 우편번호 찾기 팝업 메인창을 호출한다. + * @param model + * @return "egovframework/com/sym/ccm/zip/EgovCcmZipSearchPopup" + * @throws Exception + */ + @RequestMapping(value = "/sym/ccm/zip/EgovCcmZipSearchPopup.do") + public String callNormalCalPopup(ModelMap model) throws Exception { + return "egovframework/com/sym/ccm/zip/EgovCcmZipSearchPopup"; + } + + /** + * 우편번호 찾기 목록을 조회한다. + * @param searchVO + * @param model + * @return "egovframework/com/sym/ccm/zip/EgovCcmZipSearchList" + * @throws Exception + */ + @RequestMapping(value = "/sym/ccm/zip/EgovCcmZipSearchList.do") + public String selectZipSearchList(@ModelAttribute("searchVO") ZipVO searchVO, ModelMap model) throws Exception { + /** 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()); + + String sList = ""; + + if (searchVO.getSearchList() != null && searchVO.getSearchList() != "") { + sList = searchVO.getSearchList().substring(0, 1); + } + model.addAttribute("searchList", sList); + + if (!sList.equals("2")) { + List CmmnCodeList = zipManageService.selectZipList(searchVO); + model.addAttribute("resultList", CmmnCodeList); + + int totCnt = zipManageService.selectZipListTotCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + } else { + List CmmnCodeList = rdnmadZipService.selectZipList(searchVO); + model.addAttribute("resultList", CmmnCodeList); + + int totCnt = rdnmadZipService.selectZipListTotCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + } + + return "egovframework/com/sym/ccm/zip/EgovCcmZipSearchList"; + } + + /** + * 우편번호를 삭제한다. + * @param loginVO + * @param zip + * @param model + * @return "forward:/sym/ccm/zip/EgovCcmZipList.do" + * @throws Exception + */ + @RequestMapping(value = "/sym/ccm/zip/EgovCcmZipRemove.do") + public String deleteZip(@ModelAttribute("loginVO") LoginVO loginVO, Zip zip, ZipVO searchVO, ModelMap model) + throws Exception { + model.addAttribute("searchList", searchVO.getSearchList()); + if (searchVO.getSearchList().equals("1")) { + zipManageService.deleteZip(zip); + } else { + rdnmadZipService.deleteZip(zip); + } + return "forward:/sym/ccm/zip/EgovCcmZipList.do"; + } + + /** + * 우편번호를 등록한다. + * @param loginVO + * @param zip + * @param bindingResult + * @param model + * @return "egovframework/com/sym/ccm/zip/EgovCcmZipRegist" + * @throws Exception + */ + @RequestMapping(value = "/sym/ccm/zip/EgovCcmZipRegist.do") + public String insertZip(@ModelAttribute("loginVO") LoginVO loginVO, @ModelAttribute("zip") Zip zip, ZipVO searchVO, + BindingResult bindingResult, ModelMap model) + throws Exception { + + model.addAttribute("searchList", searchVO.getSearchList()); + + if (zip.getZip() == null || zip.getZip().equals("")) { + + return "egovframework/com/sym/ccm/zip/EgovCcmZipRegist"; + } + + if (searchVO.getSearchList().equals("1")) { + beanValidator.validate(zip, bindingResult); + if (bindingResult.hasErrors()) { + return "egovframework/com/sym/ccm/zip/EgovCcmZipRegist"; + } + + zip.setFrstRegisterId(loginVO.getUniqId()); + zipManageService.insertZip(zip); + } else { + /*beanValidator.validate(zip, bindingResult); + if (bindingResult.hasErrors()){ + return "egovframework/com/sym/ccm/zip/EgovCcmZipRegist"; + }*/ + + zip.setFrstRegisterId(loginVO.getUniqId()); + rdnmadZipService.insertZip(zip); + } + return "forward:/sym/ccm/zip/EgovCcmZipList.do"; + } + + /** + * 엑셀파일을 업로드하여 우편번호를 등록한다. + * @param loginVO + * @param request + * @param commandMap + * @param model + * @return "egovframework/com/sym/ccm/zip/EgovCcmExcelZipRegist" + * @throws Exception + */ + @RequestMapping(value = "/sym/ccm/zip/EgovCcmExcelZipRegist.do") + public String insertExcelZip(@ModelAttribute("loginVO") LoginVO loginVO, final HttpServletRequest request, + @RequestParam Map commandMap, ZipVO searchVO, Model model) + throws Exception { + model.addAttribute("searchList", searchVO.getSearchList()); + + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); + if (sCmd.equals("")) { + return "egovframework/com/sym/ccm/zip/EgovCcmExcelZipRegist"; + } + + //final MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) request; + MultipartHttpServletRequest multiRequest = WebUtils.getNativeRequest(request, + MultipartHttpServletRequest.class); + if (multiRequest != null) { //2022.01 Possible null pointer dereference due to return value of called method 조치 + final Map files = multiRequest.getFileMap(); + InputStream fis = null; + + //String sResult = ""; + + Iterator> itr = files.entrySet().iterator(); + MultipartFile file; + + while (itr.hasNext()) { + Entry entry = itr.next(); + + file = entry.getValue(); + if (file.getOriginalFilename() != null && !"".equals(file.getOriginalFilename())) { + // 업로드 파일에 대한 확장자를 체크 + if (file.getOriginalFilename().endsWith(".xls") || file.getOriginalFilename().endsWith(".xlsx") + || file.getOriginalFilename().endsWith(".XLS") + || file.getOriginalFilename().endsWith(".XLSX")) { + + //zipManageService.deleteAllZip(); + //excelZipService.uploadExcel("ZipManageDAO.insertExcelZip", file.getInputStream(), 2); + try { + fis = file.getInputStream(); + if (searchVO.getSearchList().equals("1")) { + zipManageService.insertExcelZip(fis); + } else { + rdnmadZipService.insertExcelZip(fis); + } + } finally { + EgovResourceCloseHelper.close(fis); + } + + } else { + LOGGER.info("xls, xlsx 파일 타입만 등록이 가능합니다."); + return "egovframework/com/sym/ccm/zip/EgovCcmExcelZipRegist"; + } + // *********** 끝 *********** + + } + } + } + + return "forward:/sym/ccm/zip/EgovCcmZipList.do"; + } + + /** + * 우편번호 상세항목을 조회한다. + * @param loginVO + * @param zip + * @param model + * @return "egovframework/com/sym/ccm/zip/EgovCcmZipDetail" + * @throws Exception + */ + @RequestMapping(value = "/sym/ccm/zip/EgovCcmZipDetail.do") + public String selectZipDetail(@ModelAttribute("loginVO") LoginVO loginVO, Zip zip, ZipVO searchVO, ModelMap model) + throws Exception { + if (searchVO.getSearchList().equals("1")) { + Zip vo = zipManageService.selectZipDetail(zip); + model.addAttribute("result", vo); + model.addAttribute("searchList", searchVO.getSearchList()); + } else { + Zip vo = rdnmadZipService.selectZipDetail(zip); + model.addAttribute("result", vo); + model.addAttribute("searchList", searchVO.getSearchList()); + } + + return "egovframework/com/sym/ccm/zip/EgovCcmZipDetail"; + } + + /** + * 우편번호 목록을 조회한다. + * @param loginVO + * @param searchVO + * @param model + * @return "egovframework/com/sym/ccm/zip/EgovCcmZipList" + * @throws Exception + */ + @IncludedInfo(name = "우편번호관리", listUrl = "/sym/ccm/zip/EgovCcmZipList.do", order = 1000, gid = 50) + @RequestMapping(value = "/sym/ccm/zip/EgovCcmZipList.do") + public String selectZipList(@ModelAttribute("loginVO") LoginVO loginVO, @ModelAttribute("searchVO") ZipVO searchVO, + ModelMap model) throws Exception { + /** 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()); + + if (!searchVO.getSearchList().equals("2")) { + List CmmnCodeList = zipManageService.selectZipList(searchVO); + model.addAttribute("resultList", CmmnCodeList); + + int totCnt = zipManageService.selectZipListTotCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + } else { + List CmmnCodeList = rdnmadZipService.selectZipList(searchVO); + model.addAttribute("resultList", CmmnCodeList); + + int totCnt = rdnmadZipService.selectZipListTotCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + } + + return "egovframework/com/sym/ccm/zip/EgovCcmZipList"; + } + + /** + * 우편번호를 수정한다. + * @param loginVO + * @param zip + * @param bindingResult + * @param commandMap + * @param model + * @return "egovframework/com/sym/ccm/zip/EgovCcmZipModify" + * @throws Exception + */ + @RequestMapping(value = "/sym/ccm/zip/EgovCcmZipModify.do") + public String updateZip(@ModelAttribute("loginVO") LoginVO loginVO, @ModelAttribute("zip") Zip zip, ZipVO searchVO, + BindingResult bindingResult, @RequestParam Map commandMap, + ModelMap model) throws Exception { + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); + model.addAttribute("searchList", searchVO.getSearchList()); + if (sCmd.equals("")) { + if (searchVO.getSearchList().equals("1")) { + Zip vo = zipManageService.selectZipDetail(zip); + model.addAttribute("zip", vo); + } else { + Zip vo = rdnmadZipService.selectZipDetail(zip); + model.addAttribute("zip", vo); + } + return "egovframework/com/sym/ccm/zip/EgovCcmZipModify"; + } else if (sCmd.equals("Modify")) { + if (searchVO.getSearchList().equals("1")) { + beanValidator.validate(zip, bindingResult); + if (bindingResult.hasErrors()) { + return "egovframework/com/sym/ccm/zip/EgovCcmZipModify"; + } + + zip.setLastUpdusrId(loginVO.getUniqId()); + zipManageService.updateZip(zip); + } else { + /*beanValidator.validate(zip, bindingResult); + if (bindingResult.hasErrors()){ + return "egovframework/com/sym/ccm/zip/EgovCcmZipModify"; + }*/ + + zip.setLastUpdusrId(loginVO.getUniqId()); + rdnmadZipService.updateZip(zip); + } + + return "forward:/sym/ccm/zip/EgovCcmZipList.do"; + } else { + return "forward:/sym/ccm/zip/EgovCcmZipList.do"; + } + } + + /** + * 주소정보연계 팝업을 위한 입력 페이지를 호출한다. + * + * @return + */ + @RequestMapping(value = "/sym/ccm/zip/EgovAdressPop.do") + public String selectAddPop() { + return "egovframework/com/sym/ccm/zip/EgovAdressPop"; + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sym/mnu/bmm/service/BkmkMenuManage.java b/src/main/java/egovframework/com/sym/mnu/bmm/service/BkmkMenuManage.java new file mode 100644 index 0000000..2633f18 --- /dev/null +++ b/src/main/java/egovframework/com/sym/mnu/bmm/service/BkmkMenuManage.java @@ -0,0 +1,112 @@ +package egovframework.com.sym.mnu.bmm.service; + +import java.io.Serializable; + +/** + * 바로가기메뉴관리를 위한 모델 클래스 + * @author 공통컴포넌트개발팀 윤성록 + * @since 2009.09.25 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.9.25  윤성록          최초 생성
    + *
    + * 
    + */ +@SuppressWarnings("serial") +public class BkmkMenuManage implements Serializable{ + + /** 메뉴 아이디 */ + String menuId = ""; + + /** 메뉴명 */ + String menuNm = ""; + + /** 메뉴 URL */ + String progrmStrePath = ""; + + /** 등록자 아이디 */ + String userId = ""; + + /** + * menuId attribute를 리턴한다. + * + * @return the menuId + */ + public String getMenuId() { + return menuId; + } + + /** + * menuId attribute 값을 설정한다. + * + * @param menuId + * the menuId to set + */ + public void setMenuId(String menuId) { + this.menuId = menuId; + } + + /** + * menuNm attribute를 리턴한다. + * + * @return the menuNm + */ + public String getMenuNm() { + return menuNm; + } + + /** + * menuNm attribute 값을 설정한다. + * + * @param menuNm + * the menuNm to set + */ + public void setMenuNm(String menuNm) { + this.menuNm = menuNm; + } + + /** + * progrmStrePath attribute를 리턴한다. + * + * @return the progrmStrePath + */ + public String getProgrmStrePath() { + return progrmStrePath; + } + + + /** + * progrmStrePath attribute 값을 설정한다. + * + * @param progrmStrePath + * the progrmStrePath to set + */ + public void setProgrmStrePath(String progrmStrePath) { + this.progrmStrePath = progrmStrePath; + } + + /** + * userId attribute를 리턴한다. + * + * @return the userId + */ + public String getUserId() { + return userId; + } + + /** + * userId attribute 값을 설정한다. + * + * @param userId + * the userId to set + */ + public void setUserId(String userId) { + this.userId = userId; + } +} diff --git a/src/main/java/egovframework/com/sym/mnu/bmm/service/BkmkMenuManageVO.java b/src/main/java/egovframework/com/sym/mnu/bmm/service/BkmkMenuManageVO.java new file mode 100644 index 0000000..34f5298 --- /dev/null +++ b/src/main/java/egovframework/com/sym/mnu/bmm/service/BkmkMenuManageVO.java @@ -0,0 +1,375 @@ +package egovframework.com.sym.mnu.bmm.service; + +/** + * 바로가기메뉴관리를 위한 VO 모델 클래스 + * @author 공통컴포넌트개발팀 윤성록 + * @since 2009.09.25 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.9.25  윤성록          최초 생성
    + *
    + * 
    + */ +public class BkmkMenuManageVO extends BkmkMenuManage{ + + private static final long serialVersionUID = 7602193410939256848L; + + /** 검색시작일 */ + private String searchBgnDe = ""; + + /** 검색조건 */ + private String searchCnd = ""; + + /** 검색종료일 */ + private String searchEndDe = ""; + + /** 검색단어 */ + private String searchWrd = ""; + + /** 정렬순서(DESC,ASC) */ + private long sortOrdr = 0L; + + /** 검색사용여부 */ + private String searchUseYn = ""; + + /** 현재페이지 */ + private int pageIndex = 1; + + /** 페이지갯수 */ + private int pageUnit = 10; + + /** 페이지사이즈 */ + private int pageSize = 10; + + /** 첫페이지 인덱스 */ + private int firstIndex = 1; + + /** 마지막페이지 인덱스 */ + private int lastIndex = 1; + + /** 페이지당 레코드 개수 */ + private int recordCountPerPage = 10; + + /** 레코드 번호 */ + private int rowNo = 0; + + /** 최초 등록자명 */ + private String frstRegisterNm = ""; + + /** 최종 수정자명 */ + private String lastUpdusrNm = ""; + + /** 메뉴 설명*/ + String menuDc = ""; + + + /** + * searchBgnDe attribute를 리턴한다. + * + * @return the searchBgnDe + */ + public String getSearchBgnDe() { + return searchBgnDe; + } + + /** + * searchBgnDe attribute 값을 설정한다. + * + * @param searchBgnDe + * the searchBgnDe to set + */ + public void setSearchBgnDe(String searchBgnDe) { + this.searchBgnDe = searchBgnDe; + } + + /** + * searchCnd attribute를 리턴한다. + * + * @return the searchCnd + */ + public String getSearchCnd() { + return searchCnd; + } + + /** + * searchCnd attribute 값을 설정한다. + * + * @param searchCnd + * the searchCnd to set + */ + public void setSearchCnd(String searchCnd) { + this.searchCnd = searchCnd; + } + + /** + * searchEndDe attribute를 리턴한다. + * + * @return the searchEndDe + */ + public String getSearchEndDe() { + return searchEndDe; + } + + /** + * searchEndDe attribute 값을 설정한다. + * + * @param searchEndDe + * the searchEndDe to set + */ + public void setSearchEndDe(String searchEndDe) { + this.searchEndDe = searchEndDe; + } + + /** + * searchWrd attribute를 리턴한다. + * + * @return the searchWrd + */ + public String getSearchWrd() { + return searchWrd; + } + + /** + * searchWrd attribute 값을 설정한다. + * + * @param searchWrd + * the searchWrd to set + */ + public void setSearchWrd(String searchWrd) { + this.searchWrd = searchWrd; + } + + /** + * sortOrdr attribute를 리턴한다. + * + * @return the sortOrdr + */ + public long getSortOrdr() { + return sortOrdr; + } + + /** + * sortOrdr attribute 값을 설정한다. + * + * @param sortOrdr + * the sortOrdr to set + */ + public void setSortOrdr(long sortOrdr) { + this.sortOrdr = sortOrdr; + } + + /** + * searchUseYn attribute를 리턴한다. + * + * @return the searchUseYn + */ + public String getSearchUseYn() { + return searchUseYn; + } + + /** + * searchUseYn attribute 값을 설정한다. + * + * @param searchUseYn + * the searchUseYn to set + */ + public void setSearchUseYn(String searchUseYn) { + this.searchUseYn = searchUseYn; + } + + /** + * pageIndex attribute를 리턴한다. + * + * @return the pageIndex + */ + public int getPageIndex() { + return pageIndex; + } + + /** + * pageIndex attribute 값을 설정한다. + * + * @param pageIndex + * the pageIndex to set + */ + public void setPageIndex(int pageIndex) { + this.pageIndex = pageIndex; + } + + /** + * pageUnit attribute를 리턴한다. + * + * @return the pageUnit + */ + public int getPageUnit() { + return pageUnit; + } + + /** + * pageUnit attribute 값을 설정한다. + * + * @param pageUnit + * the pageUnit to set + */ + public void setPageUnit(int pageUnit) { + this.pageUnit = pageUnit; + } + + /** + * pageSize attribute를 리턴한다. + * + * @return the pageSize + */ + public int getPageSize() { + return pageSize; + } + + /** + * pageSize attribute 값을 설정한다. + * + * @param pageSize + * the pageSize to set + */ + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + /** + * firstIndex attribute를 리턴한다. + * + * @return the firstIndex + */ + public int getFirstIndex() { + return firstIndex; + } + + /** + * firstIndex attribute 값을 설정한다. + * + * @param firstIndex + * the firstIndex to set + */ + public void setFirstIndex(int firstIndex) { + this.firstIndex = firstIndex; + } + + /** + * lastIndex attribute를 리턴한다. + * + * @return the lastIndex + */ + public int getLastIndex() { + return lastIndex; + } + + /** + * lastIndex attribute 값을 설정한다. + * + * @param lastIndex + * the lastIndex to set + */ + public void setLastIndex(int lastIndex) { + this.lastIndex = lastIndex; + } + + /** + * recordCountPerPage attribute를 리턴한다. + * + * @return the recordCountPerPage + */ + public int getRecordCountPerPage() { + return recordCountPerPage; + } + + /** + * recordCountPerPage attribute 값을 설정한다. + * + * @param recordCountPerPage + * the recordCountPerPage to set + */ + public void setRecordCountPerPage(int recordCountPerPage) { + this.recordCountPerPage = recordCountPerPage; + } + + /** + * getRowNo attribute를 리턴한다. + * + * @return the getRowNo + */ + public int getRowNo() { + return rowNo; + } + + /** + * getRowNo attribute 값을 설정한다. + * + * @param getRowNo + * the getRowNo to set + */ + public void setRowNo(int rowNo) { + this.rowNo = rowNo; + } + + /** + * frstRegisterNm attribute를 리턴한다. + * + * @return the frstRegisterNm + */ + public String getFrstRegisterNm() { + return frstRegisterNm; + } + + /** + * frstRegisterNm attribute 값을 설정한다. + * + * @param frstRegisterNm + * the frstRegisterNm to set + */ + public void setFrstRegisterNm(String frstRegisterNm) { + this.frstRegisterNm = frstRegisterNm; + } + + /** + * lastUpdusrNm attribute를 리턴한다. + * + * @return the lastUpdusrNm + */ + public String getLastUpdusrNm() { + return lastUpdusrNm; + } + + /** + * lastUpdusrNm attribute 값을 설정한다. + * + * @param lastUpdusrNm + * the lastUpdusrNm to set + */ + public void setLastUpdusrNm(String lastUpdusrNm) { + this.lastUpdusrNm = lastUpdusrNm; + } + + /** + * menuDc attribute를 리턴한다. + * + * @return the menuDc + */ + public String getMenuDc() { + return menuDc; + } + + /** + * menuDc attribute 값을 설정한다. + * + * @param menuDc + * the menuDc to set + */ + public void setMenuDc(String menuDc) { + this.menuDc = menuDc; + } +} diff --git a/src/main/java/egovframework/com/sym/mnu/bmm/service/EgovBkmkMenuManageservice.java b/src/main/java/egovframework/com/sym/mnu/bmm/service/EgovBkmkMenuManageservice.java new file mode 100644 index 0000000..8b3ed97 --- /dev/null +++ b/src/main/java/egovframework/com/sym/mnu/bmm/service/EgovBkmkMenuManageservice.java @@ -0,0 +1,84 @@ +package egovframework.com.sym.mnu.bmm.service; + +import java.util.List; +import java.util.Map; + + +/** + * 바로가기메뉴관리 정보를 관리하기 위한 서비스 인터페이스 클래스 + * @author 공통컴포넌트팀 윤성록 + * @since 2009.09.25 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.9.25  윤성록          최초 생성
    + *
    + * 
    + */ +public interface EgovBkmkMenuManageservice { + + /** + * 바로가기메뉴관리 정보를 삭제한다. + * @param BkmkMenuManage + * @return + * @exception Exception + */ + public void deleteBkmkMenuManage(BkmkMenuManage BkmkMenuManage) throws Exception ; + + /** + * 바로가기메뉴관리 정보를 등록한다. + * @param BkmkMenuManage + * @return + * @exception Exception + */ + public void insertBkmkMenuManage(BkmkMenuManage bkmkMenuManage)throws Exception ; + + /** + * 바로가기메뉴관리 정보의 전체목록을 조회한다. + * @param BkmkMenuManage + * @return Map + * @exception Exception + */ + public Map selectBkmkMenuManageList(BkmkMenuManageVO bkmkMenuManageVO) throws Exception ; + + /** + * 바로가기메뉴관리 정보를 조회한다. + * @param BkmkMenuManageVO + * @return BkmkMenuManageVO + * @exception Exception + */ + public BkmkMenuManageVO selectBkmkMenuManageResult(BkmkMenuManageVO bkmkMenuManageVO) throws Exception ; + + /** + * 등록할 메뉴정보 목록을 조회한다. + * @param BkmkMenuManageVO + * @return Map + * @exception Exception + */ + public Map selectMenuList(BkmkMenuManageVO bkmkMenuManageVO) throws Exception; + + /** + * 미리보기를 할 바로가기메뉴관리의 목록을 조회한다. + * + * @param BkmkMenuManageVO + * @return List + * @throws Exception + */ + public List selectBkmkPreviewList(BkmkMenuManageVO bkmkMenuManageVO) throws Exception; + + /** + * 선택된 메뉴의 URL 을 조회한다. + * + * @param bkmkMenuManage + * @return + * @throws Exception + */ + public String selectUrl(BkmkMenuManage bkmkMenuManage) throws Exception; + + +} diff --git a/src/main/java/egovframework/com/sym/mnu/bmm/service/impl/BkmkMenuManageDAO.java b/src/main/java/egovframework/com/sym/mnu/bmm/service/impl/BkmkMenuManageDAO.java new file mode 100644 index 0000000..3dd1c9e --- /dev/null +++ b/src/main/java/egovframework/com/sym/mnu/bmm/service/impl/BkmkMenuManageDAO.java @@ -0,0 +1,139 @@ +package egovframework.com.sym.mnu.bmm.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.sym.mnu.bmm.service.BkmkMenuManage; +import egovframework.com.sym.mnu.bmm.service.BkmkMenuManageVO; +import egovframework.com.sym.mnu.mpm.service.MenuManageVO; + +import org.springframework.stereotype.Repository; + + +/** + * @Class Name : BkmkMenuManageDAO.java + * @Description : 바로가기메뉴를 관리하는 서비스를 정의하기위한 데이터 접근 클래스 + * @Modification Information + * + * 수정일 수정자 수정내용 + * ------- ------- ------------------- + * 2009. 9. 25. 윤성록 + * + * @author 공통 컴포넌트 개발팀 윤성록 + * @since 2009. 9. 25. + * @version + * @see + * + */ +@Repository("bkmkMenuManageDAO") +public class BkmkMenuManageDAO extends EgovComAbstractDAO{ + + /** + * 바로가기메뉴관리 정보를 삭제한다. + * + * @param BkmkMenuManage + * @return + * @throws Exception + */ + public void deleteBkmkMenuManage(BkmkMenuManage bkmkMenuManage) throws Exception { + delete("BkmkMenuManageDAO.deleteBkmkMenuManage", bkmkMenuManage); + } + + /** + * 바로가기메뉴관리 정보를 등록한다. + * + * @param BkmkMenuManage + * @return + * @throws Exception + */ + public void insertBkmkMenuManage(BkmkMenuManage bkmkMenuManage) throws Exception { + insert("BkmkMenuManageDAO.insertBkmkMenuManage", bkmkMenuManage); + } + + /** + * 바로가기메뉴관리 정보를 조회한다. + * + * @param BkmkMenuManageVO + * @return + * @throws Exception + */ + public BkmkMenuManageVO selectBkmkMenuManageResult(BkmkMenuManageVO bkmkMenuManageVO) + throws Exception { + BkmkMenuManageVO vo = new BkmkMenuManageVO(); + vo = (BkmkMenuManageVO)selectOne("BkmkMenuManageDAO.selectBkmkMenuManage", bkmkMenuManageVO); + return vo; + } + + /** + * 조건에 맞는 바로가기메뉴관리 정보 목록을 조회한다. + * + * @param BkmkMenuManageVO + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List selectBkmkMenuManageList(BkmkMenuManageVO bkmkMenuManageVO) + throws Exception { + return selectList("BkmkMenuManageDAO.selectBkmkMenuManageList", bkmkMenuManageVO); + } + + /** + * 조건에 맞는 바로가기메뉴관리 정보 목록의 건수를 조회한다. + * + * @param BkmkMenuManageVO + * @return + * @throws Exception + */ + public int selectBkmkMenuManageListCnt(BkmkMenuManageVO bkmkMenuManageVO) throws Exception { + return (Integer)selectOne("BkmkMenuManageDAO.selectBkmkMenuManageListCnt", bkmkMenuManageVO); + } + + /** + * 등록할 메뉴정보 목록을 조회한다. + * + * @param BkmkMenuManageVO + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List selectBkmkMenuList(BkmkMenuManageVO bkmkMenuManageVO) + throws Exception { + return selectList("BkmkMenuManageDAO.selectBkmkMenuList", bkmkMenuManageVO); + } + + /** + * 등록할 메뉴정보 목록의 건수를 조회한다. + * + * @param BkmkMenuManageVO + * @return + * @throws Exception + */ + public int selectBkmkMenuListCnt(BkmkMenuManageVO bkmkMenuManageVO) throws Exception { + return (Integer)selectOne("BkmkMenuManageDAO.selectBkmkMenuListCnt", bkmkMenuManageVO); + } + + /** + * 미리보기를 할 바로가기메뉴관리의 목록을 조회한다. + * + * @param BkmkMenuManageVO + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List selectBkmkPreview(BkmkMenuManageVO bkmkMenuManageVO) + throws Exception { + return selectList("BkmkMenuManageDAO.selectBkmkPreview", bkmkMenuManageVO); + } + + /** + * 선택된 메뉴의 URL 을 조회한다. + * + * @param bkmkMenuManage + * @return + * @throws Exception + */ + public String selectUrl(BkmkMenuManage bkmkMenuManage) throws Exception { + return (String)selectOne("BkmkMenuManageDAO.selectUrl", bkmkMenuManage); + } +} + diff --git a/src/main/java/egovframework/com/sym/mnu/bmm/service/impl/EgovBkmkMenuManageServiceImpl.java b/src/main/java/egovframework/com/sym/mnu/bmm/service/impl/EgovBkmkMenuManageServiceImpl.java new file mode 100644 index 0000000..90fe087 --- /dev/null +++ b/src/main/java/egovframework/com/sym/mnu/bmm/service/impl/EgovBkmkMenuManageServiceImpl.java @@ -0,0 +1,142 @@ +package egovframework.com.sym.mnu.bmm.service.impl; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import egovframework.com.sym.mnu.bmm.service.BkmkMenuManage; +import egovframework.com.sym.mnu.bmm.service.BkmkMenuManageVO; +import egovframework.com.sym.mnu.bmm.service.EgovBkmkMenuManageservice; +import egovframework.com.sym.mnu.mpm.service.MenuManageVO; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +/** + * @Class Name : EgovBkmkMenuManageServiceImpl.java + * @Description : 바로가기메뉴를 관리하는 서비스 구현 클래스 + * @Modification Information + * + * 수정일 수정자 수정내용 + * ------- ------- ------------------- + * 2009. 9. 25. 윤성록 + * + * @author 공통 컴포넌트 개발팀 윤성록 + * @since 2009. 9. 25. + * @version + * @see + * + */ +@Service("bkmkMenuManageservice") +public class EgovBkmkMenuManageServiceImpl extends EgovAbstractServiceImpl implements EgovBkmkMenuManageservice{ + + + @Resource(name = "bkmkMenuManageDAO") + private BkmkMenuManageDAO bkmkMenuManageDAO; + + /** + * 바로가기메뉴관리 정보를 삭제한다. + * @param BkmkMenuManage + * @return + * @exception Exception + */ + public void deleteBkmkMenuManage(BkmkMenuManage bkmkMenuManage) throws Exception { + bkmkMenuManageDAO.deleteBkmkMenuManage(bkmkMenuManage); + } + + /** + * 바로가기메뉴관리 정보를 등록한다. + * @param BkmkMenuManage + * @return + * @exception Exception + */ + public void insertBkmkMenuManage(BkmkMenuManage bkmkMenuManage) throws Exception { + bkmkMenuManageDAO.insertBkmkMenuManage(bkmkMenuManage); + } + + /** + * 바로가기메뉴관리 정보의 전체목록을 조회한다. + * @param BkmkMenuManage + * @return Map + * @exception Exception + */ + public Map selectBkmkMenuManageList( + BkmkMenuManageVO bkmkMenuManageVO) throws Exception{ + + List result = bkmkMenuManageDAO.selectBkmkMenuManageList(bkmkMenuManageVO); + + int cnt = bkmkMenuManageDAO.selectBkmkMenuManageListCnt(bkmkMenuManageVO); + + Map map = new HashMap(); + + map.put("resultList", result); + map.put("resultCnt", Integer.toString(cnt)); + + return map; + } + + /** + * 바로가기메뉴관리 정보를 조회한다. + * @param BkmkMenuManageVO + * @return BkmkMenuManageVO + * @exception Exception + */ + public BkmkMenuManageVO selectBkmkMenuManageResult( + BkmkMenuManageVO bkmkMenuManageVO) throws Exception { + + return bkmkMenuManageDAO.selectBkmkMenuManageResult(bkmkMenuManageVO); + } + + /** + * 등록할 메뉴정보 목록을 조회한다. + * @param BkmkMenuManageVO + * @return Map + * @exception Exception + */ + public Map selectMenuList(BkmkMenuManageVO bkmkMenuManageVO) + throws Exception { + + List result = bkmkMenuManageDAO.selectBkmkMenuList(bkmkMenuManageVO); + + int cnt = bkmkMenuManageDAO.selectBkmkMenuListCnt(bkmkMenuManageVO); + + Map map = new HashMap(); + + map.put("resultList", result); + map.put("resultCnt", Integer.toString(cnt)); + + return map; + + } + + /** + * 미리보기를 할 바로가기메뉴관리의 목록을 조회한다. + * + * @param BkmkMenuManageVO + * @return List + * @throws Exception + */ + public List selectBkmkPreviewList(BkmkMenuManageVO bkmkMenuManageVO) + throws Exception { + + + List result = bkmkMenuManageDAO.selectBkmkPreview(bkmkMenuManageVO); + + return result; + } + + /** + * 선택된 메뉴의 URL 을 조회한다. + * + * @param bkmkMenuManage + * @return + * @throws Exception + */ + public String selectUrl(BkmkMenuManage bkmkMenuManage) throws Exception { + + return bkmkMenuManageDAO.selectUrl(bkmkMenuManage); + } +} diff --git a/src/main/java/egovframework/com/sym/mnu/bmm/web/EgovBkmkMenuManageController.java b/src/main/java/egovframework/com/sym/mnu/bmm/web/EgovBkmkMenuManageController.java new file mode 100644 index 0000000..6bf8711 --- /dev/null +++ b/src/main/java/egovframework/com/sym/mnu/bmm/web/EgovBkmkMenuManageController.java @@ -0,0 +1,300 @@ +package egovframework.com.sym.mnu.bmm.web; + +import java.util.Map; + +import javax.annotation.Resource; + +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.springframework.web.bind.support.SessionStatus; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.sym.mnu.bmm.service.BkmkMenuManage; +import egovframework.com.sym.mnu.bmm.service.BkmkMenuManageVO; +import egovframework.com.sym.mnu.bmm.service.EgovBkmkMenuManageservice; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +/** + * 바로가기메뉴관리 정보를 관리하기 위한 컨트롤러 클래스 + * @author 공통컴포넌트팀 윤성록 + * @since 2009.09.25 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.9.25  윤성록          최초 생성
    + *   2011.8.26	정진오			IncludedInfo annotation 추가
    + *
    + * 
    + */ + +@Controller +public class EgovBkmkMenuManageController { + + @Resource(name = "bkmkMenuManageservice") + private EgovBkmkMenuManageservice bkmkMenuManageService; + + @Resource(name = "propertiesService") + protected EgovPropertyService propertyService; + + @Autowired + private DefaultBeanValidator beanValidator; + + /** + * 바로가기메뉴관리 정보에 대한 목록을 조회한다. + * + * @param BkmkMenuManageVO + * @param status + * @param model + * @return + * @throws Exception + */ + @IncludedInfo(name="바로가기메뉴관리", order = 1110 ,gid = 60) + @RequestMapping("/sym/mnu/bmm/selectBkmkMenuManageList.do") + public String selectBkmkMenuManageList(@ModelAttribute("searchVO") BkmkMenuManageVO bkmkMenuManageVO, SessionStatus status, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if(!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + bkmkMenuManageVO.setPageUnit(propertyService.getInt("pageUnit")); + bkmkMenuManageVO.setPageSize(propertyService.getInt("pageSize")); + bkmkMenuManageVO.setUserId(user == null ? "" : EgovStringUtil.isNullToString(user.getId())); + + PaginationInfo paginationInfo = new PaginationInfo(); + + paginationInfo.setCurrentPageNo(bkmkMenuManageVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(bkmkMenuManageVO.getPageUnit()); + paginationInfo.setPageSize(bkmkMenuManageVO.getPageSize()); + + bkmkMenuManageVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + bkmkMenuManageVO.setLastIndex(paginationInfo.getLastRecordIndex()); + bkmkMenuManageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + bkmkMenuManageVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + bkmkMenuManageVO.setLastIndex(paginationInfo.getLastRecordIndex()); + bkmkMenuManageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + Map map = bkmkMenuManageService.selectBkmkMenuManageList(bkmkMenuManageVO); + + int totCnt = Integer.parseInt((String)map.get("resultCnt")); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList", map.get("resultList")); + model.addAttribute("resultCnt", map.get("resultCnt")); + model.addAttribute("uniqId", user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/sym/mnu/bmm/EgovBkmkMenuManageList"; + + } + + /** + * 바로가기메뉴관리 정보를 삭제한다. + * + * @param checkMenuIds + * @param bkmkMenuManageVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/sym/mnu/bmm/EgovBkmkMenuManageDelete.do") + public String deleteMenuManageList( + @RequestParam("checkMenuIds") String checkMenuIds , + @ModelAttribute("bkmkMenuManageVO") BkmkMenuManageVO bkmkMenuManageVO, + ModelMap model) + throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if(!isAuthenticated) { + // model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + String [] temp = checkMenuIds.split(","); + + for(int i =0; i < temp.length; i++){ + BkmkMenuManage bkmk = new BkmkMenuManage(); + bkmk.setMenuId(temp[i]); + bkmk.setUserId(user == null ? "" : EgovStringUtil.isNullToString(user.getId())); + bkmkMenuManageService.deleteBkmkMenuManage(bkmk); + } + + return "forward:/sym/mnu/bmm/selectBkmkMenuManageList.do"; + } + + /** + * 바로가기메뉴관리 등록화면으로 이동한다. + * + * @param BkmkMenuManage + * @param status + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/sym/mnu/bmm/addBkmkInf.do") + public String addBkmkMenuManage( @ModelAttribute("bkmkMenuManage") BkmkMenuManage bkmkMenuManage, SessionStatus status, ModelMap model) throws Exception { + + if(!bkmkMenuManage.getMenuId().equals("")){ + + bkmkMenuManage.setProgrmStrePath(bkmkMenuManageService.selectUrl(bkmkMenuManage)); + } + + return "egovframework/com/sym/mnu/bmm/EgovBkmkMenuManageRegist"; + } + + /** + * 메뉴정보 목록팝업 화면으로 이동한다. + * + * @param commandMap + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/sym/mnu/bmm/openPopup.do") + public String openPopupWindow(@RequestParam Map commandMap, ModelMap model) throws Exception { + + String requestUrl = (String)commandMap.get("requestUrl"); + requestUrl = requestUrl.replaceAll("&", "&"); + String width = (String)commandMap.get("width"); + String height = (String)commandMap.get("height"); + model.addAttribute("requestUrl", requestUrl + "?" + "&PopFlag=Y"); + model.addAttribute("width", width); + model.addAttribute("height", height); + + return "egovframework/com/sym/mnu/bmm/EgovModalPopupFrame"; + } + + /** + * 메뉴정보 목록을 조회한다. + * + * @param BkmkMenuManageVO + * @param commandMap + * @param model + * @return + * @throws Exception + */ + @SuppressWarnings("unused") + @RequestMapping("/sym/mnu/bmm/selectMenuList.do") + public String selectMenuList(@ModelAttribute("bkmkMenuManageVO") BkmkMenuManageVO bkmkMenuManageVO, @RequestParam Map commandMap, ModelMap model) throws Exception { + String popFlag = (String)commandMap.get("PopFlag"); + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + bkmkMenuManageVO.setPageUnit(propertyService.getInt("pageUnit")); + bkmkMenuManageVO.setPageSize(propertyService.getInt("pageSize")); + + PaginationInfo paginationInfo = new PaginationInfo(); + + paginationInfo.setCurrentPageNo(bkmkMenuManageVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(bkmkMenuManageVO.getPageUnit()); + paginationInfo.setPageSize(bkmkMenuManageVO.getPageSize()); + + + bkmkMenuManageVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + bkmkMenuManageVO.setLastIndex(paginationInfo.getLastRecordIndex()); + bkmkMenuManageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + bkmkMenuManageVO.setUserId(user == null ? "" : EgovStringUtil.isNullToString(user.getId())); + + Map map = bkmkMenuManageService.selectMenuList(bkmkMenuManageVO); + + int totCnt = Integer.parseInt((String)map.get("resultCnt")); + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList", map.get("resultList")); + model.addAttribute("resultCnt", map.get("resultCnt")); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/sym/mnu/bmm/EgovBkmkMenuPopup"; + } + + /** + * 바로가기메뉴관리 정보를 등록한다. + * + * @param BkmkMenuManage + * @param bindingResult + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/sym/mnu/bmm/registBkmkInf.do") + public String registBkmkInf(@ModelAttribute("bkmkMenuManage") BkmkMenuManage bkmkMenuManage, + BindingResult bindingResult, SessionStatus status, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if(!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + beanValidator.validate(bkmkMenuManage, bindingResult); + if (bindingResult.hasErrors()) { + return "egovframework/com/sym/mnu/bmm/EgovBkmkMenuManageRegist"; + } + + bkmkMenuManage.setUserId(user == null ? "" : EgovStringUtil.isNullToString(user.getId())); + if (isAuthenticated) { + bkmkMenuManageService.insertBkmkMenuManage(bkmkMenuManage); + } + + return "forward:/sym/mnu/bmm/selectBkmkMenuManageList.do"; + } + + /** + * 바로가기메뉴관리 미리보기 화면으로 이동한다. + * + * @param BkmkMenuManageVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping(value="/sym/mnu/bmm/previewBkmkInf.do") + public String previewBkmkInf(@ModelAttribute("searchVO") BkmkMenuManageVO bkmkMenuManageVO,ModelMap model) + throws Exception { + String resultMsg = ""; + // 0. Spring Security 사용자권한 처리 + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if(!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + bkmkMenuManageVO.setFirstIndex(0); + bkmkMenuManageVO.setLastIndex(10); + bkmkMenuManageVO.setRecordCountPerPage(10); + + bkmkMenuManageVO.setUserId(user == null ? "" : EgovStringUtil.isNullToString(user.getId())); + + Map map = bkmkMenuManageService.selectBkmkMenuManageList(bkmkMenuManageVO); + + model.addAttribute("list_menulist", map.get("resultList")); + model.addAttribute("resultMsg", resultMsg); + + return "egovframework/com/sym/mnu/bmm/EgovBookMarkMenuPopup"; + } +} diff --git a/src/main/java/egovframework/com/sym/mnu/mcm/service/EgovMenuCreateManageService.java b/src/main/java/egovframework/com/sym/mnu/mcm/service/EgovMenuCreateManageService.java new file mode 100644 index 0000000..c1d4de7 --- /dev/null +++ b/src/main/java/egovframework/com/sym/mnu/mcm/service/EgovMenuCreateManageService.java @@ -0,0 +1,100 @@ +package egovframework.com.sym.mnu.mcm.service; + +import java.util.List; + +import egovframework.com.cmm.ComDefaultVO; + + +/** + * 메뉴관리에 관한 서비스 인터페이스 클래스를 정의한다. + * @author 개발환경 개발팀 이용 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이  용          최초 생성
    + *
    + * 
    + */ +public interface EgovMenuCreateManageService { + + /** + * ID 존재여부를 조회 + * @param vo ComDefaultVO + * @return int + * @exception Exception + */ + int selectUsrByPk(ComDefaultVO vo) throws Exception; + + /** + * ID에 대한 권한코드를 조회 + * @param vo ComDefaultVO + * @return List + * @exception Exception + */ + MenuCreatVO selectAuthorByUsr(ComDefaultVO vo) throws Exception; + + + /** + * 메뉴생성관리 목록을 조회 + * @param vo ComDefaultVO + * @return List + * @exception Exception + */ + List selectMenuCreatManagList(ComDefaultVO vo) throws Exception; + + /** + * 메뉴생성관리 총건수를 조회한다. + * @param vo ComDefaultVO + * @return int + * @exception Exception + */ + int selectMenuCreatManagTotCnt(ComDefaultVO vo) throws Exception; + + /** + * 메뉴생성 내역을 조회 + * @param vo MenuCreatVO + * @return List + * @exception Exception + */ + List selectMenuCreatList(MenuCreatVO vo) throws Exception; + + + /** + * 화면에 조회된 메뉴정보로 메뉴생성내역 데이터베이스에서 입력 + * @param checkedScrtyForInsert String + * @param checkedMenuNoForInsert String + * @exception Exception + */ + void insertMenuCreatList(String checkedScrtyForInsert, String checkedMenuNoForInsert) throws Exception; + + /** + * 메뉴생성 사이트맵 내용 조회 + * @param vo MenuSiteMapVO + * @return List + * @exception Exception + */ + List selectMenuCreatSiteMapList(MenuSiteMapVO vo) throws Exception; + + /** + * 사용자 권한별 사이트맵 내용 조회 + * @param vo MenuSiteMapVO + * @return List + * @exception Exception + */ + List selectSiteMapByUser(MenuSiteMapVO vo) throws Exception; + + /** + * 사이트맵 등록 + * @param vo MenuSiteMapVO + * @param vHtmlValue String + * @return boolean + * @exception Exception + */ + boolean creatSiteMap(MenuSiteMapVO vo, String vHtmlValue) throws Exception; +} diff --git a/src/main/java/egovframework/com/sym/mnu/mcm/service/MenuCreat.java b/src/main/java/egovframework/com/sym/mnu/mcm/service/MenuCreat.java new file mode 100644 index 0000000..1b0016c --- /dev/null +++ b/src/main/java/egovframework/com/sym/mnu/mcm/service/MenuCreat.java @@ -0,0 +1,44 @@ +package egovframework.com.sym.mnu.mcm.service; + +/** + * 메뉴생성 생성을 위한 모델 클래스를 정의한다. + * @author 개발환경 개발팀 이용 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이  용          최초 생성
    + *
    + * 
    + */ +public class MenuCreat{ + /** 메뉴번호 */ + private int menuNo; + /** 맵생성ID */ + private String mapCreatId; + /** 권한코드 */ + private String authorCode; + public int getMenuNo() { + return menuNo; + } + public void setMenuNo(int menuNo) { + this.menuNo = menuNo; + } + public String getMapCreatId() { + return mapCreatId; + } + public void setMapCreatId(String mapCreatId) { + this.mapCreatId = mapCreatId; + } + public String getAuthorCode() { + return authorCode; + } + public void setAuthorCode(String authorCode) { + this.authorCode = authorCode; + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sym/mnu/mcm/service/MenuCreatVO.java b/src/main/java/egovframework/com/sym/mnu/mcm/service/MenuCreatVO.java new file mode 100644 index 0000000..39a39be --- /dev/null +++ b/src/main/java/egovframework/com/sym/mnu/mcm/service/MenuCreatVO.java @@ -0,0 +1,142 @@ +package egovframework.com.sym.mnu.mcm.service; + +/** + * 메뉴생성 처리를 위한 VO 클래스르를 정의한다 + * @author 개발환경 개발팀 이용 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이  용          최초 생성
    + *
    + * 
    + */ +public class MenuCreatVO{ + + + /** 메뉴번호 */ + private int menuNo; + /** 맵생성ID */ + private String mapCreatId; + /** 권한코드 */ + private String authorCode; + + /** 권한정보설정 */ + /** 권한명 */ + private String authorNm; + /** 권한설명 */ + private String authorDc; + /** 권한생성일자 */ + private String authorCreatDe; + + /** 기타VO변수 */ + /** 생성자ID **/ + private String creatPersonId; + + + /** + * menuNo attribute를 리턴한다. + * @return int + */ + public int getMenuNo() { + return menuNo; + } + /** + * menuNo attribute 값을 설정한다. + * @param menuNo int + */ + public void setMenuNo(int menuNo) { + this.menuNo = menuNo; + } + /** + * mapCreatId attribute를 리턴한다. + * @return String + */ + public String getMapCreatId() { + return mapCreatId; + } + /** + * mapCreatId attribute 값을 설정한다. + * @param mapCreatId String + */ + public void setMapCreatId(String mapCreatId) { + this.mapCreatId = mapCreatId; + } + /** + * authorCode attribute를 리턴한다. + * @return String + */ + public String getAuthorCode() { + return authorCode; + } + /** + * authorCode attribute 값을 설정한다. + * @param authorCode String + */ + public void setAuthorCode(String authorCode) { + this.authorCode = authorCode; + } + /** + * authorNm attribute를 리턴한다. + * @return String + */ + public String getAuthorNm() { + return authorNm; + } + /** + * authorNm attribute 값을 설정한다. + * @param authorNm String + */ + public void setAuthorNm(String authorNm) { + this.authorNm = authorNm; + } + /** + * authorDc attribute를 리턴한다. + * @return String + */ + public String getAuthorDc() { + return authorDc; + } + /** + * authorDc attribute 값을 설정한다. + * @param authorDc String + */ + public void setAuthorDc(String authorDc) { + this.authorDc = authorDc; + } + /** + * authorCreatDe attribute를 리턴한다. + * @return String + */ + public String getAuthorCreatDe() { + return authorCreatDe; + } + /** + * authorCreatDe attribute 값을 설정한다. + * @param authorCreatDe String + */ + public void setAuthorCreatDe(String authorCreatDe) { + this.authorCreatDe = authorCreatDe; + } + /** + * creatPersonId attribute를 리턴한다. + * @return String + */ + public String getCreatPersonId() { + return creatPersonId; + } + /** + * creatPersonId attribute 값을 설정한다. + * @param creatPersonId String + */ + public void setCreatPersonId(String creatPersonId) { + this.creatPersonId = creatPersonId; + } + + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sym/mnu/mcm/service/MenuSiteMap.java b/src/main/java/egovframework/com/sym/mnu/mcm/service/MenuSiteMap.java new file mode 100644 index 0000000..a7ee6a3 --- /dev/null +++ b/src/main/java/egovframework/com/sym/mnu/mcm/service/MenuSiteMap.java @@ -0,0 +1,53 @@ +package egovframework.com.sym.mnu.mcm.service; + +/** + * 사이트맵 생성을 위한 클래스를 정의한다 + * @author 개발환경 개발팀 이용 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이  용          최초 생성
    + *
    + * 
    + */ +public class MenuSiteMap{ + public String getCreatPersonId() { + return creatPersonId; + } + public void setCreatPersonId(String creatPersonId) { + this.creatPersonId = creatPersonId; + } + public String getMapCreatId() { + return mapCreatId; + } + public void setMapCreatId(String mapCreatId) { + this.mapCreatId = mapCreatId; + } + public String getBndeFileNm() { + return bndeFileNm; + } + public void setBndeFileNm(String bndeFileNm) { + this.bndeFileNm = bndeFileNm; + } + public String getBndeFilePath() { + return bndeFilePath; + } + public void setBndeFilePath(String bndeFilePath) { + this.bndeFilePath = bndeFilePath; + } + /** 사이트맵 */ + /** 생성자ID **/ + private String creatPersonId; + /** 맵생성ID */ + private String mapCreatId; + /** 맵파일명 */ + private String bndeFileNm; + /** 맵파일경로 */ + private String bndeFilePath; +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sym/mnu/mcm/service/MenuSiteMapVO.java b/src/main/java/egovframework/com/sym/mnu/mcm/service/MenuSiteMapVO.java new file mode 100644 index 0000000..ba8731b --- /dev/null +++ b/src/main/java/egovframework/com/sym/mnu/mcm/service/MenuSiteMapVO.java @@ -0,0 +1,321 @@ +package egovframework.com.sym.mnu.mcm.service; +/** + * 사이트맵/메인메뉴 처리를 위한 VO 클래스르를 정의한다 + * @author 개발환경 개발팀 이용 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이  용          최초 생성
    + *
    + * 
    + */ + +public class MenuSiteMapVO{ + + /** 메뉴번호 */ + private int menuNo; + + /* 사이트맵 */ + /** 생성자ID **/ + private String creatPersonId; + /** 맵생성ID */ + private String mapCreatId; + /** 맵파일명 */ + private String bndeFileNm; + /** 맵파일경로 */ + private String bndeFilePath; + + /* 권한정보설정 */ + /** 권한코드 */ + private String authorCode; + /** 권한명 */ + private String authorNm; + /** 권한설명 */ + private String authorDc; + /** 권한생성일자 */ + private String authorCreatDe; + + /* 기타VO변수 */ + /** rootPath Temp */ + private String tmpRootPath; + +/* Login 메뉴관련 VO변수 */ + /** tmp_Id */ + private String tmpId; + /** tmp_Password */ + private String tmpPassword; + /** tmp_Name */ + private String tmpName; + /** tmp_UserSe */ + private String tmpUserSe; + /** tmp_Email */ + private String tmpEmail; + /** tmp_OrgnztId */ + private String tmpOrgnztId; + /** tmp_UniqId */ + private String tmpUniqId; + /** tmp_Cmd */ + private String tmpCmd; + + /** + * menuNo attribute를 리턴한다. + * @return int + */ + public int getMenuNo() { + return menuNo; + } + /** + * menuNo attribute 값을 설정한다. + * @param menuNo int + */ + public void setMenuNo(int menuNo) { + this.menuNo = menuNo; + } + /** + * creatPersonId attribute를 리턴한다. + * @return String + */ + public String getCreatPersonId() { + return creatPersonId; + } + /** + * creatPersonId attribute 값을 설정한다. + * @param creatPersonId String + */ + public void setCreatPersonId(String creatPersonId) { + this.creatPersonId = creatPersonId; + } + /** + * mapCreatId attribute를 리턴한다. + * @return String + */ + public String getMapCreatId() { + return mapCreatId; + } + /** + * mapCreatId attribute 값을 설정한다. + * @param mapCreatId String + */ + public void setMapCreatId(String mapCreatId) { + this.mapCreatId = mapCreatId; + } + /** + * bndeFileNm attribute를 리턴한다. + * @return String + */ + public String getBndeFileNm() { + return bndeFileNm; + } + /** + * bndeFileNm attribute 값을 설정한다. + * @param bndeFileNm String + */ + public void setBndeFileNm(String bndeFileNm) { + this.bndeFileNm = bndeFileNm; + } + /** + * bndeFilePath attribute를 리턴한다. + * @return String + */ + public String getBndeFilePath() { + return bndeFilePath; + } + /** + * bndeFilePath attribute 값을 설정한다. + * @param bndeFilePath String + */ + public void setBndeFilePath(String bndeFilePath) { + this.bndeFilePath = bndeFilePath; + } + /** + * authorCode attribute를 리턴한다. + * @return String + */ + public String getAuthorCode() { + return authorCode; + } + /** + * authorCode attribute 값을 설정한다. + * @param authorCode String + */ + public void setAuthorCode(String authorCode) { + this.authorCode = authorCode; + } + /** + * authorNm attribute를 리턴한다. + * @return String + */ + public String getAuthorNm() { + return authorNm; + } + /** + * authorNm attribute 값을 설정한다. + * @param authorNm String + */ + public void setAuthorNm(String authorNm) { + this.authorNm = authorNm; + } + /** + * authorDc attribute를 리턴한다. + * @return String + */ + public String getAuthorDc() { + return authorDc; + } + /** + * authorDc attribute 값을 설정한다. + * @param authorDc String + */ + public void setAuthorDc(String authorDc) { + this.authorDc = authorDc; + } + /** + * authorCreatDe attribute를 리턴한다. + * @return String + */ + public String getAuthorCreatDe() { + return authorCreatDe; + } + /** + * authorCreatDe attribute 값을 설정한다. + * @param authorCreatDe String + */ + public void setAuthorCreatDe(String authorCreatDe) { + this.authorCreatDe = authorCreatDe; + } + + /** + * tmp_Id attribute를 리턴한다. + * @return String + */ + public String getTmpId() { + return tmpId; + } + /** + * tmp_Id attribute 값을 설정한다. + * @param tmp_Id String + */ + public void setTmpId(String tmp_Id) { + this.tmpId = tmp_Id; + } + /** + * tmp_Password attribute를 리턴한다. + * @return String + */ + public String getTmpPassword() { + return tmpPassword; + } + /** + * tmp_Password attribute 값을 설정한다. + * @param tmp_Password String + */ + public void setTmpPassword(String tmp_Password) { + this.tmpPassword = tmp_Password; + } + /** + * tmp_Name attribute를 리턴한다. + * @return String + */ + public String getTmpName() { + return tmpName; + } + /** + * tmp_Name attribute 값을 설정한다. + * @param tmp_Name String + */ + public void setTmpName(String tmp_Name) { + this.tmpName = tmp_Name; + } + /** + * tmp_UserSe attribute를 리턴한다. + * @return String + */ + public String getTmpUserSe() { + return tmpUserSe; + } + /** + * tmp_UserSe attribute 값을 설정한다. + * @param tmp_UserSe String + */ + public void setTmpUserSe(String tmp_UserSe) { + this.tmpUserSe = tmp_UserSe; + } + /** + * tmp_Email attribute를 리턴한다. + * @return String + */ + public String getTmpEmail() { + return tmpEmail; + } + /** + * tmp_Email attribute 값을 설정한다. + * @param tmp_Email String + */ + public void setTmpEmail(String tmp_Email) { + this.tmpEmail = tmp_Email; + } + /** + * tmp_OrgnztId attribute를 리턴한다. + * @return String + */ + public String getTmpOrgnztId() { + return tmpOrgnztId; + } + /** + * tmp_OrgnztId attribute 값을 설정한다. + * @param tmp_OrgnztId String + */ + public void setTmpOrgnztId(String tmp_OrgnztId) { + this.tmpOrgnztId = tmp_OrgnztId; + } + /** + * tmp_UniqId attribute를 리턴한다. + * @return String + */ + public String getTmpUniqId() { + return tmpUniqId; + } + /** + * tmp_UniqId attribute 값을 설정한다. + * @param tmp_UniqId String + */ + public void setTmpUniqId(String tmp_UniqId) { + this.tmpUniqId = tmp_UniqId; + } + /** + * tmp_Cmd attribute를 리턴한다. + * @return String + */ + public String getTmpCmd() { + return tmpCmd; + } + /** + * tmp_Cmd attribute 값을 설정한다. + * @param tmp_Cmd String + */ + public void setTmpCmd(String tmp_Cmd) { + this.tmpCmd = tmp_Cmd; + } + + /** + * tmp_rootPath attribute를 리턴한다. + * @return String + */ + public String getTmpRootPath() { + return tmpRootPath; + } + /** + * tmp_rootPath attribute 값을 설정한다. + * @param tmp_rootPath String + */ + public void setTmpRootPath(String tmp_rootPath) { + this.tmpRootPath = tmp_rootPath; + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sym/mnu/mcm/service/impl/EgovMenuCreateManageServiceImpl.java b/src/main/java/egovframework/com/sym/mnu/mcm/service/impl/EgovMenuCreateManageServiceImpl.java new file mode 100644 index 0000000..5d3caa0 --- /dev/null +++ b/src/main/java/egovframework/com/sym/mnu/mcm/service/impl/EgovMenuCreateManageServiceImpl.java @@ -0,0 +1,216 @@ +package egovframework.com.sym.mnu.mcm.service.impl; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.util.List; + +import egovframework.com.cmm.ComDefaultVO; +import egovframework.com.cmm.EgovWebUtil; +import egovframework.com.cmm.util.EgovResourceCloseHelper; +import egovframework.com.sym.mnu.mcm.service.EgovMenuCreateManageService; +import egovframework.com.sym.mnu.mcm.service.MenuCreatVO; +import egovframework.com.sym.mnu.mcm.service.MenuSiteMapVO; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import javax.annotation.Resource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +/** + * 메뉴목록, 사이트맵 생성을 처리하는 비즈니스 구현 클래스를 정의한다. + * @author 개발환경 개발팀 이용 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이  용          최초 생성
    + *   2011.07.01  서준식          EgovMenuManageServiceImpl에서 메뉴 생성 관련 부분 분리
    + *   2011.10.07  이기하          finally문을 추가하여 에러시 자원반환할 수 있도록 추가
    + *   2011.10.12  이기하			 사이트맵 생성시 특수문자 치환
    + *
    + *
    + * 
    + */ +@Service("meunCreateManageService") +public class EgovMenuCreateManageServiceImpl extends EgovAbstractServiceImpl implements EgovMenuCreateManageService { + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovMenuCreateManageServiceImpl.class); + + @Resource(name = "menuCreateManageDAO") + private MenuCreateManageDAO menuCreateManageDAO; + + /** + * ID 존재여부를 조회 + * @param vo ComDefaultVO + * @return int + * @exception Exception + */ + public int selectUsrByPk(ComDefaultVO vo) throws Exception { + return menuCreateManageDAO.selectUsrByPk(vo); + } + + /** + * 메뉴생성 내역을 조회 + * @param vo MenuCreatVO + * @return List + * @exception Exception + */ + public List selectMenuCreatList(MenuCreatVO vo) throws Exception { + return menuCreateManageDAO.selectMenuCreatList(vo); + } + + /** + * 화면에 조회된 메뉴정보로 메뉴생성내역 데이터베이스에서 입력 + * @param checkedAuthorForInsert String + * @param checkedMenuNoForInsert String + * @exception Exception + */ + public void insertMenuCreatList(String checkedAuthorForInsert, String checkedMenuNoForInsert) throws Exception { + MenuCreatVO menuCreatVO = null; + int AuthorCnt = 0; + String[] insertMenuNo = checkedMenuNoForInsert.split(","); + + String insertAuthor = checkedAuthorForInsert; + menuCreatVO = new MenuCreatVO(); + menuCreatVO.setAuthorCode(insertAuthor); + AuthorCnt = menuCreateManageDAO.selectMenuCreatCnt(menuCreatVO); + + // 이전에 존재하는 권한코드에 대한 메뉴설정내역 삭제 + if (AuthorCnt > 0) { + menuCreateManageDAO.deleteMenuCreat(menuCreatVO); + } + for (int i = 0; i < insertMenuNo.length; i++) { + menuCreatVO.setAuthorCode(insertAuthor); + menuCreatVO.setMenuNo(Integer.parseInt(insertMenuNo[i])); + menuCreateManageDAO.insertMenuCreat(menuCreatVO); + } + } + + /** + * 메뉴생성관리 목록을 조회 + * @param vo ComDefaultVO + * @return List + * @exception Exception + */ + public List selectMenuCreatManagList(ComDefaultVO vo) throws Exception { + return menuCreateManageDAO.selectMenuCreatManagList(vo); + } + + /** + * ID에 대한 권한코드를 조회 + * @param vo ComDefaultVO + * @return MenuCreatVO + * @exception Exception + */ + public MenuCreatVO selectAuthorByUsr(ComDefaultVO vo) throws Exception { + return menuCreateManageDAO.selectAuthorByUsr(vo); + } + + /** + * 메뉴생성관리 총건수를 조회한다. + * @param vo ComDefaultVO + * @return int + * @exception Exception + */ + public int selectMenuCreatManagTotCnt(ComDefaultVO vo) throws Exception { + return menuCreateManageDAO.selectMenuCreatManagTotCnt(vo); + } + + /** + * 메뉴생성 사이트맵 내용 조회 + * @param vo MenuSiteMapVO + * @return List + * @exception Exception + */ + public List selectMenuCreatSiteMapList(MenuSiteMapVO vo) throws Exception { + return menuCreateManageDAO.selectMenuCreatSiteMapList(vo); + } + + /** + * 사용자 권한별 사이트맵 내용 조회 + * @param vo MenuSiteMapVO + * @return List + * @exception Exception + */ + public List selectSiteMapByUser(MenuSiteMapVO vo) throws Exception { + return menuCreateManageDAO.selectSiteMapByUser(vo); + } + + /** + * 사이트맵 등록 + * @param menuSiteMapvo MenuSiteMapVO + * @param vHtmlValue String + * @return boolean + * @exception Exception + */ + public boolean creatSiteMap(MenuSiteMapVO menuSiteMapvo, String vHtmlValue) throws Exception { + boolean chkCreat = false; + String vSiteMapName = null; + int SiteMapCnt = 0; + //String newMapCreatId = null; + MenuCreatVO menuCreatVO = new MenuCreatVO(); + + menuCreatVO.setMenuNo(menuSiteMapvo.getMenuNo()); + menuCreatVO.setAuthorCode(menuSiteMapvo.getAuthorCode()); + //vSiteMapName = menuSiteMapvo.getTmp_rootPath()+"/"+menuSiteMapvo.getBndeFileNm(); + vSiteMapName = menuSiteMapvo.getTmpRootPath() + menuSiteMapvo.getBndeFilePath() + menuSiteMapvo.getBndeFileNm(); + chkCreat = siteMapCreat(vSiteMapName, vHtmlValue); + if (chkCreat) { + SiteMapCnt = menuCreateManageDAO.selectSiteMapCnt(menuSiteMapvo); + if (SiteMapCnt > 0) { + menuCreatVO.setMapCreatId(menuSiteMapvo.getMapCreatId() + Integer.toString(SiteMapCnt)); + menuSiteMapvo.setMapCreatId(menuSiteMapvo.getMapCreatId() + Integer.toString(SiteMapCnt)); + } else { + menuCreatVO.setMapCreatId(menuSiteMapvo.getMapCreatId()); + } + menuCreateManageDAO.creatSiteMap(menuSiteMapvo); + menuCreateManageDAO.updateMenuCreat(menuCreatVO); + + } + return chkCreat; + } + + /** + * 메뉴생성 사이트맵 Html 파일 생성 + * @param vSiteMapName String + * @param vHtmlValue String + * @return boolean + * @exception Exception + */ + private boolean siteMapCreat(String vSiteMapName, String vHtmlValue) throws Exception { + boolean success = false; + String FileName = null; + char FILE_SEPARATOR = File.separatorChar; + BufferedWriter out = null; + try { + FileName = vSiteMapName.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File file = new File(EgovWebUtil.filePathBlackList(FileName)); + out = new BufferedWriter(new FileWriter(file)); + + // 사이트맵 생성시 특수문자 치환 + vHtmlValue = vHtmlValue.replaceAll("<", "<"); + vHtmlValue = vHtmlValue.replaceAll(">", ">"); + vHtmlValue = vHtmlValue.replaceAll(""", "\""); + vHtmlValue = vHtmlValue.replaceAll("'", "'"); + + out.write(vHtmlValue); + success = true; + } catch (IOException e) { + LOGGER.error("IOException", e); + } finally { + EgovResourceCloseHelper.close(out); + } + + return success; + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sym/mnu/mcm/service/impl/MenuCreateManageDAO.java b/src/main/java/egovframework/com/sym/mnu/mcm/service/impl/MenuCreateManageDAO.java new file mode 100644 index 0000000..0692a90 --- /dev/null +++ b/src/main/java/egovframework/com/sym/mnu/mcm/service/impl/MenuCreateManageDAO.java @@ -0,0 +1,166 @@ +package egovframework.com.sym.mnu.mcm.service.impl; + +import java.util.List; + +import egovframework.com.cmm.ComDefaultVO; +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.sym.mnu.mcm.service.MenuCreatVO; +import egovframework.com.sym.mnu.mcm.service.MenuSiteMapVO; + +import org.springframework.stereotype.Repository; + +/** + * 메뉴생성, 사이트맵 생성에 대한 DAO 클래스를 정의한다. * + * @author 공통컴포넌트 개발팀 서준식 + * @since 2011.06.30 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2011.06.30  서 준 식   최초 생성(MenuManageDAO 클래스로 부터 분리
    + *   					   메소드들을 MenuManageDAO 클래스에서 분리해옮)
    + *
    + * 
    + */ + +@Repository("menuCreateManageDAO") +public class MenuCreateManageDAO extends EgovComAbstractDAO{ + + + + /** + * ID 존재여부를 조회 + * @param vo MenuManageVO + * @return int + * @exception Exception + */ + public int selectUsrByPk(ComDefaultVO vo) throws Exception{ + return (Integer)selectOne("menuManageDAO.selectUsrByPk", vo); + } + + /** + * ID에 대한 권한코드를 조회 + * @param vo MenuCreatVO + * @return int + * @exception Exception + */ + public MenuCreatVO selectAuthorByUsr(ComDefaultVO vo) throws Exception{ + return (MenuCreatVO)selectOne("menuManageDAO.selectAuthorByUsr", vo); + } + + /** + * 메뉴생성관리 내역을 조회 + * @param vo ComDefaultVO + * @return List + * @exception Exception + */ + public List selectMenuCreatManagList(ComDefaultVO vo) throws Exception{ + return selectList("menuManageDAO.selectMenuCreatManageList_D", vo); + } + + /** + * 메뉴생성관리 총건수를 조회한다. + * @param vo ComDefaultVO + * @return int + * @exception Exception + */ + public int selectMenuCreatManagTotCnt(ComDefaultVO vo) { + return (Integer)selectOne("menuManageDAO.selectMenuCreatManageTotCnt_S", vo); + } + + /*********** 메뉴 생성 관리 ***************/ + /** + * 메뉴생성 내역을 조회 + * @param vo MenuCreatVO + * @return List + * @exception Exception + */ + public List selectMenuCreatList(MenuCreatVO vo) throws Exception{ + return selectList("menuManageDAO.selectMenuCreatList_D", vo); + } + + /** + * 메뉴생성내역 등록 + * @param vo MenuCreatVO + * @exception Exception + */ + public void insertMenuCreat(MenuCreatVO vo){ + insert("menuManageDAO.insertMenuCreat_S", vo); + } + + /** + * 메뉴생성 사이트맵 내용 조회 + * @param vo MenuSiteMapVO + * @return List + * @exception Exception + */ + public List selectMenuCreatSiteMapList(MenuSiteMapVO vo) throws Exception{ + return selectList("menuManageDAO.selectMenuCreatSiteMapList_D", vo); + } + + + + /** + * 사이트맵 등록 + * @param vo MenuSiteMapVO + * @exception Exception + */ + public void creatSiteMap(MenuSiteMapVO vo){ + insert("menuManageDAO.insertSiteMap_S", vo); + } + + /** + * 사용자 권한별 사이트맵 내용 조회 + * @param vo MenuSiteMapVO + * @return List + * @exception Exception + */ + public List selectSiteMapByUser(MenuSiteMapVO vo) throws Exception{ + return selectList("menuManageDAO.selectSiteMapByUser", vo); + } + + /** + * 메뉴생성내역 존재여부 조회한다. + * @param vo MenuCreatVO + * @return int + * @exception Exception + */ + public int selectMenuCreatCnt(MenuCreatVO vo) { + return (Integer)selectOne("menuManageDAO.selectMenuCreatCnt_S", vo); + } + + + /** + * 메뉴생성내역 수정 + * @param vo MenuCreatVO + * @exception Exception + */ + public void updateMenuCreat(MenuCreatVO vo){ + update("menuManageDAO.updateMenuCreat_S", vo); + } + + + /** + * 메뉴생성내역 삭제 + * @param vo MenuCreatVO + * @exception Exception + */ + public void deleteMenuCreat(MenuCreatVO vo){ + delete("menuManageDAO.deleteMenuCreat_S", vo); + } + + /** + * 사이트맵 존재여부 조회한다. + * @param vo MenuSiteMapVO + * @return int + * @exception Exception + */ + public int selectSiteMapCnt(MenuSiteMapVO vo) { + return (Integer)selectOne("menuManageDAO.selectSiteMapCnt_S", vo); + } + +} diff --git a/src/main/java/egovframework/com/sym/mnu/mcm/web/EgovMenuCreateManageController.java b/src/main/java/egovframework/com/sym/mnu/mcm/web/EgovMenuCreateManageController.java new file mode 100644 index 0000000..5de8177 --- /dev/null +++ b/src/main/java/egovframework/com/sym/mnu/mcm/web/EgovMenuCreateManageController.java @@ -0,0 +1,294 @@ +package egovframework.com.sym.mnu.mcm.web; + +import java.util.List; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; + +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 egovframework.com.cmm.ComDefaultVO; +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.sym.mnu.mcm.service.EgovMenuCreateManageService; +import egovframework.com.sym.mnu.mcm.service.MenuCreatVO; +import egovframework.com.sym.mnu.mcm.service.MenuSiteMapVO; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +/** + * 메뉴목록 관리및 메뉴생성, 사이트맵 생성을 처리하는 비즈니스 구현 클래스 + * + * @author 개발환경 개발팀 이용 + * @since 2009.06.01 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *
    + *     수정일               수정자             수정내용
    + *  ------------   --------    ---------------------------
    + *   2009.03.20		이  용             최초 생성
    + * 	 2011.07.29		서준식             사이트맵 저장경로 수정
    + *	 2011.08.26		정진오             IncludedInfo annotation 추가
    + *	 2013.06.17		이기하             사이트맵 생성시 경로 오류 수정
    + *   2018.08.09		신용호             X-XSS 관련 크롬에서 오탐되는 부분 수정
    + *   2018.09.10		신용호             selectMenuCreatManagList 불필요한 로직 제거
    + * 
    + */ + +@Controller +public class EgovMenuCreateManageController { + + /* Validator */ + @Autowired + private DefaultBeanValidator beanValidator; + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** EgovMenuManageService */ + @Resource(name = "meunCreateManageService") + private EgovMenuCreateManageService menuCreateManageService; + + /** EgovMessageSource */ + @Resource(name = "egovMessageSource") + EgovMessageSource egovMessageSource; + + /*********** 메뉴 생성 관리 ***************/ + + /** + * *메뉴생성목록을 조회한다. + * + * @param searchVO + * ComDefaultVO + * @return 출력페이지정보 "sym/mnu/mcm/EgovMenuCreatManage" + * @exception Exception + */ + @IncludedInfo(name = "메뉴생성관리", order = 1100, gid = 60) + @RequestMapping(value = "/sym/mnu/mcm/EgovMenuCreatManageSelect.do") + public String selectMenuCreatManagList(@ModelAttribute("searchVO") ComDefaultVO searchVO, ModelMap model) throws Exception { + String resultMsg = ""; + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + // 내역 조회 + /** 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()); + /* + if (searchVO.getSearchKeyword() != null && !searchVO.getSearchKeyword().equals("")) { + + int IDcnt = menuCreateManageService.selectUsrByPk(searchVO); + if (IDcnt == 0) { + resultMsg = egovMessageSource.getMessage("info.nodata.msg"); + } else { + // AuthorCode 검색 + MenuCreatVO vo = new MenuCreatVO(); + vo = menuCreateManageService.selectAuthorByUsr(searchVO); + searchVO.setSearchKeyword(vo.getAuthorCode()); + } + } + */ + List list_menumanage = menuCreateManageService.selectMenuCreatManagList(searchVO); + if ( list_menumanage.size() == 0 ) + resultMsg = egovMessageSource.getMessage("info.nodata.msg"); + model.addAttribute("list_menumanage", list_menumanage); + + int totCnt = menuCreateManageService.selectMenuCreatManagTotCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + model.addAttribute("resultMsg", resultMsg); + return "egovframework/com/sym/mnu/mcm/EgovMenuCreatManage"; + } + + /* 메뉴생성 세부조회 */ + /** + * 메뉴생성 세부화면을 조회한다. + * + * @param menuCreatVO + * MenuCreatVO + * @return 출력페이지정보 "sym/mnu/mcm/EgovMenuCreat" + * @exception Exception + */ + @RequestMapping(value = "/sym/mnu/mcm/EgovMenuCreatSelect.do") + public String selectMenuCreatList(@ModelAttribute("menuCreatVO") MenuCreatVO menuCreatVO, ModelMap model) throws Exception { + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + List list_menulist = menuCreateManageService.selectMenuCreatList(menuCreatVO); + model.addAttribute("list_menulist", list_menulist); + model.addAttribute("resultVO", menuCreatVO); + + return "egovframework/com/sym/mnu/mcm/EgovMenuCreat"; + } + + /** + * 메뉴생성처리 및 메뉴생성내역을 등록한다. + * + * @param checkedAuthorForInsert + * String + * @param checkedMenuNoForInsert + * String + * @return 출력페이지정보 등록처리시 "forward:/sym/mnu/mcm/EgovMenuCreatSelect.do" + * @exception Exception + */ + @RequestMapping("/sym/mnu/mcm/EgovMenuCreatInsert.do") + public String insertMenuCreatList(@RequestParam("checkedAuthorForInsert") String checkedAuthorForInsert, @RequestParam("checkedMenuNoForInsert") String checkedMenuNoForInsert, + @ModelAttribute("menuCreatVO") MenuCreatVO menuCreatVO, ModelMap model) throws Exception { + String resultMsg = ""; + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + String[] insertMenuNo = checkedMenuNoForInsert.split(","); + if (insertMenuNo == null || (insertMenuNo.length == 0)) { + resultMsg = egovMessageSource.getMessage("fail.common.insert"); + } else { + menuCreateManageService.insertMenuCreatList(checkedAuthorForInsert, checkedMenuNoForInsert); + resultMsg = egovMessageSource.getMessage("success.common.insert"); + } + model.addAttribute("resultMsg", resultMsg); + return "forward:/sym/mnu/mcm/EgovMenuCreatSelect.do"; + } + + /* 메뉴사이트맵 생성조회 */ + /** + * 메뉴사이트맵을 생성할 내용을 조회한다. + * + * @param menuSiteMapVO + * MenuSiteMapVO + * @return 출력페이지정보 등록처리시 "sym/mnu/mcm/EgovMenuCreatSiteMap" + * @exception Exception + */ + @RequestMapping(value = "/sym/mnu/mcm/EgovMenuCreatSiteMapSelect.do") + public String selectMenuCreatSiteMap(@ModelAttribute("menuSiteMapVO") MenuSiteMapVO menuSiteMapVO, ModelMap model) throws Exception { + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + List list_menulist = menuCreateManageService.selectMenuCreatSiteMapList(menuSiteMapVO); + model.addAttribute("list_menulist", list_menulist); + LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser(); + menuSiteMapVO.setCreatPersonId(user == null ? "" : EgovStringUtil.isNullToString(user.getId())); + model.addAttribute("resultVO", menuSiteMapVO); + return "egovframework/com/sym/mnu/mcm/EgovMenuCreatSiteMap"; + } + + /** + * 메뉴사이트맵 생성처리 및 사이트맵을 등록한다. + * + * @param menuSiteMapVO + * MenuSiteMapVO + * @param valueHtml + * String + * @return 출력페이지정보 "sym/mnu/mcm/EgovMenuCreatSiteMap" + * @exception Exception + */ + @RequestMapping(value = "/sym/mnu/mcm/EgovMenuCreatSiteMapInsert.do") + public String selectMenuCreatSiteMapInsert(@ModelAttribute("menuSiteMapVO") MenuSiteMapVO menuSiteMapVO, @RequestParam("valueHtml") String valueHtml, ModelMap model + ,HttpServletResponse response) + throws Exception { + boolean chkCreat = false; + String resultMsg = ""; + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + /*menuSiteMapVO.setTmpRootPath(EgovProperties.RELATIVE_PATH_PREFIX + + ".." + System.getProperty("file.separator") + ".." + + System.getProperty("file.separator") + "..");*/ + + /* 사이트맵 파일 생성 위치 지정 */ + //String currentPath = EgovMenuCreateManageController.class.getResource("").getPath(); + String currentPath = EgovMenuCreateManageController.class.getProtectionDomain().getCodeSource() == null ? "" : EgovStringUtil.isNullToString(EgovMenuCreateManageController.class.getProtectionDomain().getCodeSource().getLocation().getPath()); + //System.out.println("===>>> currentPath = "+currentPath); + String path = currentPath.substring(0, currentPath.lastIndexOf("WEB-INF")); + menuSiteMapVO.setTmpRootPath(path); + menuSiteMapVO.setBndeFilePath("/html/egovframework/com/sym/mnu/mcm/"); + //System.out.println("===>>> path = "+path); + //System.out.println("===>>> menuSiteMapVO.getMapCreatId() = "+menuSiteMapVO.getMapCreatId()); + + /* + * 사이트맵 파일 생성 위치 지정 if ("WINDOWS".equals(Globals.OS_TYPE)) { + * menuSiteMapVO + * .setTmp_rootPath("D:/egovframework/workspace/egovcmm/src/main/webapp" + * ); }else{menuSiteMapVO.setTmp_rootPath( + * "/product/jeus/webhome/was_com/egovframework-com-1_0/egovframework-com-1_0_war___" + * ); } + */ + chkCreat = menuCreateManageService.creatSiteMap(menuSiteMapVO, valueHtml); + if (!chkCreat) { + resultMsg = egovMessageSource.getMessage("fail.common.insert"); + } else { + resultMsg = egovMessageSource.getMessage("success.common.insert"); + } + List list_menulist = menuCreateManageService.selectMenuCreatSiteMapList(menuSiteMapVO); + + model.addAttribute("list_menulist", list_menulist); + model.addAttribute("resultVO", menuSiteMapVO); + model.addAttribute("resultMsg", resultMsg); + + return "egovframework/com/sym/mnu/mcm/EgovMenuCreatSiteMap"; + } + + /* 메뉴사이트맵 생성조회 */ + /** + * 메뉴사이트맵을 생성할 내용을 조회한다. + * + * @param menuSiteMapVO + * MenuSiteMapVO + * @return 출력페이지정보 등록처리시 "sym/mnu/mcm/EgovMenuCreatSiteMap" + * @exception Exception + */ + @RequestMapping(value = "/sym/mnu/mcm/EgovSiteMap.do") + public String selectSiteMap(@ModelAttribute("menuCreatVO") MenuSiteMapVO menuSiteMapVO, ModelMap model) throws Exception { + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser(); + menuSiteMapVO.setCreatPersonId(user == null ? "" : EgovStringUtil.isNullToString(user.getId())); + + List list_menulist = menuCreateManageService.selectSiteMapByUser(menuSiteMapVO); + model.addAttribute("list_menulist", list_menulist); + + model.addAttribute("resultVO", menuSiteMapVO); + return "egovframework/com/sym/mnu/mcm/EgovSiteMap"; + } + +} diff --git a/src/main/java/egovframework/com/sym/mnu/mpm/service/EgovMenuManageService.java b/src/main/java/egovframework/com/sym/mnu/mpm/service/EgovMenuManageService.java new file mode 100644 index 0000000..f4aa9fe --- /dev/null +++ b/src/main/java/egovframework/com/sym/mnu/mpm/service/EgovMenuManageService.java @@ -0,0 +1,142 @@ +package egovframework.com.sym.mnu.mpm.service; + +import java.io.InputStream; +import java.util.List; + +import egovframework.com.cmm.ComDefaultVO; + +/** + * 메뉴관리에 관한 서비스 인터페이스 클래스를 정의한다. + * @author 개발환경 개발팀 이용 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이  용          최초 생성
    + *   2011.07.01  서준식			자기 메뉴 정보를 상위메뉴 정보로 참조하는 메뉴정보가 있는지 조회하는
    + *   							selectUpperMenuNoByPk() 메서드 추가
    + *
    + * 
    + */ + +public interface EgovMenuManageService { + + /** + * 메뉴 상세정보를 조회 + * @param vo ComDefaultVO + * @return MenuManageVO + * @exception Exception + */ + MenuManageVO selectMenuManage(ComDefaultVO vo) throws Exception; + + /** + * 메뉴 목록을 조회 + * @param vo ComDefaultVO + * @return List + * @exception Exception + */ + List selectMenuManageList(ComDefaultVO vo) throws Exception; + + /** + * 메뉴목록 총건수를 조회한다. + * @param vo ComDefaultVO + * @return int + * @exception Exception + */ + int selectMenuManageListTotCnt(ComDefaultVO vo) throws Exception; + + /** + * 메뉴번호 존재 여부를 조회한다. + * @param vo ComDefaultVO + * @return int + * @exception Exception + */ + int selectMenuNoByPk(MenuManageVO vo) throws Exception; + + int selectUpperMenuNoByPk(MenuManageVO vo) throws Exception; + + /** + * 메뉴 정보를 등록 + * @param vo MenuManageVO + * @exception Exception + */ + void insertMenuManage(MenuManageVO vo) throws Exception; + + /** + * 메뉴 정보를 수정 + * @param vo MenuManageVO + * @exception Exception + */ + void updateMenuManage(MenuManageVO vo) throws Exception; + + /** + * 메뉴 정보를 삭제 + * @param vo MenuManageVO + * @exception Exception + */ + void deleteMenuManage(MenuManageVO vo) throws Exception; + + /** + * 화면에 조회된 메뉴 목록 정보를 데이터베이스에서 삭제 + * @param checkedMenuNoForDel String + * @exception Exception + */ + void deleteMenuManageList(String checkedMenuNoForDel) throws Exception; + + /* 메뉴 생성 관리 */ + + /** + * 메뉴 목록을 조회 + * @return List + * @exception Exception + */ + List selectMenuList() throws Exception; + + /*### 메뉴관련 프로세스 ###*/ + /** + * MainMenu Head Menu 조회 + * @param vo MenuManageVO + * @return List + * @exception Exception + */ + List selectMainMenuHead(MenuManageVO vo) throws Exception; + + /** + * MainMenu Head Left 조회 + * @param vo MenuManageVO + * @return List + * @exception Exception + */ + List selectMainMenuLeft(MenuManageVO vo) throws Exception; + + /** + * MainMenu Head MenuURL 조회 + * @param iMenuNo int + * @param sUniqId String + * @return String + * @exception Exception + */ + String selectLastMenuURL(int iMenuNo, String sUniqId) throws Exception; + + /* 일괄처리 프로세스 */ + + /** + * 메뉴일괄초기화 프로세스 메뉴목록테이블, 프로그램 목록테이블 전체 삭제 + * @return boolean + */ + boolean menuBndeAllDelete() throws Exception; + + /** + * 메뉴일괄등록 프로세스 + * @param vo MenuManageVO + * @param inputStream InputStream + * @exception Exception + */ + String menuBndeRegist(MenuManageVO vo, InputStream inputStream) throws Exception; + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sym/mnu/mpm/service/MenuManage.java b/src/main/java/egovframework/com/sym/mnu/mpm/service/MenuManage.java new file mode 100644 index 0000000..5c2490f --- /dev/null +++ b/src/main/java/egovframework/com/sym/mnu/mpm/service/MenuManage.java @@ -0,0 +1,102 @@ +package egovframework.com.sym.mnu.mpm.service; + +/** + * 메뉴관리, 메뉴 생성을 위한 모델 클래스를 정의한다. + * @author 공통서비스 개발팀 이 용 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이용          최초 생성
    + *
    + * 
    + */ + +public class MenuManage { + + /** + * 메뉴설명 + */ + private String menuDc; + public String getMenuDc() { + return menuDc; + } + public void setMenuDc(String menuDc) { + this.menuDc = menuDc; + } + public String getMenuNm() { + return menuNm; + } + public void setMenuNm(String menuNm) { + this.menuNm = menuNm; + } + public int getMenuNo() { + return menuNo; + } + public void setMenuNo(int menuNo) { + this.menuNo = menuNo; + } + public int getMenuOrdr() { + return menuOrdr; + } + public void setMenuOrdr(int menuOrdr) { + this.menuOrdr = menuOrdr; + } + public String getProgrmFileNm() { + return progrmFileNm; + } + public void setProgrmFileNm(String progrmFileNm) { + this.progrmFileNm = progrmFileNm; + } + public String getRelateImageNm() { + return relateImageNm; + } + public void setRelateImageNm(String relateImageNm) { + this.relateImageNm = relateImageNm; + } + public String getRelateImagePath() { + return relateImagePath; + } + public void setRelateImagePath(String relateImagePath) { + this.relateImagePath = relateImagePath; + } + public int getUpperMenuId() { + return upperMenuId; + } + public void setUpperMenuId(int upperMenuId) { + this.upperMenuId = upperMenuId; + } + /** + * 메뉴명 + */ + private String menuNm; + /** + * 메뉴번호 + */ + private int menuNo; + /** + * 메뉴순서 + */ + private int menuOrdr; + /** + * 프로그램파일명 + */ + private String progrmFileNm; + /** + * 관련이미지명 + */ + private String relateImageNm; + /** + * 관련이미지경로 + */ + private String relateImagePath; + /** + * 상위메뉴번호 + */ + private int upperMenuId; +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sym/mnu/mpm/service/MenuManageVO.java b/src/main/java/egovframework/com/sym/mnu/mpm/service/MenuManageVO.java new file mode 100644 index 0000000..1eb6edf --- /dev/null +++ b/src/main/java/egovframework/com/sym/mnu/mpm/service/MenuManageVO.java @@ -0,0 +1,353 @@ +package egovframework.com.sym.mnu.mpm.service; + +/** + * 메뉴목록관리 처리를 위한 VO 클래스르를 정의한다 + * @author 개발환경 개발팀 이용 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이  용          최초 생성
    + *
    + * 
    + */ + +public class MenuManageVO{ + + /** 메뉴정보 */ + /** 메뉴번호 */ + private int menuNo; + /** 메뉴순서 */ + private int menuOrdr; + /** 메뉴명 */ + private String menuNm; + /** 상위메뉴번호 */ + private int upperMenuId; + /** 메뉴설명 */ + private String menuDc; + /** 관련이미지경로 */ + private String relateImagePath; + /** 관련이미지명 */ + private String relateImageNm; + /** 프로그램파일명 */ + private String progrmFileNm; + + /** 사이트맵 */ + /** 생성자ID **/ + private String creatPersonId; + + /** 권한정보설정 */ + /** 권한코드 */ + private String authorCode; + + /** 기타VO변수 */ + private String tempValue; + private int tempInt; + + + /** Login 메뉴관련 VO변수 */ + /** tmp_Id */ + private String tmpId; + /** tmp_Password */ + private String tmpPassword; + /** tmp_Name */ + private String tmpName; + /** tmp_UserSe */ + private String tmpUserSe; + /** tmp_Email */ + private String tmpEmail; + /** tmp_OrgnztId */ + private String tmpOrgnztId; + /** tmp_UniqId */ + private String tmpUniqId; + /** tmp_Cmd */ + private String tmpCmd; + + /** + * menuNo attribute를 리턴한다. + * @return int + */ + public int getMenuNo() { + return menuNo; + } + /** + * menuNo attribute 값을 설정한다. + * @param menuNo int + */ + public void setMenuNo(int menuNo) { + this.menuNo = menuNo; + } + /** + * menuOrdr attribute를 리턴한다. + * @return int + */ + public int getMenuOrdr() { + return menuOrdr; + } + /** + * menuOrdr attribute 값을 설정한다. + * @param menuOrdr int + */ + public void setMenuOrdr(int menuOrdr) { + this.menuOrdr = menuOrdr; + } + /** + * menuNm attribute를 리턴한다. + * @return String + */ + public String getMenuNm() { + return menuNm; + } + /** + * menuNm attribute 값을 설정한다. + * @param menuNm String + */ + public void setMenuNm(String menuNm) { + this.menuNm = menuNm; + } + /** + * upperMenuId attribute를 리턴한다. + * @return int + */ + public int getUpperMenuId() { + return upperMenuId; + } + /** + * upperMenuId attribute 값을 설정한다. + * @param upperMenuId int + */ + public void setUpperMenuId(int upperMenuId) { + this.upperMenuId = upperMenuId; + } + /** + * menuDc attribute를 리턴한다. + * @return String + */ + public String getMenuDc() { + return menuDc; + } + /** + * menuDc attribute 값을 설정한다. + * @param menuDc String + */ + public void setMenuDc(String menuDc) { + this.menuDc = menuDc; + } + /** + * relateImagePath attribute를 리턴한다. + * @return String + */ + public String getRelateImagePath() { + return relateImagePath; + } + /** + * relateImagePath attribute 값을 설정한다. + * @param relateImagePath String + */ + public void setRelateImagePath(String relateImagePath) { + this.relateImagePath = relateImagePath; + } + /** + * relateImageNm attribute를 리턴한다. + * @return String + */ + public String getRelateImageNm() { + return relateImageNm; + } + /** + * relateImageNm attribute 값을 설정한다. + * @param relateImageNm String + */ + public void setRelateImageNm(String relateImageNm) { + this.relateImageNm = relateImageNm; + } + /** + * progrmFileNm attribute를 리턴한다. + * @return String + */ + public String getProgrmFileNm() { + return progrmFileNm; + } + /** + * progrmFileNm attribute 값을 설정한다. + * @param progrmFileNm String + */ + public void setProgrmFileNm(String progrmFileNm) { + this.progrmFileNm = progrmFileNm; + } + /** + * creatPersonId attribute를 리턴한다. + * @return String + */ + public String getCreatPersonId() { + return creatPersonId; + } + /** + * creatPersonId attribute 값을 설정한다. + * @param creatPersonId String + */ + public void setCreatPersonId(String creatPersonId) { + this.creatPersonId = creatPersonId; + } + /** + * authorCode attribute를 리턴한다. + * @return String + */ + public String getAuthorCode() { + return authorCode; + } + /** + * authorCode attribute 값을 설정한다. + * @param authorCode String + */ + public void setAuthorCode(String authorCode) { + this.authorCode = authorCode; + } + + /** + * tmp_Id attribute를 리턴한다. + * @return String + */ + public String getTmpId() { + return tmpId; + } + /** + * tmp_Id attribute 값을 설정한다. + * @param tmp_Id String + */ + public void setTmpId(String tmp_Id) { + this.tmpId = tmp_Id; + } + /** + * tmp_Password attribute를 리턴한다. + * @return String + */ + public String getTmpPassword() { + return tmpPassword; + } + /** + * tmp_Password attribute 값을 설정한다. + * @param tmp_Password String + */ + public void setTmpPassword(String tmp_Password) { + this.tmpPassword = tmp_Password; + } + /** + * tmp_Name attribute를 리턴한다. + * @return String + */ + public String getTmpName() { + return tmpName; + } + /** + * tmp_Name attribute 값을 설정한다. + * @param tmp_Name String + */ + public void setTmpName(String tmp_Name) { + this.tmpName = tmp_Name; + } + /** + * tmp_UserSe attribute를 리턴한다. + * @return String + */ + public String getTmpUserSe() { + return tmpUserSe; + } + /** + * tmp_UserSe attribute 값을 설정한다. + * @param tmp_UserSe String + */ + public void setTmpUserSe(String tmp_UserSe) { + this.tmpUserSe = tmp_UserSe; + } + /** + * tmp_Email attribute를 리턴한다. + * @return String + */ + public String getTmpEmail() { + return tmpEmail; + } + /** + * tmp_Email attribute 값을 설정한다. + * @param tmp_Email String + */ + public void setTmpEmail(String tmp_Email) { + this.tmpEmail = tmp_Email; + } + /** + * tmp_OrgnztId attribute를 리턴한다. + * @return String + */ + public String getTmpOrgnztId() { + return tmpOrgnztId; + } + /** + * tmp_OrgnztId attribute 값을 설정한다. + * @param tmp_OrgnztId String + */ + public void setTmpOrgnztId(String tmp_OrgnztId) { + this.tmpOrgnztId = tmp_OrgnztId; + } + /** + * tmp_UniqId attribute를 리턴한다. + * @return String + */ + public String getTmpUniqId() { + return tmpUniqId; + } + /** + * tmp_UniqId attribute 값을 설정한다. + * @param tmp_UniqId String + */ + public void setTmpUniqId(String tmpUniqId) { + this.tmpUniqId = tmpUniqId; + } + /** + * tmp_Cmd attribute를 리턴한다. + * @return String + */ + public String getTmpCmd() { + return tmpCmd; + } + /** + * tmp_Cmd attribute 값을 설정한다. + * @param tmp_Cmd String + */ + public void setTmpCmd(String tmp_Cmd) { + this.tmpCmd = tmp_Cmd; + } + + /** + * tempValue attribute를 리턴한다. + * @return String + */ + public String getTempValue() { + return tempValue; + } + /** + * tempValue attribute 값을 설정한다. + * @param tempValue String + */ + public void setTempValue(String tempValue) { + this.tempValue = tempValue; + } + /** + * tempInt attribute를 리턴한다. + * @return int + */ + public int getTempInt() { + return tempInt; + } + /** + * tempInt attribute 값을 설정한다. + * @param tempInt int + */ + public void setTempInt(int tempInt) { + this.tempInt = tempInt; + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sym/mnu/mpm/service/impl/EgovMenuManageServiceImpl.java b/src/main/java/egovframework/com/sym/mnu/mpm/service/impl/EgovMenuManageServiceImpl.java new file mode 100644 index 0000000..4109111 --- /dev/null +++ b/src/main/java/egovframework/com/sym/mnu/mpm/service/impl/EgovMenuManageServiceImpl.java @@ -0,0 +1,580 @@ +package egovframework.com.sym.mnu.mpm.service.impl; + +import java.io.InputStream; +import java.sql.SQLException; +import java.util.List; + +import javax.annotation.Resource; + +import org.apache.poi.hssf.usermodel.HSSFCell; +import org.apache.poi.hssf.usermodel.HSSFRow; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import egovframework.com.cmm.ComDefaultVO; +import egovframework.com.sym.mnu.mpm.service.EgovMenuManageService; +import egovframework.com.sym.mnu.mpm.service.MenuManageVO; +import egovframework.com.sym.prm.service.ProgrmManageVO; +import egovframework.com.sym.prm.service.impl.ProgrmManageDAO; +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.cmmn.exception.BaseException; +import org.egovframe.rte.fdl.excel.EgovExcelService; + +/** + * 메뉴목록관리, 생성, 사이트맵을 처리하는 비즈니스 구현 클래스를 정의한다. + * @author 개발환경 개발팀 이용 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이  용          최초 생성
    + *   2011.07.01  서준식			자기 메뉴 정보를 상위메뉴 정보로 참조하는 메뉴정보가 있는지 조회하는
    + *   										selectUpperMenuNoByPk() 메서드 추가
    + *   2017-02-13  이정은          시큐어코딩(ES) - 시큐어코딩 부적절한 예외 처리[CWE-253, CWE-440, CWE-754]
    + *   2019-12-06  신용호          KISA 보안약점 조치 (부적절한 예외처리)
    + *
    + * 
    + */ + +@Service("meunManageService") +public class EgovMenuManageServiceImpl extends EgovAbstractServiceImpl implements EgovMenuManageService { + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovMenuManageServiceImpl.class); + + @Resource(name = "menuManageDAO") + private MenuManageDAO menuManageDAO; + @Resource(name = "progrmManageDAO") + private ProgrmManageDAO progrmManageDAO; + @Resource(name = "excelZipService") + private EgovExcelService excelZipService; + + /** + * 메뉴 상세정보를 조회 + * @param vo ComDefaultVO + * @return MenuManageVO + * @exception Exception + */ + public MenuManageVO selectMenuManage(ComDefaultVO vo) throws Exception { + return menuManageDAO.selectMenuManage(vo); + } + + /** + * 메뉴 목록을 조회 + * @param vo ComDefaultVO + * @return List + * @exception Exception + */ + public List selectMenuManageList(ComDefaultVO vo) throws Exception { + return menuManageDAO.selectMenuManageList(vo); + } + + /** + * 메뉴목록 총건수를 조회한다. + * @param vo ComDefaultVO + * @return int + * @exception Exception + */ + public int selectMenuManageListTotCnt(ComDefaultVO vo) throws Exception { + return menuManageDAO.selectMenuManageListTotCnt(vo); + } + + /** + * 메뉴번호를 상위메뉴로 참조하고 있는 메뉴 존재여부를 조회 + * @param vo ComDefaultVO + * @return int + * @exception Exception + */ + public int selectUpperMenuNoByPk(MenuManageVO vo) throws Exception { + return menuManageDAO.selectUpperMenuNoByPk(vo); + } + + /** + * 메뉴번호 존재 여부를 조회한다. + * @param vo ComDefaultVO + * @return int + * @exception Exception + */ + public int selectMenuNoByPk(MenuManageVO vo) throws Exception { + return menuManageDAO.selectMenuNoByPk(vo); + } + + /** + * 메뉴 정보를 등록 + * @param vo MenuManageVO + * @exception Exception + */ + public void insertMenuManage(MenuManageVO vo) throws Exception { + menuManageDAO.insertMenuManage(vo); + } + + /** + * 메뉴 정보를 수정 + * @param vo MenuManageVO + * @exception Exception + */ + public void updateMenuManage(MenuManageVO vo) throws Exception { + menuManageDAO.updateMenuManage(vo); + } + + /** + * 메뉴 정보를 삭제 + * @param vo MenuManageVO + * @exception Exception + */ + public void deleteMenuManage(MenuManageVO vo) throws Exception { + menuManageDAO.deleteMenuManage(vo); + } + + /** + * 화면에 조회된 메뉴 목록 정보를 데이터베이스에서 삭제 + * @param checkedMenuNoForDel String + * @exception Exception + */ + public void deleteMenuManageList(String checkedMenuNoForDel) throws Exception { + MenuManageVO vo = null; + + String[] delMenuNo = checkedMenuNoForDel.split(","); + + if (delMenuNo == null || (delMenuNo.length == 0)) { + throw new java.lang.Exception("String Split Error!"); + } + for (int i = 0; i < delMenuNo.length; i++) { + vo = new MenuManageVO(); + vo.setMenuNo(Integer.parseInt(delMenuNo[i])); + menuManageDAO.deleteMenuManage(vo); + } + } + + /* 메뉴 생성 관리 */ + + /** + * 메뉴 목록을 조회 + * @return List + * @exception Exception + */ + public List selectMenuList() throws Exception { + return menuManageDAO.selectMenuList(); + } + + /*### 메뉴관련 프로세스 ###*/ + /** + * MainMenu Head Menu 조회 + * @param vo MenuManageVO + * @return List + * @exception Exception + */ + public List selectMainMenuHead(MenuManageVO vo) throws Exception { + return menuManageDAO.selectMainMenuHead(vo); + } + + /** + * MainMenu Head Left 조회 + * @param vo MenuManageVO + * @return List + * @exception Exception + */ + public List selectMainMenuLeft(MenuManageVO vo) throws Exception { + return menuManageDAO.selectMainMenuLeft(vo); + } + + /** + * MainMenu Head MenuURL 조회 + * @param iMenuNo int + * @param sUniqId String + * @return String + * @exception Exception + */ + public String selectLastMenuURL(int iMenuNo, String sUniqId) throws Exception { + MenuManageVO vo = new MenuManageVO(); + vo.setMenuNo(selectLastMenuNo(iMenuNo, sUniqId)); + return menuManageDAO.selectLastMenuURL(vo); + } + + /** + * MainMenu Head Menu MenuNo 조회 + * @param iMenuNo int + * @param sUniqId String + * @return String + * @exception Exception + */ + private int selectLastMenuNo(int iMenuNo, String sUniqId) throws Exception { + int chkMenuNo = iMenuNo; + int cntMenuNo = 0; + for (; chkMenuNo > -1;) { + chkMenuNo = selectLastMenuNoChk(chkMenuNo, sUniqId); + if (chkMenuNo > 0) { + cntMenuNo = chkMenuNo; + } + } + return cntMenuNo; + } + + /** + * MainMenu Head Menu Last MenuNo 조회 + * @param iMenuNo int + * @param sUniqId String + * @return String + * @exception Exception + */ + private int selectLastMenuNoChk(int iMenuNo, String sUniqId) throws Exception { + MenuManageVO vo = new MenuManageVO(); + vo.setMenuNo(iMenuNo); + vo.setTempValue(sUniqId); + int chkMenuNo = 0; + int cntMenuNo = 0; + cntMenuNo = menuManageDAO.selectLastMenuNoCnt(vo); + if (cntMenuNo > 0) { + chkMenuNo = menuManageDAO.selectLastMenuNo(vo); + } else { + chkMenuNo = -1; + } + return chkMenuNo; + } + + /*### 일괄처리 프로세스 ###*/ + /** + * 메뉴일괄초기화 프로세스 메뉴목록테이블, 프로그램 목록테이블 전체 삭제 + * @return boolean + * @exception Exception + */ + public boolean menuBndeAllDelete() throws Exception { + if (!deleteAllProgrmDtls()) { + return false; + } // 프로그램변경요청 테이블 + if (!deleteAllMenuList()) { + return false; + } // 메뉴정보 테이블 + if (!deleteAllProgrm()) { + return false; + } // 프로그램목록 테이블 + return true; + } + + /** + * 메뉴일괄등록 프로세스 + * @param vo MenuManageVO + * @param inputStream InputStream + * @exception Exception + */ + public String menuBndeRegist(MenuManageVO vo, InputStream inputStream) throws Exception { + + String message = bndeRegist(inputStream); + String sMessage = null; + + switch (Integer.parseInt(message)) { + case 99: + LOGGER.debug("프로그램목록/메뉴정보테이블 데이타 존재오류 - 초기화 하신 후 다시 처리하세요."); + sMessage = "프로그램목록/메뉴정보테이블 데이타 존재오류 - 초기화 하신 후 다시 처리하세요."; + break; + case 90: + LOGGER.debug("파일존재하지 않음."); + sMessage = "파일존재하지 않음."; + break; + case 91: + LOGGER.debug("프로그램시트의 cell 갯수 오류."); + sMessage = "프로그램시트의 cell 갯수 오류."; + break; + case 92: + LOGGER.debug("메뉴정보시트의 cell 갯수 오류."); + sMessage = "메뉴정보시트의 cell 갯수 오류."; + break; + case 93: + LOGGER.debug("엑셀 시트갯수 오류."); + sMessage = "엑셀 시트갯수 오류."; + break; + case 95: + LOGGER.debug("메뉴정보 입력시 에러."); + sMessage = "메뉴정보 입력시 에러."; + break; + case 96: + LOGGER.debug("프로그램목록입력시 에러."); + sMessage = "프로그램목록입력시 에러."; + break; + default: + LOGGER.debug("일괄배치처리 완료."); + sMessage = "일괄배치처리 완료."; + break; + } + LOGGER.debug(message); + return sMessage; + } + + /** + * 메뉴목록_프로그램목록 일괄생성 + * @param inputStream InputStream + * @return String + * @exception Exception + */ + private String bndeRegist(InputStream inputStream) throws Exception { + boolean success = false; + String requestValue = null; + int progrmSheetRowCnt = 0; + int menuSheetRowCnt = 0; + //String xlsFile = null; + try { + /* + 오류 메세지 정보 + message = "99"; //프로그램목록테이블 데이타 존재오류. + message = "99"; //메뉴정보테이블 데이타 존재오류. + message = "90"; //파일존재하지 않음. + message = "91"; //프로그램시트의 cell 갯수 오류 + message = "92"; //메뉴정보시트의 cell 갯수 오류 + message = "93"; //엑셀 시트갯수 오류 + message = "95"; //메뉴정보 입력시 에러 + message = "96"; //프로그램목록입력시 에러 + message = "0"; //일괄배치처리 완료 + */ + + if (progrmManageDAO.selectProgrmListTotCnt() > 0) { + return requestValue = "99"; + } //프로그램목록테이블 데이타 존재오류. + if (menuManageDAO.selectMenuListTotCnt() > 0) { + return requestValue = "99"; + } //메뉴정보테이블 데이타 존재오류. + + HSSFWorkbook hssfWB = (HSSFWorkbook) excelZipService.loadWorkbook(inputStream); + // 엑셀 파일 시트 갯수 확인 sheet = 2 첫번째시트 = 프로그램목록 두번째시트 = 메뉴목록 + if (hssfWB.getNumberOfSheets() == 2) { + HSSFSheet progrmSheet = hssfWB.getSheetAt(0); //프로그램목록 시트 가져오기 + HSSFSheet menuSheet = hssfWB.getSheetAt(1); //메뉴정보 시트 가져오기 + HSSFRow progrmRow = progrmSheet.getRow(1); //프로그램 row 가져오기 + HSSFRow menuRow = menuSheet.getRow(1); //메뉴정보 row 가져오기 + progrmSheetRowCnt = progrmRow.getPhysicalNumberOfCells(); //프로그램 cell Cnt + menuSheetRowCnt = menuRow.getPhysicalNumberOfCells(); //메뉴정보 cell Cnt + + // 프로그램 시트 파일 데이타 검증 cell = 5개 + if (progrmSheetRowCnt != 5) { + return requestValue = "91"; //프로그램시트의 cell 갯수 오류 + } + + // 메뉴목록 시트 파일 데이타 검증 cell = 8개 + if (menuSheetRowCnt != 8) { + return requestValue = "92"; //메뉴정보시트의 cell 갯수 오류 + } + + /* sheet1번 = 프로그램목록 , sheet2번 = 메뉴정보 */ + success = progrmRegist(progrmSheet); + if (success) { + success = menuRegist(menuSheet); + if (success) { + return requestValue = "0"; // 일괄배치처리 완료 + } else { + deleteAllProgrmDtls(); + deleteAllProgrm(); + deleteAllMenuList(); + return requestValue = "95"; // 메뉴정보 입력시 에러 + } + } else { + deleteAllProgrmDtls(); + deleteAllProgrm(); + return requestValue = "96"; // 프로그램목록입력시 에러 + } + } else { + return requestValue = "93"; // 엑셀 시트갯수 오류 + } + } catch (BaseException e) { + LOGGER.error("["+ e.getClass() +"] : ", e.getMessage()); + requestValue = "99"; + + } catch (Exception e) { + //2017.02.13 이정은 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + LOGGER.error("["+ e.getClass() +"] : ", e.getMessage()); + requestValue = "99"; + } + return requestValue; + } + + /** + * 프로그램목록 일괄등록 + * @param progrmSheet HSSFSheet + * @return boolean + * @exception Exception + */ + private boolean progrmRegist(HSSFSheet progrmSheet) { + int count = 0; + boolean success = false; + try { + int rows = progrmSheet.getPhysicalNumberOfRows(); //행 갯수 가져오기 + for (int j = 1; j < rows; j++) { //row 루프 + ProgrmManageVO vo = new ProgrmManageVO(); + HSSFRow row = progrmSheet.getRow(j); //row 가져오기 + if (row != null) { + //int cells = row.getPhysicalNumberOfCells(); //cell 갯수 가져오기 + + HSSFCell cell = null; + cell = row.getCell(0); //프로그램명 + if (cell != null) { + vo.setProgrmFileNm("" + cell.getStringCellValue()); + } + cell = row.getCell(1); //프로그램한글명 + if (cell != null) { + vo.setProgrmKoreanNm("" + cell.getStringCellValue()); + } + cell = row.getCell(2); //프로그램저장경로 + if (cell != null) { + vo.setProgrmStrePath("" + cell.getStringCellValue()); + } + cell = row.getCell(3); //프로그램 URL + if (cell != null) { + vo.setURL("" + cell.getStringCellValue()); + } + cell = row.getCell(4); //프로그램설명 + if (cell != null) { + vo.setProgrmDc("" + cell.getStringCellValue()); + } + } + if (insertProgrm(vo)) { + count++; + } + } + if (count == rows - 1) { + success = true; + } else { + success = false; + } + } catch (SQLException e) { + LOGGER.error("["+ e.getClass() +"] : ", e.getMessage()); + success = false; + + } catch (Exception e) { + //2017.02.13 이정은 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + LOGGER.error("["+ e.getClass() +"] : ", e.getMessage()); + success = false; + } + return success; + } + + /** + * 메뉴정보 일괄등록 + * @param menuSheet HSSFSheet + * @return boolean + * @exception Exception + */ + private boolean menuRegist(HSSFSheet menuSheet) throws Exception { + boolean success = false; + int count = 0; + try { + int rows = menuSheet.getPhysicalNumberOfRows(); //행 갯수 가져오기 + for (int j = 1; j < rows; j++) { //row 루프 + MenuManageVO vo = new MenuManageVO(); + HSSFRow row = menuSheet.getRow(j); //row 가져오기 + if (row != null) { + //int cells = row.getPhysicalNumberOfCells(); //cell 갯수 가져오기 + HSSFCell cell = null; + cell = row.getCell(0); //메뉴번호 + if (cell != null) { + Double doubleCell = new Double(cell.getNumericCellValue()); + vo.setMenuNo(Integer.parseInt("" + doubleCell.longValue())); + } + cell = row.getCell(1); //메뉴순서 + if (cell != null) { + Double doubleCell = new Double(cell.getNumericCellValue()); + vo.setMenuOrdr(Integer.parseInt("" + doubleCell.longValue())); + } + cell = row.getCell(2); //메뉴명 + if (cell != null) { + vo.setMenuNm("" + cell.getStringCellValue()); + } + cell = row.getCell(3); //상위메뉴번호 + if (cell != null) { + Double doubleCell = new Double(cell.getNumericCellValue()); + vo.setUpperMenuId(Integer.parseInt("" + doubleCell.longValue())); + } + cell = row.getCell(4); //메뉴설명 + if (cell != null) { + vo.setMenuDc("" + cell.getStringCellValue()); + } + cell = row.getCell(5); //관련이미지경로 + if (cell != null) { + vo.setRelateImagePath("" + cell.getStringCellValue()); + } + cell = row.getCell(6); //관련이미지명 + if (cell != null) { + vo.setRelateImageNm("" + cell.getStringCellValue()); + } + cell = row.getCell(7); //프로그램파일명 + if (cell != null) { + vo.setProgrmFileNm("" + cell.getStringCellValue()); + } + } + if (insertMenuManageBind(vo)) { + count++; + } + } + if (count == rows - 1) { + success = true; + } else { + success = false; + } + } catch (SQLException e) { + LOGGER.error("["+ e.getClass() +"] : ", e.getMessage()); + success = false; + + } catch (Exception e) { + //2017.02.13 이정은 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + LOGGER.error("["+ e.getClass() +"] : ", e.getMessage()); + success = false; + } + + return success; + } + + /** + * 메뉴정보 전체데이타 초기화 + * @return boolean + * @exception Exception + */ + private boolean deleteAllMenuList() throws Exception { + return menuManageDAO.deleteAllMenuList(); + } + + /** + * 프로그램 정보를 등록 + * @param vo ProgrmManageVO + * @return boolean + * @exception Exception + */ + private boolean insertProgrm(ProgrmManageVO vo) throws Exception { + progrmManageDAO.insertProgrm(vo); + return true; + } + + /** + * 메뉴정보를 일괄 등록 + * @param vo MenuManageVO + * @return boolean + * @exception Exception + */ + private boolean insertMenuManageBind(MenuManageVO vo) throws Exception { + menuManageDAO.insertMenuManage(vo); + return true; + } + + /** + * 프로그램 정보 전체데이타 초기화 + * @return boolean + * @exception Exception + */ + private boolean deleteAllProgrm() throws Exception { + progrmManageDAO.deleteAllProgrm(); + return true; + } + + /** + * 프로그램변경내역 정보 전체데이타 초기화 + * @return boolean + * @exception Exception + */ + private boolean deleteAllProgrmDtls() throws Exception { + progrmManageDAO.deleteAllProgrmDtls(); + return true; + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sym/mnu/mpm/service/impl/MenuManageDAO.java b/src/main/java/egovframework/com/sym/mnu/mpm/service/impl/MenuManageDAO.java new file mode 100644 index 0000000..7e2b39f --- /dev/null +++ b/src/main/java/egovframework/com/sym/mnu/mpm/service/impl/MenuManageDAO.java @@ -0,0 +1,195 @@ +package egovframework.com.sym.mnu.mpm.service.impl; + +import java.util.List; + +import egovframework.com.cmm.ComDefaultVO; +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.sym.mnu.mpm.service.MenuManageVO; + +import org.springframework.stereotype.Repository; +/** + * 메뉴관리, 메뉴생성, 사이트맵 생성에 대한 DAO 클래스를 정의한다. + * @author 개발환경 개발팀 이용 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이  용          최초 생성
    + *   2011.07.01  서준식			자기 메뉴 정보를 상위메뉴 정보로 참조하는 메뉴정보가 있는지 조회하는
    + *   							selectUpperMenuNoByPk() 메서드 추가
    + *
    + * 
    + */ + +@Repository("menuManageDAO") +public class MenuManageDAO extends EgovComAbstractDAO{ + + /** + * 메뉴목록을 조회 + * @param vo ComDefaultVO + * @return List + * @exception Exception + */ + public List selectMenuManageList(ComDefaultVO vo) throws Exception{ + return selectList("menuManageDAO.selectMenuManageList_D", vo); + } + + /** + * 메뉴목록관리 총건수를 조회한다. + * @param vo ComDefaultVO + * @return int + * @exception Exception + */ + public int selectMenuManageListTotCnt(ComDefaultVO vo) { + return (Integer)selectOne("menuManageDAO.selectMenuManageListTotCnt_S", vo); + } + + /** + * 메뉴목록관리 기본정보를 조회 + * @param vo ComDefaultVO + * @return MenuManageVO + * @exception Exception + */ + public MenuManageVO selectMenuManage(ComDefaultVO vo)throws Exception{ + return (MenuManageVO)selectOne("menuManageDAO.selectMenuManage_D", vo); + } + + /** + * 메뉴목록 기본정보를 등록 + * @param vo MenuManageVO + * @exception Exception + */ + public void insertMenuManage(MenuManageVO vo){ + insert("menuManageDAO.insertMenuManage_S", vo); + } + + /** + * 메뉴목록 기본정보를 수정 + * @param vo MenuManageVO + * @exception Exception + */ + public void updateMenuManage(MenuManageVO vo){ + update("menuManageDAO.updateMenuManage_S", vo); + } + + /** + * 메뉴목록 기본정보를 삭제 + * @param vo MenuManageVO + * @exception Exception + */ + public void deleteMenuManage(MenuManageVO vo){ + delete("menuManageDAO.deleteMenuManage_S", vo); + } + + /** + * 메뉴 전체목록을 조회 + * @return list + * @exception Exception + */ + public List selectMenuList() throws Exception{ + ComDefaultVO vo = new ComDefaultVO(); + return selectList("menuManageDAO.selectMenuListT_D", vo); + } + + + /** + * 메뉴번호 존재여부를 조회 + * @param vo MenuManageVO + * @return int + * @exception Exception + */ + public int selectMenuNoByPk(MenuManageVO vo) throws Exception{ + return (Integer)selectOne("menuManageDAO.selectMenuNoByPk", vo); + } + + + + /** + * 메뉴번호를 상위메뉴로 참조하고 있는 메뉴 존재여부를 조회 + * @param vo MenuManageVO + * @return int + * @exception Exception + */ + public int selectUpperMenuNoByPk(MenuManageVO vo) throws Exception{ + return (Integer)selectOne("menuManageDAO.selectUpperMenuNoByPk", vo); + } + + + /** + * 메뉴정보 전체삭제 초기화 + * @return boolean + * @exception Exception + */ + public boolean deleteAllMenuList(){ + MenuManageVO vo = new MenuManageVO(); + insert("menuManageDAO.deleteAllMenuList", vo); + return true; + } + + /** + * 메뉴정보 존재여부 조회한다. + * @return int + * @exception Exception + */ + public int selectMenuListTotCnt() { + MenuManageVO vo = new MenuManageVO(); + return (Integer)selectOne("menuManageDAO.selectMenuListTotCnt", vo); + } + + + /*### 메뉴관련 프로세스 ###*/ + /** + * MainMenu Head Menu 조회 + * @param vo MenuManageVO + * @return List + * @exception Exception + */ + public List selectMainMenuHead(MenuManageVO vo) throws Exception{ + return selectList("menuManageDAO.selectMainMenuHead", vo); + } + + /** + * MainMenu Left Menu 조회 + * @param vo MenuManageVO + * @return List + * @exception Exception + */ + public List selectMainMenuLeft(MenuManageVO vo) throws Exception{ + return selectList("menuManageDAO.selectMainMenuLeft", vo); + } + + /** + * MainMenu Head MenuURL 조회 + * @param vo MenuManageVO + * @return String + * @exception Exception + */ + public String selectLastMenuURL(MenuManageVO vo) throws Exception{ + return (String)selectOne("menuManageDAO.selectLastMenuURL", vo); + } + + /** + * MainMenu Left Menu 조회 + * @param vo MenuManageVO + * @return int + * @exception Exception + */ + public int selectLastMenuNo(MenuManageVO vo) throws Exception{ + return (Integer)selectOne("menuManageDAO.selectLastMenuNo", vo); + } + + /** + * MainMenu Left Menu 조회 + * @param vo MenuManageVO + * @return int + * @exception Exception + */ + public int selectLastMenuNoCnt(MenuManageVO vo) throws Exception{ + return (Integer)selectOne("menuManageDAO.selectLastMenuNoCnt", vo); + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sym/mnu/mpm/web/EgovMainMenuManageController.java b/src/main/java/egovframework/com/sym/mnu/mpm/web/EgovMainMenuManageController.java new file mode 100644 index 0000000..3de9308 --- /dev/null +++ b/src/main/java/egovframework/com/sym/mnu/mpm/web/EgovMainMenuManageController.java @@ -0,0 +1,258 @@ +package egovframework.com.sym.mnu.mpm.web; + +import java.util.List; + +import javax.annotation.Resource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +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 egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.sym.mnu.mpm.service.EgovMenuManageService; +import egovframework.com.sym.mnu.mpm.service.MenuManageVO; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.fdl.property.EgovPropertyService; + +/** + * 메인메뉴 해당링크 처리를 하는 비즈니스 구현 클래스 + * @author 개발환경 개발팀 이용 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이  용          최초 생성
    + *   2011.09.07  서준식          사용자 구분 오류 수정
    + *   2015.06.19  조정국          미인증사용자에 대한 보안처리
    + *   2018.10.12  이정은          메인페이지 통합(업무, 기업, 일반)
    + * 
    + */ + +@Controller +public class EgovMainMenuManageController { + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovMainMenuManageController.class); + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** EgovMenuManageService */ + @Resource(name = "meunManageService") + private EgovMenuManageService menuManageService; + + /** EgovFileMngService */ + //@Resource(name="EgovFileMngService") + //private EgovFileMngService fileMngService; + + /** EgovFileMngUtil */ + //@Resource(name="EgovFileMngUtil") + //private EgovFileMngUtil fileUtil; + + /*### 메인작업 ###*/ + /*Main Index 조회*/ + /** + * Main메뉴의 Index를 조회한다. + * @param menuNo String + * @param chkURL String + * @return 출력페이지정보 "menu_index" + * @exception Exception + */ + @RequestMapping(value="/sym/mnu/mpm/EgovMainMenuIndex.do") + public String selectMainMenuIndex( + @ModelAttribute("menuManageVO") MenuManageVO menuManageVO, + @RequestParam("menuNo") String menuNo, + @RequestParam("chkURL") String chkURL, + ModelMap model) + throws Exception { + + int iMenuNo = Integer.parseInt(menuNo); + menuManageVO.setMenuNo(iMenuNo); + //menuManageVO.setTempValue(chkURL); + model.addAttribute("resultVO", menuManageVO); + + return "egovframework/com/menu_index"; + } + + /** + * Head메뉴를 조회한다. + * @param menuManageVO MenuManageVO + * @return 출력페이지정보 "head" + * @exception Exception + */ + @RequestMapping(value="/sym/mnu/mpm/EgovMainMenu.do") + public String selectMainMenu( + @ModelAttribute("menuManageVO") MenuManageVO menuManageVO, + ModelMap model) + throws Exception { + + LoginVO user = + (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + menuManageVO.setTmpId(user == null ? "" : EgovStringUtil.isNullToString(user.getId())); + menuManageVO.setTmpPassword(user == null ? "" : EgovStringUtil.isNullToString(user.getPassword())); + menuManageVO.setTmpUserSe(user == null ? "" : EgovStringUtil.isNullToString(user.getUserSe())); + menuManageVO.setTmpName(user == null ? "" : EgovStringUtil.isNullToString(user.getName())); + menuManageVO.setTmpEmail(user == null ? "" : EgovStringUtil.isNullToString(user.getEmail())); + menuManageVO.setTmpOrgnztId(user == null ? "" : EgovStringUtil.isNullToString(user.getOrgnztId())); + menuManageVO.setTmpUniqId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + + List list_headmenu = menuManageService.selectMainMenuHead(menuManageVO); + model.addAttribute("list_headmenu", list_headmenu); + if (!(user == null ? "" : EgovStringUtil.isNullToString(user.getId())).equals("")) { + // 메인 페이지 이동 + return "egovframework/com/EgovMainView"; + } else { + // 오류 페이지 이동 + return "egovframework/com/cmm/error/egovError"; + } + } + + /** + * Head메뉴를 조회한다. + * @param menuManageVO MenuManageVO + * @return 출력페이지정보 "main_head" + * @exception Exception + */ + @RequestMapping(value="/sym/mnu/mpm/EgovMainMenuHead.do") + public String selectMainMenuHead( + @ModelAttribute("menuManageVO") MenuManageVO menuManageVO, + ModelMap model) + throws Exception { + + LoginVO user = + (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + menuManageVO.setTmpId(user == null ? "" : EgovStringUtil.isNullToString(user.getId())); + menuManageVO.setTmpPassword(user == null ? "" : EgovStringUtil.isNullToString(user.getPassword())); + menuManageVO.setTmpUserSe(user == null ? "" : EgovStringUtil.isNullToString(user.getUserSe())); + menuManageVO.setTmpName(user == null ? "" : EgovStringUtil.isNullToString(user.getName())); + menuManageVO.setTmpEmail(user == null ? "" : EgovStringUtil.isNullToString(user.getEmail())); + menuManageVO.setTmpOrgnztId(user == null ? "" : EgovStringUtil.isNullToString(user.getOrgnztId())); + menuManageVO.setTmpUniqId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + + List list_headmenu = menuManageService.selectMainMenuHead(menuManageVO); + model.addAttribute("list_headmenu", list_headmenu); + if (!(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())).equals("")) { + // 메인 페이지 이동 + return "egovframework/com/main_head"; + } else { + // 오류 페이지 이동 + return "egovframework/com/cmm/error/egovError"; + } + } + + + /** + * 좌측메뉴를 조회한다. + * @param menuManageVO MenuManageVO + * @param vStartP String + * @return 출력페이지정보 "main_left" + * @exception Exception + */ + @RequestMapping(value="/sym/mnu/mpm/EgovMainMenuLeft.do") + public String selectMainMenuLeft( + @ModelAttribute("menuManageVO") MenuManageVO menuManageVO, + @RequestParam("vStartP") String vStartP, + ModelMap model) + throws Exception { + int iMenuNo = Integer.parseInt(vStartP); + menuManageVO.setTempInt(iMenuNo); + model.addAttribute("resultVO", menuManageVO); + + LoginVO user = + (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + menuManageVO.setTmpId(user == null ? "" : EgovStringUtil.isNullToString(user.getId())); + menuManageVO.setTmpPassword(user == null ? "" : EgovStringUtil.isNullToString(user.getPassword())); + menuManageVO.setTmpUserSe(user == null ? "" : EgovStringUtil.isNullToString(user.getUserSe())); + menuManageVO.setTmpName(user == null ? "" : EgovStringUtil.isNullToString(user.getName())); + menuManageVO.setTmpEmail(user == null ? "" : EgovStringUtil.isNullToString(user.getEmail())); + menuManageVO.setTmpOrgnztId(user == null ? "" : EgovStringUtil.isNullToString(user.getOrgnztId())); + menuManageVO.setTmpUniqId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + + List list_menulist = menuManageService.selectMainMenuLeft(menuManageVO); + model.addAttribute("list_menulist", list_menulist); + return "egovframework/com/main_left"; + } + + /** + * 우측화면을 조회한다. + * @param menuManageVO MenuManageVO + * @param vStartP String + * @return 출력페이지정보 해당URL + * @exception Exception + */ + /*Right Menu 조회*/ + @RequestMapping(value="/sym/mnu/mpm/EgovMainMenuRight.do") + public String selectMainMenuRight( + @ModelAttribute("menuManageVO") MenuManageVO menuManageVO, + @RequestParam("vStartP") String vStartP, + ModelMap model) + throws Exception { + int iMenuNo = Integer.parseInt(vStartP); + LoginVO user = + (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + String forwardURL = null; + forwardURL = menuManageService.selectLastMenuURL(iMenuNo, user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + return "forward:"+forwardURL; + } + + /** + * HOME 메인화면 조회한다. + * @param menuManageVO MenuManageVO + * @return 출력페이지정보 "EgovMainView" + * @exception Exception + */ + @IncludedInfo(name="포털(예제) 메인화면", order = 1, gid = 0) + @RequestMapping(value="/sym/mnu/mpm/EgovMainMenuHome.do") + public String selectMainMenuHome( + @ModelAttribute("menuManageVO") MenuManageVO menuManageVO, + ModelMap model) + throws Exception { + + LoginVO user = + (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + // 미인증 사용자에 대한 보안처리 + if(user == null) { + return "index"; + } + + menuManageVO.setTmpId(user.getId()); + menuManageVO.setTmpPassword(user.getPassword()); + menuManageVO.setTmpUserSe(user.getUserSe()); + menuManageVO.setTmpName(user.getName()); + menuManageVO.setTmpEmail(user.getEmail()); + menuManageVO.setTmpOrgnztId(user.getOrgnztId()); + menuManageVO.setTmpUniqId(user.getUniqId()); + + List list_headmenu = menuManageService.selectMainMenuHead(menuManageVO); + model.addAttribute("list_headmenu", list_headmenu); + + LOGGER.debug("## selectMainMenuHome ## getSUserSe 1: {}", user.getUserSe()); + LOGGER.debug("## selectMainMenuHome ## getSUserId 2: {}", user.getId()); + LOGGER.debug("## selectMainMenuHome ## getUniqId 2: {}", user.getUniqId()); + + if (!user.getId().equals("")) { + // 메인 페이지 이동 + return "egovframework/com/EgovMainView"; + + } else { + // 오류 페이지 이동 + return "egovframework/com/cmm/error/egovError"; + } + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sym/mnu/mpm/web/EgovMenuManageController.java b/src/main/java/egovframework/com/sym/mnu/mpm/web/EgovMenuManageController.java new file mode 100644 index 0000000..f78251a --- /dev/null +++ b/src/main/java/egovframework/com/sym/mnu/mpm/web/EgovMenuManageController.java @@ -0,0 +1,629 @@ +package egovframework.com.sym.mnu.mpm.web; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +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.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.util.WebUtils; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import egovframework.com.cmm.ComDefaultVO; +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.sym.mnu.mpm.service.EgovMenuManageService; +import egovframework.com.sym.mnu.mpm.service.MenuManageVO; +import egovframework.com.sym.prm.service.EgovProgrmManageService; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +/** + * 메뉴목록 관리및 메뉴생성, 사이트맵 생성을 처리하는 비즈니스 구현 클래스 + * @author 개발환경 개발팀 이용 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *  수정일               수정자           수정내용
    + *  ----------   --------   ---------------------------
    + *  2009.03.20   이  용            최초 생성
    + *  2011.07.01   서준식            메뉴정보 삭제시 참조되고 있는 하위 메뉴가 있는지 체크하는 로직 추가
    + *  2011.07.27   서준식            deleteMenuManageList() 메서드에서 메뉴 멀티 삭제 버그 수정
    + *  2011.08.26   정진오            IncludedInfo annotation 추가
    + *  2011.10.07   이기하            보안취약점 수정(파일 업로드시 엑셀파일만 가능하도록 추가)
    + *  2015.05.28   조정국            메뉴리스트관리 선택시 "정상적으로 조회되었습니다"라는 alert창이 제일 먼저 뜨는것 수정 : 출력메시지 주석처리
    + *  2020.11.02   신용호            KISA 보안약점 조치 - 자원해제
    + *  2021.02.16   신용호            WebUtils.getNativeRequest(request,MultipartHttpServletRequest.class);
    + * 
    + */ + +@Controller +public class EgovMenuManageController { + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovMenuManageController.class); + + /* Validator */ + @Autowired + private DefaultBeanValidator beanValidator; + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** EgovMenuManageService */ + @Resource(name = "meunManageService") + private EgovMenuManageService menuManageService; + + /** EgovMenuManageService */ + @Resource(name = "progrmManageService") + private EgovProgrmManageService progrmManageService; + + /** EgovFileMngService */ + // @Resource(name="EgovFileMngService") + // private EgovFileMngService fileMngService; + + /** EgovFileMngUtil */ + // @Resource(name="EgovFileMngUtil") + // private EgovFileMngUtil fileUtil; + + // @Resource(name = "excelZipService") + // private EgovExcelService excelZipService; + + /** EgovMessageSource */ + @Resource(name = "egovMessageSource") + EgovMessageSource egovMessageSource; + + /** + * 메뉴정보목록을 상세화면 호출 및 상세조회한다. + * @param req_menuNo String + * @return 출력페이지정보 "sym/mnu/mpm/EgovMenuDetailSelectUpdt" + * @exception Exception + */ + @RequestMapping(value = "/sym/mnu/mpm/EgovMenuManageListDetailSelect.do") + public String selectMenuManage( + @RequestParam("req_menuNo") String req_menuNo, + @ModelAttribute("searchVO") ComDefaultVO searchVO, + ModelMap model) + throws Exception { + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + searchVO.setSearchKeyword(req_menuNo); + + MenuManageVO resultVO = menuManageService.selectMenuManage(searchVO); + model.addAttribute("menuManageVO", resultVO); + + return "egovframework/com/sym/mnu/mpm/EgovMenuDetailSelectUpdt"; + } + + /** + * 메뉴목록 리스트조회한다. + * @param searchVO ComDefaultVO + * @return 출력페이지정보 "sym/mnu/mpm/EgovMenuManage" + * @exception Exception + */ + @IncludedInfo(name = "메뉴관리리스트", order = 1091, gid = 60) + @RequestMapping(value = "/sym/mnu/mpm/EgovMenuManageSelect.do") + public String selectMenuManageList( + @ModelAttribute("searchVO") ComDefaultVO searchVO, + ModelMap model) + throws Exception { + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + // 내역 조회 + /** 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()); + + List list_menumanage = menuManageService.selectMenuManageList(searchVO); + model.addAttribute("list_menumanage", list_menumanage); + + int totCnt = menuManageService.selectMenuManageListTotCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/sym/mnu/mpm/EgovMenuManage"; + } + + /** + * 메뉴목록 멀티 삭제한다. + * @param checkedMenuNoForDel String + * @return 출력페이지정보 "forward:/sym/mnu/mpm/EgovMenuManageSelect.do" + * @exception Exception + */ + @RequestMapping("/sym/mnu/mpm/EgovMenuManageListDelete.do") + public String deleteMenuManageList( + @RequestParam("checkedMenuNoForDel") String checkedMenuNoForDel, + @ModelAttribute("menuManageVO") MenuManageVO menuManageVO, + ModelMap model) + throws Exception { + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + String sLocationUrl = null; + String resultMsg = ""; + + String[] delMenuNo = checkedMenuNoForDel.split(","); + menuManageVO.setMenuNo(Integer.parseInt(delMenuNo[0])); + + if (menuManageService.selectUpperMenuNoByPk(menuManageVO) != 0) { + resultMsg = egovMessageSource.getMessage("fail.common.delete.upperMenuExist"); + sLocationUrl = "forward:/sym/mnu/mpm/EgovMenuManageSelect.do"; + } else if (delMenuNo == null || (delMenuNo.length == 0)) { + resultMsg = egovMessageSource.getMessage("fail.common.delete"); + sLocationUrl = "forward:/sym/mnu/mpm/EgovMenuManageSelect.do"; + } else { + menuManageService.deleteMenuManageList(checkedMenuNoForDel); + resultMsg = egovMessageSource.getMessage("success.common.delete"); + sLocationUrl = "forward:/sym/mnu/mpm/EgovMenuManageSelect.do"; + } + model.addAttribute("resultMsg", resultMsg); + return sLocationUrl; + } + + /** + * 메뉴정보를 등록화면으로 이동 및 등록 한다. + * @param menuManageVO MenuManageVO + * @param commandMap Map + * @return 출력페이지정보 등록화면 호출시 "sym/mnu/mpm/EgovMenuRegist", + * 출력페이지정보 등록처리시 "forward:/sym/mnu/mpm/EgovMenuManageSelect.do" + * @exception Exception + */ + @RequestMapping(value = "/sym/mnu/mpm/EgovMenuRegistInsert.do") + public String insertMenuManage( + @RequestParam Map commandMap, + @ModelAttribute("menuManageVO") MenuManageVO menuManageVO, + BindingResult bindingResult, + ModelMap model) + throws Exception { + String sLocationUrl = null; + String resultMsg = ""; + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); + if (sCmd.equals("insert")) { + beanValidator.validate(menuManageVO, bindingResult); + if (bindingResult.hasErrors()) { + sLocationUrl = "egovframework/com/sym/mnu/mpm/EgovMenuRegist"; + return sLocationUrl; + } + if (menuManageService.selectMenuNoByPk(menuManageVO) == 0) { + ComDefaultVO searchVO = new ComDefaultVO(); + searchVO.setSearchKeyword(menuManageVO.getProgrmFileNm()); + if (progrmManageService.selectProgrmNMTotCnt(searchVO) == 0) { + resultMsg = egovMessageSource.getMessage("fail.common.insert"); + sLocationUrl = "egovframework/com/sym/mnu/mpm/EgovMenuRegist"; + } else { + menuManageService.insertMenuManage(menuManageVO); + resultMsg = egovMessageSource.getMessage("success.common.insert"); + sLocationUrl = "forward:/sym/mnu/mpm/EgovMenuManageSelect.do"; + } + } else { + resultMsg = egovMessageSource.getMessage("common.isExist.msg"); + sLocationUrl = "egovframework/com/sym/mnu/mpm/EgovMenuRegist"; + } + model.addAttribute("resultMsg", resultMsg); + } else { + sLocationUrl = "egovframework/com/sym/mnu/mpm/EgovMenuRegist"; + } + return sLocationUrl; + } + + /** + * 메뉴정보를 수정 한다. + * @param menuManageVO MenuManageVO + * @return 출력페이지정보 "forward:/sym/mnu/mpm/EgovMenuManageSelect.do" + * @exception Exception + */ + @RequestMapping(value = "/sym/mnu/mpm/EgovMenuDetailSelectUpdt.do") + public String updateMenuManage( + @ModelAttribute("menuManageVO") MenuManageVO menuManageVO, + BindingResult bindingResult, + ModelMap model) + throws Exception { + String sLocationUrl = null; + String resultMsg = ""; + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + beanValidator.validate(menuManageVO, bindingResult); + if (bindingResult.hasErrors()) { + sLocationUrl = "forward:/sym/mnu/mpm/EgovMenuManageListDetailSelect.do"; + return sLocationUrl; + } + ComDefaultVO searchVO = new ComDefaultVO(); + searchVO.setSearchKeyword(menuManageVO.getProgrmFileNm()); + if (progrmManageService.selectProgrmNMTotCnt(searchVO) == 0) { + resultMsg = egovMessageSource.getMessage("fail.common.update"); + sLocationUrl = "forward:/sym/mnu/mpm/EgovMenuManageListDetailSelect.do"; + } else { + menuManageService.updateMenuManage(menuManageVO); + resultMsg = egovMessageSource.getMessage("success.common.update"); + sLocationUrl = "forward:/sym/mnu/mpm/EgovMenuManageSelect.do"; + } + model.addAttribute("resultMsg", resultMsg); + return sLocationUrl; + } + + /** + * 메뉴정보를 삭제 한다. + * @param menuManageVO MenuManageVO + * @return 출력페이지정보 "forward:/sym/mnu/mpm/EgovMenuManageSelect.do" + * @exception Exception + */ + @RequestMapping(value = "/sym/mnu/mpm/EgovMenuManageDelete.do") + public String deleteMenuManage( + @ModelAttribute("menuManageVO") MenuManageVO menuManageVO, + ModelMap model) + throws Exception { + String resultMsg = ""; + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + if (menuManageService.selectUpperMenuNoByPk(menuManageVO) != 0) { + resultMsg = egovMessageSource.getMessage("fail.common.delete.upperMenuExist"); + model.addAttribute("resultMsg", resultMsg); + return "forward:/sym/mnu/mpm/EgovMenuManageSelect.do"; + } + + menuManageService.deleteMenuManage(menuManageVO); + resultMsg = egovMessageSource.getMessage("success.common.delete"); + String _MenuNm = "%"; + menuManageVO.setMenuNm(_MenuNm); + model.addAttribute("resultMsg", resultMsg); + return "forward:/sym/mnu/mpm/EgovMenuManageSelect.do"; + } + + /** + * 메뉴리스트를 조회한다. + * @param searchVO ComDefaultVO + * @return 출력페이지정보 "sym/mnu/mpm/EgovMenuList" + * @exception Exception + */ + @IncludedInfo(name = "메뉴리스트관리", order = 1090, gid = 60) + @RequestMapping(value = "/sym/mnu/mpm/EgovMenuListSelect.do") + public String selectMenuList( + @ModelAttribute("searchVO") ComDefaultVO searchVO, + ModelMap model) + throws Exception { + String resultMsg = ""; + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + List list_menulist = menuManageService.selectMenuList(); + resultMsg = egovMessageSource.getMessage("success.common.select"); + model.addAttribute("list_menulist", list_menulist); + // model.addAttribute("resultMsg", resultMsg); + return "egovframework/com/sym/mnu/mpm/EgovMenuList"; + } + + /** + * 메뉴리스트의 메뉴정보를 등록한다. + * @param menuManageVO MenuManageVO + * @return 출력페이지정보 "sym/mnu/mpm/EgovMenuList" + * @exception Exception + */ + @RequestMapping(value = "/sym/mnu/mpm/EgovMenuListInsert.do") + public String insertMenuList( + @ModelAttribute("menuManageVO") MenuManageVO menuManageVO, + BindingResult bindingResult, + ModelMap model) + throws Exception { + String sLocationUrl = null; + String resultMsg = ""; + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + beanValidator.validate(menuManageVO, bindingResult); + if (bindingResult.hasErrors()) { + sLocationUrl = "egovframework/com/sym/mnu/mpm/EgovMenuList"; + return sLocationUrl; + } + + if (menuManageService.selectMenuNoByPk(menuManageVO) == 0) { + ComDefaultVO searchVO = new ComDefaultVO(); + searchVO.setSearchKeyword(menuManageVO.getProgrmFileNm()); + if (progrmManageService.selectProgrmNMTotCnt(searchVO) == 0) { + resultMsg = egovMessageSource.getMessage("fail.common.insert"); + sLocationUrl = "forward:/sym/mnu/mpm/EgovMenuListSelect.do"; + } else { + menuManageService.insertMenuManage(menuManageVO); + resultMsg = egovMessageSource.getMessage("success.common.insert"); + sLocationUrl = "forward:/sym/mnu/mpm/EgovMenuListSelect.do"; + } + } else { + resultMsg = egovMessageSource.getMessage("common.isExist.msg"); + sLocationUrl = "forward:/sym/mnu/mpm/EgovMenuListSelect.do"; + } + model.addAttribute("resultMsg", resultMsg); + return sLocationUrl; + } + + /** + * 메뉴리스트의 메뉴정보를 수정한다. + * @param menuManageVO MenuManageVO + * @return 출력페이지정보 "sym/mnu/mpm/EgovMenuList" + * @exception Exception + */ + @RequestMapping(value = "/sym/mnu/mpm/EgovMenuListUpdt.do") + public String updateMenuList( + @ModelAttribute("menuManageVO") MenuManageVO menuManageVO, + BindingResult bindingResult, + ModelMap model) + throws Exception { + String sLocationUrl = null; + String resultMsg = ""; + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + beanValidator.validate(menuManageVO, bindingResult); + if (bindingResult.hasErrors()) { + sLocationUrl = "forward:/sym/mnu/mpm/EgovMenuListSelect.do"; + return sLocationUrl; + } + ComDefaultVO searchVO = new ComDefaultVO(); + searchVO.setSearchKeyword(menuManageVO.getProgrmFileNm()); + if (progrmManageService.selectProgrmNMTotCnt(searchVO) == 0) { + resultMsg = egovMessageSource.getMessage("fail.common.update"); + sLocationUrl = "forward:/sym/mnu/mpm/EgovMenuListSelect.do"; + } else { + menuManageService.updateMenuManage(menuManageVO); + resultMsg = egovMessageSource.getMessage("success.common.update"); + sLocationUrl = "forward:/sym/mnu/mpm/EgovMenuListSelect.do"; + } + model.addAttribute("resultMsg", resultMsg); + return sLocationUrl; + } + + /** + * 메뉴리스트의 메뉴정보를 삭제한다. + * @param menuManageVO MenuManageVO + * @return 출력페이지정보 "sym/mnu/mpm/EgovMenuList" + * @exception Exception + */ + @RequestMapping(value = "/sym/mnu/mpm/EgovMenuListDelete.do") + public String deleteMenuList( + @ModelAttribute("menuManageVO") MenuManageVO menuManageVO, + BindingResult bindingResult, + ModelMap model) + throws Exception { + String sLocationUrl = null; + String resultMsg = ""; + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + beanValidator.validate(menuManageVO, bindingResult); + if (bindingResult.hasErrors()) { + sLocationUrl = "egovframework/com/sym/mnu/mpm/EgovMenuList"; + return sLocationUrl; + } + menuManageService.deleteMenuManage(menuManageVO); + resultMsg = egovMessageSource.getMessage("success.common.delete"); + sLocationUrl = "forward:/sym/mnu/mpm/EgovMenuListSelect.do"; + model.addAttribute("resultMsg", resultMsg); + return sLocationUrl; + } + + /** + * 메뉴리스트의 메뉴정보를 이동 메뉴목록을 조회한다. + * @param searchVO ComDefaultVO + * @return 출력페이지정보 "sym/mnu/mpm/EgovMenuMvmn" + * @exception Exception + */ + @RequestMapping(value = "/sym/mnu/mpm/EgovMenuListSelectMvmn.do") + public String selectMenuListMvmn( + @ModelAttribute("searchVO") ComDefaultVO searchVO, + ModelMap model) + throws Exception { + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + List list_menulist = menuManageService.selectMenuList(); + model.addAttribute("list_menulist", list_menulist); + return "egovframework/com/sym/mnu/mpm/EgovMenuMvmn"; + } + + /** + * 메뉴리스트의 메뉴정보를 이동 메뉴목록을 조회한다. (New) + * @param searchVO ComDefaultVO + * @return 출력페이지정보 "sym/mnu/mpm/EgovMenuMvmn" + * @exception Exception + */ + @RequestMapping(value = "/sym/mnu/mpm/EgovMenuListSelectMvmnNew.do") + public String selectMenuListMvmnNew( + @ModelAttribute("searchVO") ComDefaultVO searchVO, + ModelMap model) + throws Exception { + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + List list_menulist = menuManageService.selectMenuList(); + model.addAttribute("list_menulist", list_menulist); + return "egovframework/com/sym/mnu/mpm/EgovMenuMvmnNew"; + } + + /*### 일괄처리 프로세스 ###*/ + + /** + * 메뉴생성 일괄삭제프로세스 + * @param menuManageVO MenuManageVO + * @return 출력페이지정보 "sym/mnu/mpm/EgovMenuBndeRegist" + * @exception Exception + */ + @RequestMapping(value = "/sym/mnu/mpm/EgovMenuBndeAllDelete.do") + public String menuBndeAllDelete( + @ModelAttribute("menuManageVO") MenuManageVO menuManageVO, + ModelMap model) + throws Exception { + String resultMsg = ""; + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + menuManageService.menuBndeAllDelete(); + resultMsg = egovMessageSource.getMessage("success.common.delete"); + model.addAttribute("resultMsg", resultMsg); + return "egovframework/com/sym/mnu/mpm/EgovMenuBndeRegist"; + } + + /** + * 메뉴일괄등록화면 호출 및 메뉴일괄등록처리 프로세스 + * @param commandMap Map + * @param menuManageVO MenuManageVO + * @param request HttpServletRequest + * @return 출력페이지정보 "sym/mnu/mpm/EgovMenuBndeRegist" + * @exception Exception + */ + @RequestMapping(value = "/sym/mnu/mpm/EgovMenuBndeRegist.do") + public String menuBndeRegist( + @RequestParam Map commandMap, + final HttpServletRequest request, + @ModelAttribute("menuManageVO") MenuManageVO menuManageVO, + ModelMap model) + throws Exception { + String sLocationUrl = null; + String resultMsg = ""; + String sMessage = ""; + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); + if (sCmd.equals("bndeInsert")) { + //final MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) request; + final MultipartHttpServletRequest multiRequest = WebUtils.getNativeRequest(request, + MultipartHttpServletRequest.class); + if (multiRequest != null) {//2022.01 Possible null pointer dereference due to return value of called method + final Map files = multiRequest.getFileMap(); + Iterator> itr = files.entrySet().iterator(); + MultipartFile file; + while (itr.hasNext()) { + Entry entry = itr.next(); + file = entry.getValue(); + if (file.getOriginalFilename() != null && !"".equals(file.getOriginalFilename())) { + // 2011.10.07 업로드 파일에 대한 확장자를 체크 + if (file.getOriginalFilename().endsWith(".xls") + || file.getOriginalFilename().endsWith(".xlsx") + || file.getOriginalFilename().endsWith(".XLS") + || file.getOriginalFilename().endsWith(".XLSX")) { + + if (menuManageService.menuBndeAllDelete()) { + // KISA 보안약점 조치 - 자원해제 + InputStream is = null; + try { + is = file.getInputStream(); + sMessage = menuManageService.menuBndeRegist(menuManageVO, is); + } catch (IOException e) { + throw new IOException(e); + } finally { + if (is != null) {//2022.01.Possible null pointer dereference in method on exception path 처리 + is.close(); + } + } + resultMsg = sMessage; + + } else { + resultMsg = egovMessageSource.getMessage("fail.common.msg"); + menuManageVO.setTmpCmd("EgovMenuBndeRegist Error!!"); + model.addAttribute("resultVO", menuManageVO); + } + } else { + LOGGER.info("xls, xlsx 파일 타입만 등록이 가능합니다."); + resultMsg = egovMessageSource.getMessage("fail.common.msg"); + model.addAttribute("resultMsg", resultMsg); + return "egovframework/com/sym/mnu/mpm/EgovMenuBndeRegist"; + } + // *********** 끝 *********** + + } else { + resultMsg = egovMessageSource.getMessage("fail.common.msg"); + } + file = null; + } + + } + sLocationUrl = "egovframework/com/sym/mnu/mpm/EgovMenuBndeRegist"; + model.addAttribute("resultMsg", resultMsg); + } else { + sLocationUrl = "egovframework/com/sym/mnu/mpm/EgovMenuBndeRegist"; + } + return sLocationUrl; + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sym/mnu/stm/service/EgovSiteMapngService.java b/src/main/java/egovframework/com/sym/mnu/stm/service/EgovSiteMapngService.java new file mode 100644 index 0000000..1e1e2e5 --- /dev/null +++ b/src/main/java/egovframework/com/sym/mnu/stm/service/EgovSiteMapngService.java @@ -0,0 +1,30 @@ +package egovframework.com.sym.mnu.stm.service; + +import egovframework.com.cmm.ComDefaultVO; + +/** + * 메뉴사이트맵에 관한 서비스 인터페이스 클래스를 정의한다. + * @author 개발환경 개발팀 이용 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이  용          최초 생성
    + *
    + * 
    + */ +public interface EgovSiteMapngService { + + /** + * 사이트맵 조회 + * @param vo ComDefaultVO + * @return SiteMapngVO + * @exception Exception + */ + SiteMapngVO selectSiteMapng(ComDefaultVO vo) throws Exception; +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sym/mnu/stm/service/SiteMapngVO.java b/src/main/java/egovframework/com/sym/mnu/stm/service/SiteMapngVO.java new file mode 100644 index 0000000..ceaa880 --- /dev/null +++ b/src/main/java/egovframework/com/sym/mnu/stm/service/SiteMapngVO.java @@ -0,0 +1,107 @@ +package egovframework.com.sym.mnu.stm.service; + +/** + * 사이트맵 조회를 위한 VO 클래스르를 정의한다. + * @author 개발환경 개발팀 이용 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이  용          최초 생성
    + *
    + * 
    + */ +public class SiteMapngVO{ + + /** 메뉴생성내역 */ + /** 보안설정대상ID */ + private String scrtyEstbstrgetId; + + /** 사이트맵 */ + /** 생성자ID **/ + private String creatPersonId; + /** 맵생성ID */ + private String mapCreatId; + /** 맵파일명 */ + private String bndeFileNm; + /** 맵파일경로 */ + private String bndeFilePath; + + /** + * scrtyEstbstrgetId attribute를 리턴한다. + * @return String + */ + public String getScrtyEstbstrgetId() { + return scrtyEstbstrgetId; + } + /** + * scrtyEstbstrgetId attribute 값을 설정한다. + * @param scrtyEstbstrgetId String + */ + public void setScrtyEstbstrgetId(String scrtyEstbstrgetId) { + this.scrtyEstbstrgetId = scrtyEstbstrgetId; + } + /** + * creatPersonId attribute를 리턴한다. + * @return String + */ + public String getCreatPersonId() { + return creatPersonId; + } + /** + * creatPersonId attribute 값을 설정한다. + * @param creatPersonId String + */ + public void setCreatPersonId(String creatPersonId) { + this.creatPersonId = creatPersonId; + } + /** + * mapCreatId attribute를 리턴한다. + * @return String + */ + public String getMapCreatId() { + return mapCreatId; + } + /** + * mapCreatId attribute 값을 설정한다. + * @param mapCreatId String + */ + public void setMapCreatId(String mapCreatId) { + this.mapCreatId = mapCreatId; + } + /** + * bndeFileNm attribute를 리턴한다. + * @return String + */ + public String getBndeFileNm() { + return bndeFileNm; + } + /** + * bndeFileNm attribute 값을 설정한다. + * @param bndeFileNm String + */ + public void setBndeFileNm(String bndeFileNm) { + this.bndeFileNm = bndeFileNm; + } + /** + * bndeFilePath attribute를 리턴한다. + * @return String + */ + public String getBndeFilePath() { + return bndeFilePath; + } + /** + * bndeFilePath attribute 값을 설정한다. + * @param bndeFilePath String + */ + public void setBndeFilePath(String bndeFilePath) { + this.bndeFilePath = bndeFilePath; + } + + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sym/mnu/stm/service/impl/EgovSiteMapngServiceImpl.java b/src/main/java/egovframework/com/sym/mnu/stm/service/impl/EgovSiteMapngServiceImpl.java new file mode 100644 index 0000000..0d72e05 --- /dev/null +++ b/src/main/java/egovframework/com/sym/mnu/stm/service/impl/EgovSiteMapngServiceImpl.java @@ -0,0 +1,52 @@ +package egovframework.com.sym.mnu.stm.service.impl; + +import egovframework.com.cmm.ComDefaultVO; +import egovframework.com.sym.mnu.stm.service.EgovSiteMapngService; +import egovframework.com.sym.mnu.stm.service.SiteMapngVO; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +/** + * 사이트맵 조회를 처리하는 비즈니스 구현 클래스를 정의한다. + * @author 개발환경 개발팀 이용 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이  용          최초 생성
    + *
    + * 
    + */ +@Service("siteMapngService") +public class EgovSiteMapngServiceImpl extends EgovAbstractServiceImpl implements EgovSiteMapngService{ + + @Resource(name="siteMapngDAO") + private SiteMapngDAO siteMapngDAO; + + /** + * 사이트맵 조회 + * @param vo ComDefaultVO + * @return SiteMapngVO + * @exception Exception + */ + + @Override + @SuppressWarnings("unused") + public SiteMapngVO selectSiteMapng(ComDefaultVO vo) throws Exception{ + String sMapCreatID = null; + + SiteMapngVO sitemapngvo = new SiteMapngVO(); + sMapCreatID = siteMapngDAO.selectSiteMapngByMapCreatID(vo); + vo.setSearchKeyword(sMapCreatID); + return siteMapngDAO.selectSiteMapng(vo); + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sym/mnu/stm/service/impl/SiteMapngDAO.java b/src/main/java/egovframework/com/sym/mnu/stm/service/impl/SiteMapngDAO.java new file mode 100644 index 0000000..ef2ddbd --- /dev/null +++ b/src/main/java/egovframework/com/sym/mnu/stm/service/impl/SiteMapngDAO.java @@ -0,0 +1,47 @@ +package egovframework.com.sym.mnu.stm.service.impl; + +import egovframework.com.cmm.ComDefaultVO; +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.sym.mnu.stm.service.SiteMapngVO; + +import org.springframework.stereotype.Repository; +/** + * 사이트맵 조회에 대한 DAO 클래스를 정의한다. + * @author 개발환경 개발팀 이용 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이  용          최초 생성
    + *
    + * 
    + */ +@Repository("siteMapngDAO") +public class SiteMapngDAO extends EgovComAbstractDAO{ + + /** + * 사이트맵 조회 + * @param vo ComDefaultVO + * @return SiteMapngVO + * @exception Exception + */ + public SiteMapngVO selectSiteMapng(ComDefaultVO vo)throws Exception{ + return (SiteMapngVO)selectOne("siteMapngDAO.selectSiteMapng_D", vo); + } + + /** + * MapCreatId 조회 + * @param vo ComDefaultVO + * @return String + * @exception Exception + */ + public String selectSiteMapngByMapCreatID(ComDefaultVO vo)throws Exception{ + return (String)selectOne("siteMapngDAO.selectSiteMapngByMapCreatID", vo); + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sym/mnu/stm/web/EgovSiteMapngController.java b/src/main/java/egovframework/com/sym/mnu/stm/web/EgovSiteMapngController.java new file mode 100644 index 0000000..449025b --- /dev/null +++ b/src/main/java/egovframework/com/sym/mnu/stm/web/EgovSiteMapngController.java @@ -0,0 +1,82 @@ +package egovframework.com.sym.mnu.stm.web; + +import egovframework.com.cmm.ComDefaultVO; +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.sym.mnu.stm.service.EgovSiteMapngService; +import egovframework.com.sym.mnu.stm.service.SiteMapngVO; + +import org.egovframe.rte.fdl.property.EgovPropertyService; + +import javax.annotation.Resource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +/** + * 사이트맵 조회 처리를 하는 비즈니스 구현 클래스 + * @author 개발환경 개발팀 이용 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이  용          최초 생성
    + *   2011.07.29  서준식 		사이트 맵 생성 안했을 때 발생하는 오류 수정
    + *   2011.8.26	정진오			IncludedInfo annotation 추가
    + * 
    + */ + +@Controller +public class EgovSiteMapngController { + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovSiteMapngController.class); + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** EgovSiteMapngService */ + @Resource(name = "siteMapngService") + private EgovSiteMapngService siteMapngService; + + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + /*사이트맵조회*/ + /** + * 사이트맵 화면을 조회한다. + * @param searchVO ComDefaultVO + * @return 출력페이지정보 "sym/mnu/stm/EgovSiteMapng" + * @exception Exception + */ + @IncludedInfo(name="사이트맵", order = 1101 ,gid = 60) + @RequestMapping(value="/sym/mnu/stm/EgovSiteMapng.do") + public String selectSiteMapng( + @ModelAttribute("searchVO") ComDefaultVO searchVO, + ModelMap model) + throws Exception { + LoginVO user = + (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + searchVO.setSearchKeyword((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + SiteMapngVO resultVO = siteMapngService.selectSiteMapng(searchVO); + if(resultVO == null){ + model.addAttribute("resultMsg", egovMessageSource.getMessage("comSymMnuStm.siteMapng.validate.siteMap")); + return "egovframework/com/sym/mnu/stm/EgovSiteMapng"; + } + LOGGER.debug(resultVO.getBndeFileNm()); + model.addAttribute("resultVO", resultVO); + + return "egovframework/com/sym/mnu/stm/EgovSiteMapng"; + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sym/prm/service/EgovProgrmManageService.java b/src/main/java/egovframework/com/sym/prm/service/EgovProgrmManageService.java new file mode 100644 index 0000000..866e157 --- /dev/null +++ b/src/main/java/egovframework/com/sym/prm/service/EgovProgrmManageService.java @@ -0,0 +1,165 @@ +package egovframework.com.sym.prm.service; + +import java.util.List; + +import egovframework.com.cmm.ComDefaultVO; + +/** + * 프로그램관리에 관한 서비스 인터페이스 클래스를 정의한다. + * @author 개발환경 개발팀 이용 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이  용          최초 생성
    + *
    + * 
    + */ + +public interface EgovProgrmManageService { + /** + * 프로그램 상세정보를 조회 + * @param vo ComDefaultVO + * @return ProgrmManageVO + * @exception Exception + */ + ProgrmManageVO selectProgrm(ProgrmManageVO vo) throws Exception; + /** + * 프로그램 목록을 조회 + * @param vo ComDefaultVO + * @return List + * @exception Exception + */ + List selectProgrmList(ComDefaultVO vo) throws Exception; + /** + * 프로그램목록 총건수를 조회한다. + * @param vo ComDefaultVO + * @return int + * @exception Exception + */ + int selectProgrmListTotCnt(ComDefaultVO vo) throws Exception; + /** + * 프로그램 정보를 등록 + * @param vo ProgrmManageVO + * @exception Exception + */ + void insertProgrm(ProgrmManageVO vo) throws Exception; + + /** + * 프로그램 정보를 수정 + * @param vo ProgrmManageVO + * @exception Exception + */ + void updateProgrm(ProgrmManageVO vo) throws Exception; + + /** + * 프로그램 정보를 삭제 + * @param vo ProgrmManageVO + * @exception Exception + */ + void deleteProgrm(ProgrmManageVO vo) throws Exception; + + /** + * 프로그램 파일 존재여부를 조회 + * @param vo ComDefaultVO + * @return int + * @exception Exception + */ + int selectProgrmNMTotCnt(ComDefaultVO vo) throws Exception; + + /** + * 프로그램변경요청 정보를 조회 + * @param vo ProgrmManageDtlVO + * @return ProgrmManageDtlVO 프로그램변경요청 리스트 + * @exception Exception + */ + ProgrmManageDtlVO selectProgrmChangeRequst(ProgrmManageDtlVO vo) throws Exception; + + /** + * 프로그램변경요청 목록을 조회 + * @param vo ComDefaultVO + * @return List + * @exception Exception + */ + List selectProgrmChangeRequstList(ComDefaultVO vo) throws Exception; + /** + * 프로그램변경요청목록 총건수를 조회한다. + * @param vo ComDefaultVO + * @return int + * @exception Exception + */ + int selectProgrmChangeRequstListTotCnt(ComDefaultVO vo) throws Exception; + + /** + * 프로그램변경요청을 등록 + * @param vo ProgrmManageDtlVO + * @exception Exception + */ + void insertProgrmChangeRequst(ProgrmManageDtlVO vo) throws Exception; + + /** + * 프로그램변경요청을 수정 + * @param vo ProgrmManageDtlVO + * @exception Exception + */ + void updateProgrmChangeRequst(ProgrmManageDtlVO vo) throws Exception; + + /** + * 프로그램변경요청을 삭제 + * @param vo ProgrmManageDtlVO + * @exception Exception + */ + void deleteProgrmChangeRequst(ProgrmManageDtlVO vo) throws Exception; + + /** + * 프로그램변경요청 요청번호MAX 정보를 조회 + * @param vo ProgrmManageDtlVO + * @return ProgrmManageDtlVO + * @exception Exception + */ + ProgrmManageDtlVO selectProgrmChangeRequstNo(ProgrmManageDtlVO vo) throws Exception; + + /** + * 프로그램변경요청처리 목록을 조회 + * @param vo ComDefaultVO + * @return List + * @exception Exception + */ + List selectChangeRequstProcessList(ComDefaultVO vo) throws Exception; + + /** + * 프로그램변경요청처리목록 총건수를 조회한다. + * @param vo ComDefaultVO + * @return int + * @exception Exception + */ + int selectChangeRequstProcessListTotCnt(ComDefaultVO vo) throws Exception; + + /** + * 프로그램변경요청처리를 수정 + * @param vo ProgrmManageDtlVO + * @exception Exception + */ + void updateProgrmChangeRequstProcess(ProgrmManageDtlVO vo) throws Exception; + + /** + * 화면에 조회된 메뉴 목록 정보를 데이터베이스에서 삭제 + * @param checkedProgrmFileNmForDel String + * @exception Exception + */ + void deleteProgrmManageList(String checkedProgrmFileNmForDel) throws Exception; + + /** + * 프로그램변경요청자 Email 정보를 조회 + * @param vo ProgrmManageDtlVO + * @return ProgrmManageDtlVO 프로그램변경요청 리스트 + * @exception Exception + */ + ProgrmManageDtlVO selectRqesterEmail(ProgrmManageDtlVO vo) throws Exception; + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sym/prm/service/ProgrmManage.java b/src/main/java/egovframework/com/sym/prm/service/ProgrmManage.java new file mode 100644 index 0000000..bccdcfd --- /dev/null +++ b/src/main/java/egovframework/com/sym/prm/service/ProgrmManage.java @@ -0,0 +1,72 @@ +package egovframework.com.sym.prm.service; + +/** + * 프로그램목록 관리 생성을 위한 모델 클래스를 정의한다. + * @author 공통서비스 개발팀 이 용 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이용          최초 생성
    + *
    + * 
    + */ + +public class ProgrmManage { + /** + * 프로그램설명 + */ + private String progrmDc; + /** + * 프로그램파일명 + */ + private String progrmFileNm; + /** + * 프로그램한글명 + */ + private String progrmKoreanNm; + /** + * 프로그램저장경로 + */ + private String progrmStrePath; + /** + * URL + */ + private String url; + + public String getProgrmDc() { + return progrmDc; + } + public void setProgrmDc(String progrmDc) { + this.progrmDc = progrmDc; + } + public String getProgrmFileNm() { + return progrmFileNm; + } + public void setProgrmFileNm(String progrmFileNm) { + this.progrmFileNm = progrmFileNm; + } + public String getProgrmKoreanNm() { + return progrmKoreanNm; + } + public void setProgrmKoreanNm(String progrmKoreanNm) { + this.progrmKoreanNm = progrmKoreanNm; + } + public String getProgrmStrePath() { + return progrmStrePath; + } + public void setProgrmStrePath(String progrmStrePath) { + this.progrmStrePath = progrmStrePath; + } + public String getUrl() { + return url; + } + public void setUrl(String urlTemp) { + url = urlTemp; + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sym/prm/service/ProgrmManageDtlVO.java b/src/main/java/egovframework/com/sym/prm/service/ProgrmManageDtlVO.java new file mode 100644 index 0000000..a82576e --- /dev/null +++ b/src/main/java/egovframework/com/sym/prm/service/ProgrmManageDtlVO.java @@ -0,0 +1,266 @@ +package egovframework.com.sym.prm.service; + +/** + * 프로그램변경관리 처리를 위한 VO 클래스르를 정의한다 + * @author 개발환경 개발팀 이용 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이  용          최초 생성
    + *
    + * 
    + */ + +public class ProgrmManageDtlVO{ + + /** 프로그램파일명 */ + private String progrmFileNm; + /** 요청번호 */ + private int rqesterNo; + /** 요청제목 */ + private String rqesterSj; + /** 요청자ID */ + private String rqesterPersonId; + /** 요청일자 */ + private String rqesterDe; + /** 변경요청내용 */ + private String changerqesterCn; + /** 처리자ID */ + private String opetrId; + /** 처리상태코드 */ + private String processSttus; + /** 처리일자 */ + private String processDe; + /** 요청처리내용 */ + private String rqesterProcessCn; + + /** 요청시작일자 */ + private String rqesterDeBegin; + /** 요청종료일자 */ + private String rqesterDeEnd; + + /** 프로그램파일명 */ + private String tmpProgrmNm; + /** 요청번호 */ + private int tmpRqesterNo; + /** tmp_Email */ + private String tmpEmail; + + /** + * progrmFileNm attribute를 리턴한다. + * @return String + */ + public String getProgrmFileNm() { + return progrmFileNm; + } + /** + * progrmFileNm attribute 값을 설정한다. + * @param progrmFileNm String + */ + public void setProgrmFileNm(String progrmFileNm) { + this.progrmFileNm = progrmFileNm; + } + /** + * rqesterNo attribute를 리턴한다. + * @return int + */ + public int getRqesterNo() { + return rqesterNo; + } + /** + * rqesterNo attribute 값을 설정한다. + * @param rqesterNo int + */ + public void setRqesterNo(int rqesterNo) { + this.rqesterNo = rqesterNo; + } + /** + * rqesterSj attribute를 리턴한다. + * @return String + */ + public String getRqesterSj() { + return rqesterSj; + } + /** + * rqesterSj attribute 값을 설정한다. + * @param rqesterSj String + */ + public void setRqesterSj(String rqesterSj) { + this.rqesterSj = rqesterSj; + } + /** + * rqesterPersonId attribute를 리턴한다. + * @return String + */ + public String getRqesterPersonId() { + return rqesterPersonId; + } + /** + * rqesterPersonId attribute 값을 설정한다. + * @param rqesterPersonId String + */ + public void setRqesterPersonId(String rqesterPersonId) { + this.rqesterPersonId = rqesterPersonId; + } + /** + * rqesterDe attribute를 리턴한다. + * @return String + */ + public String getRqesterDe() { + return rqesterDe; + } + /** + * rqesterDe attribute 값을 설정한다. + * @param rqesterDe String + */ + public void setRqesterDe(String rqesterDe) { + this.rqesterDe = rqesterDe; + } + /** + * changerqesterCn attribute를 리턴한다. + * @return String + */ + public String getChangerqesterCn() { + return changerqesterCn; + } + /** + * changerqesterCn attribute 값을 설정한다. + * @param changerqesterCn String + */ + public void setChangerqesterCn(String changerqesterCn) { + this.changerqesterCn = changerqesterCn; + } + /** + * opetrId attribute를 리턴한다. + * @return String + */ + public String getOpetrId() { + return opetrId; + } + /** + * opetrId attribute 값을 설정한다. + * @param opetrId String + */ + public void setOpetrId(String opetrId) { + this.opetrId = opetrId; + } + /** + * processSttus attribute를 리턴한다. + * @return String + */ + public String getProcessSttus() { + return processSttus; + } + /** + * processSttus attribute 값을 설정한다. + * @param processSttus String + */ + public void setProcessSttus(String processSttus) { + this.processSttus = processSttus; + } + /** + * processDe attribute를 리턴한다. + * @return String + */ + public String getProcessDe() { + return processDe; + } + /** + * processDe attribute 값을 설정한다. + * @param processDe String + */ + public void setProcessDe(String processDe) { + this.processDe = processDe; + } + /** + * rqesterProcessCn attribute를 리턴한다. + * @return String + */ + public String getRqesterProcessCn() { + return rqesterProcessCn; + } + /** + * rqesterProcessCn attribute 값을 설정한다. + * @param rqesterProcessCn String + */ + public void setRqesterProcessCn(String rqesterProcessCn) { + this.rqesterProcessCn = rqesterProcessCn; + } + /** + * rqesterDeBegin attribute를 리턴한다. + * @return String + */ + public String getRqesterDeBegin() { + return rqesterDeBegin; + } + /** + * rqesterDeBegin attribute 값을 설정한다. + * @param rqesterDeBegin String + */ + public void setRqesterDeBegin(String rqesterDeBegin) { + this.rqesterDeBegin = rqesterDeBegin; + } + /** + * rqesterDeEnd attribute를 리턴한다. + * @return String + */ + public String getRqesterDeEnd() { + return rqesterDeEnd; + } + /** + * rqesterDeEnd attribute 값을 설정한다. + * @param rqesterDeEnd String + */ + public void setRqesterDeEnd(String rqesterDeEnd) { + this.rqesterDeEnd = rqesterDeEnd; + } + /** + * tmp_progrmNm attribute를 리턴한다. + * @return String + */ + public String getTmpProgrmNm() { + return tmpProgrmNm; + } + /** + * tmp_progrmNm attribute 값을 설정한다. + * @param tmp_progrmNm String + */ + public void setTmpProgrmNm(String tmp_progrmNm) { + this.tmpProgrmNm = tmp_progrmNm; + } + /** + * tmp_rqesterNo attribute를 리턴한다. + * @return int + */ + public int getTmpRqesterNo() { + return tmpRqesterNo; + } + /** + * tmp_rqesterNo attribute 값을 설정한다. + * @param tmp_rqesterNo int + */ + public void setTmpRqesterNo(int tmp_rqesterNo) { + this.tmpRqesterNo = tmp_rqesterNo; + } + + /** + * tmp_Email attribute를 리턴한다. + * @return String + */ + public String getTmpEmail() { + return tmpEmail; + } + /** + * tmp_Email attribute 값을 설정한다. + * @param tmp_Email String + */ + public void setTmpEmail(String tmp_Email) { + this.tmpEmail = tmp_Email; + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sym/prm/service/ProgrmManageDtls.java b/src/main/java/egovframework/com/sym/prm/service/ProgrmManageDtls.java new file mode 100644 index 0000000..c11f616 --- /dev/null +++ b/src/main/java/egovframework/com/sym/prm/service/ProgrmManageDtls.java @@ -0,0 +1,122 @@ +package egovframework.com.sym.prm.service; + +/** + * 프로그램변경요청 관리 생성을 위한 모델 클래스를 정의한다. + * @author 공통서비스 개발팀 이 용 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이용          최초 생성
    + *
    + * 
    + */ + +public class ProgrmManageDtls { + + /** + * 변경요청내용 + */ + private String changerqesterCn; + /** + * 처리자ID + */ + private String opetrId; + /** + * 처리일자 + */ + private String processDe; + public String getChangerqesterCn() { + return changerqesterCn; + } + public void setChangerqesterCn(String changerqesterCn) { + this.changerqesterCn = changerqesterCn; + } + public String getOpetrId() { + return opetrId; + } + public void setOpetrId(String opetrId) { + this.opetrId = opetrId; + } + public String getProcessDe() { + return processDe; + } + public void setProcessDe(String processDe) { + this.processDe = processDe; + } + public String getProcessSttus() { + return processSttus; + } + public void setProcessSttus(String processSttus) { + this.processSttus = processSttus; + } + public String getProgrmFileNm() { + return progrmFileNm; + } + public void setProgrmFileNm(String progrmFileNm) { + this.progrmFileNm = progrmFileNm; + } + public String getRqesterDe() { + return rqesterDe; + } + public void setRqesterDe(String rqesterDe) { + this.rqesterDe = rqesterDe; + } + public int getRqesterNo() { + return rqesterNo; + } + public void setRqesterNo(int rqesterNo) { + this.rqesterNo = rqesterNo; + } + public String getRqesterpersonId() { + return rqesterpersonId; + } + public void setRqesterpersonId(String rqesterpersonId) { + this.rqesterpersonId = rqesterpersonId; + } + public String getRqesterProcessCn() { + return rqesterProcessCn; + } + public void setRqesterProcessCn(String rqesterProcessCn) { + this.rqesterProcessCn = rqesterProcessCn; + } + public String getRqesterSj() { + return rqesterSj; + } + public void setRqesterSj(String rqesterSj) { + this.rqesterSj = rqesterSj; + } + /** + * 처리상태코드 + */ + private String processSttus; + /** + * 프로그램파일명 + */ + private String progrmFileNm; + /** + * 요청일자 + */ + private String rqesterDe; + /** + * 요청번호 + */ + private int rqesterNo; + /** + * 요청자ID + */ + private String rqesterpersonId; + /** + * 요청처리내용 + */ + private String rqesterProcessCn; + /** + * 요청제목 + */ + private String rqesterSj; +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sym/prm/service/ProgrmManageVO.java b/src/main/java/egovframework/com/sym/prm/service/ProgrmManageVO.java new file mode 100644 index 0000000..6eb353a --- /dev/null +++ b/src/main/java/egovframework/com/sym/prm/service/ProgrmManageVO.java @@ -0,0 +1,104 @@ +package egovframework.com.sym.prm.service; + +/** + * 프로그램목록 처리를 위한 VO 클래스르를 정의한다 + * @author 개발환경 개발팀 이용 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이  용          최초 생성
    + *
    + * 
    + */ + +public class ProgrmManageVO{ + + /** 프로그램파일명 */ + private String progrmFileNm; + /** 프로그램저장경로 */ + private String progrmStrePath; + /** 프로그램한글명 */ + private String progrmKoreanNm; + /** URL */ + private String url; + /** 프로그램설명 */ + private String progrmDc; + + /** + * progrmFileNm attribute를 리턴한다. + * @return String + */ + public String getProgrmFileNm() { + return progrmFileNm; + } + /** + * progrmFileNm attribute 값을 설정한다. + * @param progrmFileNm String + */ + public void setProgrmFileNm(String progrmFileNm) { + this.progrmFileNm = progrmFileNm; + } + /** + * progrmStrePath attribute를 리턴한다. + * @return String + */ + public String getProgrmStrePath() { + return progrmStrePath; + } + /** + * progrmStrePath attribute 값을 설정한다. + * @param progrmStrePath String + */ + public void setProgrmStrePath(String progrmStrePath) { + this.progrmStrePath = progrmStrePath; + } + /** + * progrmKoreanNm attribute를 리턴한다. + * @return String + */ + public String getProgrmKoreanNm() { + return progrmKoreanNm; + } + /** + * progrmKoreanNm attribute 값을 설정한다. + * @param progrmKoreanNm String + */ + public void setProgrmKoreanNm(String progrmKoreanNm) { + this.progrmKoreanNm = progrmKoreanNm; + } + /** + * url attribute를 리턴한다. + * @return String + */ + public String getURL() { + return url; + } + /** + * URL attribute 값을 설정한다. + * @param URL String + */ + public void setURL(String URL) { + this.url = URL; + } + /** + * progrmDc attribute를 리턴한다. + * @return String + */ + public String getProgrmDc() { + return progrmDc; + } + /** + * progrmDc attribute 값을 설정한다. + * @param progrmDc String + */ + public void setProgrmDc(String progrmDc) { + this.progrmDc = progrmDc; + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sym/prm/service/impl/EgovProgrmManageServiceImpl.java b/src/main/java/egovframework/com/sym/prm/service/impl/EgovProgrmManageServiceImpl.java new file mode 100644 index 0000000..5644e6c --- /dev/null +++ b/src/main/java/egovframework/com/sym/prm/service/impl/EgovProgrmManageServiceImpl.java @@ -0,0 +1,244 @@ +package egovframework.com.sym.prm.service.impl; + +import java.util.List; + +import egovframework.com.cmm.ComDefaultVO; +import egovframework.com.sym.prm.service.EgovProgrmManageService; +import egovframework.com.sym.prm.service.ProgrmManageDtlVO; +import egovframework.com.sym.prm.service.ProgrmManageVO; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +/** + * 프로그램목록관리 및 프로그램변경관리에 관한 비즈니스 구현 클래스를 정의한다. + * @author 개발환경 개발팀 이용 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이  용          최초 생성
    + *
    + * 
    + */ +@Service("progrmManageService") +public class EgovProgrmManageServiceImpl extends EgovAbstractServiceImpl implements EgovProgrmManageService { + + @Resource(name="progrmManageDAO") + private ProgrmManageDAO progrmManageDAO; + + + /** + * 프로그램 상세정보를 조회 + * @param vo ComDefaultVO + * @return ProgrmManageVO + * @exception Exception + */ + @Override + public ProgrmManageVO selectProgrm(ProgrmManageVO vo) throws Exception{ + return progrmManageDAO.selectProgrm(vo); + } + /** + * 프로그램 목록을 조회 + * @param vo ComDefaultVO + * @return List + * @exception Exception + */ + @Override + public List selectProgrmList(ComDefaultVO vo) throws Exception { + return progrmManageDAO.selectProgrmList(vo); + } + /** + * 프로그램목록 총건수를 조회한다. + * @param vo ComDefaultVO + * @return Integer + * @exception Exception + */ + @Override + public int selectProgrmListTotCnt(ComDefaultVO vo) throws Exception { + return progrmManageDAO.selectProgrmListTotCnt(vo); + } + /** + * 프로그램 정보를 등록 + * @param vo ProgrmManageVO + * @exception Exception + */ + @Override + public void insertProgrm(ProgrmManageVO vo) throws Exception { + progrmManageDAO.insertProgrm(vo); + } + + /** + * 프로그램 정보를 수정 + * @param vo ProgrmManageVO + * @exception Exception + */ + @Override + public void updateProgrm(ProgrmManageVO vo) throws Exception { + progrmManageDAO.updateProgrm(vo); + } + + /** + * 프로그램 정보를 삭제 + * @param vo ProgrmManageVO + * @exception Exception + */ + @Override + public void deleteProgrm(ProgrmManageVO vo) throws Exception { + progrmManageDAO.deleteProgrm(vo); + } + + /** + * 프로그램 파일 존재여부를 조회 + * @param vo ComDefaultVO + * @return int + * @exception Exception + */ + @Override + public int selectProgrmNMTotCnt(ComDefaultVO vo) throws Exception{ + return progrmManageDAO.selectProgrmNMTotCnt(vo); + } + + /** + * 프로그램변경요청 정보를 조회 + * @param vo ProgrmManageDtlVO + * @return ProgrmManageDtlVO + * @exception Exception + */ + @Override + public ProgrmManageDtlVO selectProgrmChangeRequst(ProgrmManageDtlVO vo) throws Exception{ + return progrmManageDAO.selectProgrmChangeRequst(vo); + } + + /** + * 프로그램변경요청 목록을 조회 + * @param vo ComDefaultVO + * @return List + * @exception Exception + */ + @Override + public List selectProgrmChangeRequstList(ComDefaultVO vo) throws Exception { + return progrmManageDAO.selectProgrmChangeRequstList(vo); + } + + /** + * 프로그램변경요청목록 총건수를 조회한다. + * @param vo ComDefaultVO + * @return int + * @exception Exception + */ + @Override + public int selectProgrmChangeRequstListTotCnt(ComDefaultVO vo) throws Exception { + return progrmManageDAO.selectProgrmChangeRequstListTotCnt(vo); + } + + /** + * 프로그램변경요청을 등록 + * @param vo ProgrmManageDtlVO + * @exception Exception + */ + @Override + public void insertProgrmChangeRequst(ProgrmManageDtlVO vo) throws Exception { + progrmManageDAO.insertProgrmChangeRequst(vo); + } + + /** + * 프로그램변경요청을 수정 + * @param vo ProgrmManageDtlVO + * @exception Exception + */ + @Override + public void updateProgrmChangeRequst(ProgrmManageDtlVO vo) throws Exception { + progrmManageDAO.updateProgrmChangeRequst(vo); + } + + /** + * 프로그램변경요청을 삭제 + * @param vo ProgrmManageDtlVO + * @exception Exception + */ + @Override + public void deleteProgrmChangeRequst(ProgrmManageDtlVO vo) throws Exception { + progrmManageDAO.deleteProgrmChangeRequst(vo); + } + + /** + * 프로그램변경요청 요청번호MAX 정보를 조회 + * @param vo ProgrmManageDtlVO + * @return ProgrmManageDtlVO + * @exception Exception + */ + @Override + public ProgrmManageDtlVO selectProgrmChangeRequstNo(ProgrmManageDtlVO vo) throws Exception { + return progrmManageDAO.selectProgrmChangeRequstNo(vo); + } + + /** + * 프로그램변경요청처리 목록을 조회 + * @param vo ComDefaultVO + * @return List + * @exception Exception + */ + @Override + public List selectChangeRequstProcessList(ComDefaultVO vo) throws Exception { + return progrmManageDAO.selectChangeRequstProcessList(vo); + } + + /** + * 프로그램변경요청처리목록 총건수를 조회한다. + * @param vo ComDefaultVO + * @return int + * @exception Exception + */ + @Override + public int selectChangeRequstProcessListTotCnt(ComDefaultVO vo) throws Exception { + return progrmManageDAO.selectChangeRequstListProcessTotCnt(vo); + } + + /** + * 프로그램변경요청처리를 수정 + * @param vo ProgrmManageDtlVO + * @exception Exception + */ + @Override + public void updateProgrmChangeRequstProcess(ProgrmManageDtlVO vo) throws Exception { + progrmManageDAO.updateProgrmChangeRequstProcess(vo); + } + + /** + * 화면에 조회된 메뉴 목록 정보를 데이터베이스에서 삭제 + * @param checkedProgrmFileNmForDel String + * @exception Exception + */ + @Override + public void deleteProgrmManageList(String checkedProgrmFileNmForDel) throws Exception { + ProgrmManageVO vo = null; + String [] delProgrmFileNm = checkedProgrmFileNmForDel.split(","); + for (int i=0; i + * << 개정이력(Modification Information) >> + * + * 수정일 수정자 수정내용 + * ------- -------- --------------------------- + * 2009.03.20 이 용 최초 생성 + * + * + */ + +@Repository("progrmManageDAO") +public class ProgrmManageDAO extends EgovComAbstractDAO { + + /** + * 프로그램 목록을 조회 + * @param vo ComDefaultVO + * @return List + * @exception Exception + */ + public List selectProgrmList(ComDefaultVO vo) throws Exception{ + return selectList("progrmManageDAO.selectProgrmList_D", vo); + } + + /** + * 프로그램목록 총건수를 조회한다. + * @param vo ComDefaultVO + * @return int + * @exception Exception + */ + public int selectProgrmListTotCnt(ComDefaultVO vo) { + return (Integer)selectOne("progrmManageDAO.selectProgrmListTotCnt_S", vo); + } + + /** + * 프로그램 기본정보를 조회 + * @param vo ComDefaultVO + * @return ProgrmManageVO + * @exception Exception + */ + public ProgrmManageVO selectProgrm(ProgrmManageVO vo)throws Exception{ + return (ProgrmManageVO)selectOne("progrmManageDAO.selectProgrm_D", vo); + } + + /** + * 프로그램 기본정보 및 URL을 등록 + * @param vo ProgrmManageVO + * @exception Exception + */ + public void insertProgrm(ProgrmManageVO vo){ + insert("progrmManageDAO.insertProgrm_S", vo); + } + + /** + * 프로그램 기본정보 및 URL을 수정 + * @param vo ProgrmManageVO + * @exception Exception + */ + public void updateProgrm(ProgrmManageVO vo){ + update("progrmManageDAO.updateProgrm_S", vo); + } + + /** + * 프로그램 기본정보 및 URL을 삭제 + * @param vo ProgrmManageVO + * @exception Exception + */ + public void deleteProgrm(ProgrmManageVO vo){ + delete("progrmManageDAO.deleteProgrm_S", vo); + } + + /** + * 프로그램 파일 존재여부를 조회 + * @param vo ProgrmManageVO + * @return int + * @exception Exception + */ + public int selectProgrmNMTotCnt(ComDefaultVO vo) throws Exception{ + return (Integer)selectOne("progrmManageDAO.selectProgrmNMTotCnt", vo); + } + + + /** + * 프로그램변경요청 목록을 조회 + * @param vo ComDefaultVO + * @return List + * @exception Exception + */ + + public List selectProgrmChangeRequstList(ComDefaultVO vo) throws Exception{ + return selectList("progrmManageDAO.selectProgrmChangeRequstList_D", vo); + } + + /** + * 프로그램변경요청 총건수를 조회한다. + * @param vo ComDefaultVO + * @return int + * @exception Exception + */ + public int selectProgrmChangeRequstListTotCnt(ComDefaultVO vo) { + return (Integer)selectOne("progrmManageDAO.selectProgrmChangeRequstListTotCnt_S", vo); + } + + /** + * 프로그램변경요청 정보를 조회 + * @param vo ProgrmManageDtlVO + * @return ProgrmManageDtlVO + * @exception Exception + */ + public ProgrmManageDtlVO selectProgrmChangeRequst(ProgrmManageDtlVO vo)throws Exception{ + return (ProgrmManageDtlVO)selectOne("progrmManageDAO.selectProgrmChangeRequst_D", vo); + } + + /** + * 프로그램변경요청을 등록 + * @param vo ProgrmManageDtlVO + * @exception Exception + */ + public void insertProgrmChangeRequst(ProgrmManageDtlVO vo){ + insert("progrmManageDAO.insertProgrmChangeRequst_S", vo); + } + + /** + * 프로그램변경요청을 수정 + * @param vo ProgrmManageDtlVO + * @exception Exception + */ + public void updateProgrmChangeRequst(ProgrmManageDtlVO vo){ + update("progrmManageDAO.updateProgrmChangeRequst_S", vo); + } + + /** + * 프로그램변경요청을 삭제 + * @param vo ProgrmManageDtlVO + * @exception Exception + */ + public void deleteProgrmChangeRequst(ProgrmManageDtlVO vo){ + delete("progrmManageDAO.deleteProgrmChangeRequst_S", vo); + } + + /** + * 프로그램변경요청 요청번호MAX 정보를 조회 + * @param vo ProgrmManageDtlVO + * @return ProgrmManageDtlVO + * @exception Exception + */ + public ProgrmManageDtlVO selectProgrmChangeRequstNo(ProgrmManageDtlVO vo){ + return (ProgrmManageDtlVO)selectOne("progrmManageDAO.selectProgrmChangeRequstNo_D", vo); + } + + /** + * 프로그램변경요청 목록을 조회 + * @param vo ComDefaultVO + * @return List + * @exception Exception + */ + public List selectChangeRequstProcessList(ComDefaultVO vo) throws Exception{ + return selectList("progrmManageDAO.selectChangeRequstProcessList_D", vo); + } + + /** + * 프로그램변경요청 총건수를 조회한다. + * @param vo ComDefaultVO + * @return int + * @exception Exception + */ + public int selectChangeRequstListProcessTotCnt(ComDefaultVO vo) { + return (Integer)selectOne("progrmManageDAO.selectChangeRequstProcessListTotCnt_S", vo); + } + + /** + * 프로그램변경요청 처리 수정 + * @param vo ProgrmManageDtlVO + * @exception Exception + */ + public void updateProgrmChangeRequstProcess(ProgrmManageDtlVO vo){ + update("progrmManageDAO.updateProgrmChangeRequstProcess_S", vo); + } + + + /** + * 프로그램목록 전체삭제 초기화 + * @return boolean + * @exception Exception + */ + public boolean deleteAllProgrm(){ + ProgrmManageVO vo = new ProgrmManageVO(); + update("progrmManageDAO.deleteAllProgrm", vo); + return true; + } + + /** + * 프로그램변경내역 전체삭제 초기화 + * @return boolean + * @exception Exception + */ + public boolean deleteAllProgrmDtls(){ + ProgrmManageDtlVO vo = new ProgrmManageDtlVO(); + update("progrmManageDAO.deleteAllProgrmDtls", vo); + return true; + } + + /** + * 프로그램목록 데이타 존재여부 조회한다. + * @return int + * @exception Exception + */ + public int selectProgrmListTotCnt() { + ProgrmManageVO vo = new ProgrmManageVO(); + return (Integer)selectOne("progrmManageDAO.selectProgrmListTotCnt", vo); + } + + /** + * 프로그램변경요청자 Email 정보를 조회 + * @param vo ProgrmManageDtlVO + * @return ProgrmManageDtlVO + * @exception Exception + */ + public ProgrmManageDtlVO selectRqesterEmail(ProgrmManageDtlVO vo){ + return (ProgrmManageDtlVO)selectOne("progrmManageDAO.selectRqesterEmail", vo); + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/sym/prm/web/EgovProgrmManageController.java b/src/main/java/egovframework/com/sym/prm/web/EgovProgrmManageController.java new file mode 100644 index 0000000..12e5906 --- /dev/null +++ b/src/main/java/egovframework/com/sym/prm/web/EgovProgrmManageController.java @@ -0,0 +1,808 @@ +package egovframework.com.sym.prm.web; + +import java.util.List; +import java.util.Map; + +import egovframework.com.cmm.ComDefaultVO; +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.cop.ems.service.EgovSndngMailRegistService; +import egovframework.com.cop.ems.service.SndngMailVO; +import egovframework.com.sym.prm.service.EgovProgrmManageService; +import egovframework.com.sym.prm.service.ProgrmManageDtlVO; +import egovframework.com.sym.prm.service.ProgrmManageVO; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +import javax.annotation.Resource; + +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; + +/** + * 프로그램목록 관리및 변경을 처리하는 비즈니스 구현 클래스 + * @author 개발환경 개발팀 이용 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  이  용          최초 생성
    + *   2011.08.22  서준식          selectProgrmChangRequstProcess() 메서드 처리일자 trim 처리
    + *   2011.8.26	정진오			IncludedInfo annotation 추가
    + * 
    + */ + +@Controller +public class EgovProgrmManageController { + + /** Validator */ + @Autowired + private DefaultBeanValidator beanValidator; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** EgovProgrmManageService */ + @Resource(name = "progrmManageService") + private EgovProgrmManageService progrmManageService; + + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + /** EgovSndngMailRegistService */ + @Resource(name = "sndngMailRegistService") + private EgovSndngMailRegistService sndngMailRegistService; + + /** + * 프로그램목록을 상세화면 호출 및 상세조회한다. + * @param tmp_progrmNm String + * @return 출력페이지정보 "sym/prm/EgovProgramListDetailSelectUpdt" + * @exception Exception + */ + @RequestMapping(value="/sym/prm/EgovProgramListDetailSelect.do") + public String selectProgrm( + @RequestParam("tmp_progrmNm") String tmp_progrmNm , + @ModelAttribute("searchVO") ComDefaultVO searchVO, + ModelMap model) + throws Exception { + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if(!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + ProgrmManageVO vo = new ProgrmManageVO(); + vo.setProgrmFileNm(tmp_progrmNm); + ProgrmManageVO progrmManageVO = progrmManageService.selectProgrm(vo); + model.addAttribute("progrmManageVO", progrmManageVO); + return "egovframework/com/sym/prm/EgovProgramListDetailSelectUpdt"; + } + + /** + * 프로그램목록 리스트조회한다. + * @param searchVO ComDefaultVO + * @return 출력페이지정보 "sym/prm/EgovProgramListManage" + * @exception Exception + */ + @IncludedInfo(name="프로그램관리",order = 1111 ,gid = 60) + @RequestMapping(value="/sym/prm/EgovProgramListManageSelect.do") + public String selectProgrmList( + @ModelAttribute("searchVO") ComDefaultVO searchVO, + ModelMap model) + throws Exception { + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if(!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + // 내역 조회 + /** 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()); + + List list_progrmmanage = progrmManageService.selectProgrmList(searchVO); + model.addAttribute("list_progrmmanage", list_progrmmanage); + model.addAttribute("searchVO", searchVO); + + int totCnt = progrmManageService.selectProgrmListTotCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/sym/prm/EgovProgramListManage"; + + } + + /** + * 프로그램목록 멀티 삭제한다. + * @param checkedProgrmFileNmForDel String + * @return 출력페이지정보 "forward:/sym/prm/EgovProgramListManageSelect.do" + * @exception Exception + */ + @RequestMapping("/sym/prm/EgovProgrmManageListDelete.do") + public String deleteProgrmManageList( + @RequestParam("checkedProgrmFileNmForDel") String checkedProgrmFileNmForDel , + @ModelAttribute("progrmManageVO") ProgrmManageVO progrmManageVO, + ModelMap model) + throws Exception { + String sLocationUrl = null; + String resultMsg = ""; + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if(!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + String [] delProgrmFileNm = checkedProgrmFileNmForDel.split(","); + if (delProgrmFileNm == null || (delProgrmFileNm.length ==0)){ + resultMsg = egovMessageSource.getMessage("fail.common.delete"); + sLocationUrl = "forward:/sym/prm/EgovProgramListManageSelect.do"; + }else{ + progrmManageService.deleteProgrmManageList(checkedProgrmFileNmForDel); + resultMsg = egovMessageSource.getMessage("success.common.delete"); + sLocationUrl ="forward:/sym/prm/EgovProgramListManageSelect.do"; + } + model.addAttribute("resultMsg", resultMsg); + //status.setComplete(); + return sLocationUrl ; + } + + /** + * 프로그램목록을 등록화면으로 이동 및 등록 한다. + * @param progrmManageVO ProgrmManageVO + * @param commandMap Map + * @return 출력페이지정보 등록화면 호출시 "sym/prm/EgovProgramListRegist", + * 출력페이지정보 등록처리시 "forward:/sym/prm/EgovProgramListManageSelect.do" + * @exception Exception + */ + @RequestMapping(value="/sym/prm/EgovProgramListRegist.do") + public String insertProgrmList( + @RequestParam Map commandMap, + @ModelAttribute("progrmManageVO") ProgrmManageVO progrmManageVO, + BindingResult bindingResult, + ModelMap model) + throws Exception { + String resultMsg = ""; + String sLocationUrl = null; + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if(!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); + if(sCmd.equals("insert")){ + beanValidator.validate(progrmManageVO, bindingResult); + if (bindingResult.hasErrors()){ + sLocationUrl = "egovframework/com/sym/prm/EgovProgramListRegist"; + return sLocationUrl; + } + if(progrmManageVO.getProgrmDc()==null || progrmManageVO.getProgrmDc().equals("")){progrmManageVO.setProgrmDc(" ");} + progrmManageService.insertProgrm(progrmManageVO); + resultMsg = egovMessageSource.getMessage("success.common.insert"); + sLocationUrl = "forward:/sym/prm/EgovProgramListManageSelect.do"; + }else{ + sLocationUrl = "egovframework/com/sym/prm/EgovProgramListRegist"; + } + model.addAttribute("resultMsg", resultMsg); + return sLocationUrl; + } + + /** + * 프로그램목록을 수정 한다. + * @param progrmManageVO ProgrmManageVO + * @return 출력페이지정보 "forward:/sym/prm/EgovProgramListManageSelect.do" + * @exception Exception + */ + /*프로그램목록수정*/ + @RequestMapping(value="/sym/prm/EgovProgramListDetailSelectUpdt.do") + public String updateProgrmList( + @ModelAttribute("progrmManageVO") ProgrmManageVO progrmManageVO, + BindingResult bindingResult, + ModelMap model) + throws Exception { + String resultMsg = ""; + String sLocationUrl = null; + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if(!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + beanValidator.validate(progrmManageVO, bindingResult); + if (bindingResult.hasErrors()){ + sLocationUrl = "forward:/sym/prm/EgovProgramListDetailSelect.do"; + return sLocationUrl; + } + if(progrmManageVO.getProgrmDc()==null || progrmManageVO.getProgrmDc().equals("")){progrmManageVO.setProgrmDc(" ");} + progrmManageService.updateProgrm(progrmManageVO); + resultMsg = egovMessageSource.getMessage("success.common.update"); + sLocationUrl = "forward:/sym/prm/EgovProgramListManageSelect.do"; + model.addAttribute("resultMsg", resultMsg); + return sLocationUrl; + } + + /** + * 프로그램목록을 삭제 한다. + * @param progrmManageVO ProgrmManageVO + * @return 출력페이지정보 "forward:/sym/prm/EgovProgramListManageSelect.do" + * @exception Exception + */ + @RequestMapping(value="/sym/prm/EgovProgramListManageDelete.do") + public String deleteProgrmList( + @ModelAttribute("progrmManageVO") + ProgrmManageVO progrmManageVO, + ModelMap model) + throws Exception { + String resultMsg = ""; + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if(!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + progrmManageService.deleteProgrm(progrmManageVO); + resultMsg = egovMessageSource.getMessage("success.common.delete"); + model.addAttribute("resultMsg", resultMsg); + return "forward:/sym/prm/EgovProgramListManageSelect.do"; + } + + /** + * 프로그램변경요청목록 조회한다. + * @param searchVO ComDefaultVO + * @return 출력페이지정보 "sym/prm/EgovProgramChangeRequst" + * @exception Exception + */ + @IncludedInfo(name="프로그램변경요청관리",order = 1112 ,gid = 60) + @RequestMapping(value="/sym/prm/EgovProgramChangeRequstSelect.do") + public String selectProgrmChangeRequstList( + @ModelAttribute("searchVO") ComDefaultVO searchVO, + ModelMap model) + throws Exception { + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if(!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + // 내역 조회 + /** 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()); + + List list_changerequst = progrmManageService.selectProgrmChangeRequstList(searchVO); + model.addAttribute("list_changerequst", list_changerequst); + + int totCnt = progrmManageService.selectProgrmChangeRequstListTotCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/sym/prm/EgovProgramChangeRequst"; + } + + /** + * 프로그램변경요청목록을 상세조회한다. + * @param progrmManageDtlVO ProgrmManageDtlVO + * @return 출력페이지정보 "sym/prm/EgovProgramChangRequstDetailSelectUpdt" + * @exception Exception + */ + @RequestMapping(value="/sym/prm/EgovProgramChangRequstDetailSelect.do") + public String selectProgrmChangeRequst( + @ModelAttribute("progrmManageDtlVO") ProgrmManageDtlVO progrmManageDtlVO, + ModelMap model) + throws Exception { + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if(!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + if(progrmManageDtlVO.getProgrmFileNm()== null||progrmManageDtlVO.getProgrmFileNm().equals("")){ + String FileNm = progrmManageDtlVO.getTmpProgrmNm(); + progrmManageDtlVO.setProgrmFileNm(FileNm); + int tmpNo = progrmManageDtlVO.getTmpRqesterNo(); + progrmManageDtlVO.setRqesterNo(tmpNo); + } + ProgrmManageDtlVO resultVO = progrmManageService.selectProgrmChangeRequst(progrmManageDtlVO); + model.addAttribute("progrmManageDtlVO", resultVO); + return "egovframework/com/sym/prm/EgovProgramChangRequstDetailSelectUpdt"; + } + + /** + * 프로그램변경요청 화면을 호출및 프로그램변경요청을 등록한다. + * @param progrmManageDtlVO ProgrmManageDtlVO + * @param commandMap Map + * @return 출력페이지정보 등록화면 호출시 "sym/prm/EgovProgramChangRequstStre", + * 출력페이지정보 등록처리시 "forward:/sym/prm/EgovProgramChangeRequstSelect.do" + * @exception Exception + */ + /*프로그램변경요청등록*/ + @RequestMapping(value="/sym/prm/EgovProgramChangRequstStre.do") + public String insertProgrmChangeRequst( + @RequestParam Map commandMap, + @ModelAttribute("progrmManageDtlVO") ProgrmManageDtlVO progrmManageDtlVO, + BindingResult bindingResult, + ModelMap model) + throws Exception { + String resultMsg = ""; + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if(!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + //로그인 객체 선언 + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + String sLocationUrl = null; + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); + if(sCmd.equals("insert")){ + //beanValidator 처리 + beanValidator.validate(progrmManageDtlVO, bindingResult); + if (bindingResult.hasErrors()){ + sLocationUrl = "egovframework/com/sym/prm/EgovProgramChangRequstStre"; + return sLocationUrl; + } + if(progrmManageDtlVO.getChangerqesterCn()==null || progrmManageDtlVO.getChangerqesterCn().equals("")){progrmManageDtlVO.setChangerqesterCn("");} + if(progrmManageDtlVO.getRqesterProcessCn()==null || progrmManageDtlVO.getRqesterProcessCn().equals("")){progrmManageDtlVO.setRqesterProcessCn("");} + progrmManageService.insertProgrmChangeRequst(progrmManageDtlVO); + resultMsg = egovMessageSource.getMessage("success.common.insert"); + sLocationUrl = "forward:/sym/prm/EgovProgramChangeRequstSelect.do"; + }else{ + /* MAX요청번호 조회 */ + ProgrmManageDtlVO tmp_vo = progrmManageService.selectProgrmChangeRequstNo(progrmManageDtlVO); + int _tmp_no = tmp_vo.getRqesterNo(); + progrmManageDtlVO.setRqesterNo(_tmp_no); + progrmManageDtlVO.setRqesterPersonId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + sLocationUrl = "egovframework/com/sym/prm/EgovProgramChangRequstStre"; + } + model.addAttribute("resultMsg", resultMsg); + return sLocationUrl; + } + + /** + * 프로그램변경 요청을 수정 한다. + * @param progrmManageDtlVO ProgrmManageDtlVO + * @return 출력페이지정보 "forward:/sym/prm/EgovProgramChangeRequstSelect.do" + * @exception Exception + */ + @RequestMapping(value="/sym/prm/EgovProgramChangRequstDetailSelectUpdt.do") + public String updateProgrmChangeRequst( + @ModelAttribute("progrmManageDtlVO") ProgrmManageDtlVO progrmManageDtlVO, + BindingResult bindingResult, + ModelMap model) + throws Exception { + String sLocationUrl = null; + String resultMsg = ""; + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if(!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + //로그인 객체 선언 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + //beanValidator 처리 + beanValidator.validate(progrmManageDtlVO, bindingResult); + if (bindingResult.hasErrors()){ + sLocationUrl = "forward:/sym/prm/EgovProgramChangRequstDetailSelect.do"; + return sLocationUrl; + } + + //KISA 보안약점 조치 (2018-10-29, 윤창원) + if(EgovStringUtil.isNullToString(progrmManageDtlVO.getRqesterPersonId()).equals(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId()))){ + if(progrmManageDtlVO.getChangerqesterCn()==null || progrmManageDtlVO.getChangerqesterCn().equals("")){progrmManageDtlVO.setChangerqesterCn(" ");} + if(progrmManageDtlVO.getRqesterProcessCn()==null || progrmManageDtlVO.getRqesterProcessCn().equals("")){progrmManageDtlVO.setRqesterProcessCn(" ");} + progrmManageService.updateProgrmChangeRequst(progrmManageDtlVO); + resultMsg = egovMessageSource.getMessage("success.common.update"); + sLocationUrl = "forward:/sym/prm/EgovProgramChangeRequstSelect.do"; + }else{ + resultMsg = "수정이 실패하였습니다. 변경요청 수정은 변경요청자만 수정가능합니다."; + progrmManageDtlVO.setTmpProgrmNm(progrmManageDtlVO.getProgrmFileNm()); + progrmManageDtlVO.setTmpRqesterNo(progrmManageDtlVO.getRqesterNo()); + sLocationUrl = "forward:/sym/prm/EgovProgramChangRequstDetailSelect.do"; + } + model.addAttribute("resultMsg", resultMsg); + return sLocationUrl; + } + + /** + * 프로그램변경 요청을 삭제 한다. + * @param progrmManageDtlVO ProgrmManageDtlVO + * @return 출력페이지정보 "forward:/sym/prm/EgovProgramChangeRequstSelect.do" + * @exception Exception + */ + @RequestMapping(value="/sym/prm/EgovProgramChangRequstDelete.do") + public String deleteProgrmChangeRequst( + @ModelAttribute("progrmManageDtlVO") ProgrmManageDtlVO progrmManageDtlVO, + ModelMap model) + throws Exception { + String sLocationUrl = null; + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if(!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + //로그인 객체 선언 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + //KISA 보안약점 조치 (2018-10-29, 윤창원) + if(EgovStringUtil.isNullToString(progrmManageDtlVO.getRqesterPersonId()).equals(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId()))){ + //progrmManageDtlVO.setRqesterPersonId(user.getId()); + model.addAttribute("resultMsg", egovMessageSource.getMessage("success.common.delete")); + progrmManageService.deleteProgrmChangeRequst(progrmManageDtlVO); + sLocationUrl = "forward:/sym/prm/EgovProgramChangeRequstSelect.do"; + }else{ + model.addAttribute("resultMsg", egovMessageSource.getMessage("comSymPrm.progrmManageController.checkRqesterPersonId")); //삭제에 실패하였습니다. 변경요청자만 삭제가능합니다. + sLocationUrl = "forward:/sym/prm/EgovProgramChangRequstDetailSelect.do"; + } + return sLocationUrl; + } + + /** + * 프로그램변경 요청에 대한 처리 사항을 조회한다. + * @param searchVO ComDefaultVO + * @return 출력페이지정보 "sym/prm/EgovProgramChangeRequstProcess" + * @exception Exception + */ + @IncludedInfo(name="프로그램변경요청처리",order = 1113 ,gid = 60) + @RequestMapping(value="/sym/prm/EgovProgramChangeRequstProcessListSelect.do") + public String selectProgrmChangeRequstProcessList( + @ModelAttribute("searchVO") ComDefaultVO searchVO, + ModelMap model) + throws Exception { + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if(!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + // 내역 조회 + /** 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()); + + List list_changerequst = progrmManageService.selectChangeRequstProcessList(searchVO); + model.addAttribute("list_changerequst", list_changerequst); + + int totCnt = progrmManageService.selectChangeRequstProcessListTotCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/sym/prm/EgovProgramChangeRequstProcess"; + } + + /** + * 프로그램변경 요청에 대한 처리 사항을 상세조회한다. + * @param progrmManageDtlVO ProgrmManageDtlVO + * @return 출력페이지정보 "sym/prm/EgovProgramChangRequstProcessDetailSelectUpdt" + * @exception Exception + */ + @RequestMapping(value="/sym/prm/EgovProgramChangRequstProcessDetailSelect.do") + public String selectProgrmChangRequstProcess( + @ModelAttribute("progrmManageDtlVO") ProgrmManageDtlVO progrmManageDtlVO, + ModelMap model) + throws Exception { + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if(!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + if(progrmManageDtlVO.getProgrmFileNm()==null){ + String _FileNm = progrmManageDtlVO.getTmpProgrmNm(); + progrmManageDtlVO.setProgrmFileNm(_FileNm); + int _Tmp_no = progrmManageDtlVO.getTmpRqesterNo(); + progrmManageDtlVO.setRqesterNo(_Tmp_no); + } + ProgrmManageDtlVO resultVO = progrmManageService.selectProgrmChangeRequst(progrmManageDtlVO); + if(resultVO.getProcessDe() != null){ + resultVO.setProcessDe(resultVO.getProcessDe().trim());//2011.08.22 + } + + if(resultVO.getOpetrId()== null){ + LoginVO user = + (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + resultVO.setOpetrId(user == null ? "" : EgovStringUtil.isNullToString(user.getId())); + } + model.addAttribute("progrmManageDtlVO", resultVO); + return "egovframework/com/sym/prm/EgovProgramChangRequstProcessDetailSelectUpdt"; + } + + /** + * 프로그램변경요청처리 내용을 수정 한다. + * @param progrmManageDtlVO ProgrmManageDtlVO + * @return 출력페이지정보 "forward:/sym/prm/EgovProgramChangeRequstProcessListSelect.do" + * @exception Exception + */ + @SuppressWarnings("unused") + @RequestMapping(value="/sym/prm/EgovProgramChangRequstProcessDetailSelectUpdt.do") + public String updateProgrmChangRequstProcess( + @ModelAttribute("progrmManageDtlVO") ProgrmManageDtlVO progrmManageDtlVO, + BindingResult bindingResult, + ModelMap model) + throws Exception { + String sLocationUrl = null; + boolean result = true; + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if(!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + beanValidator.validate(progrmManageDtlVO, bindingResult); + if (bindingResult.hasErrors()){ + sLocationUrl = "forward:/sym/prm/EgovProgramChangRequstProcessDetailSelect.do"; + return sLocationUrl; + } + + LoginVO user = + (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + //KISA 보안약점 조치 (2018-10-29, 윤창원) + if (progrmManageDtlVO.getOpetrId() != null) { + if(progrmManageDtlVO.getOpetrId().equals(user == null ? "" : EgovStringUtil.isNullToString(user.getId()))){ + if(progrmManageDtlVO.getChangerqesterCn()==null || progrmManageDtlVO.getChangerqesterCn().equals("")){progrmManageDtlVO.setChangerqesterCn(" ");} + if(progrmManageDtlVO.getRqesterProcessCn()==null || progrmManageDtlVO.getRqesterProcessCn().equals("")){progrmManageDtlVO.setRqesterProcessCn(" ");} + progrmManageService.updateProgrmChangeRequstProcess(progrmManageDtlVO); + model.addAttribute("resultMsg", egovMessageSource.getMessage("success.common.update")); + + ProgrmManageDtlVO vo = new ProgrmManageDtlVO(); + vo = progrmManageService.selectRqesterEmail(progrmManageDtlVO); + String sTemp = null; + //KISA 보안약점 조치 (2018-10-29, 윤창원) + if("A".equals(progrmManageDtlVO.getProcessSttus())){ + sTemp = egovMessageSource.getMessage("comSymPrm.progrmManageController.processSttusA"); //신청중 + }else if("P".equals(progrmManageDtlVO.getProcessSttus())){ + sTemp = egovMessageSource.getMessage("comSymPrm.progrmManageController.processSttusP"); //진행중 + }else if("R".equals(progrmManageDtlVO.getProcessSttus())){ + sTemp = egovMessageSource.getMessage("comSymPrm.progrmManageController.processSttusR"); //반려 + }else if("C".equals(progrmManageDtlVO.getProcessSttus())){ + sTemp = egovMessageSource.getMessage("comSymPrm.progrmManageController.processSttusC"); //처리완료 + } + // 프로그램 변경요청 사항을 이메일로 발송한다.(메일연동솔루션 활용) + SndngMailVO sndngMailVO = new SndngMailVO(); + sndngMailVO.setDsptchPerson(user == null ? "" : EgovStringUtil.isNullToString(user.getId())); + sndngMailVO.setRecptnPerson(vo.getTmpEmail()); + sndngMailVO.setSj(egovMessageSource.getMessage("comSymPrm.progrmManageController.email.Sj")); //프로그램변경요청 처리. + sndngMailVO.setEmailCn(egovMessageSource.getMessage("comSymPrm.progrmManageController.email.emailCn")+" : "+sTemp); //프로그램 변경요청 사항이 처리 되었습니다 + sndngMailVO.setAtchFileId(null); + result = sndngMailRegistService.insertSndngMail(sndngMailVO); + sLocationUrl = "forward:/sym/prm/EgovProgramChangeRequstProcessListSelect.do"; + }else{ + model.addAttribute("resultMsg", egovMessageSource.getMessage("comSymPrm.progrmManageController.updateProgrmChangRequstProcess.fail")); //수정이 실패하였습니다. 변경요청처리 수정은 변경처리해당 담당자만 처리가능합니다. + progrmManageDtlVO.setTmpProgrmNm(progrmManageDtlVO.getProgrmFileNm()); + progrmManageDtlVO.setTmpRqesterNo(progrmManageDtlVO.getRqesterNo()); + sLocationUrl = "forward:/sym/prm/EgovProgramChangRequstProcessDetailSelect.do"; + } + } + return sLocationUrl; + } + + /** + * 프로그램변경요청처리를 삭제 한다. + * @param progrmManageDtlVO ProgrmManageDtlVO + * @return 출력페이지정보 "forward:/sym/prm/EgovProgramChangeRequstProcessListSelect.do" + * @exception Exception + */ + /*프로그램변경요청처리 삭제*/ + @RequestMapping(value="/sym/prm/EgovProgramChangRequstProcessDelete.do") + public String deleteProgrmChangRequstProcess( + @ModelAttribute("progrmManageDtlVO") ProgrmManageDtlVO progrmManageDtlVO, + ModelMap model) + throws Exception { + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if(!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + progrmManageService.deleteProgrmChangeRequst(progrmManageDtlVO); + + return "forward:/sym/prm/EgovProgramChangeRequstProcessListSelect.do"; + } + + /** + * 프로그램변경이력리스트를 조회한다. + * @param searchVO ComDefaultVO + * @return 출력페이지정보 "sym/prm/EgovProgramChgHst" + * @exception Exception + */ + @IncludedInfo(name="프로그램변경이력",order = 1114 ,gid = 60) + @RequestMapping(value="/sym/prm/EgovProgramChgHstListSelect.do") + public String selectProgrmChgHstList( + @ModelAttribute("searchVO") ComDefaultVO searchVO, + ModelMap model) + throws Exception { + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if(!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + // 내역 조회 + /** 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()); + + List list_changerequst = progrmManageService.selectProgrmChangeRequstList(searchVO); + model.addAttribute("list_changerequst", list_changerequst); + + int totCnt = progrmManageService.selectProgrmChangeRequstListTotCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/sym/prm/EgovProgramChgHst"; + } + + /*프로그램변경이력상세조회*/ + /** + * 프로그램변경이력을 상세조회한다. + * @param progrmManageDtlVO ProgrmManageDtlVO + * @return 출력페이지정보 "sym/prm/EgovProgramChgHstDetail" + * @exception Exception + */ + @RequestMapping(value="/sym/prm/EgovProgramChgHstListDetailSelect.do") + public String selectProgramChgHstListDetail( + @ModelAttribute("progrmManageDtlVO") ProgrmManageDtlVO progrmManageDtlVO, + ModelMap model) + throws Exception { + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if(!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + String _FileNm = progrmManageDtlVO.getTmpProgrmNm(); + progrmManageDtlVO.setProgrmFileNm(_FileNm); + int _tmp_no = progrmManageDtlVO.getTmpRqesterNo(); + progrmManageDtlVO.setRqesterNo(_tmp_no); + + ProgrmManageDtlVO resultVO = progrmManageService.selectProgrmChangeRequst(progrmManageDtlVO); + model.addAttribute("resultVO", resultVO); + return "egovframework/com/sym/prm/EgovProgramChgHstDetail"; + } + + /** + * 프로그램파일명을 조회한다. + * @param searchVO ComDefaultVO + * @return 출력페이지정보 "sym/prm/EgovFileNmSearch" + * @exception Exception + */ + @RequestMapping(value="/sym/prm/EgovProgramListSearch.do") + public String selectProgrmListSearch( + @ModelAttribute("searchVO") ComDefaultVO searchVO, + ModelMap model) + throws Exception { + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if(!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + // 내역 조회 + 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()); + + List list_progrmmanage = progrmManageService.selectProgrmList(searchVO); + model.addAttribute("list_progrmmanage", list_progrmmanage); + + int totCnt = progrmManageService.selectProgrmListTotCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/sym/prm/EgovFileNmSearch"; + + } + + /** + * 프로그램파일명을 조회한다. (New) + * @param searchVO ComDefaultVO + * @return 출력페이지정보 "sym/prm/EgovFileNmSearch" + * @exception Exception + */ + @RequestMapping(value="/sym/prm/EgovProgramListSearchNew.do") + public String selectProgrmListSearchNew( + @ModelAttribute("searchVO") ComDefaultVO searchVO, + ModelMap model) + throws Exception { + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if(!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + // 내역 조회 + 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()); + + List list_progrmmanage = progrmManageService.selectProgrmList(searchVO); + model.addAttribute("list_progrmmanage", list_progrmmanage); + + int totCnt = progrmManageService.selectProgrmListTotCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/sym/prm/EgovFileNmSearchNew"; + + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uat/sso/filter/EgovSSOLoginFilter.java b/src/main/java/egovframework/com/uat/sso/filter/EgovSSOLoginFilter.java new file mode 100644 index 0000000..e3f3afa --- /dev/null +++ b/src/main/java/egovframework/com/uat/sso/filter/EgovSSOLoginFilter.java @@ -0,0 +1,152 @@ +package egovframework.com.uat.sso.filter; + +import java.io.IOException; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.NoSuchBeanDefinitionException; +import org.springframework.context.ApplicationContext; +import org.springframework.web.context.support.WebApplicationContextUtils; + +import egovframework.com.cmm.LoginVO; +import egovframework.com.uat.sso.service.EgovSSOService; +import egovframework.com.uat.uia.service.EgovLoginService; + +/** + * + * @author 공통서비스 개발팀 서준식 + * @since 2011. 8. 2. + * @version 1.0 + * @see + * + *
    + * 개정이력(Modification Information)
    + *
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2011. 8. 2.    서준식        최초생성
    + *
    + *  
    + */ + +public class EgovSSOLoginFilter implements Filter { + + private FilterConfig config; + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovSSOLoginFilter.class); + + @Override + public void destroy() {} + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) + throws IOException, ServletException { + + ApplicationContext act = WebApplicationContextUtils + .getRequiredWebApplicationContext(config.getServletContext()); + EgovSSOService egovSSOService = null; + try { + egovSSOService = (EgovSSOService)act.getBean("egovSSOService"); + if (egovSSOService == null) { + LOGGER.error("Fail to create 'EgovSSOService' object"); + chain.doFilter(request, response); + return; + } + } catch (NoSuchBeanDefinitionException ex) { + LOGGER.error("No SSO ServiceImpl Class!"); + } + + EgovLoginService loginService = (EgovLoginService)act.getBean("loginService"); + + HttpServletRequest httpRequest = (HttpServletRequest)request; + HttpSession session = httpRequest.getSession(); + String isLocallyAuthenticated = (String)session.getAttribute("isLocallyAuthenticated"); + String isRemotelyAuthenticated = (String)session.getAttribute("isRemotelyAuthenticated"); + boolean isSSOLoggedOn = false; + + if (isLocallyAuthenticated != null && (isLocallyAuthenticated.equals("true"))) { + if (isRemotelyAuthenticated == null) { + try { + if(egovSSOService!=null) {//2022.01 Null pointers should not be dereferenced + // TODO egovSSOService null 일 경우 프로세스 확인 필요 + //sso서버에 토큰 생성 + egovSSOService.requestIssueToken(request, response); + } + //로컬 인증 적용 여부 완료를 세션에 저장 + session.setAttribute("isLocallyAuthenticated", "true"); + //sso 인증 완료 여부를 세션에 저장 + session.setAttribute("isRemotelyAuthenticated", "true"); + + } catch (IllegalStateException ex) {//KISA 보안약점 조치 (2018-10-29, 윤창원) + session.setAttribute("isRemotelyAuthenticated", "fail"); + LOGGER.debug("SSO Authentication fail : invalidated session {}", ex.getMessage()); + } catch (Exception ex) { + session.setAttribute("isRemotelyAuthenticated", "fail"); + LOGGER.debug("SSO Authentication fail : {}", ex.getMessage()); + } + + } + } else if (isLocallyAuthenticated == null) { + if (isRemotelyAuthenticated == null) { + if(egovSSOService!=null) {//2022.01 Null pointers should not be dereferenced + // TODO egovSSOService null 일 경우 프로세스 확인 필요 + //sso서버에 토큰이 존재하는지 체크함 + isSSOLoggedOn = egovSSOService.hasTokenInSSOServer(httpRequest, response); + if (isSSOLoggedOn) { + //서버에 토큰이 존재할 경우 로컬 인증을 위해 isRemotelyAuthenticated true로 변경 + session.setAttribute("isRemotelyAuthenticated", "true"); + + //로컬 DB인증을 위한 loginVO 객체를 세션에 저장 + session.setAttribute("loginVOForDBAuthentication", egovSSOService.getLoginVO(request, response)); + } + } + } + } + + chain.doFilter(request, response); + + isLocallyAuthenticated = (String)session.getAttribute("isLocallyAuthenticated"); + isRemotelyAuthenticated = (String)session.getAttribute("isRemotelyAuthenticated"); + + if (isLocallyAuthenticated == null) { + if (isRemotelyAuthenticated != null && isRemotelyAuthenticated.equals("true")) { + try { + //세션 토큰 정보를 가지고 DB로부터 사용자 정보를 가져옴 + LoginVO loginVO = (LoginVO)session.getAttribute("loginVOForDBAuthentication"); + loginVO = loginService.actionLoginByEsntlId(loginVO); + if (loginVO != null && loginVO.getId() != null && !loginVO.getId().equals("")) { + //세션 로그인 + session.setAttribute("loginVO", loginVO); + + //로컬 인증결과 세션에 저장 + session.setAttribute("isLocallyAuthenticated", "true"); + } else { + LOGGER.debug("Local authentication by sso is failed"); + } + } catch (IllegalStateException ex) {//KISA 보안약점 조치 (2018-10-29, 윤창원) + LOGGER.debug("Local authentication by sso is failed (Invalidated session) : {}", ex.getMessage()); + } catch (Exception ex) { + //DB인증 예외가 발생할 경우 로그를 남기고 로컬인증을 시키지 않고 그대로 진행함. + LOGGER.debug("Local authentication by sso is failed : {}", ex.getMessage()); + } + + } + } + + } + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + + this.config = filterConfig; + } +} diff --git a/src/main/java/egovframework/com/uat/sso/filter/EgovSSOLogoutFilter.java b/src/main/java/egovframework/com/uat/sso/filter/EgovSSOLogoutFilter.java new file mode 100644 index 0000000..5e71089 --- /dev/null +++ b/src/main/java/egovframework/com/uat/sso/filter/EgovSSOLogoutFilter.java @@ -0,0 +1,57 @@ +package egovframework.com.uat.sso.filter; + +import java.io.IOException; + +import egovframework.com.uat.sso.service.EgovSSOService; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; + +import org.springframework.context.ApplicationContext; +import org.springframework.web.context.support.WebApplicationContextUtils; + +/** + * + * @author 공통서비스 개발팀 서준식 + * @since 2011. 8. 29. + * @version 1.0 + * @see + * + *
    + * 개정이력(Modification Information)
    + *
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2011. 8. 29.    서준식        최초생성
    + *
    + *  
    + */ + +public class EgovSSOLogoutFilter implements Filter{ + private FilterConfig config; + + public void destroy() {} + + public void doFilter(ServletRequest request, ServletResponse response, + FilterChain chain) throws IOException, ServletException { + + ApplicationContext act = WebApplicationContextUtils.getRequiredWebApplicationContext(config.getServletContext()); + EgovSSOService egovSSOService = (EgovSSOService) act.getBean("egovSSOService"); + + String returnURL = config.getInitParameter("returnURL"); + + ((HttpServletRequest)request).getSession().setAttribute("loginVO", null); + egovSSOService.ssoLogout(request, response, ((HttpServletRequest)request).getContextPath() + returnURL); + + } + + public void init(FilterConfig filterConfig) throws ServletException { + + this.config = filterConfig; + } +} diff --git a/src/main/java/egovframework/com/uat/sso/service/EgovSSOService.java b/src/main/java/egovframework/com/uat/sso/service/EgovSSOService.java new file mode 100644 index 0000000..c449de9 --- /dev/null +++ b/src/main/java/egovframework/com/uat/sso/service/EgovSSOService.java @@ -0,0 +1,61 @@ +package egovframework.com.uat.sso.service; + +import java.io.IOException; + +import egovframework.com.cmm.LoginVO; + +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; + + +/** + * + * @author 공통서비스 개발팀 서준식 + * @since 2011. 8. 2. + * @version 1.0 + * @see + * + *
    + * 개정이력(Modification Information) 
    + * 
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2011. 8. 2.    서준식        최초생성
    + *  
    + *  
    + */ + +public interface EgovSSOService { + + /** + * SSO 통합 인증 서버에 인증여부를 확인 하는 메서드 + * + */ + public boolean hasTokenInSSOServer(ServletRequest request, ServletResponse response); + + /** + * SSO 통합 인증 서버에 인증 토큰 생성을 요청하는 메서드 + * + */ + public void requestIssueToken(ServletRequest request, ServletResponse response) throws Exception ; + + + /** + * SSO 통합 인증 서버에 인증이 된 경우 인증 서버의 토큰을 활용하여 로컬 로그인을 처리하는 메서드 + * + */ + public void ssoLoginByServer(ServletRequest request, ServletResponse response) throws Exception; + + + /** + * 토큰 정보를 바탕으로 loginVO 객체를 생성하는 메서드 + * + */ + public LoginVO getLoginVO(ServletRequest request, ServletResponse response); + + /** + * SSO 통합 인증 서버에 글로벌 로그아웃(토큰 삭제)을 요청하는 메서드 + * + */ + public void ssoLogout(ServletRequest request, ServletResponse response, String returnURL) throws IOException; +} diff --git a/src/main/java/egovframework/com/uat/uap/filter/EgovLoginPolicyFilter.java b/src/main/java/egovframework/com/uat/uap/filter/EgovLoginPolicyFilter.java new file mode 100644 index 0000000..ce3c875 --- /dev/null +++ b/src/main/java/egovframework/com/uat/uap/filter/EgovLoginPolicyFilter.java @@ -0,0 +1,126 @@ +package egovframework.com.uat.uap.filter; + +import java.io.IOException; +import java.net.URLEncoder; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.ApplicationContext; +import org.springframework.web.context.support.WebApplicationContextUtils; + +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.uat.uap.service.EgovLoginPolicyService; +import egovframework.com.uat.uap.service.LoginPolicyVO; +import egovframework.com.utl.sim.service.EgovClntInfo; + +/** + * 로그인 정책 체크 필터 + * @author 공통서비스 개발팀 서준식 + * @since 2011.07.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2011.07.01  서준식          최초 생성
    + *  2017-02-14  이정은          시큐어코딩(ES) - 시큐어코딩 부적절한 예외 처리[CWE-253, CWE-440, CWE-754]
    + *
    + *  
    + */ +public class EgovLoginPolicyFilter implements Filter { + + private FilterConfig config; + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovLoginPolicyFilter.class); + + public void destroy() { + } + + /** + * IP를 이용해 로그인을 제한하는 메서든 + * @param request + * @param response + * @param chain + * @return void + * @exception IOException, ServletException + */ + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { + + ApplicationContext act = WebApplicationContextUtils.getRequiredWebApplicationContext(config.getServletContext()); + EgovLoginPolicyService egovLoginPolicyService = (EgovLoginPolicyService) act.getBean("egovLoginPolicyService"); + EgovMessageSource egovMessageSource = (EgovMessageSource) act.getBean("egovMessageSource"); + + HttpServletRequest httpRequest = (HttpServletRequest) request; + + String id = request.getParameter("id"); + //String password = request.getParameter("password"); + String userSe = request.getParameter("userSe"); + String userIp = ""; + + if (id == null || userSe == null) { + ((HttpServletResponse) response).sendRedirect(httpRequest.getContextPath() + "/uat/uia/egovLoginUsr.do"); + } + + // 1. LoginVO를 DB로 부터 가져오는 과정 + + try { + // 접속IP + userIp = EgovClntInfo.getClntIP((HttpServletRequest) request); + + boolean loginPolicyYn = true; + + LoginPolicyVO loginPolicyVO = new LoginPolicyVO(); + loginPolicyVO.setEmplyrId(id); + loginPolicyVO = egovLoginPolicyService.selectLoginPolicy(loginPolicyVO); + + if (loginPolicyVO == null) { + loginPolicyYn = true; + } else { + if (loginPolicyVO.getLmttAt().equals("Y")) { + if (!userIp.equals(loginPolicyVO.getIpInfo())) { + loginPolicyYn = false; + } + } + } + + if (loginPolicyYn) { + chain.doFilter(request, response); + + } else { + String message = URLEncoder.encode(egovMessageSource.getMessage("fail.common.login.ip"),"UTF-8"); + ((HttpServletRequest) request).setAttribute("loginMessage", message); + ((HttpServletResponse) response).sendRedirect(httpRequest.getContextPath() + "/uat/uia/egovLoginUsr.do?loginMessage="+message); + } + + } catch (IOException e) {//KISA 보안약점 조치 (2018-10-29, 윤창원) + LOGGER.error("["+ e.getClass() +"] : ", e.getMessage()); + ((HttpServletResponse) response).sendRedirect(httpRequest.getContextPath() + "/uat/uia/egovLoginUsr.do?login_error=1"); + } catch (Exception e) { +// LOGGER.error("Exception: {}", e.getClass().getName()); +// LOGGER.error("Exception Message: {}", e.getMessage()); + // 2017-02-14 이정은 시큐어코딩(ES) - 시큐어코딩 부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + LOGGER.error("["+ e.getClass() +"] : ", e.getMessage()); + + ((HttpServletResponse) response).sendRedirect(httpRequest.getContextPath() + "/uat/uia/egovLoginUsr.do?login_error=1"); + } + } + + public void init(FilterConfig config) throws ServletException { + + this.config = config; + + } + +} diff --git a/src/main/java/egovframework/com/uat/uap/service/EgovLoginPolicyService.java b/src/main/java/egovframework/com/uat/uap/service/EgovLoginPolicyService.java new file mode 100644 index 0000000..4ae020f --- /dev/null +++ b/src/main/java/egovframework/com/uat/uap/service/EgovLoginPolicyService.java @@ -0,0 +1,76 @@ +/** + * 개요 + * - 로그인정책에 대한 Service Interface를 정의한다. + * + * 상세내용 + * - 로그인정책에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 로그인정책의 조회기능은 목록조회, 상세조회로 구분된다. + * @author lee.m.j + * @version 1.0 + * @created 03-8-2009 오후 2:08:54 + *
    + * == 개정이력(Modification Information) ==
    + * 
    + *  수정일               수정자            수정내용
    + *  ----------   --------   ---------------------------
    + *  2009.08.03   이문준            최초 생성
    + *  2021.02.18   신용호            selectLoginPolicyResult() 삭제
    + * 
    + */ + +package egovframework.com.uat.uap.service; + +import java.util.List; + + +public interface EgovLoginPolicyService { + + /** + * 로그인정책 목록을 조회한다. + * @param loginPolicyVO - 로그인정책 VO + * @return List - 로그인정책 목록 + */ + public List selectLoginPolicyList(LoginPolicyVO loginPolicyVO) throws Exception; + + /** + * 로그인정책 목록 수를 조회한다. + * @param loginPolicyVO - 로그인정책 VO + * @return int + */ + public int selectLoginPolicyListTotCnt(LoginPolicyVO loginPolicyVO) throws Exception; + + /** + * 로그인정책 목록의 상세정보를 조회한다. + * @param loginPolicyVO - 로그인정책 VO + * @return LoginPolicyVO - 로그인정책 VO + */ + public LoginPolicyVO selectLoginPolicy(LoginPolicyVO loginPolicyVO) throws Exception; + + /** + * 로그인정책 정보를 신규로 등록한다. + * @param loginPolicy - 로그인정책 model + */ + public void insertLoginPolicy(LoginPolicy loginPolicy) throws Exception; + + /** + * 기 등록된 로그인정책 정보를 수정한다. + * @param loginPolicy - 로그인정책 model + */ + public void updateLoginPolicy(LoginPolicy loginPolicy) throws Exception; + + /** + * 기 등록된 로그인정책 정보를 삭제한다. + * @param loginPolicy - 로그인정책 model + */ + public void deleteLoginPolicy(LoginPolicy loginPolicy) throws Exception; + + /** + * 로그인정책에 대한 현재 반영되어 있는 결과를 조회한다. + * @param loginPolicyVO - 로그인정책 VO + * @return LoginPolicyVO - 로그인정책 VO + */ + /* + * public LoginPolicyVO selectLoginPolicyResult(LoginPolicyVO loginPolicyVO) + * throws Exception; + */ +} diff --git a/src/main/java/egovframework/com/uat/uap/service/LoginPolicy.java b/src/main/java/egovframework/com/uat/uap/service/LoginPolicy.java new file mode 100644 index 0000000..bebbf78 --- /dev/null +++ b/src/main/java/egovframework/com/uat/uap/service/LoginPolicy.java @@ -0,0 +1,174 @@ +/** + * 개요 + * - 로그인정책에 대한 model 클래스를 정의한다. + * + * 상세내용 + * - 로그인정책정보의 사용자ID, IP정보, 중복허용여부, 제한여부 항목을 관리한다. + * @author lee.m.j + * @version 1.0 + * @created 03-8-2009 오후 2:08:53 + *
    + * == 개정이력(Modification Information) ==
    + * 
    + *   수정일       수정자           수정내용
    + *  -------     --------    ---------------------------
    + *  2009.8.3    이문준     최초 생성
    + * 
    + */ + +package egovframework.com.uat.uap.service; + +import egovframework.com.cmm.ComDefaultVO; + +public class LoginPolicy extends ComDefaultVO { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + /** + * 사용자 ID + */ + private String emplyrId; + /** + * 사용자 명 + */ + private String emplyrNm; + /** + * 사용자 구분 + */ + private String emplyrSe; + /** + * IP정보 + */ + private String ipInfo; + /** + * 중복허용여부 + */ + private String dplctPermAt; + /** + * 제한여부 + */ + private String lmttAt; + /** + * 등록자 ID + */ + private String userId; + /** + * 등록일시 + */ + private String regDate; + /** + * 등록여부 + */ + private String regYn; + + /** + * @return the emplyrId + */ + public String getEmplyrId() { + return emplyrId; + } + /** + * @param emplyrId the emplyrId to set + */ + public void setEmplyrId(String emplyrId) { + this.emplyrId = emplyrId; + } + /** + * @return the emplyrNm + */ + public String getEmplyrNm() { + return emplyrNm; + } + /** + * @param emplyrNm the emplyrNm to set + */ + public void setEmplyrNm(String emplyrNm) { + this.emplyrNm = emplyrNm; + } + /** + * @return the emplyrSe + */ + public String getEmplyrSe() { + return emplyrSe; + } + /** + * @param emplyrSe the emplyrSe to set + */ + public void setEmplyrSe(String emplyrSe) { + this.emplyrSe = emplyrSe; + } + /** + * @return the ipInfo + */ + public String getIpInfo() { + return ipInfo; + } + /** + * @param ipInfo the ipInfo to set + */ + public void setIpInfo(String ipInfo) { + this.ipInfo = ipInfo; + } + /** + * @return the dplctPermAt + */ + public String getDplctPermAt() { + return dplctPermAt; + } + /** + * @param dplctPermAt the dplctPermAt to set + */ + public void setDplctPermAt(String dplctPermAt) { + this.dplctPermAt = dplctPermAt; + } + /** + * @return the lmttAt + */ + public String getLmttAt() { + return lmttAt; + } + /** + * @param lmttAt the lmttAt to set + */ + public void setLmttAt(String lmttAt) { + this.lmttAt = lmttAt; + } + /** + * @return the userId + */ + public String getUserId() { + return userId; + } + /** + * @param userId the userId to set + */ + public void setUserId(String userId) { + this.userId = userId; + } + /** + * @return the regDate + */ + public String getRegDate() { + return regDate; + } + /** + * @param regDate the regDate to set + */ + public void setRegDate(String regDate) { + this.regDate = regDate; + } + /** + * @return the regYn + */ + public String getRegYn() { + return regYn; + } + /** + * @param regYn the regYn to set + */ + public void setRegYn(String regYn) { + this.regYn = regYn; + } +} diff --git a/src/main/java/egovframework/com/uat/uap/service/LoginPolicyVO.java b/src/main/java/egovframework/com/uat/uap/service/LoginPolicyVO.java new file mode 100644 index 0000000..8019840 --- /dev/null +++ b/src/main/java/egovframework/com/uat/uap/service/LoginPolicyVO.java @@ -0,0 +1,64 @@ +/** + * 개요 + * - 로그인정책에 대한 VO 클래스를 정의한다. + * + * 상세내용 + * - 로그인정책정보의 목록 항목을 관리한다. + * @author lee.m.j + * @version 1.0 + * @created 03-8-2009 오후 2:08:55 + *
    + * == 개정이력(Modification Information) ==
    + * 
    + *   수정일       수정자           수정내용
    + *  -------     --------    ---------------------------
    + *  2009.8.3    이문준     최초 생성
    + * 
    + */ + +package egovframework.com.uat.uap.service; + +import java.util.List; + +public class LoginPolicyVO extends LoginPolicy { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + /** + * 로그인 정책 목록 + */ + List loginPolicyList; + /** + * 삭제 여부 + */ + String [] delYn; + + /** + * @return the loginPolicyList + */ + public List getLoginPolicyList() { + return loginPolicyList; + } + /** + * @param loginPolicyList the loginPolicyList to set + */ + public void setLoginPolicyList(List loginPolicyList) { + this.loginPolicyList = loginPolicyList; + } + /** + * @return the delYn + */ + public String[] getDelYn() { + return delYn; + } + /** + * @param delYn the delYn to set + */ + public void setDelYn(String[] delYn) { + this.delYn = delYn; + } + + +} diff --git a/src/main/java/egovframework/com/uat/uap/service/impl/EgovLoginPolicyServiceImpl.java b/src/main/java/egovframework/com/uat/uap/service/impl/EgovLoginPolicyServiceImpl.java new file mode 100644 index 0000000..8c6c973 --- /dev/null +++ b/src/main/java/egovframework/com/uat/uap/service/impl/EgovLoginPolicyServiceImpl.java @@ -0,0 +1,102 @@ +/** + * 개요 + * - 로그인정책에 대한 ServiceImpl 클래스를 정의한다. + * + * 상세내용 + * - 로그인정책에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 로그인정책의 조회기능은 목록조회, 상세조회로 구분된다. + * @author lee.m.j + * @version 1.0 + * @created 03-8-2009 오후 2:08:54 + *
    + * == 개정이력(Modification Information) ==
    + * 
    + *  수정일               수정자            수정내용
    + *  ----------   --------   ---------------------------
    + *  2009.08.03   이문준            최초 생성
    + *  2021.02.18   신용호            selectLoginPolicyResult() 삭제
    + * 
    + */ + +package egovframework.com.uat.uap.service.impl; + +import java.util.List; + +import egovframework.com.uat.uap.service.EgovLoginPolicyService; +import egovframework.com.uat.uap.service.LoginPolicy; +import egovframework.com.uat.uap.service.LoginPolicyVO; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +@Service("egovLoginPolicyService") +public class EgovLoginPolicyServiceImpl extends EgovAbstractServiceImpl implements EgovLoginPolicyService { + + @Resource(name="loginPolicyDAO") + LoginPolicyDAO loginPolicyDAO; + + /** + * 로그인정책 목록을 조회한다. + * @param loginPolicyVO - 로그인정책 VO + * @return List - 로그인정책 목록 + */ + public List selectLoginPolicyList(LoginPolicyVO loginPolicyVO) throws Exception { + return loginPolicyDAO.selectLoginPolicyList(loginPolicyVO); + } + + /** + * 로그인정책 목록 수를 조회한다. + * @param loginPolicyVO - 로그인정책 VO + * @return int + */ + public int selectLoginPolicyListTotCnt(LoginPolicyVO loginPolicyVO) throws Exception { + return loginPolicyDAO.selectLoginPolicyListTotCnt(loginPolicyVO); + } + + /** + * 로그인정책 목록의 상세정보를 조회한다. + * @param loginPolicyVO - 로그인정책 VO + * @return LoginPolicyVO - 로그인정책 VO + */ + public LoginPolicyVO selectLoginPolicy(LoginPolicyVO loginPolicyVO) throws Exception { + return loginPolicyDAO.selectLoginPolicy(loginPolicyVO); + } + + /** + * 로그인정책 정보를 신규로 등록한다. + * @param loginPolicy - 로그인정책 model + */ + public void insertLoginPolicy(LoginPolicy loginPolicy) throws Exception { + loginPolicyDAO.insertLoginPolicy(loginPolicy); + } + + /** + * 기 등록된 로그인정책 정보를 수정한다. + * @param loginPolicy - 로그인정책 model + */ + public void updateLoginPolicy(LoginPolicy loginPolicy) throws Exception { + loginPolicyDAO.updateLoginPolicy(loginPolicy); + } + + /** + * 기 등록된 로그인정책 정보를 삭제한다. + * @param loginPolicy - 로그인정책 model + */ + public void deleteLoginPolicy(LoginPolicy loginPolicy) throws Exception { + loginPolicyDAO.deleteLoginPolicy(loginPolicy); + } + + /** + * 로그인정책에 대한 현재 반영되어 있는 결과를 조회한다. + * @param loginPolicyVO - 로그인정책 VO + * @return LoginPolicyVO - 로그인정책 VO + */ + /* + * public LoginPolicyVO selectLoginPolicyResult(LoginPolicyVO loginPolicyVO) + * throws Exception { return + * loginPolicyDAO.selectLoginPolicyResult(loginPolicyVO); } + */ +} diff --git a/src/main/java/egovframework/com/uat/uap/service/impl/LoginPolicyDAO.java b/src/main/java/egovframework/com/uat/uap/service/impl/LoginPolicyDAO.java new file mode 100644 index 0000000..6f55c04 --- /dev/null +++ b/src/main/java/egovframework/com/uat/uap/service/impl/LoginPolicyDAO.java @@ -0,0 +1,85 @@ +/** + * 개요 + * - 로그인정책에 대한 DAO 클래스를 정의한다. + * + * 상세내용 + * - 로그인정책에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 로그인정책의 조회기능은 목록조회, 상세조회로 구분된다. + * @author lee.m.j + * @version 1.0 + * @created 03-8-2009 오후 2:08:54 + *
    + * == 개정이력(Modification Information) ==
    + * 
    + *  수정일                수정자           수정내용
    + *  ----------   --------   ---------------------------
    + *  2009.08.03   이문준            최초 생성
    + *  2021.02.18   신용호            selectLoginPolicyResult() 삭제
    + * 
    + */ + +package egovframework.com.uat.uap.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uat.uap.service.LoginPolicy; +import egovframework.com.uat.uap.service.LoginPolicyVO; + +import org.springframework.stereotype.Repository; + +@Repository("loginPolicyDAO") +public class LoginPolicyDAO extends EgovComAbstractDAO { + + /** + * 로그인정책 목록을 조회한다. + * @param loginPolicyVO - 로그인정책 VO + * @return List - 로그인정책 목록 + */ + public List selectLoginPolicyList(LoginPolicyVO loginPolicyVO) throws Exception { + return selectList("loginPolicyDAO.selectLoginPolicyList", loginPolicyVO); + } + + /** + * 로그인정책 목록 수를 조회한다. + * @param loginPolicyVO - 로그인정책 VO + * @return int + */ + public int selectLoginPolicyListTotCnt(LoginPolicyVO loginPolicyVO) throws Exception { + return (Integer)selectOne("loginPolicyDAO.selectLoginPolicyListTotCnt", loginPolicyVO); + } + + /** + * 로그인정책 목록의 상세정보를 조회한다. + * @param loginPolicyVO - 로그인정책 VO + * @return LoginPolicyVO - 로그인정책 VO + */ + public LoginPolicyVO selectLoginPolicy(LoginPolicyVO loginPolicyVO) throws Exception { + return (LoginPolicyVO)selectOne("loginPolicyDAO.selectLoginPolicy", loginPolicyVO); + } + + /** + * 로그인정책 정보를 신규로 등록한다. + * @param loginPolicy - 로그인정책 model + */ + public void insertLoginPolicy(LoginPolicy loginPolicy) throws Exception { + insert("loginPolicyDAO.insertLoginPolicy", loginPolicy); + } + + /** + * 기 등록된 로그인정책 정보를 수정한다. + * @param loginPolicy - 로그인정책 model + */ + public void updateLoginPolicy(LoginPolicy loginPolicy) throws Exception { + update("loginPolicyDAO.updateLoginPolicy", loginPolicy); + } + + /** + * 기 등록된 로그인정책 정보를 삭제한다. + * @param loginPolicy - 로그인정책 model + */ + public void deleteLoginPolicy(LoginPolicy loginPolicy) throws Exception { + delete("loginPolicyDAO.deleteLoginPolicy", loginPolicy); + } + +} diff --git a/src/main/java/egovframework/com/uat/uap/web/EgovLoginPolicyController.java b/src/main/java/egovframework/com/uat/uap/web/EgovLoginPolicyController.java new file mode 100644 index 0000000..23611ee --- /dev/null +++ b/src/main/java/egovframework/com/uat/uap/web/EgovLoginPolicyController.java @@ -0,0 +1,210 @@ +/** + * 개요 + * - 로그인정책에 대한 controller 클래스를 정의한다. + * + * 상세내용 + * - 로그인정책에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 로그인정책의 조회기능은 목록조회, 상세조회로 구분된다. + * @author lee.m.j + * @version 1.0 + * @created 03-8-2009 오후 2:08:53 + *
    + * == 개정이력(Modification Information) ==
    + * 
    + *   수정일       수정자           수정내용
    + *  -------     --------    ---------------------------
    + *  2009.8.3    이문준     최초 생성
    + *  2011.8.26	정진오			IncludedInfo annotation 추가
    + * 
    + */ + +package egovframework.com.uat.uap.web; + +import javax.annotation.Resource; + +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 egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uat.uap.service.EgovLoginPolicyService; +import egovframework.com.uat.uap.service.LoginPolicy; +import egovframework.com.uat.uap.service.LoginPolicyVO; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + + +@Controller +public class EgovLoginPolicyController { + + + + + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name="egovLoginPolicyService") + EgovLoginPolicyService egovLoginPolicyService; + + @Autowired + private DefaultBeanValidator beanValidator; + + /** + * 로그인정책 목록 조회화면으로 이동한다. + * @return String - 리턴 Url + */ + @RequestMapping("/uat/uap/selectLoginPolicyListView.do") + public String selectLoginPolicyListView() throws Exception { + return "egovframework/com/uat/uap/EgovLoginPolicyList"; + } + + /** + * 로그인정책 목록을 조회한다. + * @param loginPolicyVO - 로그인정책 VO + * @return String - 리턴 Url + */ + @IncludedInfo(name="로그인정책관리", order = 30 ,gid = 10) + @RequestMapping("/uat/uap/selectLoginPolicyList.do") + public String selectLoginPolicyList(@ModelAttribute("loginPolicyVO") LoginPolicyVO loginPolicyVO, + ModelMap model) throws Exception { + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(loginPolicyVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(loginPolicyVO.getPageUnit()); + paginationInfo.setPageSize(loginPolicyVO.getPageSize()); + + loginPolicyVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + loginPolicyVO.setLastIndex(paginationInfo.getLastRecordIndex()); + loginPolicyVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + loginPolicyVO.setLoginPolicyList(egovLoginPolicyService.selectLoginPolicyList(loginPolicyVO)); + model.addAttribute("loginPolicyList", loginPolicyVO.getLoginPolicyList()); + + int totCnt = egovLoginPolicyService.selectLoginPolicyListTotCnt(loginPolicyVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/uat/uap/EgovLoginPolicyList"; + } + + /** + * 로그인정책 목록의 상세정보를 조회한다. + * @param loginPolicyVO - 로그인정책 VO + * @return String - 리턴 Url + */ + @RequestMapping("/uat/uap/getLoginPolicy.do") + public String selectLoginPolicy(@RequestParam("emplyrId") String emplyrId, + @ModelAttribute("loginPolicyVO") LoginPolicyVO loginPolicyVO, + ModelMap model) throws Exception { + + loginPolicyVO.setEmplyrId(emplyrId); + + model.addAttribute("loginPolicy", egovLoginPolicyService.selectLoginPolicy(loginPolicyVO)); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + LoginPolicyVO vo = (LoginPolicyVO)model.get("loginPolicy"); + + if(vo.getRegYn().equals("N")) + return "egovframework/com/uat/uap/EgovLoginPolicyRegist"; + else + return "egovframework/com/uat/uap/EgovLoginPolicyUpdt"; + } + + /** + * 로그인정책 정보 등록화면으로 이동한다. + * @param loginPolicy - 로그인정책 model + * @return String - 리턴 Url + */ + @RequestMapping("/uat/uap/addLoginPolicyView.do") + public String insertLoginPolicyView(@RequestParam("emplyrId") String emplyrId, + @ModelAttribute("loginPolicyVO") LoginPolicyVO loginPolicyVO, + ModelMap model) throws Exception { + + loginPolicyVO.setEmplyrId(emplyrId); + + model.addAttribute("loginPolicy", egovLoginPolicyService.selectLoginPolicy(loginPolicyVO)); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/uat/uap/EgovLoginPolicyRegist"; + } + + /** + * 로그인정책 정보를 신규로 등록한다. + * @param loginPolicy - 로그인정책 model + * @return String - 리턴 Url + */ + @RequestMapping("/uat/uap/addLoginPolicy.do") + public String insertLoginPolicy(@ModelAttribute("loginPolicy") LoginPolicy loginPolicy, + BindingResult bindingResult, + ModelMap model) throws Exception { + + beanValidator.validate(loginPolicy, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + model.addAttribute("loginPolicyVO", loginPolicy); + return "egovframework/com/uat/uap/EgovLoginPolicyRegist"; + } else { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + loginPolicy.setUserId(user == null ? "" : EgovStringUtil.isNullToString(user.getId())); + + egovLoginPolicyService.insertLoginPolicy(loginPolicy); + model.addAttribute("message", egovMessageSource.getMessage("success.common.update")); + + return "forward:/uat/uap/getLoginPolicy.do"; + } + } + + /** + * 기 등록된 로그인정책 정보를 수정한다. + * @param loginPolicy - 로그인정책 model + * @return String - 리턴 Url + */ + @RequestMapping("/uat/uap/updtLoginPolicy.do") + public String updateLoginPolicy(@ModelAttribute("loginPolicy") LoginPolicy loginPolicy, + BindingResult bindingResult, + ModelMap model) throws Exception { + + beanValidator.validate(loginPolicy, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + model.addAttribute("loginPolicyVO", loginPolicy); + return "egovframework/com/uat/uap/EgovLoginPolicyUpdt"; + } else { + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + loginPolicy.setUserId(user == null ? "" : EgovStringUtil.isNullToString(user.getId())); + + egovLoginPolicyService.updateLoginPolicy(loginPolicy); + model.addAttribute("message", egovMessageSource.getMessage("success.common.update")); + + return "forward:/uat/uap/selectLoginPolicyList.do"; + } + } + + /** + * 기 등록된 로그인정책 정보를 삭제한다. + * @param loginPolicy - 로그인정책 model + * @return String - 리턴 Url + */ + @RequestMapping("/uat/uap/removeLoginPolicy.do") + public String deleteLoginPolicy(@ModelAttribute("loginPolicy") LoginPolicy loginPolicy, + ModelMap model) throws Exception { + + egovLoginPolicyService.deleteLoginPolicy(loginPolicy); + + model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); + return "forward:/uat/uap/selectLoginPolicyList.do"; + } + + +} diff --git a/src/main/java/egovframework/com/uat/uia/onepass/service/EgovOnepassService.java b/src/main/java/egovframework/com/uat/uia/onepass/service/EgovOnepassService.java new file mode 100644 index 0000000..9a216ad --- /dev/null +++ b/src/main/java/egovframework/com/uat/uia/onepass/service/EgovOnepassService.java @@ -0,0 +1,29 @@ +package egovframework.com.uat.uia.onepass.service; + +/** + * 디티털원패스 연동을 처리하는 비즈니스 인터페이스 클래스 + * @author 전자정부 표준프레임워크 정진오 + * @since 2021.05.30 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *  수정일       수정자           수정내용
    + *  ----------   --------   ---------------------------
    + *  2021.05.30   정진오           최초 생성
    + *  
    + *  
    + */ +public interface EgovOnepassService { + + /** + * 입력한 사용자아이디의 중복여부를 체크하여 사용가능여부를 확인 + * @param id + * @return LoginVO + * @exception Exception + */ + public int onePassCheckIdDplct(String checkId) throws Exception; + +} diff --git a/src/main/java/egovframework/com/uat/uia/onepass/service/impl/EgovOnepassDAO.java b/src/main/java/egovframework/com/uat/uia/onepass/service/impl/EgovOnepassDAO.java new file mode 100644 index 0000000..af935e8 --- /dev/null +++ b/src/main/java/egovframework/com/uat/uia/onepass/service/impl/EgovOnepassDAO.java @@ -0,0 +1,36 @@ +package egovframework.com.uat.uia.onepass.service.impl; + +import org.springframework.stereotype.Repository; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; + +/** + * 디티털원패스 연동을 처리하는 비즈니스 DAO 클래스 + * @author 전자정부 표준프레임워크 정진오 + * @since 2021.05.30 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *  수정일       수정자           수정내용
    + *  ----------   --------   ---------------------------
    + *  2021.05.30   정진오           최초 생성
    + *  
    + *  
    + */ +@Repository("egovOnepassDAO") +public class EgovOnepassDAO extends EgovComAbstractDAO { + + /** + * 입력한 사용자아이디의 중복여부를 체크하여 사용가능여부를 확인 + * @param id + * @return LoginVO + * @exception Exception + */ + public int onePassCheckIdDplct(String checkId){ + return (Integer)selectOne("egovOnepassDAO.onePassCheckIdDplct", checkId); + } + +} diff --git a/src/main/java/egovframework/com/uat/uia/onepass/service/impl/EgovOnepassServiceImpl.java b/src/main/java/egovframework/com/uat/uia/onepass/service/impl/EgovOnepassServiceImpl.java new file mode 100644 index 0000000..dbd9d0c --- /dev/null +++ b/src/main/java/egovframework/com/uat/uia/onepass/service/impl/EgovOnepassServiceImpl.java @@ -0,0 +1,43 @@ +package egovframework.com.uat.uia.onepass.service.impl; + +import javax.annotation.Resource; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.springframework.stereotype.Service; + +import egovframework.com.uat.uia.onepass.service.EgovOnepassService; + +/** + * 디티털원패스 연동을 처리하는 비즈니스 구현 클래스 + * @author 전자정부 표준프레임워크 정진오 + * @since 2021.05.30 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *  수정일       수정자           수정내용
    + *  ----------   --------   ---------------------------
    + *  2021.05.30   정진오           최초 생성
    + *  
    + *  
    + */ +@Service("egovOnepassService") +public class EgovOnepassServiceImpl extends EgovAbstractServiceImpl implements EgovOnepassService { + + @Resource(name="egovOnepassDAO") + private EgovOnepassDAO egovOnepassDAO; + + /** + * 입력한 사용자아이디의 중복여부를 체크하여 사용가능여부를 확인 + * @param id + * @return LoginVO + * @exception Exception + */ + @Override + public int onePassCheckIdDplct(String checkId) { + return egovOnepassDAO.onePassCheckIdDplct(checkId); + } + +} diff --git a/src/main/java/egovframework/com/uat/uia/onepass/web/EgovOnepassController.java b/src/main/java/egovframework/com/uat/uia/onepass/web/EgovOnepassController.java new file mode 100644 index 0000000..786a275 --- /dev/null +++ b/src/main/java/egovframework/com/uat/uia/onepass/web/EgovOnepassController.java @@ -0,0 +1,237 @@ +package egovframework.com.uat.uia.onepass.web; + +import java.util.Objects; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import kr.go.onepass.client.dto.api.send.OnepassUserResponse; +import kr.go.onepass.client.dto.api.send.OnepassUserResponse.PROCESS_RESULT; +import kr.go.onepass.client.dto.api.send.OnepassUserResponse.USER_STATUS; +import kr.go.onepass.client.dto.saml.OnepassResponse; +import kr.go.onepass.client.handler.api.ApiSendHandler; +import kr.go.onepass.client.handler.saml.OnepassRequestHandler; +import kr.go.onepass.client.handler.saml.OnepassResponseHandler; +import kr.go.onepass.client.handler.saml.OnepassResponseHandler.RESULT_CODE; +import kr.go.onepass.client.handler.saml.OnepassResponseHandler.STATUS; +import kr.go.onepass.client.handler.saml.OnepassResponseHandler.TYPE; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.uat.uia.onepass.service.EgovOnepassService; +import egovframework.com.uat.uia.service.EgovLoginService; + +/** + * 디티털원패스 연동을 처리하는 컨트롤러 클래스 + * @author 전자정부 표준프레임워크 정진오 + * @since 2021.05.30 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *  수정일       수정자           수정내용
    + *  ----------   --------   ---------------------------
    + *  2021.05.30   정진오           최초 생성
    + *  
    + *  
    + */ +@Controller +public class EgovOnepassController { + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovOnepassController.class); + + @Resource(name="egovOnepassService") + private EgovOnepassService egovOnepassService; + + /** EgovLoginService */ + @Resource(name="loginService") + private EgovLoginService loginService; + + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + private EgovMessageSource egovMessageSource; + + /** + * 디지털원패스 로그인 처리 + * @param request + * @param response + * @param model + * @return + * @throws Exception + */ + @RequestMapping(value="/uat/uia/onepass/onepassLogin.do", method=RequestMethod.POST) + public String onepassLogin(HttpServletRequest request, HttpServletResponse response, ModelMap model) { + String serviceType = request.getParameter("serviceType"); + String action = null; + String inputName = null; + String inputValue = null; + String pageType = OnepassRequestHandler.pageType(request); + + try { + if ("LOGIN".equals(serviceType)) { + action = OnepassRequestHandler.LOGIN_DEST; + inputName = OnepassRequestHandler.LOGIN_INPUT_NAME; + inputValue = OnepassRequestHandler.login(); + } else if ("LOGOUT".equals(serviceType)) { + action = OnepassRequestHandler.logoutDest(request); + inputName = OnepassRequestHandler.LOGOUT_INPUT_NAME; + inputValue = OnepassRequestHandler.logout(request); + } else { + action = request.getContextPath()+"/index.do"; + inputName = ""; + inputValue = ""; + } + } catch (Exception e) { + return "egovframework/com/cmm/error/onepassAccessDenied"; + } + + model.addAttribute("redirectUrl", action); + model.addAttribute("inputName", inputName); + model.addAttribute("inputValue", inputValue); + model.addAttribute("pageType", pageType); + + return "egovframework/com/uat/uia/onepass/onepassLogin"; + } + + /** + * 디지털원패스 로그인 완료 후 응답받은 callback + * @param request + * @param response + * @param model + * @return + * @throws Exception + */ + @RequestMapping(value="/uat/uia/onepass/onepassCallback.do", method=RequestMethod.POST) + public String onepassCallback(HttpServletRequest request, HttpServletResponse response, ModelMap model) throws Exception { + // 인증체크 + OnepassResponse onepassResponse = OnepassResponseHandler.check(request); + + // 인증 성공 + if (onepassResponse.getStatus() == STATUS.SUCCESS && onepassResponse.getResultCode() == RESULT_CODE.SUCCESS) { + + // type 이 LOGIN + if (onepassResponse.getType() == TYPE.LOGIN) { + String userKey = onepassResponse.getUserKey(); + String intfToken = onepassResponse.getIntfToken(); + + // 인증 후 사용자 정보 조회 + ApiSendHandler apiSendHandler = new ApiSendHandler(); + OnepassUserResponse findOnepassUser = apiSendHandler.findUser(userKey, intfToken); + + // 사용자 정보 조회 성공 + if (findOnepassUser != null && findOnepassUser.getStatus() == USER_STATUS.USE) { + + // 디지털원패스 사용자 정보 - 신규회원일 경우 이 정보를 이용할 수 있음 + LOGGER.info("getId:{}", findOnepassUser.getId()); // 사용자의 ID (최대 30자) + LOGGER.info("getName:{}", findOnepassUser.getName()); // 사용자의 이름 (최대 70자) + LOGGER.info("getUserKey:{}", findOnepassUser.getUserKey()); // 사용자 유일값인 user key 가 전달된다. (최대 50자) + LOGGER.info("getCi:{}", findOnepassUser.getCi()); // 사용자의 CI (최대 255자) + LOGGER.info("getBirth:{}", findOnepassUser.getBirth()); // 사용자의 생년월일 (최대 8자) + LOGGER.info("getPhone:{}", findOnepassUser.getPhone()); // 사용자의 휴대전화번호 (최대 14자) + LOGGER.info("getEmail:{}", findOnepassUser.getEmail()); // 사용자의 E-mail (최대 70자) + LOGGER.info("getSex:{}", findOnepassUser.getSex()); // 사용자의 성별 (남:M, 여:F) + LOGGER.info("getNation:{}", findOnepassUser.getNation()); // 내외국인 구분(내국인:L, 외국인:F) + + // 기관 아이디 조회 + int usedCnt = egovOnepassService.onePassCheckIdDplct(findOnepassUser.getId()); + + // 기관 아이디 조회 성공 + if (usedCnt > 0) { + + // 디지털원패스에서 받은 아이디로 회원정보 조회 후 세션 저장 + LoginVO resultVO = loginService.onepassLogin(findOnepassUser.getId()); + resultVO.setOnepassUserkey(userKey); + resultVO.setOnepassIntfToken(intfToken); + request.getSession().setAttribute("loginVO", resultVO); + + // 로그인 인증세션 추가 + request.getSession().setAttribute("accessUser", resultVO.getUserSe().concat(resultVO.getId())); + + model.addAttribute("resultMessage", egovMessageSource.getMessageArgs("digital.onepass.connect.success", new Object[]{resultVO.getId()})); + model.addAttribute("redirectUrl", request.getContextPath()+"/index.do"); + return "egovframework/com/uat/uia/onepass/onepassResult"; + + } + + // 기관 아이디 조회 실패 + else { + model.addAttribute("resultMessage", egovMessageSource.getMessage("digital.onepass.connect.join.failure")); + model.addAttribute("redirectUrl", request.getContextPath()+"/index.do"); + return "egovframework/com/uat/uia/onepass/onepassResult"; + } + + } + + // 사용자 정보 조회 실패 + else { + model.addAttribute("resultMessage", egovMessageSource.getMessage("digital.onepass.connect.user.infomation.failure")); + model.addAttribute("redirectUrl", request.getContextPath()+"/index.do"); + return "egovframework/com/uat/uia/onepass/onepassResult"; + } + + } + + // type 이 LOGIN 이 아님 + else { + model.addAttribute("resultMessage", egovMessageSource.getMessage("digital.onepass.connect.athentication.failure")); + model.addAttribute("redirectUrl", request.getContextPath()+"/index.do"); + return "egovframework/com/uat/uia/onepass/onepassResult"; + } + + } + + // 인증 실패 + else { + model.addAttribute("resultMessage", egovMessageSource.getMessage("digital.onepass.connect.athentication.failure")); + model.addAttribute("redirectUrl", request.getContextPath()+"/index.do"); + return "egovframework/com/uat/uia/onepass/onepassResult"; + } + + } + + /** + * 디지털원패스 연동해제 처리 + * @param request + * @param response + * @param model + * @return + * @throws Exception + */ + @RequestMapping(value="/uat/uia/onepass/onepassCancel.do", method=RequestMethod.POST) + public String onepassCancel(HttpServletRequest request, HttpServletResponse response, ModelMap model) throws Exception { + ApiSendHandler apiSendHandler = new ApiSendHandler(); + String userKey = request.getParameter("userKey"); + String intfToken = request.getParameter("intfToken"); + + OnepassUserResponse onepassUser = apiSendHandler.InterLockRelease(userKey, intfToken); + + if (Objects.isNull(onepassUser)) { + onepassUser = new OnepassUserResponse(); + model.addAttribute("resultMessage", egovMessageSource.getMessage("digital.onepass.connect.athentication.failure")); + model.addAttribute("redirectUrl", request.getContextPath()+"/uat/uia/actionLogout.do"); + return "egovframework/com/uat/uia/onepass/onepassResult"; + } else { + if (onepassUser.getProcess_result() == PROCESS_RESULT.SUCESS) { + model.addAttribute("resultMessage", egovMessageSource.getMessage("digital.onepass.disconnect.success")); + model.addAttribute("redirectUrl", request.getContextPath()+"/uat/uia/actionLogout.do"); + return "egovframework/com/uat/uia/onepass/onepassResult"; + } else { + model.addAttribute("resultMessage", egovMessageSource.getMessage("digital.onepass.connect.user.infomation.failure")); + model.addAttribute("redirectUrl", request.getContextPath()+"/uat/uia/actionLogout.do"); + return "egovframework/com/uat/uia/onepass/onepassResult"; + } + } + + } + +} diff --git a/src/main/java/egovframework/com/uat/uia/service/EgovLoginService.java b/src/main/java/egovframework/com/uat/uia/service/EgovLoginService.java new file mode 100644 index 0000000..8eec6da --- /dev/null +++ b/src/main/java/egovframework/com/uat/uia/service/EgovLoginService.java @@ -0,0 +1,102 @@ +package egovframework.com.uat.uia.service; + +import java.util.Map; + +import egovframework.com.cmm.LoginVO; + +/** + * 일반 로그인, 인증서 로그인을 처리하는 비즈니스 인터페이스 클래스 + * @author 공통서비스 개발팀 박지욱 + * @since 2009.03.06 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + * 
    + *  수정일               수정자            수정내용
    + *  ----------   --------   ---------------------------
    + *  2009.03.06   박지욱            최초 생성 
    + *  2011.08.26   서준식            EsntlId를 이용한 로그인 추가
    + *  2017.07.21   장동한            로그인인증제한 작업
    + *  2020.07.08   신용호            비밀번호를 수정한후 경과한 날짜 조회
    + *  2021.05.30   정진오            디지털원패스 인증 회원 조회
    + *  
    + */ +public interface EgovLoginService { + + /** + * 2011.08.26 + * EsntlId를 이용한 로그인을 처리한다 + * @param vo LoginVO + * @return LoginVO + * @exception Exception + */ + public LoginVO actionLoginByEsntlId(LoginVO vo) throws Exception; + + /** + * 일반 로그인을 처리한다 + * @param vo LoginVO + * @return LoginVO + * @exception Exception + */ + LoginVO actionLogin(LoginVO vo) throws Exception; + + /** + * 인증서 로그인을 처리한다 + * @param vo LoginVO + * @return LoginVO + * @exception Exception + */ + LoginVO actionCrtfctLogin(LoginVO vo) throws Exception; + + /** + * 아이디를 찾는다. + * @param vo LoginVO + * @return LoginVO + * @exception Exception + */ + LoginVO searchId(LoginVO vo) throws Exception; + + /** + * 비밀번호를 찾는다. + * @param vo LoginVO + * @return boolean + * @exception Exception + */ + boolean searchPassword(LoginVO vo) throws Exception; + + + /** + * 로그인인증제한을 처리한다. + * @param vo LoginVO + * @param Map mapLockUserInfo + * @return String + * @exception Exception + */ + String processLoginIncorrect(LoginVO vo, Map mapLockUserInfo) throws Exception; + + /** + * 로그인인증제한을 조회한다. + * @param vo LoginVO + * @return Map + * @exception Exception + */ + Map selectLoginIncorrect(LoginVO vo) throws Exception; + + /** + * 비밀번호를 수정한후 경과한 날짜를 조회한다. + * @param vo LoginVO + * @return int + * @exception Exception + */ + int selectPassedDayChangePWD(LoginVO vo) throws Exception; + + /** + * 디지털원패스 인증 회원 조회한다. + * @param id + * @return LoginVO + * @exception Exception + */ + LoginVO onepassLogin(String id) throws Exception; +} diff --git a/src/main/java/egovframework/com/uat/uia/service/impl/EgovLoginServiceImpl.java b/src/main/java/egovframework/com/uat/uia/service/impl/EgovLoginServiceImpl.java new file mode 100644 index 0000000..c305864 --- /dev/null +++ b/src/main/java/egovframework/com/uat/uia/service/impl/EgovLoginServiceImpl.java @@ -0,0 +1,270 @@ +package egovframework.com.uat.uia.service.impl; + +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.config.EgovLoginConfig; +import egovframework.com.cop.ems.service.EgovSndngMailRegistService; +import egovframework.com.cop.ems.service.SndngMailVO; +import egovframework.com.uat.uia.service.EgovLoginService; +import egovframework.com.utl.fcc.service.EgovNumberUtil; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import egovframework.com.utl.sim.service.EgovFileScrty; +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.psl.dataaccess.util.EgovMap; + +/** + * 일반 로그인, 인증서 로그인을 처리하는 비즈니스 구현 클래스 + * @author 공통서비스 개발팀 박지욱 + * @since 2009.03.06 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *  수정일               수정자            수정내용
    + *  ----------   --------   ---------------------------
    + *  2009.03.06   박지욱            최초 생성
    + *  2011.08.26   서준식            EsntlId를 이용한 로그인 추가
    + *  2014.12.08   이기하            암호화방식 변경(EgovFileScrty.encryptPassword)
    + *  2017.07.21   장동한            로그인인증제한 작업
    + *  2020.07.08   신용호            비밀번호를 수정한후 경과한 날짜 조회
    + *  2021.05.30   정진오            디지털원패스 인증 회원 조회
    + *  
    + */ +@Service("loginService") +public class EgovLoginServiceImpl extends EgovAbstractServiceImpl implements EgovLoginService { + + @Resource(name="loginDAO") + private LoginDAO loginDAO; + + /** EgovSndngMailRegistService */ + @Resource(name = "sndngMailRegistService") + private EgovSndngMailRegistService sndngMailRegistService; + + @Resource(name = "egovLoginConfig") + EgovLoginConfig egovLoginConfig; + + /** + * 2011.08.26 + * EsntlId를 이용한 로그인을 처리한다 + * @param vo LoginVO + * @return LoginVO + * @exception Exception + */ + @Override + public LoginVO actionLoginByEsntlId(LoginVO vo) throws Exception { + + LoginVO loginVO = loginDAO.actionLoginByEsntlId(vo); + + // 3. 결과를 리턴한다. + if (loginVO != null && !loginVO.getId().equals("") && !loginVO.getPassword().equals("")) { + return loginVO; + } else { + loginVO = new LoginVO(); + } + + return loginVO; + } + + + /** + * 일반 로그인을 처리한다 + * @param vo LoginVO + * @return LoginVO + * @exception Exception + */ + @Override + public LoginVO actionLogin(LoginVO vo) throws Exception { + + // 1. 입력한 비밀번호를 암호화한다. + String enpassword = EgovFileScrty.encryptPassword(vo.getPassword(), vo.getId()); + vo.setPassword(enpassword); + + // 2. 아이디와 암호화된 비밀번호가 DB와 일치하는지 확인한다. + LoginVO loginVO = loginDAO.actionLogin(vo); + + // 3. 결과를 리턴한다. + if (loginVO != null && !loginVO.getId().equals("") && !loginVO.getPassword().equals("")) { + return loginVO; + } else { + loginVO = new LoginVO(); + } + + return loginVO; + } + + /** + * 인증서 로그인을 처리한다 + * @param vo LoginVO + * @return LoginVO + * @exception Exception + */ + @Override + public LoginVO actionCrtfctLogin(LoginVO vo) throws Exception { + + // 1. DN값으로 ID, PW를 조회한다. + LoginVO loginVO = loginDAO.actionCrtfctLogin(vo); + + // 3. 결과를 리턴한다. + if (loginVO != null && !loginVO.getId().equals("") && !loginVO.getPassword().equals("")) { + return loginVO; + } else { + loginVO = new LoginVO(); + } + + return loginVO; + } + + /** + * 아이디를 찾는다. + * @param vo LoginVO + * @return LoginVO + * @exception Exception + */ + @Override + public LoginVO searchId(LoginVO vo) throws Exception { + + // 1. 이름, 이메일주소가 DB와 일치하는 사용자 ID를 조회한다. + LoginVO loginVO = loginDAO.searchId(vo); + + // 2. 결과를 리턴한다. + if (loginVO != null && !loginVO.getId().equals("")) { + return loginVO; + } else { + loginVO = new LoginVO(); + } + + return loginVO; + } + + /** + * 비밀번호를 찾는다. + * @param vo LoginVO + * @return boolean + * @exception Exception + */ + @Override + public boolean searchPassword(LoginVO vo) throws Exception { + + boolean result = true; + + // 1. 아이디, 이름, 이메일주소, 비밀번호 힌트, 비밀번호 정답이 DB와 일치하는 사용자 Password를 조회한다. + LoginVO loginVO = loginDAO.searchPassword(vo); + if (loginVO == null || loginVO.getPassword() == null || "".equals(loginVO.getPassword())) { + return false; + } + + // 2. 임시 비밀번호를 생성한다.(영+영+숫+영+영+숫+영+영=8자리) + String newpassword = ""; + for (int i = 1; i <= 8; i++) { + // 영자 + if (i % 3 != 0) { + newpassword += EgovStringUtil.getRandomStr('a', 'z'); + // 숫자 + } else { + newpassword += EgovNumberUtil.getRandomNum(0, 9); + } + } + + // 3. 임시 비밀번호를 암호화하여 DB에 저장한다. + LoginVO pwVO = new LoginVO(); + String enpassword = EgovFileScrty.encryptPassword(newpassword, vo.getId()); + pwVO.setId(vo.getId()); + pwVO.setPassword(enpassword); + pwVO.setUserSe(vo.getUserSe()); + loginDAO.updatePassword(pwVO); + + // 4. 임시 비밀번호를 이메일 발송한다.(메일연동솔루션 활용) + SndngMailVO sndngMailVO = new SndngMailVO(); + sndngMailVO.setDsptchPerson("webmaster"); + sndngMailVO.setRecptnPerson(vo.getEmail()); + sndngMailVO.setSj("[MOIS] 임시 비밀번호를 발송했습니다."); + sndngMailVO.setEmailCn("고객님의 임시 비밀번호는 " + newpassword + " 입니다."); + sndngMailVO.setAtchFileId(""); + + result = sndngMailRegistService.insertSndngMail(sndngMailVO); + + return result; + } + + + /** + * 로그인인증제한을 조회한다. + * @param vo LoginVO + * @return Map + * @exception Exception + */ + public Map selectLoginIncorrect(LoginVO vo) throws Exception{ + return loginDAO.selectLoginIncorrect(vo); + } + + /** + * 로그인인증제한을 처리한다. + * @param vo LoginVO + * @param vo mapLockUserInfo + * @return String + * @exception Exception + */ + public String processLoginIncorrect(LoginVO vo, Map mapLockUserInfo) throws Exception{ + String sRtnCode = "C"; + //KISA 보안약점 조치 (2018-10-29, 윤창원) + String enpassword = EgovFileScrty.encryptPassword(vo.getPassword(), EgovStringUtil.isNullToString(vo.getId())); + Map mapParam = new HashMap(); + mapParam.put("USER_SE", vo.getUserSe()); + mapParam.put("id", EgovStringUtil.isNullToString(vo.getId()));//KISA 보안약점 조치 (2018-10-29, 윤창원) + //잠김시 + if("Y".equals(((String)mapLockUserInfo.get("lockAt")))){ + sRtnCode = "L"; + //패드워드 인증시 + }else if( ((String)mapLockUserInfo.get("userPw")).equals(enpassword) ){ + //LOCK 해제 + mapParam.put("updateAt", "E"); + loginDAO.updateLoginIncorrect(mapParam); + sRtnCode = "E"; + //패드워드 비인증시 + }else if(!"Y".equals(((String)mapLockUserInfo.get("lockAt")))){ + //LOCK 설정 + if( Integer.parseInt(String.valueOf(mapLockUserInfo.get("lockCnt")))+1 >= egovLoginConfig.getLockCount() ){ + mapParam.put("updateAt", "L"); + loginDAO.updateLoginIncorrect(mapParam); + sRtnCode = "L"; + //LOCK 증가 + }else{ + mapParam.put("updateAt", "C"); + loginDAO.updateLoginIncorrect(mapParam); + sRtnCode = "C"; + } + } + return sRtnCode; + } + + /** + * 비밀번호를 수정한후 경과한 날짜를 조회한다. + * @param vo LoginVO + * @return int + * @exception Exception + */ + public int selectPassedDayChangePWD(LoginVO vo) throws Exception { + return loginDAO.selectPassedDayChangePWD(vo); + } + + /** + * 디지털원패스 인증 회원 조회한다. + * @param id + * @return LoginVO + * @exception Exception + */ + @Override + public LoginVO onepassLogin(String id) throws Exception { + LoginVO loginVO = loginDAO.onepassLogin(id); + return loginVO; + } + +} diff --git a/src/main/java/egovframework/com/uat/uia/service/impl/LoginDAO.java b/src/main/java/egovframework/com/uat/uia/service/impl/LoginDAO.java new file mode 100644 index 0000000..bc0ec9e --- /dev/null +++ b/src/main/java/egovframework/com/uat/uia/service/impl/LoginDAO.java @@ -0,0 +1,136 @@ +package egovframework.com.uat.uia.service.impl; + +import java.util.Map; + +import org.springframework.stereotype.Repository; + +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; + +/** + * 일반 로그인, 인증서 로그인을 처리하는 DAO 클래스 + * @author 공통서비스 개발팀 박지욱 + * @since 2009.03.06 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *  수정일               수정자            수정내용
    + *  ----------   --------   ---------------------------
    + *  2009.03.06   박지욱            최초 생성
    + *  2011.08.26   서준식            EsntlId를 이용한 로그인 추가
    + *  2017.07.21   장동한            로그인인증제한 작업
    + *  2020.07.08   신용호            비밀번호를 수정한후 경과한 날짜 조회
    + *  2021.05.30   정진오            디지털원패스 인증 회원 조회
    + *  
    + */ +@Repository("loginDAO") +public class LoginDAO extends EgovComAbstractDAO { + + /** + * 2011.08.26 + * EsntlId를 이용한 로그인을 처리한다 + * @param vo LoginVO + * @return LoginVO + * @exception Exception + */ + public LoginVO actionLoginByEsntlId(LoginVO vo) throws Exception { + return (LoginVO)selectOne("LoginUsr.ssoLoginByEsntlId", vo); + } + + /** + * 일반 로그인을 처리한다 + * @param vo LoginVO + * @return LoginVO + * @exception Exception + */ + public LoginVO actionLogin(LoginVO vo) throws Exception { + return (LoginVO)selectOne("LoginUsr.actionLogin", vo); + } + + /** + * 인증서 로그인을 처리한다 + * @param vo LoginVO + * @return LoginVO + * @exception Exception + */ + public LoginVO actionCrtfctLogin(LoginVO vo) throws Exception { + + return (LoginVO)selectOne("LoginUsr.actionCrtfctLogin", vo); + } + + /** + * 아이디를 찾는다. + * @param vo LoginVO + * @return LoginVO + * @exception Exception + */ + public LoginVO searchId(LoginVO vo) throws Exception { + + return (LoginVO)selectOne("LoginUsr.searchId", vo); + } + + /** + * 비밀번호를 찾는다. + * @param vo LoginVO + * @return LoginVO + * @exception Exception + */ + public LoginVO searchPassword(LoginVO vo) throws Exception { + + return (LoginVO)selectOne("LoginUsr.searchPassword", vo); + } + + /** + * 변경된 비밀번호를 저장한다. + * @param vo LoginVO + * @exception Exception + */ + public void updatePassword(LoginVO vo) throws Exception { + update("LoginUsr.updatePassword", vo); + } + + + /** + * 로그인인증제한 내역을 조회한다. + * @param vo LoginVO + * @return LoginVO + * @exception Exception + */ + public Map selectLoginIncorrect(LoginVO vo) throws Exception { + return (Map)selectOne("LoginUsr.selectLoginIncorrect", vo); + } + + /** + * 로그인인증제한 내역을 업데이트 한다. + * @param vo LoginVO + * @return vod + * @exception Exception + */ + public void updateLoginIncorrect(Map map) throws Exception { + update("LoginUsr.updateLoginIncorrect"+map.get("USER_SE"), map); + } + + /** + * 비밀번호를 수정한후 경과한 날짜를 조회한다. + * @param vo LoginVO + * @return LoginVO + * @exception Exception + */ + public int selectPassedDayChangePWD(LoginVO vo) throws Exception { + return selectOne("LoginUsr.selectPassedDayChangePWD", vo); + } + + /** + * 디지털원패스 인증 회원 조회한다. + * @param id + * @return LoginVO + * @exception Exception + */ + public LoginVO onepassLogin(String id) throws Exception { + return (LoginVO)selectOne("LoginUsr.onepassLogin", id); + } + +} diff --git a/src/main/java/egovframework/com/uat/uia/web/EgovLoginController.java b/src/main/java/egovframework/com/uat/uia/web/EgovLoginController.java new file mode 100644 index 0000000..039f3b0 --- /dev/null +++ b/src/main/java/egovframework/com/uat/uia/web/EgovLoginController.java @@ -0,0 +1,619 @@ +package egovframework.com.uat.uia.web; + +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +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.springframework.web.servlet.ModelAndView; + +import egovframework.com.cmm.ComDefaultCodeVO; +import egovframework.com.cmm.EgovComponentChecker; +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.config.EgovLoginConfig; +import egovframework.com.cmm.service.EgovCmmUseService; +import egovframework.com.cmm.service.EgovProperties; +import egovframework.com.cmm.service.Globals; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uat.uia.service.EgovLoginService; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import egovframework.com.utl.sim.service.EgovClntInfo; +import org.egovframe.rte.psl.dataaccess.util.EgovMap; + +/* +import com.gpki.gpkiapi.cert.X509Certificate; +import com.gpki.servlet.GPKIHttpServletRequest; +import com.gpki.servlet.GPKIHttpServletResponse; +*/ + +/** + * 일반 로그인, 인증서 로그인을 처리하는 컨트롤러 클래스 + * @author 공통서비스 개발팀 박지욱 + * @since 2009.03.06 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *  수정일               수정자            수정내용
    + *  ----------   --------   ---------------------------
    + *  2009.03.06   박지욱           최초 생성
    + *  2011.08.26   정진오           IncludedInfo annotation 추가
    + *  2011.09.07   서준식           스프링 시큐리티 로그인 및 SSO 인증 로직을 필터로 분리
    + *  2011.09.25   서준식           사용자 관리 컴포넌트 미포함에 대한 점검 로직 추가
    + *  2011.09.27   서준식           인증서 로그인시 스프링 시큐리티 사용에 대한 체크 로직 추가
    + *  2011.10.27   서준식           아이디 찾기 기능에서 사용자 리름 공백 제거 기능 추가
    + *  2017.07.21   장동한           로그인인증제한 작업
    + *  2018.10.26   신용호           로그인 화면에 message 파라미터 전달 수정
    + *  2019.10.01   정진오           로그인 인증세션 추가
    + *  2020.06.25   신용호           로그인 메시지 처리 수정
    + *  2021.01.15   신용호           로그아웃시 권한 초기화 추가 : session 모드 actionLogout()
    + *  2021.05.30   정진오           디지털원패스 처리하기 위해 로그인 화면에 인증방식 전달
    + *  
    + *  
    + */ +@Controller +public class EgovLoginController { + + /** EgovLoginService */ + @Resource(name = "loginService") + private EgovLoginService loginService; + + /** EgovCmmUseService */ + @Resource(name = "EgovCmmUseService") + private EgovCmmUseService cmmUseService; + + /** EgovMessageSource */ + @Resource(name = "egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name = "egovLoginConfig") + EgovLoginConfig egovLoginConfig; + + /** log */ + private static final Logger LOGGER = LoggerFactory.getLogger(EgovLoginController.class); + + /** + * 로그인 화면으로 들어간다 + * @param vo - 로그인후 이동할 URL이 담긴 LoginVO + * @return 로그인 페이지 + * @exception Exception + */ + @IncludedInfo(name = "로그인", listUrl = "/uat/uia/egovLoginUsr.do", order = 10, gid = 10) + @RequestMapping(value = "/uat/uia/egovLoginUsr.do") + public String loginUsrView(@ModelAttribute("loginVO") LoginVO loginVO, HttpServletRequest request, HttpServletResponse response, ModelMap model) throws Exception { + if (EgovComponentChecker.hasComponent("mberManageService")) { + model.addAttribute("useMemberManage", "true"); + } + + //권한체크시 에러 페이지 이동 + String auth_error = request.getParameter("auth_error") == null ? "" : (String)request.getParameter("auth_error"); + if(auth_error != null && auth_error.equals("1")){ + return "egovframework/com/cmm/error/accessDenied"; + } + + /* + GPKIHttpServletResponse gpkiresponse = null; + GPKIHttpServletRequest gpkirequest = null; + + try{ + + gpkiresponse=new GPKIHttpServletResponse(response); + gpkirequest= new GPKIHttpServletRequest(request); + gpkiresponse.setRequest(gpkirequest); + model.addAttribute("challenge", gpkiresponse.getChallenge()); + return "egovframework/com/uat/uia/EgovLoginUsr"; + + }catch(Exception e){ + return "egovframework/com/cmm/egovError"; + } + */ + + // 2021.05.30, 정진오, 디지털원패스 처리하기 위해 로그인 화면에 인증방식 전달 + String authType = EgovProperties.getProperty("Globals.Auth").trim(); + model.addAttribute("authType", authType); + + String message = (String)request.getParameter("loginMessage"); + if (message!=null) model.addAttribute("loginMessage", message); + + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + /** + * 일반(세션) 로그인을 처리한다 + * @param vo - 아이디, 비밀번호가 담긴 LoginVO + * @param request - 세션처리를 위한 HttpServletRequest + * @return result - 로그인결과(세션정보) + * @exception Exception + */ + @RequestMapping(value = "/uat/uia/actionLogin.do") + public String actionLogin(@ModelAttribute("loginVO") LoginVO loginVO, HttpServletRequest request, ModelMap model) throws Exception { + + // 1. 로그인인증제한 활성화시 + if( egovLoginConfig.isLock()){ + Map mapLockUserInfo = (EgovMap)loginService.selectLoginIncorrect(loginVO); + if(mapLockUserInfo != null){ + //2.1 로그인인증제한 처리 + String sLoginIncorrectCode = loginService.processLoginIncorrect(loginVO, mapLockUserInfo); + if(!sLoginIncorrectCode.equals("E")){ + if(sLoginIncorrectCode.equals("L")){ + model.addAttribute("loginMessage", egovMessageSource.getMessageArgs("fail.common.loginIncorrect", new Object[] {egovLoginConfig.getLockCount(),request.getLocale()})); + }else if(sLoginIncorrectCode.equals("C")){ + model.addAttribute("loginMessage", egovMessageSource.getMessage("fail.common.login",request.getLocale())); + } + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + }else{ + model.addAttribute("loginMessage", egovMessageSource.getMessage("fail.common.login",request.getLocale())); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + } + + // 2. 로그인 처리 + LoginVO resultVO = loginService.actionLogin(loginVO); + + // 3. 일반 로그인 처리 + if (resultVO != null && resultVO.getId() != null && !resultVO.getId().equals("")) { + + // 3-1. 로그인 정보를 세션에 저장 + request.getSession().setAttribute("loginVO", resultVO); + // 2019.10.01 로그인 인증세션 추가 + request.getSession().setAttribute("accessUser", resultVO.getUserSe().concat(resultVO.getId())); + + return "redirect:/uat/uia/actionMain.do"; + + } else { + model.addAttribute("loginMessage", egovMessageSource.getMessage("fail.common.login",request.getLocale())); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + } + + /** + * 인증서 로그인을 처리한다 + * @param vo - 주민번호가 담긴 LoginVO + * @return result - 로그인결과(세션정보) + * @exception Exception + */ + @RequestMapping(value = "/uat/uia/actionCrtfctLogin.do") + public String actionCrtfctLogin(@ModelAttribute("loginVO") LoginVO loginVO, HttpServletRequest request, HttpServletResponse response, ModelMap model) throws Exception { + + // 접속IP + String userIp = EgovClntInfo.getClntIP(request); + LOGGER.debug("User IP : {}", userIp); + + /* + // 1. GPKI 인증 + GPKIHttpServletResponse gpkiresponse = null; + GPKIHttpServletRequest gpkirequest = null; + String dn = ""; + try{ + gpkiresponse = new GPKIHttpServletResponse(response); + gpkirequest = new GPKIHttpServletRequest(request); + gpkiresponse.setRequest(gpkirequest); + X509Certificate cert = null; + + byte[] signData = null; + byte[] privatekey_random = null; + String signType = ""; + String queryString = ""; + + cert = gpkirequest.getSignerCert(); + dn = cert.getSubjectDN(); + + java.math.BigInteger b = cert.getSerialNumber(); + b.toString(); + int message_type = gpkirequest.getRequestMessageType(); + if( message_type == gpkirequest.ENCRYPTED_SIGNDATA || message_type == gpkirequest.LOGIN_ENVELOP_SIGN_DATA || + message_type == gpkirequest.ENVELOP_SIGNDATA || message_type == gpkirequest.SIGNED_DATA){ + signData = gpkirequest.getSignedData(); + if(privatekey_random != null) { + privatekey_random = gpkirequest.getSignerRValue(); + } + signType = gpkirequest.getSignType(); + } + queryString = gpkirequest.getQueryString(); + }catch(Exception e){ + return "cmm/egovError"; + } + + // 2. 업무사용자 테이블에서 dn값으로 사용자의 ID, PW를 조회하여 이를 일반로그인 형태로 인증하도록 함 + if (dn != null && !dn.equals("")) { + + loginVO.setDn(dn); + LoginVO resultVO = loginService.actionCrtfctLogin(loginVO); + if (resultVO != null && resultVO.getId() != null && !resultVO.getId().equals("")) { + + //스프링 시큐리티패키지를 사용하는지 체크하는 로직 + if(EgovComponentChecker.hasComponent("egovAuthorManageService")){ + // 3-1. spring security 연동 + return "redirect:/j_spring_security_check?j_username=" + resultVO.getUserSe() + resultVO.getId() + "&j_password=" + resultVO.getUniqId(); + + }else{ + // 3-2. 로그인 정보를 세션에 저장 + request.getSession().setAttribute("loginVO", resultVO); + return "redirect:/uat/uia/actionMain.do"; + } + + + } else { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + } else { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + */ + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + /** + * 로그인 후 메인화면으로 들어간다 + * @param + * @return 로그인 페이지 + * @exception Exception + */ + @RequestMapping(value = "/uat/uia/actionMain.do") + public String actionMain(ModelMap model) throws Exception { + + // 1. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("loginMessage", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser(); + + LOGGER.debug("User Id : {}", user == null ? "" : EgovStringUtil.isNullToString(user.getId())); + + /* + // 2. 메뉴조회 + MenuManageVO menuManageVO = new MenuManageVO(); + menuManageVO.setTmp_Id(user.getId()); + menuManageVO.setTmp_UserSe(user.getUserSe()); + menuManageVO.setTmp_Name(user.getName()); + menuManageVO.setTmp_Email(user.getEmail()); + menuManageVO.setTmp_OrgnztId(user.getOrgnztId()); + menuManageVO.setTmp_UniqId(user.getUniqId()); + List list_headmenu = menuManageService.selectMainMenuHead(menuManageVO); + model.addAttribute("list_headmenu", list_headmenu); + */ + + // 3. 메인 페이지 이동 + String main_page = Globals.MAIN_PAGE; + + LOGGER.debug("Globals.MAIN_PAGE > " + Globals.MAIN_PAGE); + LOGGER.debug("main_page > {}", main_page); + + if (main_page.startsWith("/")) { + return "forward:" + main_page; + } else { + return main_page; + } + + /* + if (main_page != null && !main_page.equals("")) { + + // 3-1. 설정된 메인화면이 있는 경우 + return main_page; + + } else { + + // 3-2. 설정된 메인화면이 없는 경우 + if (user.getUserSe().equals("USR")) { + return "egovframework/com/EgovMainView"; + } else { + return "egovframework/com/EgovMainViewG"; + } + } + */ + } + + /** + * 로그아웃한다. + * @return String + * @exception Exception + */ + @RequestMapping(value = "/uat/uia/actionLogout.do") + public String actionLogout(HttpServletRequest request, ModelMap model) throws Exception { + + /*String userIp = EgovClntInfo.getClntIP(request); + + // 1. Security 연동 + return "redirect:/j_spring_security_logout";*/ + + request.getSession().setAttribute("loginVO", null); + // 세션모드인경우 Authority 초기화 + // List authList = (List)EgovUserDetailsHelper.getAuthorities(); + request.getSession().setAttribute("accessUser", null); + + //return "redirect:/egovDevIndex.jsp"; + return "redirect:/EgovContent.do"; + } + + /** + * 아이디/비밀번호 찾기 화면으로 들어간다 + * @param + * @return 아이디/비밀번호 찾기 페이지 + * @exception Exception + */ + @RequestMapping(value = "/uat/uia/egovIdPasswordSearch.do") + public String idPasswordSearchView(ModelMap model) throws Exception { + + // 1. 비밀번호 힌트 공통코드 조회 + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM022"); + List code = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("pwhtCdList", code); + + return "egovframework/com/uat/uia/EgovIdPasswordSearch"; + } + + /** + * 인증서안내 화면으로 들어간다 + * @return 인증서안내 페이지 + * @exception Exception + */ + @RequestMapping(value = "/uat/uia/egovGpkiIssu.do") + public String gpkiIssuView(ModelMap model) throws Exception { + return "egovframework/com/uat/uia/EgovGpkiIssu"; + } + + /** + * 아이디를 찾는다. + * @param vo - 이름, 이메일주소, 사용자구분이 담긴 LoginVO + * @return result - 아이디 + * @exception Exception + */ + @RequestMapping(value = "/uat/uia/searchId.do") + public String searchId(@ModelAttribute("loginVO") LoginVO loginVO, ModelMap model) throws Exception { + + if (loginVO == null || loginVO.getName() == null || loginVO.getName().equals("") && loginVO.getEmail() == null || loginVO.getEmail().equals("") + && loginVO.getUserSe() == null || loginVO.getUserSe().equals("")) { + return "egovframework/com/cmm/egovError"; + } + + // 1. 아이디 찾기 + loginVO.setName(loginVO.getName().replaceAll(" ", "")); + LoginVO resultVO = loginService.searchId(loginVO); + + if (resultVO != null && resultVO.getId() != null && !resultVO.getId().equals("")) { + + model.addAttribute("resultInfo", "아이디는 " + resultVO.getId() + " 입니다."); + return "egovframework/com/uat/uia/EgovIdPasswordResult"; + } else { + model.addAttribute("resultInfo", egovMessageSource.getMessage("fail.common.idsearch")); + return "egovframework/com/uat/uia/EgovIdPasswordResult"; + } + } + + /** + * 비밀번호를 찾는다. + * @param vo - 아이디, 이름, 이메일주소, 비밀번호 힌트, 비밀번호 정답, 사용자구분이 담긴 LoginVO + * @return result - 임시비밀번호전송결과 + * @exception Exception + */ + @RequestMapping(value = "/uat/uia/searchPassword.do") + public String searchPassword(@ModelAttribute("loginVO") LoginVO loginVO, ModelMap model) throws Exception { + + //KISA 보안약점 조치 (2018-10-29, 윤창원) + if (loginVO == null || loginVO.getId() == null || loginVO.getId().equals("") && loginVO.getName() == null || "".equals(loginVO.getName()) && loginVO.getEmail() == null + || loginVO.getEmail().equals("") && loginVO.getPasswordHint() == null || "".equals(loginVO.getPasswordHint()) && loginVO.getPasswordCnsr() == null + || "".equals(loginVO.getPasswordCnsr()) && loginVO.getUserSe() == null || "".equals(loginVO.getUserSe())) { + return "egovframework/com/cmm/egovError"; + } + + // 1. 비밀번호 찾기 + boolean result = loginService.searchPassword(loginVO); + + // 2. 결과 리턴 + if (result) { + model.addAttribute("resultInfo", "임시 비밀번호를 발송하였습니다."); + return "egovframework/com/uat/uia/EgovIdPasswordResult"; + } else { + model.addAttribute("resultInfo", egovMessageSource.getMessage("fail.common.pwsearch")); + return "egovframework/com/uat/uia/EgovIdPasswordResult"; + } + } + + /** + * 개발 시스템 구축 시 발급된 GPKI 서버용인증서에 대한 암호화데이터를 구한다. + * 최초 한번만 실행하여, 암호화데이터를 EgovGpkiVariables.js의 ServerCert에 넣는다. + * @return String + * @exception Exception + */ + @RequestMapping(value = "/uat/uia/getEncodingData.do") + public void getEncodingData() throws Exception { + + /* + X509Certificate x509Cert = null; + byte[] cert = null; + String base64cert = null; + try { + x509Cert = Disk.readCert("/product/jeus/egovProps/gpkisecureweb/certs/SVR1311000011_env.cer"); + cert = x509Cert.getCert(); + Base64 base64 = new Base64(); + base64cert = base64.encode(cert); + log.info("+++ Base64로 변환된 인증서는 : " + base64cert); + + } catch (GpkiApiException e) { + e.printStackTrace(); + } + */ + } + + /** + * 인증서 DN추출 팝업을 호출한다. + * @return 인증서 등록 페이지 + * @exception Exception + */ + @RequestMapping(value = "/uat/uia/EgovGpkiRegist.do") + public String gpkiRegistView(HttpServletRequest request, HttpServletResponse response, ModelMap model) throws Exception { + + /** GPKI 인증 부분 */ + // OS에 따라 (local NT(로컬) / server Unix(서버)) 구분 + String os = System.getProperty("os.arch"); + LOGGER.debug("OS : {}", os); + + //String virusReturn = null; + + /* + // 브라우저 이름을 받기위한 처리 + String webKind = EgovClntInfo.getClntWebKind(request); + String[] ss = webKind.split(" "); + String browser = ss[1]; + model.addAttribute("browser",browser); + // -- 여기까지 + if (os.equalsIgnoreCase("x86")) { + //Local Host TEST 진행중 + } else { + if (browser.equalsIgnoreCase("Explorer")) { + GPKIHttpServletResponse gpkiresponse = null; + GPKIHttpServletRequest gpkirequest = null; + + try { + gpkiresponse = new GPKIHttpServletResponse(response); + gpkirequest = new GPKIHttpServletRequest(request); + + gpkiresponse.setRequest(gpkirequest); + model.addAttribute("challenge", gpkiresponse.getChallenge()); + + return "egovframework/com/uat/uia/EgovGpkiRegist"; + + } catch (Exception e) { + return "egovframework/com/cmm/egovError"; + } + } + } + */ + return "egovframework/com/uat/uia/EgovGpkiRegist"; + } + + /** + * 인증서 DN값을 추출한다 + * @return result - dn값 + * @exception Exception + */ + @RequestMapping(value = "/uat/uia/actionGpkiRegist.do") + public String actionGpkiRegist(HttpServletRequest request, HttpServletResponse response, ModelMap model) throws Exception { + + /** GPKI 인증 부분 */ + // OS에 따라 (local NT(로컬) / server Unix(서버)) 구분 + String os = System.getProperty("os.arch"); + LOGGER.debug("OS : {}", os); + + // String virusReturn = null; + @SuppressWarnings("unused") + String dn = ""; + + // 브라우저 이름을 받기위한 처리 + String webKind = EgovClntInfo.getClntWebKind(request); + String[] ss = webKind.split(" "); + String browser = ss[1]; + model.addAttribute("browser", browser); + /* + // -- 여기까지 + if (os.equalsIgnoreCase("x86")) { + // Local Host TEST 진행중 + } else { + if (browser.equalsIgnoreCase("Explorer")) { + GPKIHttpServletResponse gpkiresponse = null; + GPKIHttpServletRequest gpkirequest = null; + try { + gpkiresponse = new GPKIHttpServletResponse(response); + gpkirequest = new GPKIHttpServletRequest(request); + gpkiresponse.setRequest(gpkirequest); + X509Certificate cert = null; + + // byte[] signData = null; + // byte[] privatekey_random = null; + // String signType = ""; + // String queryString = ""; + + cert = gpkirequest.getSignerCert(); + dn = cert.getSubjectDN(); + + model.addAttribute("dn", dn); + model.addAttribute("challenge", gpkiresponse.getChallenge()); + + return "egovframework/com/uat/uia/EgovGpkiRegist"; + } catch (Exception e) { + return "egovframework/com/cmm/egovError"; + } + } + } + */ + return "egovframework/com/uat/uia/EgovGpkiRegist"; + } + + /** + * 세션타임아웃 시간을 연장한다. + * Cookie에 egovLatestServerTime, egovExpireSessionTime 기록하도록 한다. + * @return result - String + * @exception Exception + */ + @RequestMapping(value="/uat/uia/refreshSessionTimeout.do") + public ModelAndView refreshSessionTimeout(@RequestParam Map commandMap) throws Exception { + ModelAndView modelAndView = new ModelAndView(); + modelAndView.setViewName("jsonView"); + + modelAndView.addObject("result", "ok"); + + return modelAndView; + } + + /** + * 비밀번호 유효기간 팝업을 출력한다. + * Cookie에 egovLatestServerTime, egovExpireSessionTime 기록하도록 한다. + * @return result - String + * @exception Exception + */ + @RequestMapping(value="/uat/uia/noticeExpirePwd.do") + public String noticeExpirePwd(@RequestParam Map commandMap, ModelMap model) throws Exception { + + // 설정된 비밀번호 유효기간을 가져온다. ex) 180이면 비밀번호 변경후 만료일이 앞으로 180일 + String propertyExpirePwdDay = EgovProperties.getProperty("Globals.ExpirePwdDay"); + int expirePwdDay = 0 ; + try { + expirePwdDay = Integer.parseInt(propertyExpirePwdDay); + } catch (NumberFormatException e) { + LOGGER.debug("convert expirePwdDay Err : "+e.getMessage()); + } catch (Exception e) { + LOGGER.debug("convert expirePwdDay Err : "+e.getMessage()); + } + + model.addAttribute("expirePwdDay", expirePwdDay); + + // 비밀번호 설정일로부터 몇일이 지났는지 확인한다. ex) 3이면 비빌번호 설정후 3일 경과 + LoginVO loginVO = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser(); + model.addAttribute("loginVO", loginVO); + int passedDayChangePWD = 0; + if ( loginVO != null ) { + LOGGER.debug("===>>> loginVO.getId() = "+loginVO.getId()); + LOGGER.debug("===>>> loginVO.getUniqId() = "+loginVO.getUniqId()); + LOGGER.debug("===>>> loginVO.getUserSe() = "+loginVO.getUserSe()); + // 비밀번호 변경후 경과한 일수 + passedDayChangePWD = loginService.selectPassedDayChangePWD(loginVO); + LOGGER.debug("===>>> passedDayChangePWD = "+passedDayChangePWD); + model.addAttribute("passedDay", passedDayChangePWD); + } + + // 만료일자로부터 경과한 일수 => ex)1이면 만료일에서 1일 경과 + model.addAttribute("elapsedTimeExpiration", passedDayChangePWD - expirePwdDay); + + return "egovframework/com/uat/uia/EgovExpirePwd"; + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/cmt/service/CmtDefaultVO.java b/src/main/java/egovframework/com/uss/cmt/service/CmtDefaultVO.java new file mode 100644 index 0000000..d8b1271 --- /dev/null +++ b/src/main/java/egovframework/com/uss/cmt/service/CmtDefaultVO.java @@ -0,0 +1,199 @@ +package egovframework.com.uss.cmt.service; + +import java.io.Serializable; + +/** + * 출퇴근관리 VO 클래스 + * @author 표준프레임워크센터 개발팀 + * @since 2014.12.20 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2014.12.20  개발팀         최초 생성
    + *
    + * 
    + */ +public class CmtDefaultVO implements Serializable { + + private static final long serialVersionUID = -2782974258506027986L; + + /** 검색조건 */ + private String searchCondition = ""; + + /** 검색Keyword */ + private String searchKeyword = ""; + + /** 검색사용여부 */ + private String searchUseYn = ""; + + /** 현재페이지 */ + private int pageIndex = 1; + + /** 페이지갯수 */ + private int pageUnit = 10; + + /** 페이지사이즈 */ + private int pageSize = 10; + + /** firstIndex */ + private int firstIndex = 1; + + /** lastIndex */ + private int lastIndex = 1; + + /** recordCountPerPage */ + private int recordCountPerPage = 10; + + + /** + * searchCondition attribute 값을 리턴한다. + * @return String + */ + public String getSearchCondition() { + return searchCondition; + } + + /** + * searchCondition attribute 값을 설정한다. + * @param searchCondition String + */ + public void setSearchCondition(String searchCondition) { + this.searchCondition = searchCondition; + } + + /** + * searchKeyword attribute 값을 리턴한다. + * @return String + */ + public String getSearchKeyword() { + return searchKeyword; + } + + /** + * searchKeyword attribute 값을 설정한다. + * @param searchKeyword String + */ + public void setSearchKeyword(String searchKeyword) { + this.searchKeyword = searchKeyword; + } + + /** + * searchUseYn attribute 값을 리턴한다. + * @return String + */ + public String getSearchUseYn() { + return searchUseYn; + } + + /** + * searchUseYn attribute 값을 설정한다. + * @param searchUseYn String + */ + public void setSearchUseYn(String searchUseYn) { + this.searchUseYn = searchUseYn; + } + + /** + * pageIndex attribute 값을 리턴한다. + * @return int + */ + public int getPageIndex() { + return pageIndex; + } + + /** + * pageIndex attribute 값을 설정한다. + * @param pageIndex int + */ + public void setPageIndex(int pageIndex) { + this.pageIndex = pageIndex; + } + + /** + * pageUnit attribute 값을 리턴한다. + * @return int + */ + public int getPageUnit() { + return pageUnit; + } + + /** + * pageUnit attribute 값을 설정한다. + * @param pageUnit int + */ + public void setPageUnit(int pageUnit) { + this.pageUnit = pageUnit; + } + + /** + * pageSize attribute 값을 리턴한다. + * @return int + */ + public int getPageSize() { + return pageSize; + } + + /** + * pageSize attribute 값을 설정한다. + * @param pageSize int + */ + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + /** + * firstIndex attribute 값을 리턴한다. + * @return int + */ + public int getFirstIndex() { + return firstIndex; + } + + /** + * firstIndex attribute 값을 설정한다. + * @param firstIndex int + */ + public void setFirstIndex(int firstIndex) { + this.firstIndex = firstIndex; + } + + /** + * lastIndex attribute 값을 리턴한다. + * @return int + */ + public int getLastIndex() { + return lastIndex; + } + + /** + * lastIndex attribute 값을 설정한다. + * @param lastIndex int + */ + public void setLastIndex(int lastIndex) { + this.lastIndex = lastIndex; + } + + /** + * recordCountPerPage attribute 값을 리턴한다. + * @return int + */ + public int getRecordCountPerPage() { + return recordCountPerPage; + } + + /** + * recordCountPerPage attribute 값을 설정한다. + * @param recordCountPerPage int + */ + public void setRecordCountPerPage(int recordCountPerPage) { + this.recordCountPerPage = recordCountPerPage; + } + + + +} diff --git a/src/main/java/egovframework/com/uss/cmt/service/CmtManageVO.java b/src/main/java/egovframework/com/uss/cmt/service/CmtManageVO.java new file mode 100644 index 0000000..5bf80e1 --- /dev/null +++ b/src/main/java/egovframework/com/uss/cmt/service/CmtManageVO.java @@ -0,0 +1,229 @@ +package egovframework.com.uss.cmt.service; + +import java.io.Serializable; +import java.util.List; + +/** + * 출퇴근관리 VO 클래스 + * @author 표준프레임워크센터 개발팀 + * @since 2014.12.20 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2014.12.20  개발팀         최초 생성
    + *
    + * 
    + */ +public class CmtManageVO implements Serializable { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + + public CmtManageVO() { + // constructor + } + + public List getCmtManageList() { + return cmtManageList; + } + + public void setCmtManageList(List cmtManageList) { + this.cmtManageList = cmtManageList; + } + + public String getUserNmString() { + return userNmString; + } + + public void setUserNmString(String userNmString) { + this.userNmString = userNmString; + } + + public String getUsid() { + return usid; + } + + public void setUsid(String usid) { + this.usid = usid; + } + + public String getWrkStartStatus() { + return wrkStartStatus; + } + + public void setWrkStartStatus(String workStartStatus) { + this.wrkStartStatus = workStartStatus; + } + + public String getWrkEndStatus() { + return wrkEndStatus; + } + + public void setWrkEndStatus(String workEndStatus) { + this.wrkEndStatus = workEndStatus; + } + + public String getDate() { + return date; + } + + public void setDate(String date) { + this.date = date; + } + + public String getWrkHours() { + return wrkHours; + } + + public void setWrkHours(String workHours) { + this.wrkHours = workHours; + } + + public String getWrktmId() { + return wrktmId; + } + + public void setWrktmId(String wrktmId) { + this.wrktmId = wrktmId; + } + + public String getWrkStartTime() { + return wrkStartTime; + } + + public void setWrkStartTime(String wrkStartTime) { + this.wrkStartTime = wrkStartTime; + } + + public String getWrkEndTime() { + return wrkEndTime; + } + + public void setWrkEndTime(String wrkEndTime) { + this.wrkEndTime = wrkEndTime; + } + + public String getOvtmwrkHours() { + return ovtmwrkHours; + } + + public void setOvtmwrkHours(String ovtmwrkHours) { + this.ovtmwrkHours = ovtmwrkHours; + } + + public String getRm() { + return rm; + } + + public void setRm(String rm) { + this.rm = rm; + } + + public String getEmplyrId() { + return emplyrId; + } + + public void setEmplyrId(String emplyrId) { + this.emplyrId = emplyrId; + } + + public String getOrgnztId() { + return orgnztId; + } + + public void setOrgnztId(String orgnztId) { + this.orgnztId = orgnztId; + } + + public String getWrktDt() { + return wrktDt; + } + + public void setWrktDt(String wrkt_dt) { + this.wrktDt = wrkt_dt; + } + + /** + * 출퇴근 목록 + */ + List cmtManageList; + + /** + * 사용자명 + */ + private String userNmString; + + /** + * 사용자ID + */ + private String usid; + + /** + * employee ID + */ + private String emplyrId; + + /** + * 부서Id + */ + private String orgnztId; + + /** + * 근무시간 + */ + private String wrkHours; + + /** + * 출퇴근 구분 ID + * + */ + private String wrktmId; + + /** + * 출근날짜 + */ + private String wrktDt; + + /** + * 출근시간 + */ + private String wrkStartTime; + + /** + * 퇴근시간 + */ + private String wrkEndTime; + + /** + * 출근상태 + */ + private String wrkStartStatus; + + /** + * 출근상태 + */ + private String wrkEndStatus; + + /** + * 초과근무시간 + */ + private String ovtmwrkHours; + + /** + * 비고 + */ + private String rm; + + /** + * date + */ + private String date; + +} diff --git a/src/main/java/egovframework/com/uss/cmt/service/EgovCmtManageService.java b/src/main/java/egovframework/com/uss/cmt/service/EgovCmtManageService.java new file mode 100644 index 0000000..10394ac --- /dev/null +++ b/src/main/java/egovframework/com/uss/cmt/service/EgovCmtManageService.java @@ -0,0 +1,55 @@ +package egovframework.com.uss.cmt.service; + +import java.util.List; + +/** + * 출퇴근관리에 관한 인터페이스클래스를 정의한다. + * @author 표준프레임워크 개발팀 + * @since 2014.08.29 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2014.08.29  개발팀          최초 생성
    + *
    + * 
    + */ +public interface EgovCmtManageService { + + /** + * 출퇴근정보 목록 화면에 출력 + * @param DeptInfo (부서별 - optional) 검색조건 + * @return List 업무사용자 목록정보 + * @throws Exception + */ + public List selectCmtInfoList(CmtDefaultVO cmtSearchVO) throws Exception; + + /** + * 출근정보 입력, 디바이스를 통해 외부 연계입력가능 + * @param cmtManageVO를 등록정보 + * @return result 등록결과 + * @throws Exception + */ + public String insertWrkStartCmtInfo(CmtManageVO cmtManageVO) throws Exception; + + /** + * 퇴근정보 입력, 디바이스를 통해 외부 연계입력가능 + * @param cmtManageVO를 등록정보 + * @return result 등록결과 + * @throws Exception + */ + public int insertWrkEndCmtInfo(CmtManageVO cmtManageVO) throws Exception; + + /** + * 퇴근 정보 입력을 위한 wrktm id 확인 + * @param cmtManageVO 검색조건 + * @return 총사용자갯수(int) + * @throws Exception + */ + public String selectWrktmId(CmtManageVO cmtManageVO) throws Exception; + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/cmt/service/impl/EgovCmtManageDAO.java b/src/main/java/egovframework/com/uss/cmt/service/impl/EgovCmtManageDAO.java new file mode 100644 index 0000000..3fb39ef --- /dev/null +++ b/src/main/java/egovframework/com/uss/cmt/service/impl/EgovCmtManageDAO.java @@ -0,0 +1,74 @@ +package egovframework.com.uss.cmt.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.cmt.service.CmtDefaultVO; +import egovframework.com.uss.cmt.service.CmtManageVO; + +import org.springframework.stereotype.Repository; + +/** + * 출퇴근관리에 관한 데이터 접근 클래스를 정의한다. + * @author 표준프레임워크 개발팀 + * @since 2014.11.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일         수정자           수정내용
    + *  -------       ----------    ---------------------------
    + *   2014.11.10   개발팀     최초 생성
    + *
    + * 
    + */ +@Repository("cmtManageDAO") +public class EgovCmtManageDAO extends EgovComAbstractDAO { + + public List selectCmtInfoList(CmtDefaultVO cmtSearchVO) { + return selectList("cmtManageDAO.selectCmtList_S", cmtSearchVO); + } + + /** + * 출근 기본정보를 화면에서 입력하여 항목의 정합성을 체크하고 데이터베이스에 저장 + * @param cmtManageVO 업무사용자 등록정보 + * @return String result 등록결과 + */ + public String insertWrkStartCmtInfo(CmtManageVO cmtManageVO) { + return Integer.toString(insert("cmtManageDAO.insertWrkStartCmtInfo_S", cmtManageVO)); + } + + /** + * 퇴근 기본정보를 화면에서 입력하여 항목의 정합성을 체크하고 데이터베이스에 저장 + * @param cmtManageVO 업무사용자 등록정보 + * @return String result 등록결과 + */ + public int insertWrkEndCmtInfo(CmtManageVO cmtManageVO) { + return update("cmtManageDAO.insertWrkEndCmtInfo_S", cmtManageVO); + } + + /** + * 퇴근정보 입력을 위한 출근정보 id 조회 + * @param cmtManageVO + * @return String wrktmId + */ + + public String selectWrktmId(CmtManageVO cmtManageVO) { + return (String) selectOne("cmtManageDAO.selectWrktmId_S", cmtManageVO); + } + + /** + * 퇴근정보 입력을 위한 출근정보조회 + * @param cmtManageVO + * @return cmtManageVO + */ + + public CmtManageVO selectWrkStartInfo(CmtManageVO cmtManageVO) { + CmtManageVO cmtVO = (CmtManageVO) selectOne("cmtManageDAO.selectWrkStartInfo_S", cmtManageVO); + + return cmtVO; + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/cmt/service/impl/EgovCmtManageServiceImpl.java b/src/main/java/egovframework/com/uss/cmt/service/impl/EgovCmtManageServiceImpl.java new file mode 100644 index 0000000..c8ea876 --- /dev/null +++ b/src/main/java/egovframework/com/uss/cmt/service/impl/EgovCmtManageServiceImpl.java @@ -0,0 +1,119 @@ +package egovframework.com.uss.cmt.service.impl; + +import java.text.SimpleDateFormat; +import java.util.List; + +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.uss.cmt.service.CmtDefaultVO; +import egovframework.com.uss.cmt.service.CmtManageVO; +import egovframework.com.uss.cmt.service.EgovCmtManageService; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import com.ibm.icu.util.Calendar; + +/** + * 출퇴근관리에 관한 비지니스 클래스를 정의한다. + * @author 표준프레임워크 개발팀 + * @since 2009.04.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.10  개발팀          최초 생성
    + *
    + * 
    + */ +@Service("cmtManageService") +public class EgovCmtManageServiceImpl extends EgovAbstractServiceImpl implements EgovCmtManageService { + + /** cmtManageDAO */ + @Resource(name = "cmtManageDAO") + private EgovCmtManageDAO cmtManageDAO; + + /** egovCmtManageIdGnrService */ + @Resource(name = "egovCmtManageIdGnrService") + private EgovIdGnrService idgenService; + + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + /** + * 출퇴근정보 목록 화면에 출력 + * @param DeptInfo (부서별 - optional) 검색조건 + * @return List 업무사용자 목록정보 + * @throws Exception + */ + @SuppressWarnings("unchecked") + @Override + public List selectCmtInfoList(CmtDefaultVO cmtSearchVO) throws Exception { + List result = (List) cmtManageDAO.selectCmtInfoList(cmtSearchVO); + return result; + } + + /** + * 출근정보 입력, 디바이스를 통해 외부 연계입력가능 + * @param cmtManageVO를 등록정보 + * @return result 등록결과 + * @throws Exception + */ + @Override + public String insertWrkStartCmtInfo(CmtManageVO cmtManageVO) throws Exception { + + // Key + String wrktmId = idgenService.getNextStringId(); + cmtManageVO.setWrktmId(wrktmId); + // 출근시간 + String formattedStartTime = new SimpleDateFormat("HH:mm").format(Calendar.getInstance().getTime()); + cmtManageVO.setWrkStartTime(formattedStartTime); + + return cmtManageDAO.insertWrkStartCmtInfo(cmtManageVO); + } + + /** + * 퇴근 정보 입력을 위한 wrktm id 확인 + * @param cmtManageVO 검색조건 + * @return 총사용자갯수(int) + * @throws Exception + */ + @Override + public String selectWrktmId(CmtManageVO cmtManageVO) throws Exception { + + return cmtManageDAO.selectWrktmId(cmtManageVO); + } + + /** + * 퇴근 정보 입력 + * @param cmtManageVO를 등록정보 + * @return result 등록결과 + * @throws Exception + */ + @Override + public int insertWrkEndCmtInfo(CmtManageVO cmtManageVO) throws Exception { + + cmtManageVO = cmtManageDAO.selectWrkStartInfo(cmtManageVO); + //퇴근시간 + String formattedEndTime = new SimpleDateFormat("HH:mm").format(Calendar.getInstance().getTime()); + cmtManageVO.setWrkEndTime(formattedEndTime); + //회사별 Rule 기반으로 workhour / overtime_workhour를 결정한다. ex) DB 연동활용 + cmtManageVO.setWrkHours("8"); + cmtManageVO.setOvtmwrkHours("0"); + //출퇴근시간 Rule 기반으로 출퇴근상태를 구분한다. ex) 정상/지각/조회 + String msg = egovMessageSource.getMessage("ussCmt.cmtManageServiceImpl.normal"); + cmtManageVO.setWrkStartStatus(msg); + cmtManageVO.setWrkEndStatus(msg); + + return cmtManageDAO.insertWrkEndCmtInfo(cmtManageVO); + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/cmt/web/EgovCmtManageController.java b/src/main/java/egovframework/com/uss/cmt/web/EgovCmtManageController.java new file mode 100644 index 0000000..6a31160 --- /dev/null +++ b/src/main/java/egovframework/com/uss/cmt/web/EgovCmtManageController.java @@ -0,0 +1,153 @@ +package egovframework.com.uss.cmt.web; + +import java.util.List; + +import javax.annotation.Resource; + +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 egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.cmt.service.CmtDefaultVO; +import egovframework.com.uss.cmt.service.CmtManageVO; +import egovframework.com.uss.cmt.service.EgovCmtManageService; +import egovframework.com.utl.fcc.service.EgovDateUtil; + +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; +import org.egovframe.rte.fdl.property.EgovPropertyService; + +/** + * 업무사용자관련 요청을 비지니스 클래스로 전달하고 처리된결과를 해당 + * 웹 화면으로 전달하는 Controller를 정의한다 + * @author 표준프레임워크 개발팀 + * @since 2014.08.29 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      	수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2014.08.29  개발팀          최초 생성
    + *   2019.01.10  이정은          출근 중복 확인, 퇴근 전 출근여부 확인 추가
    + *
    + * 
    + */ + +@Controller +public class EgovCmtManageController { + + /** cmtManageService */ + @Resource(name = "cmtManageService") + private EgovCmtManageService cmtManageService; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** DefaultBeanValidator beanValidator */ +// @Autowired +// private DefaultBeanValidator beanValidator; + + /** egovCmtManageIdGnrService */ + @Resource(name = "egovCmtManageIdGnrService") + private EgovIdGnrService idgenService; + + /** EgovMessageSource */ + @Resource(name = "egovMessageSource") + EgovMessageSource egovMessageSource; + + /** + * 출근 정보를 등록한다. + * @param cmtManageVO 사용자등록정보 + * @param bindingResult 입력값검증용 bindingResult + * @param model 화면모델 + * @return forward:/uss/cmt/EgovCmtMange.do + * @throws Exception + */ + @RequestMapping(value = "/uss/cmt/EgovCmtWrkStartInsert.do") + public String insertWrkStartCmtInfo(@ModelAttribute("cmtManageVO") CmtManageVO cmtManageVO, + BindingResult bindingResult, Model model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + if (user != null && user.getUniqId() != null) { + cmtManageVO.setEmplyrId(user.getUniqId()); + } + if (user != null && user.getOrgnztId() != null) { + cmtManageVO.setOrgnztId(user.getOrgnztId()); + } + cmtManageVO.setWrktDt(EgovDateUtil.getToday()); + + //출근 중복 확인 + String wrktmId = cmtManageService.selectWrktmId(cmtManageVO); + if (wrktmId != null) { + model.addAttribute("message", egovMessageSource.getMessage("ussCmt.cmtManageList.validate.wrkStartAlert")); //이미 출근 상태입니다. + return "forward:/uss/cmt/EgovCmtManageList.do"; + } else { + cmtManageService.insertWrkStartCmtInfo(cmtManageVO); + } + return "forward:/uss/cmt/EgovCmtManageList.do"; + } + + /** + * 퇴근 정보를 등록한다. + * @param cmtManageVO 사용자등록정보 + * @param bindingResult 입력값검증용 bindingResult + * @param model 화면모델 + * @return forward:/uss/cmt/EgovCmtMange.do + * @throws Exception + */ + @RequestMapping(value = "/uss/cmt/EgovCmtWrkEndInsert.do") + public String insertWrkEndCmtInfo(@ModelAttribute("cmtManageVO") CmtManageVO cmtManageVO, + BindingResult bindingResult, Model model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + if (user != null && user.getUniqId() != null) { + cmtManageVO.setEmplyrId(user.getUniqId()); + } + if (user != null && user.getOrgnztId() != null) { + cmtManageVO.setOrgnztId(user.getOrgnztId()); + } + cmtManageVO.setWrktDt(EgovDateUtil.getToday()); + + // 출근여부 체크 + String wrktmId = cmtManageService.selectWrktmId(cmtManageVO); + if (wrktmId != null) { + cmtManageService.insertWrkEndCmtInfo(cmtManageVO); + return "forward:/uss/cmt/EgovCmtManageList.do"; + } + model.addAttribute("message", + egovMessageSource.getMessage("ussCmt.cmtManageList.validate.wrkStartBeforeEndAlert"));// 먼저 출근등록을 해주세요. + return "forward:/uss/cmt/EgovCmtManageList.do"; + + } + + /** + * 출퇴근목록을 조회한다. (paging) + * @param userSearchVO 검색조건정보 + * @param model 화면모델 + * @return cmm/uss/umt/EgovCmtManageList + * @throws Exception + */ + @IncludedInfo(name = "출퇴근관리", order = 950, gid = 50) + @RequestMapping(value = "/uss/cmt/EgovCmtManageList.do") + public String selectUserCmtList(@ModelAttribute("cmtSearchVO") CmtDefaultVO cmtSearchVO, ModelMap model) + throws Exception { + + List cmtManageList = cmtManageService.selectCmtInfoList(cmtSearchVO); + model.addAttribute("resultList", cmtManageList); + + return "egovframework/com/uss/cmt/EgovCmtManageList"; + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/ans/service/AnnvrsryManage.java b/src/main/java/egovframework/com/uss/ion/ans/service/AnnvrsryManage.java new file mode 100644 index 0000000..92f1b59 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ans/service/AnnvrsryManage.java @@ -0,0 +1,300 @@ +package egovframework.com.uss.ion.ans.service; + +import egovframework.com.cmm.ComDefaultVO; + +/** + * 개요 + * - 기념일관리에 대한 model 클래스를 정의한다. + * + * 상세내용 + * - 기념일관리의 사용자ID,기념일명,기념일자,달력구분,알림설정,알림시작일자,메모,최초등록자ID,최초등록시점,최종수정자ID,최종수정시점 항목을 관리한다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +public class AnnvrsryManage extends ComDefaultVO { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + + /** + * 기념일ID + */ + private String annId; + + + /** + * 사용자ID + */ + private String usid; + + /** + * 기념일구분 + */ + private String annvrsrySe; + + + /** + * 기념일명 + */ + private String annvrsryNm; + + /** + * 기념일자 + */ + private String annvrsryDe; + + /** + * 달력구분 + */ + private String cldrSe; + + /** + * 반복구분 + */ + private String reptitSe; + + /** + * 알림설정 + */ + private String annvrsrySetup; + + /** + * 알림시작일자 + */ + private String annvrsryBeginDe; + + /** + * 메모 + */ + private String memo; + + /** + * 최초등록자ID + */ + private String frstRegisterId; + + /** + * 최초등록시점 + */ + private String frstRegisterPnttm; + + /** + * 최종수정자ID + */ + private String lastUpdusrId; + + /** + * 최종수정시점 + */ + private String lastUpdusrPnttm; + + + /** + * @return the annId + */ + public String getAnnId() { + return annId; + } + + /** + * @param annId the annId to set + */ + public void setAnnId(String annId) { + this.annId = annId; + } + + /** + * @return the usid + */ + public String getUsid() { + return usid; + } + + /** + * @param usid the usid to set + */ + public void setUsid(String usid) { + this.usid = usid; + } + + /** + * @return the annvrsrySe + */ + public String getAnnvrsrySe() { + return annvrsrySe; + } + + /** + * @param annvrsrySe the annvrsrySe to set + */ + public void setAnnvrsrySe(String annvrsrySe) { + this.annvrsrySe = annvrsrySe; + } + + /** + * @return the annvrsryNm + */ + public String getAnnvrsryNm() { + return annvrsryNm; + } + + /** + * @param annvrsryNm the annvrsryNm to set + */ + public void setAnnvrsryNm(String annvrsryNm) { + this.annvrsryNm = annvrsryNm; + } + + /** + * @return the annvrsryDe + */ + public String getAnnvrsryDe() { + return annvrsryDe; + } + + /** + * @param annvrsryDe the annvrsryDe to set + */ + public void setAnnvrsryDe(String annvrsryDe) { + this.annvrsryDe = annvrsryDe; + } + + /** + * @return the cldrSe + */ + public String getCldrSe() { + return cldrSe; + } + + /** + * @param cldrSe the cldrSe to set + */ + public void setCldrSe(String cldrSe) { + this.cldrSe = cldrSe; + } + + /** + * @return the annvrsrySetup + */ + public String getAnnvrsrySetup() { + return annvrsrySetup; + } + + /** + * @param annvrsrySetup the annvrsrySetup to set + */ + public void setAnnvrsrySetup(String annvrsrySetup) { + this.annvrsrySetup = annvrsrySetup; + } + + /** + * @return the annvrsryBeginDe + */ + public String getAnnvrsryBeginDe() { + return annvrsryBeginDe; + } + + /** + * @param annvrsryBeginDe the annvrsryBeginDe to set + */ + public void setAnnvrsryBeginDe(String annvrsryBeginDe) { + this.annvrsryBeginDe = annvrsryBeginDe; + } + + /** + * @return the memo + */ + public String getMemo() { + return memo; + } + + /** + * @param memo the memo to set + */ + public void setMemo(String memo) { + this.memo = memo; + } + + /** + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * @param frstRegisterId the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * @param frstRegisterPnttm the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * @param lastUpdusrId the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + /** + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * @param lastUpdusrPnttm the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * @return the serialVersionUID + */ + public static long getSerialVersionUID() { + return serialVersionUID; + } + + /** + * @return the reptitSe + */ + public String getReptitSe() { + return reptitSe; + } + + /** + * @param reptitSe the reptitSe to set + */ + public void setReptitSe(String reptitSe) { + this.reptitSe = reptitSe; + } + + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/ans/service/AnnvrsryManageVO.java b/src/main/java/egovframework/com/uss/ion/ans/service/AnnvrsryManageVO.java new file mode 100644 index 0000000..be4511a --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ans/service/AnnvrsryManageVO.java @@ -0,0 +1,144 @@ +package egovframework.com.uss.ion.ans.service; + +import java.util.List; + +/** + * 개요 + * - 기념일관리에 대한 Vo 클래스를 정의한다. + * + * 상세내용 + * - 기념일관리의 목록 항목을 관리한다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +//public class AnnvrsryManageVO extends AnnvrsryManage implements Serializable { +public class AnnvrsryManageVO extends AnnvrsryManage{ + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + /** + * 기념일관리 목록 + */ + List annvrsryManageList; + + /** + * list 번호 + */ + private int rowCount; + + /** + * 출력 변수 1 + */ + private String annvrsryTemp1; + + /** + * 출력 변수 2 + */ + private String annvrsryTemp2; + + /** + * 출력 변수 3 + */ + private String annvrsryTemp3; + + /** + * 출력 변수 4 + */ + private String annvrsryTemp4; + + /** + * 출력 변수 5 + */ + private String annvrsryTemp5; + + /** + * @return the annvrsryManageList + */ + public List getAnnvrsryManageList() { + return annvrsryManageList; + } + /** + * @param bannerList the bannerList to set + */ + public void setAnnvrsryManageList(List annvrsryManageList) { + this.annvrsryManageList = annvrsryManageList; + } + /** + * @return the rowCount + */ + public int getRowCount() { + return rowCount; + } + /** + * @param rowCount the rowCount to set + */ + public void setRowCount(int rowCount) { + this.rowCount = rowCount; + } + /** + * @return the annvrsryTemp1 + */ + public String getAnnvrsryTemp1() { + return annvrsryTemp1; + } + /** + * @param annvrsryTemp1 the annvrsryTemp1 to set + */ + public void setAnnvrsryTemp1(String annvrsryTemp1) { + this.annvrsryTemp1 = annvrsryTemp1; + } + /** + * @return the annvrsryTemp2 + */ + public String getAnnvrsryTemp2() { + return annvrsryTemp2; + } + /** + * @param annvrsryTemp2 the annvrsryTemp2 to set + */ + public void setAnnvrsryTemp2(String annvrsryTemp2) { + this.annvrsryTemp2 = annvrsryTemp2; + } + /** + * @return the annvrsryTemp3 + */ + public String getAnnvrsryTemp3() { + return annvrsryTemp3; + } + /** + * @param annvrsryTemp3 the annvrsryTemp3 to set + */ + public void setAnnvrsryTemp3(String annvrsryTemp3) { + this.annvrsryTemp3 = annvrsryTemp3; + } + /** + * @return the annvrsryTemp4 + */ + public String getAnnvrsryTemp4() { + return annvrsryTemp4; + } + /** + * @param annvrsryTemp4 the annvrsryTemp4 to set + */ + public void setAnnvrsryTemp4(String annvrsryTemp4) { + this.annvrsryTemp4 = annvrsryTemp4; + } + /** + * @return the annvrsryTemp5 + */ + public String getAnnvrsryTemp5() { + return annvrsryTemp5; + } + /** + * @param annvrsryTemp5 the annvrsryTemp5 to set + */ + public void setAnnvrsryTemp5(String annvrsryTemp5) { + this.annvrsryTemp5 = annvrsryTemp5; + } + + +} diff --git a/src/main/java/egovframework/com/uss/ion/ans/service/EgovAnnvrsryManageService.java b/src/main/java/egovframework/com/uss/ion/ans/service/EgovAnnvrsryManageService.java new file mode 100644 index 0000000..75e4e17 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ans/service/EgovAnnvrsryManageService.java @@ -0,0 +1,89 @@ +package egovframework.com.uss.ion.ans.service; + +import java.io.InputStream; +import java.util.List; + +/** + * 개요 + * - 기념일관리에 대한 Service Interface를 정의한다. + * + * 상세내용 + * - 기념일관리에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 기념일관리의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +public interface EgovAnnvrsryManageService { + + /** + * 기념일관리 정보를 관리하기 위해 등록된 기념일관리 목록을 조회한다. + * @param annvrsryManageVO - 기념일관리 VO + * @return List - 기념일관리 목록 + */ + public List selectAnnvrsryManageList(AnnvrsryManageVO annvrsryManageVO) throws Exception; + + /** + * 기념일관리 목록 총 갯수를 조회한다. + * @param annvrsryManageVO - 기념일관리 VO + * @return int - 기념일관리 카운트 수 + */ + public int selectAnnvrsryManageListTotCnt(AnnvrsryManageVO annvrsryManageVO) throws Exception ; + + /** + * 등록된 기념일관리의 상세정보를 조회한다. + * @param annvrsryManageVO - 기념일관리 VO + * @return AnnvrsryManageVO - 기념일관리 VO + */ + public AnnvrsryManageVO selectAnnvrsryManage(AnnvrsryManageVO annvrsryManageVO) throws Exception; + + /** + * 기념일관리 정보를 신규로 등록한다. + * @param annvrsryManage - 기념일관리 model + */ + public void insertAnnvrsryManage(AnnvrsryManage annvrsryManage) throws Exception; + + /** + * 기 등록된 기념일관리 정보를 수정한다. + * @param annvrsryManage - 기념일관리 model + */ + public void updateAnnvrsryManage(AnnvrsryManage annvrsryManage) throws Exception; + + /** + * 기 등록된 기념일관리 정보를 삭제한다. + * @param annvrsryManage - 기념일관리 model + */ + public void deleteAnnvrsryManage(AnnvrsryManage annvrsryManage) throws Exception; + + /** + * 등록된 기념일관리의 알림 화면을 조회한다. + * @param annvrsryManageVO - 기념일관리 VO + * @return AnnvrsryManageVO - 기념일관리 VO + */ + public List selectAnnvrsryGdcc(AnnvrsryManageVO annvrsryManageVO) throws Exception; + + /** + * 기념일관리 등록시 중복여부를 조회한다. + * @param annvrsryManage - 기념일관리 VO + * @return int + * @exception Exception + */ + public int selectAnnvrsryManageDplctAt(AnnvrsryManage annvrsryManage) throws Exception ; + + /** + * 기념일정보 excel생성 + * @param inputStream InputStream + * @return String + * @exception Exception + */ + public List selectAnnvrsryManageBnde(InputStream inputStream)throws Exception; + + /** + * 기념일정보를 일괄등록처리한다. + * @param annvrsryManageVO - 기념일관리 VO + * @param String - 기념일정보 + */ + public void insertAnnvrsryManageBnde(AnnvrsryManageVO annvrsryManageVO, + String checkedAnnvrsryManageForInsert) throws Exception; +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/ans/service/impl/AnnvrsryManageDAO.java b/src/main/java/egovframework/com/uss/ion/ans/service/impl/AnnvrsryManageDAO.java new file mode 100644 index 0000000..ecc43e6 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ans/service/impl/AnnvrsryManageDAO.java @@ -0,0 +1,106 @@ +package egovframework.com.uss.ion.ans.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.ion.ans.service.AnnvrsryManage; +import egovframework.com.uss.ion.ans.service.AnnvrsryManageVO; + +import org.springframework.stereotype.Repository; + +/** + * 개요 + * - 기념일관리에 대한 DAO 클래스를 정의한다. + * + * 상세내용 + * - 기념일관리에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 기념일관리의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +@Repository("annvrsryManageDAO") +public class AnnvrsryManageDAO extends EgovComAbstractDAO { + + /** + * 기념일관리정보를 관리하기 위해 등록된 기념일관리 목록을 조회한다. + * @param annvrsryManageVO - 기념일관리 VO + * @return List - 기념일관리 목록 + */ + public List selectAnnvrsryManageList(AnnvrsryManageVO annvrsryManageVO) throws Exception { + return selectList("annvrsryManageDAO.selectAnnvrsryManageList", annvrsryManageVO); + } + + /** + * 기념일관리목록 총 갯수를 조회한다. + * @param annvrsryManageVO - 기념일관리 VO + * @return int + * @exception Exception + */ + public int selectAnnvrsryManageListTotCnt(AnnvrsryManageVO annvrsryManageVO) throws Exception { + return (Integer)selectOne("annvrsryManageDAO.selectAnnvrsryManageListTotCnt", annvrsryManageVO); + } + + /** + * 등록된 기념일관리의 상세정보를 조회한다. + * @param annvrsryManageVO - 기념일관리 VO + * @return AnnvrsryManageVO - 기념일관리 VO + */ + public AnnvrsryManageVO selectAnnvrsryManage(AnnvrsryManageVO annvrsryManageVO) throws Exception { + return (AnnvrsryManageVO) selectOne("annvrsryManageDAO.selectAnnvrsryManage", annvrsryManageVO); + } + + /** + * 기념일관리정보를 신규로 등록한다. + * @param annvrsryManage - 기념일관리 model + */ + public void insertAnnvrsryManage(AnnvrsryManage annvrsryManage) throws Exception { + insert("annvrsryManageDAO.insertAnnvrsryManage", annvrsryManage); + } + + /** + * 기 등록된 기념일관리정보를 수정한다. + * @param annvrsryManage - 기념일관리 model + */ + public void updateAnnvrsryManage(AnnvrsryManage annvrsryManage) throws Exception { + update("annvrsryManageDAO.updateAnnvrsryManage", annvrsryManage); + } + + /** + * 기 등록된 기념일관리정보를 삭제한다. + * @param annvrsryManage - 기념일관리 model + */ + public void deleteAnnvrsryManage(AnnvrsryManage annvrsryManage) throws Exception { + delete("annvrsryManageDAO.deleteAnnvrsryManage",annvrsryManage); + } + + /** + * 등록된 기념일관리의 상세정보를 조회한다. + * @param annvrsryManageVO - 기념일관리 VO + * @return AnnvrsryManageVO - 기념일관리 VO + */ + public List selectAnnvrsryGdcc(AnnvrsryManageVO annvrsryManageVO) throws Exception { + return selectList("annvrsryManageDAO.selectAnnvrsryGdcc", annvrsryManageVO); + } + + /** + * 기념일관리 등록시 중복여부를 조회한다. + * @param annvrsryManage - 기념일관리 VO + * @return int + * @exception Exception + */ + public int selectAnnvrsryManageDplctAt(AnnvrsryManage annvrsryManage) throws Exception { + return (Integer)selectOne("annvrsryManageDAO.selectAnnvrsryManageDplctAt", annvrsryManage); + } + + /** + * 등록된 기념일관리의 상세정보를 조회한다. + * @param annvrsryManageVO - 기념일관리 VO + * @return AnnvrsryManageVO - 기념일관리 VO + */ + public AnnvrsryManageVO selectAnnvrsryManageBnde(AnnvrsryManageVO annvrsryManageVO) throws Exception { + return (AnnvrsryManageVO) selectOne("annvrsryManageDAO.selectAnnvrsryManageBnde", annvrsryManageVO); + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/ans/service/impl/EgovAnnvrsryManageServiceImpl.java b/src/main/java/egovframework/com/uss/ion/ans/service/impl/EgovAnnvrsryManageServiceImpl.java new file mode 100644 index 0000000..f1c5c08 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ans/service/impl/EgovAnnvrsryManageServiceImpl.java @@ -0,0 +1,345 @@ +package egovframework.com.uss.ion.ans.service.impl; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +import egovframework.com.uss.ion.ans.service.AnnvrsryManage; +import egovframework.com.uss.ion.ans.service.AnnvrsryManageVO; +import egovframework.com.uss.ion.ans.service.EgovAnnvrsryManageService; +import egovframework.com.utl.fcc.service.EgovDateUtil; +import egovframework.com.utl.fcc.service.EgovStringUtil; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.excel.EgovExcelService; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +import javax.annotation.Resource; + +import org.apache.poi.hssf.usermodel.HSSFCell; +import org.apache.poi.hssf.usermodel.HSSFRow; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.springframework.stereotype.Service; + +/** + * 개요 + * - 기념일관리에 대한 ServiceImpl 클래스를 정의한다. + * + * 상세내용 + * - 기념일관리에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 기념일관리의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + * *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      	수정자          	수정내용
    + *  ----------  --------    ---------------------------
    + *  2010.06.15	표준프레임워크   	최초 생성
    + *  2018.11.30	최두영		selectAnnvrsryManageBnde에서 annvrsryManageVO의 null처리 추가
    + *
    + *  
    + */ + +@Service("egovAnnvrsryManageService") +public class EgovAnnvrsryManageServiceImpl extends EgovAbstractServiceImpl implements EgovAnnvrsryManageService { + + @Resource(name = "annvrsryManageDAO") + private AnnvrsryManageDAO annvrsryManageDAO; + + @Resource(name = "excelZipService") + private EgovExcelService excelZipService; + + /** ID Generation */ + @Resource(name = "egovAnnvrsryManageIdGnrService") + private EgovIdGnrService idgenAnnvrsryManageService; + + /** + * 기념일관리정보를 관리하기 위해 등록된 기념일관리 목록을 조회한다. + * @param annvrsryManageVO - 기념일관리 VO + * @return List - 기념일관리 목록 + */ + public List selectAnnvrsryManageList(AnnvrsryManageVO annvrsryManageVO) throws Exception { + + List result = annvrsryManageDAO.selectAnnvrsryManageList(annvrsryManageVO); + int num = result.size(); + + for (int i = 0; i < num; i++) { + AnnvrsryManageVO annvrsryManageVO1 = result.get(i); + annvrsryManageVO1.setAnnvrsryDe(EgovDateUtil.formatDate(annvrsryManageVO1.getAnnvrsryDe(), "-")); + result.set(i, annvrsryManageVO1); + } + return result; + } + + /** + * 기념일관리목록 총 갯수를 조회한다. + * @param annvrsryManageVO - 기념일관리 VO + * @return int - 기념일관리 카운트 수 + */ + public int selectAnnvrsryManageListTotCnt(AnnvrsryManageVO annvrsryManageVO) throws Exception { + return annvrsryManageDAO.selectAnnvrsryManageListTotCnt(annvrsryManageVO); + } + + /** + * 등록된 기념일관리의 상세정보를 조회한다. + * @param annvrsryManageVO - 기념일관리 VO + * @return AnnvrsryManageVO - 기념일관리 VO + */ + public AnnvrsryManageVO selectAnnvrsryManage(AnnvrsryManageVO annvrsryManageVO) throws Exception { + annvrsryManageVO.setAnnvrsryDe(EgovStringUtil.removeMinusChar(annvrsryManageVO.getAnnvrsryDe())); + AnnvrsryManageVO annvrsryManageVOTemp = annvrsryManageDAO.selectAnnvrsryManage(annvrsryManageVO); + annvrsryManageVOTemp.setAnnvrsryDe(EgovDateUtil.formatDate(annvrsryManageVOTemp.getAnnvrsryDe(), "-")); + return annvrsryManageVOTemp; + } + + /** + * 기념일관리정보를 신규로 등록한다. + * @param annvrsryManage - 기념일관리 model + */ + public void insertAnnvrsryManage(AnnvrsryManage annvrsryManage) throws Exception { + annvrsryManage.setAnnvrsryDe(EgovStringUtil.removeMinusChar(annvrsryManage.getAnnvrsryDe())); + + String sAnnId = idgenAnnvrsryManageService.getNextStringId(); + annvrsryManage.setAnnId(sAnnId); + annvrsryManageDAO.insertAnnvrsryManage(annvrsryManage); + } + + /** + * 기 등록된 기념일관리정보를 수정한다. + * @param annvrsryManage - 기념일관리 model + */ + public void updateAnnvrsryManage(AnnvrsryManage annvrsryManage) throws Exception { + annvrsryManage.setAnnvrsryDe(EgovStringUtil.removeMinusChar(annvrsryManage.getAnnvrsryDe())); + annvrsryManageDAO.updateAnnvrsryManage(annvrsryManage); + } + + /** + * 기 등록된 기념일관리정보를 삭제한다. + * @param annvrsryManage - 기념일관리 model + */ + public void deleteAnnvrsryManage(AnnvrsryManage annvrsryManage) throws Exception { + annvrsryManage.setAnnvrsryDe(EgovStringUtil.removeMinusChar(annvrsryManage.getAnnvrsryDe())); + annvrsryManageDAO.deleteAnnvrsryManage(annvrsryManage); + } + + /** + * 등록된 기념일관리의 상세정보를 조회한다. + * @param annvrsryManageVO - 기념일관리 VO + * @return AnnvrsryManageVO - 기념일관리 VO + */ + public List selectAnnvrsryGdcc(AnnvrsryManageVO annvrsryManageVO) throws Exception { + + List result_temp = annvrsryManageDAO.selectAnnvrsryGdcc(annvrsryManageVO); + List result = new ArrayList(); + long lTemp = 0; + int num = result_temp.size(); + + for (int i = 0; i < num; i++) { + AnnvrsryManageVO annvrsryManageVO1 = result_temp.get(i); + lTemp = getDateCount(annvrsryManageVO1); + + if (lTemp >= 0 && lTemp < Long.parseLong(annvrsryManageVO1.getAnnvrsryBeginDe().replaceAll("\\p{Space}", ""))) { + annvrsryManageVO1.setAnnvrsryDe(EgovDateUtil.formatDate(annvrsryManageVO1.getAnnvrsryDe(), "-")); + result_temp.set(i, annvrsryManageVO1); + result.add(result_temp.get(i)); + } + } + return result; + } + + /** + * 기념일관리목록 총 갯수를 조회한다. + * @param annvrsryManageVO - 기념일관리 VO + * @return int - 기념일관리 카운트 수 + */ + public int selectAnnvrsryManageDplctAt(AnnvrsryManage annvrsryManage) throws Exception { + return annvrsryManageDAO.selectAnnvrsryManageDplctAt(annvrsryManage); + } + + /** + * 해당일자와 현재일자의 일수 계산 + * @param annvrsryManageVO + * @return long + */ + private long getDateCount(AnnvrsryManageVO annvrsryManageVO) throws Exception { + + /* 날짜 사이의 기간 산출 */ + long resultDay = 0; + Calendar to_day = Calendar.getInstance(); //Calendar객체를 생성합니다. + Calendar target_day = Calendar.getInstance(); + + String sAnnvrsryDe = null; + + sAnnvrsryDe = EgovStringUtil.removeMinusChar(annvrsryManageVO.getAnnvrsryDe()); + + // 매년반복일 경우 + if ("1".equals(annvrsryManageVO.getReptitSe())) { + sAnnvrsryDe = Integer.toString(to_day.get(Calendar.YEAR)) + (sAnnvrsryDe == null || sAnnvrsryDe.length() < 8 ? to_day.get(Calendar.MONTH) : sAnnvrsryDe.substring(4, 6)) + (sAnnvrsryDe == null || sAnnvrsryDe.length() < 8 ? to_day.get(Calendar.DATE) : sAnnvrsryDe.substring(6, 8)); + } + + // 음력인 경우 양력으로 환산 + if ("2".equals(annvrsryManageVO.getCldrSe())) { + sAnnvrsryDe = EgovDateUtil.toSolar(sAnnvrsryDe, 0); + } + + if (sAnnvrsryDe != null && !sAnnvrsryDe.equals("")) { + target_day.set(Integer.parseInt(sAnnvrsryDe.substring(0, 4)), Integer.parseInt(sAnnvrsryDe.substring(4, 6)) - 1, Integer.parseInt(sAnnvrsryDe.substring(6, 8))); + } else { + target_day.set(to_day.get(Calendar.YEAR), to_day.get(Calendar.MONTH) + 1, to_day.get(Calendar.DATE)); + } + + long resultTime = target_day.getTime().getTime() - to_day.getTime().getTime(); // 차이 구하기 + if (resultTime > 0) { + resultDay = resultTime / (1000 * 60 * 60 * 24);// 일로 바꾸기 + } else { + resultDay = -1; + } + //annvrsryManageVO.setAnnvrsryBeginDe(Long.toString(resultDay)); + + return resultDay; + } + + /*### 엑셀 일괄처리 프로세스 ###*/ + + /** + * 기념일정보 excel생성 + * @param inputStream InputStream + * @return String + * @exception Exception + */ + public List selectAnnvrsryManageBnde(InputStream inputStream) throws Exception { + //int annvrsrySheetRowCnt = 0; + //String xlsFile = null; + + String sTempId = null; //사용자ID + String sTempNm = null; //사용자명 + String sTempAnnvrsryDe = null; //기념일자 + String sTempCldrSe = null; //양/음 구분 + String sTempAnnvrsrySe = null; //기념일구분 + String sTempAnnvrsryNm = null; //기념일명 + String sTempReptitSe = null; // 반복여부 + + List list = new ArrayList(); + + //String sBndtDe = null; + HSSFWorkbook hssfWB = (HSSFWorkbook) excelZipService.loadWorkbook(inputStream); + // 엑셀 파일 시트 갯수 확인 sheet = 1 + if (hssfWB.getNumberOfSheets() == 1) { + HSSFSheet annvrsrySheet = hssfWB.getSheetAt(0); //기념일관리 시트 가져오기 + //HSSFRow annvrsryRow = annvrsrySheet.getRow(1); //기념일 row 가져오기 + //annvrsrySheetRowCnt = annvrsryRow.getPhysicalNumberOfCells(); //기념일 cell Cnt + int rowsCnt = annvrsrySheet.getPhysicalNumberOfRows(); //행 갯수 가져오기 + + //사용자ID 기념일자 양/음 구분 기념일구분 기념일명 + for (int j = 1; j < rowsCnt; j++) { //row 루프 + AnnvrsryManageVO annvrsryManageVO = new AnnvrsryManageVO(); + AnnvrsryManageVO annvrsryManageVOTemp = null; + HSSFRow row = annvrsrySheet.getRow(j); //row 가져오기 + if (row != null) { + //int cells = row.getPhysicalNumberOfCells(); //cell 갯수 가져오기 + HSSFCell cell = null; + cell = row.getCell(0); //사용자ID + if (cell != null) { + sTempId = (String) cell.getStringCellValue(); + } + + cell = row.getCell(1); //사용자명 + if (cell != null) { + sTempNm = (String) cell.getStringCellValue(); + } + + cell = row.getCell(2); //기념일자 + if (cell != null) { + sTempAnnvrsryDe = (String) cell.getStringCellValue(); + } + + cell = row.getCell(3); //양/음구분 + if (cell != null) { + sTempCldrSe = (String) cell.getStringCellValue(); + } + + cell = row.getCell(4); //기념일구분 + if (cell != null) { + sTempAnnvrsrySe = (String) cell.getStringCellValue(); + } + cell = row.getCell(5); //기념일명 + if (cell != null) { + sTempAnnvrsryNm = (String) cell.getStringCellValue(); + } + cell = row.getCell(6); //반복여부 + if (cell != null) { + sTempReptitSe = (String) cell.getStringCellValue(); + } + annvrsryManageVO.setUsid(sTempId); // 당직자ID + annvrsryManageVO.setAnnvrsryTemp1(sTempNm); // 당직자명 + annvrsryManageVO.setAnnvrsrySe(sTempAnnvrsrySe); + annvrsryManageVOTemp = annvrsryManageDAO.selectAnnvrsryManageBnde(annvrsryManageVO); + if (annvrsryManageVOTemp != null) annvrsryManageVO = annvrsryManageVOTemp; // 기존에 등록되어 있는경우 + annvrsryManageVO.setAnnvrsrySe(sTempAnnvrsrySe); + annvrsryManageVO.setAnnvrsryDe(EgovDateUtil.formatDate(sTempAnnvrsryDe, "-")); + annvrsryManageVO.setCldrSe(sTempCldrSe); + annvrsryManageVO.setAnnvrsryNm(sTempAnnvrsryNm); + annvrsryManageVO.setReptitSe(sTempReptitSe); + list.add(annvrsryManageVO); + } + } + } + + return list; + } + + /** + * 기념일정보를 일괄등록처리한다. + * @param annvrsryManageVO - 기념일관리 VO + * @param String - 기념일정보 + */ + public void insertAnnvrsryManageBnde(AnnvrsryManageVO annvrsryManageVO, String checkedAnnvrsryManageForInsert) throws Exception { + AnnvrsryManage annvrsryManage; + //int insertCnt = 0; + String[] annvrsryManageValues = checkedAnnvrsryManageForInsert.split("[$]"); + String[] sTempAnnvrsryManage; + String sTemp = null; + String sAnnId = null; + + if (checkedAnnvrsryManageForInsert != null && !checkedAnnvrsryManageForInsert.equals("")) { + for (int i = 0; i < annvrsryManageValues.length; i++) { + annvrsryManage = new AnnvrsryManage(); + sTemp = annvrsryManageValues[i]; + sTempAnnvrsryManage = sTemp.split(","); + annvrsryManage.setUsid(sTempAnnvrsryManage[0]); + + annvrsryManage.setAnnvrsryDe(EgovStringUtil.removeMinusChar(sTempAnnvrsryManage[1])); + annvrsryManage.setCldrSe(sTempAnnvrsryManage[2]); + annvrsryManage.setAnnvrsrySe(sTempAnnvrsryManage[3]); + annvrsryManage.setAnnvrsryNm(sTempAnnvrsryManage[4]); + if ("Y".equals(sTempAnnvrsryManage[5])) { + annvrsryManage.setReptitSe("1"); + } + annvrsryManage.setAnnvrsryBeginDe("7"); + annvrsryManage.setAnnvrsrySetup("Y"); + annvrsryManage.setMemo("기념일 일괄등록"); + sAnnId = idgenAnnvrsryManageService.getNextStringId(); + annvrsryManage.setAnnId(sAnnId); + + annvrsryManage.setFrstRegisterId(annvrsryManageVO.getFrstRegisterId()); + annvrsryManageDAO.insertAnnvrsryManage(annvrsryManage); + } + } + } + + /** + * 기념일관리 건수를 조회한다. + * @param annvrsryManage - 기념일관리 + * @return int + * @exception Exception + + public int selectAnnvrsryManageMonthCnt(AnnvrsryManageVO annvrsryManageVO) throws Exception { + return annvrsryManageDAO.selectAnnvrsryManageMonthCnt(annvrsryManageVO); + } + */ + +} diff --git a/src/main/java/egovframework/com/uss/ion/ans/web/EgovAnnvrsryManageController.java b/src/main/java/egovframework/com/uss/ion/ans/web/EgovAnnvrsryManageController.java new file mode 100644 index 0000000..b236d2b --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ans/web/EgovAnnvrsryManageController.java @@ -0,0 +1,539 @@ +package egovframework.com.uss.ion.ans.web; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Calendar; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +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.springframework.web.bind.support.SessionStatus; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import egovframework.com.cmm.ComDefaultCodeVO; +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.service.EgovCmmUseService; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.ion.ans.service.AnnvrsryManage; +import egovframework.com.uss.ion.ans.service.AnnvrsryManageVO; +import egovframework.com.uss.ion.ans.service.EgovAnnvrsryManageService; +import egovframework.com.utl.fcc.service.EgovDateUtil; +import egovframework.com.utl.fcc.service.EgovStringUtil; + +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +/** + * 개요 + * - 기념일관리에 대한 controller 클래스를 정의한다. + * + * 상세내용 + * - 기념일관리에 대한 등록, 수정, 삭제, 조회 기능을 제공한다. + * - 기념일관리의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + *
    + * << 개정이력(Modification Information) >>
    + *
    + *  수정일               수정자            수정내용
    + *  ----------   --------   ---------------------------
    + *  2009.06.25   이용               최초 생성
    + *  2011.08.26   정진오            IncludedInfo annotation 추가
    + *  2020.11.02   신용호            KISA 보안약점 조치 - 자원해제
    + *
    + *  
    + */ + +@Controller +public class EgovAnnvrsryManageController { + + @Resource(name = "egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name = "egovAnnvrsryManageService") + private EgovAnnvrsryManageService egovAnnvrsryManageService; + + @Autowired + private DefaultBeanValidator beanValidator; + + @Resource(name = "EgovCmmUseService") + private EgovCmmUseService cmmUseService; + + /** + * 기념일관리 목록화면 이동 + * @return String + * @exception Exception + */ + @RequestMapping("/uss/ion/ans/selectAnnvrsryManageListView.do") + public String selectAnnvrsryManageListView() throws Exception { + + return "egovframework/com/uss/ion/ans/EgovAnnvrsryManageList"; + } + + /** + * 기념일관리정보를 관리하기 위해 등록된 기념일관리 목록을 조회한다. + * @param annvrsryManageVO - 기념일관리 VO + * @return String - 리턴 Url + */ + @IncludedInfo(name = "기념일관리", order = 930, gid = 50) + @RequestMapping(value = "/uss/ion/ans/selectAnnvrsryManageList.do") + public String selectAnnvrsryManageList(@ModelAttribute("annvrsryManageVO") AnnvrsryManageVO annvrsryManageVO, + @ModelAttribute("annvrsryManageVO") AnnvrsryManageVO annvrsryGdcc, + ModelMap model) throws Exception { + + java.util.Calendar cal = java.util.Calendar.getInstance(); + String[] yearList = new String[5]; + for (int x = 0; x < 5; x++) { + yearList[x] = Integer.toString(cal.get(java.util.Calendar.YEAR) + 2 - x); + } + if (annvrsryManageVO.getSearchKeyword() == null || annvrsryManageVO.getSearchKeyword().equals("")) { + annvrsryManageVO.setSearchKeyword(Integer.toString(cal.get(java.util.Calendar.YEAR))); + } + + //로그인 객체 선언 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + if (loginVO == null) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + annvrsryManageVO.setUsid(loginVO.getUniqId()); + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(annvrsryManageVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(annvrsryManageVO.getPageUnit()); + paginationInfo.setPageSize(annvrsryManageVO.getPageSize()); + + annvrsryManageVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + annvrsryManageVO.setLastIndex(paginationInfo.getLastRecordIndex()); + annvrsryManageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + annvrsryManageVO.setAnnvrsryManageList(egovAnnvrsryManageService.selectAnnvrsryManageList(annvrsryManageVO)); + model.addAttribute("annvrsryManageList", annvrsryManageVO.getAnnvrsryManageList()); + + int totCnt = egovAnnvrsryManageService.selectAnnvrsryManageListTotCnt(annvrsryManageVO); + paginationInfo.setTotalRecordCount(totCnt); + //annvrsryGdcc.setAnnvrsryManageList(egovAnnvrsryManageService.selectAnnvrsryGdcc(annvrsryManageVO)); + //model.addAttribute("annvrsryGdccList", annvrsryGdcc.getAnnvrsryManageList()); + + model.addAttribute("yearList", yearList); + model.addAttribute("paginationInfo", paginationInfo); + + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + return "egovframework/com/uss/ion/ans/EgovAnnvrsryManageList"; + } + + /** + * 등록된 기념일관리의 상세정보를 조회한다. + * @param annvrsryManageVO - 기념일관리 VO + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/ion/ans/selectAnnvrsryManage.do") + public String selectAnnvrsryManage(@ModelAttribute("annvrsryManage") AnnvrsryManage annvrsryManage, + @ModelAttribute("annvrsryManageVO") AnnvrsryManageVO annvrsryManageVO, + @RequestParam Map commandMap, + ModelMap model) throws Exception { + + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); // 상세정보 구분 + String sTempAnnvrsryDe = null; + String sTempCldrSe = null; + String sTempAnnvrsrySetup = null; + AnnvrsryManageVO annvrsryManageVO_Temp = new AnnvrsryManageVO(); + annvrsryManageVO_Temp = egovAnnvrsryManageService.selectAnnvrsryManage(annvrsryManageVO); + + if ("1".equals(annvrsryManageVO_Temp.getCldrSe())) { + sTempCldrSe = egovMessageSource.getMessage("comUssIonAns.annvrsryGdcc.cldrSe1");//양 + } + else { + sTempCldrSe = egovMessageSource.getMessage("comUssIonAns.annvrsryGdcc.cldrSe2");//음 + } + sTempAnnvrsryDe = annvrsryManageVO_Temp.getAnnvrsryDe() + "(" + sTempCldrSe + ")"; + annvrsryManageVO_Temp.setAnnvrsryTemp4(sTempAnnvrsryDe); + + if ("Y".equals(annvrsryManageVO_Temp.getAnnvrsrySetup())) { + sTempAnnvrsrySetup = "ON"; + } else { + sTempAnnvrsrySetup = "OFF"; + } + annvrsryManageVO_Temp.setAnnvrsryTemp5(sTempAnnvrsrySetup); + + model.addAttribute("annvrsryManageVO", annvrsryManageVO_Temp); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + if (sCmd.equals("update")) { + + annvrsryManage.setAnnId(annvrsryManageVO_Temp.getAnnId()); + annvrsryManage.setAnnvrsryNm(annvrsryManageVO_Temp.getAnnvrsryNm()); + annvrsryManage.setAnnvrsryDe(annvrsryManageVO_Temp.getAnnvrsryDe()); + annvrsryManage.setCldrSe(annvrsryManageVO_Temp.getCldrSe()); + annvrsryManage.setUsid(annvrsryManageVO_Temp.getUsid()); + annvrsryManage.setAnnvrsrySe(annvrsryManageVO_Temp.getAnnvrsrySe()); + + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM069"); + List annvrsrySeCodeList = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("annvrsrySeCode", annvrsrySeCodeList); + model.addAttribute("annvrsryManage", annvrsryManage); + return "egovframework/com/uss/ion/ans/EgovAnnvrsryUpdt"; + } else { + return "egovframework/com/uss/ion/ans/EgovAnnvrsryDetail"; + } + } + + /** + * 기념일관리 등록 화면으로 이동한다. + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/ion/ans/insertViewAnnvrsry.do") + public String insertViewAnnvrsryManage(@ModelAttribute("annvrsryManage") AnnvrsryManage annvrsryManage, + @ModelAttribute("annvrsryManageVO") AnnvrsryManageVO annvrsryManageVO, + ModelMap model) throws Exception { + //로그인 객체 선언 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + annvrsryManage.setUsid(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + annvrsryManage.setAnnvrsrySetup("Y"); + annvrsryManage.setCldrSe("1"); // 1:양력 2:음력 + annvrsryManageVO.setUsid(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); // 사용자ID + annvrsryManageVO.setAnnvrsryTemp1(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getName())); // 사용자명 + annvrsryManageVO.setAnnvrsryTemp2(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getOrgnztNm())); // 조직 ID + + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM069"); + List annvrsrySeCodeList = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("annvrsrySeCode", annvrsrySeCodeList); + model.addAttribute("annvrsryManage", annvrsryManage); + model.addAttribute("annvrsryManageVO", annvrsryManageVO); + return "egovframework/com/uss/ion/ans/EgovAnnvrsryRegist"; + } + + /** + * 기념일관리정보를 신규로 등록한다. + * @param annvrsryManage - 기념일관리 model + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/ion/ans/insertAnnvrsry.do") + public String insertAnnvrsryManage(@ModelAttribute("annvrsryManage") AnnvrsryManage annvrsryManage, + @ModelAttribute("annvrsryManageVO") AnnvrsryManageVO annvrsryManageVO, + BindingResult bindingResult, + SessionStatus status, + ModelMap model) throws Exception { + + beanValidator.validate(annvrsryManage, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM069"); + List annvrsrySeCodeList = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("annvrsrySeCode", annvrsrySeCodeList); + + model.addAttribute("annvrsryManageVO", annvrsryManageVO); + model.addAttribute("message", egovMessageSource.getMessage("fail.common.insert")); + return "egovframework/com/uss/ion/ans/EgovAnnvrsryRegist"; + } else { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + status.setComplete(); + model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); + annvrsryManage.setFrstRegisterId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + + if (egovAnnvrsryManageService.selectAnnvrsryManageDplctAt(annvrsryManage) == 0) { + egovAnnvrsryManageService.insertAnnvrsryManage(annvrsryManage); + model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); + return "forward:/uss/ion/ans/selectAnnvrsryManageList.do"; + } else { + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM069"); + List annvrsrySeCodeList = cmmUseService.selectCmmCodeDetail(vo); + annvrsryManageVO.setAnnvrsryTemp1(user == null ? "" : EgovStringUtil.isNullToString(user.getName())); + annvrsryManageVO + .setAnnvrsryTemp2(user == null ? "" : EgovStringUtil.isNullToString(user.getOrgnztNm())); + model.addAttribute("annvrsrySeCode", annvrsrySeCodeList); + model.addAttribute("annvrsryManageVO", annvrsryManageVO); + model.addAttribute("dplctMessage", egovMessageSource.getMessage("comUssIonAns.common.duplicate"));//이미 등록된 데이타입니다. 해당 데이타를 확인해 주세요"); + return "egovframework/com/uss/ion/ans/EgovAnnvrsryRegist"; + } + } + } + + /** + * 기 등록된 기념일관리정보를 수정한다. + * @param annvrsryManage - 기념일관리 model + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/ion/ans/updateAnnvrsryManage.do") + public String updateAnnvrsryManage(@ModelAttribute("annvrsryManage") AnnvrsryManage annvrsryManage, + @ModelAttribute("annvrsryManageVO") AnnvrsryManageVO annvrsryManageVO, + BindingResult bindingResult, + SessionStatus status, + ModelMap model) throws Exception { + + beanValidator.validate(annvrsryManage, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + model.addAttribute("annvrsryManageVO", annvrsryManage); + return "egovframework/com/uss/ion/ans/EgovAnnvrsryManageUpdt"; + } else { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + status.setComplete(); + annvrsryManage.setLastUpdusrId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + + if (egovAnnvrsryManageService.selectAnnvrsryManageDplctAt(annvrsryManage) == 0) { + egovAnnvrsryManageService.updateAnnvrsryManage(annvrsryManage); + model.addAttribute("message", egovMessageSource.getMessage("success.common.update")); + return "forward:/uss/ion/ans/selectAnnvrsryManageList.do"; + } else { + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM069"); + List annvrsrySeCodeList = cmmUseService.selectCmmCodeDetail(vo); + annvrsryManageVO.setAnnvrsryTemp1(user == null ? "" : EgovStringUtil.isNullToString(user.getName())); + annvrsryManageVO + .setAnnvrsryTemp2(user == null ? "" : EgovStringUtil.isNullToString(user.getOrgnztNm())); + model.addAttribute("annvrsrySeCode", annvrsrySeCodeList); + model.addAttribute("annvrsryManageVO", annvrsryManageVO); + model.addAttribute("dplctMessage", egovMessageSource.getMessage("comUssIonAns.common.duplicate"));//이미 등록된 데이타입니다. 해당 데이타를 확인해 주세요"); + return "egovframework/com/uss/ion/ans/EgovAnnvrsryUpdt"; + } + } + } + + /** + * 기 등록된 기념일관리정보를 삭제한다. + * @param annvrsryManage - 기념일관리 model + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/ion/ans/deleteAnnvrsryManage.do") + public String deleteAnnvrsryManage(@ModelAttribute("annvrsryManage") AnnvrsryManage annvrsryManage, + SessionStatus status, + ModelMap model) throws Exception { + + egovAnnvrsryManageService.deleteAnnvrsryManage(annvrsryManage); + status.setComplete(); + model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); + return "forward:/uss/ion/ans/selectAnnvrsryManageList.do"; + } + + /** + * Main화면에서 알림설정에 다른 기념일관리 목록을 조회한다. + * @param annvrsryManageVO - 기념일관리 VO + * @return String - 리턴 Url + */ + @IncludedInfo(name = "기념일목록(확인용)", order = 931, gid = 50) + @RequestMapping(value = "/uss/ion/ans/selectAnnvrsryMainList.do") + public String selectAnnvrsryMainList(@ModelAttribute("annvrsryManageVO") AnnvrsryManageVO annvrsryManageVO, + @ModelAttribute("annvrsryManageVO") AnnvrsryManageVO annvrsryGdcc, + ModelMap model) throws Exception { + + //로그인 객체 선언 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + if (loginVO == null) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + annvrsryManageVO.setUsid(loginVO.getUniqId()); + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(annvrsryManageVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(annvrsryManageVO.getPageUnit()); + paginationInfo.setPageSize(annvrsryManageVO.getPageSize()); + + annvrsryManageVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + annvrsryManageVO.setLastIndex(paginationInfo.getLastRecordIndex()); + annvrsryManageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + annvrsryManageVO.setAnnvrsryManageList(egovAnnvrsryManageService.selectAnnvrsryGdcc(annvrsryManageVO)); + model.addAttribute("annvrsryGdccList", annvrsryManageVO.getAnnvrsryManageList()); + + int totCnt = egovAnnvrsryManageService.selectAnnvrsryManageListTotCnt(annvrsryManageVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + return "egovframework/com/uss/ion/ans/EgovAnnvrsryMainList"; + } + + /** + * 등록된 기념일관리의 알림 화면을 조회한다. + * @param annvrsryManageVO - 기념일관리 VO + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/ion/ans/selectAnnvrsryGdcc.do") + public String selectAnnvrsryGdcc(@ModelAttribute("annvrsryManageVO") AnnvrsryManageVO annvrsryManageVO, + ModelMap model) throws Exception { + String sTempAnnvrsryDe = null; + String sTempCldrSe = null; + String sTempAnnvrsrySetup = null; + String sAnnvrsryDe = null; + AnnvrsryManageVO annvrsryManageVO_Temp = new AnnvrsryManageVO(); + /* + String sAnnvrsryDe_Temp = null; + + sAnnvrsryDe_Temp = EgovStringUtil.removeMinusChar(annvrsryManageVO.getAnnvrsryDe()); + if("0".equals(annvrsryManageVO.getCldrSe())){ // 음력인 경우 양력으로 환산 + sAnnvrsryDe_Temp = EgovDateUtil.toSolar(sAnnvrsryDe_Temp, 0); + annvrsryManageVO.setAnnvrsryDe(sAnnvrsryDe_Temp); + } + */ + annvrsryManageVO_Temp = egovAnnvrsryManageService.selectAnnvrsryManage(annvrsryManageVO); + sAnnvrsryDe = EgovStringUtil.removeMinusChar(annvrsryManageVO_Temp.getAnnvrsryDe()); + if ("1".equals(annvrsryManageVO_Temp.getCldrSe())) { + sTempCldrSe = egovMessageSource.getMessage("comUssIonAns.annvrsryGdcc.cldrSe1");//양 + } else { + sTempCldrSe = egovMessageSource.getMessage("comUssIonAns.annvrsryGdcc.cldrSe2");//음 + sAnnvrsryDe = EgovDateUtil.toSolar(sAnnvrsryDe, 0); + } + + sTempAnnvrsryDe = annvrsryManageVO_Temp.getAnnvrsryDe() + "(" + sTempCldrSe + ")"; + annvrsryManageVO_Temp.setAnnvrsryTemp4(sTempAnnvrsryDe); + + if ("Y".equals(annvrsryManageVO_Temp.getAnnvrsrySetup())) { + sTempAnnvrsrySetup = "ON"; + } else { + sTempAnnvrsrySetup = "OFF"; + } + annvrsryManageVO_Temp.setAnnvrsryTemp5(sTempAnnvrsrySetup); + + /* 날짜 사이의 기간 산출 */ + long resultDay = 0; + Calendar to_day = Calendar.getInstance(); //Calendar객체를 생성합니다. + Calendar target_day = Calendar.getInstance(); + + if (sAnnvrsryDe != null && !sAnnvrsryDe.equals("")) { + target_day.set(Integer.parseInt(sAnnvrsryDe.substring(0, 4)), + Integer.parseInt(sAnnvrsryDe.substring(4, 6)) - 1, Integer.parseInt(sAnnvrsryDe.substring(6, 8))); + } else { + target_day.set(to_day.get(Calendar.YEAR), to_day.get(Calendar.MONTH) + 1, to_day.get(Calendar.DATE)); + } + + long resultTime = target_day.getTime().getTime() - to_day.getTime().getTime(); // 차이 구하기 + if (resultTime > 0) { + resultDay = resultTime / (1000 * 60 * 60 * 24);// 일로 바꾸기 + } else { + resultDay = 0; + } + + annvrsryManageVO_Temp.setAnnvrsryBeginDe(Long.toString(resultDay)); + + model.addAttribute("annvrsryManageVO", annvrsryManageVO_Temp); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/uss/ion/ans/EgovAnnvrsryGdcc"; + } + + /** + * 기념일일괄등록화면 호출 및 기념일일괄등록처리 프로세스 + * @param annvrsryManageVO AnnvrsryManageVO + * @param request HttpServletRequest + * @return 출력페이지정보 "ion/bnt/EgovBndtManageListPop" + * @exception Exception + */ + @RequestMapping(value = "/uss/ion/ans/EgovAnnvrsryManageListPop.do") + public String selectAnnvrsryManageBnde(final HttpServletRequest request, + @ModelAttribute("annvrsryManageVO") AnnvrsryManageVO annvrsryManageVO, + @RequestParam Map commandMap, + BindingResult bindingResult, + ModelMap model) throws Exception { + String resultMsg = ""; + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); // 상세정보 구분 + + // 0. Spring Security 사용자권한 처리 + + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + return "egovframework/com/uss/ion/ans/EgovAnnvrsryManageBndeListPop"; + } + + @RequestMapping(value = "/uss/ion/ans/EgovAnnvrsryManageListPopAction.do") + public String selectAnnvrsryManageBndeAction(final MultipartHttpServletRequest multiRequest, + @ModelAttribute("annvrsryManageVO") AnnvrsryManageVO annvrsryManageVO, + @RequestParam Map commandMap, + ModelMap model) throws Exception { + String resultMsg = ""; + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); // 상세정보 구분 + + // 0. Spring Security 사용자권한 처리 + + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + if (sCmd.equals("bnde")) { + //final MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) request; + final Map files = multiRequest.getFileMap(); + Iterator> itr = files.entrySet().iterator(); + MultipartFile file; + while (itr.hasNext()) { + Entry entry = itr.next(); + file = entry.getValue(); + if (!"".equals(file.getOriginalFilename())) { + // KISA 보안약점 조치 - 자원해제 + InputStream is = null; + try { + is = file.getInputStream(); + model.addAttribute("annvrsryManageList", + egovAnnvrsryManageService.selectAnnvrsryManageBnde(is)); + } catch (IOException e) { + throw new IOException(e); + } finally { + if (is != null) {//2022.01.Possible null pointer dereference in method on exception path 처리 + is.close(); + } + } + } else { + resultMsg = egovMessageSource.getMessage("fail.common.msg"); + } + } + model.addAttribute("resultMsg", resultMsg); + } + return "egovframework/com/uss/ion/ans/EgovAnnvrsryManageBndeListPop"; + } + + /** + * 기념일정보를 일괄등록처리한다. + * @param annvrsryManageVO - 기념일관리 VO + * @param String - 기념일정보 + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/ion/ans/insertAnnvrsryManageBnde.do") + public String insertAnnvrsryManageBnde( + @RequestParam("checkedAnnvrsryManageForInsert") String checkedAnnvrsryManageForInsert, + @ModelAttribute("annvrsryManageVO") AnnvrsryManageVO annvrsryManageVO, + SessionStatus status, + ModelMap model) throws Exception { + //int iTemp = egovAnnvrsryManageService.selectAnnvrsryManageMonthCnt(annvrsryManageVO); + // if(iTemp == 0 ){ + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + annvrsryManageVO.setFrstRegisterId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + egovAnnvrsryManageService.insertAnnvrsryManageBnde(annvrsryManageVO, checkedAnnvrsryManageForInsert); + status.setComplete(); + model.addAttribute("message", "true"); + return "egovframework/com/uss/ion/ans/EgovAnnvrsryManageBndeListPop"; + // }else{ + //String sTempMessage = annvrsryManageVO.getBndtDe().substring(0,4)+"년"+bndtManageVO.getBndtDe().substring(4,6)+"월 데이타가 존재합니다."; + //model.addAttribute("message", sTempMessage); + // return "egovframework/com/uss/ion/bnt/EgovBndtManageBndeListPop"; + // } + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/bnr/service/Banner.java b/src/main/java/egovframework/com/uss/ion/bnr/service/Banner.java new file mode 100644 index 0000000..5e131e9 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/bnr/service/Banner.java @@ -0,0 +1,200 @@ +/** + * 개요 + * - 배너에 대한 model 클래스를 정의한다. + * + * 상세내용 + * - 배너의 일련번호, 배너명, 링크URL, 배너설명, 반영여부 항목을 관리한다. + * @author 이문준 + * @version 1.0 + * @created 03-8-2009 오후 2:07:10 + */ + +package egovframework.com.uss.ion.bnr.service; + +import egovframework.com.cmm.ComDefaultVO; + +public class Banner extends ComDefaultVO { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + /** + * 배너 ID + */ + private String bannerId; + /** + * 배너 명 + */ + private String bannerNm; + /** + * 링크 URL + */ + private String linkUrl; + /** + * 배너 이미지 + */ + private String bannerImage; + /** + * 배너 이미지 파일 + */ + private String bannerImageFile; + /** + * 배너 설명 + */ + private String bannerDc; + /** + * 정렬 순서 + */ + private String sortOrdr; + /** + * 반영여부 + */ + private String reflctAt; + /** + * 사용자 ID + */ + private String userId; + /** + * 등록일자 + */ + private String regDate; + /** + * 파일첨부여부 + */ + private boolean isAtchFile; + + /** + * @return the bannerId + */ + public String getBannerId() { + return bannerId; + } + /** + * @param bannerId the bannerId to set + */ + public void setBannerId(String bannerId) { + this.bannerId = bannerId; + } + /** + * @return the bannerNm + */ + public String getBannerNm() { + return bannerNm; + } + /** + * @param bannerNm the bannerNm to set + */ + public void setBannerNm(String bannerNm) { + this.bannerNm = bannerNm; + } + /** + * @return the linkUrl + */ + public String getLinkUrl() { + return linkUrl; + } + /** + * @param linkUrl the linkUrl to set + */ + public void setLinkUrl(String linkUrl) { + this.linkUrl = linkUrl; + } + /** + * @return the bannerImage + */ + public String getBannerImage() { + return bannerImage; + } + /** + * @param bannerImage the bannerImage to set + */ + public void setBannerImage(String bannerImage) { + this.bannerImage = bannerImage; + } + /** + * @return the bannerImageFile + */ + public String getBannerImageFile() { + return bannerImageFile; + } + /** + * @param bannerImageFile the bannerImageFile to set + */ + public void setBannerImageFile(String bannerImageFile) { + this.bannerImageFile = bannerImageFile; + } + /** + * @return the bannerDc + */ + public String getBannerDc() { + return bannerDc; + } + /** + * @param bannerDc the bannerDc to set + */ + public void setBannerDc(String bannerDc) { + this.bannerDc = bannerDc; + } + /** + * @return the sortOrdr + */ + public String getSortOrdr() { + return sortOrdr; + } + /** + * @param sortOrdr the sortOrdr to set + */ + public void setSortOrdr(String sortOrdr) { + this.sortOrdr = sortOrdr; + } + /** + * @return the reflctAt + */ + public String getReflctAt() { + return reflctAt; + } + /** + * @param reflctAt the reflctAt to set + */ + public void setReflctAt(String reflctAt) { + this.reflctAt = reflctAt; + } + /** + * @return the userId + */ + public String getUserId() { + return userId; + } + /** + * @param userId the userId to set + */ + public void setUserId(String userId) { + this.userId = userId; + } + /** + * @return the regDate + */ + public String getRegDate() { + return regDate; + } + /** + * @param regDate the regDate to set + */ + public void setRegDate(String regDate) { + this.regDate = regDate; + } + /** + * @return the isAtchFile + */ + public boolean isAtchFile() { + return isAtchFile; + } + /** + * @param isAtchFile the isAtchFile to set + */ + public void setAtchFile(boolean isAtchFile) { + this.isAtchFile = isAtchFile; + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/bnr/service/BannerVO.java b/src/main/java/egovframework/com/uss/ion/bnr/service/BannerVO.java new file mode 100644 index 0000000..8616858 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/bnr/service/BannerVO.java @@ -0,0 +1,75 @@ +/** + * 개요 + * - 배너에 대한 Vo 클래스를 정의한다. + * + * 상세내용 + * - 배너의 목록 항목을 관리한다. + * @author 이문준 + * @version 1.0 + * @created 03-8-2009 오후 2:07:13 + */ + +package egovframework.com.uss.ion.bnr.service; + +import java.util.List; + +public class BannerVO extends Banner { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + /** + * 배너 목록 + */ + List bannerList; + /** + * 삭제대상 목록 + */ + String[] delYn; + /** + * 결과 반영 타입 + * vertical : 세로 + * horizontal : 가로 + */ + String resultType = "horizontal"; + + /** + * @return the bannerList + */ + public List getBannerList() { + return bannerList; + } + /** + * @param bannerList the bannerList to set + */ + public void setBannerList(List bannerList) { + this.bannerList = bannerList; + } + /** + * @return the delYn + */ + public String[] getDelYn() { + return delYn; + } + /** + * @param delYn the delYn to set + */ + public void setDelYn(String[] delYn) { + this.delYn = delYn; + } + /** + * @return the resultType + */ + public String getResultType() { + return resultType; + } + /** + * @param resultType the resultType to set + */ + public void setResultType(String resultType) { + this.resultType = resultType; + } + + +} diff --git a/src/main/java/egovframework/com/uss/ion/bnr/service/EgovBannerService.java b/src/main/java/egovframework/com/uss/ion/bnr/service/EgovBannerService.java new file mode 100644 index 0000000..798e8fe --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/bnr/service/EgovBannerService.java @@ -0,0 +1,86 @@ +/** + * 개요 + * - 배너에 대한 Service Interface를 정의한다. + * + * 상세내용 + * - 배너에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 배너의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이문준 + * @version 1.0 + * @created 03-8-2009 오후 2:07:12 + */ + +package egovframework.com.uss.ion.bnr.service; + +import java.util.List; + +public interface EgovBannerService { + + /** + * 배너를 관리하기 위해 등록된 배너목록을 조회한다. + * @param bannerVO - 배너 Vo + * @return List - 배너 목록 + * + * @param bannerVO + */ + public List selectBannerList(BannerVO bannerVO) throws Exception; + + /** + * 배너목록 총 갯수를 조회한다. + * @param bannerVO - 배너 Vo + * @return int - 배너 카운트 수 + * + * @param bannerVO + */ + public int selectBannerListTotCnt(BannerVO bannerVO) throws Exception; + + /** + * 등록된 배너의 상세정보를 조회한다. + * @param bannerVO - 배너 Vo + * @return BannerVO - 배너 Vo + * + * @param bannerVO + */ + public BannerVO selectBanner(BannerVO bannerVO) throws Exception; + + /** + * 배너정보를 신규로 등록한다. + * @param banner - 배너 model + * + * @param banner + */ + public BannerVO insertBanner(Banner banner, BannerVO bannerVO) throws Exception; + + /** + * 기 등록된 배너정보를 수정한다. + * @param banner - 배너 model + * + * @param banner + */ + public void updateBanner(Banner banner) throws Exception; + + /** + * 기 등록된 배너정보를 삭제한다. + * @param banner - 배너 model + * + * @param banner + */ + public void deleteBanner(Banner banner) throws Exception; + + /** + * 기 등록된 배너정보의 이미지파일을 삭제한다. + * @param banner - 배너 model + * + * @param banner + */ + public void deleteBannerFile(Banner banner) throws Exception; + + /** + * 배너가 특정화면에 반영된 결과를 조회한다. + * @param bannerVO - 배너 Vo + * @return BannerVO - 배너 Vo + * + * @param bannerVO + */ + public List selectBannerResult(BannerVO bannerVO) throws Exception; +} diff --git a/src/main/java/egovframework/com/uss/ion/bnr/service/impl/BannerDAO.java b/src/main/java/egovframework/com/uss/ion/bnr/service/impl/BannerDAO.java new file mode 100644 index 0000000..9bf504e --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/bnr/service/impl/BannerDAO.java @@ -0,0 +1,104 @@ +/** + * 개요 + * - 배너에 대한 DAO 클래스를 정의한다. + * + * 상세내용 + * - 배너에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 배너의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이문준 + * @version 1.0 + * @created 03-8-2009 오후 2:07:11 + */ + +package egovframework.com.uss.ion.bnr.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.FileVO; +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.ion.bnr.service.Banner; +import egovframework.com.uss.ion.bnr.service.BannerVO; + +import org.springframework.stereotype.Repository; + +@Repository("bannerDAO") +public class BannerDAO extends EgovComAbstractDAO { + + /** + * 배너를 관리하기 위해 등록된 배너목록을 조회한다. + * @param bannerVO - 배너 Vo + * @return List - 배너 목록 + * @exception Exception + */ + public List selectBannerList(BannerVO bannerVO) throws Exception { + return selectList("bannerDAO.selectBannerList", bannerVO); + } + + /** + * 배너목록 총 갯수를 조회한다. + * @param bannerVO BannerVO + * @return int + * @exception Exception + */ + public int selectBannerListTotCnt(BannerVO bannerVO) throws Exception { + return (Integer)selectOne("bannerDAO.selectBannerListTotCnt", bannerVO); + } + + /** + * 등록된 배너의 상세정보를 조회한다. + * @param bannerVO - 배너 Vo + * @return BannerVO - 배너 Vo + * + * @param bannerVO + */ + public BannerVO selectBanner(BannerVO bannerVO) throws Exception { + return (BannerVO) selectOne("bannerDAO.selectBanner", bannerVO); + } + + /** + * 배너정보를 신규로 등록한다. + * @param banner - 배너 model + */ + public void insertBanner(Banner banner) throws Exception { + insert("bannerDAO.insertBanner", banner); + } + + /** + * 기 등록된 배너정보를 수정한다. + * @param banner - 배너 model + */ + public void updateBanner(Banner banner) throws Exception { + update("bannerDAO.updateBanner", banner); + } + + /** + * 기 등록된 배너정보를 삭제한다. + * @param banner - 배너 model + * + * @param banner + */ + public void deleteBanner(Banner banner) throws Exception { + delete("bannerDAO.deleteBanner", banner); + } + + /** + * 기 등록된 배너정보의 이미지파일을 삭제하기 위해 파일정보를 조회한다. + * @param banner - 배너 model + * @return FileVO - 파일 VO + */ + public FileVO selectBannerFile(Banner banner) throws Exception { + return (FileVO) selectOne("bannerDAO.selectBannerFile", banner); + } + + /** + * 배너가 특정화면에 반영된 결과를 조회한다. + * @param bannerVO - 배너 VO + * @return BannerVO - 배너 VO + * @exception Exception + */ + + public List selectBannerResult(BannerVO bannerVO) throws Exception { + return selectList("bannerDAO.selectBannerResult", bannerVO); + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/bnr/service/impl/EgovBannerServiceImpl.java b/src/main/java/egovframework/com/uss/ion/bnr/service/impl/EgovBannerServiceImpl.java new file mode 100644 index 0000000..97e7ae8 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/bnr/service/impl/EgovBannerServiceImpl.java @@ -0,0 +1,117 @@ +/** + * 개요 + * - 배너에 대한 ServiceImpl 클래스를 정의한다. + * + * 상세내용 + * - 배너에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 배너의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이문준 + * @version 1.0 + * @created 03-8-2009 오후 2:07:12 + */ + +package egovframework.com.uss.ion.bnr.service.impl; + +import java.io.File; +import java.util.List; + +import egovframework.com.cmm.service.FileVO; +import egovframework.com.uss.ion.bnr.service.Banner; +import egovframework.com.uss.ion.bnr.service.BannerVO; +import egovframework.com.uss.ion.bnr.service.EgovBannerService; +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import javax.annotation.Resource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +@Service("egovBannerService") +public class EgovBannerServiceImpl extends EgovAbstractServiceImpl implements EgovBannerService { + + /** logger */ + private static final Logger LOGGER = LoggerFactory.getLogger(EgovBannerServiceImpl.class); + + @Resource(name="bannerDAO") + private BannerDAO bannerDAO; + + /** + * 배너를 관리하기 위해 등록된 배너목록을 조회한다. + * @param bannerVO - 배너 VO + * @return List - 배너 목록 + */ + public List selectBannerList(BannerVO bannerVO) throws Exception{ + return bannerDAO.selectBannerList(bannerVO); + } + + /** + * 배너목록 총 갯수를 조회한다. + * @param bannerVO - 배너 VO + * @return int - 배너 카운트 수 + */ + public int selectBannerListTotCnt(BannerVO bannerVO) throws Exception { + return bannerDAO.selectBannerListTotCnt(bannerVO); + } + + /** + * 등록된 배너의 상세정보를 조회한다. + * @param bannerVO - 배너 VO + * @return BannerVO - 배너 VO + */ + public BannerVO selectBanner(BannerVO bannerVO) throws Exception{ + return bannerDAO.selectBanner(bannerVO); + } + + /** + * 배너정보를 신규로 등록한다. + * @param banner - 배너 model + */ + public BannerVO insertBanner(Banner banner, BannerVO bannerVO) throws Exception{ + bannerDAO.insertBanner(banner); + bannerVO.setBannerId(banner.getBannerId()); + return selectBanner(bannerVO); + } + + /** + * 기 등록된 배너정보를 수정한다. + * @param banner - 배너 model + */ + public void updateBanner(Banner banner) throws Exception{ + bannerDAO.updateBanner(banner); + } + + /** + * 기 등록된 배너정보를 삭제한다. + * @param banner - 배너 model + */ + public void deleteBanner(Banner banner) throws Exception { + deleteBannerFile(banner); + bannerDAO.deleteBanner(banner); + } + + /** + * 기 등록된 배너정보의 이미지파일을 삭제한다. + * @param banner - 배너 model + */ + public void deleteBannerFile(Banner banner) throws Exception{ + FileVO fileVO = (FileVO)bannerDAO.selectBannerFile(banner); + File file = new File(fileVO.getFileStreCours()+fileVO.getStreFileNm()); + //2017.02.08 이정은 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + if(file.delete()){ + LOGGER.debug("[file.delete] file : File Deletion Success"); + }else{ + LOGGER.error("[file.delete] file : File Deletion Fail"); + } + } + + /** + * 배너가 특정화면에 반영된 결과를 조회한다. + * @param bannerVO - 배너 VO + * @return BannerVO - 배너 VO + */ + public List selectBannerResult(BannerVO bannerVO) throws Exception{ + return bannerDAO.selectBannerResult(bannerVO); + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/bnr/web/EgovBannerController.java b/src/main/java/egovframework/com/uss/ion/bnr/web/EgovBannerController.java new file mode 100644 index 0000000..eb194b1 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/bnr/web/EgovBannerController.java @@ -0,0 +1,364 @@ +/** + * 개요 + * - 배너에 대한 controller 클래스를 정의한다. + * + * 상세내용 + * - 배너에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 배너의 조회기능은 목록조회, 상세조회로 구분된다. + * @author lee.m.j + * @version 1.0 + * @created 03-8-2009 오후 2:07:11 + * *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2009.8.3	lee.m.j          최초 생성
    + *  2011.8.26	정진오			IncludedInfo annotation 추가
    + *
    + *  
    + */ + +package egovframework.com.uss.ion.bnr.web; + +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +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.springframework.web.bind.support.SessionStatus; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.service.EgovFileMngService; +import egovframework.com.cmm.service.EgovFileMngUtil; +import egovframework.com.cmm.service.FileVO; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.ion.bnr.service.Banner; +import egovframework.com.uss.ion.bnr.service.BannerVO; +import egovframework.com.uss.ion.bnr.service.EgovBannerService; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +@Controller +public class EgovBannerController { + + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name="EgovFileMngService") + private EgovFileMngService fileMngService; + + @Resource(name="EgovFileMngUtil") + private EgovFileMngUtil fileUtil; + + @Resource(name = "egovBannerService") + private EgovBannerService egovBannerService; + + /** Message ID Generation */ + @Resource(name="egovBannerIdGnrService") + private EgovIdGnrService egovBannerIdGnrService; + + @Autowired + private DefaultBeanValidator beanValidator; + + /** + * 배너 목록화면 이동 + * @return String + * @exception Exception + */ + @RequestMapping("/uss/ion/bnr/selectBannerListView.do") + public String selectBannerListView() throws Exception { + + return "egovframework/com/uss/ion/bnr/EgovBannerList"; + } + + /** + * 배너를 관리하기 위해 등록된 배너목록을 조회한다. + * @param bannerVO - 배너 VO + * @return String - 리턴 URL + * @throws Exception + */ + @IncludedInfo(name="배너관리", order = 740 ,gid = 50) + @RequestMapping(value="/uss/ion/bnr/selectBannerList.do") + public String selectBannerList(@ModelAttribute("bannerVO") BannerVO bannerVO, + ModelMap model) throws Exception{ + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(bannerVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(bannerVO.getPageUnit()); + paginationInfo.setPageSize(bannerVO.getPageSize()); + + bannerVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + bannerVO.setLastIndex(paginationInfo.getLastRecordIndex()); + bannerVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + bannerVO.setBannerList(egovBannerService.selectBannerList(bannerVO)); + + model.addAttribute("bannerList", bannerVO.getBannerList()); + + int totCnt = egovBannerService.selectBannerListTotCnt(bannerVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/uss/ion/bnr/EgovBannerList"; + } + + /** + * 등록된 배너의 상세정보를 조회한다. + * @param bannerVO - 배너 Vo + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/bnr/getBanner.do") + public String selectBanner(@RequestParam("bannerId") String bannerId, + @ModelAttribute("bannerVO") BannerVO bannerVO, + ModelMap model) throws Exception { + + bannerVO.setBannerId(bannerId); + + model.addAttribute("banner", egovBannerService.selectBanner(bannerVO)); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + return "egovframework/com/uss/ion/bnr/EgovBannerUpdt"; + } + + /** + * 배너등록 화면으로 이동한다. + * @param banner - 배너 model + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/bnr/addViewBanner.do") + public String insertViewBanner(@ModelAttribute("bannerVO") BannerVO bannerVO, + ModelMap model) throws Exception { + + model.addAttribute("banner", bannerVO); + return "egovframework/com/uss/ion/bnr/EgovBannerRegist"; + } + + /** + * 배너정보를 신규로 등록한다. + * @param banner - 배너 model + * @return String - 리턴 Url + */ + @SuppressWarnings("unused") + @RequestMapping(value="/uss/ion/bnr/addBanner.do") + public String insertBanner(final MultipartHttpServletRequest multiRequest, + @ModelAttribute("banner") Banner banner, + @ModelAttribute("bannerVO") BannerVO bannerVO, + BindingResult bindingResult, + SessionStatus status, + ModelMap model) throws Exception { + + beanValidator.validate(banner, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + model.addAttribute("bannerVO", bannerVO); + return "egovframework/com/uss/ion/bnr/EgovBannerRegist"; + } else { + List result = null; + + String uploadFolder = ""; + String bannerImage = ""; + String bannerImageFile = ""; + String atchFileId = ""; + + final Map files = multiRequest.getFileMap(); + + if(!files.isEmpty()){ + result = fileUtil.parseFileInf(files, "BNR_", 0, "", uploadFolder); + atchFileId = fileMngService.insertFileInfs(result); + + FileVO vo = result.get(0); + Iterator iter = result.iterator(); + + while (iter.hasNext()) { + vo = iter.next(); + bannerImage = vo.getOrignlFileNm(); + bannerImageFile = vo.getStreFileNm(); + } + } + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + banner.setBannerId(egovBannerIdGnrService.getNextStringId()); + banner.setBannerImage(bannerImage); + banner.setBannerImageFile(atchFileId); + banner.setUserId(user == null ? "" : EgovStringUtil.isNullToString(user.getId())); + bannerVO.setBannerId(banner.getBannerId()); + status.setComplete(); + model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); + model.addAttribute("banner", egovBannerService.insertBanner(banner, bannerVO)); + +// return "egovframework/com/uss/ion/bnr/EgovBannerUpdt"; + return "forward:/uss/ion/bnr/selectBannerList.do"; + + } + } + + /** + * 기 등록된 배너정보를 수정한다. + * @param banner - 배너 model + * @return String - 리턴 Url + */ + @SuppressWarnings("unused") + @RequestMapping(value="/uss/ion/bnr/updtBanner.do") + public String updateBanner(final MultipartHttpServletRequest multiRequest, + @ModelAttribute("banner") Banner banner, + BindingResult bindingResult, + SessionStatus status, + ModelMap model) throws Exception { + beanValidator.validate(banner, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + model.addAttribute("bannerVO", banner); + return "egovframework/com/uss/ion/bnr/EgovBannerUpdt"; + } else { + + List result = null; + + String uploadFolder = ""; + String bannerImage = ""; + String bannerImageFile = ""; + String atchFileId = ""; + + final Map files = multiRequest.getFileMap(); + + if (!files.isEmpty()) { + result = fileUtil.parseFileInf(files, "BNR_", 0, "", uploadFolder); + atchFileId = fileMngService.insertFileInfs(result); + + FileVO vo = null; + Iterator iter = result.iterator(); + + while (iter.hasNext()) { + vo = iter.next(); + bannerImage = vo.getOrignlFileNm(); + bannerImageFile = vo.getStreFileNm(); + } + + if (vo == null) { + banner.setAtchFile(false); + } else { + banner.setBannerImage(bannerImage); + banner.setBannerImageFile(atchFileId); + banner.setAtchFile(true); + + } + } else { + banner.setAtchFile(false); + } + + LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser(); + banner.setUserId(user == null ? "" : EgovStringUtil.isNullToString(user.getId())); + + + egovBannerService.updateBanner(banner); + // return "forward:/uss/ion/bnr/getBanner.do"; + return "forward:/uss/ion/bnr/selectBannerList.do"; + + } + } + + /** + * 기 등록된 배너정보를 삭제한다. + * @param banner Banner + * @return String + * @exception Exception + */ + @RequestMapping(value="/uss/ion/bnr/removeBanner.do") + public String deleteBanner(@RequestParam("bannerId") String bannerId, + @ModelAttribute("banner") Banner banner, + SessionStatus status, + ModelMap model) throws Exception { + + banner.setBannerId(bannerId); + egovBannerService.deleteBanner(banner); + status.setComplete(); + model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); + return "forward:/uss/ion/bnr/selectBannerList.do"; + } + + /** + * 기 등록된 배너정보목록을 일괄 삭제한다. + * @param banners String + * @param banner Banner + * @return String + * @exception Exception + */ + @RequestMapping(value="/uss/ion/bnr/removeBannerList.do") + public String deleteBannerList(@RequestParam("bannerIds") String bannerIds, + @ModelAttribute("banner") Banner banner, + SessionStatus status, + ModelMap model) throws Exception { + + String [] strBannerIds = bannerIds.split(";"); + + for(int i=0; i fileList = egovBannerService.selectBannerResult(bannerVO); + model.addAttribute("fileList", fileList); + model.addAttribute("resultType", bannerVO.getResultType()); + + return "egovframework/com/uss/ion/bnr/EgovBannerView"; + } + + /** + * MyPage에 배너정보를 제공하기 위해 목록을 조회한다. + * @param bannerVO - 배너 VO + * @return String - 리턴 URL + * @throws Exception + */ + @IncludedInfo(name="MYPAGE배너관리", order = 741 ,gid = 50) + @RequestMapping(value="/uss/ion/bnr/selectBannerMainList.do") + public String selectBannerMainList(@ModelAttribute("bannerVO") BannerVO bannerVO, + ModelMap model) throws Exception{ + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(bannerVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(5); + paginationInfo.setPageSize(bannerVO.getPageSize()); + + bannerVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + bannerVO.setLastIndex(paginationInfo.getLastRecordIndex()); + bannerVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + bannerVO.setBannerList(egovBannerService.selectBannerList(bannerVO)); + + model.addAttribute("bannerList", bannerVO.getBannerList()); + + return "egovframework/com/uss/ion/bnr/EgovBannerMainList"; + } +} diff --git a/src/main/java/egovframework/com/uss/ion/bnt/service/BndtCeckManage.java b/src/main/java/egovframework/com/uss/ion/bnt/service/BndtCeckManage.java new file mode 100644 index 0000000..f0531b4 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/bnt/service/BndtCeckManage.java @@ -0,0 +1,172 @@ +package egovframework.com.uss.ion.bnt.service; + +import egovframework.com.cmm.ComDefaultVO; + +/** + * 개요 + * - 당직관리에 대한 model 클래스를 정의한다. + * + * 상세내용 + * - 당직관리의 당직ID,당직일자,비고,최초등록자ID,최초등록시점,최종수정자ID,최종수정시점 항목을 관리한다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +public class BndtCeckManage extends ComDefaultVO { + + private static final long serialVersionUID = -690185899926659585L; + + /** + * 당직체크구분 + */ + private String bndtCeckSe; + + /** + * 당직체크코드 + */ + private String bndtCeckCd; + + /** + * 당직체크코드명 + */ + private String bndtCeckCdNm; + + /** + * 사용여부 + */ + private String useAt; + + /** + * 최초등록자ID + */ + private String frstRegisterId; + + /** + * 최초등록시점 + */ + private String frstRegisterPnttm; + + /** + * 최종수정자ID + */ + private String lastUpdusrId; + + /** + * 최종수정시점 + */ + private String lastUpdusrPnttm; + + /** + * @return the bndtCeckSe + */ + public String getBndtCeckSe() { + return bndtCeckSe; + } + + /** + * @param bndtCeckSe the bndtCeckSe to set + */ + public void setBndtCeckSe(String bndtCeckSe) { + this.bndtCeckSe = bndtCeckSe; + } + + /** + * @return the bndtCeckCd + */ + public String getBndtCeckCd() { + return bndtCeckCd; + } + + /** + * @param bndtCeckCd the bndtCeckCd to set + */ + public void setBndtCeckCd(String bndtCeckCd) { + this.bndtCeckCd = bndtCeckCd; + } + + /** + * @return the bndtCeckCdNm + */ + public String getBndtCeckCdNm() { + return bndtCeckCdNm; + } + + /** + * @param bndtCeckCdNm the bndtCeckCdNm to set + */ + public void setBndtCeckCdNm(String bndtCeckCdNm) { + this.bndtCeckCdNm = bndtCeckCdNm; + } + + /** + * @return the useAt + */ + public String getUseAt() { + return useAt; + } + + /** + * @param useAt the useAt to set + */ + public void setUseAt(String useAt) { + this.useAt = useAt; + } + + /** + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * @param frstRegisterId the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * @param frstRegisterPnttm the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * @param lastUpdusrId the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + /** + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * @param lastUpdusrPnttm the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/bnt/service/BndtCeckManageVO.java b/src/main/java/egovframework/com/uss/ion/bnt/service/BndtCeckManageVO.java new file mode 100644 index 0000000..18a25f8 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/bnt/service/BndtCeckManageVO.java @@ -0,0 +1,110 @@ +package egovframework.com.uss.ion.bnt.service; + +import java.io.Serializable; +import java.util.List; + +/** + * 개요 + * - 당직체크관리에 대한 Vo 클래스를 정의한다. + * + * 상세내용 + * - 당직체크관리의 목록 항목을 관리한다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +public class BndtCeckManageVO extends BndtCeckManage implements Serializable { + + private static final long serialVersionUID = -9114350207789216858L; + + /** + * 당직체크리스트관리 목록 + */ + List bndtCeckManageList; + + /** + * 당직체크리스트 Temp변수 1 + */ + private String bndtCeckTemp1; + + /** + * 당직체크리스트 당직체크구분 조회조건 변수 + */ + private String searchBndtCeckSe; + + /** + * 당직체크리스트 당직체크코드 조회조건 변수 + */ + private String searchBndtCeckCd; + + /** + * 당직체크리스트 당직체크구분 조회조건 변수 + */ + private String searchUseAt; + + /** + * @return the searchUseAt + */ + public String getSearchUseAt() { + return searchUseAt; + } + /** + * @param searchUseAt the searchUseAt to set + */ + public void setSearchUseAt(String searchUseAt) { + this.searchUseAt = searchUseAt; + } + /** + * @return the bndtCeckManageList + */ + public List getBndtCeckManageList() { + return bndtCeckManageList; + } + /** + * @param bndtCeckManageList the bndtCeckManageList to set + */ + public void setBndtCeckManageList(List bndtCeckManageList) { + this.bndtCeckManageList = bndtCeckManageList; + } + + /** + * @return the bndtCeckTemp1 + */ + public String getBndtCeckTemp1() { + return bndtCeckTemp1; + } + /** + * @param bndtCeckTemp1 the bndtCeckTemp1 to set + */ + public void setBndtCeckTemp1(String bndtCeckTemp1) { + this.bndtCeckTemp1 = bndtCeckTemp1; + } + /** + * @return the searchBndtCeckSe + */ + public String getSearchBndtCeckSe() { + return searchBndtCeckSe; + } + /** + * @param searchBndtCeckSe the searchBndtCeckSe to set + */ + public void setSearchBndtCeckSe(String searchBndtCeckSe) { + this.searchBndtCeckSe = searchBndtCeckSe; + } + /** + * @return the searchBndtCeckCd + */ + public String getSearchBndtCeckCd() { + return searchBndtCeckCd; + } + /** + * @param searchBndtCeckCd the searchBndtCeckCd to set + */ + public void setSearchBndtCeckCd(String searchBndtCeckCd) { + this.searchBndtCeckCd = searchBndtCeckCd; + } + + + +} diff --git a/src/main/java/egovframework/com/uss/ion/bnt/service/BndtDiary.java b/src/main/java/egovframework/com/uss/ion/bnt/service/BndtDiary.java new file mode 100644 index 0000000..19dd5ba --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/bnt/service/BndtDiary.java @@ -0,0 +1,191 @@ +package egovframework.com.uss.ion.bnt.service; + +import egovframework.com.cmm.ComDefaultVO; + +/** + * 개요 + * - 당직관리에 대한 model 클래스를 정의한다. + * + * 상세내용 + * - 당직관리의 당직ID,당직일자,당직체크구분, 당직체크코드, 당직점검상태,최초등록자ID,최초등록시점,최종수정자ID,최종수정시점 항목을 관리한다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +public class BndtDiary extends ComDefaultVO { + + private static final long serialVersionUID = -7344878163008635232L; + + /** + * 당직ID + */ + private String bndtId; + + /** + * 당직일자 + */ + private String bndtDe; + + /** + * 당직체크구분 + */ + private String bndtCeckSe; + + /** + * 당직체크코드 + */ + private String bndtCeckCd; + + /** + * 당직점검상태 + */ + private String chckSttus; + + /** + * 최초등록자ID + */ + private String frstRegisterId; + + /** + * 최초등록시점 + */ + private String frstRegisterPnttm; + + /** + * 최종수정자ID + */ + private String lastUpdusrId; + + /** + * 최종수정시점 + */ + private String lastUpdusrPnttm; + + /** + * @return the bndtId + */ + public String getBndtId() { + return bndtId; + } + + /** + * @param bndtId the bndtId to set + */ + public void setBndtId(String bndtId) { + this.bndtId = bndtId; + } + + /** + * @return the bndtDe + */ + public String getBndtDe() { + return bndtDe; + } + + /** + * @param bndtDe the bndtDe to set + */ + public void setBndtDe(String bndtDe) { + this.bndtDe = bndtDe; + } + + /** + * @return the bndtCeckSe + */ + public String getBndtCeckSe() { + return bndtCeckSe; + } + + /** + * @param bndtCeckSe the bndtCeckSe to set + */ + public void setBndtCeckSe(String bndtCeckSe) { + this.bndtCeckSe = bndtCeckSe; + } + + /** + * @return the bndtCeckCd + */ + public String getBndtCeckCd() { + return bndtCeckCd; + } + + /** + * @param bndtCeckCd the bndtCeckCd to set + */ + public void setBndtCeckCd(String bndtCeckCd) { + this.bndtCeckCd = bndtCeckCd; + } + + /** + * @return the chckSttus + */ + public String getChckSttus() { + return chckSttus; + } + + /** + * @param chckSttus the chckSttus to set + */ + public void setChckSttus(String chckSttus) { + this.chckSttus = chckSttus; + } + + /** + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * @param frstRegisterId the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * @param frstRegisterPnttm the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * @param lastUpdusrId the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + /** + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * @param lastUpdusrPnttm the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/bnt/service/BndtDiaryVO.java b/src/main/java/egovframework/com/uss/ion/bnt/service/BndtDiaryVO.java new file mode 100644 index 0000000..3fbe8df --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/bnt/service/BndtDiaryVO.java @@ -0,0 +1,56 @@ +package egovframework.com.uss.ion.bnt.service; + +import java.io.Serializable; +import java.util.List; + +/** + * 개요 + * - 당직일지에 대한 Vo 클래스를 정의한다. + * + * 상세내용 + * - 당직일지의 목록 항목을 관리한다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +public class BndtDiaryVO extends BndtDiary implements Serializable { + + private static final long serialVersionUID = 1767342530176012296L; + /** + * 배너 목록 + */ + List bndtDiaryList; + + /** + * @return the bndtDiaryList + */ + public List getBndtDiaryList() { + return bndtDiaryList; + } + /** + * @param bannerList the bannerList to set + */ + public void setBndtDiaryList(List bndtDiaryList) { + this.bndtDiaryList = bndtDiaryList; + } + + /** + * 당직체크코드명 + */ + private String bndtCeckCdNm; + + /** + * @return the bndtCeckCdNm + */ + public String getBndtCeckCdNm() { + return bndtCeckCdNm; + } + /** + * @param bndtCeckCdNm the bndtCeckCdNm to set + */ + public void setBndtCeckCdNm(String bndtCeckCdNm) { + this.bndtCeckCdNm = bndtCeckCdNm; + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/bnt/service/BndtManage.java b/src/main/java/egovframework/com/uss/ion/bnt/service/BndtManage.java new file mode 100644 index 0000000..94bd560 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/bnt/service/BndtManage.java @@ -0,0 +1,157 @@ +package egovframework.com.uss.ion.bnt.service; + +import egovframework.com.cmm.ComDefaultVO; + +/** + * 개요 + * - 당직일지에 대한 model 클래스를 정의한다. + * + * 상세내용 + * - 당직관리의 당직ID,당직일자,비고,최초등록자ID,최초등록시점,최종수정자ID,최종수정시점 항목을 관리한다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +public class BndtManage extends ComDefaultVO { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + + /** + * 당직ID + */ + private String bndtId; + + /** + * 당직일자 + */ + private String bndtDe; + + /** + * 비고 + */ + private String remark; + + /** + * 최초등록자ID + */ + private String frstRegisterId; + + /** + * 최초등록시점 + */ + private String frstRegisterPnttm; + + /** + * 최종수정자ID + */ + private String lastUpdusrId; + + /** + * 최종수정시점 + */ + private String lastUpdusrPnttm; + + /** + * @return the bndtId + */ + public String getBndtId() { + return bndtId; + } + + /** + * @param bndtId the bndtId to set + */ + public void setBndtId(String bndtId) { + this.bndtId = bndtId; + } + + /** + * @return the bndtDe + */ + public String getBndtDe() { + return bndtDe; + } + + /** + * @param bndtDe the bndtDe to set + */ + public void setBndtDe(String bndtDe) { + this.bndtDe = bndtDe; + } + + /** + * @return the remark + */ + public String getRemark() { + return remark; + } + + /** + * @param remark the remark to set + */ + public void setRemark(String remark) { + this.remark = remark; + } + + /** + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * @param frstRegisterId the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * @param frstRegisterPnttm the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * @param lastUpdusrId the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + /** + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * @param lastUpdusrPnttm the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/bnt/service/BndtManageVO.java b/src/main/java/egovframework/com/uss/ion/bnt/service/BndtManageVO.java new file mode 100644 index 0000000..87d46b4 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/bnt/service/BndtManageVO.java @@ -0,0 +1,180 @@ +package egovframework.com.uss.ion.bnt.service; + +import java.io.Serializable; +import java.util.List; + +/** + * 개요 + * - 당직관리에 대한 Vo 클래스를 정의한다. + * + * 상세내용 + * - 당직관리의 목록 항목을 관리한다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +public class BndtManageVO extends BndtManage implements Serializable { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + /** + * 배너 목록 + */ + List bndtManageList; + + /** + * 당직 bndtTemp1 + */ + private String bndtTemp1; + + /** + * 당직 bndtTemp2 + */ + private String bndtTemp2; + + /** + * 당직 tempBndtNm + */ + private String tempBndtNm; + + /** + * 당직 tempBndtId + */ + private String tempBndtId; + + /** + * 당직 tempBndtWeek + */ + private String tempBndtWeek; + + /** + * 당직 tempOrgnztNm + */ + private String tempOrgnztNm; + + /** + * 당직 tempCount + */ + private int tempCount; + + /** + * 당직 dateWeek + */ + private int dateWeek; + + /** + * @return the annvrsryManageList + */ + public List getBndtManageList() { + return bndtManageList; + } + /** + * @param bannerList the bannerList to set + */ + public void setBndtManageList(List bndtManageList) { + this.bndtManageList = bndtManageList; + } + + /** + * @return the tempBndtNm + */ + public String getTempBndtNm() { + return tempBndtNm; + } + /** + * @param tempBndtNm the tempBndtNm to set + */ + public void setTempBndtNm(String tempBndtNm) { + this.tempBndtNm = tempBndtNm; + } + /** + * @return the tempBndtId + */ + public String getTempBndtId() { + return tempBndtId; + } + /** + * @param tempBndtId the tempBndtId to set + */ + public void setTempBndtId(String tempBndtId) { + this.tempBndtId = tempBndtId; + } + /** + * @return the tempBndtWeek + */ + public String getTempBndtWeek() { + return tempBndtWeek; + } + /** + * @param tempBndtWeek the tempBndtWeek to set + */ + public void setTempBndtWeek(String tempBndtWeek) { + this.tempBndtWeek = tempBndtWeek; + } + /** + * @return the tempCount + */ + public int getTempCount() { + return tempCount; + } + /** + * @param tempCount the tempCount to set + */ + public void setTempCount(int tempCount) { + this.tempCount = tempCount; + } + /** + * @return the dateWeek + */ + public int getDateWeek() { + return dateWeek; + } + /** + * @param dateWeek the dateWeek to set + */ + public void setDateWeek(int dateWeek) { + this.dateWeek = dateWeek; + } + /** + * @return the bndtTemp1 + */ + public String getBndtTemp1() { + return bndtTemp1; + } + /** + * @param bndtTemp1 the bndtTemp1 to set + */ + public void setBndtTemp1(String bndtTemp1) { + this.bndtTemp1 = bndtTemp1; + } + /** + * @return the bndtTemp2 + */ + public String getBndtTemp2() { + return bndtTemp2; + } + /** + * @param bndtTemp2 the bndtTemp2 to set + */ + public void setBndtTemp2(String bndtTemp2) { + this.bndtTemp2 = bndtTemp2; + } + /** + * @return the tempOrgnztNm + */ + public String getTempOrgnztNm() { + return tempOrgnztNm; + } + /** + * @param tempOrgnztNm the tempOrgnztNm to set + */ + public void setTempOrgnztNm(String tempOrgnztNm) { + this.tempOrgnztNm = tempOrgnztNm; + } + + + +} diff --git a/src/main/java/egovframework/com/uss/ion/bnt/service/EgovBndtManageService.java b/src/main/java/egovframework/com/uss/ion/bnt/service/EgovBndtManageService.java new file mode 100644 index 0000000..1f937af --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/bnt/service/EgovBndtManageService.java @@ -0,0 +1,174 @@ +package egovframework.com.uss.ion.bnt.service; + +import java.io.InputStream; +import java.util.List; + +/** + * 개요 + * - 당직관리에 대한 Service Interface를 정의한다. + * + * 상세내용 + * - 당직관리에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 당직관리의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +public interface EgovBndtManageService { + + /** + * 당직관리 정보를 관리하기 위해 등록된 당직관리 목록을 조회한다. + * @param bndtManageVO - 당직관리 VO + * @return List - 당직관리 목록 + */ + public List selectBndtManageList(BndtManageVO bndtManageVO) throws Exception; + + /** + * 당직관리 목록 총 갯수를 조회한다. + * @param bndtManageVO - 당직관리 VO + * @return int - 당직관리 카운트 수 + */ + public int selectBndtManageListTotCnt(BndtManageVO bndtManageVO) throws Exception ; + + /** + * 등록된 당직관리의 상세정보를 조회한다. + * @param bndtManageVO - 당직관리 VO + * @return BndtManageVO - 당직관리 VO + */ + public BndtManageVO selectBndtManage(BndtManageVO bndtManageVO) throws Exception; + + /** + * 당직관리 정보를 신규로 등록한다. + * @param bndtManage - 당직관리 model + */ + public void insertBndtManage(BndtManage bndtManage) throws Exception; + + /** + * 기 등록된 당직관리 정보를 수정한다. + * @param bndtManage - 당직관리 model + */ + public void updtBndtManage(BndtManage bndtManage) throws Exception; + + /** + * 기 등록된 당직관리 정보를 삭제한다. + * @param bndtManage - 당직관리 model + */ + public void deleteBndtManage(BndtManage bndtManage) throws Exception; + + /** + * 당직일지 갯수를 조회한다. + * @param bndtManageVO - 당직관리 VO + * @return int + * @exception Exception + */ + public int selectBndtDiaryTotCnt(BndtManage bndtManage) throws Exception; + + /***** 당직 체크관리 *****/ + /** + * 당직체크관리 정보를 관리하기 위해 등록된 당직체크관리 목록을 조회한다. + * @param bndtCeckManageVO - 당직체크관리 VO + * @return List - 당직체크관리 목록 + */ + public List selectBndtCeckManageList(BndtCeckManageVO bndtCeckManageVO) throws Exception; + + /** + * 당직체크관리 목록 총 갯수를 조회한다. + * @param bndtCeckManageVO - 당직체크관리 VO + * @return int - 당직체크관리 카운트 수 + */ + public int selectBndtCeckManageListTotCnt(BndtCeckManageVO bndtCeckManageVO) throws Exception ; + + /** + * 등록된 당직체크관리의 상세정보를 조회한다. + * @param bndtCeckManageVO - 당직체크관리 VO + * @return BndtCeckManageVO - 당직체크관리 VO + */ + public BndtCeckManageVO selectBndtCeckManage(BndtCeckManageVO bndtCeckManageVO) throws Exception; + + /** + * 당직체크관리 정보를 신규로 등록한다. + * @param bndtCeckManage - 당직체크관리 model + */ + public void insertBndtCeckManage(BndtCeckManage bndtCeckManage) throws Exception; + + /** + * 기 등록된 당직체크관리 정보를 수정한다. + * @param bndtCeckManage - 당직체크관리 model + */ + public void updtBndtCeckManage(BndtCeckManage bndtCeckManage) throws Exception; + + /** + * 기 등록된 당직체크관리 정보를 삭제한다. + * @param bndtCeckManage - 당직체크관리 model + */ + public void deleteBndtCeckManage(BndtCeckManage bndtCeckManage) throws Exception; + + + /** + * 당직체크 중복여부 조회한다. + * @param bndtCeckManageVO - 당직체크관리 VO + * @return int + * @exception Exception + */ + public int selectBndtCeckManageDplctAt(BndtCeckManage bndtCeckManage) throws Exception ; + + + /***** 당직 일지 *****/ + + /** + * 등록된 당직일지관리의 상세정보를 조회한다. + * @param bndtDiaryVO - 당직일지관리 VO + * @return BndtDiaryVO - 당직일지관리 VO + */ + public List selectBndtDiary(BndtDiaryVO bndtDiaryVO) throws Exception; + + /** + * 당직일지관리 정보를 신규로 등록한다. + * @param bndtDiary - 당직일지관리 model + */ + public void insertBndtDiary(BndtDiary bndtDiary, String diaryForInsert) throws Exception; + + /** + * 기 등록된 당직일지관리 정보를 수정한다. + * @param bndtDiary - 당직일지관리 model + */ + public void updtBndtDiary(BndtDiary bndtDiary, String diaryForUpdt) throws Exception; + + /** + * 기 등록된 당직일지관리 정보를 삭제한다. + * @param bndtDiary - 당직일지관리 model + */ + public void deleteBndtDiary(BndtDiary bndtDiary) throws Exception; + + /** + * 당직자 excel생성 + * @param inputStream InputStream + * @return String + * @exception Exception + */ + public List selectBndtManageBnde(InputStream inputStream) throws Exception; + + /** + * 당직자 excel생성 (Xlsx사용시) + * @param inputStream InputStream + * @return String + * @exception Exception + */ + public List selectBndtManageBndeX(InputStream inputStream) throws Exception; + + /** + * 당직정보를 일괄등록처리한다. + * @param bndtManageVO - 당직관리 VO + * @param String - 당직자정보 + */ + public void insertBndtManageBnde(BndtManageVO bndtManageVO, String checkedBndtManageForInsert) throws Exception; + + /** + * 당직관리 등록건수 조회한다. + * @param bndtManageVO - 당직관리 VO + * @return int + * @exception Exception + */ + public int selectBndtManageMonthCnt(BndtManageVO bndtManageVO) throws Exception; +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/bnt/service/impl/BndtManageDAO.java b/src/main/java/egovframework/com/uss/ion/bnt/service/impl/BndtManageDAO.java new file mode 100644 index 0000000..68653df --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/bnt/service/impl/BndtManageDAO.java @@ -0,0 +1,212 @@ +package egovframework.com.uss.ion.bnt.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.ion.bnt.service.BndtCeckManage; +import egovframework.com.uss.ion.bnt.service.BndtCeckManageVO; +import egovframework.com.uss.ion.bnt.service.BndtDiary; +import egovframework.com.uss.ion.bnt.service.BndtDiaryVO; +import egovframework.com.uss.ion.bnt.service.BndtManage; +import egovframework.com.uss.ion.bnt.service.BndtManageVO; + +import org.springframework.stereotype.Repository; + +/** + * 개요 + * - 당직관리에 대한 DAO 클래스를 정의한다. + * + * 상세내용 + * - 당직관리에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 당직관리의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +@Repository("bndtManageDAO") +public class BndtManageDAO extends EgovComAbstractDAO { + + /** + * 당직관리정보를 관리하기 위해 등록된 당직관리 목록을 조회한다. + * @param bndtManageVO - 당직관리 VO + * @return List - 당직관리 목록 + */ + + public List selectBndtManageList(BndtManageVO bndtManageVO) throws Exception { + return selectList("bndtManageDAO.selectBndtManageList", bndtManageVO); + } + + /** + * 당직관리목록 총 갯수를 조회한다. + * @param bndtManageVO - 당직관리 VO + * @return int + * @exception Exception + */ + public int selectBndtManageListTotCnt(BndtManageVO bndtManageVO) throws Exception { + return (Integer)selectOne("bndtManageDAO.selectBndtManageListTotCnt", bndtManageVO); + } + + /** + * 등록된 당직관리의 상세정보를 조회한다. + * @param bndtManageVO - 당직관리 VO + * @return BndtManageVO - 당직관리 VO + */ + public BndtManageVO selectBndtManage(BndtManageVO bndtManageVO) throws Exception { + return (BndtManageVO) selectOne("bndtManageDAO.selectBndtManage", bndtManageVO); + } + + /** + * 당직관리정보를 신규로 등록한다. + * @param bndtManage - 당직관리 model + */ + public void insertBndtManage(BndtManage bndtManage) throws Exception { + insert("bndtManageDAO.insertBndtManage", bndtManage); + } + + /** + * 기 등록된 당직관리정보를 수정한다. + * @param bndtManage - 당직관리 model + */ + public void updtBndtManage(BndtManage bndtManage) throws Exception { + update("bndtManageDAO.updtBndtManage", bndtManage); + } + + /** + * 기 등록된 당직관리정보를 삭제한다. + * @param bndtManage - 당직관리 model + */ + public void deleteBndtManage(BndtManage bndtManage) throws Exception { + delete("bndtManageDAO.deleteBndtManage",bndtManage); + } + + /** + * 당직일지 갯수를 조회한다. + * @param bndtManageVO - 당직관리 VO + * @return int + * @exception Exception + */ + public int selectBndtDiaryTotCnt(BndtManage bndtManage) throws Exception { + return (Integer)selectOne("bndtManageDAO.selectBndtDiaryTotCnt", bndtManage); + } + + /***** 당직 체크관리 *****/ + + /** + * 당직체크관리정보를 관리하기 위해 등록된 당직체크관리 목록을 조회한다. + * @param bndtCeckManageVO - 당직체크관리 VO + * @return List - 당직체크관리 목록 + */ + public List selectBndtCeckManageList(BndtCeckManageVO bndtCeckManageVO) throws Exception { + return selectList("bndtManageDAO.selectBndtCeckManageList", bndtCeckManageVO); + } + + /** + * 당직체크관리목록 총 갯수를 조회한다. + * @param bndtCeckManageVO - 당직체크관리 VO + * @return int + * @exception Exception + */ + public int selectBndtCeckManageListTotCnt(BndtCeckManageVO bndtCeckManageVO) throws Exception { + return (Integer)selectOne("bndtManageDAO.selectBndtCeckManageListTotCnt", bndtCeckManageVO); + } + + /** + * 등록된 당직체크관리의 상세정보를 조회한다. + * @param bndtCeckManageVO - 당직체크관리 VO + * @return BndtCeckManageVO - 당직체크관리 VO + */ + public BndtCeckManageVO selectBndtCeckManage(BndtCeckManageVO bndtCeckManageVO) throws Exception { + return (BndtCeckManageVO) selectOne("bndtManageDAO.selectBndtCeckManage", bndtCeckManageVO); + } + + /** + * 당직체크관리정보를 신규로 등록한다. + * @param bndtCeckManage - 당직체크관리 model + */ + public void insertBndtCeckManage(BndtCeckManage bndtCeckManage) throws Exception { + insert("bndtManageDAO.insertBndtCeckManage", bndtCeckManage); + } + + /** + * 기 등록된 당직체크관리정보를 수정한다. + * @param bndtCeckManage - 당직체크관리 model + */ + public void updtBndtCeckManage(BndtCeckManage bndtCeckManage) throws Exception { + update("bndtManageDAO.updtBndtCeckManage", bndtCeckManage); + } + + /** + * 기 등록된 당직체크관리정보를 삭제한다. + * @param bndtCeckManage - 당직체크관리 model + */ + public void deleteBndtCeckManage(BndtCeckManage bndtCeckManage) throws Exception { + delete("bndtManageDAO.deleteBndtCeckManage",bndtCeckManage); + } + + /** + * 당직체크 중복여부 조회한다. + * @param bndtCeckManageVO - 당직체크관리 VO + * @return int + * @exception Exception + */ + public int selectBndtCeckManageDplctAt(BndtCeckManage bndtCeckManage) throws Exception { + return (Integer)selectOne("bndtManageDAO.selectBndtCeckManageDplctAt", bndtCeckManage); + } + + /***** 당직 일지 *****/ + + /** + * 등록된 당직일지관리의 상세정보를 조회한다. + * @param bndtDiaryVO - 당직일지관리 VO + * @return List - 당직일지관리 VO + */ + public List selectBndtDiary(BndtDiaryVO bndtDiaryVO) throws Exception { + return selectList("bndtManageDAO.selectBndtDiary", bndtDiaryVO); + } + + /** + * 당직일지관리정보를 신규로 등록한다. + * @param bndtDiary - 당직일지관리 model + */ + public void insertBndtDiary(BndtDiary bndtDiary) throws Exception { + + insert("bndtManageDAO.insertBndtDiary", bndtDiary); + } + + /** + * 기 등록된 당직일지관리정보를 수정한다. + * @param bndtDiary - 당직일지관리 model + */ + public void updtBndtDiary(BndtDiary bndtDiary) throws Exception { + update("bndtManageDAO.updtBndtDiary", bndtDiary); + } + + /** + * 기 등록된 당직일지관리정보를 삭제한다. + * @param bndtDiary - 당직일지관리 model + */ + public void deleteBndtDiary(BndtDiary bndtDiary) throws Exception { + delete("bndtManageDAO.deleteBndtDiary",bndtDiary); + } + + + /** + * 등록된 당직관리의 상세정보를 조회한다. + * @param bndtManageVO - 당직관리 VO + * @return BndtManageVO - 당직관리 VO + */ + public BndtManageVO selectBndtManageBnde(BndtManageVO bndtManageVO) throws Exception { + return (BndtManageVO) selectOne("bndtManageDAO.selectBndtManageBnde", bndtManageVO); + } + + /** + * 당직관리 등록건수 조회한다. + * @param bndtManageVO - 당직관리 VO + * @return int + * @exception Exception + */ + public int selectBndtManageMonthCnt(BndtManageVO bndtManageVO) throws Exception { + return (Integer)selectOne("bndtManageDAO.selectBndtManageMonthCnt", bndtManageVO); + } +} diff --git a/src/main/java/egovframework/com/uss/ion/bnt/service/impl/EgovBndtManageServiceImpl.java b/src/main/java/egovframework/com/uss/ion/bnt/service/impl/EgovBndtManageServiceImpl.java new file mode 100644 index 0000000..b403be6 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/bnt/service/impl/EgovBndtManageServiceImpl.java @@ -0,0 +1,526 @@ +package egovframework.com.uss.ion.bnt.service.impl; + +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.GregorianCalendar; +import java.util.List; + +import javax.annotation.Resource; + +import org.apache.poi.hssf.usermodel.HSSFCell; +import org.apache.poi.hssf.usermodel.HSSFRow; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import egovframework.com.cmm.service.EgovProperties; +import egovframework.com.uss.ion.bnt.service.BndtCeckManage; +import egovframework.com.uss.ion.bnt.service.BndtCeckManageVO; +import egovframework.com.uss.ion.bnt.service.BndtDiary; +import egovframework.com.uss.ion.bnt.service.BndtDiaryVO; +import egovframework.com.uss.ion.bnt.service.BndtManage; +import egovframework.com.uss.ion.bnt.service.BndtManageVO; +import egovframework.com.uss.ion.bnt.service.EgovBndtManageService; +import egovframework.com.utl.fcc.service.EgovDateUtil; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.excel.EgovExcelService; + +/** + * 개요 + * - 당직관리에 대한 ServiceImpl 클래스를 정의한다. + * + * 상세내용 + * - 당직관리에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 당직관리의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + * *
    + * << 개정이력(Modification Information) >>
    + *
    + *  수정일                수정자               수정내용
    + *  ----------   ----------   ---------------------------
    + *  2010.06.15   표준프레임워크     최초 생성
    + *  2018.08.29   신용호               xlsx 처리 할수 있도록 selectBndtManageBndeX추가
    + *  2020.11.02   신용호               KISA 보안약점 조치 - 널(null) 값 체크
    + *
    + *  
    + */ + + +@Service("egovBndtManageService") +public class EgovBndtManageServiceImpl extends EgovAbstractServiceImpl implements EgovBndtManageService { + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovBndtManageServiceImpl.class); + + @Resource(name = "excelZipService") + private EgovExcelService excelZipService; + + @Resource(name="bndtManageDAO") + private BndtManageDAO bndtManageDAO; + + /** + * 당직관리정보를 관리하기 위해 등록된 당직관리 목록을 조회한다. + * @param bndtManageVO - 당직관리 VO + * @return List - 당직관리 목록 + */ + @Override + public List selectBndtManageList(BndtManageVO bndtManageVO) throws Exception{ + return bndtManageDAO.selectBndtManageList(bndtManageVO); + } + + /** + * 당직관리목록 총 갯수를 조회한다. + * @param bndtManageVO - 당직관리 VO + * @return int - 당직관리 카운트 수 + */ + @Override + public int selectBndtManageListTotCnt(BndtManageVO bndtManageVO) throws Exception { + return bndtManageDAO.selectBndtManageListTotCnt(bndtManageVO); + } + + /** + * 등록된 당직관리의 상세정보를 조회한다. + * @param bndtManageVO - 당직관리 VO + * @return BndtManageVO - 당직관리 VO + */ + @Override + public BndtManageVO selectBndtManage(BndtManageVO bndtManageVO) throws Exception { + bndtManageVO.setBndtDe(EgovStringUtil.removeMinusChar(bndtManageVO.getBndtDe())); + BndtManageVO bndtManageVOTemp = new BndtManageVO(); + bndtManageVOTemp = bndtManageDAO.selectBndtManage(bndtManageVO); + bndtManageVOTemp.setBndtDe(EgovDateUtil.formatDate(bndtManageVOTemp.getBndtDe(), "-")); + + return bndtManageVOTemp; + } + + /** + * 당직관리정보를 신규로 등록한다. + * @param bndtManage - 당직관리 model + */ + @Override + public void insertBndtManage(BndtManage bndtManage) throws Exception { + bndtManage.setBndtDe(EgovStringUtil.removeMinusChar(bndtManage.getBndtDe())); + bndtManageDAO.insertBndtManage(bndtManage); + } + + /** + * 기 등록된 당직관리정보를 수정한다. + * @param bndtManage - 당직관리 model + */ + @Override + public void updtBndtManage(BndtManage bndtManage) throws Exception { + bndtManage.setBndtDe(EgovStringUtil.removeMinusChar(bndtManage.getBndtDe())); + bndtManageDAO.updtBndtManage(bndtManage); + } + + /** + * 기 등록된 당직관리정보를 삭제한다. + * @param bndtManage - 당직관리 model + */ + @Override + public void deleteBndtManage(BndtManage bndtManage) throws Exception { + bndtManage.setBndtDe(EgovStringUtil.removeMinusChar(bndtManage.getBndtDe())); + bndtManageDAO.deleteBndtManage(bndtManage); + } + + /** + * 당직일지 갯수를 조회한다. + * @param bndtManage - 당직관리 + * @return int + * @exception Exception + */ + @Override + public int selectBndtDiaryTotCnt(BndtManage bndtManage) throws Exception { + bndtManage.setBndtDe(EgovStringUtil.removeMinusChar(bndtManage.getBndtDe())); + return bndtManageDAO.selectBndtDiaryTotCnt(bndtManage); + } + + /***** 당직 체크관리 *****/ + + /** + * 당직체크관리정보를 관리하기 위해 등록된 당직체크관리 목록을 조회한다. + * @param bndtCeckManageVO - 당직체크관리 VO + * @return List - 당직체크관리 목록 + */ + @Override + public List selectBndtCeckManageList(BndtCeckManageVO bndtCeckManageVO) throws Exception{ + return bndtManageDAO.selectBndtCeckManageList(bndtCeckManageVO); + } + + /** + * 당직체크관리목록 총 갯수를 조회한다. + * @param bndtCeckManageVO - 당직체크관리 VO + * @return int - 당직체크관리 카운트 수 + */ + @Override + public int selectBndtCeckManageListTotCnt(BndtCeckManageVO bndtCeckManageVO) throws Exception { + return bndtManageDAO.selectBndtCeckManageListTotCnt(bndtCeckManageVO); + } + + /** + * 등록된 당직체크관리의 상세정보를 조회한다. + * @param bndtCeckManageVO - 당직체크관리 VO + * @return BndtCeckManageVO - 당직체크관리 VO + */ + @Override + public BndtCeckManageVO selectBndtCeckManage(BndtCeckManageVO bndtCeckManageVO) throws Exception { + return bndtManageDAO.selectBndtCeckManage(bndtCeckManageVO); + } + + /** + * 당직체크관리정보를 신규로 등록한다. + * @param bndtCeckManage - 당직체크관리 model + */ + @Override + public void insertBndtCeckManage(BndtCeckManage bndtCeckManage) throws Exception { + bndtManageDAO.insertBndtCeckManage(bndtCeckManage); + } + + /** + * 기 등록된 당직체크관리정보를 수정한다. + * @param bndtCeckManage - 당직체크관리 model + */ + @Override + public void updtBndtCeckManage(BndtCeckManage bndtCeckManage) throws Exception { + bndtManageDAO.updtBndtCeckManage(bndtCeckManage); + } + + /** + * 기 등록된 당직체크관리정보를 삭제한다. + * @param bndtCeckManage - 당직체크관리 model + */ + @Override + public void deleteBndtCeckManage(BndtCeckManage bndtCeckManage) throws Exception { + bndtManageDAO.deleteBndtCeckManage(bndtCeckManage); + } + + /** + * 당직체크 중복여부 조회한다. + * @param bndtCeckManageVO - 당직체크관리 VO + * @return int + * @exception Exception + */ + @Override + public int selectBndtCeckManageDplctAt(BndtCeckManage bndtCeckManage) throws Exception { + return bndtManageDAO.selectBndtCeckManageDplctAt(bndtCeckManage); + } + + + /***** 당직 일지 *****/ + + /** + * 등록된 당직일지관리의 상세정보를 조회한다. + * @param bndtDiaryVO - 당직일지관리 VO + * @return BndtDiaryVO - 당직일지관리 VO + */ + @Override + public List selectBndtDiary(BndtDiaryVO bndtDiaryVO) throws Exception { + return bndtManageDAO.selectBndtDiary(bndtDiaryVO); + } + + /** + * 당직일지관리정보를 신규로 등록한다. + * @param bndtDiary - 당직일지관리 model + * @param diaryForUpdt - String + */ + @Override + public void insertBndtDiary(BndtDiary bndtDiary, String diaryForInsert) throws Exception { + + BndtDiary bndtDiaryTemp; + String [] bndtDiaryValues = diaryForInsert.split("[@]"); + String [] sTempBndtDiary; + String sTemp=null; + for (int i=0; i selectBndtManageBnde(InputStream inputStream)throws Exception{ + int bndtSheetRowCnt = 0; + String xlsFile = null; + String sTempNm = null; + String sTempId = null; + + + List list = new ArrayList(); + + String sBndtDe = null; + HSSFWorkbook hssfWB = (HSSFWorkbook) excelZipService.loadWorkbook(inputStream); + // 엑셀 파일 시트 갯수 확인 sheet = 1 + if (hssfWB.getNumberOfSheets() == 1) { + HSSFSheet bndtSheet = hssfWB.getSheetAt(0); //당직자 시트 가져오기 + HSSFRow bndtRow = bndtSheet.getRow(1); //당직자 row 가져오기 + bndtSheetRowCnt = bndtRow.getPhysicalNumberOfCells(); //당직자 cell Cnt + int rowsCnt=bndtSheet.getPhysicalNumberOfRows(); //행 갯수 가져오기 + + BndtManageVO checkBndtManageVO = new BndtManageVO(); + for(int j=1; j selectBndtManageBndeX(InputStream inputStream)throws Exception{ + int bndtSheetRowCnt = 0; + String xlsFile = null; + String sTempNm = null; + String sTempId = null; + + + List list = new ArrayList(); + + String sBndtDe = null; + XSSFWorkbook hssfWB = null;// = (XSSFWorkbook) excelZipService.loadWorkbook(inputStream,null); + try { + hssfWB = new XSSFWorkbook(inputStream); + + } catch (IOException e) {//KISA 보안약점 조치 (2018-10-29, 윤창원) + LOGGER.debug("=====>>>>> ERR : IOException "+e.getMessage()); + } catch (Exception e) { + LOGGER.debug("=====>>>>> ERR : "+e.getMessage()); + } + + // 엑셀 파일 시트 갯수 확인 sheet = 1 + if (hssfWB != null && hssfWB.getNumberOfSheets() == 1) { + XSSFSheet bndtSheet = hssfWB.getSheetAt(0); //당직자 시트 가져오기 + XSSFRow bndtRow = bndtSheet.getRow(1); //당직자 row 가져오기 + bndtSheetRowCnt = bndtRow.getPhysicalNumberOfCells(); //당직자 cell Cnt + int rowsCnt=bndtSheet.getPhysicalNumberOfRows(); //행 갯수 가져오기 + + BndtManageVO checkBndtManageVO = new BndtManageVO(); + for(int j=1; j= 8) { + target_day.set(Integer.parseInt(sDayOfWeek.substring(0,4)),Integer.parseInt(sDayOfWeek.substring(4,6))-1,Integer.parseInt(sDayOfWeek.substring(6,8))); + sDayOfWeekReturnValue = EgovDateUtil.formatDate(sDayOfWeek, "-")+" "+dayOfWeek[target_day.get(Calendar.DAY_OF_WEEK)-1]; + } + + return sDayOfWeekReturnValue; + + } +} diff --git a/src/main/java/egovframework/com/uss/ion/bnt/web/EgovBndtManageController.java b/src/main/java/egovframework/com/uss/ion/bnt/web/EgovBndtManageController.java new file mode 100644 index 0000000..2f3d1f4 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/bnt/web/EgovBndtManageController.java @@ -0,0 +1,676 @@ +package egovframework.com.uss.ion.bnt.web; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +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.springframework.web.bind.support.SessionStatus; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import egovframework.com.cmm.ComDefaultCodeVO; +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.service.EgovCmmUseService; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.ion.bnt.service.BndtCeckManage; +import egovframework.com.uss.ion.bnt.service.BndtCeckManageVO; +import egovframework.com.uss.ion.bnt.service.BndtDiary; +import egovframework.com.uss.ion.bnt.service.BndtDiaryVO; +import egovframework.com.uss.ion.bnt.service.BndtManage; +import egovframework.com.uss.ion.bnt.service.BndtManageVO; +import egovframework.com.uss.ion.bnt.service.EgovBndtManageService; +import egovframework.com.utl.fcc.service.EgovDateUtil; +import egovframework.com.utl.fcc.service.EgovFileUploadUtil; + +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +/** + * 개요 + * - 당직관리에 대한 controller 클래스를 정의한다. + * + * 상세내용 + * - 당직관리에 대한 등록, 수정, 삭제, 조회 기능을 제공한다. + * - 당직관리의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + * *
    + * << 개정이력(Modification Information) >>
    + *
    + *  수정일              수정자             수정내용
    + *  ----------  --------    ---------------------------
    + *  2009.06.25   이용              최초 생성
    + *  2011.08.26   정진오            IncludedInfo annotation 추가
    + *  2018.08.29   신용호            xlsx 업로드 할수 있도록 수정
    + *  2020.11.02   신용호            KISA 보안약점 조치 - 자원해제
    + *
    + *  
    + */ + +@Controller +public class EgovBndtManageController { + + @Resource(name = "egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name = "egovBndtManageService") + private EgovBndtManageService egovBndtManageService; + + @Autowired + private DefaultBeanValidator beanValidator; + + @Resource(name = "EgovCmmUseService") + private EgovCmmUseService cmmUseService; + + /** + * 당직관리 목록화면 이동 + * @return String + * @exception Exception + */ + @SuppressWarnings("unused") + @IncludedInfo(name = "당직관리", order = 910, gid = 50) + @RequestMapping("/uss/ion/bnt/EgovBndtManageList.do") + public String selectBndtManageListView( + @ModelAttribute("bndtManageVO") BndtManageVO bndtManageVO, + @RequestParam Map commandMap, + ModelMap model) throws Exception { + + //일정구분 검색 유지 + //model.addAttribute("searchKeyword", commandMap.get("searchKeyword") == null ? "" : (String)commandMap.get("searchKeyword")); + //model.addAttribute("searchCondition", commandMap.get("searchCondition") == null ? "" : (String)commandMap.get("searchCondition")); + + java.util.Calendar cal = java.util.Calendar.getInstance(); + + String sYear = (String)commandMap.get("year"); + String sMonth = (String)commandMap.get("month"); + + int iYear = cal.get(java.util.Calendar.YEAR); + int iMonth = cal.get(java.util.Calendar.MONTH); + int iDate = cal.get(java.util.Calendar.DATE); + + //검색 설정 + String sSearchDate = ""; + if (sYear == null || sMonth == null) { + sSearchDate += Integer.toString(iYear); + sSearchDate += Integer.toString(iMonth + 1).length() == 1 ? "0" + Integer.toString(iMonth + 1) + : Integer.toString(iMonth + 1); + } else { + iYear = Integer.parseInt(sYear); + iMonth = Integer.parseInt(sMonth); + sSearchDate += sYear; + sSearchDate += Integer.toString(iMonth + 1).length() == 1 ? "0" + Integer.toString(iMonth + 1) + : Integer.toString(iMonth + 1); + } + bndtManageVO.setBndtDe(sSearchDate); + + bndtManageVO.setBndtManageList(egovBndtManageService.selectBndtManageList(bndtManageVO)); + model.addAttribute("bndtManageList", bndtManageVO.getBndtManageList()); + + return "egovframework/com/uss/ion/bnt/EgovBndtManageList"; + } + + /** + * 당직관리정보를 관리하기 위해 등록된 당직관리 목록을 조회한다. + * @param bndtManageVO - 당직관리 VO + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/ion/bnt/selectBndtManageList.do") + public String selectBndtManageList(@ModelAttribute("bndtManageVO") BndtManageVO bndtManageVO, + ModelMap model) throws Exception { + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(bndtManageVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(bndtManageVO.getPageUnit()); + paginationInfo.setPageSize(bndtManageVO.getPageSize()); + + bndtManageVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + bndtManageVO.setLastIndex(paginationInfo.getLastRecordIndex()); + bndtManageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + bndtManageVO.setBndtManageList(egovBndtManageService.selectBndtManageList(bndtManageVO)); + + model.addAttribute("bndtManageList", bndtManageVO.getBndtManageList()); + + int totCnt = egovBndtManageService.selectBndtManageListTotCnt(bndtManageVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/uss/ion/bnt/EgovBndtManageList"; + } + + /** + * 등록된 당직관리의 상세정보를 조회한다. + * @param bndtManageVO - 당직관리 VO + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/ion/bnt/EgovBndtManageDetail.do") + public String selectBndtManage(@ModelAttribute("bndtManageVO") BndtManageVO bndtManageVO, + @ModelAttribute("bndtManage") BndtManage bndtManage, + @RequestParam Map commandMap, + ModelMap model) throws Exception { + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); // 상세정보 구분 + BndtManageVO bndtManageVO_Temp = new BndtManageVO(); + bndtManageVO_Temp = egovBndtManageService.selectBndtManage(bndtManageVO); + + model.addAttribute("bndtManageVO", bndtManageVO_Temp); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + if (sCmd.equals("updt")) { + bndtManage.setBndtDe(bndtManageVO_Temp.getBndtDe()); + bndtManage.setBndtId(bndtManageVO_Temp.getBndtId()); + bndtManage.setRemark(bndtManageVO_Temp.getRemark()); + model.addAttribute("bndtManage", bndtManage); + + return "egovframework/com/uss/ion/bnt/EgovBndtManageUpdt"; + } else { + return "egovframework/com/uss/ion/bnt/EgovBndtManageDetail"; + } + //model.addAttribute("bndtManage", egovBndtManageService.selectBndtManage(bndtManageVO)); + //model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + //return "egovframework/com/uss/ion/ans/EgovBndtManageUpdt"; + } + + /** + * 당직관리 등록 화면으로 이동한다. + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/ion/bnt/EgovBndtManageRegist.do") + public String insertViewBndtManage(@ModelAttribute("bndtManage") BndtManage bndtManage, + @ModelAttribute("bndtManageVO") BndtManageVO bndtManageVO, + ModelMap model) throws Exception { + + bndtManage.setBndtDe(EgovDateUtil.formatDate(bndtManage.getBndtDe(), "-")); + model.addAttribute("bndtManage", bndtManage); + model.addAttribute("bndtManageVO", bndtManageVO); + + return "egovframework/com/uss/ion/bnt/EgovBndtManageRegist"; + } + + /** + * 당직관리정보를 신규로 등록한다. + * @param bndtManage - 당직관리 model + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/ion/bnt/insertBndtManage.do") + public String insertBndtManage(@ModelAttribute("bndtManage") BndtManage bndtManage, + @ModelAttribute("bndtManageVO") BndtManageVO bndtManageVO, + BindingResult bindingResult, + SessionStatus status, + ModelMap model) throws Exception { + + beanValidator.validate(bndtManage, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + model.addAttribute("bndtManageVO", bndtManageVO); + return "egovframework/com/uss/ion/bnt/EgovBndtManageRegist"; + } else { + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + status.setComplete(); + model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); + bndtManage.setFrstRegisterId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + egovBndtManageService.insertBndtManage(bndtManage); + //model.addAttribute("bndtManage", egovBndtManageService.insertBndtManage(bndtManage)); + + return "forward:/uss/ion/bnt/EgovBndtManageList.do"; + + } + } + + /** + * 기 등록된 당직관리정보를 수정한다. + * @param bndtManage - 당직관리 model + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/ion/bnt/updtBndtManage.do") + public String updtBndtManage(@ModelAttribute("bndtManage") BndtManage bndtManage, + @ModelAttribute("bndtManageVO") BndtManageVO bndtManageVO, + BindingResult bindingResult, + SessionStatus status, + ModelMap model) throws Exception { + + beanValidator.validate(bndtManage, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + model.addAttribute("bndtManageVO", bndtManageVO); + return "egovframework/com/uss/ion/bnt/EgovBndtManageUpdt"; + } else { + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + bndtManage.setLastUpdusrId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + egovBndtManageService.updtBndtManage(bndtManage); + return "forward:/uss/ion/bnt/EgovBndtManageList.do"; + + } + } + + /** + * 기 등록된 당직관리정보를 삭제한다. + * @param bndtManage - 당직관리 model + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/ion/bnt/deleteBndtManage.do") + public String deleteBndtManage(@ModelAttribute("bndtManage") BndtManage bndtManage, + SessionStatus status, + ModelMap model) throws Exception { + + int iDiaryTotCnt = egovBndtManageService.selectBndtDiaryTotCnt(bndtManage); + if (iDiaryTotCnt == 0) { + egovBndtManageService.deleteBndtManage(bndtManage); + status.setComplete(); + model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); + return "forward:/uss/ion/bnt/EgovBndtManageList.do"; + } else { + + BndtManageVO bndtManageVO = new BndtManageVO(); + bndtManageVO.setBndtDe(bndtManage.getBndtDe()); + bndtManageVO.setBndtId(bndtManage.getBndtId()); + + bndtManageVO = egovBndtManageService.selectBndtManage(bndtManageVO); + + model.addAttribute("bndtManageVO", bndtManageVO); + model.addAttribute("errorMessage", "당직일지를 삭제하신 후 당직정보를 삭제 하세요."); + + bndtManage.setBndtDe(bndtManageVO.getBndtDe()); + bndtManage.setBndtId(bndtManageVO.getBndtId()); + bndtManage.setRemark(bndtManageVO.getRemark()); + model.addAttribute("bndtManage", bndtManage); + + return "egovframework/com/uss/ion/bnt/EgovBndtManageUpdt"; + } + } + + /****** 당직체크 관리 ******/ + /** + * 당직체크정보를 관리하기 위해 등록된 당직체크 목록을 조회한다. + * @param bndtCeckManageVO - 당직체크 VO + * @return String - 리턴 Url + */ + @IncludedInfo(name = "당직체크관리", order = 911, gid = 50) + @RequestMapping(value = "/uss/ion/bnt/EgovBndtCeckManageList.do") + public String selectBndtCeckManageList(@ModelAttribute("bndtCeckManageVO") BndtCeckManageVO bndtCeckManageVO, + ModelMap model) throws Exception { + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(bndtCeckManageVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(bndtCeckManageVO.getPageUnit()); + paginationInfo.setPageSize(bndtCeckManageVO.getPageSize()); + + bndtCeckManageVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + bndtCeckManageVO.setLastIndex(paginationInfo.getLastRecordIndex()); + bndtCeckManageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM071"); + List bndtCeckSeList = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("bndtCeckSeList", bndtCeckSeList); + + bndtCeckManageVO.setBndtCeckManageList(egovBndtManageService.selectBndtCeckManageList(bndtCeckManageVO)); + model.addAttribute("bndtCeckManageList", bndtCeckManageVO.getBndtCeckManageList()); + + int totCnt = egovBndtManageService.selectBndtCeckManageListTotCnt(bndtCeckManageVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + model.addAttribute("bndtCeckManageVO", bndtCeckManageVO); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/uss/ion/bnt/EgovBndtCeckManageList"; + } + + /** + * 등록된 당직체크의 상세정보를 조회한다. + * @param bndtCeckManageVO - 당직체크 VO + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/ion/bnt/EgovBndtCeckManage.do") + public String selectBndtCeckManage(@ModelAttribute("bndtCeckManageVO") BndtCeckManageVO bndtCeckManageVO, + @ModelAttribute("bndtCeckManage") BndtCeckManage bndtCeckManage, + @RequestParam Map commandMap, + ModelMap model) throws Exception { + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); // 상세정보 구분 + BndtCeckManageVO bndtCeckManageVO_Temp = new BndtCeckManageVO(); + bndtCeckManageVO_Temp = egovBndtManageService.selectBndtCeckManage(bndtCeckManageVO); + + model.addAttribute("bndtCeckManageVO", bndtCeckManageVO_Temp); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + if (sCmd.equals("updt")) { + BndtCeckManage bndtCeckManage_Temp = new BndtCeckManage(); + bndtCeckManage_Temp.setBndtCeckSe(bndtCeckManageVO_Temp.getBndtCeckSe()); + bndtCeckManage_Temp.setBndtCeckCd(bndtCeckManageVO_Temp.getBndtCeckSe()); + bndtCeckManage_Temp.setBndtCeckCdNm(bndtCeckManageVO_Temp.getBndtCeckCdNm()); + bndtCeckManage_Temp.setUseAt(bndtCeckManageVO_Temp.getUseAt()); + model.addAttribute("bndtCeckManage", bndtCeckManage_Temp); + return "egovframework/com/uss/ion/bnt/EgovBndtCeckManageUpdt"; + } else { + return "egovframework/com/uss/ion/bnt/EgovBndtCeckManageDetail"; + } + } + + /** + * 당직체크 등록 화면으로 이동한다. + * @return String - 리턴 Url + */ + @SuppressWarnings("unused") + @RequestMapping(value = "/uss/ion/bnt/EgovBndtCeckManageRegist.do") + public String insertViewBndtCeckManage(@ModelAttribute("bndtCeckManage") BndtCeckManage bndtCeckManage, + ModelMap model) throws Exception { + //로그인 객체 선언 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM071"); + List bndtCeckSeList = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("bndtCeckSeList", bndtCeckSeList); + + bndtCeckManage.setBndtCeckCd(""); + bndtCeckManage.setBndtCeckCdNm(""); + bndtCeckManage.setBndtCeckSe(""); + return "egovframework/com/uss/ion/bnt/EgovBndtCeckManageRegist"; + } + + /** + * 당직체크정보를 신규로 등록한다. + * @param bndtCeckManage - 당직체크 model + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/ion/bnt/insertBndtCeckManage.do") + public String insertBndtCeckManage(@ModelAttribute("bndtCeckManage") BndtCeckManage bndtCeckManage, + @ModelAttribute("bndtCeckManageVO") BndtCeckManageVO bndtCeckManageVO, + BindingResult bindingResult, + SessionStatus status, + ModelMap model) throws Exception { + + beanValidator.validate(bndtCeckManage, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM071"); + List bndtCeckSeList = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("bndtCeckSeList", bndtCeckSeList); + model.addAttribute("bndtCeckManageVO", bndtCeckManageVO); + return "egovframework/com/uss/ion/bnt/EgovBndtCeckManageRegist"; + } else { + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + bndtCeckManage.setFrstRegisterId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + status.setComplete(); + + if (egovBndtManageService.selectBndtCeckManageDplctAt(bndtCeckManage) == 0) { + egovBndtManageService.insertBndtCeckManage(bndtCeckManage); + model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); + return "forward:/uss/ion/bnt/EgovBndtCeckManageList.do"; + } else { + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM071"); + List bndtCeckSeList = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("bndtCeckSeList", bndtCeckSeList); + model.addAttribute("bndtCeckManageVO", bndtCeckManageVO); + model.addAttribute("dplctMessage", "이미 등록된 데이타입니다. 해당 데이타를 확인해 주세요"); + return "egovframework/com/uss/ion/bnt/EgovBndtCeckManageRegist"; + } + } + } + + /** + * 기 등록된 당직체크정보를 수정한다. + * @param bndtCeckManage - 당직체크 model + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/ion/bnt/updtBndtCeckManage.do") + public String updtBndtCeckManage(@ModelAttribute("bndtCeckManage") BndtCeckManage bndtCeckManage, + @ModelAttribute("bndtCeckManageVO") BndtCeckManageVO bndtCeckManageVO, + BindingResult bindingResult, + SessionStatus status, + ModelMap model) throws Exception { + + beanValidator.validate(bndtCeckManage, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + model.addAttribute("bndtCeckManageVO", bndtCeckManageVO); + return "egovframework/com/uss/ion/bnt/EgovBndtCeckManageUpdt"; + } else { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + bndtCeckManage.setLastUpdusrId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + egovBndtManageService.updtBndtCeckManage(bndtCeckManage); + return "forward:/uss/ion/bnt/EgovBndtCeckManageList.do"; + + } + } + + /** + * 기 등록된 당직체크정보를 삭제한다. + * @param bndtCeckManage - 당직체크 model + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/ion/bnt/deleteBndtCeckManage.do") + public String deleteBndtCeckManage(@ModelAttribute("bndtCeckManage") BndtCeckManage bndtCeckManage, + SessionStatus status, + ModelMap model) throws Exception { + + egovBndtManageService.deleteBndtCeckManage(bndtCeckManage); + status.setComplete(); + model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); + return "forward:/uss/ion/bnt/EgovBndtCeckManageList.do"; + } + + /****** 당직일지 ******/ + + /** + * 등록된 당직일지의 정보를 조회한다. + * @param bndtDiaryVO - 당직일지 VO + * @return String - 리턴 Url + */ + @SuppressWarnings("unchecked") + @RequestMapping(value = "/uss/ion/bnt/selectBndtDiary.do") + public String selectBndtDiary(@ModelAttribute("bndtDiaryVO") BndtDiaryVO bndtDiaryVO, + @RequestParam Map commandMap, + ModelMap model) throws Exception { + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); // 상세정보 구분 + + bndtDiaryVO.setBndtDiaryList((List)egovBndtManageService.selectBndtDiary(bndtDiaryVO)); + model.addAttribute("bndtDiaryList", bndtDiaryVO.getBndtDiaryList()); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + if (sCmd.equals("insert")) { + bndtDiaryVO.setBndtDe(bndtDiaryVO.getBndtDe()); + bndtDiaryVO.setBndtId(bndtDiaryVO.getBndtId()); + model.addAttribute("bndtDiaryVO", bndtDiaryVO); + return "egovframework/com/uss/ion/bnt/EgovBndtDiaryRegist"; + } else if (sCmd.equals("updt")) { + return "egovframework/com/uss/ion/bnt/EgovBndtDiaryUpdt"; + } else { + return "egovframework/com/uss/ion/bnt/EgovBndtDiaryDetail"; + } + } + + /** + * 당직일지정보를 신규로 등록한다. + * @param bndtDiary - 당직일지 model + * @return String - 리턴 Url + */ + @SuppressWarnings("unused") + @RequestMapping(value = "/uss/ion/bnt/insertBndtDiary.do") + public String insertBndtDiary(@RequestParam("diaryForInsert") String diaryForInsert, + @ModelAttribute("bndtDiary") BndtDiary bndtDiary, + @ModelAttribute("bndtDiaryVO") BndtDiaryVO bndtDiaryVO, + BindingResult bindingResult, + SessionStatus status, + @RequestParam Map commandMap, + ModelMap model) throws Exception { + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); // 상세정보 구분 + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + status.setComplete(); + + bndtDiary.setFrstRegisterId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + egovBndtManageService.insertBndtDiary(bndtDiary, diaryForInsert); + model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); + return "forward:/uss/ion/bnt/EgovBndtManageList.do"; + } + + /** + * 기 등록된 당직일지정보를 수정한다. + * @param bndtDiary - 당직일지 model + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/ion/bnt/updtBndtDiary.do") + public String updtBndtDiary(@RequestParam("diaryForUpdt") String diaryForUpdt, + @ModelAttribute("bndtDiary") BndtDiary bndtDiary, + BindingResult bindingResult, + SessionStatus status, + ModelMap model) throws Exception { + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + bndtDiary.setLastUpdusrId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + egovBndtManageService.updtBndtDiary(bndtDiary, diaryForUpdt); + return "forward:/uss/ion/bnt/EgovBndtManageList.do"; + } + + /** + * 기 등록된 당직일지정보를 삭제한다. + * @param bndtDiary - 당직일지 model + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/ion/bnt/deleteBndtDiary.do") + public String deleteBndtDiary(@ModelAttribute("bndtDiary") BndtDiary bndtDiary, + SessionStatus status, + ModelMap model) throws Exception { + + egovBndtManageService.deleteBndtDiary(bndtDiary); + status.setComplete(); + model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); + return "forward:/uss/ion/bnt/EgovBndtManageList.do"; + } + + /** + * 당직일괄등록화면 호출 및 당직일괄등록처리 프로세스 + * @param bndtManageVO BndtManageVO + * @param request HttpServletRequest + * @return 출력페이지정보 "ion/bnt/EgovBndtManageListPop" + * @exception Exception + */ + @RequestMapping(value = "/uss/ion/bnt/EgovBndtManageListPop.do") + public String selectBndtManageBnde(final HttpServletRequest request, + @ModelAttribute("bndtManageVO") BndtManageVO bndtManageVO, + @RequestParam Map commandMap, + ModelMap model) throws Exception { + // 0. Spring Security 사용자권한 처리 + + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + return "egovframework/com/uss/ion/bnt/EgovBndtManageBndeListPop"; + } + + @RequestMapping(value = "/uss/ion/bnt/EgovBndtManageListPopAction.do") + public String selectBndtManageBndeAction(final MultipartHttpServletRequest multiRequest, + @ModelAttribute("bndtManageVO") BndtManageVO bndtManageVO, + @RequestParam Map commandMap, + ModelMap model) throws Exception { + String resultMsg = ""; + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); // 상세정보 구분 + + // 0. Spring Security 사용자권한 처리 + + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + if (sCmd.equals("bnde")) { + //final MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) request; + final Map files = multiRequest.getFileMap(); + Iterator> itr = files.entrySet().iterator(); + MultipartFile file; + while (itr.hasNext()) { + Entry entry = itr.next(); + file = entry.getValue(); + if (!"".equals(file.getOriginalFilename())) { + String ext = EgovFileUploadUtil.getFileExtension(file.getOriginalFilename()); + if ("xlsx".equals(ext)) { + InputStream is = null; + try { + is = file.getInputStream(); + model.addAttribute("bndtManageList", egovBndtManageService.selectBndtManageBndeX(is)); + } catch (IOException e) { + throw new IOException(e); + } finally { + if (is != null) {//2022.01.Possible null pointer dereference in method on exception path 처리 + is.close(); + } + } + } else if ("xls".equals(ext)) { + InputStream is = null; + try { + is = file.getInputStream(); + model.addAttribute("bndtManageList", egovBndtManageService.selectBndtManageBnde(is)); + } catch (IOException e) { + throw new IOException(e); + } finally { + if (is != null) {//2022.01.Possible null pointer dereference in method on exception path 처리 + is.close(); + } + } + } else { + throw new RuntimeException(egovMessageSource.getMessage("errors.file.extension")); + } + } else { + resultMsg = egovMessageSource.getMessage("fail.common.msg"); + } + } + model.addAttribute("resultMsg", resultMsg); + } + return "egovframework/com/uss/ion/bnt/EgovBndtManageBndeListPop"; + } + + /** + * 당직정보를 일괄등록처리한다. + * @param bndtManageVO - 당직관리 VO + * @param String - 당직자정보 + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/ion/bnt/insertBndtManageBnde.do") + public String insertBndtManageBnde(@RequestParam("checkedBndtManageForInsert") String checkedBndtManageForInsert, + @ModelAttribute("bndtManageVO") BndtManageVO bndtManageVO, + SessionStatus status, + ModelMap model) throws Exception { + int iTemp = egovBndtManageService.selectBndtManageMonthCnt(bndtManageVO); + if (iTemp == 0) { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + bndtManageVO.setFrstRegisterId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + egovBndtManageService.insertBndtManageBnde(bndtManageVO, checkedBndtManageForInsert); + status.setComplete(); + model.addAttribute("message", "true"); + return "egovframework/com/uss/ion/bnt/EgovBndtManageList"; + } else { + String sTempMessage = bndtManageVO.getBndtDe().substring(0, 4) + "년" + + bndtManageVO.getBndtDe().substring(4, 6) + "월 데이타가 존재합니다."; + model.addAttribute("message", sTempMessage); + return "egovframework/com/uss/ion/bnt/EgovBndtManageBndeListPop"; + } + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/ctn/service/CtsnnManage.java b/src/main/java/egovframework/com/uss/ion/ctn/service/CtsnnManage.java new file mode 100644 index 0000000..6d7eac9 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ctn/service/CtsnnManage.java @@ -0,0 +1,385 @@ +package egovframework.com.uss.ion.ctn.service; + +import egovframework.com.cmm.ComDefaultVO; + +/** + * 개요 + * - 경조관리에 대한 model 클래스를 정의한다. + * + * 상세내용 + * - 경조관리의 사용자ID,경조코드,신청일자,대상자명,생년월일,발생일자,관계,비고,결재자ID,승인여부,결재일시,반려사유,최초등록자ID,최초등록시점,최종수정자ID,최종수정시점 항목을 관리한다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +public class CtsnnManage extends ComDefaultVO { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + + /** + * 경조ID + */ + private String ctsnnId; + + /** + * 사용자ID + */ + private String usid; + + /** + * 경조코드 + */ + private String ctsnnCd; + + /** + * 신청일자 + */ + private String reqstDe; + + /** + * 경조명 + */ + private String ctsnnNm; + + /** + * 대상자명 + */ + private String trgterNm; + + /** + * 생년월일 + */ + private String brth; + + /** + * 발생일자 + */ + private String occrrDe; + + /** + * 관계 + */ + private String relate; + + /** + * 비고 + */ + private String remark; + + /** + * 결재자ID + */ + private String sanctnerId; + + /** + * 승인여부 + */ + private String confmAt; + + /** + * 결재일시 + */ + private String sanctnDt; + + /** + * 반려사유 + */ + private String returnResn; + + /** + * 약식결재ID + */ + private String infrmlSanctnId; + + /** + * 최초등록자ID + */ + private String frstRegisterId; + + /** + * 최초등록시점 + */ + private String frstRegisterPnttm; + + /** + * 최종수정자ID + */ + private String lastUpdusrId; + + /** + * 최종수정시점 + */ + private String lastUpdusrPnttm; + + + /** + * @return the ctsnnId + */ + public String getCtsnnId() { + return ctsnnId; + } + + /** + * @param ctsnnId the ctsnnId to set + */ + public void setCtsnnId(String ctsnnId) { + this.ctsnnId = ctsnnId; + } + + /** + * @return the usid + */ + public String getUsid() { + return usid; + } + + /** + * @param usid the usid to set + */ + public void setUsid(String usid) { + this.usid = usid; + } + + /** + * @return the ctsnnCd + */ + public String getCtsnnCd() { + return ctsnnCd; + } + + /** + * @param ctsnnCd the ctsnnCd to set + */ + public void setCtsnnCd(String ctsnnCd) { + this.ctsnnCd = ctsnnCd; + } + + /** + * @return the reqstDe + */ + public String getReqstDe() { + return reqstDe; + } + + /** + * @param reqstDe the reqstDe to set + */ + public void setReqstDe(String reqstDe) { + this.reqstDe = reqstDe; + } + + /** + * @return the ctsnnNm + */ + public String getCtsnnNm() { + return ctsnnNm; + } + + /** + * @param ctsnnNm the ctsnnNm to set + */ + public void setCtsnnNm(String ctsnnNm) { + this.ctsnnNm = ctsnnNm; + } + + /** + * @return the trgterNm + */ + public String getTrgterNm() { + return trgterNm; + } + + /** + * @param trgterNm the trgterNm to set + */ + public void setTrgterNm(String trgterNm) { + this.trgterNm = trgterNm; + } + + /** + * @return the brth + */ + public String getBrth() { + return brth; + } + + /** + * @param brth the brth to set + */ + public void setBrth(String brth) { + this.brth = brth; + } + + /** + * @return the occrrDe + */ + public String getOccrrDe() { + return occrrDe; + } + + /** + * @param occrrDe the occrrDe to set + */ + public void setOccrrDe(String occrrDe) { + this.occrrDe = occrrDe; + } + + /** + * @return the relate + */ + public String getRelate() { + return relate; + } + + /** + * @param relate the relate to set + */ + public void setRelate(String relate) { + this.relate = relate; + } + + /** + * @return the remark + */ + public String getRemark() { + return remark; + } + + /** + * @param remark the remark to set + */ + public void setRemark(String remark) { + this.remark = remark; + } + + /** + * @return the sanctnerId + */ + public String getSanctnerId() { + return sanctnerId; + } + + /** + * @param sanctnerId the sanctnerId to set + */ + public void setSanctnerId(String sanctnerId) { + this.sanctnerId = sanctnerId; + } + + /** + * @return the confmAt + */ + public String getConfmAt() { + return confmAt; + } + + /** + * @param confmAt the confmAt to set + */ + public void setConfmAt(String confmAt) { + this.confmAt = confmAt; + } + + /** + * @return the sanctnDt + */ + public String getSanctnDt() { + return sanctnDt; + } + + /** + * @param sanctnDt the sanctnDt to set + */ + public void setSanctnDt(String sanctnDt) { + this.sanctnDt = sanctnDt; + } + + /** + * @return the returnResn + */ + public String getReturnResn() { + return returnResn; + } + + /** + * @param returnResn the returnResn to set + */ + public void setReturnResn(String returnResn) { + this.returnResn = returnResn; + } + + /** + * @return the infrmlSanctnId + */ + public String getInfrmlSanctnId() { + return infrmlSanctnId; + } + + /** + * @param infrmlSanctnId the infrmlSanctnId to set + */ + public void setInfrmlSanctnId(String infrmlSanctnId) { + this.infrmlSanctnId = infrmlSanctnId; + } + + /** + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * @param frstRegisterId the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * @param frstRegisterPnttm the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * @param lastUpdusrId the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + /** + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * @param lastUpdusrPnttm the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/ctn/service/CtsnnManageVO.java b/src/main/java/egovframework/com/uss/ion/ctn/service/CtsnnManageVO.java new file mode 100644 index 0000000..3ae82e9 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ctn/service/CtsnnManageVO.java @@ -0,0 +1,246 @@ +package egovframework.com.uss.ion.ctn.service; + +import java.io.Serializable; +import java.util.List; + +/** + * 개요 + * - 경조관리에 대한 Vo 클래스를 정의한다. + * + * 상세내용 + * - 경조관리의 목록 항목을 관리한다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +public class CtsnnManageVO extends CtsnnManage implements Serializable { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + /** + * 배너 목록 + */ + List ctsnnManageList; + + /** + * @return the annvrsryManageList + */ + public List getCtsnnManageList() { + return ctsnnManageList; + } + /** + * @param bannerList the bannerList to set + */ + public void setCtsnnManageList(List ctsnnManageList) { + this.ctsnnManageList = ctsnnManageList; + } + + /** + * 신청자명 + */ + private String usNm; + + /** + * 승인자명 + */ + private String sanctnerNm; + + /** + * 경조코드명 + */ + private String ctsnnCdNm; + + /** + * 사용자 소속명 + */ + private String orgnztNm; + + /** + * 승인자 소속명 + */ + private String sanctnerOrgnztNm; + + /** + * 검색시작일자 + */ + private String searchFromDate; + + /** + * 검색종료일자 + */ + private String searchToDate; + + /** + * 검색 성명 + */ + private String searchNm; + + /** + * 검색 진행구분 + */ + private String searchConfmAt; + + /** + * 가족관계명 + */ + private String relateNm; + + /** + * searchToDateView + */ + private String searchToDateView; + + /** + * searchFromDateView + */ + private String searchFromDateView; + + + /** + * @return the searchToDateView + */ + public String getSearchToDateView() { + return searchToDateView; + } + /** + * @param searchToDateView the searchToDateView to set + */ + public void setSearchToDateView(String searchToDateView) { + this.searchToDateView = searchToDateView; + } + /** + * @return the searchFromDateView + */ + public String getSearchFromDateView() { + return searchFromDateView; + } + /** + * @param searchFromDateView the searchFromDateView to set + */ + public void setSearchFromDateView(String searchFromDateView) { + this.searchFromDateView = searchFromDateView; + } + /** + * @return the usNm + */ + public String getUsNm() { + return usNm; + } + /** + * @param usNm the usNm to set + */ + public void setUsNm(String usNm) { + this.usNm = usNm; + } + /** + * @return the sanctnerNm + */ + public String getSanctnerNm() { + return sanctnerNm; + } + /** + * @param sanctnerNm the sanctnerNm to set + */ + public void setSanctnerNm(String sanctnerNm) { + this.sanctnerNm = sanctnerNm; + } + /** + * @return the ctsnnCdNm + */ + public String getCtsnnCdNm() { + return ctsnnCdNm; + } + /** + * @param ctsnnCdNm the ctsnnCdNm to set + */ + public void setCtsnnCdNm(String ctsnnCdNm) { + this.ctsnnCdNm = ctsnnCdNm; + } + /** + * @return the orgnztNm + */ + public String getOrgnztNm() { + return orgnztNm; + } + /** + * @param orgnztNm the orgnztNm to set + */ + public void setOrgnztNm(String orgnztNm) { + this.orgnztNm = orgnztNm; + } + /** + * @return the sanctnerOrgnztNm + */ + public String getSanctnerOrgnztNm() { + return sanctnerOrgnztNm; + } + /** + * @param sanctnerOrgnztNm the sanctnerOrgnztNm to set + */ + public void setSanctnerOrgnztNm(String sanctnerOrgnztNm) { + this.sanctnerOrgnztNm = sanctnerOrgnztNm; + } + /** + * @return the searchFromDate + */ + public String getSearchFromDate() { + return searchFromDate; + } + /** + * @param searchFromDate the searchFromDate to set + */ + public void setSearchFromDate(String searchFromDate) { + this.searchFromDate = searchFromDate; + } + /** + * @return the searchToDate + */ + public String getSearchToDate() { + return searchToDate; + } + /** + * @param searchToDate the searchToDate to set + */ + public void setSearchToDate(String searchToDate) { + this.searchToDate = searchToDate; + } + /** + * @return the searchNm + */ + public String getSearchNm() { + return searchNm; + } + /** + * @param searchNm the searchNm to set + */ + public void setSearchNm(String searchNm) { + this.searchNm = searchNm; + } + /** + * @return the searchConfmAt + */ + public String getSearchConfmAt() { + return searchConfmAt; + } + /** + * @param searchConfmAt the searchConfmAt to set + */ + public void setSearchConfmAt(String searchConfmAt) { + this.searchConfmAt = searchConfmAt; + } + /** + * @return the relateNm + */ + public String getRelateNm() { + return relateNm; + } + /** + * @param relateNm the relateNm to set + */ + public void setRelateNm(String relateNm) { + this.relateNm = relateNm; + } +} diff --git a/src/main/java/egovframework/com/uss/ion/ctn/service/EgovCtsnnManageService.java b/src/main/java/egovframework/com/uss/ion/ctn/service/EgovCtsnnManageService.java new file mode 100644 index 0000000..d91af96 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ctn/service/EgovCtsnnManageService.java @@ -0,0 +1,78 @@ +package egovframework.com.uss.ion.ctn.service; + +import java.util.List; + +/** + * 개요 + * - 경조관리에 대한 Service Interface를 정의한다. + * + * 상세내용 + * - 경조관리에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 경조관리의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +public interface EgovCtsnnManageService { + + /** + * 경조관리 정보를 관리하기 위해 등록된 로그인화면이미지 목록을 조회한다. + * @param ctsnnManageVO - 경조관리 VO + * @return List - 경조관리 목록 + */ + public List selectCtsnnManageList(CtsnnManageVO ctsnnManageVO) throws Exception; + + /** + * 경조관리 목록 총 갯수를 조회한다. + * @param ctsnnManageVO - 경조관리 VO + * @return int - 경조관리 카운트 수 + */ + public int selectCtsnnManageListTotCnt(CtsnnManageVO ctsnnManageVO) throws Exception ; + + /** + * 등록된 경조관리의 상세정보를 조회한다. + * @param ctsnnManageVO - 경조관리 VO + * @return CtsnnManageVO - 경조관리 VO + */ + public CtsnnManageVO selectCtsnnManage(CtsnnManageVO ctsnnManageVO) throws Exception; + + /** + * 경조관리 정보를 신규로 등록한다. + * @param ctsnnManage - 경조관리 model + */ + public void insertCtsnnManage(CtsnnManage ctsnnManage) throws Exception; + + /** + * 기 등록된 경조관리 정보를 수정한다. + * @param ctsnnManage - 경조관리 model + */ + public void updtCtsnnManage(CtsnnManage ctsnnManage) throws Exception; + + /** + * 기 등록된 경조관리 정보를 삭제한다. + * @param ctsnnManage - 경조관리 model + */ + public void deleteCtsnnManage(CtsnnManage ctsnnManage) throws Exception; + + /*** 승인처리관련 ***/ + /** + * 경조관리정보 승인 처리를 위해 신청된 경조관리 목록을 조회한다. + * @param ctsnnManageVO - 경조관리 VO + * @return List - 경조관리 목록 + */ + public List selectCtsnnManageConfmList(CtsnnManageVO ctsnnManageVO) throws Exception; + + /** + * 경조관리정보 승인 처리를 위해 신청된 경조관리 목록 총 갯수를 조회한다. + * @param ctsnnManageVO - 경조관리 VO + * @return int - 경조관리 카운트 수 + */ + public int selectCtsnnManageConfmListTotCnt(CtsnnManageVO ctsnnManageVO) throws Exception ; + + /** + * 경조정보를 승인처리 한다. + * @param ctsnnManage - 경조관리 model + */ + public void updtCtsnnManageConfm(CtsnnManage ctsnnManage) throws Exception; +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/ctn/service/impl/CtsnnManageDAO.java b/src/main/java/egovframework/com/uss/ion/ctn/service/impl/CtsnnManageDAO.java new file mode 100644 index 0000000..aef04b4 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ctn/service/impl/CtsnnManageDAO.java @@ -0,0 +1,105 @@ +package egovframework.com.uss.ion.ctn.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.ion.ctn.service.CtsnnManage; +import egovframework.com.uss.ion.ctn.service.CtsnnManageVO; + +import org.springframework.stereotype.Repository; + +/** + * 개요 + * - 경조관리에 대한 DAO 클래스를 정의한다. + * + * 상세내용 + * - 경조관리에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 경조관리의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +@Repository("ctsnnManageDAO") +public class CtsnnManageDAO extends EgovComAbstractDAO { + + /** + * 경조관리정보를 관리하기 위해 등록된 경조관리 목록을 조회한다. + * @param ctsnnManageVO - 경조관리 VO + * @return List - 경조관리 목록 + */ + public List selectCtsnnManageList(CtsnnManageVO ctsnnManageVO) throws Exception { + return selectList("ctsnnManageDAO.selectCtsnnManageList", ctsnnManageVO); + } + + /** + * 경조관리목록 총 갯수를 조회한다. + * @param ctsnnManageVO - 경조관리 VO + * @return int + * @exception Exception + */ + public int selectCtsnnManageListTotCnt(CtsnnManageVO ctsnnManageVO) throws Exception { + return (Integer)selectOne("ctsnnManageDAO.selectCtsnnManageListTotCnt", ctsnnManageVO); + } + + /** + * 등록된 경조관리의 상세정보를 조회한다. + * @param ctsnnManageVO - 경조관리 VO + * @return CtsnnManageVO - 경조관리 VO + */ + public CtsnnManageVO selectCtsnnManage(CtsnnManageVO ctsnnManageVO) throws Exception { + return (CtsnnManageVO) selectOne("ctsnnManageDAO.selectCtsnnManage", ctsnnManageVO); + } + + /** + * 경조관리정보를 신규로 등록한다. + * @param ctsnnManage - 경조관리 model + */ + public void insertCtsnnManage(CtsnnManage ctsnnManage) throws Exception { + insert("ctsnnManageDAO.insertCtsnnManage", ctsnnManage); + } + + /** + * 기 등록된 경조관리정보를 수정한다. + * @param ctsnnManage - 경조관리 model + */ + public void updtCtsnnManage(CtsnnManage ctsnnManage) throws Exception { + update("ctsnnManageDAO.updateCtsnnManage", ctsnnManage); + } + + /** + * 기 등록된 경조관리정보를 삭제한다. + * @param ctsnnManage - 경조관리 model + */ + public void deleteCtsnnManage(CtsnnManage ctsnnManage) throws Exception { + delete("ctsnnManageDAO.deleteCtsnnManage",ctsnnManage); + } + + /*** 승인처리관련 ***/ + /** + * 경조관리정보 승인 처리를 위해 신청된 경조관리 목록을 조회한다. + * @param ctsnnManageVO - 경조관리 VO + * @return List - 경조관리 목록 + */ + public List selectCtsnnManageConfmList(CtsnnManageVO ctsnnManageVO) throws Exception { + return selectList("ctsnnManageDAO.selectCtsnnManageConfmList", ctsnnManageVO); + } + + /** + * 경조관리정보 승인 처리를 위해 신청된 경조관리 목록 총 갯수를 조회한다. + * @param ctsnnManageVO - 경조관리 VO + * @return int + * @exception Exception + */ + public int selectCtsnnManageConfmListTotCnt(CtsnnManageVO ctsnnManageVO) throws Exception { + return (Integer)selectOne("ctsnnManageDAO.selectCtsnnManageConfmListTotCnt", ctsnnManageVO); + } + + /** + *경조정보를 승인처리 한다. + * @param ctsnnManage - 경조관리 model + */ + public void updtCtsnnManageConfm(CtsnnManage ctsnnManage) throws Exception { + update("ctsnnManageDAO.updtCtsnnManageConfm", ctsnnManage); + } +} diff --git a/src/main/java/egovframework/com/uss/ion/ctn/service/impl/EgovCtsnnManageServiceImpl.java b/src/main/java/egovframework/com/uss/ion/ctn/service/impl/EgovCtsnnManageServiceImpl.java new file mode 100644 index 0000000..314e5eb --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ctn/service/impl/EgovCtsnnManageServiceImpl.java @@ -0,0 +1,232 @@ +package egovframework.com.uss.ion.ctn.service.impl; + +import java.util.List; + +import egovframework.com.uss.ion.ctn.service.CtsnnManage; +import egovframework.com.uss.ion.ctn.service.CtsnnManageVO; +import egovframework.com.uss.ion.ctn.service.EgovCtsnnManageService; +import egovframework.com.uss.ion.ism.service.EgovInfrmlSanctnService; +import egovframework.com.uss.ion.ism.service.InfrmlSanctn; +import egovframework.com.utl.fcc.service.EgovDateUtil; +import egovframework.com.utl.fcc.service.EgovStringUtil; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +/** + * 개요 + * - 경조관리에 대한 ServiceImpl 클래스를 정의한다. + * + * 상세내용 + * - 경조관리에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 경조관리의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +@Service("egovCtsnnManageService") +public class EgovCtsnnManageServiceImpl extends EgovAbstractServiceImpl implements EgovCtsnnManageService { + + @Resource(name="ctsnnManageDAO") + private CtsnnManageDAO ctsnnManageDAO; + + /** ID Generation */ + @Resource(name="egovCtsnnManageIdGnrService") + private EgovIdGnrService idgenCtsnnManageService; + + + @Resource(name="EgovInfrmlSanctnService") + protected EgovInfrmlSanctnService infrmlSanctnService; + + /** + * 경조관리정보를 관리하기 위해 등록된 경조관리 목록을 조회한다. + * @param ctsnnManageVO - 경조관리 VO + * @return List - 경조관리 목록 + */ + public List selectCtsnnManageList(CtsnnManageVO ctsnnManageVO) throws Exception{ + ctsnnManageVO.setSearchFromDate(EgovStringUtil.removeMinusChar(ctsnnManageVO.getSearchFromDate())); + ctsnnManageVO.setSearchToDate(EgovStringUtil.removeMinusChar(ctsnnManageVO.getSearchToDate())); + List result = ctsnnManageDAO.selectCtsnnManageList(ctsnnManageVO); + + int num = result.size(); + + for (int i = 0 ; i < num ; i ++ ){ + CtsnnManageVO ctsnnManageVO1 = result.get(i); + ctsnnManageVO1.setReqstDe(EgovDateUtil.formatDate(ctsnnManageVO1.getReqstDe(), "-")); + ctsnnManageVO1.setOccrrDe(EgovDateUtil.formatDate(ctsnnManageVO1.getOccrrDe(), "-")); + result.set(i, ctsnnManageVO1); + } + return result; + } + + /** + * 경조관리목록 총 갯수를 조회한다. + * @param ctsnnManageVO - 경조관리 VO + * @return int - 경조관리 카운트 수 + */ + public int selectCtsnnManageListTotCnt(CtsnnManageVO ctsnnManageVO) throws Exception { + return ctsnnManageDAO.selectCtsnnManageListTotCnt(ctsnnManageVO); + } + + /** + * 등록된 경조관리의 상세정보를 조회한다. + * @param ctsnnManageVO - 경조관리 VO + * @return CtsnnManageVO - 경조관리 VO + */ + public CtsnnManageVO selectCtsnnManage(CtsnnManageVO ctsnnManageVO) throws Exception { + + CtsnnManageVO ctsnnManageVOTemp = ctsnnManageDAO.selectCtsnnManage(ctsnnManageVO); + ctsnnManageVOTemp.setReqstDe(EgovDateUtil.formatDate(ctsnnManageVOTemp.getReqstDe(), "-")); + ctsnnManageVOTemp.setOccrrDe(EgovDateUtil.formatDate(ctsnnManageVOTemp.getOccrrDe(), "-")); + ctsnnManageVOTemp.setBrth(EgovDateUtil.formatDate(ctsnnManageVOTemp.getBrth(), "-")); + return ctsnnManageVOTemp; + } + + /** + * 경조관리정보를 신규로 등록한다. + * @param ctsnnManage - 경조관리 model + */ + public void insertCtsnnManage(CtsnnManage ctsnnManage) throws Exception { + + java.util.Calendar cal = java.util.Calendar.getInstance(); + String sYear =Integer.toString(cal.get(java.util.Calendar.YEAR)); + String sMonth =Integer.toString(cal.get(java.util.Calendar.MONTH)+1); + if(sMonth.length() == 1) sMonth = "0"+sMonth; + String sDay =Integer.toString(cal.get(java.util.Calendar.DATE)); + if(sDay.length() == 1) sDay = "0"+sDay; + ctsnnManage.setReqstDe(sYear+sMonth+sDay); + + /* + * 경조 승인처리 신청 + */ + //InfrmlSanctn infrmlSanctn = infrmlSanctnService.insertInfrmlSanctn("001", ctsnnManage); + + ctsnnManage.setReqstDe(EgovStringUtil.removeMinusChar(ctsnnManage.getReqstDe())); + ctsnnManage.setBrth(EgovStringUtil.removeMinusChar(ctsnnManage.getBrth())); + ctsnnManage.setOccrrDe(EgovStringUtil.removeMinusChar(ctsnnManage.getOccrrDe())); + InfrmlSanctn infrmlSanctn = infrmlSanctnService.insertInfrmlSanctn(converToInfrmlSanctnObject(ctsnnManage)); //신청 + ctsnnManage.setInfrmlSanctnId(infrmlSanctn.getInfrmlSanctnId()); + ctsnnManage.setConfmAt(infrmlSanctn.getConfmAt()); + + String sCtsnnId = idgenCtsnnManageService.getNextStringId(); + ctsnnManage.setCtsnnId(sCtsnnId); + + ctsnnManageDAO.insertCtsnnManage(ctsnnManage); + } + + /** + * 기 등록된 경조관리정보를 수정한다. + * @param ctsnnManage - 경조관리 model + */ + public void updtCtsnnManage(CtsnnManage ctsnnManage) throws Exception { + ctsnnManage.setReqstDe(EgovStringUtil.removeMinusChar(ctsnnManage.getReqstDe())); + ctsnnManage.setBrth(EgovStringUtil.removeMinusChar(ctsnnManage.getBrth())); + ctsnnManage.setOccrrDe(EgovStringUtil.removeMinusChar(ctsnnManage.getOccrrDe())); + ctsnnManage.setBrth(EgovStringUtil.removeMinusChar(ctsnnManage.getBrth())); + ctsnnManage.setOccrrDe(EgovStringUtil.removeMinusChar(ctsnnManage.getOccrrDe())); + ctsnnManageDAO.updtCtsnnManage(ctsnnManage); + } + + /** + * 기 등록된 경조관리정보를 삭제한다. + * @param ctsnnManage - 경조관리 model + */ + public void deleteCtsnnManage(CtsnnManage ctsnnManage) throws Exception { + ctsnnManage.setReqstDe(EgovStringUtil.removeMinusChar(ctsnnManage.getReqstDe())); + ctsnnManage.setBrth(EgovStringUtil.removeMinusChar(ctsnnManage.getBrth())); + ctsnnManage.setOccrrDe(EgovStringUtil.removeMinusChar(ctsnnManage.getOccrrDe())); + /* + * 포상 승인처리 삭제 infrmlSanctnService.deleteInfrmlSanctn("000", vcatnManage); + */ + infrmlSanctnService.deleteInfrmlSanctn(converToInfrmlSanctnObject(ctsnnManage)); //삭제 + //infrmlSanctnService.deleteInfrmlSanctn("001", ctsnnManage); + ctsnnManageDAO.deleteCtsnnManage(ctsnnManage); + } + + /** + * 경조관리정보 승인 처리를 위해 신청된 경조관리 목록을 조회한다. + * @param ctsnnManageVO - 경조관리 VO + * @return List - 경조관리 목록 + */ + public List selectCtsnnManageConfmList(CtsnnManageVO ctsnnManageVO) throws Exception{ + ctsnnManageVO.setSearchFromDate(EgovStringUtil.removeMinusChar(ctsnnManageVO.getSearchFromDate())); + ctsnnManageVO.setSearchToDate(EgovStringUtil.removeMinusChar(ctsnnManageVO.getSearchToDate())); + List result = ctsnnManageDAO.selectCtsnnManageConfmList(ctsnnManageVO); + int num = result.size(); + + for (int i = 0 ; i < num ; i ++ ){ + CtsnnManageVO ctsnnManageVO1 = result.get(i); + ctsnnManageVO1.setReqstDe(EgovDateUtil.formatDate(ctsnnManageVO1.getReqstDe(), "-")); + ctsnnManageVO1.setOccrrDe(EgovDateUtil.formatDate(ctsnnManageVO1.getOccrrDe(), "-")); + result.set(i, ctsnnManageVO1); + } + return result; + } + + /** + * 경조승인목록 총 갯수를 조회한다. + * @param ctsnnManageVO - 경조관리 VO + * @return int - 경조관리 카운트 수 + */ + public int selectCtsnnManageConfmListTotCnt(CtsnnManageVO ctsnnManageVO) throws Exception { + return ctsnnManageDAO.selectCtsnnManageConfmListTotCnt(ctsnnManageVO); + } + + /** + * 경조정보를 승인처리 한다. + * @param ctsnnManage - 경조관리 model + */ + public void updtCtsnnManageConfm(CtsnnManage ctsnnManage) throws Exception { + InfrmlSanctn infrmlSanctn = new InfrmlSanctn(); + ctsnnManage.setReqstDe(EgovStringUtil.removeMinusChar(ctsnnManage.getReqstDe())); + ctsnnManage.setBrth(EgovStringUtil.removeMinusChar(ctsnnManage.getBrth())); + ctsnnManage.setOccrrDe(EgovStringUtil.removeMinusChar(ctsnnManage.getOccrrDe())); + //KISA 보안약점 조치 (2018-10-29, 윤창원) + if("C".equals(ctsnnManage.getConfmAt())){ + /* + * 승인처리 + */ + infrmlSanctn = infrmlSanctnService.updateInfrmlSanctnConfm(converToInfrmlSanctnObject(ctsnnManage)); //승인 + //infrmlSanctn = infrmlSanctnService.updateInfrmlSanctnConfm("001", ctsnnManage); + }else if("R".equals(ctsnnManage.getConfmAt())){ + /* + * 반려처리 + */ + //infrmlSanctn = infrmlSanctnService.updateInfrmlSanctnReturn("001", ctsnnManage); + infrmlSanctn = infrmlSanctnService.updateInfrmlSanctnReturn(converToInfrmlSanctnObject(ctsnnManage)); + } + ctsnnManage.setSanctnDt(infrmlSanctn.getSanctnDt()); + ctsnnManage.setConfmAt(infrmlSanctn.getConfmAt()); + + ctsnnManageDAO.updtCtsnnManageConfm(ctsnnManage); + } + + /** + * CtsnnManage model을 InfrmlSanctn model로 변환한다. + * @param CtsnnManage + * @return InfrmlSanctn + * @param ctsnnManage + */ + private InfrmlSanctn converToInfrmlSanctnObject(CtsnnManage ctsnnManage) throws Exception{ + InfrmlSanctn infrmlSanctn = new InfrmlSanctn(); + infrmlSanctn.setJobSeCode("001"); // 업무구분코드 (공통코드 COM75) + infrmlSanctn.setApplcntId(ctsnnManage.getUsid()); // 사용자ID + infrmlSanctn.setReqstDe(ctsnnManage.getReqstDe()); // 신청일자 + infrmlSanctn.setSanctnerId(ctsnnManage.getSanctnerId()); // 결재자ID + infrmlSanctn.setConfmAt(ctsnnManage.getConfmAt()); // 승인구분 + infrmlSanctn.setSanctnDt(ctsnnManage.getSanctnDt()); // 결재일시 + infrmlSanctn.setReturnResn(ctsnnManage.getReturnResn()); // 반려사유 + infrmlSanctn.setFrstRegisterId(ctsnnManage.getFrstRegisterId()); + ctsnnManage.setFrstRegisterPnttm(ctsnnManage.getFrstRegisterId()); + infrmlSanctn.setLastUpdusrId(ctsnnManage.getLastUpdusrId()); + infrmlSanctn.setLastUpdusrPnttm(ctsnnManage.getLastUpdusrPnttm()); + infrmlSanctn.setInfrmlSanctnId(ctsnnManage.getInfrmlSanctnId());// 약식결재ID + return infrmlSanctn; + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/ctn/web/EgovCtsnnManageController.java b/src/main/java/egovframework/com/uss/ion/ctn/web/EgovCtsnnManageController.java new file mode 100644 index 0000000..24bedb5 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ctn/web/EgovCtsnnManageController.java @@ -0,0 +1,385 @@ +package egovframework.com.uss.ion.ctn.web; + +import java.util.List; +import java.util.Map; + +import egovframework.com.cmm.ComDefaultCodeVO; +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.service.EgovCmmUseService; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.ion.ctn.service.CtsnnManage; +import egovframework.com.uss.ion.ctn.service.CtsnnManageVO; +import egovframework.com.uss.ion.ctn.service.EgovCtsnnManageService; +import egovframework.com.utl.fcc.service.EgovStringUtil; + +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +import javax.annotation.Resource; + +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.springframework.web.bind.support.SessionStatus; +import org.springmodules.validation.commons.DefaultBeanValidator; + +/** + * 개요 + * - 경조관리에 대한 controller 클래스를 정의한다. + * + * 상세내용 + * - 경조관리에 대한 등록, 수정, 삭제, 조회 기능을 제공한다. + * - 경조관리의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + * *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2010.6.15	이용          최초 생성
    + *  2011.8.26	정진오			IncludedInfo annotation 추가
    + *
    + *  
    + */ + +@Controller +public class EgovCtsnnManageController { + + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name = "egovCtsnnManageService") + private EgovCtsnnManageService egovCtsnnManageService; + + @Resource(name="EgovCmmUseService") + private EgovCmmUseService cmmUseService; + + @Autowired + private DefaultBeanValidator beanValidator; + + /** + * 경조관리 목록화면 이동 + * @return String + * @exception Exception + */ + @RequestMapping("/uss/ion/ctn/EgovCtsnnManageListView.do") + public String selectCtsnnManageListView(@ModelAttribute("ctsnnManageVO") CtsnnManageVO ctsnnManageVO, + ModelMap model) throws Exception { + List ctsnnCdCodeList = null; + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM054"); + ctsnnCdCodeList = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("ctsnnCodeList", ctsnnCdCodeList); + return "egovframework/com/uss/ion/ctn/EgovCtsnnManageList"; + } + + /** + * 경조관리정보를 관리하기 위해 등록된 경조관리 목록을 조회한다. + * @param ctsnnManageVO - 경조관리 VO + * @return String - 리턴 Url + */ + @IncludedInfo(name="직원경조사관리",order = 890 ,gid = 50) + @RequestMapping(value="/uss/ion/ctn/selectCtsnnManageList.do") + public String selectCtsnnManageList(@ModelAttribute("ctsnnManageVO") CtsnnManageVO ctsnnManageVO, + ModelMap model) throws Exception { + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(ctsnnManageVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(ctsnnManageVO.getPageUnit()); + paginationInfo.setPageSize(ctsnnManageVO.getPageSize()); + + ctsnnManageVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + ctsnnManageVO.setLastIndex(paginationInfo.getLastRecordIndex()); + ctsnnManageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + ctsnnManageVO.setCtsnnManageList(egovCtsnnManageService.selectCtsnnManageList(ctsnnManageVO)); + + int totCnt = egovCtsnnManageService.selectCtsnnManageListTotCnt(ctsnnManageVO); + paginationInfo.setTotalRecordCount(totCnt); + + List ctsnnCdCodeList = null; + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM054"); + ctsnnCdCodeList = cmmUseService.selectCmmCodeDetail(vo); + + model.addAttribute("paginationInfo" , paginationInfo ); + model.addAttribute("ctsnnManageList", ctsnnManageVO.getCtsnnManageList()); + model.addAttribute("ctsnnCodeList" , ctsnnCdCodeList); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/uss/ion/ctn/EgovCtsnnManageList"; + } + + /** + * 등록된 경조관리의 상세정보를 조회한다. + * @param ctsnnManageVO - 경조관리 VO + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/ctn/EgovCtsnnManageDetail.do") + public String selectCtsnnManage(@ModelAttribute("ctsnnManage") CtsnnManage ctsnnManage, + @ModelAttribute("ctsnnManageVO") CtsnnManageVO ctsnnManageVO, + @RequestParam Map commandMap, + ModelMap model) throws Exception { + + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); // 상세정보 구분 + ctsnnManageVO.setReqstDe(EgovStringUtil.removeMinusChar(ctsnnManageVO.getReqstDe())); + + // 등록 상세정보 + CtsnnManageVO ctsnnManageVOTemp = egovCtsnnManageService.selectCtsnnManage(ctsnnManageVO); + + model.addAttribute("ctsnnManageVO", ctsnnManageVOTemp); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + if(sCmd.equals("updt")){ + + List ctsnnCdCodeList = null; + List relateCodeList = null; + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM054"); + ctsnnCdCodeList = cmmUseService.selectCmmCodeDetail(vo); + vo.setCodeId("COM073"); + relateCodeList = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("ctsnnCodeList", ctsnnCdCodeList); + model.addAttribute("relateCodeList", relateCodeList); + + CtsnnManage ctsnnManageTemp = new CtsnnManage(); + + ctsnnManageTemp.setCtsnnId(ctsnnManageVOTemp.getCtsnnId()); + ctsnnManageTemp.setCtsnnNm(ctsnnManageVOTemp.getCtsnnNm()); + ctsnnManageTemp.setRemark(ctsnnManageVOTemp.getRemark()); + ctsnnManageTemp.setUsid(ctsnnManageVOTemp.getUsid()); + ctsnnManageTemp.setCtsnnCd(ctsnnManageVOTemp.getCtsnnCd()); + ctsnnManageTemp.setReqstDe(ctsnnManageVOTemp.getReqstDe()); + ctsnnManageTemp.setInfrmlSanctnId(ctsnnManageVOTemp.getInfrmlSanctnId()); + ctsnnManageTemp.setTrgterNm(ctsnnManageVOTemp.getTrgterNm()); + ctsnnManageTemp.setBrth(ctsnnManageVOTemp.getBrth()); + ctsnnManageTemp.setOccrrDe(ctsnnManageVOTemp.getOccrrDe()); + ctsnnManageTemp.setRelate(ctsnnManageVOTemp.getRelate()); + ctsnnManageTemp.setSanctnerId(ctsnnManageVOTemp.getSanctnerId()); + + model.addAttribute("ctsnnManage", ctsnnManageTemp); + return "egovframework/com/uss/ion/ctn/EgovCtsnnUpdt"; + }else{ + return "egovframework/com/uss/ion/ctn/EgovCtsnnDetail"; + } + + } + + /** + * 경조관리 등록 화면으로 이동한다. + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/ctn/EgovCtsnnRegist.do") + public String insertViewCtsnnManage(@ModelAttribute("ctsnnManage") CtsnnManage ctsnnManage, + @ModelAttribute("ctsnnManageVO") CtsnnManageVO ctsnnManageVO, + ModelMap model) throws Exception { + + List ctsnnCdCodeList = null; + List relateCodeList = null; + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM054"); + ctsnnCdCodeList = cmmUseService.selectCmmCodeDetail(vo); + vo.setCodeId("COM073"); + relateCodeList = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("ctsnnCodeList", ctsnnCdCodeList); + model.addAttribute("relateCodeList", relateCodeList); + return "egovframework/com/uss/ion/ctn/EgovCtsnnRegist"; + } + + /** + * 경조관리정보를 신규로 등록한다. + * @param ctsnnManage - 경조관리 model + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/ctn/insertCtsnnManage.do") + public String insertCtsnnManage( @ModelAttribute("ctsnnManageVO") CtsnnManageVO ctsnnManageVO, + @ModelAttribute("ctsnnManage") CtsnnManage ctsnnManage, + BindingResult bindingResult, + SessionStatus status, + ModelMap model) throws Exception { + + beanValidator.validate(ctsnnManage, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + model.addAttribute("ctsnnManageVO", ctsnnManageVO); + return "egovframework/com/uss/ion/ctn/EgovCtsnnRegist"; + } else { + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + ctsnnManage.setFrstRegisterId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + egovCtsnnManageService.insertCtsnnManage(ctsnnManage); + status.setComplete(); + model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); + return "forward:/uss/ion/ctn/selectCtsnnManageList.do"; + } + } + + /** + * 기 등록된 경조관리정보를 수정한다. + * @param ctsnnManage - 경조관리 model + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/ctn/updtCtsnnManage.do") + public String updtCtsnnManage( @ModelAttribute("ctsnnManage") CtsnnManage ctsnnManage, + @ModelAttribute("ctsnnManageVO") CtsnnManageVO ctsnnManageVO, + BindingResult bindingResult, + SessionStatus status, + ModelMap model) throws Exception { + + beanValidator.validate(ctsnnManageVO, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + model.addAttribute("ctsnnManageVO", ctsnnManageVO); + return "egovframework/com/uss/ion/ctn/EgovCtsnnUpdt"; + } else { + + //LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + egovCtsnnManageService.updtCtsnnManage(ctsnnManage); + return "forward:/uss/ion/ctn/selectCtsnnManageList.do"; + + } + } + + /** + * 기 등록된 경조관리정보를 삭제한다. + * @param ctsnnManage - 경조관리 model + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/ctn/deleteCtsnnManage.do") + public String deleteCtsnnManage(@ModelAttribute("ctsnnManage") CtsnnManage ctsnnManage, + SessionStatus status, + ModelMap model) throws Exception { + + egovCtsnnManageService.deleteCtsnnManage(ctsnnManage); + status.setComplete(); + model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); + return "forward:/uss/ion/ctn/selectCtsnnManageList.do"; + } + + + /*** 승인관련 ***/ + /** + * 경조관리정보 승인 처리를 위해 신청된 경조관리 목록을 조회한다. + * @param ctsnnManageVO - 경조관리 VO + * @return String - 리턴 Url + */ + @IncludedInfo(name="직원경조사승인관리",order = 891 ,gid = 50) + @RequestMapping(value="/uss/ion/ctn/EgovCtsnnConfmList.do") + public String selectCtsnnManageConfmList(@ModelAttribute("ctsnnManageVO") CtsnnManageVO ctsnnManageVO, + ModelMap model) throws Exception { + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(ctsnnManageVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(ctsnnManageVO.getPageUnit()); + paginationInfo.setPageSize(ctsnnManageVO.getPageSize()); + + ctsnnManageVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + ctsnnManageVO.setLastIndex(paginationInfo.getLastRecordIndex()); + ctsnnManageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + ctsnnManageVO.setSanctnerId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); //사용자가 승인권자인지 조건값 setting selectCtsnnManageList + ctsnnManageVO.setCtsnnManageList(egovCtsnnManageService.selectCtsnnManageConfmList(ctsnnManageVO)); + model.addAttribute("ctsnnManageList", ctsnnManageVO.getCtsnnManageList()); + + int totCnt = egovCtsnnManageService.selectCtsnnManageConfmListTotCnt(ctsnnManageVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + List ctsnnCdCodeList = null; + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM054"); + ctsnnCdCodeList = cmmUseService.selectCmmCodeDetail(vo); + + model.addAttribute("ctsnnCodeList" , ctsnnCdCodeList); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/uss/ion/ctn/EgovCtsnnConfmList"; + } + + /** + * 경조승인관리 상세정보를 조회한다. + * @param ctsnnManageVO - 경조관리 VO + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/ctn/EgovCtsnnConfm.do") + public String selectCtsnnConfm( @ModelAttribute("ctsnnManageVO") CtsnnManageVO ctsnnManageVO, + @ModelAttribute("ctsnnManage") CtsnnManage ctsnnManage, + ModelMap model) throws Exception { + ctsnnManageVO.setReqstDe(EgovStringUtil.removeMinusChar(ctsnnManageVO.getReqstDe())); + + // 등록 상세정보 + CtsnnManageVO ctsnnManageVOTemp = egovCtsnnManageService.selectCtsnnManage(ctsnnManageVO); + + CtsnnManage ctsnnManageTemp = new CtsnnManage(); + ctsnnManageTemp.setCtsnnId(ctsnnManageVOTemp.getCtsnnId()); + ctsnnManageTemp.setCtsnnNm(ctsnnManageVOTemp.getCtsnnNm()); + ctsnnManageTemp.setRemark(ctsnnManageVOTemp.getRemark()); + ctsnnManageTemp.setUsid(ctsnnManageVOTemp.getUsid()); + ctsnnManageTemp.setCtsnnCd(ctsnnManageVOTemp.getCtsnnCd()); + ctsnnManageTemp.setReqstDe(ctsnnManageVOTemp.getReqstDe()); + ctsnnManageTemp.setInfrmlSanctnId(ctsnnManageVOTemp.getInfrmlSanctnId()); + ctsnnManageTemp.setTrgterNm(ctsnnManageVOTemp.getTrgterNm()); + ctsnnManageTemp.setBrth(ctsnnManageVOTemp.getBrth()); + ctsnnManageTemp.setOccrrDe(ctsnnManageVOTemp.getOccrrDe()); + ctsnnManageTemp.setRelate(ctsnnManageVOTemp.getRelate()); + ctsnnManageTemp.setSanctnerId(ctsnnManageVOTemp.getSanctnerId()); + + model.addAttribute("ctsnnManage", ctsnnManageTemp); + model.addAttribute("ctsnnManageVO", ctsnnManageVOTemp); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/uss/ion/ctn/EgovCtsnnConfm"; + } + + /** + * 기 등록된 경조관리정보를 승인 처리한다. + * @param ctsnnManage - 경조관리 model + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/ctn/updtCtsnnConfm.do") + public String updateCtsnnManageConfm( @ModelAttribute("ctsnnManage") CtsnnManage ctsnnManage, + BindingResult bindingResult, + SessionStatus status, + ModelMap model) throws Exception { + + + beanValidator.validate(ctsnnManage, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + model.addAttribute("ctsnnManageVO", ctsnnManage); + return "egovframework/com/uss/ion/ctn/EgovCtsnnConfm"; + } else { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + ctsnnManage.setSanctnerId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + ctsnnManage.setLastUpdusrId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + ctsnnManage.setReqstDe(EgovStringUtil.removeMinusChar(ctsnnManage.getReqstDe())); + + egovCtsnnManageService.updtCtsnnManageConfm(ctsnnManage); + return "forward:/uss/ion/ctn/EgovCtsnnConfmList.do"; + } + } + + /** + * 경조관리정보 반려처리 화면을 호출한다. + * @param ctsnnManage + * @return String + */ + @RequestMapping("/uss/ion/ctn/EgovCtsnnReturn.do") + public String selectSanctnerListPopup(@ModelAttribute("ctsnnManage") CtsnnManage ctsnnManage, + @RequestParam Map commandMap, + ModelMap model) throws Exception{ + return "egovframework/com/uss/ion/ctn/EgovCtsnnReturn"; + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/ecc/service/EgovEventCmpgnService.java b/src/main/java/egovframework/com/uss/ion/ecc/service/EgovEventCmpgnService.java new file mode 100644 index 0000000..b45ba75 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ecc/service/EgovEventCmpgnService.java @@ -0,0 +1,33 @@ +package egovframework.com.uss.ion.ecc.service; + +import java.util.List; + +import org.egovframe.rte.fdl.cmmn.exception.FdlException; + +public interface EgovEventCmpgnService { + + List selectEventCmpgnList(EventCmpgnVO searchVO); + + int selectEventCmpgnListCnt(EventCmpgnVO searchVO); + + void insertEventCmpgn(EventCmpgnVO eventCmpgnVO) throws FdlException; + + EventCmpgnVO selectEventCmpgnDetail(EventCmpgnVO eventCmpgnVO) throws Exception; + + void updateEventCmpgn(EventCmpgnVO eventCmpgnVO); + + void deleteEventCmpgn(EventCmpgnVO eventCmpgnVO); + + List selectTnextrlHrList(TnextrlHrVO searchVO); + + int selectTnextrlHrListCnt(TnextrlHrVO searchVO); + + void insertTnextrlHr(TnextrlHrVO tnextrlHrVO) throws FdlException; + + TnextrlHrVO selectTnextrlHrDetail(TnextrlHrVO tnextrlHrVO) throws Exception; + + void updateTnextrlHr(TnextrlHrVO tnextrlHrVO); + + void deleteTnextrlHr(TnextrlHrVO tnextrlHrVO); + +} diff --git a/src/main/java/egovframework/com/uss/ion/ecc/service/EventCmpgnVO.java b/src/main/java/egovframework/com/uss/ion/ecc/service/EventCmpgnVO.java new file mode 100644 index 0000000..a396403 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ecc/service/EventCmpgnVO.java @@ -0,0 +1,392 @@ +package egovframework.com.uss.ion.ecc.service; + +import java.io.Serializable; + +import egovframework.com.cmm.ComDefaultVO; +/** + * 행사/이벤트/캠페인 VO Class 구현 + * @author 공통서비스 장동한 + * @since 2009.03.20 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  장동한          최초 생성
    + *
    + * 
    + */ +public class EventCmpgnVO extends ComDefaultVO implements Serializable { + + private static final long serialVersionUID = -5817021412630105195L; + + /** + * 행사/이벤트/캠페인ID + */ + private String eventId = ""; + + /** + * 사업년도 + */ + private String bsnsYear = ""; + + /** + * 사업코드 + */ + private String bsnsCode = ""; + + /** + * 행사시작일자 + */ + private String eventSvcBeginDe = ""; + + /** + * 서비스이용 인원수 + */ + private int svcUseNmprCo = 0; + + /** + * 담당자명 + */ + private String chargerNm = ""; + + /** + * 행사내용 + */ + private String eventCn = ""; + + /** + * 행사종료일자 + */ + private String eventSvcEndDe = ""; + + /** + * 행사유형코드 + */ + private String eventTyCode = ""; + + /** + * 행사유형코드명 + */ + private String eventTyCodeNm = ""; + + /** + * 준비물내용 + */ + private String prparetgCn = ""; + + /** + * 최초등록시점 + */ + private String frstRegisterPnttm = ""; + /** + * 최초등록ID + */ + private String frstRegisterId = ""; + /** + * 최초등록자 + */ + private String frstRegisterNm = ""; + /** + * 최종수정시점 + */ + private String lastUpdusrPnttm = ""; + /** + * 최종수정ID + */ + private String lastUpdusrId = ""; + /** + * 화면처리 명령어 + */ + private String cmd = ""; + + + /** + * 행사/이벤트 승인여부 + */ + private String eventConfmAt = ""; + + /** + * 행사/이벤트 승인일 + */ + private String eventConfmDe = ""; + + + /** + * eventConfmDe attribute 를 리턴한다. + * @return the String + */ + public String getEventConfmDe() { + return eventConfmDe; + } + /** + * eventConfmDe attribute 값을 설정한다. + * @return eventId String + */ + public void setEventConfmDe(String eventConfmDe) { + this.eventConfmDe = eventConfmDe; + } + + /** + * eventConfmAt attribute 를 리턴한다. + * @return the String + */ + public String getEventConfmAt() { + return eventConfmAt; + } + /** + * eventConfmAt attribute 값을 설정한다. + * @return eventId String + */ + public void setEventConfmAt(String eventConfmAt) { + this.eventConfmAt = eventConfmAt; + } + + + /** + * eventId attribute 를 리턴한다. + * @return the String + */ + public String getEventId() { + return eventId; + } + /** + * eventId attribute 값을 설정한다. + * @return eventId String + */ + public void setEventId(String eventId) { + this.eventId = eventId; + } + /** + * bsnsYear attribute 를 리턴한다. + * @return the String + */ + public String getBsnsYear() { + return bsnsYear; + } + /** + * bsnsYear attribute 값을 설정한다. + * @return bsnsYear String + */ + public void setBsnsYear(String bsnsYear) { + this.bsnsYear = bsnsYear; + } + /** + * bsnsCode attribute 를 리턴한다. + * @return the String + */ + public String getBsnsCode() { + return bsnsCode; + } + /** + * bsnsCode attribute 값을 설정한다. + * @return bsnsCode String + */ + public void setBsnsCode(String bsnsCode) { + this.bsnsCode = bsnsCode; + } + /** + * eventSvcBeginDe attribute 를 리턴한다. + * @return the String + */ + public String getEventSvcBeginDe() { + return eventSvcBeginDe; + } + /** + * eventSvcBeginDe attribute 값을 설정한다. + * @return eventSvcBeginDe String + */ + public void setEventSvcBeginDe(String eventSvcBeginDe) { + this.eventSvcBeginDe = eventSvcBeginDe; + } + /** + * svcUseNmprCo attribute 를 리턴한다. + * @return the int + */ + public int getSvcUseNmprCo() { + return svcUseNmprCo; + } + /** + * svcUseNmprCo attribute 값을 설정한다. + * @return svcUseNmprCo int + */ + public void setSvcUseNmprCo(int svcUseNmprCo) { + this.svcUseNmprCo = svcUseNmprCo; + } + /** + * chargerNm attribute 를 리턴한다. + * @return the String + */ + public String getChargerNm() { + return chargerNm; + } + /** + * chargerNm attribute 값을 설정한다. + * @return chargerNm String + */ + public void setChargerNm(String chargerNm) { + this.chargerNm = chargerNm; + } + /** + * eventCn attribute 를 리턴한다. + * @return the String + */ + public String getEventCn() { + return eventCn; + } + /** + * eventCn attribute 값을 설정한다. + * @return eventCn String + */ + public void setEventCn(String eventCn) { + this.eventCn = eventCn; + } + /** + * eventSvcEndDe attribute 를 리턴한다. + * @return the String + */ + public String getEventSvcEndDe() { + return eventSvcEndDe; + } + /** + * eventSvcEndDe attribute 값을 설정한다. + * @return eventSvcEndDe String + */ + public void setEventSvcEndDe(String eventSvcEndDe) { + this.eventSvcEndDe = eventSvcEndDe; + } + /** + * eventTyCode attribute 를 리턴한다. + * @return the String + */ + public String getEventTyCode() { + return eventTyCode; + } + /** + * eventTyCode attribute 값을 설정한다. + * @return eventTyCode String + */ + public void setEventTyCode(String eventTyCode) { + this.eventTyCode = eventTyCode; + } + /** + * eventTyCodeNm attribute 를 리턴한다. + * @return the String + */ + public String getEventTyCodeNm() { + return eventTyCodeNm; + } + /** + * eventTyCodeNm attribute 값을 설정한다. + * @return eventTyCodeNm String + */ + public void setEventTyCodeNm(String eventTyCodeNm) { + this.eventTyCodeNm = eventTyCodeNm; + } + /** + * prparetgCn attribute 를 리턴한다. + * @return the String + */ + public String getPrparetgCn() { + return prparetgCn; + } + /** + * prparetgCn attribute 값을 설정한다. + * @return prparetgCn String + */ + public void setPrparetgCn(String prparetgCn) { + this.prparetgCn = prparetgCn; + } + /** + * frstRegisterPnttm attribute 를 리턴한다. + * @return the String + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + /** + * frstRegisterPnttm attribute 값을 설정한다. + * @return frstRegisterPnttm String + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + /** + * frstRegisterId attribute 를 리턴한다. + * @return the String + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + /** + * frstRegisterId attribute 값을 설정한다. + * @return frstRegisterId String + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + /** + * frstRegisterNm attribute 를 리턴한다. + * @return the String + */ + public String getFrstRegisterNm() { + return frstRegisterNm; + } + /** + * frstRegisterNm attribute 값을 설정한다. + * @return frstRegisterNm String + */ + public void setFrstRegisterNm(String frstRegisterNm) { + this.frstRegisterNm = frstRegisterNm; + } + /** + * lastUpdusrPnttm attribute 를 리턴한다. + * @return the String + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + /** + * lastUpdusrPnttm attribute 값을 설정한다. + * @return lastUpdusrPnttm String + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + /** + * lastUpdusrId attribute 를 리턴한다. + * @return the String + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + /** + * lastUpdusrId attribute 값을 설정한다. + * @return lastUpdusrId String + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + /** + * cmd attribute 를 리턴한다. + * @return the String + */ + public String getCmd() { + return cmd; + } + /** + * cmd attribute 값을 설정한다. + * @return cmd String + */ + public void setCmd(String cmd) { + this.cmd = cmd; + } + + + + + +} diff --git a/src/main/java/egovframework/com/uss/ion/ecc/service/TnextrlHrVO.java b/src/main/java/egovframework/com/uss/ion/ecc/service/TnextrlHrVO.java new file mode 100644 index 0000000..e0d630b --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ecc/service/TnextrlHrVO.java @@ -0,0 +1,492 @@ +package egovframework.com.uss.ion.ecc.service; + +import java.io.Serializable; + +import egovframework.com.cmm.ComDefaultVO; +/** + * 외부인사관리 VO Class 구현 + * @author 공통서비스 장동한 + * @since 2009.03.20 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  장동한          최초 생성
    + *
    + * 
    + */ +public class TnextrlHrVO extends ComDefaultVO implements Serializable { + + private static final long serialVersionUID = 1739374172177710041L; + + /** + * 성별코드 + */ + private String sexdstnCode = ""; + + /** + * 성별코드명 + */ + private String sexdstnCodeNm = ""; + + /** + * 외부인사명 + */ + private String extrlHrNm = ""; + + /** + * 이메일주소 + */ + private String emailAdres = ""; + + /** + * 직업유형코드 + */ + private String occpTyCode = ""; + + /** + * 직업유형코드명 + */ + private String occpTyCodeNm = ""; + + /** + * 소속기관명 + */ + private String psitnInsttNm = ""; + + /** + * 외부인사ID + */ + private String extrlHrId = ""; + + /** + * 행사/이벤트/캠페인 아이디 + */ + private String eventId = ""; + + /** + * 행사/이벤트/캠페인내용 + */ + private String eventCn = ""; + + /** + * 생년월일 + */ + private String brth = ""; + + /** + * 지역번호 + */ + private String areaNo = ""; + + /** + * 중간전화번호 + */ + private String middleTelno = ""; + + /** + * 끝전화번호 + */ + private String endTelno = ""; + + /** + * 생년월일(년) + */ + private String brthYYYY = ""; + + /** + * 생년월일(월) + */ + private String brthMM = ""; + + /** + * 생년월일(일) + */ + private String brthDD = ""; + + /** + * 최초등록시점 + */ + private String frstRegisterPnttm = ""; + + /** + * 최초등록ID + */ + private String frstRegisterId = ""; + + /** + * 최초등록ID + */ + private String frstRegisterNm = ""; + + /** + * 최종수정시점 + */ + private String lastUpdusrPnttm = ""; + + /** + * 최종수정ID + */ + private String lastUpdusrId = ""; + + /** + * sexdstnCode attribute 를 리턴한다. + * @return the String + */ + public String getSexdstnCode() { + return sexdstnCode; + } + + /** + * sexdstnCode attribute 값을 설정한다. + * @return sexdstnCode String + */ + public void setSexdstnCode(String sexdstnCode) { + this.sexdstnCode = sexdstnCode; + } + + /** + * sexdstnCodeNm attribute 를 리턴한다. + * @return the String + */ + public String getSexdstnCodeNm() { + return sexdstnCodeNm; + } + + /** + * sexdstnCodeNm attribute 값을 설정한다. + * @return sexdstnCodeNm String + */ + public void setSexdstnCodeNm(String sexdstnCodeNm) { + this.sexdstnCodeNm = sexdstnCodeNm; + } + + /** + * extrlHrNm attribute 를 리턴한다. + * @return the String + */ + public String getExtrlHrNm() { + return extrlHrNm; + } + + /** + * extrlHrNm attribute 값을 설정한다. + * @return extrlHrNm String + */ + public void setExtrlHrNm(String extrlHrNm) { + this.extrlHrNm = extrlHrNm; + } + + /** + * emailAdres attribute 를 리턴한다. + * @return the String + */ + public String getEmailAdres() { + return emailAdres; + } + + /** + * emailAdres attribute 값을 설정한다. + * @return emailAdres String + */ + public void setEmailAdres(String emailAdres) { + this.emailAdres = emailAdres; + } + + /** + * occpTyCode attribute 를 리턴한다. + * @return the String + */ + public String getOccpTyCode() { + return occpTyCode; + } + + /** + * occpTyCode attribute 값을 설정한다. + * @return occpTyCode String + */ + public void setOccpTyCode(String occpTyCode) { + this.occpTyCode = occpTyCode; + } + + /** + * occpTyCodeNm attribute 를 리턴한다. + * @return the String + */ + public String getOccpTyCodeNm() { + return occpTyCodeNm; + } + + /** + * occpTyCodeNm attribute 값을 설정한다. + * @return occpTyCodeNm String + */ + public void setOccpTyCodeNm(String occpTyCodeNm) { + this.occpTyCodeNm = occpTyCodeNm; + } + + /** + * psitnInsttNm attribute 를 리턴한다. + * @return the String + */ + public String getPsitnInsttNm() { + return psitnInsttNm; + } + + /** + * psitnInsttNm attribute 값을 설정한다. + * @return psitnInsttNm String + */ + public void setPsitnInsttNm(String psitnInsttNm) { + this.psitnInsttNm = psitnInsttNm; + } + + /** + * extrlHrId attribute 를 리턴한다. + * @return the String + */ + public String getExtrlHrId() { + return extrlHrId; + } + + /** + * extrlHrId attribute 값을 설정한다. + * @return extrlHrId String + */ + public void setExtrlHrId(String extrlHrId) { + this.extrlHrId = extrlHrId; + } + + /** + * eventId attribute 를 리턴한다. + * @return the String + */ + public String getEventId() { + return eventId; + } + + /** + * eventId attribute 값을 설정한다. + * @return eventId String + */ + public void setEventId(String eventId) { + this.eventId = eventId; + } + + /** + * eventCn attribute 를 리턴한다. + * @return the String + */ + public String getEventCn() { + return eventCn; + } + + /** + * eventCn attribute 값을 설정한다. + * @return eventCn String + */ + public void setEventCn(String eventCn) { + this.eventCn = eventCn; + } + + /** + * brth attribute 를 리턴한다. + * @return the String + */ + public String getBrth() { + return brth; + } + + /** + * brth attribute 값을 설정한다. + * @return brth String + */ + public void setBrth(String brth) { + this.brth = brth; + } + + /** + * areaNo attribute 를 리턴한다. + * @return the String + */ + public String getAreaNo() { + return areaNo; + } + + /** + * areaNo attribute 값을 설정한다. + * @return areaNo String + */ + public void setAreaNo(String areaNo) { + this.areaNo = areaNo; + } + + /** + * middleTelno attribute 를 리턴한다. + * @return the String + */ + public String getMiddleTelno() { + return middleTelno; + } + + /** + * middleTelno attribute 값을 설정한다. + * @return middleTelno String + */ + public void setMiddleTelno(String middleTelno) { + this.middleTelno = middleTelno; + } + + /** + * endTelno attribute 를 리턴한다. + * @return the String + */ + public String getEndTelno() { + return endTelno; + } + + /** + * endTelno attribute 값을 설정한다. + * @return endTelno String + */ + public void setEndTelno(String endTelno) { + this.endTelno = endTelno; + } + + /** + * brthYYYY attribute 를 리턴한다. + * @return the String + */ + public String getBrthYYYY() { + return brthYYYY; + } + + /** + * brthYYYY attribute 값을 설정한다. + * @return brthYYYY String + */ + public void setBrthYYYY(String brthYYYY) { + this.brthYYYY = brthYYYY; + } + + /** + * brthMM attribute 를 리턴한다. + * @return the String + */ + public String getBrthMM() { + return brthMM; + } + + /** + * brthMM attribute 값을 설정한다. + * @return brthMM String + */ + public void setBrthMM(String brthMM) { + this.brthMM = brthMM; + } + + /** + * brthDD attribute 를 리턴한다. + * @return the String + */ + public String getBrthDD() { + return brthDD; + } + + /** + * brthDD attribute 값을 설정한다. + * @return brthDD String + */ + public void setBrthDD(String brthDD) { + this.brthDD = brthDD; + } + + /** + * frstRegisterPnttm attribute 를 리턴한다. + * @return the String + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * frstRegisterPnttm attribute 값을 설정한다. + * @return frstRegisterPnttm String + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * frstRegisterId attribute 를 리턴한다. + * @return the String + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * frstRegisterId attribute 값을 설정한다. + * @return frstRegisterId String + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * frstRegisterNm attribute 를 리턴한다. + * @return the String + */ + public String getFrstRegisterNm() { + return frstRegisterNm; + } + + /** + * frstRegisterNm attribute 값을 설정한다. + * @return frstRegisterNm String + */ + public void setFrstRegisterNm(String frstRegisterNm) { + this.frstRegisterNm = frstRegisterNm; + } + + /** + * lastUpdusrPnttm attribute 를 리턴한다. + * @return the String + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * lastUpdusrPnttm attribute 값을 설정한다. + * @return lastUpdusrPnttm String + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * lastUpdusrId attribute 를 리턴한다. + * @return the String + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * lastUpdusrId attribute 값을 설정한다. + * @return lastUpdusrId String + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + + + + +} diff --git a/src/main/java/egovframework/com/uss/ion/ecc/service/impl/EgovEventCmpgnDAO.java b/src/main/java/egovframework/com/uss/ion/ecc/service/impl/EgovEventCmpgnDAO.java new file mode 100644 index 0000000..7ca12b9 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ecc/service/impl/EgovEventCmpgnDAO.java @@ -0,0 +1,66 @@ +package egovframework.com.uss.ion.ecc.service.impl; + +import java.util.List; + +import org.springframework.stereotype.Repository; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.ion.ecc.service.EventCmpgnVO; +import egovframework.com.uss.ion.ecc.service.TnextrlHrVO; + +@Repository("EgovEventCmpgnDAO") +public class EgovEventCmpgnDAO extends EgovComAbstractDAO { + + public List selectEventCmpgnList(EventCmpgnVO searchVO) { + return list("EventCmpgn.selectEventCmpgnList", searchVO); + } + + public int selectEventCmpgnListCnt(EventCmpgnVO searchVO) { + return (Integer) selectOne("EventCmpgn.selectEventCmpgnListCnt", searchVO); + } + + public void insertEventCmpgn(EventCmpgnVO eventCmpgnVO) { + insert("EventCmpgn.insertEventCmpgn", eventCmpgnVO); + } + + public EventCmpgnVO selectEventCmpgnDetail(EventCmpgnVO eventCmpgnVO) { + return (EventCmpgnVO) selectOne("EventCmpgn.selectEventCmpgnDetail", eventCmpgnVO); + } + + public void updateEventCmpgn(EventCmpgnVO eventCmpgnVO) { + update("EventCmpgn.updateEventCmpgn", eventCmpgnVO); + } + + public void deleteEventCmpgn(EventCmpgnVO eventCmpgnVO) { + delete("EventCmpgn.deleteEventCmpgn", eventCmpgnVO); + } + + public List selectTnextrlHrList(TnextrlHrVO searchVO) { + return list("EventCmpgn.selectTnextrlHrList", searchVO); + } + + public int selectTnextrlHrListCnt(TnextrlHrVO searchVO) { + return (Integer) selectOne("EventCmpgn.selectTnextrlHrListCnt", searchVO); + } + + public void insertTnextrlHr(TnextrlHrVO tnextrlHrVO) { + insert("EventCmpgn.insertTnextrlHr", tnextrlHrVO); + } + + public TnextrlHrVO selectTnextrlHrDetail(TnextrlHrVO tnextrlHrVO) { + return (TnextrlHrVO) selectOne("EventCmpgn.selectTnextrlHrDetail", tnextrlHrVO); + } + + public void updateTnextrlHr(TnextrlHrVO tnextrlHrVO) { + update("EventCmpgn.updateTnextrlHr", tnextrlHrVO); + } + + public void deleteTnextrlHr(TnextrlHrVO tnextrlHrVO) { + delete("EventCmpgn.deleteTnextrlHr", tnextrlHrVO); + } + + public void deleteEventCmpgnTnextrlHr(EventCmpgnVO eventCmpgnVO) { + delete("EventCmpgn.deleteEventCmpgnTnextrlHr", eventCmpgnVO); + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/ecc/service/impl/EgovEventCmpgnServiceImpl.java b/src/main/java/egovframework/com/uss/ion/ecc/service/impl/EgovEventCmpgnServiceImpl.java new file mode 100644 index 0000000..db0876e --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ecc/service/impl/EgovEventCmpgnServiceImpl.java @@ -0,0 +1,105 @@ +package egovframework.com.uss.ion.ecc.service.impl; + +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import egovframework.com.uss.ion.ecc.service.EgovEventCmpgnService; +import egovframework.com.uss.ion.ecc.service.EventCmpgnVO; +import egovframework.com.uss.ion.ecc.service.TnextrlHrVO; +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.cmmn.exception.FdlException; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +@Service("EgovEventCmpgnService") +public class EgovEventCmpgnServiceImpl extends EgovAbstractServiceImpl implements EgovEventCmpgnService { + + @Resource(name="EgovEventCmpgnDAO") + private EgovEventCmpgnDAO egovEventCmpgnDao; + + @Resource(name="egovEventInfoIdGnrService") + private EgovIdGnrService idgenService1; + + @Resource(name="egovExtrlhrInfoIdGnrService") + private EgovIdGnrService idgenService2; + + @Override + public List selectEventCmpgnList(EventCmpgnVO searchVO) { + return egovEventCmpgnDao.selectEventCmpgnList(searchVO); + } + + @Override + public int selectEventCmpgnListCnt(EventCmpgnVO searchVO) { + return egovEventCmpgnDao.selectEventCmpgnListCnt(searchVO); + } + + @Override + public void insertEventCmpgn(EventCmpgnVO eventCmpgnVO) throws FdlException { + String eventId = idgenService1.getNextStringId(); + eventCmpgnVO.setEventId(eventId); + + egovEventCmpgnDao.insertEventCmpgn(eventCmpgnVO); + } + + @Override + public EventCmpgnVO selectEventCmpgnDetail(EventCmpgnVO eventCmpgnVO) throws Exception { + EventCmpgnVO resultVO = egovEventCmpgnDao.selectEventCmpgnDetail(eventCmpgnVO); + if (resultVO == null) + throw processException("info.nodata.msg"); + return resultVO; + } + + @Override + public void updateEventCmpgn(EventCmpgnVO eventCmpgnVO) { + egovEventCmpgnDao.updateEventCmpgn(eventCmpgnVO); + } + + @Override + public void deleteEventCmpgn(EventCmpgnVO eventCmpgnVO) { + //행사/이벤트/캠페인에 속한 외부인사정보를 삭제한다. + egovEventCmpgnDao.deleteEventCmpgnTnextrlHr(eventCmpgnVO); + + //행사/이벤트/캠페인을 삭제한다. + egovEventCmpgnDao.deleteEventCmpgn(eventCmpgnVO); + + } + + @Override + public List selectTnextrlHrList(TnextrlHrVO searchVO) { + return egovEventCmpgnDao.selectTnextrlHrList(searchVO); + } + + @Override + public int selectTnextrlHrListCnt(TnextrlHrVO searchVO) { + return egovEventCmpgnDao.selectTnextrlHrListCnt(searchVO); + } + + @Override + public void insertTnextrlHr(TnextrlHrVO tnextrlHrVO) throws FdlException { + String extrlHrId = idgenService2.getNextStringId(); + tnextrlHrVO.setExtrlHrId(extrlHrId); + + egovEventCmpgnDao.insertTnextrlHr(tnextrlHrVO); + } + + @Override + public TnextrlHrVO selectTnextrlHrDetail(TnextrlHrVO tnextrlHrVO) throws Exception { + TnextrlHrVO resultVO = egovEventCmpgnDao.selectTnextrlHrDetail(tnextrlHrVO); + if (resultVO == null) + throw processException("info.nodata.msg"); + return resultVO; + } + + @Override + public void updateTnextrlHr(TnextrlHrVO tnextrlHrVO) { + egovEventCmpgnDao.updateTnextrlHr(tnextrlHrVO); + } + + @Override + public void deleteTnextrlHr(TnextrlHrVO tnextrlHrVO) { + egovEventCmpgnDao.deleteTnextrlHr(tnextrlHrVO); + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/ecc/web/EgovEventCmpgnController.java b/src/main/java/egovframework/com/uss/ion/ecc/web/EgovEventCmpgnController.java new file mode 100644 index 0000000..9c23415 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ecc/web/EgovEventCmpgnController.java @@ -0,0 +1,481 @@ +package egovframework.com.uss.ion.ecc.web; + +import java.util.List; + +import javax.annotation.Resource; + +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 egovframework.com.cmm.ComDefaultCodeVO; +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.service.EgovCmmUseService; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.ion.ecc.service.EgovEventCmpgnService; +import egovframework.com.uss.ion.ecc.service.EventCmpgnVO; +import egovframework.com.uss.ion.ecc.service.TnextrlHrVO; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +/** + * 행사/이벤트/캠페인을 처리하는 Controller Class 구현 + * @author 공통서비스 장동한 + * @since 2009.03.20 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.03.20  장동한          최초 생성
    + *   2011.8.26	정진오			IncludedInfo annotation 추가
    + *
    + * 
    + */ + +@Controller +public class EgovEventCmpgnController { + + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name = "EgovEventCmpgnService") + private EgovEventCmpgnService egovEventCmpgnService; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + @Resource(name="EgovCmmUseService") + private EgovCmmUseService cmmUseService; + + @Autowired + private DefaultBeanValidator beanValidator; + + /** + * 행사/이벤트/캠페인 목록을 조회한다. + * @param searchVO + * @param eventCmpgnVO + * @param model + * @return "egovframework/com/uss/ion/ecc/EgovEventCmpgnList + * @throws Exception + */ + @IncludedInfo(name="행사/이벤트/캠페인", order = 710 ,gid = 50) + @RequestMapping(value="/uss/ion/ecc/selectEventCmpgnList.do") + public String selectEventCmpgnList(@ModelAttribute("searchVO") EventCmpgnVO searchVO, ModelMap model) throws Exception { + + /** 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()); + + List sampleList = egovEventCmpgnService.selectEventCmpgnList(searchVO); + model.addAttribute("resultList", sampleList); + + int totCnt = egovEventCmpgnService.selectEventCmpgnListCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/uss/ion/ecc/EgovEventCmpgnList"; + + } + + /** + * 행사/이벤트/캠페인 목록을 조회한다.(Popup) + * @param searchVO + * @param eventCmpgnVO + * @param model + * @return "egovframework/com/uss/ion/ecc/EgovEventCmpgnList + * @throws Exception + */ + @RequestMapping(value="/uss/ion/ecc/selectEventCmpgnListPopup.do") + public String selectEventCmpgnListPopup(@ModelAttribute("searchVO") EventCmpgnVO searchVO, ModelMap model) throws Exception { + + /** 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()); + + List sampleList = egovEventCmpgnService.selectEventCmpgnList(searchVO); + model.addAttribute("resultList", sampleList); + + int totCnt = egovEventCmpgnService.selectEventCmpgnListCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/uss/ion/ecc/EgovEventCmpgnListPopup"; + + } + + /** + * 행사/이벤트/캠페인 목록에 대한 상세정보를 조회한다. + * @param eventCmpgnVO + * @param searchVO + * @param model + * @return "/uss/ion/ecc/EgovEventCmpgnDetail" + * @throws Exception + */ + @RequestMapping("/uss/ion/ecc/selectEventCmpgnDetail.do") + public String selectEventCmpgnDetail(EventCmpgnVO eventCmpgnVO, + @ModelAttribute("searchVO") EventCmpgnVO searchVO, + ModelMap model) throws Exception { + + EventCmpgnVO vo = egovEventCmpgnService.selectEventCmpgnDetail(eventCmpgnVO); + + model.addAttribute("result", vo); + + return "egovframework/com/uss/ion/ecc/EgovEventCmpgnDetail"; + } + + + /** + * 행사/이벤트/캠페인 등록전 단계 + * @param searchVO + * @param model + * @return "/uss/ion/ecc/EgovEventCmpgnRegist" + * @throws Exception + */ + @RequestMapping("/uss/ion/ecc/insertEventCmpgnView.do") + public String insertEventCmpgnView(@ModelAttribute("searchVO") EventCmpgnVO searchVO, Model model) throws Exception { + + // 공통코드를 가져오기 위한 Vo + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM035"); + + List _result = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("eventTyCode", _result); + + + model.addAttribute("eventCmpgnVO", new EventCmpgnVO()); + + return "egovframework/com/uss/ion/ecc/EgovEventCmpgnRegist"; + + } + + /** + * 행사/이벤트/캠페인을 등록한다. + * @param searchVO + * @param eventCmpgnVO + * @param bindingResult + * @return "forward:/uss/ion/ecc/selectEventCmpgnList.do" + * @throws Exception + */ + @RequestMapping("/uss/ion/ecc/insertEventCmpgn.do") + public String insertEventCmpgn(@ModelAttribute("searchVO") EventCmpgnVO searchVO, @ModelAttribute("eventCmpgnVO") EventCmpgnVO eventCmpgnVO, + BindingResult bindingResult) throws Exception { + + beanValidator.validate(eventCmpgnVO, bindingResult); + if(bindingResult.hasErrors()){ + return "egovframework/com/uss/olh/ecc/EgovEventCmpgnRegist"; + } + + // 로그인VO에서 사용자 정보 가져오기 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + String frstRegisterId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId()); + + eventCmpgnVO.setFrstRegisterId(frstRegisterId); // 최초등록자ID + eventCmpgnVO.setLastUpdusrId(frstRegisterId); // 최종수정자ID + + egovEventCmpgnService.insertEventCmpgn(eventCmpgnVO); + + return "forward:/uss/ion/ecc/selectEventCmpgnList.do"; + } + + /** + * 행사/이벤트/캠페인을 수정하기 전 처리 + * @param eventId + * @param searchVO + * @param model + * @return "/uss/ion/ecc/EgovEventCmpgnUpdt" + * @throws Exception + */ + @RequestMapping("/uss/ion/ecc/updateEventCmpgnView.do") + public String updateEventCmpgnView(@RequestParam("eventId") String eventId , + @ModelAttribute("searchVO") EventCmpgnVO searchVO, ModelMap model) + throws Exception { + + // 공통코드를 가져오기 위한 Vo + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM035"); + + List _result = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("eventTyCode", _result); + + EventCmpgnVO eventCmpgnVO = new EventCmpgnVO(); + + // Primary Key 값 세팅 + eventCmpgnVO.setEventId(eventId); + model.addAttribute("eventCmpgnVO", egovEventCmpgnService.selectEventCmpgnDetail(eventCmpgnVO)); + + + return "egovframework/com/uss/ion/ecc/EgovEventCmpgnUpdt"; + } + + /** + * 행사/이벤트/캠페인을 수정처리한다. + * @param searchVO + * @param eventCmpgnVO + * @param bindingResult + * @return "forward:/uss/ion/ecc/selectEventCmpgnList.do" + * @throws Exception + */ + @RequestMapping("/uss/ion/ecc/updateEventCmpgn.do") + public String updateEventCmpgn(@ModelAttribute("searchVO") EventCmpgnVO searchVO, @ModelAttribute("eventCmpgnVO") EventCmpgnVO eventCmpgnVO, + BindingResult bindingResult) + throws Exception { + + // Validation + beanValidator.validate(eventCmpgnVO, bindingResult); + if(bindingResult.hasErrors()){ + return "egovframework/com/uss/olh/ecc/EgovEventCmpgnUpdt"; + } + + // 로그인VO에서 사용자 정보 가져오기 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + String lastUpdusrId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId()); + eventCmpgnVO.setLastUpdusrId(lastUpdusrId); // 최종수정자ID + + egovEventCmpgnService.updateEventCmpgn(eventCmpgnVO); + + return "forward:/uss/ion/ecc/selectEventCmpgnList.do"; + + } + + /** + * 행사/이벤트/캠페인을 삭제처리한다. + * @param eventCmpgnVO + * @param searchVO + * @return "forward:/uss/ion/ecc/selectEventCmpgnList.do" + * @throws Exception + */ + @RequestMapping("/uss/ion/ecc/deleteEventCmpgn.do") + public String deleteEventCmpgn(EventCmpgnVO eventCmpgnVO, @ModelAttribute("searchVO") EventCmpgnVO searchVO) throws Exception { + + egovEventCmpgnService.deleteEventCmpgn(eventCmpgnVO); + + return "forward:/uss/ion/ecc/selectEventCmpgnList.do"; + } + + /** + * 외부인사정보 목록을 조회한다. + * @param searchVO + * @param tnextrlHrVO + * @param model + * @return "egovframework/com/uss/ion/ecc/EgovTnextrlHrList + * @throws Exception + */ + @IncludedInfo(name="외부인사정보", order = 711 ,gid = 50) + @RequestMapping(value="/uss/ion/ecc/selectTnextrlHrList.do") + public String selectTnextrlHrList(@ModelAttribute("searchVO") TnextrlHrVO searchVO, ModelMap model) throws Exception { + + /** 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()); + + List sampleList = egovEventCmpgnService.selectTnextrlHrList(searchVO); + model.addAttribute("resultList", sampleList); + + int totCnt = egovEventCmpgnService.selectTnextrlHrListCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/uss/ion/ecc/EgovTnextrlHrList"; + + } + + /** + * 외부인사정보 목록에 대한 상세정보를 조회한다. + * @param tnextrlHrVO + * @param searchVO + * @param model + * @return "/uss/ion/ecc/EgovTnextrlHrDetail" + * @throws Exception + */ + @RequestMapping("/uss/ion/ecc/selectTnextrlHrDetail.do") + public String selectTnextrlHrDetail(TnextrlHrVO tnextrlHrVO, @ModelAttribute("searchVO") TnextrlHrVO searchVO, ModelMap model) throws Exception { + + TnextrlHrVO vo = egovEventCmpgnService.selectTnextrlHrDetail(tnextrlHrVO); + + model.addAttribute("result", vo); + + return "egovframework/com/uss/ion/ecc/EgovTnextrlHrDetail"; + } + + /** + * 외부인사정보 등록전 단계 + * @param searchVO + * @param model + * @return "/uss/ion/ecc/EgovTnextrlHrRegist" + * @throws Exception + */ + @RequestMapping("/uss/ion/ecc/insertTnextrlHrView.do") + public String insertTnextrlHrView(@ModelAttribute("searchVO") TnextrlHrVO searchVO, Model model) throws Exception { + + // 공통코드를 가져오기 위한 Vo + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM014"); //성별 + List _result = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("sexdstnCode", _result); + + vo.setCodeId("COM034"); //직업코드 + _result = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("occpTyCode", _result); + + + + model.addAttribute("tnextrlHrVO", new TnextrlHrVO()); + + return "egovframework/com/uss/ion/ecc/EgovTnextrlHrRegist"; + + } + + /** + * 외부인사정보를 등록한다. + * @param searchVO + * @param tnextrlHrVO + * @param bindingResult + * @return "forward:/uss/ion/ecc/selectTnextrlHrList.do" + * @throws Exception + */ + @RequestMapping("/uss/ion/ecc/insertTnextrlHr.do") + public String insertTnextrlHr(@ModelAttribute("searchVO") TnextrlHrVO searchVO, @ModelAttribute("tnextrlHrVO") TnextrlHrVO tnextrlHrVO, + BindingResult bindingResult) throws Exception { + + beanValidator.validate(tnextrlHrVO, bindingResult); + if(bindingResult.hasErrors()){ + return "egovframework/com/uss/olh/ecc/EgovTnextrlHrRegist"; + } + + // 로그인VO에서 사용자 정보 가져오기 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + String frstRegisterId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId()); + + tnextrlHrVO.setFrstRegisterId(frstRegisterId); // 최초등록자ID + tnextrlHrVO.setLastUpdusrId(frstRegisterId); // 최종수정자ID + + egovEventCmpgnService.insertTnextrlHr(tnextrlHrVO); + + return "redirect:/uss/ion/ecc/selectTnextrlHrList.do"; + } + + /** + * 외부인사정보를 수정하기 전 처리 + * @param extrlHrId + * @param searchVO + * @param model + * @return "/uss/ion/ecc/EgovTnextrlHrUpdt" + * @throws Exception + */ + @RequestMapping("/uss/ion/ecc/updateTnextrlHrView.do") + public String updateTnextrlHrView(@RequestParam("extrlHrId") String extrlHrId , + @ModelAttribute("searchVO") TnextrlHrVO searchVO, ModelMap model) + throws Exception { + + // 공통코드를 가져오기 위한 Vo + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM014"); //성별 + List _result = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("sexdstnCode", _result); + + vo.setCodeId("COM034"); //직업코드 + _result = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("occpTyCode", _result); + + TnextrlHrVO tnextrlHrVO = new TnextrlHrVO(); + + // Primary Key 값 세팅 + tnextrlHrVO.setExtrlHrId(extrlHrId); + model.addAttribute("tnextrlHrVO", egovEventCmpgnService.selectTnextrlHrDetail(tnextrlHrVO)); + + + return "egovframework/com/uss/ion/ecc/EgovTnextrlHrUpdt"; + } + + /** + * 외부인사정보를 수정처리한다. + * @param searchVO + * @param tnextrlHrVO + * @param bindingResult + * @return "forward:/uss/ion/ecc/selectTnextrlHrList.do" + * @throws Exception + */ + @RequestMapping("/uss/ion/ecc/updateTnextrlHr.do") + public String updateTnextrlHr(@ModelAttribute("searchVO") TnextrlHrVO searchVO, @ModelAttribute("tnextrlHrVO") TnextrlHrVO tnextrlHrVO, + BindingResult bindingResult) + throws Exception { + + // Validation + beanValidator.validate(tnextrlHrVO, bindingResult); + if(bindingResult.hasErrors()){ + return "egovframework/com/uss/olh/ecc/EgovTnextrlHrUpdt"; + } + + // 로그인VO에서 사용자 정보 가져오기 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + String lastUpdusrId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId()); + tnextrlHrVO.setLastUpdusrId(lastUpdusrId); // 최종수정자ID + + egovEventCmpgnService.updateTnextrlHr(tnextrlHrVO); + + return "forward:/uss/ion/ecc/selectTnextrlHrList.do"; + + } + + /** + * 외부인사정보를 삭제처리한다. + * @param tnextrlHrVO + * @param searchVO + * @return "forward:/uss/ion/ecc/selectTnextrlHrList.do" + * @throws Exception + */ + @RequestMapping("/uss/ion/ecc/deleteTnextrlHr.do") + public String deleteTnextrlHr(TnextrlHrVO tnextrlHrVO, @ModelAttribute("searchVO") TnextrlHrVO searchVO) throws Exception { + + egovEventCmpgnService.deleteTnextrlHr(tnextrlHrVO); + + return "forward:/uss/ion/ecc/selectTnextrlHrList.do"; + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/evt/service/EgovEventManageService.java b/src/main/java/egovframework/com/uss/ion/evt/service/EgovEventManageService.java new file mode 100644 index 0000000..872df77 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/evt/service/EgovEventManageService.java @@ -0,0 +1,136 @@ +package egovframework.com.uss.ion.evt.service; + +import java.util.List; + +/** + * 개요 + * - 행사관리에 대한 Service Interface를 정의한다. + * + * 상세내용 + * - 행사관리에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 행사관리의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +public interface EgovEventManageService { + + /** + * 행사관리 정보를 관리하기 위해 등록된 행사목록을 조회한다. + * @param eventManageVO - 행사관리 VO + * @return List - 행사관리 목록 + */ + public List selectEventManageList(EventManageVO eventManageVO) throws Exception; + + /** + * 행사관리 목록 총 갯수를 조회한다. + * @param eventManageVO - 행사관리 VO + * @return int - 행사관리 카운트 수 + */ + public int selectEventManageListTotCnt(EventManageVO eventManageVO) throws Exception ; + + /** + * 등록된 행사관리의 상세정보를 조회한다. + * @param eventManageVO - 행사관리 VO + * @return EventManageVO - 행사관리 VO + */ + public EventManageVO selectEventManage(EventManageVO eventManageVO) throws Exception; + + /** + * 행사관리 정보를 신규로 등록한다. + * @param eventManage - 행사관리 model + */ + public void insertEventManage(EventManage eventManage) throws Exception; + + /** + * 기 등록된 행사관리 정보를 수정한다. + * @param eventManage - 행사관리 model + */ + public void updtEventManage(EventManage eventManage) throws Exception; + + /** + * 기 등록된 행사관리 정보를 삭제한다. + * @param eventManage - 행사관리 model + */ + public void deleteEventManage(EventManage eventManage) throws Exception; + + + + /*** 행사접수관리 ****/ + + /** + * 행사접수정보를 관리하기 위해 등록된 행사관리 목록을 조회한다. + * @param eventManageVO - 행사관리 VO + * @return List - 행사접수관리 목록 + */ + public List selectEventAtdrnList(EventManageVO eventManageVO) throws Exception; + + /** + * 행사관리 목록 총 갯수를 조회한다. + * @param eventManageVO - 행사관리 VO + * @return int - 행사접수관리 카운트 수 + */ + public int selectEventAtdrnListTotCnt(EventManageVO eventManageVO) throws Exception ; + + /** + * 행사접수승인/반려 처리를 위해 등록된 행사접수 목록을 조회한다. + * @param eventManageVO - 행사관리 VO + * @return List - 행사접수승인 목록 + */ + public List selectEventRceptConfmList(EventManageVO eventManageVO) throws Exception; + + /** + * 행사접수승인/반려 처리를 위해 등록된 행사접수 목록 총 갯수를 조회한다. + * @param eventManageVO - 행사관리 VO + * @return int - 행사접수승인 카운트 수 + */ + public int selectEventRceptConfmListTotCnt(EventManageVO eventManageVO) throws Exception ; + + /** + * 행사일자, 행사구분 조건에 따른 행사명 목록을 조회한다. + * @param eventManageVO - 행사관리 VO + * @return List - 행사명 목록 + */ + public List selectEventNmList(EventManageVO eventManageVO) throws Exception; + + /** + * 등록된 행사관리의 상세정보를 조회한다. + * @param eventManageVO - 행사관리 VO + * @return EventManageVO - 행사관리 VO + */ + public EventManageVO selectEventAtdrn(EventManageVO eventManageVO) throws Exception; + + /** + * 행사관리 정보를 신규로 등록한다. + * @param eventManage - 행사관리 model + */ + public void insertEventAtdrn(EventAtdrn eventAtdrn) throws Exception; + + /** + * 기 등록된 행사관리 정보를 삭제한다. + * @param eventManage - 행사관리 model + */ + public void deleteEventAtdrn(EventAtdrn eventAtdrn) throws Exception; + + /** + * 기 등록된 행사관리 정보를 승인/반려처리한다. + * @param eventManage - 행사관리 model + */ + public void updtEventAtdrn(EventAtdrn eventAtdrn, String checkedEventRceptForConfm) throws Exception; + + /** + * 행사접수자 정보를 조회한다. + * @param eventManageVO - 행사관리 VO + * @return List - 행사관리 목록 + */ + public List selectEventReqstAtdrnList(EventManageVO eventManageVO) throws Exception; + + /** + * 행사접수자 목록 총 갯수를 조회한다. + * @param eventManageVO - 행사관리 VO + * @return int - 행사관리 카운트 수 + */ + public int selectEventReqstAtdrnListTotCnt(EventManageVO eventManageVO) throws Exception ; + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/evt/service/EventAtdrn.java b/src/main/java/egovframework/com/uss/ion/evt/service/EventAtdrn.java new file mode 100644 index 0000000..040b4a4 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/evt/service/EventAtdrn.java @@ -0,0 +1,252 @@ +package egovframework.com.uss.ion.evt.service; + +import egovframework.com.cmm.ComDefaultVO; + +/** + * 개요 + * - 행사참석자에 대한 model 클래스를 정의한다. + * + * 상세내용 + * - 행사참석자의 신청자ID,행사ID,신청일자,결재자ID,승인여부,결재일시,반려사유,최초등록자ID,최초등록시점,최종수정자ID,최종수정시점 항목을 관리한다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +public class EventAtdrn extends ComDefaultVO { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + + /** + * 신청자ID + */ + private String applcntId; + + /** + * 행사ID + */ + private String eventId; + + /** + * 신청일자 + */ + private String reqstDe; + + /** + * 결재자ID + */ + private String sanctnerId; + + /** + * 승인여부 + */ + private String confmAt; + + /** + * 결재일시 + */ + private String sanctnDt; + + /** + * 반려사유 + */ + private String returnResn; + + /** + * 약식결재ID + */ + private String infrmlSanctnId; + + /** + * 최초등록자ID + */ + private String frstRegisterId; + + /** + * 최초등록시점 + */ + private String frstRegisterPnttm; + + /** + * 최종수정자ID + */ + private String lastUpdusrId; + + /** + * 최종수정시점 + */ + private String lastUpdusrPnttm; + + /** + * @return the applcntId + */ + public String getApplcntId() { + return applcntId; + } + + /** + * @param applcntId the applcntId to set + */ + public void setApplcntId(String applcntId) { + this.applcntId = applcntId; + } + + /** + * @return the eventId + */ + public String getEventId() { + return eventId; + } + + /** + * @param eventId the eventId to set + */ + public void setEventId(String eventId) { + this.eventId = eventId; + } + + /** + * @return the reqstDe + */ + public String getReqstDe() { + return reqstDe; + } + + /** + * @param reqstDe the reqstDe to set + */ + public void setReqstDe(String reqstDe) { + this.reqstDe = reqstDe; + } + + /** + * @return the sanctnerId + */ + public String getSanctnerId() { + return sanctnerId; + } + + /** + * @param sanctnerId the sanctnerId to set + */ + public void setSanctnerId(String sanctnerId) { + this.sanctnerId = sanctnerId; + } + + /** + * @return the confmAt + */ + public String getConfmAt() { + return confmAt; + } + + /** + * @param confmAt the confmAt to set + */ + public void setConfmAt(String confmAt) { + this.confmAt = confmAt; + } + + /** + * @return the sanctnDt + */ + public String getSanctnDt() { + return sanctnDt; + } + + /** + * @param sanctnDt the sanctnDt to set + */ + public void setSanctnDt(String sanctnDt) { + this.sanctnDt = sanctnDt; + } + + /** + * @return the returnResn + */ + public String getReturnResn() { + return returnResn; + } + + /** + * @param returnResn the returnResn to set + */ + public void setReturnResn(String returnResn) { + this.returnResn = returnResn; + } + + /** + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * @param frstRegisterId the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * @param frstRegisterPnttm the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * @param lastUpdusrId the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + /** + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * @param lastUpdusrPnttm the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * @return the infrmlSanctnId + */ + public String getInfrmlSanctnId() { + return infrmlSanctnId; + } + + /** + * @param infrmlSanctnId the infrmlSanctnId to set + */ + public void setInfrmlSanctnId(String infrmlSanctnId) { + this.infrmlSanctnId = infrmlSanctnId; + } + + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/evt/service/EventAtdrnVO.java b/src/main/java/egovframework/com/uss/ion/evt/service/EventAtdrnVO.java new file mode 100644 index 0000000..c45fa5b --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/evt/service/EventAtdrnVO.java @@ -0,0 +1,43 @@ +package egovframework.com.uss.ion.evt.service; + +import java.io.Serializable; +import java.util.List; + +/** + * 개요 + * - 행사참석자에 대한 Vo 클래스를 정의한다. + * + * 상세내용 + * - 행사참석자의 목록 항목을 관리한다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +public class EventAtdrnVO extends EventAtdrn implements Serializable { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + /** + * 배너 목록 + */ + List eventAtdrnList; + + /** + * @return the eventAtdrnList + */ + public List getEventAtdrnList() { + return eventAtdrnList; + } + /** + * @param eventManage the eventManage to set + */ + public void setEventAtdrnList(List eventAtdrnList) { + this.eventAtdrnList = eventAtdrnList; + } + + + +} diff --git a/src/main/java/egovframework/com/uss/ion/evt/service/EventManage.java b/src/main/java/egovframework/com/uss/ion/evt/service/EventManage.java new file mode 100644 index 0000000..fe8fa03 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/evt/service/EventManage.java @@ -0,0 +1,406 @@ +package egovframework.com.uss.ion.evt.service; + +import egovframework.com.cmm.ComDefaultVO; + +/** + * 개요 + * - 행사관리에 대한 model 클래스를 정의한다. + * + * 상세내용 + * - 행사관리의 행사ID,행사구분,행사명,행사목적,행사시작일자,행사종료일자,행사주최기관명,행사주관기관명,행사장소,행사내용,비용발생여부,참가비용,정원,참조URL,접수시작일자,접수종료일자,최초등록자ID,최초등록시점,최종수정자ID,최종수정시점 항목을 관리한다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +public class EventManage extends ComDefaultVO { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + + /** + * 행사ID + */ + private String eventId; + + /** + * 행사구분 + */ + private String eventSe; + + /** + * 행사명 + */ + private String eventNm; + + /** + * 행사목적 + */ + private String eventPurps; + + /** + * 행사시작일자 + */ + private String eventBeginDe; + + /** + * 행사종료일자 + */ + private String eventEndDe; + + /** + * 행사주최기관명 + */ + private String eventAuspcInsttNm; + + /** + * 행사주관기관명 + */ + private String eventMngtInsttNm; + + /** + * 행사장소 + */ + private String eventPlace; + + /** + * 행사내용 + */ + private String eventCn; + + /** + * 비용발생여부 + */ + private String ctOccrrncAt; + + /** + * 참가비용 + */ + private int partcptCt; + + /** + * 정원 + */ + private int psncpa; + + /** + * 참조URL + */ + private String refrnUrl; + + /** + * 접수시작일자 + */ + private String rceptBeginDe; + + /** + * 접수종료일자 + */ + private String rceptEndDe; + + /** + * 최초등록자ID + */ + private String frstRegisterId; + + /** + * 최초등록시점 + */ + private String frstRegisterPnttm; + + /** + * 최종수정자ID + */ + private String lastUpdusrId; + + /** + * 최종수정시점 + */ + private String lastUpdusrPnttm; + + + + /** + * @return the eventId + */ + public String getEventId() { + return eventId; + } + + /** + * @param eventId the eventId to set + */ + public void setEventId(String eventId) { + this.eventId = eventId; + } + + /** + * @return the eventSe + */ + public String getEventSe() { + return eventSe; + } + + /** + * @param eventSe the eventSe to set + */ + public void setEventSe(String eventSe) { + this.eventSe = eventSe; + } + + /** + * @return the eventNm + */ + public String getEventNm() { + return eventNm; + } + + /** + * @param eventNm the eventNm to set + */ + public void setEventNm(String eventNm) { + this.eventNm = eventNm; + } + + /** + * @return the eventPurps + */ + public String getEventPurps() { + return eventPurps; + } + + /** + * @param eventPurps the eventPurps to set + */ + public void setEventPurps(String eventPurps) { + this.eventPurps = eventPurps; + } + + /** + * @return the eventBeginDe + */ + public String getEventBeginDe() { + return eventBeginDe; + } + + /** + * @param eventBeginDe the eventBeginDe to set + */ + public void setEventBeginDe(String eventBeginDe) { + this.eventBeginDe = eventBeginDe; + } + + /** + * @return the eventEndDe + */ + public String getEventEndDe() { + return eventEndDe; + } + + /** + * @param eventEndDe the eventEndDe to set + */ + public void setEventEndDe(String eventEndDe) { + this.eventEndDe = eventEndDe; + } + + /** + * @return the eventAuspcInsttNm + */ + public String getEventAuspcInsttNm() { + return eventAuspcInsttNm; + } + + /** + * @param eventAuspcInsttNm the eventAuspcInsttNm to set + */ + public void setEventAuspcInsttNm(String eventAuspcInsttNm) { + this.eventAuspcInsttNm = eventAuspcInsttNm; + } + + /** + * @return the eventMngtInsttNm + */ + public String getEventMngtInsttNm() { + return eventMngtInsttNm; + } + + /** + * @param eventMngtInsttNm the eventMngtInsttNm to set + */ + public void setEventMngtInsttNm(String eventMngtInsttNm) { + this.eventMngtInsttNm = eventMngtInsttNm; + } + + /** + * @return the eventPlace + */ + public String getEventPlace() { + return eventPlace; + } + + /** + * @param eventPlace the eventPlace to set + */ + public void setEventPlace(String eventPlace) { + this.eventPlace = eventPlace; + } + + /** + * @return the eventCn + */ + public String getEventCn() { + return eventCn; + } + + /** + * @param eventCn the eventCn to set + */ + public void setEventCn(String eventCn) { + this.eventCn = eventCn; + } + + /** + * @return the ctOccrrncAt + */ + public String getCtOccrrncAt() { + return ctOccrrncAt; + } + + /** + * @param ctOccrrncAt the ctOccrrncAt to set + */ + public void setCtOccrrncAt(String ctOccrrncAt) { + this.ctOccrrncAt = ctOccrrncAt; + } + + /** + * @return the partcptCt + */ + public int getPartcptCt() { + return partcptCt; + } + + /** + * @param partcptCt the partcptCt to set + */ + public void setPartcptCt(int partcptCt) { + this.partcptCt = partcptCt; + } + + /** + * @return the garden + */ + public int getPsncpa() { + return psncpa; + } + + /** + * @param garden the garden to set + */ + public void setPsncpa(int psncpa) { + this.psncpa = psncpa; + } + + /** + * @return the refrnUrl + */ + public String getRefrnUrl() { + return refrnUrl; + } + + /** + * @param refrnUrl the refrnUrl to set + */ + public void setRefrnUrl(String refrnUrl) { + this.refrnUrl = refrnUrl; + } + + /** + * @return the rceptBeginDe + */ + public String getRceptBeginDe() { + return rceptBeginDe; + } + + /** + * @param rceptBeginDe the rceptBeginDe to set + */ + public void setRceptBeginDe(String rceptBeginDe) { + this.rceptBeginDe = rceptBeginDe; + } + + /** + * @return the rceptEndDe + */ + public String getRceptEndDe() { + return rceptEndDe; + } + + /** + * @param rceptEndDe the rceptEndDe to set + */ + public void setRceptEndDe(String rceptEndDe) { + this.rceptEndDe = rceptEndDe; + } + + /** + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * @param frstRegisterId the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * @param frstRegisterPnttm the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * @param lastUpdusrId the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + /** + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * @param lastUpdusrPnttm the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/evt/service/EventManageVO.java b/src/main/java/egovframework/com/uss/ion/evt/service/EventManageVO.java new file mode 100644 index 0000000..6eaf66a --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/evt/service/EventManageVO.java @@ -0,0 +1,531 @@ +package egovframework.com.uss.ion.evt.service; + +import java.io.Serializable; +import java.util.List; + +/** + * 개요 + * - 행사관리에 대한 Vo 클래스를 정의한다. + * + * 상세내용 + * - 행사관리의 목록 항목을 관리한다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + + +public class EventManageVO extends EventManage implements Serializable { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + /** + * 배너 목록 + */ + List eventManageList; + + /** + * 신청자ID + */ + private String applcntId; + + /** + * 신청일자 + */ + private String reqstDe; + + /** + * 결재자ID + */ + private String sanctnerId; + + /** + * 승인여부 + */ + private String confmAt; + + /** + * 결재일시 + */ + private String sanctnDt; + + /** + * 반려사유 + */ + private String returnResn; + + /** + * 약식결재ID + */ + private String infrmlSanctnId; + + /** + * eventTemp1 + */ + private String eventTemp1; + + /** + * eventTemp1 + */ + private String eventTemp2; + /** + * eventTemp1 + */ + + private String eventTemp3; + + /** + * eventTemp4 + */ + private String eventTemp4; + + /** + * eventTemp5 + */ + private String eventTemp5; + + /** + * eventTemp6 + */ + private String eventTemp6; + + /** + * eventTemp7 + */ + private String eventTemp7; + + /** + * 결재자명 + */ + private String sanctnerNm; + + /** + * 신청자명 + */ + private String applcntNm; + + /** + * 행사구분명 + */ + private String eventSeNm; + + /** + * 검색 연도 + */ + private String searchYear; + + /** + * 검색 월 + */ + private String searchMonth; + + /** + * 검색 명 + */ + private String searchNm; + + /** + * 검색 구분명 + */ + private String searchSe; + + /** + * 체크 행사접수기간 일수 + */ + private int eventDayCount; + + /** + * 체크 행사참여인원 + */ + private int eventAtdrnCount; + + /** + * searchToDateView + */ + private String searchToDateView; + + /** + * searchFromDateView + */ + private String searchFromDateView; + + /** + * 검색 승인여부 + */ + private String searchConfmAt; + + /** + * @return the searchConfmAt + */ + public String getSearchConfmAt() { + return searchConfmAt; + } + /** + * @param searchConfmAt the searchConfmAt to set + */ + public void setSearchConfmAt(String searchConfmAt) { + this.searchConfmAt = searchConfmAt; + } + /** + * @return the searchToDateView + */ + public String getSearchToDateView() { + return searchToDateView; + } + /** + * @param searchToDateView the searchToDateView to set + */ + public void setSearchToDateView(String searchToDateView) { + this.searchToDateView = searchToDateView; + } + /** + * @return the searchFromDateView + */ + public String getSearchFromDateView() { + return searchFromDateView; + } + /** + * @param searchFromDateView the searchFromDateView to set + */ + public void setSearchFromDateView(String searchFromDateView) { + this.searchFromDateView = searchFromDateView; + } + + /** + * @return the searchNm + */ + public String getSearchNm() { + return searchNm; + } + + /** + * @param searchNm the searchNm to set + */ + public void setSearchNm(String searchNm) { + this.searchNm = searchNm; + } + + /** + * @return the searchSe + */ + public String getSearchSe() { + return searchSe; + } + + /** + * @param searchSe the searchSe to set + */ + public void setSearchSe(String searchSe) { + this.searchSe = searchSe; + } + + /** + * @return the searchYear + */ + public String getSearchYear() { + return searchYear; + } + + /** + * @param searchYear the searchYear to set + */ + public void setSearchYear(String searchYear) { + this.searchYear = searchYear; + } + + /** + * @return the searchMonth + */ + public String getSearchMonth() { + return searchMonth; + } + + /** + * @param searchMonth the searchMonth to set + */ + public void setSearchMonth(String searchMonth) { + this.searchMonth = searchMonth; + } + + /** + * @return the applcntNm + */ + public String getApplcntNm() { + return applcntNm; + } + + /** + * @param applcntNm the applcntNm to set + */ + public void setApplcntNm(String applcntNm) { + this.applcntNm = applcntNm; + } + + /** + * @return the eventSeNm + */ + public String getEventSeNm() { + return eventSeNm; + } + + /** + * @param eventSeNm the eventSeNm to set + */ + public void setEventSeNm(String eventSeNm) { + this.eventSeNm = eventSeNm; + } + + /** + * @return the sanctnerNm + */ + public String getSanctnerNm() { + return sanctnerNm; + } + + /** + * @param sanctnerNm the sanctnerNm to set + */ + public void setSanctnerNm(String sanctnerNm) { + this.sanctnerNm = sanctnerNm; + } + + /** + * @return the eventTemp1 + */ + public String getEventTemp1() { + return eventTemp1; + } + + /** + * @param eventTemp1 the eventTemp1 to set + */ + public void setEventTemp1(String eventTemp1) { + this.eventTemp1 = eventTemp1; + } + + /** + * @return the eventTemp2 + */ + public String getEventTemp2() { + return eventTemp2; + } + + /** + * @param eventTemp2 the eventTemp2 to set + */ + public void setEventTemp2(String eventTemp2) { + this.eventTemp2 = eventTemp2; + } + + /** + * @return the eventTemp3 + */ + public String getEventTemp3() { + return eventTemp3; + } + + /** + * @param eventTemp3 the eventTemp3 to set + */ + public void setEventTemp3(String eventTemp3) { + this.eventTemp3 = eventTemp3; + } + + /** + * @return the eventTemp4 + */ + public String getEventTemp4() { + return eventTemp4; + } + + /** + * @param eventTemp4 the eventTemp4 to set + */ + public void setEventTemp4(String eventTemp4) { + this.eventTemp4 = eventTemp4; + } + + /** + * @return the eventTemp5 + */ + public String getEventTemp5() { + return eventTemp5; + } + + /** + * @param eventTemp5 the eventTemp5 to set + */ + public void setEventTemp5(String eventTemp5) { + this.eventTemp5 = eventTemp5; + } + + /** + * @return the eventTemp6 + */ + public String getEventTemp6() { + return eventTemp6; + } + + /** + * @param eventTemp6 the eventTemp6 to set + */ + public void setEventTemp6(String eventTemp6) { + this.eventTemp6 = eventTemp6; + } + + /** + * @return the eventTemp7 + */ + public String getEventTemp7() { + return eventTemp7; + } + + /** + * @param eventTemp7 the eventTemp7 to set + */ + public void setEventTemp7(String eventTemp7) { + this.eventTemp7 = eventTemp7; + } + + /** + * @return the applcntId + */ + public String getApplcntId() { + return applcntId; + } + + /** + * @param applcntId the applcntId to set + */ + public void setApplcntId(String applcntId) { + this.applcntId = applcntId; + } + + /** + * @return the reqstDe + */ + public String getReqstDe() { + return reqstDe; + } + + /** + * @param reqstDe the reqstDe to set + */ + public void setReqstDe(String reqstDe) { + this.reqstDe = reqstDe; + } + + /** + * @return the sanctnerId + */ + public String getSanctnerId() { + return sanctnerId; + } + + /** + * @param sanctnerId the sanctnerId to set + */ + public void setSanctnerId(String sanctnerId) { + this.sanctnerId = sanctnerId; + } + + /** + * @return the confmAt + */ + public String getConfmAt() { + return confmAt; + } + + /** + * @param confmAt the confmAt to set + */ + public void setConfmAt(String confmAt) { + this.confmAt = confmAt; + } + + /** + * @return the sanctnDt + */ + public String getSanctnDt() { + return sanctnDt; + } + + /** + * @param sanctnDt the sanctnDt to set + */ + public void setSanctnDt(String sanctnDt) { + this.sanctnDt = sanctnDt; + } + + /** + * @return the returnResn + */ + public String getReturnResn() { + return returnResn; + } + + /** + * @param returnResn the returnResn to set + */ + public void setReturnResn(String returnResn) { + this.returnResn = returnResn; + } + + /** + * @return the eventManageList + */ + public List getEventManageList() { + return eventManageList; + } + /** + * @param eventManage the eventManage to set + */ + public void setEventManageList(List eventManageList) { + this.eventManageList = eventManageList; + } + + /** + * @return the infrmlSanctnId + */ + public String getInfrmlSanctnId() { + return infrmlSanctnId; + } + + /** + * @param infrmlSanctnId the infrmlSanctnId to set + */ + public void setInfrmlSanctnId(String infrmlSanctnId) { + this.infrmlSanctnId = infrmlSanctnId; + } + + /** + * @return the eventDayCount + */ + public int getEventDayCount() { + return eventDayCount; + } + + /** + * @param eventDayCount the eventDayCount to set + */ + public void setEventDayCount(int eventDayCount) { + this.eventDayCount = eventDayCount; + } + + /** + * @return the eventAtdrnCount + */ + public int getEventAtdrnCount() { + return eventAtdrnCount; + } + + /** + * @param eventAtdrnCount the eventAtdrnCount to set + */ + public void setEventAtdrnCount(int eventAtdrnCount) { + this.eventAtdrnCount = eventAtdrnCount; + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/evt/service/impl/EgovEventManageServiceImpl.java b/src/main/java/egovframework/com/uss/ion/evt/service/impl/EgovEventManageServiceImpl.java new file mode 100644 index 0000000..2f6a092 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/evt/service/impl/EgovEventManageServiceImpl.java @@ -0,0 +1,316 @@ +package egovframework.com.uss.ion.evt.service.impl; + +import java.util.List; + +import egovframework.com.uss.ion.evt.service.EgovEventManageService; +import egovframework.com.uss.ion.evt.service.EventAtdrn; +import egovframework.com.uss.ion.evt.service.EventManage; +import egovframework.com.uss.ion.evt.service.EventManageVO; +import egovframework.com.uss.ion.ism.service.EgovInfrmlSanctnService; +import egovframework.com.uss.ion.ism.service.InfrmlSanctn; +import egovframework.com.utl.fcc.service.EgovDateUtil; +import egovframework.com.utl.fcc.service.EgovStringUtil; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +/** + * 개요 + * - 행사관리에 대한 ServiceImpl 클래스를 정의한다. + * + * 상세내용 + * - 행사관리에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 행사관리의 조회기능은 목록조회, 상세조회로 구분된다. + * + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + * + *
    + * << 개정이력(Modification Information) >> *   
    + *   수정일       수정자           수정내용
    + *  -------       --------    ---------------------------
    + *  2011.8.11     정진오      Dependency 최소화를 위한 불필요 변수 선언 주석처리
    + *   
    + * 
    + */ + +@Service("egovEventManageService") +public class EgovEventManageServiceImpl extends EgovAbstractServiceImpl implements EgovEventManageService { + + @Resource(name="eventManageDAO") + private EventManageDAO eventManageDAO; + + /** ID Generation */ + @Resource(name="egovEventManageIdGnrService") + private EgovIdGnrService idgenEventService; + + @Resource(name="EgovInfrmlSanctnService") + protected EgovInfrmlSanctnService infrmlSanctnService; + + /** + * 행사관리정보를 관리하기 위해 등록된 행사관리 목록을 조회한다. + * @param eventManageVO - 행사관리 VO + * @return List - 행사관리 목록 + */ + public List selectEventManageList(EventManageVO eventManageVO) throws Exception{ + + List result = eventManageDAO.selectEventManageList(eventManageVO); + int num = result.size(); + + for (int i = 0 ; i < num ; i ++ ){ + EventManageVO eventManageVO1 = result.get(i); + eventManageVO1.setEventBeginDe(EgovDateUtil.formatDate(eventManageVO1.getEventBeginDe(), "-")); + eventManageVO1.setEventEndDe (EgovDateUtil.formatDate(eventManageVO1.getEventEndDe() , "-")); + eventManageVO1.setRceptBeginDe(EgovDateUtil.formatDate(eventManageVO1.getRceptBeginDe(), "-")); + eventManageVO1.setRceptEndDe (EgovDateUtil.formatDate(eventManageVO1.getRceptEndDe() , "-")); + result.set(i, eventManageVO1); + } + return result; + } + + /** + * 행사관리목록 총 갯수를 조회한다. + * @param eventManageVO - 행사관리 VO + * @return int - 행사관리 카운트 수 + */ + public int selectEventManageListTotCnt(EventManageVO eventManageVO) throws Exception { + return eventManageDAO.selectEventManageListTotCnt(eventManageVO); + } + + /** + * 등록된 행사관리의 상세정보를 조회한다. + * @param eventManageVO - 행사관리 VO + * @return EventManageVO - 행사관리 VO + */ + public EventManageVO selectEventManage(EventManageVO eventManageVO) throws Exception { + return eventManageDAO.selectEventManage(eventManageVO); + } + + /** + * 행사관리정보를 신규로 등록한다. + * @param eventManage - 행사관리 model + */ + public void insertEventManage(EventManage eventManage) throws Exception { + eventManage.setEventBeginDe(EgovStringUtil.removeMinusChar(eventManage.getEventBeginDe())); + eventManage.setEventEndDe (EgovStringUtil.removeMinusChar(eventManage.getEventEndDe() )); + eventManage.setRceptBeginDe(EgovStringUtil.removeMinusChar(eventManage.getRceptBeginDe())); + eventManage.setRceptEndDe (EgovStringUtil.removeMinusChar(eventManage.getRceptEndDe() )); + + String sEventId = idgenEventService.getNextStringId(); + eventManage.setEventId(sEventId); + eventManageDAO.insertEventManage(eventManage); + } + + /** + * 기 등록된 행사관리정보를 수정한다. + * @param eventManage - 행사관리 model + */ + public void updtEventManage(EventManage eventManage) throws Exception { + eventManage.setEventBeginDe(EgovStringUtil.removeMinusChar(eventManage.getEventBeginDe())); + eventManage.setEventEndDe (EgovStringUtil.removeMinusChar(eventManage.getEventEndDe() )); + eventManage.setRceptBeginDe(EgovStringUtil.removeMinusChar(eventManage.getRceptBeginDe())); + eventManage.setRceptEndDe (EgovStringUtil.removeMinusChar(eventManage.getRceptEndDe() )); + eventManageDAO.updtEventManage(eventManage); + } + + /** + * 기 등록된 행사관리정보를 삭제한다. + * @param eventManage - 행사관리 model + */ + public void deleteEventManage(EventManage eventManage) throws Exception { + eventManageDAO.deleteEventManage(eventManage); + } + +/*** 행사접수관리 ****/ + /** + * 행사접수관리정보를 관리하기 위해 등록된 행사접수관리 목록을 조회한다. + * @param eventManageVO - 행사관리 VO + * @return List - 행사접수관리 목록 + */ + public List selectEventAtdrnList(EventManageVO eventManageVO) throws Exception{ + List result = eventManageDAO.selectEventAtdrnList(eventManageVO); + int num = result.size(); + + for (int i = 0 ; i < num ; i ++ ){ + EventManageVO eventManageVO1 = result.get(i); + eventManageVO1.setEventBeginDe(EgovDateUtil.formatDate(eventManageVO1.getEventBeginDe(), "-")); + eventManageVO1.setEventEndDe (EgovDateUtil.formatDate(eventManageVO1.getEventEndDe() , "-")); + eventManageVO1.setRceptBeginDe(EgovDateUtil.formatDate(eventManageVO1.getRceptBeginDe(), "-")); + eventManageVO1.setRceptEndDe (EgovDateUtil.formatDate(eventManageVO1.getRceptEndDe() , "-")); + result.set(i, eventManageVO1); + } + return result; + } + + /** + * 행사접수관리목록 총 갯수를 조회한다. + * @param eventManageVO - 행사관리 VO + * @return int - 행사접수관리 카운트 수 + */ + public int selectEventAtdrnListTotCnt(EventManageVO eventManageVO) throws Exception { + return eventManageDAO.selectEventAtdrnListTotCnt(eventManageVO); + } + + /** + * 행사접수승인/반려 처리를 위해 등록된 행사접수 목록을 조회한다. + * @param eventManageVO - 행사관리 VO + * @return List - 행사접수승인 목록 + */ + public List selectEventRceptConfmList(EventManageVO eventManageVO) throws Exception{ + List result = eventManageDAO.selectEventRceptConfmList(eventManageVO); + int num = result.size(); + + for (int i = 0 ; i < num ; i ++ ){ + EventManageVO eventManageVO1 = result.get(i); + eventManageVO1.setEventBeginDe(EgovDateUtil.formatDate(eventManageVO1.getEventBeginDe(), "-")); + eventManageVO1.setEventEndDe (EgovDateUtil.formatDate(eventManageVO1.getEventEndDe() , "-")); + result.set(i, eventManageVO1); + } + return result; + } + + /** + * 행사접수승인/반려 처리를 위해 등록된 행사접수 목록 총 갯수를 조회한다. + * @param eventManageVO - 행사관리 VO + * @return int - 행사접수승인 카운트 수 + */ + public int selectEventRceptConfmListTotCnt(EventManageVO eventManageVO) throws Exception { + return eventManageDAO.selectEventRceptConfmListTotCnt(eventManageVO); + } + + /** + * 행사일자, 행사구분 조건에 따른 행사명 목록을 조회한다. + * @param eventManageVO - 행사관리 VO + * @return List - 행사명 목록 + */ + public List selectEventNmList(EventManageVO eventManageVO) throws Exception{ + List result = eventManageDAO.selectEventNmList(eventManageVO); + return result; + } + + + /** + * 등록된 행사접수관리의 상세정보를 조회한다. + * @param eventManageVO - 행사관리 VO + * @return EventManageVO - 행사관리 VO + */ + public EventManageVO selectEventAtdrn(EventManageVO eventManageVO) throws Exception { + return eventManageDAO.selectEventAtdrn(eventManageVO); + } + + /** + * 행사접수관리정보를 신규로 등록한다. + * @param eventManage - 행사접수관리 model + */ + public void insertEventAtdrn(EventAtdrn eventAtdrn) throws Exception { + + /* + * 행사접수 승인처리 신청 infrmlSanctnService.insertInfrmlSanctn("000", vcatnManage); + */ + InfrmlSanctn infrmlSanctn = infrmlSanctnService.insertInfrmlSanctn(converToInfrmlSanctnObject(eventAtdrn)); //신청 + //InfrmlSanctn infrmlSanctn = infrmlSanctnService.insertInfrmlSanctn("004", eventAtdrn); + eventAtdrn.setInfrmlSanctnId(infrmlSanctn.getInfrmlSanctnId()); + eventAtdrn.setConfmAt(infrmlSanctn.getConfmAt()); + eventManageDAO.insertEventAtdrn(eventAtdrn); + } + + /** + * 기 등록된 행사접수관리정보를 삭제한다. + * @param eventManage - 행사접수관리 model + */ + public void deleteEventAtdrn(EventAtdrn eventAtdrn) throws Exception { + eventAtdrn.setReqstDe(EgovStringUtil.removeMinusChar(eventAtdrn.getReqstDe())); + /* + * 행사접수 승인처리 삭제 + */ + infrmlSanctnService.deleteInfrmlSanctn(converToInfrmlSanctnObject(eventAtdrn)); //삭제 + eventManageDAO.deleteEventAtdrn(eventAtdrn); + } + + /** + * 기 등록된 행사접수관리정보를 승인/반려처리한다. + * @param eventManage - 행사접수관리 model + * @param String - 승인/반려정보 + */ + public void updtEventAtdrn(EventAtdrn eventAtdrn, String checkedEventRceptForConfm) throws Exception { + + //MtgPlaceFxtrs mtgPlaceFxtrs; // 2011.8.11 수정분 mtg(회의실관리 컴포넌트)와의 의존성 제거 + //int insertCnt = 0; // 2011.8.11 수정분 + String [] eventRceptValues = checkedEventRceptForConfm.split("[$]"); + String [] sTempEventRcept; + String sTemp=null; + for (int i=0; i selectEventReqstAtdrnList(EventManageVO eventManageVO) throws Exception{ + return eventManageDAO.selectEventReqstAtdrnList(eventManageVO); + } + + /** + * 행사접수자 목록 총 갯수를 조회한다. + * @param eventManageVO - 행사관리 VO + * @return int - 행사관리 카운트 수 + */ + public int selectEventReqstAtdrnListTotCnt(EventManageVO eventManageVO) throws Exception { + return eventManageDAO.selectEventReqstAtdrnListTotCnt(eventManageVO); + } + + /** + * CtsnnManage model을 InfrmlSanctn model로 변환한다. + * @param CtsnnManage + * @return InfrmlSanctn + */ + private InfrmlSanctn converToInfrmlSanctnObject(EventAtdrn eventAtdrn) throws Exception{ + InfrmlSanctn infrmlSanctn = new InfrmlSanctn(); + infrmlSanctn.setJobSeCode("004"); // 업무구분코드 (공통코드 COM75) + infrmlSanctn.setApplcntId(eventAtdrn.getApplcntId()); // 사용자ID + infrmlSanctn.setReqstDe(eventAtdrn.getReqstDe()); // 신청일자 + infrmlSanctn.setSanctnerId(eventAtdrn.getSanctnerId()); // 결재자ID + infrmlSanctn.setConfmAt(eventAtdrn.getConfmAt()); // 승인구분 + infrmlSanctn.setSanctnDt(eventAtdrn.getSanctnDt()); // 결재일시 + infrmlSanctn.setReturnResn(eventAtdrn.getReturnResn()); // 반려사유 + infrmlSanctn.setFrstRegisterId(eventAtdrn.getFrstRegisterId()); + infrmlSanctn.setFrstRegisterPnttm(eventAtdrn.getFrstRegisterId()); + infrmlSanctn.setLastUpdusrId(eventAtdrn.getLastUpdusrId()); + infrmlSanctn.setLastUpdusrPnttm(eventAtdrn.getLastUpdusrPnttm()); + infrmlSanctn.setInfrmlSanctnId(eventAtdrn.getInfrmlSanctnId());// 약식결재ID + return infrmlSanctn; + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/evt/service/impl/EventManageDAO.java b/src/main/java/egovframework/com/uss/ion/evt/service/impl/EventManageDAO.java new file mode 100644 index 0000000..9ff2647 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/evt/service/impl/EventManageDAO.java @@ -0,0 +1,182 @@ +package egovframework.com.uss.ion.evt.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.ion.evt.service.EventAtdrn; +import egovframework.com.uss.ion.evt.service.EventManage; +import egovframework.com.uss.ion.evt.service.EventManageVO; + +import org.springframework.stereotype.Repository; + +/** + * 개요 + * - 행사관리에 대한 DAO 클래스를 정의한다. + * + * 상세내용 + * - 행사관리에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 행사관리의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +@Repository("eventManageDAO") +public class EventManageDAO extends EgovComAbstractDAO { + + /** + * 행사관리정보를 관리하기 위해 등록된 행사관리 목록을 조회한다. + * @param eventManageVO - 행사관리 VO + * @return List - 행사관리 목록 + */ + public List selectEventManageList(EventManageVO eventManageVO) throws Exception { + return selectList("eventManageDAO.selectEventManageList", eventManageVO); + } + + /** + * 행사관리목록 총 갯수를 조회한다. + * @param eventManageVO - 행사관리 VO + * @return int + * @exception Exception + */ + public int selectEventManageListTotCnt(EventManageVO eventManageVO) throws Exception { + return (Integer)selectOne("eventManageDAO.selectEventManageListTotCnt", eventManageVO); + } + + /** + * 등록된 행사관리의 상세정보를 조회한다. + * @param eventManageVO - 행사관리 VO + * @return EventManageVO - 행사관리 VO + */ + public EventManageVO selectEventManage(EventManageVO eventManageVO) throws Exception { + return (EventManageVO) selectOne("eventManageDAO.selectEventManage", eventManageVO); + } + + /** + * 행사관리정보를 신규로 등록한다. + * @param eventManage - 행사관리 model + */ + public void insertEventManage(EventManage eventManage) throws Exception { + insert("eventManageDAO.insertEventManage", eventManage); + } + + /** + * 기 등록된 행사관리정보를 수정한다. + * @param eventManage - 행사관리 model + */ + public void updtEventManage(EventManage eventManage) throws Exception { + update("eventManageDAO.updateEventManage", eventManage); + } + + /** + * 기 등록된 행사관리정보를 삭제한다. + * @param eventManage - 행사관리 model + */ + public void deleteEventManage(EventManage eventManage) throws Exception { + delete("eventManageDAO.deleteEventManage",eventManage); + } + + + /** 행사접수관리 ***/ + /** + * 행사접수정보를 관리하기 위해 등록된 행사관리 목록을 조회한다. + * @param eventManageVO - 행사관리 VO + * @return List - 행사관리 목록 + */ + public List selectEventAtdrnList(EventManageVO eventManageVO) throws Exception { + return selectList("eventManageDAO.selectEventAtdrnList", eventManageVO); + } + + /** + * 행사접수관리목록 총 갯수를 조회한다. + * @param eventManageVO - 행사관리 VO + * @return int + * @exception Exception + */ + public int selectEventAtdrnListTotCnt(EventManageVO eventManageVO) throws Exception { + return (Integer)selectOne("eventManageDAO.selectEventAtdrnListTotCnt", eventManageVO); + } + + /** + * 행사접수승인/반려 처리를 위해 등록된 행사접수 목록을 조회한다. + * @param eventManageVO - 행사관리 VO + * @return List - 행사관리 목록 + */ + public List selectEventRceptConfmList(EventManageVO eventManageVO) throws Exception { + return selectList("eventManageDAO.selectEventRceptConfmList", eventManageVO); + } + + /** + * 행사접수승인/반려 처리를 위해 등록된 행사접수 목록 총 갯수를 조회한다. + * @param eventManageVO - 행사관리 VO + * @return int + * @exception Exception + */ + public int selectEventRceptConfmListTotCnt(EventManageVO eventManageVO) throws Exception { + return (Integer)selectOne("eventManageDAO.selectEventRceptConfmListTotCnt", eventManageVO); + } + + /** + * 행사일자, 행사구분 조건에 따른 행사명 목록을 조회한다. + * @param eventManageVO - 행사관리 VO + * @return List - 행사관리 목록 + */ + public List selectEventNmList(EventManageVO eventManageVO) throws Exception { + return selectList("eventManageDAO.selectEventNmList", eventManageVO); + } + + /** + * 등록된 행사접수관리의 상세정보를 조회한다. + * @param eventManageVO - 행사관리 VO + * @return EventManageVO - 행사관리 VO + */ + public EventManageVO selectEventAtdrn(EventManageVO eventManageVO) throws Exception { + return (EventManageVO) selectOne("eventManageDAO.selectEventAtdrn", eventManageVO); + } + + /** + * 행사접수관리정보를 신규로 등록한다. + * @param eventManage - 행사관리 model + */ + public void insertEventAtdrn(EventAtdrn eventAtdrn) throws Exception { + insert("eventManageDAO.insertEventAtdrn", eventAtdrn); + } + + /** + * 기 등록된 행사접수관리정보를 삭제한다. + * @param eventManage - 행사관리 model + */ + public void deleteEventAtdrn(EventAtdrn eventAtdrn) throws Exception { + delete("eventManageDAO.deleteEventAtdrn",eventAtdrn); + } + + /** + * 기 등록된 행사접수관리정보를 승인처리한다. + * @param eventManage - 행사관리 model + */ + public void updtEventAtdrn(EventAtdrn eventAtdrn) throws Exception { + update("eventManageDAO.updtEventAtdrn", eventAtdrn); + } + + + /** + * 행사접수자 정보를 조회한다. + * @param eventManageVO - 행사관리 VO + * @return List - 행사관리 목록 + */ + + public List selectEventReqstAtdrnList(EventManageVO eventManageVO) throws Exception { + return selectList("eventManageDAO.selectEventReqstAtdrnList", eventManageVO); + } + + /** + * 행사접수자 목록 총 갯수를 조회한다. + * @param eventManageVO - 행사관리 VO + * @return int + * @exception Exception + */ + public int selectEventReqstAtdrnListTotCnt(EventManageVO eventManageVO) throws Exception { + return (Integer)selectOne("eventManageDAO.selectEventReqstAtdrnListTotCnt", eventManageVO); + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/evt/web/EgovEventManageController.java b/src/main/java/egovframework/com/uss/ion/evt/web/EgovEventManageController.java new file mode 100644 index 0000000..1b2b153 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/evt/web/EgovEventManageController.java @@ -0,0 +1,555 @@ +package egovframework.com.uss.ion.evt.web; + +import java.util.List; +import java.util.Map; + +import egovframework.com.cmm.ComDefaultCodeVO; +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.service.EgovCmmUseService; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.ion.evt.service.EgovEventManageService; +import egovframework.com.uss.ion.evt.service.EventAtdrn; +import egovframework.com.uss.ion.evt.service.EventManage; +import egovframework.com.uss.ion.evt.service.EventManageVO; +import egovframework.com.utl.fcc.service.EgovDateUtil; + +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +import javax.annotation.Resource; + +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.springframework.web.bind.support.SessionStatus; +import org.springmodules.validation.commons.DefaultBeanValidator; + +/** + * 개요 + * - 행사관리에 대한 controller 클래스를 정의한다. + * + * 상세내용 + * - 행사관리에 대한 등록, 수정, 삭제, 조회 기능을 제공한다. + * - 행사관리의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2010.6.15	이용          최초 생성
    + *  2011.8.26	정진오			IncludedInfo annotation 추가
    + *
    + *  
    + */ + +@Controller +public class EgovEventManageController { + + + + + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name = "egovEventManageService") + private EgovEventManageService egovEventManageService; + + @Autowired + private DefaultBeanValidator beanValidator; + + @Resource(name="EgovCmmUseService") + private EgovCmmUseService cmmUseService; + + /** + * 행사관리 목록화면 이동 + * @return String + * @exception Exception + */ + @RequestMapping("/uss/ion/evt/EgovEventReqstManageListView.do") + public String selectEventManageListView() throws Exception { + + return "egovframework/com/uss/ion/evt/EgovEventReqstManageList"; + } + + /** + * 행사관리정보를 관리하기 위해 등록된 행사관리 목록을 조회한다. + * @param eventManageVO - 행사관리 VO + * @return String - 리턴 Url + */ + @IncludedInfo(name="행사신청관리", order = 940 ,gid = 50) + @RequestMapping(value="/uss/ion/evt/EgovEventReqstManageList.do") + public String selectEventManageList(@ModelAttribute("eventManageVO") EventManageVO eventManageVO, + ModelMap model) throws Exception { + + //행사년월 + java.util.Calendar cal = java.util.Calendar.getInstance(); + String [] yearList = new String[5]; + for(int x=0; x < 5 ; x++){ + yearList[x] = Integer.toString(cal.get(java.util.Calendar.YEAR)-x); + } + //행사구분 + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM053"); + List eventSeCodeList = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("eventSeCode", eventSeCodeList); + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(eventManageVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(eventManageVO.getPageUnit()); + paginationInfo.setPageSize(eventManageVO.getPageSize()); + + eventManageVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + eventManageVO.setLastIndex(paginationInfo.getLastRecordIndex()); + eventManageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + eventManageVO.setSearchKeyword(eventManageVO.getSearchYear()+eventManageVO.getSearchMonth()); + eventManageVO.setEventManageList(egovEventManageService.selectEventManageList(eventManageVO)); + + model.addAttribute("eventManageList", eventManageVO.getEventManageList()); + + int totCnt = egovEventManageService.selectEventManageListTotCnt(eventManageVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + model.addAttribute("yearList", yearList); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/uss/ion/evt/EgovEventReqstManageList"; + } + + /** + * 등록된 행사관리의 상세정보를 조회한다. + * @param eventManageVO - 행사관리 VO + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/evt/EgovEventReqstDetail.do") + public String selectEventManage( @ModelAttribute("eventManage") EventManageVO eventManage, + @ModelAttribute("eventManageVO") EventManageVO eventManageVO, + @RequestParam Map commandMap, + ModelMap model) throws Exception { + + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); // 상세정보 구분 + EventManageVO eventManageVO1 = egovEventManageService.selectEventManage(eventManageVO); + eventManageVO1.setEventBeginDe( EgovDateUtil.formatDate(eventManageVO1.getEventBeginDe(), "-")); + eventManageVO1.setEventEndDe( EgovDateUtil.formatDate(eventManageVO1.getEventEndDe() , "-")); + eventManageVO1.setRceptBeginDe( EgovDateUtil.formatDate(eventManageVO1.getRceptBeginDe(), "-")); + eventManageVO1.setRceptEndDe( EgovDateUtil.formatDate(eventManageVO1.getRceptEndDe() , "-")); + + model.addAttribute("eventManageVO", eventManageVO1); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + if(sCmd.equals("updt")){ + eventManage.setEventId( eventManageVO1.getEventId() ); + eventManage.setEventSe( eventManageVO1.getEventSe() ); + eventManage.setEventNm( eventManageVO1.getEventNm() ); + eventManage.setEventPurps( eventManageVO1.getEventPurps() ); + eventManage.setEventBeginDe( eventManageVO1.getEventBeginDe() ); + eventManage.setEventEndDe( eventManageVO1.getEventEndDe() ); + eventManage.setEventAuspcInsttNm(eventManageVO1.getEventAuspcInsttNm() ); + eventManage.setEventMngtInsttNm( eventManageVO1.getEventMngtInsttNm() ); + eventManage.setEventPlace( eventManageVO1.getEventPlace() ); + eventManage.setEventCn( eventManageVO1.getEventCn() ); + eventManage.setCtOccrrncAt( eventManageVO1.getCtOccrrncAt() ); + eventManage.setPartcptCt( eventManageVO1.getPartcptCt() ); + eventManage.setPsncpa( eventManageVO1.getPsncpa() ); + eventManage.setRefrnUrl( eventManageVO1.getRefrnUrl() ); + eventManage.setRceptBeginDe( eventManageVO1.getRceptBeginDe() ); + eventManage.setRceptEndDe( eventManageVO1.getRceptEndDe() ); + model.addAttribute("eventManage", eventManage); + return "egovframework/com/uss/ion/evt/EgovEventReqstUpdt"; + }else if(sCmd.equals("popup")){ + model.addAttribute("check_popup", "Y"); + return "egovframework/com/uss/ion/evt/EgovEventReqstDetail"; + }else{ + return "egovframework/com/uss/ion/evt/EgovEventReqstDetail"; + } + } + + /** + * 행사관리 등록 화면으로 이동한다. + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/evt/EgovEventReqstRegist.do") + public String insertViewEventManage( @ModelAttribute("eventManage") EventManageVO eventManage, + @ModelAttribute("eventManageVO") EventManageVO eventManageVO, + ModelMap model ) throws Exception { + + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM053"); + List eventSeCodeList = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("eventSeCode", eventSeCodeList); + + return "egovframework/com/uss/ion/evt/EgovEventReqstRegist"; + } + + /** + * 행사관리정보를 신규로 등록한다. + * @param eventManage - 행사관리 model + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/evt/insertEventManage.do") + public String insertEventManage( @ModelAttribute("eventManage") EventManage eventManage, + @ModelAttribute("eventManageVO") EventManageVO eventManageVO, + BindingResult bindingResult, + SessionStatus status, + ModelMap model) throws Exception { + + beanValidator.validate(eventManage, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + model.addAttribute("eventManageVO", eventManageVO); + return "egovframework/com/uss/ion/evt/EgovEventReqstRegist"; + } else { + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + eventManage.setFrstRegisterId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + status.setComplete(); + egovEventManageService.insertEventManage(eventManage); + model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); + return "forward:/uss/ion/evt/EgovEventReqstManageList.do"; + } + } + + /** + * 기 등록된 행사관리정보를 수정한다. + * @param eventManage - 행사관리 model + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/evt/EgovEventReqstSave.do") + public String updtEventManage( @ModelAttribute("eventManage") EventManage eventManage, + @ModelAttribute("eventManageVO") EventManageVO eventManageVO, + BindingResult bindingResult, + SessionStatus status, + ModelMap model) throws Exception { + + beanValidator.validate(eventManage, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + model.addAttribute("eventManageVO", eventManage); + return "egovframework/com/uss/ion/evt/EgovEventReqstUpdt"; + } else { + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + eventManage.setLastUpdusrId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + status.setComplete(); + egovEventManageService.updtEventManage(eventManage); + return "forward:/uss/ion/evt/EgovEventReqstManageList.do"; + } + } + + /** + * 기 등록된 행사관리정보를 삭제한다. + * @param eventManage - 행사관리 model + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/evt/EgovEventReqstDelete.do") + public String deleteEventManage( @ModelAttribute("eventManage") EventManage eventManage, + SessionStatus status, + ModelMap model) throws Exception { + + egovEventManageService.deleteEventManage(eventManage); + status.setComplete(); + model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); + return "forward:/uss/ion/evt/EgovEventReqstManageList.do"; + } + + + /** 행사접수관리 **/ + /** + * 행사접수관리정보를 관리하기 위해 등록된 행사접수관리 목록을 조회한다. + * @param eventManageVO - 행사관리 VO + * @return String - 리턴 Url + */ + @IncludedInfo(name="행사접수관리", order = 941 ,gid = 50) + @RequestMapping(value="/uss/ion/evt/EgovEventRcrptManageList.do") + public String selectEventAtdrnList(@ModelAttribute("eventManageVO") EventManageVO eventManageVO, + ModelMap model) throws Exception { + + //행사년월 + java.util.Calendar cal = java.util.Calendar.getInstance(); + String [] yearList = new String[5]; + for(int x=0; x < 5 ; x++){ + yearList[x] = Integer.toString(cal.get(java.util.Calendar.YEAR)-x); + } + model.addAttribute("yearList", yearList); + + //행사구분 + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM053"); + List eventSeCodeList = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("eventSeCode", eventSeCodeList); + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(eventManageVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(eventManageVO.getPageUnit()); + paginationInfo.setPageSize(eventManageVO.getPageSize()); + + eventManageVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + eventManageVO.setLastIndex(paginationInfo.getLastRecordIndex()); + eventManageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + eventManageVO.setSearchKeyword(eventManageVO.getSearchYear()+eventManageVO.getSearchMonth()); + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + if (user == null) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + eventManageVO.setApplcntId(user.getUniqId());// 사용자UniqID + eventManageVO.setEventManageList(egovEventManageService.selectEventAtdrnList(eventManageVO)); + model.addAttribute("eventManageList", eventManageVO.getEventManageList()); + + int totCnt = egovEventManageService.selectEventAtdrnListTotCnt(eventManageVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + return "egovframework/com/uss/ion/evt/EgovEventRceptManageList"; + } + + /** + * 등록된 행사접수관리의 상세정보를 조회한다. + * @param eventManageVO - 행사관리 VO + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/evt/EgovEventRcrptDetail.do") + public String selectEventAtdrn( @ModelAttribute("eventAtdrn") EventAtdrn eventAtdrn, + @ModelAttribute("eventManageVO") EventManageVO eventManageVO, + ModelMap model) throws Exception { + EventManageVO eventManageVO1 = egovEventManageService.selectEventAtdrn(eventManageVO); + + eventAtdrn.setEventId( eventManageVO1.getEventId() ); + eventAtdrn.setApplcntId( eventManageVO1.getApplcntId() ); + eventManageVO1.setEventBeginDe( EgovDateUtil.formatDate(eventManageVO1.getEventBeginDe(), "-")); + eventManageVO1.setEventEndDe( EgovDateUtil.formatDate(eventManageVO1.getEventEndDe() , "-")); + eventManageVO1.setRceptBeginDe( EgovDateUtil.formatDate(eventManageVO1.getRceptBeginDe(), "-")); + eventManageVO1.setRceptEndDe( EgovDateUtil.formatDate(eventManageVO1.getRceptEndDe() , "-")); + + model.addAttribute("eventAtdrn", eventAtdrn); + model.addAttribute("eventManageVO", eventManageVO1); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/uss/ion/evt/EgovEventRceptDetail"; + } + + /** + * 행사접수관리 등록 화면으로 이동한다. + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/evt/EgovEventRceptRegist.do") + public String insertViewEventAtdrn( + @ModelAttribute("eventAtdrn") EventAtdrn eventAtdrn, + @ModelAttribute("eventManageVO") EventManageVO eventManageVO, + SessionStatus status, + ModelMap model + ) throws Exception { + EventManageVO eventManageVO1 = egovEventManageService.selectEventManage(eventManageVO); + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + status.setComplete(); + eventAtdrn.setApplcntId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + eventAtdrn.setEventId(eventManageVO1.getEventId()); + eventManageVO1.setEventBeginDe( EgovDateUtil.formatDate(eventManageVO1.getEventBeginDe(), "-")); + eventManageVO1.setEventEndDe( EgovDateUtil.formatDate(eventManageVO1.getEventEndDe() , "-")); + eventManageVO1.setRceptBeginDe( EgovDateUtil.formatDate(eventManageVO1.getRceptBeginDe(), "-")); + eventManageVO1.setRceptEndDe( EgovDateUtil.formatDate(eventManageVO1.getRceptEndDe() , "-")); + eventManageVO1.setEventTemp6((user == null || user.getName() == null) ? "" : user.getName()); + eventManageVO1.setEventTemp7((user == null || user.getOrgnztNm() == null) ? "" : user.getOrgnztNm()); + + model.addAttribute("eventAtdrn", eventAtdrn); + model.addAttribute("eventManageVO", eventManageVO1); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/uss/ion/evt/EgovEventRceptRegist"; + } + + /** + * 행사접수관리정보를 신규로 등록한다. + * @param eventAtdrn - 행사참석자 model + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/evt/insertEventAtdrn.do") + public String insertEventAtdrn( @ModelAttribute("eventAtdrn") EventAtdrn eventAtdrn, + @ModelAttribute("eventManageVO") EventManageVO eventManageVO, + BindingResult bindingResult, + SessionStatus status, + ModelMap model) throws Exception { + + beanValidator.validate(eventAtdrn, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + model.addAttribute("eventManageVO", eventManageVO); + return "forward:/uss/ion/evt/EgovEventRceptRegist.do"; + } else { + EventManageVO eventManageVO_check = new EventManageVO(); + eventManageVO_check = egovEventManageService.selectEventManage(eventManageVO); + if(eventManageVO_check.getPsncpa()> egovEventManageService.selectEventReqstAtdrnListTotCnt(eventManageVO)) + { + java.util.Calendar cal = java.util.Calendar.getInstance(); + + int iYear = cal.get(java.util.Calendar.YEAR); + int iMonth = cal.get(java.util.Calendar.MONTH); + int iDate = cal.get(java.util.Calendar.DATE); + + //검색 설정 + String sSearchDate = ""; + sSearchDate += Integer.toString(iYear); + sSearchDate += Integer.toString(iMonth+1).length() == 1 ? "0" + Integer.toString(iMonth+1) : Integer.toString(iMonth+1); + sSearchDate += Integer.toString(iDate); + eventAtdrn.setReqstDe(sSearchDate);//신청일자 + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + eventAtdrn.setFrstRegisterId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + status.setComplete(); + egovEventManageService.insertEventAtdrn(eventAtdrn); + model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); + + return "forward:/uss/ion/evt/EgovEventRcrptManageList.do"; + }else{ + EventManageVO eventManageVO1 = egovEventManageService.selectEventManage(eventManageVO); + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + status.setComplete(); + eventAtdrn.setApplcntId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + eventAtdrn.setEventId(eventManageVO1.getEventId()); + eventManageVO1.setEventBeginDe( EgovDateUtil.formatDate(eventManageVO1.getEventBeginDe(), "-")); + eventManageVO1.setEventEndDe( EgovDateUtil.formatDate(eventManageVO1.getEventEndDe() , "-")); + eventManageVO1.setRceptBeginDe( EgovDateUtil.formatDate(eventManageVO1.getRceptBeginDe(), "-")); + eventManageVO1.setRceptEndDe( EgovDateUtil.formatDate(eventManageVO1.getRceptEndDe() , "-")); + eventManageVO1.setEventTemp6((user == null || user.getName() == null) ? "" : user.getName()); + eventManageVO1.setEventTemp7((user == null || user.getOrgnztNm() == null) ? "" : user.getOrgnztNm()); + + model.addAttribute("eventAtdrn", eventAtdrn); + model.addAttribute("eventManageVO", eventManageVO1); + model.addAttribute("errMessage", "정원초과"); + + return "egovframework/com/uss/ion/evt/EgovEventRceptRegist"; + } + } + } + + /** + * 기 등록된 행사접수관리정보를 취소한다. + * @param eventManage - 행사관리 model + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/evt/deleteEventAtdrn.do") + public String deleteEventAtdrn( @ModelAttribute("eventAtdrn") EventAtdrn eventAtdrn, + SessionStatus status, + ModelMap model) throws Exception { + + egovEventManageService.deleteEventAtdrn(eventAtdrn); + status.setComplete(); + model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); + return "forward:/uss/ion/evt/EgovEventRcrptManageList.do"; + } + + + /** + * 행사접수승인/반려 처리를 위해 등록된 행사접수 목록을 조회한다. + * @param eventManageVO - 행사관리 VO + * @return String - 리턴 Url + */ + @IncludedInfo(name="행사접수승인관리", order = 942 ,gid = 50) + @RequestMapping(value="/uss/ion/evt/selectEventRceptConfmList.do") + public String selectEventRceptConfmList(@ModelAttribute("eventManageVO") EventManageVO eventManageVO, + @RequestParam Map commandMap, + ModelMap model) throws Exception { + //행사년월 + java.util.Calendar cal = java.util.Calendar.getInstance(); + String [] yearList = new String[5]; + for(int x=0; x < 5 ; x++){ + yearList[x] = Integer.toString(cal.get(java.util.Calendar.YEAR)-x); + } + //행사구분 + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM053"); + List eventSeCodeList = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("eventSeCode", eventSeCodeList); + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(eventManageVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(eventManageVO.getPageUnit()); + paginationInfo.setPageSize(eventManageVO.getPageSize()); + + eventManageVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + eventManageVO.setLastIndex(paginationInfo.getLastRecordIndex()); + eventManageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + if (user == null) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + eventManageVO.setSanctnerId(user.getUniqId());// 승인권자UniqID + + eventManageVO.setSearchKeyword(eventManageVO.getSearchYear()+eventManageVO.getSearchMonth()); + + int totCnt = egovEventManageService.selectEventRceptConfmListTotCnt(eventManageVO); + eventManageVO.setEventManageList(egovEventManageService.selectEventRceptConfmList(eventManageVO)); + model.addAttribute("eventRceptConfmList", eventManageVO.getEventManageList()); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("paginationInfo", paginationInfo); + model.addAttribute("yearList", yearList); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/uss/ion/evt/EgovEventRceptConfm"; + } + + /** + * 기 등록된 행사접수관리정보를 승인/반려처리한다. + * @param eventAtdrn - 행사참석자 model + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/evt/updtEventAtdrn.do") + public String updtEventAtdrn(@RequestParam("checkedEventRceptForConfm") String checkedEventRceptForConfm, + @ModelAttribute("eventAtdrn") EventAtdrn eventAtdrn, + @RequestParam Map commandMap, + SessionStatus status, + ModelMap model) throws Exception { + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); // 상세정보 구분 + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + eventAtdrn.setConfmAt(sCmd); + eventAtdrn.setSanctnerId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + eventAtdrn.setFrstRegisterId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + egovEventManageService.updtEventAtdrn(eventAtdrn, checkedEventRceptForConfm); + return "forward:/uss/ion/evt/selectEventRceptConfmList.do"; + } + + /** + * 행사접수자 정보 목록을 조회한다. + * @param eventManageVO - 행사관리 VO + * @return String - 리턴 Url + */ + //@IncludedInfo(name="행사참가요청자목록", order = 942) + @RequestMapping(value="/uss/ion/evt/EgovEventReqstAtdrnList.do") + public String selectEventReqstAtdrnList(@ModelAttribute("eventManageVO") EventManageVO eventManageVO, + ModelMap model) throws Exception { + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(eventManageVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(eventManageVO.getPageUnit()); + paginationInfo.setPageSize(eventManageVO.getPageSize()); + + eventManageVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + eventManageVO.setLastIndex(paginationInfo.getLastRecordIndex()); + eventManageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + eventManageVO.setEventManageList(egovEventManageService.selectEventReqstAtdrnList(eventManageVO)); + model.addAttribute("eventManageList", eventManageVO.getEventManageList()); + + int totCnt = egovEventManageService.selectEventReqstAtdrnListTotCnt(eventManageVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/uss/ion/evt/EgovEventReqstAtdrnList"; + } + + +} diff --git a/src/main/java/egovframework/com/uss/ion/fbk/service/EgovFacebookConfig.java b/src/main/java/egovframework/com/uss/ion/fbk/service/EgovFacebookConfig.java new file mode 100644 index 0000000..bb2b576 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/fbk/service/EgovFacebookConfig.java @@ -0,0 +1,110 @@ +/* + * Copyright 2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Spring Social Configuration. + * @author Keith Donald + */ +package egovframework.com.uss.ion.fbk.service; + +import egovframework.com.cmm.service.EgovProperties; +import egovframework.com.uss.ion.fbk.service.impl.EgovSimpleConnectionSignUp; + +import javax.annotation.Resource; +import javax.sql.DataSource; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Scope; +import org.springframework.context.annotation.ScopedProxyMode; +import org.springframework.security.crypto.encrypt.Encryptors; +import org.springframework.social.connect.ConnectionFactory; +import org.springframework.social.connect.ConnectionFactoryLocator; +import org.springframework.social.connect.ConnectionRepository; +import org.springframework.social.connect.NotConnectedException; +import org.springframework.social.connect.UsersConnectionRepository; +import org.springframework.social.connect.jdbc.JdbcUsersConnectionRepository; +import org.springframework.social.connect.support.ConnectionFactoryRegistry; +import org.springframework.social.facebook.api.Facebook; +import org.springframework.social.facebook.connect.FacebookConnectionFactory; + +/** + * @Class Name : EgovFacebookConfig.java + * @Description : facebook을 위한 JavaConfig + * @Modification Information + * + * 수정일 수정자 수정내용 + * ----------- -------------------- --------------------------- + * 2014.11.10 표준프레임워크센터 최초 생성 + * @author 표준프레임워크센터 + * @since 2014.11.10 + * @version 3.5 + */ + + +@Configuration +public class EgovFacebookConfig { + + private String facebookId = EgovProperties.getProperty("facebook.appId"); + + private String facebookappSecret = EgovProperties.getProperty("facebook.appSecret"); + + @Resource(name="social.dataSource") + private DataSource dataSource; + + /** + * When a new provider is added to the app, register its {@link ConnectionFactory} here. + * @see FacebookConnectionFactory + */ + @Bean + @Scope(value="singleton", proxyMode=ScopedProxyMode.INTERFACES) + public ConnectionFactoryLocator connectionFactoryLocator() { + ConnectionFactoryRegistry registry = new ConnectionFactoryRegistry(); + registry.addConnectionFactory(new FacebookConnectionFactory(facebookId, facebookappSecret)); + return registry; + } + + /** + * Singleton data access object providing access to connections across all users. + */ + @Bean + @Scope(value="singleton", proxyMode=ScopedProxyMode.INTERFACES) + public UsersConnectionRepository usersConnectionRepository() { + JdbcUsersConnectionRepository repository = new JdbcUsersConnectionRepository(dataSource, + connectionFactoryLocator(), Encryptors.noOpText()); + repository.setConnectionSignUp(new EgovSimpleConnectionSignUp()); + return repository; + } + + /** + * Request-scoped data access object providing access to the current user's connections. + */ + @Bean + @Scope(value="request", proxyMode=ScopedProxyMode.INTERFACES) + public ConnectionRepository connectionRepository() { + FacebookUser user = FacebookSecurityContext.getCurrentUser(); + return usersConnectionRepository().createConnectionRepository(user.getId()); + } + + /** + * A proxy to a request-scoped object representing the current user's primary Facebook account. + * @throws NotConnectedException if the user is not connected to facebook. + */ + @Bean + @Scope(value="request", proxyMode=ScopedProxyMode.INTERFACES) + public Facebook facebook() { + return connectionRepository().getPrimaryConnection(Facebook.class).getApi(); + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/fbk/service/FacebookSecurityContext.java b/src/main/java/egovframework/com/uss/ion/fbk/service/FacebookSecurityContext.java new file mode 100644 index 0000000..1951b60 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/fbk/service/FacebookSecurityContext.java @@ -0,0 +1,62 @@ +/* + * Copyright 2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Simple SecurityContext that stores the currently signed-in connection in a thread local. + * @author Keith Donald + */ +package egovframework.com.uss.ion.fbk.service; + + +/** + * SecurityContext 클래스 + * @author 표준프레임워크센터 + * @since 2014.11.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일     	수정자          		      수정내용
    + *  -----------    --------------------    ---------------------------
    + *  2014.11.10		표준프레임워크센터		      최초 생성
    + *  
    + */ + +public final class FacebookSecurityContext { + + private static final ThreadLocal currentUser = new ThreadLocal(); + + public static FacebookUser getCurrentUser() { + FacebookUser user = currentUser.get(); + if (user == null) { + throw new IllegalStateException("No user is currently signed in"); + } + return user; + } + + public static void setCurrentUser(FacebookUser user) { + currentUser.set(user); + } + + public static boolean userSignedIn() { + return currentUser.get() != null; + } + + public static void remove() { + currentUser.remove(); + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/fbk/service/FacebookUser.java b/src/main/java/egovframework/com/uss/ion/fbk/service/FacebookUser.java new file mode 100644 index 0000000..7c3064c --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/fbk/service/FacebookUser.java @@ -0,0 +1,51 @@ +/* + * Copyright 2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Simple little User model. + * Just stores the user's id for simplicity. + * @author Keith Donald + * + */ +package egovframework.com.uss.ion.fbk.service; + +/** + * facebook userVO 클래스 + * @author 표준프레임워크센터 + * @since 2014.11.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일     	수정자          		      수정내용
    + *  -----------    --------------------    ---------------------------
    + *  2014.11.10		표준프레임워크센터		      최초 생성
    + *  
    + */ + +public final class FacebookUser { + + private final String id; + + public FacebookUser(String id) { + this.id = id; + } + + public String getId() { + return id; + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/fbk/service/impl/EgovSimpleConnectionSignUp.java b/src/main/java/egovframework/com/uss/ion/fbk/service/impl/EgovSimpleConnectionSignUp.java new file mode 100644 index 0000000..73756e0 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/fbk/service/impl/EgovSimpleConnectionSignUp.java @@ -0,0 +1,56 @@ +/* + * Copyright 2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Simple little {@link ConnectionSignUp} command that allocates new userIds in memory. + * Doesn't bother storing a user record in any local database, since this quickstart just stores the user id in a cookie. + * @author Keith Donald + */ +package egovframework.com.uss.ion.fbk.service.impl; + +import java.util.concurrent.atomic.AtomicLong; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import org.springframework.social.connect.Connection; +import org.springframework.social.connect.ConnectionSignUp; +import org.springframework.stereotype.Service; + +/** + * facebook 설정 클래스 + * @author 표준프레임워크센터 + * @since 2014.11.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일     	수정자          		      수정내용
    + *  -----------    --------------------    ---------------------------
    + *  2014.11.10		표준프레임워크센터		      최초 생성
    + *  
    + */ + +@Service +public final class EgovSimpleConnectionSignUp extends EgovAbstractServiceImpl implements ConnectionSignUp { + + private final AtomicLong userIdSequence = new AtomicLong(); + + @Override + public String execute(Connection connection) { + return Long.toString(userIdSequence.incrementAndGet()); + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/fbk/web/EgovFacebookController.java b/src/main/java/egovframework/com/uss/ion/fbk/web/EgovFacebookController.java new file mode 100644 index 0000000..4cc494c --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/fbk/web/EgovFacebookController.java @@ -0,0 +1,133 @@ +/* + * Copyright 2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Simple little @Controller that invokes Facebook and renders the result. + * The injected {@link Facebook} reference is configured with the required authorization credentials for the current user behind the scenes. + * @author Keith Donald + */ +package egovframework.com.uss.ion.fbk.web; + +import javax.inject.Inject; + +import org.springframework.social.connect.Connection; +import org.springframework.social.connect.ConnectionRepository; +import org.springframework.social.facebook.api.Facebook; +import org.springframework.social.facebook.api.User; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +import egovframework.com.cmm.annotation.IncludedInfo; + +/** + * Facebook을 처리하는 Controller Class 구현 + * @author 표준프레임워크센터 + * @since 2014.11.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일     	수정자          		      수정내용
    + *  -----------    --------------------    ---------------------------
    + *  2014.11.10		표준프레임워크센터		      최초 생성
    + *  2018.10.02		신용호		      profile 호출 수정
    + *  
    + */ +@Controller +public class EgovFacebookController { + + private final Facebook facebook; + + @Inject + public EgovFacebookController(Facebook facebook) { + this.facebook = facebook; + } + + @Inject + private ConnectionRepository connectionRepository; + + /** + * facebook 연동을 위한 목록을 보여준다. + * @return String - 리턴 Url + */ + @IncludedInfo(name="Facebook 연동",order = 831 ,gid = 50) + @RequestMapping(value = "/uss/ion/fbk/facebook.do", method = RequestMethod.GET) + public String home() { + return "egovframework/com/uss/ion/fbk/EgovFacebookHome"; + } + + /** + * facebook 담벼락 목록을 보여준다. + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/fbk/feed.do", method=RequestMethod.GET) + public String showFeed(Model model) { + model.addAttribute("feed", facebook.feedOperations().getFeed()); + return "egovframework/com/uss/ion/fbk/EgovFacebookFeed"; + } + + /** + * facebook 담벼락 내용을 입력한다. + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/fbk/feed.do", method=RequestMethod.POST) + public String postUpdate(String message) { + facebook.feedOperations().updateStatus(message); + return "redirect:/uss/ion/fbk/feed.do"; + } + + /** + * facebook 앨범 목록을 보여준다. + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/fbk/albums.do", method=RequestMethod.GET) + public String showAlbums(Model model) { + model.addAttribute("albums", facebook.mediaOperations().getAlbums()); + return "egovframework/com/uss/ion/fbk/EgovFacebookAlbums"; + } + + /** + * facebook 앨범을 보여준다. + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/fbk/album/{albumId}", method=RequestMethod.GET) + public String showAlbum(@PathVariable("albumId") String albumId, Model model) { + model.addAttribute("album", facebook.mediaOperations().getAlbum(albumId)); + model.addAttribute("photos", facebook.mediaOperations().getPhotos(albumId)); + return "egovframework/com/uss/ion/fbk/EgovFacebookAlbum"; + } + + /** + * facebook profile을 보여준다. + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/fbk/profile.do", method=RequestMethod.GET) + public String profile(Model model) { + Connection connection = connectionRepository.findPrimaryConnection(Facebook.class); + if (connection == null) { + return "redirect:/connect/facebook"; + } + //model.addAttribute("profile", connection.getApi().userOperations().getUserProfile()); + String [] fields = { "id", "email", "first_name", "last_name" }; + User userProfile = facebook.fetchObject("me", User.class, fields); + model.addAttribute("profile", userProfile); + return "egovframework/com/uss/ion/fbk/EgovFacebookProfile"; + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/fbk/web/FacebookSimpleSignInAdapter.java b/src/main/java/egovframework/com/uss/ion/fbk/web/FacebookSimpleSignInAdapter.java new file mode 100644 index 0000000..7a1b6ea --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/fbk/web/FacebookSimpleSignInAdapter.java @@ -0,0 +1,63 @@ +/* + * Copyright 2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Signs the user in by setting the currentUser property on the {@link SecurityContext}. + * Remembers the sign-in after the current request completes by storing the user's id in a cookie. + * This is cookie is read in {@link UserInterceptor#preHandle(HttpServletRequest, HttpServletResponse, Object)} on subsequent requests. + * @author Keith Donald + * @see UserInterceptor + * + */ +package egovframework.com.uss.ion.fbk.web; + +import javax.servlet.http.HttpServletResponse; + +import org.springframework.social.connect.Connection; +import org.springframework.social.connect.web.SignInAdapter; +import org.springframework.web.context.request.NativeWebRequest; + +import egovframework.com.uss.ion.fbk.service.FacebookSecurityContext; +import egovframework.com.uss.ion.fbk.service.FacebookUser; + +/** + * facebook 연동 로그인 클래스 + * @author 표준프레임워크센터 + * @since 2014.11.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일     	수정자          		      수정내용
    + *  -----------    --------------------    ---------------------------
    + *  2014.11.10		표준프레임워크센터		      최초 생성
    + *  
    + */ + +public final class FacebookSimpleSignInAdapter implements SignInAdapter { + + private final FacebookUserCookieGenerator userCookieGenerator = new FacebookUserCookieGenerator(); + + @Override + public String signIn(String userId, Connection connection, NativeWebRequest request) { + FacebookSecurityContext.setCurrentUser(new FacebookUser(userId)); + if (userCookieGenerator != null) { + userCookieGenerator.addCookie(userId, request.getNativeResponse(HttpServletResponse.class)); + } + return null; + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/fbk/web/FacebookUserCookieGenerator.java b/src/main/java/egovframework/com/uss/ion/fbk/web/FacebookUserCookieGenerator.java new file mode 100644 index 0000000..0fd9e07 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/fbk/web/FacebookUserCookieGenerator.java @@ -0,0 +1,73 @@ +/* + * Copyright 2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Utility class for managing the quick_start user cookie that remembers the signed-in user. + * @author Keith Donald + * + */ +package egovframework.com.uss.ion.fbk.web; + +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.web.util.CookieGenerator; + +/** + * facebook Cookie관리 클래스 + * @author 표준프레임워크센터 + * @since 2014.11.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일     	수정자          		      수정내용
    + *  -----------    --------------------    ---------------------------
    + *  2014.11.10		표준프레임워크센터		      최초 생성
    + *  
    + */ + +final class FacebookUserCookieGenerator { + + private final CookieGenerator userCookieGenerator = new CookieGenerator(); + + public FacebookUserCookieGenerator() { + userCookieGenerator.setCookieName("social_user"); + } + + public void addCookie(String userId, HttpServletResponse response) { + userCookieGenerator.addCookie(response, userId); + } + + public void removeCookie(HttpServletResponse response) { + userCookieGenerator.addCookie(response, ""); + } + + public String readCookieValue(HttpServletRequest request) { + Cookie[] cookies = request.getCookies(); + if (cookies == null) { + return null; + } + for (Cookie cookie : cookies) { + if (cookie.getName().equals(userCookieGenerator.getCookieName())) { + return cookie.getValue(); + } + } + return null; + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/fbk/web/FacebookUserInterceptor.java b/src/main/java/egovframework/com/uss/ion/fbk/web/FacebookUserInterceptor.java new file mode 100644 index 0000000..0f027c0 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/fbk/web/FacebookUserInterceptor.java @@ -0,0 +1,112 @@ +/* + * Copyright 2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Before a request is handled: + * 1. sets the current User in the {@link SecurityContext} from a cookie, if present and the user is still connected to Facebook. + * 2. requires that the user sign-in if he or she hasn't already. + * @author Keith Donald + */ +package egovframework.com.uss.ion.fbk.web; + +import egovframework.com.uss.ion.fbk.service.FacebookSecurityContext; +import egovframework.com.uss.ion.fbk.service.FacebookUser; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.social.connect.UsersConnectionRepository; +import org.springframework.social.facebook.api.Facebook; +import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; +import org.springframework.web.servlet.view.RedirectView; + +/** + * facebook 연결을 확인하는 인터셉터 클래스 + * @author 표준프레임워크센터 + * @since 2014.11.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일     	수정자          		      수정내용
    + *  -----------    --------------------    ---------------------------
    + *  2014.11.10		표준프레임워크센터		      최초 생성
    + *  
    + */ + +public final class FacebookUserInterceptor extends HandlerInterceptorAdapter { + + private final UsersConnectionRepository connectionRepository; + + private final FacebookUserCookieGenerator userCookieGenerator = new FacebookUserCookieGenerator(); + + public FacebookUserInterceptor(UsersConnectionRepository connectionRepository) { + this.connectionRepository = connectionRepository; + } + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { + rememberUser(request, response); + handleSignOut(request, response); + if (FacebookSecurityContext.userSignedIn() || requestForSignIn(request)) { + return true; + } else { + return requireSignIn(request, response); + } + } + + @Override + public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { + FacebookSecurityContext.remove(); + } + + // internal helpers + + private void rememberUser(HttpServletRequest request, HttpServletResponse response) { + String userId = userCookieGenerator.readCookieValue(request); + if (userId == null || userId == "") { + return; + } + if (!userNotFound(userId)) { + userCookieGenerator.removeCookie(response); + return; + } + FacebookSecurityContext.setCurrentUser(new FacebookUser(userId)); + } + + private void handleSignOut(HttpServletRequest request, HttpServletResponse response) { + if (FacebookSecurityContext.userSignedIn() && request.getServletPath().startsWith("/uss/ion/fbk/facebookSignout.do")) { + connectionRepository.createConnectionRepository(FacebookSecurityContext.getCurrentUser().getId()).removeConnections("facebook"); + userCookieGenerator.removeCookie(response); + FacebookSecurityContext.remove(); + } + } + + private boolean requestForSignIn(HttpServletRequest request) { + return request.getServletPath().startsWith("/uss/ion/fbk/facebookSignin.do"); + } + + private boolean requireSignIn(HttpServletRequest request, HttpServletResponse response) throws Exception { + new RedirectView("/uss/ion/fbk/facebookSignin.do", true).render(null, request, response); + return false; + } + + private boolean userNotFound(String userId) { + // doesn't bother checking a local user database: simply checks if the userId is connected to Facebook + return connectionRepository.createConnectionRepository(userId).findPrimaryConnection(Facebook.class) != null; + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/isg/service/EgovIntnetSvcGuidanceService.java b/src/main/java/egovframework/com/uss/ion/isg/service/EgovIntnetSvcGuidanceService.java new file mode 100644 index 0000000..eb3d41a --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/isg/service/EgovIntnetSvcGuidanceService.java @@ -0,0 +1,65 @@ +/** + * 개요 + * - 인터넷서비스안내에 대한 Service Interface를 정의한다. + * + * 상세내용 + * - 인터넷서비스안내에 대한 등록, 수정, 삭제, 조회 기능을 제공한다. + * - 인터넷서비스안내의 조회기능은 목록조회, 상세조회로 구분된다. + * @author lee.m.j + * @version 1.0 + * @created 03-8-2009 오후 2:08:03 + */ + +package egovframework.com.uss.ion.isg.service; + +import java.util.List; + +public interface EgovIntnetSvcGuidanceService { + + /** + * 인터넷서비스안내정보를 관리하기 위해 등록된 인터넷서비스안내 목록을 조회한다. + * @param intnetSvcGuidanceVO - 인터넷서비스안내 VO + * @return List - 인터넷서비스안내 목록 + */ + public List selectIntnetSvcGuidanceList(IntnetSvcGuidanceVO intnetSvcGuidanceVO) throws Exception; + + /** + * 인터넷서비스안내목록 총 갯수를 조회한다. + * @param mainImageVO - 인터넷서비스안내 VO + * @return int + */ + public int selectIntnetSvcGuidanceListTotCnt(IntnetSvcGuidanceVO intnetSvcGuidanceVO) throws Exception; + + /** + * 등록된 인터넷서비스안내의 상세정보를 조회한다. + * @param intnetSvcGuidanceVO - 인터넷서비스안내 VO + * @return IntnetSvcGuidanceVO - 인터넷서비스안내 VO + */ + public IntnetSvcGuidanceVO selectIntnetSvcGuidance(IntnetSvcGuidanceVO intnetSvcGuidanceVO) throws Exception; + + /** + * 인터넷서비스안내정보를 신규로 등록한다. + * @param intnetSvcGuidance - 인터넷서비스안내 model + */ + public IntnetSvcGuidanceVO insertIntnetSvcGuidance(IntnetSvcGuidance intnetSvcGuidance, IntnetSvcGuidanceVO intnetSvcGuidanceVO) throws Exception; + + /** + * 기 등록된 인터넷서비스안내정보를 수정한다. + * @param intnetSvcGuidance - 인터넷서비스안내 model + */ + public void updateIntnetSvcGuidance(IntnetSvcGuidance intnetSvcGuidance) throws Exception; + + /** + * 기 등록된 인터넷서비스안내정보를 삭제한다. + * @param intnetSvcGuidance - 인터넷서비스안내 model + */ + public void deleteIntnetSvcGuidance(IntnetSvcGuidance intnetSvcGuidance) throws Exception; + + /** + * 인터넷서비스안내정보 적용결과를 조회한다. + * @param intnetSvcGuidanceVO - 인터넷서비스안내 VO + * @return List - 인터넷서비스안내 목록 + */ + public List selectIntnetSvcGuidanceResult(IntnetSvcGuidanceVO intnetSvcGuidanceVO) throws Exception; + +} diff --git a/src/main/java/egovframework/com/uss/ion/isg/service/IntnetSvcGuidance.java b/src/main/java/egovframework/com/uss/ion/isg/service/IntnetSvcGuidance.java new file mode 100644 index 0000000..174f6de --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/isg/service/IntnetSvcGuidance.java @@ -0,0 +1,120 @@ +/** + * 개요 + * - 인터넷서비스안내에 대한 model 클래스를 정의한다. + * + * 상세내용 + * - 인터넷서비스안내의 일련번호, 인터넷서비스명, 인터넷서비스설명, 반영여부 항목을 관리한다. + * @author lee.m.j + * @version 1.0 + * @created 03-8-2009 오후 2:08:51 + */ + +package egovframework.com.uss.ion.isg.service; + +import egovframework.com.cmm.ComDefaultVO; + +public class IntnetSvcGuidance extends ComDefaultVO { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + /** + * 인터넷서비스ID + */ + private String intnetSvcId; + /** + * 인터넷서비스명 + */ + private String intnetSvcNm; + /** + * 인터넷서비스설명 + */ + private String intnetSvcDc; + /** + * 반영여부 + */ + private String reflctAt; + /** + * 사용자 ID + */ + private String userId; + /** + * 등록일자 + */ + private String regDate; + + /** + * @return the intnetSvcId + */ + public String getIntnetSvcId() { + return intnetSvcId; + } + /** + * @param intnetSvcId the intnetSvcId to set + */ + public void setIntnetSvcId(String intnetSvcId) { + this.intnetSvcId = intnetSvcId; + } + /** + * @return the intnetSvcNm + */ + public String getIntnetSvcNm() { + return intnetSvcNm; + } + /** + * @param intnetSvcNm the intnetSvcNm to set + */ + public void setIntnetSvcNm(String intnetSvcNm) { + this.intnetSvcNm = intnetSvcNm; + } + /** + * @return the intnetSvcDc + */ + public String getIntnetSvcDc() { + return intnetSvcDc; + } + /** + * @param intnetSvcDc the intnetSvcDc to set + */ + public void setIntnetSvcDc(String intnetSvcDc) { + this.intnetSvcDc = intnetSvcDc; + } + /** + * @return the reflctAt + */ + public String getReflctAt() { + return reflctAt; + } + /** + * @param reflctAt the reflctAt to set + */ + public void setReflctAt(String reflctAt) { + this.reflctAt = reflctAt; + } + /** + * @return the userId + */ + public String getUserId() { + return userId; + } + /** + * @param userId the userId to set + */ + public void setUserId(String userId) { + this.userId = userId; + } + /** + * @return the regDate + */ + public String getRegDate() { + return regDate; + } + /** + * @param regDate the regDate to set + */ + public void setRegDate(String regDate) { + this.regDate = regDate; + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/isg/service/IntnetSvcGuidanceVO.java b/src/main/java/egovframework/com/uss/ion/isg/service/IntnetSvcGuidanceVO.java new file mode 100644 index 0000000..33b3493 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/isg/service/IntnetSvcGuidanceVO.java @@ -0,0 +1,58 @@ +/** + * 개요 + * - 인터넷서비스안내에 대한 VO 클래스를 정의한다. + * + * 상세내용 + * - 인터넷서비스안내의 목록 항목을 관리한다. + * @author lee.m.j + * @version 1.0 + * @created 03-8-2009 오후 2:08:52 + */ + +package egovframework.com.uss.ion.isg.service; + +import java.util.List; + +public class IntnetSvcGuidanceVO extends IntnetSvcGuidance { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + /** + * 인터넷서비스 목록 + */ + List intnetSvcGuidanceList; + /** + * 삭제여부 + */ + String [] delYn; + + /** + * @return the intnetSvcGuidanceList + */ + public List getIntnetSvcGuidanceList() { + return intnetSvcGuidanceList; + } + /** + * @param intnetSvcGuidanceList the intnetSvcGuidanceList to set + */ + public void setIntnetSvcGuidanceList( + List intnetSvcGuidanceList) { + this.intnetSvcGuidanceList = intnetSvcGuidanceList; + } + /** + * @return the delYn + */ + public String[] getDelYn() { + return delYn; + } + /** + * @param delYn the delYn to set + */ + public void setDelYn(String[] delYn) { + this.delYn = delYn; + } + + +} diff --git a/src/main/java/egovframework/com/uss/ion/isg/service/impl/EgovIntnetSvcGuidanceServiceImpl.java b/src/main/java/egovframework/com/uss/ion/isg/service/impl/EgovIntnetSvcGuidanceServiceImpl.java new file mode 100644 index 0000000..90535e8 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/isg/service/impl/EgovIntnetSvcGuidanceServiceImpl.java @@ -0,0 +1,93 @@ +/** + * 개요 + * - 인터넷서비스안내에 대한 ServiceImpl 클래스를 정의한다. + * + * 상세내용 + * - 인터넷서비스안내에 대한 등록, 수정, 삭제, 조회 기능을 제공한다. + * - 인터넷서비스안내의 조회기능은 목록조회, 상세조회로 구분된다. + * @author lee.m.j + * @version 1.0 + * @created 03-8-2009 오후 2:08:03 + */ + +package egovframework.com.uss.ion.isg.service.impl; + +import java.util.List; + +import egovframework.com.uss.ion.isg.service.EgovIntnetSvcGuidanceService; +import egovframework.com.uss.ion.isg.service.IntnetSvcGuidance; +import egovframework.com.uss.ion.isg.service.IntnetSvcGuidanceVO; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +@Service("egovIntnetSvcGuidanceService") +public class EgovIntnetSvcGuidanceServiceImpl extends EgovAbstractServiceImpl implements EgovIntnetSvcGuidanceService { + + @Resource(name="intnetSvcGuidanceDAO") + private IntnetSvcGuidanceDAO intnetSvcGuidanceDAO; + + /** + * 인터넷서비스안내정보를 관리하기 위해 등록된 인터넷서비스안내 목록을 조회한다. + * @param intnetSvcGuidanceVO - 인터넷서비스안내 VO + * @return List - 인터넷서비스안내 목록 + */ + public List selectIntnetSvcGuidanceList(IntnetSvcGuidanceVO intnetSvcGuidanceVO) throws Exception{ + return intnetSvcGuidanceDAO.selectIntnetSvcGuidanceList(intnetSvcGuidanceVO); + } + + /** + * 인터넷서비스안내목록 총 갯수를 조회한다. + * @param mainImageVO - 인터넷서비스안내 VO + * @return int + */ + public int selectIntnetSvcGuidanceListTotCnt(IntnetSvcGuidanceVO intnetSvcGuidanceVO) throws Exception { + return intnetSvcGuidanceDAO.selectIntnetSvcGuidanceListTotCnt(intnetSvcGuidanceVO); + } + + /** + * 등록된 인터넷서비스안내의 상세정보를 조회한다. + * @param intnetSvcGuidanceVO - 인터넷서비스안내 Vo + * @return IntnetSvcGuidanceVO - 인터넷서비스안내 Vo + */ + public IntnetSvcGuidanceVO selectIntnetSvcGuidance(IntnetSvcGuidanceVO intnetSvcGuidanceVO) throws Exception { + return intnetSvcGuidanceDAO.selectIntnetSvcGuidance(intnetSvcGuidanceVO); + } + + /** + * 인터넷서비스안내정보를 신규로 등록한다. + * @param intnetSvcGuidance - 인터넷서비스안내 model + */ + public IntnetSvcGuidanceVO insertIntnetSvcGuidance(IntnetSvcGuidance intnetSvcGuidance, IntnetSvcGuidanceVO intnetSvcGuidanceVO) throws Exception { + intnetSvcGuidanceDAO.insertIntnetSvcGuidance(intnetSvcGuidance); + return selectIntnetSvcGuidance(intnetSvcGuidanceVO); + } + + /** + * 기 등록된 인터넷서비스안내정보를 수정한다. + * @param intnetSvcGuidance - 인터넷서비스안내 model + */ + public void updateIntnetSvcGuidance(IntnetSvcGuidance intnetSvcGuidance) throws Exception { + intnetSvcGuidanceDAO.updateIntnetSvcGuidance(intnetSvcGuidance); + } + + /** + * 기 등록된 인터넷서비스안내정보를 삭제한다. + * @param intnetSvcGuidance - 인터넷서비스안내 model + */ + public void deleteIntnetSvcGuidance(IntnetSvcGuidance intnetSvcGuidance) throws Exception{ + intnetSvcGuidanceDAO.deleteIntnetSvcGuidance(intnetSvcGuidance); + } + + /** + * 인터넷서비스안내정보 적용결과를 조회한다. + * @param intnetSvcGuidanceVO - 인터넷서비스안내 VO + * @return List - 인터넷서비스안내 목록 + */ + public List selectIntnetSvcGuidanceResult(IntnetSvcGuidanceVO intnetSvcGuidanceVO) throws Exception { + return intnetSvcGuidanceDAO.selectIntnetSvcGuidanceResult(intnetSvcGuidanceVO); + } +} diff --git a/src/main/java/egovframework/com/uss/ion/isg/service/impl/IntnetSvcGuidanceDAO.java b/src/main/java/egovframework/com/uss/ion/isg/service/impl/IntnetSvcGuidanceDAO.java new file mode 100644 index 0000000..d7dbe0b --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/isg/service/impl/IntnetSvcGuidanceDAO.java @@ -0,0 +1,85 @@ +/** + * 개요 + * - 인터넷서비스안내에 대한 DAO 클래스를 정의한다. + * + * 상세내용 + * - 인터넷서비스안내에 대한 등록, 수정, 삭제, 조회 기능을 제공한다. + * - 인터넷서비스안내의 조회기능은 목록조회, 상세조회로 구분된다. + * @author lee.m.j + * @version 1.0 + * @created 03-8-2009 오후 2:08:52 + */ + +package egovframework.com.uss.ion.isg.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.ion.isg.service.IntnetSvcGuidance; +import egovframework.com.uss.ion.isg.service.IntnetSvcGuidanceVO; + +import org.springframework.stereotype.Repository; + +@Repository("intnetSvcGuidanceDAO") +public class IntnetSvcGuidanceDAO extends EgovComAbstractDAO { + + /** + * 인터넷서비스안내정보를 관리하기 위해 등록된 인터넷서비스안내 목록을 조회한다. + * @param intnetSvcGuidanceVO - 인터넷서비스안내 VO + * @return List - 인터넷서비스안내 목록 + */ + public List selectIntnetSvcGuidanceList(IntnetSvcGuidanceVO intnetSvcGuidanceVO) throws Exception { + return selectList("intnetSvcGuidanceDAO.selectIntnetSvcGuidanceList", intnetSvcGuidanceVO); + } + + /** + * 인터넷서비스안내목록 총 갯수를 조회한다. + * @param mainImageVO - 인터넷서비스안내 VO + * @return int + */ + public int selectIntnetSvcGuidanceListTotCnt(IntnetSvcGuidanceVO intnetSvcGuidanceVO) throws Exception { + return (Integer)selectOne("intnetSvcGuidanceDAO.selectIntnetSvcGuidanceListTotCnt", intnetSvcGuidanceVO); + } + + /** + * 등록된 인터넷서비스안내의 상세정보를 조회한다. + * @param intnetSvcGuidanceVO - 인터넷서비스안내 VO + * @return IntnetSvcGuidanceVO - 인터넷서비스안내 VO + */ + public IntnetSvcGuidanceVO selectIntnetSvcGuidance(IntnetSvcGuidanceVO intnetSvcGuidanceVO) throws Exception { + return (IntnetSvcGuidanceVO) selectOne("intnetSvcGuidanceDAO.selectIntnetSvcGuidance", intnetSvcGuidanceVO); + } + + /** + * 인터넷서비스안내정보를 신규로 등록한다. + * @param intnetSvcGuidance - 인터넷서비스안내 model + */ + public void insertIntnetSvcGuidance(IntnetSvcGuidance intnetSvcGuidance) throws Exception { + insert("intnetSvcGuidanceDAO.insertIntnetSvcGuidance", intnetSvcGuidance); + } + + /** + * 기 등록된 인터넷서비스안내정보를 수정한다. + * @param intnetSvcGuidance - 인터넷서비스안내 model + */ + public void updateIntnetSvcGuidance(IntnetSvcGuidance intnetSvcGuidance) throws Exception { + update("intnetSvcGuidanceDAO.updateIntnetSvcGuidance", intnetSvcGuidance); + } + + /** + * 기 등록된 인터넷서비스안내정보를 삭제한다. + * @param intnetSvcGuidance - 인터넷서비스안내 model + */ + public void deleteIntnetSvcGuidance(IntnetSvcGuidance intnetSvcGuidance) throws Exception { + delete("intnetSvcGuidanceDAO.deleteIntnetSvcGuidance", intnetSvcGuidance); + } + + /** + * 인터넷서비스안내정보 적용결과를 조회한다. + * @param intnetSvcGuidanceVO - 인터넷서비스안내 VO + * @return List - 인터넷서비스안내 목록 + */ + public List selectIntnetSvcGuidanceResult(IntnetSvcGuidanceVO intnetSvcGuidanceVO) throws Exception { + return selectList("intnetSvcGuidanceDAO.selectIntnetSvcGuidanceResult", intnetSvcGuidanceVO); + } +} diff --git a/src/main/java/egovframework/com/uss/ion/isg/web/EgovIntnetSvcGuidanceController.java b/src/main/java/egovframework/com/uss/ion/isg/web/EgovIntnetSvcGuidanceController.java new file mode 100644 index 0000000..db4d327 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/isg/web/EgovIntnetSvcGuidanceController.java @@ -0,0 +1,232 @@ +/** + * 개요 + * - 인터넷서비스안내에 대한 controller 클래스를 정의한다. + * + * + * 상세내용 + * - 인터넷서비스안내에 대한 등록, 수정, 삭제, 조회 기능을 제공한다. + * - 인터넷서비스안내의 조회기능은 목록조회, 상세조회로 구분된다. + * @author lee.m.j + * @version 1.0 + * @created 03-8-2009 오후 2:08:02 + *
    + * << 개정이력(Modification Information) >>
    + * 
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2010.8.3	lee.m.j          최초 생성 
    + *  2011.8.26	정진오			IncludedInfo annotation 추가
    + *  
    + *  
    + */ + +package egovframework.com.uss.ion.isg.web; + +import java.util.List; + +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.ion.isg.service.EgovIntnetSvcGuidanceService; +import egovframework.com.uss.ion.isg.service.IntnetSvcGuidance; +import egovframework.com.uss.ion.isg.service.IntnetSvcGuidanceVO; +import egovframework.com.utl.fcc.service.EgovStringUtil; + +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +import javax.annotation.Resource; + +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; + + +@Controller +public class EgovIntnetSvcGuidanceController { + + + + + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name = "egovIntnetSvcGuidanceService") + private EgovIntnetSvcGuidanceService egovIntnetSvcGuidanceService; + + /** Message ID Generation */ + @Resource(name="egovIntnetSvcGuidanceIdGnrService") + private EgovIdGnrService egovIntnetSvcGuidanceIdGnrService; + + @Autowired + private DefaultBeanValidator beanValidator; + + /** + * 인터넷서비스안내 목록화면 이동 + * @return String + * @exception Exception + */ + @RequestMapping("/uss/ion/isg/selectIntnetSvcGuidanceListView.do") + public String selectIntnetSvcGuidanceListView() throws Exception { + + return "egovframework/com/uss/ion/isg/EgovIntnetSvcGuidanceList"; + } + + /** + * 인터넷서비스안내정보를 관리하기 위해 등록된 인터넷서비스안내 목록을 조회한다. + * @param intnetSvcGuidanceVO - 인터넷서비스안내 VO + * @return String - 리턴 Url + */ + @IncludedInfo(name="인터넷서비스안내및관리", order = 800 ,gid = 50) + @RequestMapping("/uss/ion/isg/selectIntnetSvcGuidanceList.do") + public String selectIntnetSvcGuidanceList(@ModelAttribute("intnetSvcGuidanceVO") IntnetSvcGuidanceVO intnetSvcGuidanceVO, + ModelMap model ) throws Exception { + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(intnetSvcGuidanceVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(intnetSvcGuidanceVO.getPageUnit()); + paginationInfo.setPageSize(intnetSvcGuidanceVO.getPageSize()); + + intnetSvcGuidanceVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + intnetSvcGuidanceVO.setLastIndex(paginationInfo.getLastRecordIndex()); + intnetSvcGuidanceVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + intnetSvcGuidanceVO.setIntnetSvcGuidanceList(egovIntnetSvcGuidanceService.selectIntnetSvcGuidanceList(intnetSvcGuidanceVO)); + + model.addAttribute("intnetSvcGuidanceList", intnetSvcGuidanceVO.getIntnetSvcGuidanceList()); + + int totCnt = egovIntnetSvcGuidanceService.selectIntnetSvcGuidanceListTotCnt(intnetSvcGuidanceVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/uss/ion/isg/EgovIntnetSvcGuidanceList"; + } + + /** + * 등록된 인터넷서비스안내의 상세정보를 조회한다. + * @param intnetSvcGuidanceVO - 인터넷서비스안내 VO + * @return String - 리턴 Url + */ + @RequestMapping("/uss/ion/isg/getIntnetSvcGuidance.do") + public String selectIntnetSvcGuidance(@RequestParam("intnetSvcId") String intnetSvcId, + @ModelAttribute("intnetSvcGuidanceVO") IntnetSvcGuidanceVO intnetSvcGuidanceVO, + ModelMap model) throws Exception { + + intnetSvcGuidanceVO.setIntnetSvcId(intnetSvcId); + model.addAttribute("intnetSvcGuidance", egovIntnetSvcGuidanceService.selectIntnetSvcGuidance(intnetSvcGuidanceVO)); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/uss/ion/isg/EgovIntnetSvcGuidanceUpdt"; + } + + /** + * 인터넷서비스안내정보를 신규 등록을 위해 등록화면으로 이동한다. + * @return String - 리턴 Url + */ + @RequestMapping("/uss/ion/isg/addViewIntnetSvcGuidance.do") + public String insertIntnetSvcGuidanceView(@ModelAttribute("intnetSvcGuidanceVO") IntnetSvcGuidanceVO intnetSvcGuidanceVO) throws Exception { + + return "egovframework/com/uss/ion/isg/EgovIntnetSvcGuidanceRegist"; + } + + /** + * 인터넷서비스안내정보를 신규로 등록한다. + * @param intnetSvcGuidance - 인터넷서비스안내 model + * @return String - 리턴 Url + */ + @RequestMapping("/uss/ion/isg/addIntnetSvcGuidance.do") + public String insertIntnetSvcGuidance(@ModelAttribute("intnetSvcGuidance") IntnetSvcGuidance intnetSvcGuidance, + @ModelAttribute("intnetSvcGuidanceVO") IntnetSvcGuidanceVO intnetSvcGuidanceVO, + BindingResult bindingResult, + ModelMap model) throws Exception { + + beanValidator.validate(intnetSvcGuidance, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + model.addAttribute("intnetSvcGuidanceVO", intnetSvcGuidanceVO); + return "egovframework/com/uss/ion/isg/EgovIntnetSvcGuidanceRegist"; + } else { + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + intnetSvcGuidance.setIntnetSvcId(egovIntnetSvcGuidanceIdGnrService.getNextStringId()); + intnetSvcGuidance.setUserId(user == null ? "" : EgovStringUtil.isNullToString(user.getId())); + intnetSvcGuidanceVO.setIntnetSvcId(intnetSvcGuidance.getIntnetSvcId()); + + model.addAttribute("intnetSvcGuidance", egovIntnetSvcGuidanceService.insertIntnetSvcGuidance(intnetSvcGuidance, intnetSvcGuidanceVO)); + model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); + +// return "egovframework/com/uss/ion/isg/EgovIntnetSvcGuidanceUpdt"; + return "forward:/uss/ion/isg/selectIntnetSvcGuidanceList.do"; + } + } + + /** + * 기 등록된 인터넷서비스안내정보를 수정한다. + * @param intnetSvcGuidance - 인터넷서비스안내 model + * @return String - 리턴 Url + */ + @RequestMapping("/uss/ion/isg/updtIntnetSvcGuidance.do") + public String updateIntnetSvcGuidance(@ModelAttribute("intnetSvcGuidance") IntnetSvcGuidance intnetSvcGuidance, + BindingResult bindingResult, + ModelMap model) throws Exception { + + beanValidator.validate(intnetSvcGuidance, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + model.addAttribute("intnetSvcGuidanceVO", intnetSvcGuidance); + return "egovframework/com/uss/ion/isg/EgovIntnetSvcGuidanceUpdt"; + } else { + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + intnetSvcGuidance.setUserId(user == null ? "" : EgovStringUtil.isNullToString(user.getId())); + + egovIntnetSvcGuidanceService.updateIntnetSvcGuidance(intnetSvcGuidance); +// return "forward:/uss/ion/isg/getIntnetSvcGuidance.do"; + return "forward:/uss/ion/isg/selectIntnetSvcGuidanceList.do"; + } + } + + /** + * 기 등록된 인터넷서비스안내정보를 삭제한다. + * @param intnetSvcGuidance - 인터넷서비스안내 model + * @return String - 리턴 Url + */ + @RequestMapping("/uss/ion/isg/removeIntnetSvcGuidance.do") + public String deleteIntnetSvcGuidance(@ModelAttribute("intnetSvcGuidance") IntnetSvcGuidance intnetSvcGuidance, + ModelMap model) throws Exception { + + egovIntnetSvcGuidanceService.deleteIntnetSvcGuidance(intnetSvcGuidance); + + model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); + return "forward:/uss/ion/isg/selectIntnetSvcGuidanceList.do"; + } + + + /** + * 인터넷서비스안내정보 적용결과를 조회한다. + * @param intnetSvcGuidanceVO - 인터넷서비스안내 VO + * @return String - 리턴 Url + */ + @RequestMapping("/uss/ion/isg/selectIntnetSvcGuidanceResultList.do") + public String selectIntnetSvcGuidanceResult(@ModelAttribute("intnetSvcGuidanceVO") IntnetSvcGuidanceVO intnetSvcGuidanceVO, + ModelMap model ) throws Exception { + + List intnetSvcGuidanceList = egovIntnetSvcGuidanceService.selectIntnetSvcGuidanceResult(intnetSvcGuidanceVO); + + for(int i=0; i + * + * @param sanctnerVO + */ + public Map selectSanctnerList(SanctnerVO sanctnerVO) throws Exception; + + /** + * 약식결재 정보를 조회한다. + * @param InfrmlSanctn + * @return InfrmlSanctn + * + * @param infrmlSanctn + */ + public InfrmlSanctn selectInfrmlSanctn(InfrmlSanctn infrmlSanctn) throws Exception; + + /** + * 약식결재관리 정보를 수정한다. + * @param InfrmlSanctn + * @return InfrmlSanctn + * + * @param InfrmlSanctn + */ + public InfrmlSanctn updateInfrmlSanctn(InfrmlSanctn infrmlSanctn) throws Exception; + + /** + * 약식결재관리 정보를 승인한다. + * @param InfrmlSanctn + * @return InfrmlSanctn + * + * @param InfrmlSanctn + */ + public InfrmlSanctn updateInfrmlSanctnConfm(InfrmlSanctn infrmlSanctn) throws Exception; + + /** + * 약식결재관리 정보를 반려한다. + * @param InfrmlSanctn + * @return InfrmlSanctn + * + * @param InfrmlSanctn + */ + public InfrmlSanctn updateInfrmlSanctnReturn(InfrmlSanctn infrmlSanctn) throws Exception; + + /** + * 약식결재관리 정보를 등록한다. + * @param InfrmlSanctn + * @return InfrmlSanctn + * + * @param InfrmlSanctn + */ + public InfrmlSanctn insertInfrmlSanctn(InfrmlSanctn infrmlSanctn) throws Exception; + + /** + * 약식결재관리 정보를 삭제한다. + * @param InfrmlSanctn + * @return InfrmlSanctn + * + * @param InfrmlSanctn + */ + public void deleteInfrmlSanctn(InfrmlSanctn infrmlSanctn) throws Exception; + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/ism/service/InfrmlSanctn.java b/src/main/java/egovframework/com/uss/ion/ism/service/InfrmlSanctn.java new file mode 100644 index 0000000..44f2201 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ism/service/InfrmlSanctn.java @@ -0,0 +1,190 @@ +package egovframework.com.uss.ion.ism.service; + +import java.io.Serializable; + +/** + * 개요 + * - 약식결재관리에 대한 model 클래스를 정의한다. + * + * 상세내용 + * - 약식결재ID, 업무구분코드, 업무구분명, 연계URL, 신청자ID, 신청자명, 신청일자, 결재자ID, 결재자명, 결재자소속, 승인여부, 결재일시, 반려사유 의 항목을 관리한다. + * @author 장철호 + * @version 1.0 + * @created 28-6-2010 오전 11:29:26 + */ +@SuppressWarnings("serial") +public class InfrmlSanctn implements Serializable { + /** + * 약식결재ID + */ + private String infrmlSanctnId; + /** + * 업무구분코드 + */ + private String jobSeCode; + /** + * 업무구분명 + */ + private String jobSeNm; + /** + * 신청자ID + */ + private String applcntId; + /** + * 신청자명 + */ + private String applcntNm; + /** + * 신청일자 + */ + private String reqstDe = ""; + /** + * 결재자ID + */ + private String sanctnerId; + /** + * 결재자명 + */ + private String sanctnerNm; + /** + * 결재자소속 + */ + private String sanctnerOrgnztNm; + /** + * 승인여부 + */ + private String confmAt = ""; + /** + * 결재일시 + */ + private String sanctnDt = ""; + /** + * 반려사유 + */ + private String returnResn = ""; + /** + * 최초등록자 ID + */ + private String frstRegisterId = ""; + /** + * 최초등록시점 + */ + private String frstRegisterPnttm = ""; + /** + * 최종수정자ID + */ + private String lastUpdusrId = ""; + /** + * 최종수정자명 + */ + private String lastUpdusrNm = ""; + /** + * 최종수정시점 + */ + private String lastUpdusrPnttm = ""; + + public String getInfrmlSanctnId() { + return infrmlSanctnId; + } + public void setInfrmlSanctnId(String infrmlSanctnId) { + this.infrmlSanctnId = infrmlSanctnId; + } + public String getJobSeCode() { + return jobSeCode; + } + public void setJobSeCode(String jobSeCode) { + this.jobSeCode = jobSeCode; + } + public String getJobSeNm() { + return jobSeNm; + } + public void setJobSeNm(String jobSeNm) { + this.jobSeNm = jobSeNm; + } + public String getApplcntId() { + return applcntId; + } + public void setApplcntId(String applcntId) { + this.applcntId = applcntId; + } + public String getApplcntNm() { + return applcntNm; + } + public void setApplcntNm(String applcntNm) { + this.applcntNm = applcntNm; + } + public String getReqstDe() { + return reqstDe; + } + public void setReqstDe(String reqstDe) { + this.reqstDe = reqstDe; + } + public String getSanctnerId() { + return sanctnerId; + } + public void setSanctnerId(String sanctnerId) { + this.sanctnerId = sanctnerId; + } + public String getSanctnerNm() { + return sanctnerNm; + } + public void setSanctnerNm(String sanctnerNm) { + this.sanctnerNm = sanctnerNm; + } + public String getSanctnerOrgnztNm() { + return sanctnerOrgnztNm; + } + public void setSanctnerOrgnztNm(String sanctnerOrgnztNm) { + this.sanctnerOrgnztNm = sanctnerOrgnztNm; + } + public String getConfmAt() { + return confmAt; + } + public void setConfmAt(String confmAt) { + this.confmAt = confmAt; + } + public String getSanctnDt() { + return sanctnDt; + } + public void setSanctnDt(String sanctnDt) { + this.sanctnDt = sanctnDt; + } + public String getReturnResn() { + return returnResn; + } + public void setReturnResn(String returnResn) { + this.returnResn = returnResn; + } + public String getFrstRegisterId() { + return frstRegisterId; + } + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + public String getLastUpdusrId() { + return lastUpdusrId; + } + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + public String getLastUpdusrNm() { + return lastUpdusrNm; + } + public void setLastUpdusrNm(String lastUpdusrNm) { + this.lastUpdusrNm = lastUpdusrNm; + } + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/ism/service/Sanctner.java b/src/main/java/egovframework/com/uss/ion/ism/service/Sanctner.java new file mode 100644 index 0000000..d039b96 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ism/service/Sanctner.java @@ -0,0 +1,71 @@ +package egovframework.com.uss.ion.ism.service; + +import java.io.Serializable; + +/** + * 개요 + * - 결재자에 대한 model 클래스를 정의한다. + * + * 상세내용 + * - 조직명, 직위명, 사용자명, 사용자ID 의 항목을 관리한다. + * @author 장철호 + * @version 1.0 + * @created 28-6-2010 오전 11:29:26 + */ +@SuppressWarnings("serial") +public class Sanctner implements Serializable { + + /** + * 조직명 + */ + private String orgnztNm; + /** + * 직위명 + */ + private String ofcpsNm; + /** + * 사용자명 + */ + private String emplyrNm; + /** + * 사용자ID + */ + private String uniqId; + /** + * 사원번호 + */ + private String emplNo; + + public String getOrgnztNm() { + return orgnztNm; + } + public void setOrgnztNm(String orgnztNm) { + this.orgnztNm = orgnztNm; + } + public String getOfcpsNm() { + return ofcpsNm; + } + public void setOfcpsNm(String ofcpsNm) { + this.ofcpsNm = ofcpsNm; + } + public String getEmplyrNm() { + return emplyrNm; + } + public void setEmplyrNm(String emplyrNm) { + this.emplyrNm = emplyrNm; + } + public String getUniqId() { + return uniqId; + } + public void setUniqId(String uniqId) { + this.uniqId = uniqId; + } + public String getEmplNo() { + return emplNo; + } + public void setEmplNo(String emplNo) { + this.emplNo = emplNo; + } + + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/ism/service/SanctnerVO.java b/src/main/java/egovframework/com/uss/ion/ism/service/SanctnerVO.java new file mode 100644 index 0000000..7c50c23 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ism/service/SanctnerVO.java @@ -0,0 +1,105 @@ +package egovframework.com.uss.ion.ism.service; + + +/** + * 개요 + * - 결재자에 대한 Vo 클래스를 정의한다. + * + * 상세내용 + * - 결재자의 목록 항목, 조회조건 등을 관리한다. + * @author 장철호 + * @version 1.0 + * @created 28-6-2010 오전 11:29:26 + */ +@SuppressWarnings("serial") +public class SanctnerVO extends Sanctner { + + /** 검색조건 */ + private String searchCnd = ""; + + /** 검색단어 */ + private String searchWrd = ""; + + /** 현재페이지 */ + private int pageIndex = 1; + + /** 페이지갯수 */ + private int pageUnit = 10; + + /** 페이지사이즈 */ + private int pageSize = 10; + + /** 첫페이지 인덱스 */ + private int firstIndex = 1; + + /** 마지막페이지 인덱스 */ + private int lastIndex = 1; + + /** 페이지당 레코드 개수 */ + private int recordCountPerPage = 10; + + public String getSearchCnd() { + return searchCnd; + } + + public void setSearchCnd(String searchCnd) { + this.searchCnd = searchCnd; + } + + public String getSearchWrd() { + return searchWrd; + } + + public void setSearchWrd(String searchWrd) { + this.searchWrd = searchWrd; + } + + public int getPageIndex() { + return pageIndex; + } + + public void setPageIndex(int pageIndex) { + this.pageIndex = pageIndex; + } + + public int getPageUnit() { + return pageUnit; + } + + public void setPageUnit(int pageUnit) { + this.pageUnit = pageUnit; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public int getFirstIndex() { + return firstIndex; + } + + public void setFirstIndex(int firstIndex) { + this.firstIndex = firstIndex; + } + + public int getLastIndex() { + return lastIndex; + } + + public void setLastIndex(int lastIndex) { + this.lastIndex = lastIndex; + } + + public int getRecordCountPerPage() { + return recordCountPerPage; + } + + public void setRecordCountPerPage(int recordCountPerPage) { + this.recordCountPerPage = recordCountPerPage; + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/ism/service/impl/EgovInfrmlSanctnServiceImpl.java b/src/main/java/egovframework/com/uss/ion/ism/service/impl/EgovInfrmlSanctnServiceImpl.java new file mode 100644 index 0000000..4285b55 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ism/service/impl/EgovInfrmlSanctnServiceImpl.java @@ -0,0 +1,134 @@ +package egovframework.com.uss.ion.ism.service.impl; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import egovframework.com.uss.ion.ism.service.EgovInfrmlSanctnService; +import egovframework.com.uss.ion.ism.service.InfrmlSanctn; +import egovframework.com.uss.ion.ism.service.SanctnerVO; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +/** + * 개요 + * 약식결재관리에 대한 ServiceImpl 클래스를 정의한다. + * + * 상세내용 + * - 약식결재관리에 대한 등록, 수정, 삭제기능을 제공한다. + * - 결재자에 대한 목록조회기능을 제공한다. + * @author 장철호 + * @version 1.0 + * @created 28-6-2010 오전 11:29:26 + */ + +@Service("EgovInfrmlSanctnService") +public class EgovInfrmlSanctnServiceImpl extends EgovAbstractServiceImpl implements EgovInfrmlSanctnService { + + @Resource(name = "InfrmlSanctnDAO") + private InfrmlSanctnDAO infrmlSanctnDAO; + + @Resource(name="egovInfrmlSanctnIdGnrService") + private EgovIdGnrService idgenServiceInfrmlSanctn; + /** + * 결재자 목록을 조회한다. + * @param SanctnerVO + * @return Map + * + * @param sanctnerVO + */ + public Map selectSanctnerList(SanctnerVO sanctnerVO) throws Exception{ + List result = infrmlSanctnDAO.selectSanctnerList(sanctnerVO); + int cnt = infrmlSanctnDAO.selectSanctnerListCnt(sanctnerVO); + + Map map = new HashMap(); + + map.put("resultList", result); + map.put("resultCnt", Integer.toString(cnt)); + + return map; + } + + /** + * 약식결재 정보를 조회한다. + * @param InfrmlSanctnVO + * @return InfrmlSanctnVO + * + * @param infrmlSanctnVO + */ + public InfrmlSanctn selectInfrmlSanctn(InfrmlSanctn infrmlSanctn) throws Exception{ + InfrmlSanctn result = infrmlSanctnDAO.selectInfrmlSanctn(infrmlSanctn); + if(result.getSanctnDt() != null && !result.getSanctnDt().equals("")){ + if(result.getSanctnDt().length() > 18){ + result.setSanctnDt(result.getSanctnDt().substring(0, 19)); + } + } + return result; + } + + /** + * 약식결재관리 정보를 수정한다. + * @param InfrmlSanctn + * + * @param infrmlSanctn + */ + public InfrmlSanctn updateInfrmlSanctn(InfrmlSanctn infrmlSanctn) throws Exception{ + infrmlSanctnDAO.updateInfrmlSanctn(infrmlSanctn); + return selectInfrmlSanctn(infrmlSanctn); + } + + /** + * 약식결재관리 정보를 승인한다. + * @param InfrmlSanctn + * + * @param infrmlSanctn + */ + public InfrmlSanctn updateInfrmlSanctnConfm(InfrmlSanctn infrmlSanctn) throws Exception{ + infrmlSanctn.setConfmAt("C"); + infrmlSanctnDAO.updateInfrmlSanctnConfm(infrmlSanctn); + + return selectInfrmlSanctn(infrmlSanctn); + } + + /** + * 약식결재관리 정보를 반려한다. + * @param InfrmlSanctn + * + * @param infrmlSanctn + */ + public InfrmlSanctn updateInfrmlSanctnReturn(InfrmlSanctn infrmlSanctn) throws Exception{ + infrmlSanctn.setConfmAt("R"); + infrmlSanctnDAO.updateInfrmlSanctnConfm(infrmlSanctn); + + return selectInfrmlSanctn(infrmlSanctn); + } + + /** + * 약식결재관리 정보를 등록한다. + * @param InfrmlSanctn + * + * @param infrmlSanctn + */ + public InfrmlSanctn insertInfrmlSanctn(InfrmlSanctn infrmlSanctn) throws Exception{ + infrmlSanctn.setInfrmlSanctnId(idgenServiceInfrmlSanctn.getNextStringId()); + infrmlSanctn.setConfmAt("A"); + infrmlSanctnDAO.insertInfrmlSanctn(infrmlSanctn); + + return selectInfrmlSanctn(infrmlSanctn); + } + + /** + * 약식결재관리 정보를 삭제한다. + * @param InfrmlSanctn + * + * @param infrmlSanctn + */ + public void deleteInfrmlSanctn(InfrmlSanctn infrmlSanctn) throws Exception{ + infrmlSanctnDAO.deleteInfrmlSanctn(infrmlSanctn); + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/ism/service/impl/InfrmlSanctnDAO.java b/src/main/java/egovframework/com/uss/ion/ism/service/impl/InfrmlSanctnDAO.java new file mode 100644 index 0000000..95db736 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ism/service/impl/InfrmlSanctnDAO.java @@ -0,0 +1,99 @@ +package egovframework.com.uss.ion.ism.service.impl; +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.ion.ism.service.InfrmlSanctn; +import egovframework.com.uss.ion.ism.service.SanctnerVO; + +import org.springframework.stereotype.Repository; + +/** + * 개요 + * - 약식결재관리에 대한 DAO 클래스를 정의한다. + * + * 상세내용 + * - 약식결재관리에 대한 등록, 수정, 삭제기능을 제공한다. + * - 결재자에 대한 목록조회기능을 제공한다. + * @author 장철호 + * @version 1.0 + * @created 28-6-2010 오전 11:29:26 + */ +@Repository("InfrmlSanctnDAO") +public class InfrmlSanctnDAO extends EgovComAbstractDAO { + + + /** + * 주어진 조건에 맞는 결재자를 불러온다. + * @param SanctnerVO + * @return List + * + * @param sanctnerVO + */ + public List selectSanctnerList(SanctnerVO sanctnerVO) throws Exception{ + return selectList("InfrmlSanctnDAO.selectSanctnerList", sanctnerVO); + } + + /** + * 결재자 목록에 대한 전체 건수를 조회한다. + * @param SanctnerVO + * @return int + * + * @param sanctnerVO + */ + public int selectSanctnerListCnt(SanctnerVO sanctnerVO) throws Exception{ + return (Integer)selectOne("InfrmlSanctnDAO.selectSanctnerListCnt", sanctnerVO); + } + + /** + * 주어진 조건에 맞는 약식결재정보를 불러온다. + * @param InfrmlSanctn + * @return InfrmlSanctn + * + * @param infrmlSanctn + */ + public InfrmlSanctn selectInfrmlSanctn(InfrmlSanctn infrmlSanctn) throws Exception{ + return (InfrmlSanctn)selectOne("InfrmlSanctnDAO.selectInfrmlSanctn", infrmlSanctn); + } + + + /** + * 약식결재관리 정보를 수정한다. + * @param InfrmlSanctn + * + * @param infrmlSanctn + */ + public void updateInfrmlSanctn(InfrmlSanctn infrmlSanctn) throws Exception{ + update("InfrmlSanctnDAO.updateInfrmlSanctn", infrmlSanctn); + } + + /** + * 약식결재관리 정보를 승인 또는 반려한다. + * @param InfrmlSanctn + * + * @param infrmlSanctn + */ + public void updateInfrmlSanctnConfm(InfrmlSanctn infrmlSanctn) throws Exception{ + update("InfrmlSanctnDAO.updateInfrmlSanctnConfm", infrmlSanctn); + } + + /** + * 약식결재관리 정보를 등록한다. + * @param InfrmlSanctn + * + * @param infrmlSanctn + */ + public void insertInfrmlSanctn(InfrmlSanctn infrmlSanctn) throws Exception{ + insert("InfrmlSanctnDAO.insertInfrmlSanctn", infrmlSanctn); + } + + /** + * 약식결재관리 정보를 삭제한다. + * @param InfrmlSanctn + * + * @param infrmlSanctn + */ + public void deleteInfrmlSanctn(InfrmlSanctn infrmlSanctn) throws Exception{ + delete("InfrmlSanctnDAO.deleteInfrmlSanctn", infrmlSanctn); + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/ism/web/EgovInfrmlSanctnController.java b/src/main/java/egovframework/com/uss/ion/ism/web/EgovInfrmlSanctnController.java new file mode 100644 index 0000000..ee2f8ad --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ism/web/EgovInfrmlSanctnController.java @@ -0,0 +1,205 @@ +package egovframework.com.uss.ion.ism.web; +import java.util.Map; + +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.ion.ism.service.EgovInfrmlSanctnService; +import egovframework.com.uss.ion.ism.service.InfrmlSanctn; +import egovframework.com.uss.ion.ism.service.SanctnerVO; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +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; + +/** + * 개요 + * - 약식결재관리에 대한 controller 클래스를 정의한다. + * + * 상세내용 + * - 약식결재관리에 대한 등록, 승인, 반려, 삭제기능을 제공한다. + * - 결재자에 대한 목록조회기능을 제공한다. + * @author 장철호 + * @version 1.0 + * @created 28-6-2010 오전 11:29:25 + */ + +@Controller +public class EgovInfrmlSanctnController { + + @Resource(name="EgovInfrmlSanctnService") + protected EgovInfrmlSanctnService infrmlSanctnService; + + @Resource(name="propertiesService") + protected EgovPropertyService propertyService; + + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + /** + * 결재자 정보에 대한 팝업 목록을 조회한다. + * @param SanctnerVO + * @return String + * + * @param sanctnerVO + */ + @RequestMapping("/uss/ion/ism/selectSanctnerListPopup.do") + public String selectSanctnerListPopup(@ModelAttribute("searchVO") SanctnerVO sanctnerVO, ModelMap model) throws Exception{ + return "egovframework/com/uss/ion/ism/EgovSanctnerListPopup"; + } + + /** + * 결재자 정보에 대한 목록을 조회한다. + * @param SanctnerVO + * @return String + * + * @param sanctnerVO + */ + @RequestMapping("/uss/ion/ism/selectSanctnerList.do") + public String selectSanctnerList(@ModelAttribute("searchVO") SanctnerVO sanctnerVO, ModelMap model) throws Exception{ + //LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + //sanctnerVO.setUniqId(user.getUniqId()); + + sanctnerVO.setPageUnit(propertyService.getInt("pageUnit")); + sanctnerVO.setPageSize(propertyService.getInt("pageSize")); + + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(sanctnerVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(sanctnerVO.getPageUnit()); + paginationInfo.setPageSize(sanctnerVO.getPageSize()); + + sanctnerVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + sanctnerVO.setLastIndex(paginationInfo.getLastRecordIndex()); + sanctnerVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + Map map = infrmlSanctnService.selectSanctnerList(sanctnerVO); + int totCnt = Integer.parseInt((String)map.get("resultCnt")); + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList", map.get("resultList")); + model.addAttribute("resultCnt", map.get("resultCnt")); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/uss/ion/ism/EgovSanctnerList"; + } + + /** + * 결재자 정보에 대한 목록을 조회한다. Old 삭제 후 반영 + * @param SanctnerVO + * @return String + * + * @param sanctnerVO + */ + @RequestMapping("/uss/ion/ism/selectSanctnerListNew.do") + public String selectSanctnerListNew(@ModelAttribute("searchVO") SanctnerVO sanctnerVO, ModelMap model) throws Exception{ + //LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + //sanctnerVO.setUniqId(user.getUniqId()); + + sanctnerVO.setPageUnit(propertyService.getInt("pageUnit")); + sanctnerVO.setPageSize(propertyService.getInt("pageSize")); + + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(sanctnerVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(sanctnerVO.getPageUnit()); + paginationInfo.setPageSize(sanctnerVO.getPageSize()); + + sanctnerVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + sanctnerVO.setLastIndex(paginationInfo.getLastRecordIndex()); + sanctnerVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + Map map = infrmlSanctnService.selectSanctnerList(sanctnerVO); + int totCnt = Integer.parseInt((String)map.get("resultCnt")); + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList", map.get("resultList")); + model.addAttribute("resultCnt", map.get("resultCnt")); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/uss/ion/ism/EgovSanctnerListNew"; + } + + /** + * 약식결재 정보의 상세화면으로 이동한다. + * @param InfrmlSanctn + * @return String + * + * @param InfrmlSanctn + */ + @RequestMapping("/uss/ion/ism/selectInfrmlSanctn.do") + public String selectInfrmlSanctn( + @ModelAttribute("infrmlSanctn") InfrmlSanctn infrmlSanctn, ModelMap model) throws Exception{ + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if(!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + if(infrmlSanctn.getInfrmlSanctnId() != null){ + if(infrmlSanctn.getInfrmlSanctnId().indexOf(",") > 0){ + infrmlSanctn.setInfrmlSanctnId(infrmlSanctn.getInfrmlSanctnId().substring(0, infrmlSanctn.getInfrmlSanctnId().indexOf(","))); + } + } + + model.addAttribute("infrmlSanctnVO", infrmlSanctnService.selectInfrmlSanctn(infrmlSanctn)); + + return "egovframework/com/uss/ion/ism/EgovInfrmlSanctnDetail"; + } + + /** + * 약식결재 반려처리 화면을 호출한다. + * @param + * @return String + * + * @param + */ + @RequestMapping("/uss/ion/ism/EgovReturnPopup.do") + public String selectReturnPopup() throws Exception{ + return "egovframework/com/uss/ion/ism/EgovReturnPopup"; + } + + /** + * 약식결재 승인처리 화면을 호출한다. + * @param + * @return String + * + * @param + */ + @RequestMapping("/uss/ion/ism/EgovConfmPopup.do") + public String selectConfmPopup() throws Exception{ + return "egovframework/com/uss/ion/ism/EgovConfmPopup"; + } + + /** + * 약식결재 반려처리 화면을 호출한다. Old 삭제 후 반영 + * @param + * @return String + * + * @param + */ + @RequestMapping("/uss/ion/ism/EgovReturnPopupNew.do") + public String selectReturnPopupNew() throws Exception{ + return "egovframework/com/uss/ion/ism/EgovReturnPopupNew"; + } + + + /** + * 약식결재 승인처리 화면을 호출한다. Old 삭제 후 반영 + * @param + * @return String + * + * @param + */ + @RequestMapping("/uss/ion/ism/EgovConfmPopupNew.do") + public String selectConfmPopupNew() throws Exception{ + return "egovframework/com/uss/ion/ism/EgovConfmPopupNew"; + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/lsi/service/EgovLoginScrinImageService.java b/src/main/java/egovframework/com/uss/ion/lsi/service/EgovLoginScrinImageService.java new file mode 100644 index 0000000..4674340 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/lsi/service/EgovLoginScrinImageService.java @@ -0,0 +1,72 @@ + +/** + * 개요 + * - 로그인화면이미지에 대한 Service Interface를 정의한다. + * + * 상세내용 + * - 로그인화면이미지에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 로그인화면이미지의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이문준 + * @version 1.0 + * @created 03-8-2009 오후 2:08:56 + */ + +package egovframework.com.uss.ion.lsi.service; + +import java.util.List; + +public interface EgovLoginScrinImageService { + + /** + * 로그인화면이미지정보를 관리하기 위해 등록된 로그인화면이미지 목록을 조회한다. + * @param loginScrinImageVO - 로그인화면이미지 VO + * @return List - 로그인화면이미지 목록 + */ + public List selectLoginScrinImageList(LoginScrinImageVO loginScrinImageVO) throws Exception; + + /** + * 로그인화면이미지목록 총 갯수를 조회한다. + * @param loginScrinImageVO - 로그인화면이미지 VO + * @return int - 로그인화면이미지 카운트 수 + */ + public int selectLoginScrinImageListTotCnt(LoginScrinImageVO loginScrinImageVO) throws Exception ; + + /** + * 등록된 로그인화면이미지의 상세정보를 조회한다. + * @param loginScrinImageVO - 로그인화면이미지 VO + * @return LoginScrinImageVO - 로그인화면이미지 VO + */ + public LoginScrinImageVO selectLoginScrinImage(LoginScrinImageVO loginScrinImageVO) throws Exception; + + /** + * 로그인화면이미지정보를 신규로 등록한다. + * @param loginScrinImage - 로그인화면이미지 model + */ + public LoginScrinImageVO insertLoginScrinImage(LoginScrinImage loginScrinImage, LoginScrinImageVO loginScrinImageVO) throws Exception; + + /** + * 기 등록된 로그인화면이미지정보를 수정한다. + * @param loginScrinImage - 로그인화면이미지 model + */ + public void updateLoginScrinImage(LoginScrinImage loginScrinImage) throws Exception; + + /** + * 기 등록된 로그인화면이미지정보를 삭제한다. + * @param loginScrinImage - 로그인화면이미지 model + */ + public void deleteLoginScrinImage(LoginScrinImage loginScrinImage) throws Exception; + + /** + * 기 등록된 로그인화면이미지정보의 파일을 삭제한다. + * @param loginScrinImage - 로그인화면이미지 model + */ + public void deleteLoginScrinImageFile(LoginScrinImage loginScrinImage) throws Exception; + + /** + * 로그인화면이미지가 특정화면에 반영된 결과를 조회한다. + * @param loginScrinImageVO - 로그인화면이미지 VO + * @return LoginScrinImageVO - 로그인화면이미지 VO + */ + public List selectLoginScrinImageResult(LoginScrinImageVO loginScrinImageVO) throws Exception; + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/lsi/service/LoginScrinImage.java b/src/main/java/egovframework/com/uss/ion/lsi/service/LoginScrinImage.java new file mode 100644 index 0000000..5dc7cbd --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/lsi/service/LoginScrinImage.java @@ -0,0 +1,168 @@ +/** + * 개요 + * - 로그인화면이미지에 대한 model 클래스를 정의한다. + * + * 상세내용 + * - 로그인화면이미지의 일련번호, 이미지명, 링크URL, 이미지설명, 반영여부 항목을 관리한다. + * @author 이문준 + * @version 1.0 + * @created 03-8-2009 오후 2:08:55 + */ + +package egovframework.com.uss.ion.lsi.service; + +import egovframework.com.cmm.ComDefaultVO; + +public class LoginScrinImage extends ComDefaultVO { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + /** + * 이미지 ID + */ + private String imageId; + /** + * 이미지명 + */ + private String imageNm; + /** + * 로그인 이미지 + */ + private String image; + /** + * 로그인 이미지 파일 + */ + private String imageFile; + /** + * 이미지 설명 + */ + private String imageDc; + /** + * 반영여부 + */ + private String reflctAt; + /** + * 사용자 ID + */ + private String userId; + /** + * 등록일자 + */ + private String regDate; + /** + * 파일첨부여부 + */ + private boolean isAtchFile; + /** + * @return the imageId + */ + public String getImageId() { + return imageId; + } + /** + * @param imageId the imageId to set + */ + public void setImageId(String imageId) { + this.imageId = imageId; + } + /** + * @return the imageNm + */ + public String getImageNm() { + return imageNm; + } + /** + * @param imageNm the imageNm to set + */ + public void setImageNm(String imageNm) { + this.imageNm = imageNm; + } + /** + * @return the image + */ + public String getImage() { + return image; + } + /** + * @param image the image to set + */ + public void setImage(String image) { + this.image = image; + } + /** + * @return the imageFile + */ + public String getImageFile() { + return imageFile; + } + /** + * @param imageFile the imageFile to set + */ + public void setImageFile(String imageFile) { + this.imageFile = imageFile; + } + /** + * @return the imageDc + */ + public String getImageDc() { + return imageDc; + } + /** + * @param imageDc the imageDc to set + */ + public void setImageDc(String imageDc) { + this.imageDc = imageDc; + } + /** + * @return the reflctAt + */ + public String getReflctAt() { + return reflctAt; + } + /** + * @param reflctAt the reflctAt to set + */ + public void setReflctAt(String reflctAt) { + this.reflctAt = reflctAt; + } + /** + * @return the userId + */ + public String getUserId() { + return userId; + } + /** + * @param userId the userId to set + */ + public void setUserId(String userId) { + this.userId = userId; + } + /** + * @return the regDate + */ + public String getRegDate() { + return regDate; + } + /** + * @param regDate the regDate to set + */ + public void setRegDate(String regDate) { + this.regDate = regDate; + } + /** + * @return the isAtchFile + */ + public boolean isAtchFile() { + return isAtchFile; + } + /** + * @param isAtchFile the isAtchFile to set + */ + public void setAtchFile(boolean isAtchFile) { + this.isAtchFile = isAtchFile; + } + + +} diff --git a/src/main/java/egovframework/com/uss/ion/lsi/service/LoginScrinImageVO.java b/src/main/java/egovframework/com/uss/ion/lsi/service/LoginScrinImageVO.java new file mode 100644 index 0000000..923d26e --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/lsi/service/LoginScrinImageVO.java @@ -0,0 +1,56 @@ +/** + * 개요 + * - 로그인화면이미지에 대한 Vo 클래스를 정의한다. + * + * 상세내용 + * - 로그인화면이미지의 목록 항목을 관리한다. + * @author 이문준 + * @version 1.0 + * @created 03-8-2009 오후 2:08:56 + */ + +package egovframework.com.uss.ion.lsi.service; + +import java.util.List; + +public class LoginScrinImageVO extends LoginScrinImage { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + /** + * 로그인화면이미지 목록 + */ + List loginScrinImageList; + /** + * 삭제대상 목록 + */ + String[] delYn; + + /** + * @return the loginScrinImageList + */ + public List getLoginScrinImageList() { + return loginScrinImageList; + } + /** + * @param loginScrinImageList the loginScrinImageList to set + */ + public void setLoginScrinImageList(List loginScrinImageList) { + this.loginScrinImageList = loginScrinImageList; + } + /** + * @return the delYn + */ + public String[] getDelYn() { + return delYn; + } + /** + * @param delYn the delYn to set + */ + public void setDelYn(String[] delYn) { + this.delYn = delYn; + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/lsi/service/impl/EgovLoginScrinImageServiceImpl.java b/src/main/java/egovframework/com/uss/ion/lsi/service/impl/EgovLoginScrinImageServiceImpl.java new file mode 100644 index 0000000..b15ddb0 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/lsi/service/impl/EgovLoginScrinImageServiceImpl.java @@ -0,0 +1,118 @@ +/** + * 개요 + * - 로그인화면이미지에 대한 ServiceImpl 클래스를 정의한다. + * + * 상세내용 + * - 로그인화면이미지에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 로그인화면이미지의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이문준 + * @version 1.0 + * @created 05-8-2009 오후 2:08:56 + * + * 수정 + * 2017.02.07 이정은 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + */ + +package egovframework.com.uss.ion.lsi.service.impl; + +import java.io.File; +import java.util.List; + +import egovframework.com.cmm.service.FileVO; +import egovframework.com.uss.ion.lsi.service.EgovLoginScrinImageService; +import egovframework.com.uss.ion.lsi.service.LoginScrinImage; +import egovframework.com.uss.ion.lsi.service.LoginScrinImageVO; +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import javax.annotation.Resource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +@Service("egovLoginScrinImageService") +public class EgovLoginScrinImageServiceImpl extends EgovAbstractServiceImpl implements EgovLoginScrinImageService { + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovLoginScrinImageServiceImpl.class); + + @Resource(name="loginScrinImageDAO") + private LoginScrinImageDAO loginScrinImageDAO; + + /** + * 로그인화면이미지정보를 관리하기 위해 등록된 로그인화면이미지 목록을 조회한다. + * @param loginScrinImageVO - 로그인화면이미지 VO + * @return List - 로그인화면이미지 목록 + */ + public List selectLoginScrinImageList(LoginScrinImageVO loginScrinImageVO) throws Exception{ + return loginScrinImageDAO.selectLoginScrinImageList(loginScrinImageVO); + } + + /** + * 로그인화면이미지목록 총 갯수를 조회한다. + * @param loginScrinImageVO - 로그인화면이미지 VO + * @return int - 로그인화면이미지 카운트 수 + */ + public int selectLoginScrinImageListTotCnt(LoginScrinImageVO loginScrinImageVO) throws Exception { + return loginScrinImageDAO.selectLoginScrinImageListTotCnt(loginScrinImageVO); + } + + /** + * 등록된 로그인화면이미지의 상세정보를 조회한다. + * @param loginScrinImageVO - 로그인화면이미지 VO + * @return LoginScrinImageVO - 로그인화면이미지 VO + */ + public LoginScrinImageVO selectLoginScrinImage(LoginScrinImageVO loginScrinImageVO) throws Exception { + return loginScrinImageDAO.selectLoginScrinImage(loginScrinImageVO); + } + + /** + * 로그인화면이미지정보를 신규로 등록한다. + * @param loginScrinImage - 로그인화면이미지 model + */ + public LoginScrinImageVO insertLoginScrinImage(LoginScrinImage loginScrinImage, LoginScrinImageVO loginScrinImageVO) throws Exception { + loginScrinImageDAO.insertLoginScrinImage(loginScrinImage); + loginScrinImageVO.setImageId(loginScrinImage.getImageId()); + return selectLoginScrinImage(loginScrinImageVO); + } + + /** + * 기 등록된 로그인화면이미지정보를 수정한다. + * @param loginScrinImage - 로그인화면이미지 model + */ + public void updateLoginScrinImage(LoginScrinImage loginScrinImage) throws Exception { + loginScrinImageDAO.updateLoginScrinImage(loginScrinImage); + } + + /** + * 기 등록된 로그인화면이미지정보를 삭제한다. + * @param loginScrinImage - 로그인화면이미지 model + */ + public void deleteLoginScrinImage(LoginScrinImage loginScrinImage) throws Exception { + deleteLoginScrinImageFile(loginScrinImage); + loginScrinImageDAO.deleteLoginScrinImage(loginScrinImage); + } + + /** + * 기 등록된 로그인화면이미지정보의 파일을 삭제한다. + * @param loginScrinImage - 로그인화면이미지 model + */ + public void deleteLoginScrinImageFile(LoginScrinImage loginScrinImage) throws Exception { + FileVO fileVO = (FileVO)loginScrinImageDAO.selectLoginScrinImageFile(loginScrinImage); + File file = new File(fileVO.getFileStreCours()+fileVO.getStreFileNm()); + //2017.02.08 이정은 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + if(file.delete()){ + LOGGER.debug("[file.delete] file : File Deletion Success"); + }else{ + LOGGER.error("[file.delete] file : File Deletion Fail"); + } + } + + /** + * 로그인화면이미지가 특정화면에 반영된 결과를 조회한다. + * @param loginScrinImageVO - 로그인화면이미지 VO + * @return LoginScrinImageVO - 로그인화면이미지 VO + */ + public List selectLoginScrinImageResult(LoginScrinImageVO loginScrinImageVO) throws Exception { + return loginScrinImageDAO.selectLoginScrinImageResult(loginScrinImageVO); + } +} diff --git a/src/main/java/egovframework/com/uss/ion/lsi/service/impl/LoginScrinImageDAO.java b/src/main/java/egovframework/com/uss/ion/lsi/service/impl/LoginScrinImageDAO.java new file mode 100644 index 0000000..d893a28 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/lsi/service/impl/LoginScrinImageDAO.java @@ -0,0 +1,95 @@ +/** + * 개요 + * - 로그인화면이미지에 대한 DAO 클래스를 정의한다. + * + * 상세내용 + * - 로그인화면이미지에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 로그인화면이미지의 조회기능은 목록조회, 상세조회로 구분된다. + * @author lee.m.j + * @version 1.0 + * @created 2009.08.07 오후 2:08:56 + */ + +package egovframework.com.uss.ion.lsi.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.FileVO; +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.ion.lsi.service.LoginScrinImage; +import egovframework.com.uss.ion.lsi.service.LoginScrinImageVO; + +import org.springframework.stereotype.Repository; + +@Repository("loginScrinImageDAO") +public class LoginScrinImageDAO extends EgovComAbstractDAO { + + /** + * 로그인화면이미지정보를 관리하기 위해 등록된 로그인화면이미지 목록을 조회한다. + * @param loginScrinImageVO - 로그인화면이미지 VO + * @return List - 로그인화면이미지 목록 + */ + public List selectLoginScrinImageList(LoginScrinImageVO loginScrinImageVO) throws Exception { + return selectList("loginScrinImageDAO.selectLoginScrinImageList", loginScrinImageVO); + } + + /** + * 로그인화면이미지목록 총 갯수를 조회한다. + * @param loginScrinImageVO - 로그인화면이미지 VO + * @return int + * @exception Exception + */ + public int selectLoginScrinImageListTotCnt(LoginScrinImageVO loginScrinImageVO) throws Exception { + return (Integer)selectOne("loginScrinImageDAO.selectLoginScrinImageListTotCnt", loginScrinImageVO); + } + + /** + * 등록된 로그인화면이미지의 상세정보를 조회한다. + * @param loginScrinImageVO - 로그인화면이미지 VO + * @return LoginScrinImageVO - 로그인화면이미지 VO + */ + public LoginScrinImageVO selectLoginScrinImage(LoginScrinImageVO loginScrinImageVO) throws Exception { + return (LoginScrinImageVO) selectOne("loginScrinImageDAO.selectLoginScrinImage", loginScrinImageVO); + } + + /** + * 로그인화면이미지정보를 신규로 등록한다. + * @param loginScrinImage - 로그인화면이미지 model + */ + public void insertLoginScrinImage(LoginScrinImage loginScrinImage) throws Exception { + insert("loginScrinImageDAO.insertLoginScrinImage", loginScrinImage); + } + + /** + * 기 등록된 로그인화면이미지정보를 수정한다. + * @param loginScrinImage - 로그인화면이미지 model + */ + public void updateLoginScrinImage(LoginScrinImage loginScrinImage) throws Exception { + update("loginScrinImageDAO.updateLoginScrinImage", loginScrinImage); + } + + /** + * 기 등록된 로그인화면이미지정보를 삭제한다. + * @param loginScrinImage - 로그인화면이미지 model + */ + public void deleteLoginScrinImage(LoginScrinImage loginScrinImage) throws Exception { + delete("loginScrinImageDAO.deleteLoginScrinImage",loginScrinImage); + } + + /** + * 기 등록된 로그인화면이미지정보의 이미지파일을 삭제하기 위해 파일정보를 조회한다. + * @param loginScrinImage - 로그인화면이미지 model + */ + public FileVO selectLoginScrinImageFile(LoginScrinImage loginScrinImage) throws Exception { + return (FileVO) selectOne("loginScrinImageDAO.selectLoginScrinImageFile", loginScrinImage); + } + + /** + * 로그인화면이미지가 특정화면에 반영된 결과를 조회한다. + * @param loginScrinImageVO - 로그인화면이미지 VO + * @return LoginScrinImageVO - 로그인화면이미지 VO + */ + public List selectLoginScrinImageResult(LoginScrinImageVO loginScrinImageVO) throws Exception { + return selectList("loginScrinImageDAO.selectLoginScrinImageResult", loginScrinImageVO); + } +} diff --git a/src/main/java/egovframework/com/uss/ion/lsi/web/EgovLoginScrinImageController.java b/src/main/java/egovframework/com/uss/ion/lsi/web/EgovLoginScrinImageController.java new file mode 100644 index 0000000..f6cb19d --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/lsi/web/EgovLoginScrinImageController.java @@ -0,0 +1,341 @@ +/** + * 개요 + * - 인터넷서비스안내에 대한 controller 클래스를 정의한다. + * + * 상세내용 + * - 인터넷서비스안내에 대한 등록, 수정, 삭제, 조회 기능을 제공한다. + * - 인터넷서비스안내의 조회기능은 목록조회, 상세조회로 구분된다. + * @author lee.m.j + * @version 1.0 + * @created 03-8-2009 오후 2:08:02 + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2010.8.3	lee.m.j          최초 생성
    + *  2011.8.26	정진오			IncludedInfo annotation 추가
    + *
    + *  
    + */ + +package egovframework.com.uss.ion.lsi.web; + +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +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.springframework.web.bind.support.SessionStatus; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.service.EgovFileMngService; +import egovframework.com.cmm.service.EgovFileMngUtil; +import egovframework.com.cmm.service.FileVO; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.ion.lsi.service.EgovLoginScrinImageService; +import egovframework.com.uss.ion.lsi.service.LoginScrinImage; +import egovframework.com.uss.ion.lsi.service.LoginScrinImageVO; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + + +@Controller +public class EgovLoginScrinImageController { + + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name="EgovFileMngService") + private EgovFileMngService fileMngService; + + @Resource(name="EgovFileMngUtil") + private EgovFileMngUtil fileUtil; + + /** Message ID Generation */ + @Resource(name="egovLoginScrinImageIdGnrService") + private EgovIdGnrService egovLoginScrinImageIdGnrService; + + @Resource(name = "egovLoginScrinImageService") + private EgovLoginScrinImageService egovLoginScrinImageService; + + @Autowired + private DefaultBeanValidator beanValidator; + + /** + * 로그인화면이미지 목록화면 이동 + * @return String + * @exception Exception + */ + @RequestMapping("/uss/ion/lsi/selectLoginScrinImageListView.do") + public String selectLoginScrinImageListView() throws Exception { + + return "egovframework/com/uss/ion/lsi/EgovLoginScrinImageList"; + } + + /** + * 로그인화면이미지정보를 관리하기 위해 등록된 로그인화면이미지 목록을 조회한다. + * @param loginScrinImageVO - 로그인화면이미지 VO + * @return String - 리턴 Url + */ + @IncludedInfo(name="로그인화면이미지관리", order = 750 ,gid = 50) + @RequestMapping(value="/uss/ion/lsi/selectLoginScrinImageList.do") + public String selectLoginScrinImageList(@ModelAttribute("loginScrinImageVO") LoginScrinImageVO loginScrinImageVO, + ModelMap model) throws Exception { + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(loginScrinImageVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(loginScrinImageVO.getPageUnit()); + paginationInfo.setPageSize(loginScrinImageVO.getPageSize()); + + loginScrinImageVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + loginScrinImageVO.setLastIndex(paginationInfo.getLastRecordIndex()); + loginScrinImageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + loginScrinImageVO.setLoginScrinImageList(egovLoginScrinImageService.selectLoginScrinImageList(loginScrinImageVO)); + + model.addAttribute("loginScrinImageList", loginScrinImageVO.getLoginScrinImageList()); + + + int totCnt = egovLoginScrinImageService.selectLoginScrinImageListTotCnt(loginScrinImageVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/uss/ion/lsi/EgovLoginScrinImageList"; + } + + /** + * 등록된 로그인화면이미지의 상세정보를 조회한다. + * @param loginScrinImageVO - 로그인화면이미지 VO + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/lsi/getLoginScrinImage.do") + public String selectLoginScrinImage(@RequestParam("imageId") String imageId, + @ModelAttribute("loginScrinImageVO") LoginScrinImageVO loginScrinImageVO, + ModelMap model) throws Exception { + loginScrinImageVO.setImageId(imageId); + + model.addAttribute("loginScrinImage", egovLoginScrinImageService.selectLoginScrinImage(loginScrinImageVO)); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + return "egovframework/com/uss/ion/lsi/EgovLoginScrinImageUpdt"; + } + + /** + * 로그인화면이미지 등록 화면으로 이동한다. + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/lsi/addViewLoginScrinImage.do") + public String insertViewLoginScrinImage(@ModelAttribute("loginScrinImageVO") LoginScrinImageVO loginScrinImageVO) throws Exception { + return "egovframework/com/uss/ion/lsi/EgovLoginScrinImageRegist"; + } + + /** + * 로그인화면이미지정보를 신규로 등록한다. + * @param loginScrinImage - 로그인화면이미지 model + * @return String - 리턴 Url + */ + @SuppressWarnings("unused") + @RequestMapping(value="/uss/ion/lsi/addLoginScrinImage.do") + public String insertLoginScrinImage(final MultipartHttpServletRequest multiRequest, + @ModelAttribute("loginScrinImage") LoginScrinImage loginScrinImage, + @ModelAttribute("loginScrinImageVO") LoginScrinImageVO loginScrinImageVO, + BindingResult bindingResult, + SessionStatus status, + ModelMap model) throws Exception { + + beanValidator.validate(loginScrinImage, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + model.addAttribute("loginScrinImageVO", loginScrinImageVO); + return "egovframework/com/uss/ion/lsi/EgovLoginScrinImageRegist"; + } else { + + List result = null; + + String uploadFolder = ""; + String image = ""; + String imageFile = ""; + String atchFileId = ""; + + final Map files = multiRequest.getFileMap(); + + if(!files.isEmpty()){ + result = fileUtil.parseFileInf(files, "LSI_", 0, "", uploadFolder); + atchFileId = fileMngService.insertFileInfs(result); + + FileVO vo = result.get(0); + Iterator iter = result.iterator(); + + while (iter.hasNext()) { + vo = iter.next(); + image = vo.getOrignlFileNm(); + imageFile = vo.getStreFileNm(); + } + } + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + loginScrinImage.setImageId(egovLoginScrinImageIdGnrService.getNextStringId()); + loginScrinImage.setImage(image); + loginScrinImage.setImageFile(atchFileId); + loginScrinImage.setUserId(user == null ? "" : EgovStringUtil.isNullToString(user.getId())); + loginScrinImageVO.setImageId(loginScrinImage.getImageId()); + + status.setComplete(); + model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); + model.addAttribute("loginScrinImage", egovLoginScrinImageService.insertLoginScrinImage(loginScrinImage, loginScrinImageVO)); + +// return "egovframework/com/uss/ion/lsi/EgovLoginScrinImageUpdt"; + return "forward:/uss/ion/lsi/selectLoginScrinImageList.do"; + + } + } + + /** + * 기 등록된 로그인화면이미지정보를 수정한다. + * @param loginScrinImage - 로그인화면이미지 model + * @return String - 리턴 Url + */ + @SuppressWarnings("unused") + @RequestMapping(value="/uss/ion/lsi/updtLoginScrinImage.do") + public String updateLoginScrinImage(final MultipartHttpServletRequest multiRequest, + @ModelAttribute("loginScrinImage") LoginScrinImage loginScrinImage, + BindingResult bindingResult, + SessionStatus status, + ModelMap model) throws Exception { + + beanValidator.validate(loginScrinImage, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + model.addAttribute("loginScrinImageVO", loginScrinImage); + return "egovframework/com/uss/ion/lsi/EgovLoginScrinImageUpdt"; + } else { + + List result = null; + + String uploadFolder = ""; + String image = ""; + String imageFile = ""; + String atchFileId = ""; + + final Map files = multiRequest.getFileMap(); + + if(!files.isEmpty()){ + result = fileUtil.parseFileInf(files, "LSI_", 0, "", uploadFolder); + atchFileId = fileMngService.insertFileInfs(result); + + FileVO vo = null; + Iterator iter = result.iterator(); + + while (iter.hasNext()) { + vo = iter.next(); + image = vo.getOrignlFileNm(); + imageFile = vo.getStreFileNm(); + } + + if (vo == null) { + loginScrinImage.setAtchFile(false); + } else { + loginScrinImage.setImage(image); + loginScrinImage.setImageFile(atchFileId); + loginScrinImage.setAtchFile(true); + } + } else { + loginScrinImage.setAtchFile(false); + } + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + loginScrinImage.setUserId(user == null ? "" : EgovStringUtil.isNullToString(user.getId())); + + egovLoginScrinImageService.updateLoginScrinImage(loginScrinImage); +// return "forward:/uss/ion/lsi/getLoginScrinImage.do"; + return "forward:/uss/ion/lsi/selectLoginScrinImageList.do"; + + } + } + + /** + * 기 등록된 로그인화면이미지정보를 삭제한다. + * @param loginScrinImage - 로그인화면이미지 model + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/lsi/removeLoginScrinImage.do") + public String deleteLoginScrinImage(@RequestParam("imageId") String imageId, + @ModelAttribute("loginScrinImage") LoginScrinImage loginScrinImage, + SessionStatus status, + ModelMap model) throws Exception { + + loginScrinImage.setImageId(imageId); + egovLoginScrinImageService.deleteLoginScrinImage(loginScrinImage); + status.setComplete(); + model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); + return "forward:/uss/ion/lsi/selectLoginScrinImageList.do"; + } + + + /** + * 기 등록된 로그인화면이미지정보 목록을 일괄 삭제한다. + * @param loginScrinImageIds String + * @param loginScrinImage LoginScrinImage + * @return String + * @exception Exception + */ + @RequestMapping(value="/uss/ion/lsi/removeLoginScrinImageList.do") + public String deleteLoginScrinImageList(@RequestParam("imageIds") String imageIds, + @ModelAttribute("loginScrinImage") LoginScrinImage loginScrinImage, + SessionStatus status, + ModelMap model) throws Exception { + + String [] strImageIds = imageIds.split(";"); + + for(int i=0; i fileList = egovLoginScrinImageService.selectLoginScrinImageResult(loginScrinImageVO); + model.addAttribute("fileList", fileList); + + return "egovframework/com/uss/ion/lsi/EgovLoginScrinImageView"; + } +} diff --git a/src/main/java/egovframework/com/uss/ion/msi/service/EgovMainImageService.java b/src/main/java/egovframework/com/uss/ion/msi/service/EgovMainImageService.java new file mode 100644 index 0000000..1f3b285 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/msi/service/EgovMainImageService.java @@ -0,0 +1,72 @@ +/** + * 개요 + * - 메인화면이미지에 대한 Service Interface를 정의한다. + * + * 상세내용 + * - 메인화면이미지에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 메인화면이미지의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이문준 + * @version 1.0 + * @created 03-8-2009 오후 2:08:58 + */ + +package egovframework.com.uss.ion.msi.service; + +import java.util.List; + +public interface EgovMainImageService { + + /** + * 메인화면이미지정보를 관리하기 위해 등록된 메인화면이미지 목록을 조회한다. + * @param mainImageVO - 메인이미지 VO + * @return List - 메인이미지 목록 + */ + public List selectMainImageList(MainImageVO mainImageVO) throws Exception; + + /** + * 메인화면이미지목록 총 갯수를 조회한다. + * @param mainImageVO - 메인이미지 VO + * @return int - 메인이미지 카운트 수 + */ + public int selectLoginScrinImageListTotCnt(MainImageVO mainImageVO) throws Exception; + + /** + * 등록된 메인화면이미지의 상세정보를 조회한다. + * @param mainImageVO - 메인이미지 VO + * @return MainImageVO - 메인이미지 VO + */ + public MainImageVO selectMainImage(MainImageVO mainImageVO) throws Exception; + + /** + * 메인화면이미지정보를 신규로 등록한다. + * @param mainImage - 메인이미지 model + * @param mainImageVO - 메인이미지 VO + */ + public MainImageVO insertMainImage(MainImage mainImage,MainImageVO mainImageVO) throws Exception; + + /** + * 기 등록된 메인화면이미지정보를 수정한다. + * @param mainImage - 메인이미지 model + */ + public void updateMainImage(MainImage mainImage) throws Exception; + + /** + * 기 등록된 메인화면이미지정보를 삭제한다. + * @param mainImage - 메인이미지 model + */ + public void deleteMainImage(MainImage mainImage) throws Exception; + + /** + * 기 등록된 메인화면이미지정보의 이미지파일을 삭제한다. + * @param mainImage - 메인이미지 model + */ + public void deleteMainImageFile(MainImage mainImage) throws Exception; + + /** + * 메인화면이미지가 특정화면에 반영된 결과를 조회한다. + * @param mainImageVO - 메인이미지 VO + * @return List - 메인이미지 목록 + */ + public List selectMainImageResult(MainImageVO mainImageVO) throws Exception; + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/msi/service/MainImage.java b/src/main/java/egovframework/com/uss/ion/msi/service/MainImage.java new file mode 100644 index 0000000..35e2619 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/msi/service/MainImage.java @@ -0,0 +1,168 @@ +/** + * 개요 + * - 메인화면이미지에 대한 model 클래스를 정의한다. + * + * 상세내용 + * - 메인화면이미지의 일련번호, 이미지명, 링크URL, 이미지설명, 반영여부 항목을 관리한다. + * @author 이문준 + * @version 1.0 + * @created 03-8-2009 오후 2:08:57 + */ + +package egovframework.com.uss.ion.msi.service; + +import egovframework.com.cmm.ComDefaultVO; + +public class MainImage extends ComDefaultVO { + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + /** + * 이미지 ID + */ + private String imageId; + /** + * 이미지명 + */ + private String imageNm; + /** + * 메인 이미지 + */ + private String image; + /** + * 메인 이미지 파일 + */ + private String imageFile; + /** + * 이미지 설명 + */ + private String imageDc; + /** + * 반영여부 + */ + private String reflctAt; + /** + * 사용자 ID + */ + private String userId; + /** + * 등록일자 + */ + private String regDate; + /** + * 파일첨부여부 + */ + private boolean isAtchFile; + + /** + * @return the imageId + */ + public String getImageId() { + return imageId; + } + /** + * @param imageId the imageId to set + */ + public void setImageId(String imageId) { + this.imageId = imageId; + } + /** + * @return the imageNm + */ + public String getImageNm() { + return imageNm; + } + /** + * @param imageNm the imageNm to set + */ + public void setImageNm(String imageNm) { + this.imageNm = imageNm; + } + /** + * @return the image + */ + public String getImage() { + return image; + } + /** + * @param image the image to set + */ + public void setImage(String image) { + this.image = image; + } + /** + * @return the imageFile + */ + public String getImageFile() { + return imageFile; + } + /** + * @param imageFile the imageFile to set + */ + public void setImageFile(String imageFile) { + this.imageFile = imageFile; + } + /** + * @return the imageDc + */ + public String getImageDc() { + return imageDc; + } + /** + * @param imageDc the imageDc to set + */ + public void setImageDc(String imageDc) { + this.imageDc = imageDc; + } + /** + * @return the reflctAt + */ + public String getReflctAt() { + return reflctAt; + } + /** + * @param reflctAt the reflctAt to set + */ + public void setReflctAt(String reflctAt) { + this.reflctAt = reflctAt; + } + /** + * @return the userId + */ + public String getUserId() { + return userId; + } + /** + * @param userId the userId to set + */ + public void setUserId(String userId) { + this.userId = userId; + } + /** + * @return the regDate + */ + public String getRegDate() { + return regDate; + } + /** + * @param regDate the regDate to set + */ + public void setRegDate(String regDate) { + this.regDate = regDate; + } + /** + * @return the isAtchFile + */ + public boolean isAtchFile() { + return isAtchFile; + } + /** + * @param isAtchFile the isAtchFile to set + */ + public void setAtchFile(boolean isAtchFile) { + this.isAtchFile = isAtchFile; + } + + +} diff --git a/src/main/java/egovframework/com/uss/ion/msi/service/MainImageVO.java b/src/main/java/egovframework/com/uss/ion/msi/service/MainImageVO.java new file mode 100644 index 0000000..cea8df5 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/msi/service/MainImageVO.java @@ -0,0 +1,58 @@ +/** + * 개요 + * - 메인화면이미지에 대한 Vo 클래스를 정의한다. + * + * 상세내용 + * - 메인화면이미지의 목록 항목을 관리한다. + * @author 이문준 + * @version 1.0 + * @created 03-8-2009 오후 2:08:58 + */ + +package egovframework.com.uss.ion.msi.service; + +import java.util.List; + +public class MainImageVO extends MainImage { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + /** + * 메인화면이미지 목록 + */ + List mainImageList; + /** + * 삭제대상 목록 + */ + String[] delYn; + + /** + * @return the mainImageList + */ + public List getMainImageList() { + return mainImageList; + } + /** + * @param mainImageList the mainImageList to set + */ + public void setMainImageList(List mainImageList) { + this.mainImageList = mainImageList; + } + /** + * @return the delYn + */ + public String[] getDelYn() { + return delYn; + } + /** + * @param delYn the delYn to set + */ + public void setDelYn(String[] delYn) { + this.delYn = delYn; + } + + + +} diff --git a/src/main/java/egovframework/com/uss/ion/msi/service/impl/EgovMainImageServiceImpl.java b/src/main/java/egovframework/com/uss/ion/msi/service/impl/EgovMainImageServiceImpl.java new file mode 100644 index 0000000..5d89056 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/msi/service/impl/EgovMainImageServiceImpl.java @@ -0,0 +1,118 @@ +/** + * 개요 + * - 메인화면이미지에 대한 ServiceImpl 클래스를 정의한다. + * + * 상세내용 + * - 메인화면이미지에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 메인화면이미지의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이문준 + * @version 1.0 + * @created 03-8-2009 오후 2:08:58 + * + * 수정 + * 2017.02.08 이정은 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + */ + +package egovframework.com.uss.ion.msi.service.impl; + +import java.io.File; +import java.util.List; + +import egovframework.com.cmm.service.FileVO; +import egovframework.com.uss.ion.msi.service.EgovMainImageService; +import egovframework.com.uss.ion.msi.service.MainImage; +import egovframework.com.uss.ion.msi.service.MainImageVO; +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import javax.annotation.Resource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +@Service("egovMainImageService") +public class EgovMainImageServiceImpl extends EgovAbstractServiceImpl implements EgovMainImageService { + private static final Logger LOGGER = LoggerFactory.getLogger(EgovMainImageServiceImpl.class); + + @Resource(name="mainImageDAO") + private MainImageDAO mainImageDAO; + + /** + * 메인화면이미지정보를 관리하기 위해 등록된 메인화면이미지 목록을 조회한다. + * @param mainImageVO - 메인이미지 VO + * @return List - 메인이미지 목록 + */ + public List selectMainImageList(MainImageVO mainImageVO) throws Exception { + return mainImageDAO.selectMainImageList(mainImageVO); + } + + /** + * 메인화면이미지목록 총 갯수를 조회한다. + * @param mainImageVO - 메인이미지 VO + * @return int - 메인이미지 카운트 수 + */ + public int selectLoginScrinImageListTotCnt(MainImageVO mainImageVO) throws Exception { + return mainImageDAO.selectMainImageListTotCnt(mainImageVO); + } + + /** + * 등록된 메인화면이미지의 상세정보를 조회한다. + * @param mainImageVO - 메인이미지 VO + * @return MainImageVO - 메인이미지 VO + */ + public MainImageVO selectMainImage(MainImageVO mainImageVO) throws Exception { + return mainImageDAO.selectMainImage(mainImageVO); + } + + /** + * 메인화면이미지정보를 신규로 등록한다. + * @param mainImage - 메인이미지 model + */ + public MainImageVO insertMainImage(MainImage mainImage,MainImageVO mainImageVO) throws Exception { + mainImageDAO.insertMainImage(mainImage); + mainImageVO.setImageId(mainImage.getImageId()); + return selectMainImage(mainImageVO); + } + + /** + * 기 등록된 메인화면이미지정보를 수정한다. + * @param mainImage - 메인이미지 model + */ + public void updateMainImage(MainImage mainImage) throws Exception { + mainImageDAO.updateMainImage(mainImage); + } + + /** + * 기 등록된 메인화면이미지정보를 삭제한다. + * @param mainImage - 메인이미지 model + */ + public void deleteMainImage(MainImage mainImage) throws Exception { + + deleteMainImageFile(mainImage); + mainImageDAO.deleteMainImage(mainImage); + } + + /** + * 기 등록된 메인화면이미지정보의 이미지파일을 삭제한다. + * @param mainImage - 메인이미지 model + */ + public void deleteMainImageFile(MainImage mainImage) throws Exception { + FileVO fileVO = (FileVO)mainImageDAO.selectMainImageFile(mainImage); + File file = new File(fileVO.getFileStreCours()+fileVO.getStreFileNm()); + //2017.02.08 이정은 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + if(file.delete()){ + LOGGER.debug("[file.delete] file : File Deletion Success"); + }else{ + LOGGER.error("[file.delete] file : File Deletion Fail"); + } + } + + /** + * 메인화면이미지가 특정화면에 반영된 결과를 조회한다. + * @param mainImageVO - 메인이미지 VO + * @return MainImageVO - 메인이미지 VO + */ + public List selectMainImageResult(MainImageVO mainImageVO) throws Exception { + return mainImageDAO.selectMainImageResult(mainImageVO); + } +} diff --git a/src/main/java/egovframework/com/uss/ion/msi/service/impl/MainImageDAO.java b/src/main/java/egovframework/com/uss/ion/msi/service/impl/MainImageDAO.java new file mode 100644 index 0000000..d03e358 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/msi/service/impl/MainImageDAO.java @@ -0,0 +1,95 @@ +/** + * 개요 + * - 메인화면이미지에 대한 DAO 클래스를 정의한다. + * + * 상세내용 + * - 메인화면이미지에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 메인화면이미지의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이문준 + * @version 1.0 + * @created 03-8-2009 오후 2:08:58 + */ + +package egovframework.com.uss.ion.msi.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.FileVO; +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.ion.msi.service.MainImage; +import egovframework.com.uss.ion.msi.service.MainImageVO; + +import org.springframework.stereotype.Repository; + +@Repository("mainImageDAO") +public class MainImageDAO extends EgovComAbstractDAO { + + /** + * 메인화면이미지정보를 관리하기 위해 등록된 메인화면이미지 목록을 조회한다. + * @param mainImageVO - 메인이미지 VO + * @return List - 메인이미지 목록 + */ + public List selectMainImageList(MainImageVO mainImageVO) throws Exception { + return selectList("mainImageDAO.selectMainImageList", mainImageVO); + } + + /** + * 메인화면이미지목록 총 갯수를 조회한다. + * @param mainImageVO - 메인화면이미지 VO + * @return int + * @exception Exception + */ + public int selectMainImageListTotCnt(MainImageVO mainImageVO) throws Exception { + return (Integer)selectOne("mainImageDAO.selectMainImageListTotCnt", mainImageVO); + } + + /** + * 등록된 메인화면이미지의 상세정보를 조회한다. + * @param mainImageVO - 메인이미지 VO + * @return MainImageVO - 메인이미지 VO + */ + public MainImageVO selectMainImage(MainImageVO mainImageVO) throws Exception { + return (MainImageVO) selectOne("mainImageDAO.selectMainImage", mainImageVO); + } + + /** + * 메인화면이미지정보를 신규로 등록한다. + * @param mainImage - 메인이미지 model + */ + public void insertMainImage(MainImage mainImage) throws Exception { + insert("mainImageDAO.insertMainImage", mainImage); + } + + /** + * 기 등록된 메인화면이미지정보를 수정한다. + * @param mainImage - 메인이미지 model + */ + public void updateMainImage(MainImage mainImage) throws Exception { + update("mainImageDAO.updateMainImage", mainImage); + } + + /** + * 기 등록된 메인화면이미지정보를 삭제한다. + * @param mainImage - 메인이미지 model + */ + public void deleteMainImage(MainImage mainImage) throws Exception { + delete("mainImageDAO.deleteMainImage", mainImage); + } + + /** + * 기 등록된 메인화면이미지정보의 이미지파일을 삭제하기 위해 파일정보를 조회한다. + * @param mainImage - 메인이미지 model + */ + public FileVO selectMainImageFile(MainImage mainImage) throws Exception { + return (FileVO) selectOne("mainImageDAO.selectMainImageFile", mainImage); + } + + /** + * 메인화면이미지가 특정화면에 반영된 결과를 조회한다. + * @param mainImageVO - 메인이미지 VO + * @return MainImageVO - 메인이미지 VO + */ + public List selectMainImageResult(MainImageVO mainImageVO) throws Exception { + return selectList("mainImageDAO.selectMainImageResult", mainImageVO); + } +} diff --git a/src/main/java/egovframework/com/uss/ion/msi/web/EgovMainImageController.java b/src/main/java/egovframework/com/uss/ion/msi/web/EgovMainImageController.java new file mode 100644 index 0000000..a14abfa --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/msi/web/EgovMainImageController.java @@ -0,0 +1,330 @@ +/** + * 개요 + * - 메인화면이미지에 대한 controller 클래스를 정의한다. + * + * 상세내용 + * - 메인화면이미지에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 메인화면이미지의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이문준 + * @version 1.0 + * @created 03-8-2009 오후 2:08:57 + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2010.8.3	이문준          최초 생성
    + *  2011.8.26	정진오			IncludedInfo annotation 추가
    + *
    + *  
    + */ + +package egovframework.com.uss.ion.msi.web; + +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +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.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.service.EgovFileMngService; +import egovframework.com.cmm.service.EgovFileMngUtil; +import egovframework.com.cmm.service.FileVO; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.ion.msi.service.EgovMainImageService; +import egovframework.com.uss.ion.msi.service.MainImage; +import egovframework.com.uss.ion.msi.service.MainImageVO; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + + +@Controller +public class EgovMainImageController { + + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name="EgovFileMngService") + private EgovFileMngService fileMngService; + + @Resource(name="EgovFileMngUtil") + private EgovFileMngUtil fileUtil; + + /** Message ID Generation */ + @Resource(name="egovMainImageIdGnrService") + private EgovIdGnrService egovMainImageIdGnrService; + + @Resource(name = "egovMainImageService") + private EgovMainImageService egovMainImageService; + + @Autowired + private DefaultBeanValidator beanValidator; + + /** + * 메인화면이미지 목록화면 이동 + * @return String + * @exception Exception + */ + @RequestMapping("/uss/ion/msi/selectMainImageListView.do") + public String selectMainImageListView() throws Exception { + + return "egovframework/com/uss/ion/msi/EgovMainImageList"; + } + + /** + * 메인화면이미지정보를 관리하기 위해 등록된 메인화면이미지 목록을 조회한다. + * @param mainImageVO - 메인이미지 VO + * @return String - 리턴 Url + */ + @IncludedInfo(name="메인이미지관리", order = 770 ,gid = 50) + @RequestMapping("/uss/ion/msi/selectMainImageList.do") + public String selectMainImageList(@ModelAttribute("mainImageVO") MainImageVO mainImageVO, + ModelMap model) throws Exception { + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(mainImageVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(mainImageVO.getPageUnit()); + paginationInfo.setPageSize(mainImageVO.getPageSize()); + + mainImageVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + mainImageVO.setLastIndex(paginationInfo.getLastRecordIndex()); + mainImageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + mainImageVO.setMainImageList(egovMainImageService.selectMainImageList(mainImageVO)); + + model.addAttribute("mainImageList", mainImageVO.getMainImageList()); + + int totCnt = egovMainImageService.selectLoginScrinImageListTotCnt(mainImageVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/uss/ion/msi/EgovMainImageList"; + } + + /** + * 등록된 메인화면이미지의 상세정보를 조회한다. + * @param mainImageVO - 메인이미지 VO + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/msi/getMainImage.do") + public String selectMainImage(@RequestParam("imageId") String imageId, + @ModelAttribute("mainImageVO") MainImageVO mainImageVO, + ModelMap model) throws Exception { + + mainImageVO.setImageId(imageId); + model.addAttribute("mainImage", egovMainImageService.selectMainImage(mainImageVO)); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/uss/ion/msi/EgovMainImageUpdt"; + } + + /** + * 메인인화면이미지 등록 화면으로 이동한다. + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/msi/addViewMainImage.do") + public String insertViewMainImage(@ModelAttribute("mainImageVO") MainImageVO mainImageVO) throws Exception { + return "egovframework/com/uss/ion/msi/EgovMainImageRegist"; + } + + /** + * 메인화면이미지정보를 신규로 등록한다. + * @param mainImage - 메인이미지 model + * @return String - 리턴 Url + */ + @SuppressWarnings("unused") + @RequestMapping(value="/uss/ion/msi/addMainImage.do") + public String insertMainImage(final MultipartHttpServletRequest multiRequest, + @ModelAttribute("mainImage") MainImage mainImage, + @ModelAttribute("mainImageVO") MainImageVO mainImageVO, + BindingResult bindingResult, + ModelMap model) throws Exception { + + beanValidator.validate(mainImage, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + model.addAttribute("mainImageVO", mainImageVO); + return "egovframework/com/uss/ion/msi/EgovMainImageRegist"; + } else { + + List result = null; + + String uploadFolder = ""; + String image = ""; + String imageFile = ""; + String atchFileId = ""; + + final Map files = multiRequest.getFileMap(); + + if(!files.isEmpty()){ + result = fileUtil.parseFileInf(files, "MSI_", 0, "", uploadFolder); + atchFileId = fileMngService.insertFileInfs(result); + + FileVO vo = result.get(0); + Iterator iter = result.iterator(); + + while (iter.hasNext()) { + vo = iter.next(); + image = vo.getOrignlFileNm(); + imageFile = vo.getStreFileNm(); + } + } + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + mainImage.setImageId(egovMainImageIdGnrService.getNextStringId()); + mainImage.setImage(image); + mainImage.setImageFile(atchFileId); + mainImage.setImageId(mainImage.getImageId()); + mainImage.setUserId(user == null ? "" : EgovStringUtil.isNullToString(user.getId())); + + model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); + model.addAttribute("mainImage", egovMainImageService.insertMainImage(mainImage, mainImageVO)); + +// return "egovframework/com/uss/ion/msi/EgovMainImageUpdt"; + return "forward:/uss/ion/msi/selectMainImageList.do"; + + } + } + + /** + * 기 등록된 메인화면이미지정보를 수정한다. + * @param mainImage - 메인이미지 model + * @return String - 리턴 Url + */ + @SuppressWarnings("unused") + @RequestMapping(value="/uss/ion/msi/updtMainImage.do") + public String updateMainImage(final MultipartHttpServletRequest multiRequest, + @ModelAttribute("mainImage") MainImage mainImage, + BindingResult bindingResult, + ModelMap model) throws Exception { + + beanValidator.validate(mainImage, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + model.addAttribute("mainImageVO", mainImage); + return "egovframework/com/uss/ion/msi/EgovMainImageUpdt"; + } else { + + List result = null; + + String uploadFolder = ""; + String image = ""; + String imageFile = ""; + String atchFileId = ""; + + final Map files = multiRequest.getFileMap(); + + if(!files.isEmpty()){ + result = fileUtil.parseFileInf(files, "MSI_", 0, "", uploadFolder); + atchFileId = fileMngService.insertFileInfs(result); + + FileVO vo = null; + Iterator iter = result.iterator(); + + while (iter.hasNext()) { + vo = iter.next(); + image = vo.getOrignlFileNm(); + imageFile = vo.getStreFileNm(); + } + + if (vo == null) { + mainImage.setAtchFile(false); + } else { + mainImage.setImage(image); + mainImage.setImageFile(atchFileId); + mainImage.setAtchFile(true); + } + } else { + mainImage.setAtchFile(false); + } + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + mainImage.setUserId(user == null ? "" : EgovStringUtil.isNullToString(user.getId())); + + egovMainImageService.updateMainImage(mainImage); +// return "forward:/uss/ion/msi/getMainImage.do"; + return "forward:/uss/ion/msi/selectMainImageList.do"; + } + } + + /** + * 기 등록된 메인화면이미지정보를 삭제한다. + * @param mainImage - 메인이미지 model + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/msi/removeMainImage.do") + public String deleteMainImage(@RequestParam("imageId") String imageId, + @ModelAttribute("mainImage") MainImage mainImage, + ModelMap model) throws Exception { + + mainImage.setImageId(imageId); + egovMainImageService.deleteMainImage(mainImage); + model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); + return "forward:/uss/ion/msi/selectMainImageList.do"; + } + + /** + * 기 등록된 메인화면이미지정보를 삭제한다. + * @param mainImage - 메인이미지 model + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/msi/removeMainImageList.do") + public String deleteMainImageList(@RequestParam("imageIds") String imageIds, + @ModelAttribute("mainImage") MainImage mainImage, + ModelMap model) throws Exception { + + String [] strImageIds = imageIds.split(";"); + + for(int i=0; i fileList = egovMainImageService.selectMainImageResult(mainImageVO); + model.addAttribute("fileList", fileList); + + return "egovframework/com/uss/ion/msi/EgovMainImageView"; + } +} diff --git a/src/main/java/egovframework/com/uss/ion/mtg/service/EgovMtgPlaceManageService.java b/src/main/java/egovframework/com/uss/ion/mtg/service/EgovMtgPlaceManageService.java new file mode 100644 index 0000000..99b2341 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/mtg/service/EgovMtgPlaceManageService.java @@ -0,0 +1,111 @@ +package egovframework.com.uss.ion.mtg.service; + +import java.util.List; + +/** + * 개요 + * - 회의실관리에 대한 Service Interface를 정의한다. + * + * 상세내용 + * - 회의실관리에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 회의실관리의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +public interface EgovMtgPlaceManageService { + + /** + * 회의실관리 정보를 관리하기 위해 등록된 회의실 목록을 조회한다. + * @param mtgPlaceManageVO - 회의실관리 VO + * @return List - 회의실관리 목록 + */ + public List selectMtgPlaceManageList(MtgPlaceManageVO mtgPlaceManageVO) throws Exception; + + /** + * 회의실관리 목록 총 갯수를 조회한다. + * @param mtgPlaceManageVO - 회의실관리 VO + * @return int - 회의실관리 카운트 수 + */ + public int selectMtgPlaceManageListTotCnt(MtgPlaceManageVO mtgPlaceManageVO) throws Exception ; + + /** + * 등록된 회의실관리의 상세정보를 조회한다. + * @param mtgPlaceManageVO - 회의실관리 VO + * @return MtgPlaceManageVO - 회의실관리 VO + */ + public MtgPlaceManage selectMtgPlaceManage(MtgPlaceManageVO mtgPlaceManageVO) throws Exception; + + /** + * 회의실관리 정보를 신규로 등록한다. + * @param mtgPlaceManage - 회의실관리 model + */ + public void insertMtgPlaceManage(MtgPlaceManage mtgPlaceManage, MtgPlaceManageVO mtgPlaceManageVO) throws Exception; + + /** + * 기 등록된 회의실관리 정보를 수정한다. + * @param mtgPlaceManage - 회의실관리 model + */ + public void updtMtgPlaceManage(MtgPlaceManage mtgPlaceManage, MtgPlaceManageVO mtgPlaceManageVO) throws Exception; + + /** + * 기 등록된 회의실관리 정보를 삭제한다. + * @param mtgPlaceManage - 회의실관리 model + */ + public void deleteMtgPlaceManage(MtgPlaceManage mtgPlaceManage) throws Exception; + + /** + * 회의실관리가 특정화면에 반영된 결과를 조회한다. + * @param mtgPlaceManageVO - 회의실관리 VO + * @return MtgPlaceManageVO - 회의실관리 VO + */ + //public List selectMtgPlaceManageResult(MtgPlaceManageVO mtgPlaceManageVO) throws Exception; + + /******** 회의실 예약 관리 *************/ + /** + * 회의실 예약정보를 관리하기 위해 등록된 회의실 예약 목록을 조회한다. + * @param mtgPlaceManageVO - 회의실관리 VO + * @return List - 회의실관리 목록 + */ + public List selectMtgPlaceResveManageList(MtgPlaceManageVO mtgPlaceManageVO) throws Exception; + + /** + * 회의실예약 신청화면을 조회한다. + * @param mtgPlaceManageVO - 회의실관리 VO + * @return MtgPlaceManageVO - 회의실관리 VO + */ + public MtgPlaceManageVO selectMtgPlaceResve(MtgPlaceManageVO mtgPlaceManageVO) throws Exception; + + /** + * 등록된 회의실 예약 상세정보를 조회한다. + * @param mtgPlaceManageVO - 회의실관리 VO + * @return MtgPlaceManageVO - 회의실관리 VO + */ + public MtgPlaceManageVO selectMtgPlaceResveDetail(MtgPlaceManageVO mtgPlaceManageVO) throws Exception; + + /** + * 회의실 예약정보를 신규로 등록한다. + * @param mtgPlaceManage - 회의실예약 model + */ + public void insertMtgPlaceResve(MtgPlaceResve mtgPlaceResve) throws Exception; + + /** + * 기 등록된 회의실 예약정보를 수정한다. + * @param mtgPlaceManage - 회의실예약 model + */ + public void updtMtgPlaceResve(MtgPlaceResve mtgPlaceResve) throws Exception; + + /** + * 기 등록된 회의실 예약정보를 삭제한다. + * @param mtgPlaceManage - 회의실예약 model + */ + public void deleteMtgPlaceResve(MtgPlaceResve mtgPlaceResve) throws Exception; + + /** + * 회의실 중복여부 체크. + * @param mtgPlaceManageVO - 회의실관리 VO + * @return int - 중복건수 + */ + public int mtgPlaceResveDplactCeck(MtgPlaceManageVO mtgPlaceManageVO) throws Exception; +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/mtg/service/MtgPlaceManage.java b/src/main/java/egovframework/com/uss/ion/mtg/service/MtgPlaceManage.java new file mode 100644 index 0000000..e0b6a39 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/mtg/service/MtgPlaceManage.java @@ -0,0 +1,250 @@ +package egovframework.com.uss.ion.mtg.service; + +import egovframework.com.cmm.ComDefaultVO; + +/** + * 개요 + * - 회의실관리에 대한 model 클래스를 정의한다. + * + * 상세내용 + * - 회의실관리의 회의실코드,회의실명,개방시작시간,개방종료시간,수용가능인원,위치구분,위치상세,최초등록자ID,최초등록시점,최종수정자ID,최종수정시점 항목을 관리한다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +public class MtgPlaceManage extends ComDefaultVO { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + + /** + * 회의실ID + */ + private String mtgPlaceId; + + /** + * 회의실명 + */ + private String mtgPlaceNm; + + /** + * 개방시작시간 + */ + private String opnBeginTm; + + /** + * 개방종료시간 + */ + private String opnEndTm; + + /** + * 수용가능인원 + */ + private int aceptncPosblNmpr; + + /** + * 위치구분 + */ + private String lcSe; + + /** + * 위치상세 + */ + private String lcDetail; + + /** + * 첨부파일 + */ + private String atchFileId; + + /** + * 최초등록자ID + */ + private String frstRegisterId; + + /** + * 최초등록시점 + */ + private String frstRegisterPnttm; + + /** + * 최종수정자ID + */ + private String lastUpdusrId; + + /** + * 최종수정시점 + */ + private String lastUpdusrPnttm; + + /** + * @return the mtgPlaceCd + */ + public String getMtgPlaceId() { + return mtgPlaceId; + } + + /** + * @param mtgPlaceCd the mtgPlaceCd to set + */ + public void setMtgPlaceId(String mtgPlaceId) { + this.mtgPlaceId = mtgPlaceId; + } + + /** + * @return the mtgPlaceNm + */ + public String getMtgPlaceNm() { + return mtgPlaceNm; + } + + /** + * @param mtgPlaceNm the mtgPlaceNm to set + */ + public void setMtgPlaceNm(String mtgPlaceNm) { + this.mtgPlaceNm = mtgPlaceNm; + } + + /** + * @return the opnBeginTm + */ + public String getOpnBeginTm() { + return opnBeginTm; + } + + /** + * @param opnBeginTm the opnBeginTm to set + */ + public void setOpnBeginTm(String opnBeginTm) { + this.opnBeginTm = opnBeginTm; + } + + /** + * @return the opnEndTm + */ + public String getOpnEndTm() { + return opnEndTm; + } + + /** + * @param opnEndTm the opnEndTm to set + */ + public void setOpnEndTm(String opnEndTm) { + this.opnEndTm = opnEndTm; + } + + /** + * @return the aceptncPosblNmpr + */ + public int getAceptncPosblNmpr() { + return aceptncPosblNmpr; + } + + /** + * @param aceptncPosblNmpr the aceptncPosblNmpr to set + */ + public void setAceptncPosblNmpr(int aceptncPosblNmpr) { + this.aceptncPosblNmpr = aceptncPosblNmpr; + } + + /** + * @return the lcSe + */ + public String getLcSe() { + return lcSe; + } + + /** + * @param lcSe the lcSe to set + */ + public void setLcSe(String lcSe) { + this.lcSe = lcSe; + } + + /** + * @return the lcDetail + */ + public String getLcDetail() { + return lcDetail; + } + + /** + * @param lcDetail the lcDetail to set + */ + public void setLcDetail(String lcDetail) { + this.lcDetail = lcDetail; + } + + /** + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * @param frstRegisterId the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * @param frstRegisterPnttm the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * @param lastUpdusrId the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + /** + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * @param lastUpdusrPnttm the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * @return the atchFileId + */ + public String getAtchFileId() { + return atchFileId; + } + + /** + * @param atchFileId the atchFileId to set + */ + public void setAtchFileId(String atchFileId) { + this.atchFileId = atchFileId; + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/mtg/service/MtgPlaceManageVO.java b/src/main/java/egovframework/com/uss/ion/mtg/service/MtgPlaceManageVO.java new file mode 100644 index 0000000..acd0a92 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/mtg/service/MtgPlaceManageVO.java @@ -0,0 +1,673 @@ +package egovframework.com.uss.ion.mtg.service; + +import java.io.Serializable; +import java.util.List; + +/** + * 개요 + * - 회의실관리에 대한 Vo 클래스를 정의한다. + * + * 상세내용 + * - 회의실관리의 목록 항목을 관리한다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +public class MtgPlaceManageVO extends MtgPlaceManage implements Serializable { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + /** + * 회의실관리 목록 + */ + List mtgPlaceManageList; + + /** + * 예약ID + */ + private String resveId; + + /** + * 회의제목 + */ + private String mtgSj; + + /** + * 예약자ID + */ + private String resveManId; + + /** + * 예약일자 + */ + private String resveDe; + + /** + * 예약시작시간 + */ + private String resveBeginTm; + + /** + * 예약종료시간 + */ + private String resveEndTm; + + /** + * 참석인원 + */ + private int atndncNmpr; + + /** + * 회의내용 + */ + private String mtgCn; + + /** + * list 번호 + */ + private int rowCount; + + /** + * 출력 변수 1 + */ + private String mtgPlaceTemp1; + + /** + * 출력 변수 2 + */ + private String mtgPlaceTemp2; + + /** + * 출력 변수 3 + */ + private String mtgPlaceTemp3; + + /** + * 출력 변수 4 + */ + private String mtgPlaceTemp4; + + /** + * 출력 변수 5 + */ + private String mtgPlaceTemp5; + + /** + * ID 변수 + */ + private String usidTemp; + + /** + * 시간출력 변수 + */ + private String resveTemp0800; + private String resveTemp0830; + private String resveTemp0900; + private String resveTemp0930; + private String resveTemp1000; + private String resveTemp1030; + private String resveTemp1100; + private String resveTemp1130; + private String resveTemp1200; + private String resveTemp1230; + private String resveTemp1300; + private String resveTemp1330; + private String resveTemp1400; + private String resveTemp1430; + private String resveTemp1500; + private String resveTemp1530; + private String resveTemp1600; + private String resveTemp1630; + private String resveTemp1700; + private String resveTemp1730; + private String resveTemp1800; + private String resveTemp1830; + private String resveTemp1900; + private String resveTemp1930; + private String resveTemp2000; + private String resveTemp2030; + private String resveTemp2100; + + /** + * resveDeView 변수 + */ + private String resveDeView; + + + + /** + * @return the resveDeView + */ + public String getResveDeView() { + return resveDeView; + } + /** + * @param resveDeView the resveDeView to set + */ + public void setResveDeView(String resveDeView) { + this.resveDeView = resveDeView; + } + /** + * @return the resveId + */ + public String getResveId() { + return resveId; + } + /** + * @param resveId the resveId to set + */ + public void setResveId(String resveId) { + this.resveId = resveId; + } + + /** + * @return the mtgSj + */ + public String getMtgSj() { + return mtgSj; + } + /** + * @param mtgSj the mtgSj to set + */ + public void setMtgSj(String mtgSj) { + this.mtgSj = mtgSj; + } + /** + * @return the resveManId + */ + public String getResveManId() { + return resveManId; + } + /** + * @param resveManId the resveManId to set + */ + public void setResveManId(String resveManId) { + this.resveManId = resveManId; + } + /** + * @return the resveBeginTm + */ + public String getResveBeginTm() { + return resveBeginTm; + } + /** + * @param resveBeginTm the resveBeginTm to set + */ + public void setResveBeginTm(String resveBeginTm) { + this.resveBeginTm = resveBeginTm; + } + /** + * @return the resveEndTm + */ + public String getResveEndTm() { + return resveEndTm; + } + /** + * @param resveEndTm the resveEndTm to set + */ + public void setResveEndTm(String resveEndTm) { + this.resveEndTm = resveEndTm; + } + + + /** + * @return the mtgPlaceManageList + */ + public List getMtgPlaceManageList() { + return mtgPlaceManageList; + } + /** + * @param eventManage the mtgPlaceManage to set + */ + public void setMtgPlaceManageList(List mtgPlaceManageList) { + this.mtgPlaceManageList = mtgPlaceManageList; + } + /** + * @return the rowCount + */ + public int getRowCount() { + return rowCount; + } + /** + * @param rowCount the rowCount to set + */ + public void setRowCount(int rowCount) { + this.rowCount = rowCount; + } + /** + * @return the mtgPlaceTemp1 + */ + public String getMtgPlaceTemp1() { + return mtgPlaceTemp1; + } + /** + * @param mtgPlaceTemp1 the mtgPlaceTemp1 to set + */ + public void setMtgPlaceTemp1(String mtgPlaceTemp1) { + this.mtgPlaceTemp1 = mtgPlaceTemp1; + } + /** + * @return the mtgPlaceTemp2 + */ + public String getMtgPlaceTemp2() { + return mtgPlaceTemp2; + } + /** + * @param mtgPlaceTemp2 the mtgPlaceTemp2 to set + */ + public void setMtgPlaceTemp2(String mtgPlaceTemp2) { + this.mtgPlaceTemp2 = mtgPlaceTemp2; + } + /** + * @return the mtgPlaceTemp3 + */ + public String getMtgPlaceTemp3() { + return mtgPlaceTemp3; + } + /** + * @param mtgPlaceTemp3 the mtgPlaceTemp3 to set + */ + public void setMtgPlaceTemp3(String mtgPlaceTemp3) { + this.mtgPlaceTemp3 = mtgPlaceTemp3; + } + /** + * @return the mtgPlaceTemp4 + */ + public String getMtgPlaceTemp4() { + return mtgPlaceTemp4; + } + /** + * @param mtgPlaceTemp4 the mtgPlaceTemp4 to set + */ + public void setMtgPlaceTemp4(String mtgPlaceTemp4) { + this.mtgPlaceTemp4 = mtgPlaceTemp4; + } + /** + * @return the mtgPlaceTemp5 + */ + public String getMtgPlaceTemp5() { + return mtgPlaceTemp5; + } + /** + * @param mtgPlaceTemp5 the mtgPlaceTemp5 to set + */ + public void setMtgPlaceTemp5(String mtgPlaceTemp5) { + this.mtgPlaceTemp5 = mtgPlaceTemp5; + } + /** + * @return the resveDe + */ + public String getResveDe() { + return resveDe; + } + /** + * @param resveDe the resveDe to set + */ + public void setResveDe(String resveDe) { + this.resveDe = resveDe; + } + /** + * @return the atndncNmpr + */ + public int getAtndncNmpr() { + return atndncNmpr; + } + /** + * @param atndncNmpr the atndncNmpr to set + */ + public void setAtndncNmpr(int atndncNmpr) { + this.atndncNmpr = atndncNmpr; + } + /** + * @return the mtgCn + */ + public String getMtgCn() { + return mtgCn; + } + /** + * @param mtgCn the mtgCn to set + */ + public void setMtgCn(String mtgCn) { + this.mtgCn = mtgCn; + } + /** + * @return the resveTemp0800 + */ + public String getResveTemp0800() { + return resveTemp0800; + } + /** + * @param resveTemp0800 the resveTemp0800 to set + */ + public void setResveTemp0800(String resveTemp0800) { + this.resveTemp0800 = resveTemp0800; + } + /** + * @return the resveTemp0830 + */ + public String getResveTemp0830() { + return resveTemp0830; + } + /** + * @param resveTemp0830 the resveTemp0830 to set + */ + public void setResveTemp0830(String resveTemp0830) { + this.resveTemp0830 = resveTemp0830; + } + /** + * @return the resveTemp0900 + */ + public String getResveTemp0900() { + return resveTemp0900; + } + /** + * @param resveTemp0900 the resveTemp0900 to set + */ + public void setResveTemp0900(String resveTemp0900) { + this.resveTemp0900 = resveTemp0900; + } + /** + * @return the resveTemp0930 + */ + public String getResveTemp0930() { + return resveTemp0930; + } + /** + * @param resveTemp0930 the resveTemp0930 to set + */ + public void setResveTemp0930(String resveTemp0930) { + this.resveTemp0930 = resveTemp0930; + } + /** + * @return the resveTemp1000 + */ + public String getResveTemp1000() { + return resveTemp1000; + } + /** + * @param resveTemp1000 the resveTemp1000 to set + */ + public void setResveTemp1000(String resveTemp1000) { + this.resveTemp1000 = resveTemp1000; + } + /** + * @return the resveTemp1030 + */ + public String getResveTemp1030() { + return resveTemp1030; + } + /** + * @param resveTemp1030 the resveTemp1030 to set + */ + public void setResveTemp1030(String resveTemp1030) { + this.resveTemp1030 = resveTemp1030; + } + /** + * @return the resveTemp1100 + */ + public String getResveTemp1100() { + return resveTemp1100; + } + /** + * @param resveTemp1100 the resveTemp1100 to set + */ + public void setResveTemp1100(String resveTemp1100) { + this.resveTemp1100 = resveTemp1100; + } + /** + * @return the resveTemp1130 + */ + public String getResveTemp1130() { + return resveTemp1130; + } + /** + * @param resveTemp1130 the resveTemp1130 to set + */ + public void setResveTemp1130(String resveTemp1130) { + this.resveTemp1130 = resveTemp1130; + } + /** + * @return the resveTemp1200 + */ + public String getResveTemp1200() { + return resveTemp1200; + } + /** + * @param resveTemp1200 the resveTemp1200 to set + */ + public void setResveTemp1200(String resveTemp1200) { + this.resveTemp1200 = resveTemp1200; + } + /** + * @return the resveTemp1230 + */ + public String getResveTemp1230() { + return resveTemp1230; + } + /** + * @param resveTemp1230 the resveTemp1230 to set + */ + public void setResveTemp1230(String resveTemp1230) { + this.resveTemp1230 = resveTemp1230; + } + /** + * @return the resveTemp1300 + */ + public String getResveTemp1300() { + return resveTemp1300; + } + /** + * @param resveTemp1300 the resveTemp1300 to set + */ + public void setResveTemp1300(String resveTemp1300) { + this.resveTemp1300 = resveTemp1300; + } + /** + * @return the resveTemp1330 + */ + public String getResveTemp1330() { + return resveTemp1330; + } + /** + * @param resveTemp1330 the resveTemp1330 to set + */ + public void setResveTemp1330(String resveTemp1330) { + this.resveTemp1330 = resveTemp1330; + } + /** + * @return the resveTemp1400 + */ + public String getResveTemp1400() { + return resveTemp1400; + } + /** + * @param resveTemp1400 the resveTemp1400 to set + */ + public void setResveTemp1400(String resveTemp1400) { + this.resveTemp1400 = resveTemp1400; + } + /** + * @return the resveTemp1430 + */ + public String getResveTemp1430() { + return resveTemp1430; + } + /** + * @param resveTemp1430 the resveTemp1430 to set + */ + public void setResveTemp1430(String resveTemp1430) { + this.resveTemp1430 = resveTemp1430; + } + /** + * @return the resveTemp1500 + */ + public String getResveTemp1500() { + return resveTemp1500; + } + /** + * @param resveTemp1500 the resveTemp1500 to set + */ + public void setResveTemp1500(String resveTemp1500) { + this.resveTemp1500 = resveTemp1500; + } + /** + * @return the resveTemp1530 + */ + public String getResveTemp1530() { + return resveTemp1530; + } + /** + * @param resveTemp1530 the resveTemp1530 to set + */ + public void setResveTemp1530(String resveTemp1530) { + this.resveTemp1530 = resveTemp1530; + } + /** + * @return the resveTemp1600 + */ + public String getResveTemp1600() { + return resveTemp1600; + } + /** + * @param resveTemp1600 the resveTemp1600 to set + */ + public void setResveTemp1600(String resveTemp1600) { + this.resveTemp1600 = resveTemp1600; + } + /** + * @return the resveTemp1630 + */ + public String getResveTemp1630() { + return resveTemp1630; + } + /** + * @param resveTemp1630 the resveTemp1630 to set + */ + public void setResveTemp1630(String resveTemp1630) { + this.resveTemp1630 = resveTemp1630; + } + /** + * @return the resveTemp1700 + */ + public String getResveTemp1700() { + return resveTemp1700; + } + /** + * @param resveTemp1700 the resveTemp1700 to set + */ + public void setResveTemp1700(String resveTemp1700) { + this.resveTemp1700 = resveTemp1700; + } + /** + * @return the resveTemp1730 + */ + public String getResveTemp1730() { + return resveTemp1730; + } + /** + * @param resveTemp1730 the resveTemp1730 to set + */ + public void setResveTemp1730(String resveTemp1730) { + this.resveTemp1730 = resveTemp1730; + } + /** + * @return the resveTemp1800 + */ + public String getResveTemp1800() { + return resveTemp1800; + } + /** + * @param resveTemp1800 the resveTemp1800 to set + */ + public void setResveTemp1800(String resveTemp1800) { + this.resveTemp1800 = resveTemp1800; + } + /** + * @return the resveTemp1830 + */ + public String getResveTemp1830() { + return resveTemp1830; + } + /** + * @param resveTemp1830 the resveTemp1830 to set + */ + public void setResveTemp1830(String resveTemp1830) { + this.resveTemp1830 = resveTemp1830; + } + /** + * @return the resveTemp1900 + */ + public String getResveTemp1900() { + return resveTemp1900; + } + /** + * @param resveTemp1900 the resveTemp1900 to set + */ + public void setResveTemp1900(String resveTemp1900) { + this.resveTemp1900 = resveTemp1900; + } + /** + * @return the resveTemp1930 + */ + public String getResveTemp1930() { + return resveTemp1930; + } + /** + * @param resveTemp1930 the resveTemp1930 to set + */ + public void setResveTemp1930(String resveTemp1930) { + this.resveTemp1930 = resveTemp1930; + } + /** + * @return the resveTemp2000 + */ + public String getResveTemp2000() { + return resveTemp2000; + } + /** + * @param resveTemp2000 the resveTemp2000 to set + */ + public void setResveTemp2000(String resveTemp2000) { + this.resveTemp2000 = resveTemp2000; + } + /** + * @return the resveTemp2030 + */ + public String getResveTemp2030() { + return resveTemp2030; + } + /** + * @param resveTemp2030 the resveTemp2030 to set + */ + public void setResveTemp2030(String resveTemp2030) { + this.resveTemp2030 = resveTemp2030; + } + /** + * @return the resveTemp2100 + */ + public String getResveTemp2100() { + return resveTemp2100; + } + /** + * @param resveTemp2100 the resveTemp2100 to set + */ + public void setResveTemp2100(String resveTemp2100) { + this.resveTemp2100 = resveTemp2100; + } + /** + * @return the usidTemp + */ + public String getUsidTemp() { + return usidTemp; + } + /** + * @param usidTemp the usidTemp to set + */ + public void setUsidTemp(String usidTemp) { + this.usidTemp = usidTemp; + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/mtg/service/MtgPlaceResve.java b/src/main/java/egovframework/com/uss/ion/mtg/service/MtgPlaceResve.java new file mode 100644 index 0000000..1581bdd --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/mtg/service/MtgPlaceResve.java @@ -0,0 +1,270 @@ +package egovframework.com.uss.ion.mtg.service; + +import egovframework.com.cmm.ComDefaultVO; + +/** + * 개요 + * - 회의실예약에 대한 model 클래스를 정의한다. + * + * 상세내용 + * - 회의실예약의 예약ID,회의실코드,회의제목,예약자ID,예약시작시간,예약종료시간,최초등록자ID,최초등록시점,최종수정자ID,최종수정시점 항목을 관리한다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +public class MtgPlaceResve extends ComDefaultVO { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + + /** + * 예약ID + */ + private String resveId; + + /** + * 회의실코드 + */ + private String mtgPlaceId; + + /** + * 회의제목 + */ + private String mtgSj; + + /** + * 예약자ID + */ + private String resveManId; + + /** + * 예약일자 + */ + private String resveDe; + + /** + * 예약시작시간 + */ + private String resveBeginTm; + + /** + * 예약종료시간 + */ + private String resveEndTm; + + /** + * 참석인원 + */ + private int atndncNmpr; + + /** + * 회의내용 + */ + private String mtgCn; + + /** + * 최초등록자ID + */ + private String frstRegisterId; + + /** + * 최초등록시점 + */ + private String frstRegisterPnttm; + + /** + * 최종수정자ID + */ + private String lastUpdusrId; + + /** + * 최종수정시점 + */ + private String lastUpdusrPnttm; + + /** + * @return the resveId + */ + public String getResveId() { + return resveId; + } + + /** + * @param resveId the resveId to set + */ + public void setResveId(String resveId) { + this.resveId = resveId; + } + + + /** + * @return the mtgPlaceId + */ + public String getMtgPlaceId() { + return mtgPlaceId; + } + + /** + * @param mtgPlaceId the mtgPlaceId to set + */ + public void setMtgPlaceId(String mtgPlaceId) { + this.mtgPlaceId = mtgPlaceId; + } + + /** + * @return the mtgSj + */ + public String getMtgSj() { + return mtgSj; + } + + /** + * @param mtgSj the mtgSj to set + */ + public void setMtgSj(String mtgSj) { + this.mtgSj = mtgSj; + } + + /** + * @return the resveManId + */ + public String getResveManId() { + return resveManId; + } + + /** + * @param resveManId the resveManId to set + */ + public void setResveManId(String resveManId) { + this.resveManId = resveManId; + } + + /** + * @return the resveDe + */ + public String getResveDe() { + return resveDe; + } + + /** + * @param resveDe the resveDe to set + */ + public void setResveDe(String resveDe) { + this.resveDe = resveDe; + } + + /** + * @return the resveBeginTm + */ + public String getResveBeginTm() { + return resveBeginTm; + } + + /** + * @param resveBeginTm the resveBeginTm to set + */ + public void setResveBeginTm(String resveBeginTm) { + this.resveBeginTm = resveBeginTm; + } + + /** + * @return the resveEndTm + */ + public String getResveEndTm() { + return resveEndTm; + } + + /** + * @param resveEndTm the resveEndTm to set + */ + public void setResveEndTm(String resveEndTm) { + this.resveEndTm = resveEndTm; + } + + /** + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * @param frstRegisterId the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * @param frstRegisterPnttm the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * @param lastUpdusrId the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + /** + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * @param lastUpdusrPnttm the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * @return the atndncNmpr + */ + public int getAtndncNmpr() { + return atndncNmpr; + } + + /** + * @param atndncNmpr the atndncNmpr to set + */ + public void setAtndncNmpr(int atndncNmpr) { + this.atndncNmpr = atndncNmpr; + } + + /** + * @return the mtgCn + */ + public String getMtgCn() { + return mtgCn; + } + + /** + * @param mtgCn the mtgCn to set + */ + public void setMtgCn(String mtgCn) { + this.mtgCn = mtgCn; + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/mtg/service/MtgPlaceResveVO.java b/src/main/java/egovframework/com/uss/ion/mtg/service/MtgPlaceResveVO.java new file mode 100644 index 0000000..24dd2db --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/mtg/service/MtgPlaceResveVO.java @@ -0,0 +1,43 @@ +package egovframework.com.uss.ion.mtg.service; + +import java.io.Serializable; +import java.util.List; + +/** + * 개요 + * - 회의실예약에 대한 Vo 클래스를 정의한다. + * + * 상세내용 + * - 회의실예약의 목록 항목을 관리한다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +public class MtgPlaceResveVO extends MtgPlaceResve implements Serializable { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + /** + * 예약 목록 + */ + List mtgPlaceResveList; + + /** + * @return the mtgPlaceResveList + */ + public List getMtgPlaceResveList() { + return mtgPlaceResveList; + } + /** + * @param MtgPlaceResve the mtgPlaceResve to set + */ + public void setMtgPlaceResveList(List mtgPlaceResveList) { + this.mtgPlaceResveList = mtgPlaceResveList; + } + + + +} diff --git a/src/main/java/egovframework/com/uss/ion/mtg/service/impl/EgovMtgPlaceManageServiceImpl.java b/src/main/java/egovframework/com/uss/ion/mtg/service/impl/EgovMtgPlaceManageServiceImpl.java new file mode 100644 index 0000000..55935f0 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/mtg/service/impl/EgovMtgPlaceManageServiceImpl.java @@ -0,0 +1,207 @@ +/** + * 개요 + * - 회의실관리에 대한 ServiceImpl 클래스를 정의한다. + * + * 상세내용 + * - 회의실관리에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 회의실관리의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +package egovframework.com.uss.ion.mtg.service.impl; + +import java.util.ArrayList; +import java.util.List; + +import egovframework.com.uss.ion.mtg.service.EgovMtgPlaceManageService; +import egovframework.com.uss.ion.mtg.service.MtgPlaceManage; +import egovframework.com.uss.ion.mtg.service.MtgPlaceManageVO; +import egovframework.com.uss.ion.mtg.service.MtgPlaceResve; +import egovframework.com.utl.fcc.service.EgovStringUtil; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + + +@Service("egovMtgPlaceManageService") +public class EgovMtgPlaceManageServiceImpl extends EgovAbstractServiceImpl implements EgovMtgPlaceManageService { + + @Resource(name="mtgPlaceManageDAO") + private MtgPlaceManageDAO mtgPlaceManageDAO; + + /** ID Generation */ + @Resource(name="egovMtgPlaceManageIdGnrService") + private EgovIdGnrService idgenService; + + /** ID Generation */ + @Resource(name="egovMtgPlaceResveIdGnrService") + private EgovIdGnrService idgenResveService; + + /** + * 회의실관리정보를 관리하기 위해 등록된 회의실관리 목록을 조회한다. + * @param mtgPlaceManageVO - 회의실관리 VO + * @return List - 회의실관리 목록 + */ + @Override + public List selectMtgPlaceManageList(MtgPlaceManageVO mtgPlaceManageVO) throws Exception{ + return mtgPlaceManageDAO.selectMtgPlaceManageList(mtgPlaceManageVO); + } + + /** + * 회의실관리목록 총 갯수를 조회한다. + * @param mtgPlaceManageVO - 회의실관리 VO + * @return int - 회의실관리 카운트 수 + */ + @Override + public int selectMtgPlaceManageListTotCnt(MtgPlaceManageVO mtgPlaceManageVO) throws Exception { + return mtgPlaceManageDAO.selectMtgPlaceManageListTotCnt(mtgPlaceManageVO); + } + + /** + * 등록된 회의실관리의 상세정보를 조회한다. + * @param mtgPlaceManageVO - 회의실관리 VO + * @return MtgPlaceManageVO - 회의실관리 VO + */ + @Override + public MtgPlaceManage selectMtgPlaceManage(MtgPlaceManageVO mtgPlaceManageVO) throws Exception { + return mtgPlaceManageDAO.selectMtgPlaceManage(mtgPlaceManageVO); + } + + /** + * 회의실관리정보를 신규로 등록한다. + * @param mtgPlaceManage - 회의실관리 model + * @param String - 회의실비품정보 + * @param MtgPlaceManageVO - 회의실관리VOl + */ + @Override + @SuppressWarnings("unused") + public void insertMtgPlaceManage(MtgPlaceManage mtgPlaceManage, + MtgPlaceManageVO mtgPlaceManageVO) throws Exception { + String mtgPlaceId = idgenService.getNextStringId(); + mtgPlaceManage.setMtgPlaceId(mtgPlaceId); + + mtgPlaceManageDAO.insertMtgPlaceManage(mtgPlaceManage); + int insertCnt = 0; + String [] sTempMtgPlaces; + String sTemp=null; + + } + + /** + * 기 등록된 회의실관리정보를 수정한다. + * @param mtgPlaceManage - 회의실관리 model + */ + @Override + public void updtMtgPlaceManage(MtgPlaceManage mtgPlaceManage, + MtgPlaceManageVO mtgPlaceManageVO) throws Exception { + + mtgPlaceManageDAO.updtMtgPlaceManage(mtgPlaceManage); + String sMtgPlaceId = mtgPlaceManage.getMtgPlaceId(); + + } + + /** + * 기 등록된 회의실관리정보를 삭제한다. + * @param mtgPlaceManage - 회의실관리 model + */ + @Override + public void deleteMtgPlaceManage(MtgPlaceManage mtgPlaceManage) throws Exception { + String sMtgPlaceId = mtgPlaceManage.getMtgPlaceId(); + mtgPlaceManageDAO.deleteMtgPlaceManage(mtgPlaceManage); + } + + /******** 회의실 예약 관리 *************/ + + /** + * 회의실 예약정보를 관리하기 위해 등록된 회의실 예약 목록을 조회한다. + * @param mtgPlaceManageVO - 회의실관리 VO + * @return List - 회의실관리 목록 + */ + @Override + public List selectMtgPlaceResveManageList(MtgPlaceManageVO mtgPlaceManageVO) throws Exception{ + + List result = mtgPlaceManageDAO.selectMtgPlaceIDList(mtgPlaceManageVO); + List list = new ArrayList(); + String tempResveDe = EgovStringUtil.removeMinusChar(mtgPlaceManageVO.getResveDe()); + int num = result.size(); + + for (int i = 0 ; i < num ; i ++ ){ + MtgPlaceManageVO mtgPlaceManageVO1 = result.get(i); + mtgPlaceManageVO1.setResveDe(tempResveDe); + list.add(mtgPlaceManageDAO.selectMtgPlaceResveManageList(mtgPlaceManageVO1)); + } + + return list; + } + + /** + * 회의실예약 신청화면을 조회한다. + * @param mtgPlaceManageVO - 회의실관리 VO + * @return MtgPlaceManageVO - 회의실관리 VO + */ + @Override + public MtgPlaceManageVO selectMtgPlaceResve(MtgPlaceManageVO mtgPlaceManageVO) throws Exception { + return mtgPlaceManageDAO.selectMtgPlaceResve(mtgPlaceManageVO); + } + + /** + * 등록된 회의실 예약 상세정보를 조회한다. + * @param mtgPlaceManageVO - 회의실관리 VO + * @return MtgPlaceManageVO - 회의실관리 VO + */ + @Override + public MtgPlaceManageVO selectMtgPlaceResveDetail(MtgPlaceManageVO mtgPlaceManageVO) throws Exception { + return mtgPlaceManageDAO.selectMtgPlaceResveDetail(mtgPlaceManageVO); + } + + /** + * 회의실 예약정보를 신규로 등록한다. + * @param mtgPlaceManage - 회의실예약 model + */ + @Override + public void insertMtgPlaceResve(MtgPlaceResve mtgPlaceResve) throws Exception { + mtgPlaceResve.setResveDe(EgovStringUtil.removeMinusChar(mtgPlaceResve.getResveDe())); + String sResveId = idgenResveService.getNextStringId(); + mtgPlaceResve.setResveId(sResveId); + mtgPlaceManageDAO.insertMtgPlaceResve(mtgPlaceResve); + } + + /** + * 기 등록된 회의실 예약정보를 수정한다. + * @param mtgPlaceManage - 회의실예약 model + */ + @Override + public void updtMtgPlaceResve(MtgPlaceResve mtgPlaceResve) throws Exception { + mtgPlaceResve.setResveDe(EgovStringUtil.removeMinusChar(mtgPlaceResve.getResveDe())); + mtgPlaceManageDAO.updtMtgPlaceResve(mtgPlaceResve); + } + + /** + * 기 등록된 회의실 예약정보를 삭제한다. + * @param mtgPlaceManage - 회의실예약 model + */ + @Override + public void deleteMtgPlaceResve(MtgPlaceResve mtgPlaceResve) throws Exception { + mtgPlaceResve.setResveDe(EgovStringUtil.removeMinusChar(mtgPlaceResve.getResveDe())); + mtgPlaceManageDAO.deleteMtgPlaceResve(mtgPlaceResve); + } + + + /** + * 회의실 중복여부 체크. + * @param mtgPlaceManageVO - 회의실관리 VO + * @return int - 중복건수 + */ + @Override + public int mtgPlaceResveDplactCeck(MtgPlaceManageVO mtgPlaceManageVO) throws Exception { + mtgPlaceManageVO.setResveDe(EgovStringUtil.removeMinusChar(mtgPlaceManageVO.getResveDe())); + return mtgPlaceManageDAO.mtgPlaceResveDplactCeck(mtgPlaceManageVO); + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/mtg/service/impl/MtgPlaceManageDAO.java b/src/main/java/egovframework/com/uss/ion/mtg/service/impl/MtgPlaceManageDAO.java new file mode 100644 index 0000000..d6b4e4b --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/mtg/service/impl/MtgPlaceManageDAO.java @@ -0,0 +1,151 @@ +/** + * 개요 + * - 회의실관리에 대한 DAO 클래스를 정의한다. + * + * 상세내용 + * - 회의실관리에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 회의실관리의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +package egovframework.com.uss.ion.mtg.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.ion.mtg.service.MtgPlaceManage; +import egovframework.com.uss.ion.mtg.service.MtgPlaceManageVO; +import egovframework.com.uss.ion.mtg.service.MtgPlaceResve; + +import org.springframework.stereotype.Repository; + +@Repository("mtgPlaceManageDAO") +public class MtgPlaceManageDAO extends EgovComAbstractDAO { + + /** + * 회의실관리정보를 관리하기 위해 등록된 회의실관리 목록을 조회한다. + * @param mtgPlaceManageVO - 회의실관리 VO + * @return List - 회의실관리 목록 + */ + public List selectMtgPlaceManageList(MtgPlaceManageVO mtgPlaceManageVO) throws Exception { + return selectList("mtgPlaceManageDAO.selectMtgPlaceManageList", mtgPlaceManageVO); + } + + /** + * 회의실관리목록 총 갯수를 조회한다. + * @param mtgPlaceManageVO - 회의실관리 VO + * @return int + * @exception Exception + */ + public int selectMtgPlaceManageListTotCnt(MtgPlaceManageVO mtgPlaceManageVO) throws Exception { + return (Integer)selectOne("mtgPlaceManageDAO.selectMtgPlaceManageListTotCnt", mtgPlaceManageVO); + } + + /** + * 등록된 회의실관리의 상세정보를 조회한다. + * @param mtgPlaceManageVO - 회의실관리 VO + * @return MtgPlaceManageVO - 회의실관리 VO + */ + public MtgPlaceManage selectMtgPlaceManage(MtgPlaceManageVO mtgPlaceManageVO) throws Exception { + return (MtgPlaceManage) selectOne("mtgPlaceManageDAO.selectMtgPlaceManage", mtgPlaceManageVO); + } + + /** + * 회의실관리정보를 신규로 등록한다. + * @param mtgPlaceManage - 회의실관리 model + */ + public void insertMtgPlaceManage(MtgPlaceManage mtgPlaceManage) throws Exception { + insert("mtgPlaceManageDAO.insertMtgPlaceManage", mtgPlaceManage); + } + + /** + * 기 등록된 회의실관리정보를 수정한다. + * @param mtgPlaceManage - 회의실관리 model + */ + public void updtMtgPlaceManage(MtgPlaceManage mtgPlaceManage) throws Exception { + update("mtgPlaceManageDAO.updtMtgPlaceManage", mtgPlaceManage); + } + + /** + * 기 등록된 회의실관리정보를 삭제한다. + * @param mtgPlaceManage - 회의실관리 model + */ + public void deleteMtgPlaceManage(MtgPlaceManage mtgPlaceManage) throws Exception { + delete("mtgPlaceManageDAO.deleteMtgPlaceManage",mtgPlaceManage); + } + + /******** 회의실 예약 관리 *************/ + + /** + * 회의실 ID 정보 목록을 조회한다. + * @param mtgPlaceManageVO - 회의실관리 VO + * @return List - 회의실관리 목록 + */ + public List selectMtgPlaceIDList(MtgPlaceManageVO mtgPlaceManageVO) throws Exception { + return selectList("mtgPlaceManageDAO.selectMtgPlaceIDList", mtgPlaceManageVO); + } + + /** + * 회의실 예약정보를 관리하기 위해 등록된 회의실예약을 조회한다. + * @param mtgPlaceManageVO - 회의실관리 VO + * @return MtgPlaceManageVO - 회의실관리 목록 + */ + public MtgPlaceManageVO selectMtgPlaceResveManageList(MtgPlaceManageVO mtgPlaceManageVO) throws Exception { + return (MtgPlaceManageVO) selectOne("mtgPlaceManageDAO.selectMtgPlaceResveManageList", mtgPlaceManageVO); + } + + /** + * 회의실예약 신청화면을 조회한다. + * @param mtgPlaceManageVO - 회의실관리 VO + * @return MtgPlaceManageVO - 회의실관리 VO + */ + public MtgPlaceManageVO selectMtgPlaceResve(MtgPlaceManageVO mtgPlaceManageVO) throws Exception { + return (MtgPlaceManageVO) selectOne("mtgPlaceManageDAO.selectMtgPlaceResve", mtgPlaceManageVO); + } + + /** + * 등록된 회의실예약 상세정보를 조회한다. + * @param mtgPlaceManageVO - 회의실관리 VO + * @return MtgPlaceManageVO - 회의실관리 VO + */ + public MtgPlaceManageVO selectMtgPlaceResveDetail(MtgPlaceManageVO mtgPlaceManageVO) throws Exception { + return (MtgPlaceManageVO) selectOne("mtgPlaceManageDAO.selectMtgPlaceResveDetail", mtgPlaceManageVO); + } + + /** + * 회의실예약 정보를 신규로 등록한다. + * @param mtgPlaceResve - 회의실예약 model + */ + public void insertMtgPlaceResve(MtgPlaceResve mtgPlaceResve) throws Exception { + insert("mtgPlaceManageDAO.insertMtgPlaceResve", mtgPlaceResve); + } + + /** + * 기 등록된 회의실예약 정보를 수정한다. + * @param mtgPlaceResve - 회의실예약 model + */ + public void updtMtgPlaceResve(MtgPlaceResve mtgPlaceResve) throws Exception { + update("mtgPlaceManageDAO.updtMtgPlaceResve", mtgPlaceResve); + } + + /** + * 기 등록된 회의실예약 정보를 삭제한다. + * @param mtgPlaceResve - 회의실예약 model + */ + public void deleteMtgPlaceResve(MtgPlaceResve mtgPlaceResve) throws Exception { + delete("mtgPlaceManageDAO.deleteMtgPlaceResve",mtgPlaceResve); + } + + + /** + * 회의실 중복여부 체크. + * @param mtgPlaceManageVO - 회의실관리 VO + * @return int - 중복건수 + */ + public int mtgPlaceResveDplactCeck(MtgPlaceManageVO mtgPlaceManageVO) throws Exception { + return (Integer)selectOne("mtgPlaceManageDAO.mtgPlaceResveDplactCeck", mtgPlaceManageVO); + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/mtg/web/EgovMtgPlaceManageController.java b/src/main/java/egovframework/com/uss/ion/mtg/web/EgovMtgPlaceManageController.java new file mode 100644 index 0000000..07a4ccc --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/mtg/web/EgovMtgPlaceManageController.java @@ -0,0 +1,563 @@ +package egovframework.com.uss.ion.mtg.web; + +import java.util.Calendar; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +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.springframework.web.bind.support.SessionStatus; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import egovframework.com.cmm.ComDefaultCodeVO; +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.service.EgovCmmUseService; +import egovframework.com.cmm.service.EgovFileMngService; +import egovframework.com.cmm.service.EgovFileMngUtil; +import egovframework.com.cmm.service.FileVO; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.ion.mtg.service.EgovMtgPlaceManageService; +import egovframework.com.uss.ion.mtg.service.MtgPlaceManage; +import egovframework.com.uss.ion.mtg.service.MtgPlaceManageVO; +import egovframework.com.uss.ion.mtg.service.MtgPlaceResve; +import egovframework.com.utl.fcc.service.EgovDateUtil; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +/** + * 개요 + * - 회의실관리에 대한 controller 클래스를 정의한다. + * + * 상세내용 + * - 회의실관리에 대한 등록, 수정, 삭제, 조회 기능을 제공한다. + * - 회의실관리의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자          수정내용
    + *  -------    --------    ---------------------------
    + *  2010.6.15	이용          최초 생성
    + *  2011.8.26	정진오			IncludedInfo annotation 추가
    + *
    + *  
    + */ + + +@Controller +public class EgovMtgPlaceManageController { + + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name = "egovMtgPlaceManageService") + private EgovMtgPlaceManageService egovMtgPlaceManageService; + + @Autowired + private DefaultBeanValidator beanValidator; + + @Resource(name="EgovCmmUseService") + private EgovCmmUseService cmmUseService; + + // 첨부파일 관련 + @Resource(name="EgovFileMngService") + private EgovFileMngService fileMngService; + + @Resource(name="EgovFileMngUtil") + private EgovFileMngUtil fileUtil; + + /** + * 회의실관리 목록화면 이동 + * @return String + * @exception Exception + */ + @RequestMapping("/uss/ion/mtg/selectMtgPlaceManageListView.do") + public String selectMtgPlaceManageListView() throws Exception { + + return "egovframework/com/uss/ion/mtg/EgovMtgPlaceManageList"; + } + + /** + * 회의실관리정보를 관리하기 위해 등록된 회의실관리 목록을 조회한다. + * @param mtgPlaceManageVO - 회의실관리 VO + * @return String - 리턴 Url + */ + @IncludedInfo(name="회의실관리", order = 870 ,gid = 50) + @RequestMapping(value="/uss/ion/mtg/selectMtgPlaceManageList.do") + public String selectMtgPlaceManageList(@ModelAttribute("mtgPlaceManageVO") MtgPlaceManageVO mtgPlaceManageVO, + @ModelAttribute("mtgPlaceManage") MtgPlaceManage mtgPlaceManage, + BindingResult bindingResult, + ModelMap model) throws Exception { + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(mtgPlaceManageVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(mtgPlaceManageVO.getPageUnit()); + paginationInfo.setPageSize(mtgPlaceManageVO.getPageSize()); + + mtgPlaceManageVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + mtgPlaceManageVO.setLastIndex(paginationInfo.getLastRecordIndex()); + mtgPlaceManageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + mtgPlaceManageVO.setMtgPlaceManageList(egovMtgPlaceManageService.selectMtgPlaceManageList(mtgPlaceManageVO)); + + int totCnt = egovMtgPlaceManageService.selectMtgPlaceManageListTotCnt(mtgPlaceManageVO); + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("mtgPlaceManageList", mtgPlaceManageVO.getMtgPlaceManageList()); + model.addAttribute("mtgPlaceManageVO" , mtgPlaceManageVO); + model.addAttribute("paginationInfo", paginationInfo); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/uss/ion/mtg/EgovMtgPlaceManageList"; + } + + /** + * 등록된 회의실관리의 상세정보를 조회한다. + * @param mtgPlaceManageVO - 회의실관리 VO + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/mtg/selectMtgPlaceManage.do") + public String selectMtgPlaceManage(@ModelAttribute("mtgPlaceManageVO") MtgPlaceManageVO mtgPlaceManageVO, + @ModelAttribute("mtgPlaceManage") MtgPlaceManage mtgPlaceManage, + @RequestParam Map commandMap, + ModelMap model) throws Exception { + + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); // 상세정보 구분 + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM070"); + List lcSeCodeList = cmmUseService.selectCmmCodeDetail(vo); + + model.addAttribute("lcSeCode", lcSeCodeList); + model.addAttribute("mtgPlaceManage", egovMtgPlaceManageService.selectMtgPlaceManage(mtgPlaceManageVO)); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + if(sCmd.equals("update")){ + return "egovframework/com/uss/ion/mtg/EgovMtgPlaceUpdt"; + }else{ + return "egovframework/com/uss/ion/mtg/EgovMtgPlaceDetail"; + } + } + + /** + * 회의실관리 등록 화면으로 이동한다. + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/mtg/insertViewMtgPlace.do") + public String insertViewMtgPlaceManage(@ModelAttribute("mtgPlaceManage") MtgPlaceManage mtgPlaceManage, + @ModelAttribute("mtgPlaceManageVO") MtgPlaceManageVO mtgPlaceManageVO, + ModelMap model) throws Exception { + + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM070"); + List lcSeCodeList = cmmUseService.selectCmmCodeDetail(vo); + + model.addAttribute("lcSeCode", lcSeCodeList); + + return "egovframework/com/uss/ion/mtg/EgovMtgPlaceRegist"; + } + + /** + * 회의실관리정보를 신규로 등록한다. + * @param mtgPlaceManage - 회의실관리 model + * @return String - 리턴 Url + */ + @SuppressWarnings("unused") + @RequestMapping(value="/uss/ion/mtg/insertMtgPlace.do") + public String insertMtgPlaceManage(final MultipartHttpServletRequest multiRequest, + @ModelAttribute("mtgPlaceManage") MtgPlaceManage mtgPlaceManage, + @ModelAttribute("mtgPlaceManageVO") MtgPlaceManageVO mtgPlaceManageVO, + BindingResult bindingResult, + SessionStatus status, + ModelMap model) throws Exception { + + beanValidator.validate(mtgPlaceManage, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + model.addAttribute("mtgPlaceManageVO", mtgPlaceManageVO); + return "egovframework/com/uss/ion/mtg/EgovMtgPlaceRegist"; + } else { + // 첨부파일 관련 첨부파일ID 생성 + List _result = null; + String _atchFileId = ""; + + //final Map files = multiRequest.getFileMap(); + final List files = multiRequest.getFiles("file_1"); + if(!files.isEmpty()){ + _result = fileUtil.parseFileInf(files, "MTG_", 0, "", ""); + _atchFileId = fileMngService.insertFileInfs(_result); //파일이 생성되고나면 생성된 첨부파일 ID를 리턴한다. + } + // 리턴받은 첨부파일ID를 셋팅한다.. + mtgPlaceManage.setAtchFileId(_atchFileId); // 첨부파일 ID + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + status.setComplete(); + egovMtgPlaceManageService.insertMtgPlaceManage(mtgPlaceManage, mtgPlaceManageVO); + model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); + + return "redirect:/uss/ion/mtg/selectMtgPlaceManageList.do"; + } + } + + /** + * 기 등록된 회의실관리정보를 수정한다. + * @param mtgPlaceManage - 회의실관리 model + * @return String - 리턴 Url + */ + @SuppressWarnings("unused") + @RequestMapping(value="/uss/ion/mtg/updtMtgPlace.do") + public String updateMtgPlaceManage(final MultipartHttpServletRequest multiRequest, + @RequestParam("atchFileAt") String atchFileAt , + @ModelAttribute("mtgPlaceManage") MtgPlaceManage mtgPlaceManage, + @ModelAttribute("mtgPlaceManageVO") MtgPlaceManageVO mtgPlaceManageVO, + BindingResult bindingResult, + SessionStatus status, + ModelMap model) throws Exception { + + beanValidator.validate(mtgPlaceManage, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + model.addAttribute("mtgPlaceManageVO", mtgPlaceManage); + return "egovframework/com/uss/ion/mtg/EgovMtgPlaceUpdt"; + } else { + + // 첨부파일 관련 ID 생성 start.... + String _atchFileId = mtgPlaceManage.getAtchFileId(); + + //final Map files = multiRequest.getFileMap(); + final List files = multiRequest.getFiles("file_1"); + + if(!files.isEmpty()){ + + if("N".equals(atchFileAt)){ + List _result = fileUtil.parseFileInf(files, "MTG_", 0, _atchFileId, ""); + _atchFileId = fileMngService.insertFileInfs(_result); + + // 첨부파일 ID 셋팅 + mtgPlaceManage.setAtchFileId(_atchFileId); // 첨부파일 ID + + }else{ + FileVO fvo = new FileVO(); + fvo.setAtchFileId(_atchFileId); + int _cnt = fileMngService.getMaxFileSN(fvo); + List _result = fileUtil.parseFileInf(files, "MTG_", _cnt, _atchFileId, ""); + fileMngService.updateFileInfs(_result); + } + } + // 첨부파일 관련 ID 생성 end... + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + status.setComplete(); + egovMtgPlaceManageService.updtMtgPlaceManage(mtgPlaceManage, mtgPlaceManageVO); + model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); + + return "redirect:/uss/ion/mtg/selectMtgPlaceManageList.do"; + } + } + + /** + * 기 등록된 회의실관리정보를 삭제한다. + * @param mtgPlaceManage - 회의실관리 model + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/mtg/deleteMtgPlaceManage.do") + public String deleteMtgPlaceManage(@ModelAttribute("mtgPlaceManage") MtgPlaceManage mtgPlaceManage, + SessionStatus status, + ModelMap model) throws Exception { + // 첨부파일 삭제를 위한 ID 생성 start.... + String _atchFileId = mtgPlaceManage.getAtchFileId(); + + egovMtgPlaceManageService.deleteMtgPlaceManage(mtgPlaceManage); + + // 첨부파일을 삭제하기 위한 Vo + FileVO fvo = new FileVO(); + fvo.setAtchFileId(_atchFileId); + + fileMngService.deleteAllFileInf(fvo); + // 첨부파일 삭제 End............. + + status.setComplete(); + model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); + return "forward:/uss/ion/mtg/selectMtgPlaceManageList.do"; + } + + /** + * 등록된 회의실관리의 이미지 상세정보를 조회한다. + * @param mtgPlaceManageVO - 회의실관리 VO + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/mtg/selectMtgPlaceImage.do") + public String selectMtgPlaceImage(@ModelAttribute("mtgPlaceManageVO") MtgPlaceManageVO mtgPlaceManageVO, + @RequestParam("sTmMtgPlaceId") String sTmMtgPlaceId, + @RequestParam Map commandMap, + ModelMap model) throws Exception { + mtgPlaceManageVO.setMtgPlaceId(sTmMtgPlaceId); + + MtgPlaceManage mtgPlaceManage_Temp = egovMtgPlaceManageService.selectMtgPlaceManage(mtgPlaceManageVO); + + FileVO fileVO = new FileVO(); + fileVO.setAtchFileId(mtgPlaceManage_Temp.getAtchFileId()); + List result = fileMngService.selectImageFileList(fileVO); + + model.addAttribute("fileList", result); + model.addAttribute("mtgPlaceManage", egovMtgPlaceManageService.selectMtgPlaceManage(mtgPlaceManageVO)); + + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + return "egovframework/com/uss/ion/mtg/EgovMtgPlaceImageDetail"; + } + + /**** 회의실 예약 ****/ + + /** + * 회의실예약 정보를 관리하기 위해 등록된 회의실예약 목록을 조회한다. + * @param mtgPlaceManageVO - 회의실관리 VO + * @return String - 리턴 Url + */ + @IncludedInfo(name="회의실예약관리", order = 871 ,gid = 50) + @RequestMapping(value="/uss/ion/mtg/selectMtgPlaceResveManageList.do") + public String selectMtgPlaceResveManageList(@ModelAttribute("mtgPlaceManageVO") MtgPlaceManageVO mtgPlaceManageVO, + ModelMap model) throws Exception { + /* ***************************************************************** + // 캘런더 설정 로직 + ****************************************************************** */ + Calendar calNow = Calendar.getInstance(); +/* + String strYear = (String)commandMap.get("year"); + String strMonth = (String)commandMap.get("month"); + String strDay =( String)commandMap.get("day"); +*/ + String strSearchDay = ""; + + int iNowYear = calNow.get(Calendar.YEAR); + int iNowMonth = calNow.get(Calendar.MONTH); + int iNowDay = calNow.get(Calendar.DATE); + + if(mtgPlaceManageVO.getResveDe() == null) + { + strSearchDay = Integer.toString(iNowYear); + strSearchDay += dateTypeIntForString(iNowMonth+1); + strSearchDay += dateTypeIntForString(iNowDay); + mtgPlaceManageVO.setResveDe(strSearchDay); + mtgPlaceManageVO.setResveDeView(EgovDateUtil.formatDate(strSearchDay, "-")); + }else{ + mtgPlaceManageVO.setResveDeView(EgovDateUtil.formatDate(mtgPlaceManageVO.getResveDe(), "-")); + } + + mtgPlaceManageVO.setResveDe(EgovDateUtil.formatDate(mtgPlaceManageVO.getResveDe(), "-")); //formatDate + //mtgPlaceManageVO.setResveDe(mtgPlaceManageVO.getResveDe()); + mtgPlaceManageVO.setMtgPlaceManageList(egovMtgPlaceManageService.selectMtgPlaceResveManageList(mtgPlaceManageVO)); + model.addAttribute("mtgPlaceManageList", mtgPlaceManageVO.getMtgPlaceManageList()); + model.addAttribute("mtgPlaceManageVO", mtgPlaceManageVO); + //model.addAttribute("paginationInfo", paginationInfo); + + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/uss/ion/mtg/EgovMtgPlaceResveManageList"; + } + + /** + * 회의실예약 신청 화면을 조회한다. + * @param mtgPlaceManageVO - 회의실관리 VO + * @return String - 리턴 Url + */ + @SuppressWarnings("unused") + @RequestMapping(value="/uss/ion/mtg/selectMtgPlaceResveManage.do") + public String selectMtgPlaceResveManage( @ModelAttribute("mtgPlaceManageVO") MtgPlaceManageVO mtgPlaceManageVO, + @ModelAttribute("mtgPlaceResve") MtgPlaceResve mtgPlaceResve, + BindingResult bindingResult, + @RequestParam Map commandMap, + ModelMap model) throws Exception { + + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); // 상세정보 구분 + String sTempResveDe = mtgPlaceManageVO.getResveDe(); + String sTempResveBeginTm = mtgPlaceManageVO.getResveBeginTm(); + String sTempResveEndTm = mtgPlaceManageVO.getResveEndTm(); + MtgPlaceManageVO mtgPlaceManageVO_Temp = new MtgPlaceManageVO(); + + mtgPlaceManageVO_Temp = egovMtgPlaceManageService.selectMtgPlaceResve(mtgPlaceManageVO); + mtgPlaceManageVO_Temp.setResveDe(sTempResveDe); + mtgPlaceManageVO_Temp.setResveBeginTm(sTempResveBeginTm); + mtgPlaceManageVO_Temp.setResveEndTm(sTempResveEndTm); + mtgPlaceManageVO_Temp.setResveDe(EgovDateUtil.formatDate(mtgPlaceManageVO_Temp.getResveDe(), "-")); + + //로그인 객체 선언 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + mtgPlaceManageVO_Temp.setMtgPlaceTemp4(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getName())); + mtgPlaceManageVO_Temp.setMtgPlaceTemp5(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getOrgnztNm())); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + model.addAttribute("mtgPlaceManageVO", mtgPlaceManageVO_Temp); + return "egovframework/com/uss/ion/mtg/EgovMtgPlaceResveRegist"; + } + + /** + * 등록된 회의실예약 상세정보를 조회한다. + * @param mtgPlaceManageVO - 회의실관리 VO + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/mtg/selectMtgPlaceResveManageDetail.do") + public String selectMtgPlaceResveManageDetail( @ModelAttribute("mtgPlaceManageVO") MtgPlaceManageVO mtgPlaceManageVO, + @ModelAttribute("mtgPlaceResve") MtgPlaceResve mtgPlaceResve, + BindingResult bindingResult, + @RequestParam Map commandMap, + ModelMap model) throws Exception { + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); // 상세정보 구분 + MtgPlaceManageVO mtgPlaceManageVO_Temp = new MtgPlaceManageVO(); + + mtgPlaceManageVO_Temp = egovMtgPlaceManageService.selectMtgPlaceResveDetail(mtgPlaceManageVO); + mtgPlaceManageVO_Temp.setResveDe(EgovDateUtil.formatDate(mtgPlaceManageVO_Temp.getResveDe(), "-")); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + if(sCmd.equals("detail")){ + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + mtgPlaceManageVO_Temp.setUsidTemp(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + String resveBeginTm = mtgPlaceManageVO_Temp.getResveBeginTm(); + String resveEndTm = mtgPlaceManageVO_Temp.getResveEndTm(); + if( resveBeginTm.length() == 3) resveBeginTm = "0"+resveBeginTm.substring(0,1)+":"+resveBeginTm.substring(1,3); + else if( resveBeginTm.length() == 4) resveBeginTm = resveBeginTm.substring(0,2)+":"+resveBeginTm.substring(2,4); + if( resveEndTm.length() == 3) resveEndTm = "0"+resveEndTm.substring(0,1)+":"+resveEndTm.substring(1,3); + else if( resveEndTm.length() == 4) resveEndTm = resveEndTm.substring(0,2)+":"+resveEndTm.substring(2,4); + + mtgPlaceManageVO_Temp.setResveBeginTm(resveBeginTm); + mtgPlaceManageVO_Temp.setResveEndTm(resveEndTm); + model.addAttribute("mtgPlaceManageVO", mtgPlaceManageVO_Temp); + return "egovframework/com/uss/ion/mtg/EgovMtgPlaceResveDetail"; + }else{ + model.addAttribute("mtgPlaceManageVO", mtgPlaceManageVO_Temp); + return "egovframework/com/uss/ion/mtg/EgovMtgPlaceResveUpdt"; + } + } + + /** + * 회의실예약 정보를 신규로 등록한다. + * @param mtgPlaceResve - 회의실예약 model + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/mtg/insertMtgPlaceResve.do") + public String insertMtgPlaceResveManage(@ModelAttribute("mtgPlaceManageVO") MtgPlaceManageVO mtgPlaceManageVO, + @ModelAttribute("mtgPlaceResve") MtgPlaceResve mtgPlaceResve, + BindingResult bindingResult, + SessionStatus status, + ModelMap model) throws Exception { + + beanValidator.validate(mtgPlaceResve, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + model.addAttribute("mtgPlaceManageVO", mtgPlaceManageVO); + return "forward:/uss/ion/mtg/selectMtgPlaceResveManage.do"; + } else { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + status.setComplete(); + model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); + mtgPlaceResve.setResveManId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + mtgPlaceResve.setFrstRegisterId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + + egovMtgPlaceManageService.insertMtgPlaceResve(mtgPlaceResve); + model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); + + return "forward:/uss/ion/mtg/selectMtgPlaceResveManageList.do"; + } + } + + /** + * 기 등록된 회의실예약 정보를 수정한다. + * @param mtgPlaceResve - 회의실예약 model + * @return String - 리턴 Url + */ + @SuppressWarnings("unused") + @RequestMapping(value="/uss/ion/mtg/updtMtgPlaceResve.do") + public String updtMtgPlaceResveManage(@ModelAttribute("mtgPlaceManageVO") MtgPlaceManageVO mtgPlaceManageVO, + @ModelAttribute("mtgPlaceResve") MtgPlaceResve mtgPlaceResve, + BindingResult bindingResult, + SessionStatus status, + ModelMap model) throws Exception { + + beanValidator.validate(mtgPlaceResve, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + model.addAttribute("mtgPlaceManageVO", mtgPlaceResve); + return "egovframework/com/uss/ion/mtg/EgovMtgPlaceResveUpdt"; + } else { + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + status.setComplete(); + egovMtgPlaceManageService.updtMtgPlaceResve(mtgPlaceResve); + model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); + + return "forward:/uss/ion/mtg/selectMtgPlaceResveManageList.do"; + } + } + + /** + * 기 등록된 회의실예약 정보를 삭제한다. + * @param mtgPlaceResve - 회의실예약 model + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/mtg/deleteMtgPlaceResve.do") + public String deleteMtgPlaceResveManage(@ModelAttribute("mtgPlaceResve") MtgPlaceResve mtgPlaceResve, + SessionStatus status, + ModelMap model) throws Exception { + + egovMtgPlaceManageService.deleteMtgPlaceResve(mtgPlaceResve); + status.setComplete(); + model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); + return "forward:/uss/ion/mtg/selectMtgPlaceResveManageList.do"; + } + + + + /** + * 회의실 중복여부 체크. + * @param mtgPlaceManageVO - 회의실관리 VO + * @return int - 중복건수 + */ + @RequestMapping(value="/uss/ion/mtg/mtgPlaceResveDplactCeck.do") + public String mtgPlaceResveDplactCeck( @ModelAttribute("mtgPlaceManageVO") MtgPlaceManageVO mtgPlaceManageVO, + @RequestParam("sTmResveDe") String sTempResveDe , + @RequestParam("sTmResveBeginTm") String sTempResveBeginTm , + @RequestParam("sTmResveEndTm") String sTempResveEndTm , + @RequestParam("sTmMtgPlaceId") String sTempMtgPlaceId, + @RequestParam("sTmResveId") String sTempResveId, + ModelMap model) throws Exception { + mtgPlaceManageVO.setResveDe(sTempResveDe); + mtgPlaceManageVO.setMtgPlaceId(sTempMtgPlaceId); + mtgPlaceManageVO.setResveBeginTm(sTempResveBeginTm); + mtgPlaceManageVO.setResveEndTm(sTempResveEndTm); + mtgPlaceManageVO.setResveId(sTempResveId); + int dplactCeckCnt = egovMtgPlaceManageService.mtgPlaceResveDplactCeck(mtgPlaceManageVO); + model.addAttribute("dplactCeck", dplactCeckCnt); + return "egovframework/com/uss/ion/mtg/EgovMtgPlaceResveDplactCeck"; + } + + + /** + * 0을 붙여 반환 + * @return String + * @throws + */ + private String dateTypeIntForString(int iInput){ + String sOutput = ""; + if(Integer.toString(iInput).length() == 1){ + sOutput = "0" + Integer.toString(iInput); + }else{ + sOutput = Integer.toString(iInput); + } + return sOutput; + } +} diff --git a/src/main/java/egovframework/com/uss/ion/noi/service/EgovNotificationService.java b/src/main/java/egovframework/com/uss/ion/noi/service/EgovNotificationService.java new file mode 100644 index 0000000..80d5711 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/noi/service/EgovNotificationService.java @@ -0,0 +1,79 @@ +package egovframework.com.uss.ion.noi.service; + +import java.util.List; +import java.util.Map; + +/** + * 정보알림이를 위한 서비스 인터페이스 클래스 + * @author 공통컴포넌트개발팀 한성곤 + * @since 2009.06.08 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.6.8  한성곤          최초 생성
    + *
    + * 
    + */ +public interface EgovNotificationService { + /** + * 정보알림이 목록을 조회 한다. + * + * @param BoardMasterVO + */ + public Map selectNotificationInfs(NotificationVO searchVO) throws Exception; + + /** + * 정보알림이 정보를 등록한다. + * + * @param notification + * @throws Exception + */ + public void insertNotificationInf(Notification notification) throws Exception; + + /** + * 정보알림이에 대한 상세정보를 조회한다. + * + * @param searchVO + * @return + * @throws Exception + */ + public NotificationVO selectNotificationInf(NotificationVO searchVO) throws Exception; + + /** + * 정보알림이 정보를 수정한다. + * + * @param notification + * @throws Exception + */ + public void updateNotifictionInf(Notification notification) throws Exception; + + /** + * 정보알림이 정보를 삭제한다. + * + * @param notification + * @throws Exception + */ + public void deleteNotifictionInf(Notification notification) throws Exception; + + /** + * 정보알림이 알림시간 등에 대한 점검을 수행한다. + * + * @param notification + * @return + * @throws Exception + */ + public boolean checkNotification(Notification notification) throws Exception; + + /** + * 정보알림이 정보 표시를 수행한다. + * + * @return + * @throws Exception + */ + public List selectNotificationData() throws Exception; +} diff --git a/src/main/java/egovframework/com/uss/ion/noi/service/Notification.java b/src/main/java/egovframework/com/uss/ion/noi/service/Notification.java new file mode 100644 index 0000000..d9818b2 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/noi/service/Notification.java @@ -0,0 +1,337 @@ +package egovframework.com.uss.ion.noi.service; + +import java.io.Serializable; + +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * 정보알림이 서비스 데이터 처리 모델 + * @author 공통컴포넌트개발팀 한성곤 + * @since 2009.06.08 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *   -------    --------    ---------------------------
    + *   2009.6.8  	 한성곤          최초 생성
    + *	 2011.10.07	 이기하		보안취약점 수정(private 배열 처리)
    + *
    + * 
    + */ +@SuppressWarnings("serial") +public class Notification implements Serializable { + /** 알림 번호 */ + private String ntfcNo = ""; + + /** 알림 제목 */ + private String ntfcSj = ""; + + /** 알림 내용 */ + private String ntfcCn = ""; + + /** 알림 시간 */ + private String ntfcDate = ""; + + /** 알림 시간 */ + private String ntfcTime = ""; + + /** 사전 알림 간격 */ + private String[] bhNtfcIntrvl = new String[0]; + + /** 사전 알림 간격 문자열 */ + private String bhNtfcIntrvlString = ""; + + /** 최초등록자 아이디 */ + private String frstRegisterId = ""; + + /** 최초 등록자명 */ + private String frstRegisterNm = ""; + + /** 최초등록시점 */ + private String frstRegisterPnttm = ""; + + /** 최종수정자 아이디 */ + public String lastUpdusrId = ""; + + /** 최종수정시점 */ + private String lastUpdusrPnttm = ""; + + /** 유일 아이디 */ + private String uniqId = ""; + + /** 알림 시간 */ + private String ntfcHH = ""; + + /** 알림 시간 */ + private String ntfcMM = ""; + + /** + * ntfcNo attribute를 리턴한다. + * @return the ntfcNo + */ + public String getNtfcNo() { + return ntfcNo; + } + + /** + * ntfcNo attribute 값을 설정한다. + * @param ntfcNo the ntfcNo to set + */ + public void setNtfcNo(String ntfcNo) { + this.ntfcNo = ntfcNo; + } + + /** + * ntfcSj attribute를 리턴한다. + * @return the ntfcSj + */ + public String getNtfcSj() { + return ntfcSj; + } + + /** + * ntfcSj attribute 값을 설정한다. + * @param ntfcSj the ntfcSj to set + */ + public void setNtfcSj(String ntfcSj) { + this.ntfcSj = ntfcSj; + } + + /** + * ntfcCn attribute를 리턴한다. + * @return the ntfcCn + */ + public String getNtfcCn() { + return ntfcCn; + } + + /** + * ntfcCn attribute 값을 설정한다. + * @param ntfcCn the ntfcCn to set + */ + public void setNtfcCn(String ntfcCn) { + this.ntfcCn = ntfcCn; + } + + /** + * ntfcTime attribute를 리턴한다. + * @return the ntfcTime + */ + public String getNtfcTime() { + return ntfcTime; + } + + /** + * ntfcTime attribute 값을 설정한다. + * @param ntfcTime the ntfcTime to set + */ + public void setNtfcTime(String ntfcTime) { + this.ntfcTime = ntfcTime; + } + + /** + * bhNtfcIntrvl attribute를 리턴한다. + * @return the bhNtfcIntrvl + */ +// public String[] getBhNtfcIntrvl() { +// return bhNtfcIntrvl; +// } + // 2011.10.07 private 배열을 public 함수가 반환되지 않도록 함 + public String[] getBhNtfcIntrvl() { + // 메소드를 private으로 하거나, 복제본을 반환하거나, + // 수정을 제어하는 public메소드를 별도로 만든다. + String[] ret = null; + if(this.bhNtfcIntrvl != null) { + ret = new String[bhNtfcIntrvl.length]; + for (int i=0; i + * << 개정이력(Modification Information) >> + * + * 수정일 수정자 수정내용 + * ------- -------- --------------------------- + * 2009.6.8 한성곤 최초 생성 + * + * + */ +@SuppressWarnings("serial") +public class NotificationVO extends Notification { + + /** 검색조건 */ + private String searchCnd = ""; + + /** 검색단어 */ + private String searchWrd = ""; + + /** 정렬순서(DESC,ASC) */ + private String sortOrdr = ""; + + /** 현재페이지 */ + private int pageIndex = 1; + + /** 페이지갯수 */ + private int pageUnit = 10; + + /** 페이지사이즈 */ + private int pageSize = 10; + + /** firstIndex */ + private int firstIndex = 1; + + /** lastIndex */ + private int lastIndex = 1; + + /** recordCountPerPage */ + private int recordCountPerPage = 10; + + /** rowNo */ + private int rowNo = 0; + + /** 정보알림이 표시를 위한 시작일 및 시작시간 */ + private String startDateTime = ""; + + /** 정보알림이 표시를 위한 종료일 및 종료시간 */ + private String endDateTime = ""; + + /** + * searchCnd attribute를 리턴한다. + * @return the searchCnd + */ + public String getSearchCnd() { + return searchCnd; + } + + /** + * searchCnd attribute 값을 설정한다. + * @param searchCnd the searchCnd to set + */ + public void setSearchCnd(String searchCnd) { + this.searchCnd = searchCnd; + } + + /** + * searchWrd attribute를 리턴한다. + * @return the searchWrd + */ + public String getSearchWrd() { + return searchWrd; + } + + /** + * searchWrd attribute 값을 설정한다. + * @param searchWrd the searchWrd to set + */ + public void setSearchWrd(String searchWrd) { + this.searchWrd = searchWrd; + } + + /** + * sortOrdr attribute를 리턴한다. + * @return the sortOrdr + */ + public String getSortOrdr() { + return sortOrdr; + } + + /** + * sortOrdr attribute 값을 설정한다. + * @param sortOrdr the sortOrdr to set + */ + public void setSortOrdr(String sortOrdr) { + this.sortOrdr = sortOrdr; + } + + /** + * pageIndex attribute를 리턴한다. + * @return the pageIndex + */ + public int getPageIndex() { + return pageIndex; + } + + /** + * pageIndex attribute 값을 설정한다. + * @param pageIndex the pageIndex to set + */ + public void setPageIndex(int pageIndex) { + this.pageIndex = pageIndex; + } + + /** + * pageUnit attribute를 리턴한다. + * @return the pageUnit + */ + public int getPageUnit() { + return pageUnit; + } + + /** + * pageUnit attribute 값을 설정한다. + * @param pageUnit the pageUnit to set + */ + public void setPageUnit(int pageUnit) { + this.pageUnit = pageUnit; + } + + /** + * pageSize attribute를 리턴한다. + * @return the pageSize + */ + public int getPageSize() { + return pageSize; + } + + /** + * pageSize attribute 값을 설정한다. + * @param pageSize the pageSize to set + */ + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + /** + * firstIndex attribute를 리턴한다. + * @return the firstIndex + */ + public int getFirstIndex() { + return firstIndex; + } + + /** + * firstIndex attribute 값을 설정한다. + * @param firstIndex the firstIndex to set + */ + public void setFirstIndex(int firstIndex) { + this.firstIndex = firstIndex; + } + + /** + * lastIndex attribute를 리턴한다. + * @return the lastIndex + */ + public int getLastIndex() { + return lastIndex; + } + + /** + * lastIndex attribute 값을 설정한다. + * @param lastIndex the lastIndex to set + */ + public void setLastIndex(int lastIndex) { + this.lastIndex = lastIndex; + } + + /** + * recordCountPerPage attribute를 리턴한다. + * @return the recordCountPerPage + */ + public int getRecordCountPerPage() { + return recordCountPerPage; + } + + /** + * recordCountPerPage attribute 값을 설정한다. + * @param recordCountPerPage the recordCountPerPage to set + */ + public void setRecordCountPerPage(int recordCountPerPage) { + this.recordCountPerPage = recordCountPerPage; + } + + /** + * rowNo attribute를 리턴한다. + * @return the rowNo + */ + public int getRowNo() { + return rowNo; + } + + /** + * rowNo attribute 값을 설정한다. + * @param rowNo the rowNo to set + */ + public void setRowNo(int rowNo) { + this.rowNo = rowNo; + } + + /** + * startDateTime attribute를 리턴한다. + * @return the startDateTime + */ + public String getStartDateTime() { + return startDateTime; + } + + /** + * startDateTime attribute 값을 설정한다. + * @param startDateTime the startDateTime to set + */ + public void setStartDateTime(String startDateTime) { + this.startDateTime = startDateTime; + } + + /** + * endDateTime attribute를 리턴한다. + * @return the endDateTime + */ + public String getEndDateTime() { + return endDateTime; + } + + /** + * endDateTime attribute 값을 설정한다. + * @param endDateTime the endDateTime to set + */ + public void setEndDateTime(String endDateTime) { + this.endDateTime = endDateTime; + } + + /** + * toString 메소드를 대치한다. + */ + public String toString() { + return ToStringBuilder.reflectionToString(this); + } +} diff --git a/src/main/java/egovframework/com/uss/ion/noi/service/impl/EgovNotificationServiceImpl.java b/src/main/java/egovframework/com/uss/ion/noi/service/impl/EgovNotificationServiceImpl.java new file mode 100644 index 0000000..f79d7e0 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/noi/service/impl/EgovNotificationServiceImpl.java @@ -0,0 +1,244 @@ +package egovframework.com.uss.ion.noi.service.impl; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +import egovframework.com.uss.ion.noi.service.EgovNotificationService; +import egovframework.com.uss.ion.noi.service.Notification; +import egovframework.com.uss.ion.noi.service.NotificationVO; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +/** + * 정보알림이를 위한 서비스 구현 클래스 + * @author 공통컴포넌트개발팀 한성곤 + * @since 2009.06.08 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.06.08  한성곤          최초 생성
    + *
    + * 
    + */ +@Service("EgovNotificationService") +public class EgovNotificationServiceImpl extends EgovAbstractServiceImpl implements EgovNotificationService { + + @Resource(name="NotificationDAO") + private NotificationDAO notificationDao; + + /** + * 정보알림이 목록을 조회 한다. + */ + public Map selectNotificationInfs(NotificationVO searchVO) throws Exception { + List result = notificationDao.selectNotificationInfs(searchVO); + int cnt = notificationDao.selectNotificationInfsCnt(searchVO); + + Map map = new HashMap(); + + map.put("resultList", result); + map.put("resultCnt", Integer.toString(cnt)); + + return map; + } + + /** + * 정보알림이 정보를 등록한다. + */ + public void insertNotificationInf(Notification notification) throws Exception { + //--------------------------------------- + // 알림일자 및 시작 지정 + //--------------------------------------- + StringBuffer time = new StringBuffer(); + + time.append(notification.getNtfcDate().replaceAll("-", "")); + time.append(notification.getNtfcHH().length() == 1 ? "0" + notification.getNtfcHH() : notification.getNtfcHH()); + time.append(notification.getNtfcMM().length() == 1 ? "0" + notification.getNtfcMM() : notification.getNtfcMM()); + time.append("00"); + + notification.setNtfcTime(time.toString()); + + //--------------------------------------- + // 사전 알림간격 지정 + //--------------------------------------- + StringBuffer interval = new StringBuffer(); + + String[] array = notification.getBhNtfcIntrvl(); + + //KISA 보안약점 조치 (2018-10-29, 윤창원) + if (array == null) { + throw new RuntimeException("Method insertNotificationInf : array is null\n"); + } + + for (int i = 0; i < array.length; i++) { + if (i != 0) { + interval.append(","); + } + + interval.append(array[i]); + } + + notification.setBhNtfcIntrvlString(interval.toString()); + + //--------------------------------------- + // 등록 처리 + //--------------------------------------- + notificationDao.insertNotificationInf(notification); + } + + /** + * 알림메시지에 대한 상세정보를 조회한다. + */ + public NotificationVO selectNotificationInf(NotificationVO searchVO) throws Exception { + return notificationDao.selectNotificationInf(searchVO); + } + + /** + * 정보알림이 정보를 수정한다. + */ + public void updateNotifictionInf(Notification notification) throws Exception { + //--------------------------------------- + // 알림일자 및 시작 지정 + //--------------------------------------- + StringBuffer time = new StringBuffer(); + + time.append(notification.getNtfcDate().replaceAll("-", "")); + time.append(notification.getNtfcHH().length() == 1 ? "0" + notification.getNtfcHH() : notification.getNtfcHH()); + time.append(notification.getNtfcMM().length() == 1 ? "0" + notification.getNtfcMM() : notification.getNtfcMM()); + time.append("00"); + + notification.setNtfcTime(time.toString()); + + //--------------------------------------- + // 사전 알림간격 지정 + //--------------------------------------- + StringBuffer interval = new StringBuffer(); + + String[] array = notification.getBhNtfcIntrvl(); + + if (array != null) { + + for (int i = 0; i < array.length; i++) { + if (i != 0) { + interval.append(","); + } + + interval.append(array[i]); + } + } + + notification.setBhNtfcIntrvlString(interval.toString()); + + //--------------------------------------- + // 수정 처리 + //--------------------------------------- + notificationDao.updateNotificationInf(notification); + } + + /** + * 정보알림이 정보를 삭제한다. + */ + public void deleteNotifictionInf(Notification notification) throws Exception { + notificationDao.deleteNotificationInf(notification); + } + + /** + * 정보알림이 알림시간 등에 대한 점검을 수행한다. + */ + public boolean checkNotification(Notification notification) throws Exception { + //--------------------------------------- + // 알림일자 및 시작 지정 + //--------------------------------------- + StringBuffer time = new StringBuffer(); + + time.append(notification.getNtfcDate().replaceAll("-", "")); + time.append(notification.getNtfcHH().length() == 1 ? "0" + notification.getNtfcHH() : notification.getNtfcHH()); + time.append(notification.getNtfcMM().length() == 1 ? "0" + notification.getNtfcMM() : notification.getNtfcMM()); + time.append("00"); + + //--------------------------------------- + // 시간 지정 + //--------------------------------------- + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss", Locale.getDefault()); + Calendar alarm = Calendar.getInstance(); + alarm.setTime(formatter.parse(time.toString())); + + Calendar current = Calendar.getInstance(); + current.add(Calendar.MINUTE, -1); + + if (current.after(alarm)) { + return false; + } + + return true; + } + + private String getDateTimeWithoutSec(Calendar cal) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss", Locale.getDefault()); + + return formatter.format(cal.getTime()).substring(0, 12); + } + + /** + * 정보알림이 정보 표시를 수행한다. + */ + public List selectNotificationData() throws Exception { + List result = new ArrayList(); + + //------------------------------------------ + // 검색 조건 지정 + //------------------------------------------ + NotificationVO vo = new NotificationVO(); + + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss", Locale.getDefault()); + SimpleDateFormat other = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()); + + // 전후 1시간 조건 지정.. + Calendar start = Calendar.getInstance(); + Calendar end = Calendar.getInstance(); + + start.add(Calendar.HOUR, -1); + end.add(Calendar.HOUR, 1); + + vo.setStartDateTime(formatter.format(start.getTime())); + vo.setEndDateTime(formatter.format(end.getTime())); + ////---------------------------------------- + + List target = notificationDao.getNotificationData(vo); + + Calendar current = Calendar.getInstance(); + for (int i = 0; i < target.size(); i++) { + vo = target.get(i); + + String[] interval = ("0," + vo.getBhNtfcIntrvlString()).split(","); + + for (int j = 0; j < interval.length; j++) { + Calendar alarm = Calendar.getInstance(); + alarm.setTime(other.parse(vo.getNtfcTime())); + + alarm.add(Calendar.MINUTE, -1 * Integer.parseInt(interval[j])); + + if (getDateTimeWithoutSec(current).equals(getDateTimeWithoutSec(alarm))) { + + result.add(vo); + break; + } + } + } + + return result; + } +} diff --git a/src/main/java/egovframework/com/uss/ion/noi/service/impl/NotificationDAO.java b/src/main/java/egovframework/com/uss/ion/noi/service/impl/NotificationDAO.java new file mode 100644 index 0000000..af28fb0 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/noi/service/impl/NotificationDAO.java @@ -0,0 +1,101 @@ +package egovframework.com.uss.ion.noi.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.ion.noi.service.Notification; +import egovframework.com.uss.ion.noi.service.NotificationVO; + +import org.springframework.stereotype.Repository; + +/** + * 정보알림이를 위한 데이터 접근 클래스 + * @author 공통컴포넌트개발팀 한성곤 + * @since 2009.06.08 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.06.08  한성곤          최초 생성
    + *
    + * 
    + */ +@Repository("NotificationDAO") +public class NotificationDAO extends EgovComAbstractDAO { + /** + * 정보알림이 목록을 조회한다. + * + * @param NotificationVO + */ + public List selectNotificationInfs(NotificationVO vo) throws Exception { + return selectList("NotificationDAO.selectNotificationInfs", vo); + } + + /** + * 정보알림이 목록 숫자를 조회한다 + * + * @param vo + * @return + * @throws Exception + */ + public int selectNotificationInfsCnt(NotificationVO vo) throws Exception { + return (Integer)selectOne("NotificationDAO.selectNotificationInfsCnt", vo); + } + + /** + * 정보알림이 정보를 등록한다. + * + * @param notification + * @return + * @throws Exception + */ + public String insertNotificationInf(Notification notification) throws Exception { + return Integer.toString(insert("NotificationDAO.insertNotificationInf", notification)); + } + + /** + * 정보알림이에 대한 상세정보를 조회한다. + * + * @param searchVO + * @return + */ + public NotificationVO selectNotificationInf(NotificationVO searchVO) { + return (NotificationVO)selectOne("NotificationDAO.selectNotificationInf", searchVO); + } + + /** + * 정보알림이 정보를 수정한다. + * + * @param notification + * @return + * @throws Exception + */ + public void updateNotificationInf(Notification notification) throws Exception { + update("NotificationDAO.updateNotificationInf", notification); + } + + /** + * 정보알림이 정보를 삭제한다. + * + * @param notification + * @throws Exception + */ + public void deleteNotificationInf(Notification notification) throws Exception { + update("NotificationDAO.deleteNotificationInf", notification); + } + + /** + * 정보알림이 표시를 위한 대상 알림 정보를 얻는다. + * + * @param vo + * @return + * @throws Exception + */ + public List getNotificationData(NotificationVO vo) throws Exception { + return selectList("NotificationDAO.getNotificationData", vo); + } +} diff --git a/src/main/java/egovframework/com/uss/ion/noi/web/EgovNotificationController.java b/src/main/java/egovframework/com/uss/ion/noi/web/EgovNotificationController.java new file mode 100644 index 0000000..53e788f --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/noi/web/EgovNotificationController.java @@ -0,0 +1,284 @@ +package egovframework.com.uss.ion.noi.web; + +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +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.support.SessionStatus; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.util.EgovDoubleSubmitHelper; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.ion.noi.service.EgovNotificationService; +import egovframework.com.uss.ion.noi.service.Notification; +import egovframework.com.uss.ion.noi.service.NotificationVO; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +/** + * 정보알림이 서비스 컨트롤러 클래스 + * @author 공통컴포넌트개발팀 한성곤 + * @since 2009.06.08 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.6.8  한성곤          최초 생성
    + *   2011.8.26	정진오			IncludedInfo annotation 추가
    + *
    + * 
    + */ + +@Controller +public class EgovNotificationController { + + @Resource(name="EgovNotificationService") + protected EgovNotificationService notificationService; + + @Resource(name="propertiesService") + protected EgovPropertyService propertyService; + + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Autowired + private DefaultBeanValidator beanValidator; + + /** + * 정보알림이에 대한 목록을 조회한다. + * + * @param notificationVO + * @param model + * @return + * @throws Exception + */ + @IncludedInfo(name="정보알림이", order = 730 ,gid = 50) + @RequestMapping("/uss/ion/noi/selectNotificationList.do") + public String selectNotificationList(@ModelAttribute("searchVO") NotificationVO notificationVO, ModelMap model) throws Exception { + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + notificationVO.setUniqId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + + notificationVO.setPageUnit(propertyService.getInt("pageUnit")); + notificationVO.setPageSize(propertyService.getInt("pageSize")); + + PaginationInfo paginationInfo = new PaginationInfo(); + + paginationInfo.setCurrentPageNo(notificationVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(notificationVO.getPageUnit()); + paginationInfo.setPageSize(notificationVO.getPageSize()); + + notificationVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + notificationVO.setLastIndex(paginationInfo.getLastRecordIndex()); + notificationVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + Map map = notificationService.selectNotificationInfs(notificationVO); + int totCnt = Integer.parseInt((String)map.get("resultCnt")); + + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList", map.get("resultList")); + model.addAttribute("resultCnt", map.get("resultCnt")); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/uss/ion/noi/EgovNotificationList"; + } + + /** + * 신규 정보알림이 등록을 위한 등록페이지로 이동한다. + * + * @param notificationVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/uss/ion/noi/addNotification.do") + public String addNotification(@ModelAttribute("searchVO") NotificationVO notificationVO, ModelMap model) throws Exception { + + Notification notification = new Notification(); + + model.addAttribute("notification", notification); + + return "egovframework/com/uss/ion/noi/EgovNotificationRegist"; + } + + /** + * 신규 정보알림이 정보를 등록한다. + * + * @param notificationVO + * @param boardMaster + * @param status + * @return + * @throws Exception + */ + @RequestMapping("/uss/ion/noi/insertNotification.do") + public String insertNotification(@ModelAttribute("searchVO") NotificationVO notificationVO, @ModelAttribute("notification") Notification notification, + BindingResult bindingResult, SessionStatus status, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + beanValidator.validate(notification, bindingResult); + if (bindingResult.hasErrors()) { + return "egovframework/com/uss/ion/noi/EgovNotificationRegist"; + } + + if (! notificationService.checkNotification(notification)) { + model.addAttribute("msg", egovMessageSource.getMessage("ussIonNoi.notificationUpdt.validate.alertNtfcTime")); + return "egovframework/com/uss/ion/noi/EgovNotificationRegist"; + } + + if (isAuthenticated) { + notification.setFrstRegisterId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + + if (EgovDoubleSubmitHelper.checkAndSaveToken()) { + + notificationService.insertNotificationInf(notification); + } + } + + return "forward:/uss/ion/noi/selectNotificationList.do"; + } + + /** + * 정보알림이에 대한 상세정보를 조회한다. + * + * @param notificationVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/uss/ion/noi/selectNotification.do") + public String selectNotification(@ModelAttribute("searchVO") NotificationVO notificationVO, ModelMap model) throws Exception { + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + NotificationVO vo = notificationService.selectNotificationInf(notificationVO); + + model.addAttribute("sessionUniqId", user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + model.addAttribute("result", vo); + + return "egovframework/com/uss/ion/noi/EgovNotificationDetail"; + } + + /** + * 정보알림이 수정을 위해 수정페이지로 이동한다. + * + * @param notificationVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/uss/ion/noi/forUpdateNotification.do") + public String forUpdateNotificaiton(@ModelAttribute("searchVO") NotificationVO notificationVO, ModelMap model) throws Exception { + NotificationVO vo = notificationService.selectNotificationInf(notificationVO); + + model.addAttribute("result", vo); + + return "egovframework/com/uss/ion/noi/EgovNotificationUpdt"; + } + + /** + * 정보알림이 정보를 수정한다. + * + * @param notificationVO + * @param notification + * @param bindingResult + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/uss/ion/noi/updateNotification.do") + public String updateNotification(@ModelAttribute("searchVO") NotificationVO notificationVO, @ModelAttribute("notification") Notification notification, + BindingResult bindingResult, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + beanValidator.validate(notification, bindingResult); + if (bindingResult.hasErrors()) { + NotificationVO vo = notificationService.selectNotificationInf(notificationVO); + model.addAttribute("result", vo); + return "egovframework/com/uss/ion/noi/EgovNotificationUpdt"; + } + + if (!notificationService.checkNotification(notification)) { + model.addAttribute("msg", egovMessageSource.getMessage("ussIonNoi.notificationUpdt.validate.alertNtfcTime")); + + NotificationVO vo = notificationService.selectNotificationInf(notificationVO); + + model.addAttribute("result", vo); + return "egovframework/com/uss/ion/noi/EgovNotificationUpdt"; + } + + if (isAuthenticated) { + notification.setLastUpdusrId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + + if (EgovDoubleSubmitHelper.checkAndSaveToken("EgovNotification")) { + notificationService.updateNotifictionInf(notification); + } + } + + return "forward:/uss/ion/noi/selectNotificationList.do"; + } + + /** + * 정보알림이 정보를 삭제한다. + * + * @param notificationVO + * @param notification + * @param status + * @return + * @throws Exception + */ + @RequestMapping("/uss/ion/noi/deleteNotification.do") + public String deleteNotification(@ModelAttribute("searchVO") NotificationVO notificationVO, @ModelAttribute("notification") Notification notification, + SessionStatus status) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if (isAuthenticated) { + notification.setLastUpdusrId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + notificationService.deleteNotifictionInf(notification); + } + // status.setComplete(); + return "forward:/uss/ion/noi/selectNotificationList.do"; + } + + /** + * 정보알림이 표시를 조회한다. + * + * @param notificationVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/uss/ion/noi/getNotifications.do") + public String getNotifications(@ModelAttribute("searchVO") NotificationVO notificationVO, ModelMap model) throws Exception { + //LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if (isAuthenticated) { + List list = notificationService.selectNotificationData(); + + model.addAttribute("list", list); + } + + return "egovframework/com/uss/ion/noi/EgovNotificationData"; + } +} diff --git a/src/main/java/egovframework/com/uss/ion/ntm/service/EgovNoteManageService.java b/src/main/java/egovframework/com/uss/ion/ntm/service/EgovNoteManageService.java new file mode 100644 index 0000000..25d05b5 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ntm/service/EgovNoteManageService.java @@ -0,0 +1,58 @@ +package egovframework.com.uss.ion.ntm.service; + +import java.util.List; +import java.util.Map; + +import egovframework.com.cmm.ComDefaultVO; + +import org.springframework.web.bind.annotation.RequestParam; +/** + * 쪽지 관리(보내기)를 처리하는 Service Class 구현 + * @author 공통서비스 장동한 + * @since 2010.06.16 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + *
    + * 
    + */ +public interface EgovNoteManageService { + + /** + * 쪽지관리 정보를 조회한다. + * @param noteManage -쪽지 관리(보내기) 정보가 담김 객체 + * @throws Exception + */ + public Map selectNoteManage(NoteManageVO noteManage) throws Exception; + + /** + * 쪽지 관리(보내기)를(을) 등록한다. + * @param noteManage 쪽지 관리(보내기) 정보 담김 객체 + * @param commandMap -Request 변수 + * @throws Exception + */ + void insertNoteManage(NoteManageVO noteManage, @RequestParam Map commandMap) throws Exception; + + /** + * 수신자/참조자선택팝업 목록을 조회한다. + * @param searchVO -조회할 정보가 담긴 VO + * @return List -회원정보 리스트 + * @throws Exception + */ + public List selectNoteEmpListPopup(ComDefaultVO searchVO) throws Exception; + + /** + * 수신자/참조자선택팝업 갯수를 조회한다. + * @param searchVO -조회할 정보가 담긴 VO + * @return int -조회된 데이터 건수 + * @throws Exception + */ + public int selectNoteEmpListPopupCnt(ComDefaultVO searchVO) throws Exception; + +} diff --git a/src/main/java/egovframework/com/uss/ion/ntm/service/NoteManageVO.java b/src/main/java/egovframework/com/uss/ion/ntm/service/NoteManageVO.java new file mode 100644 index 0000000..cd01f8e --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ntm/service/NoteManageVO.java @@ -0,0 +1,310 @@ +package egovframework.com.uss.ion.ntm.service; + +import java.io.Serializable; + +import egovframework.com.cmm.ComDefaultVO; + +/** + * 쪽지 관리(보내기) Model and VO Class 구현 + * @author 공통서비스 장동한 + * @since 2010.06.16 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + * 
    + * 
    + */ +@SuppressWarnings("serial") +public class NoteManageVO extends ComDefaultVO implements Serializable{ + + /** 쪽지 ID */ + private String noteId; + + /** 쪽지 송신 ID */ + private String noteTrnsmitId; + + /** 쪽지 수신 ID */ + private String noteRecptnId; + + /** 수신자 ID */ + private String rcverId; + + /** 개봉여부 */ + private String openYn; + + /** 수신구분 */ + private String recptnSe; + + /** 쪽지 내용 */ + private String noteCn; + + /** 쪽지 제목 */ + private String noteSj; + + /** 쪽지 발신자 */ + private String trnsmiterId; + + /** 쪽지 수신자 목록 */ + private String recptnEmpList; + + /** 쪽지 첨부파일 아이디 */ + private String atchFileId; + + /** 쪽지 첨부파일 */ + private byte[] atchFile; + + /** 최초등록시점 */ + private String frstRegisterPnttm; + + /** 최초등록아이디 */ + private String frstRegisterId; + + /** 최종수정일 */ + private String lastUpdusrPnttm; + + /** 최종수정자 아이디 */ + private String lastUpdusrId; + + /** + * @return the noteId + */ + public String getNoteId() { + return noteId; + } + + /** + * @param noteId the noteId to set + */ + public void setNoteId(String noteId) { + this.noteId = noteId; + } + + /** + * @return the noteTrnsmitId + */ + public String getNoteTrnsmitId() { + return noteTrnsmitId; + } + + /** + * @param noteTrnsmitId the noteTrnsmitId to set + */ + public void setNoteTrnsmitId(String noteTrnsmitId) { + this.noteTrnsmitId = noteTrnsmitId; + } + + /** + * @return the noteRecptnId + */ + public String getNoteRecptnId() { + return noteRecptnId; + } + + /** + * @param noteRecptnId the noteRecptnId to set + */ + public void setNoteRecptnId(String noteRecptnId) { + this.noteRecptnId = noteRecptnId; + } + + /** + * @return the rcverId + */ + public String getRcverId() { + return rcverId; + } + + /** + * @param rcverId the rcverId to set + */ + public void setRcverId(String rcverId) { + this.rcverId = rcverId; + } + + /** + * @return the openYn + */ + public String getOpenYn() { + return openYn; + } + + /** + * @param openYn the openYn to set + */ + public void setOpenYn(String openYn) { + this.openYn = openYn; + } + + /** + * @return the recptnSe + */ + public String getRecptnSe() { + return recptnSe; + } + + /** + * @param recptnSe the recptnSe to set + */ + public void setRecptnSe(String recptnSe) { + this.recptnSe = recptnSe; + } + + /** + * @return the noteCn + */ + public String getNoteCn() { + return noteCn; + } + + /** + * @param noteCn the noteCn to set + */ + public void setNoteCn(String noteCn) { + this.noteCn = noteCn; + } + + /** + * @return the noteSj + */ + public String getNoteSj() { + return noteSj; + } + + /** + * @param noteSj the noteSj to set + */ + public void setNoteSj(String noteSj) { + this.noteSj = noteSj; + } + + /** + * @return the trnsmiterId + */ + public String getTrnsmiterId() { + return trnsmiterId; + } + + /** + * @param trnsmiterId the trnsmiterId to set + */ + public void setTrnsmiterId(String trnsmiterId) { + this.trnsmiterId = trnsmiterId; + } + + /** + * @return the recptnEmpList + */ + public String getRecptnEmpList() { + return recptnEmpList; + } + + /** + * @param recptnEmpList the recptnEmpList to set + */ + public void setRecptnEmpList(String recptnEmpList) { + this.recptnEmpList = recptnEmpList; + } + + /** + * @return the atchFileId + */ + public String getAtchFileId() { + return atchFileId; + } + + /** + * @param atchFileId the atchFileId to set + */ + public void setAtchFileId(String atchFileId) { + this.atchFileId = atchFileId; + } + + /** + * @return the atchFile + */ + public byte[] getAtchFile() { + byte[] ret = null; + + if (atchFile != null) { + ret = new byte[atchFile.length]; + + for (int i = 0; i < atchFile.length; i++) { + ret[i] = atchFile[i]; + } + } + return ret; + } + + /** + * @param atchFile the atchFile to set + */ + public void setAtchFile(byte[] atchFile) { + this.atchFile = new byte[atchFile.length]; + + for (int i = 0; i < atchFile.length; ++i) { + this.atchFile[i] = atchFile[i]; + } + } + + /** + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * @param frstRegisterPnttm the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * @param frstRegisterId the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * @param lastUpdusrPnttm the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * @param lastUpdusrId the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + +} diff --git a/src/main/java/egovframework/com/uss/ion/ntm/service/impl/EgovNoteManageServiceImpl.java b/src/main/java/egovframework/com/uss/ion/ntm/service/impl/EgovNoteManageServiceImpl.java new file mode 100644 index 0000000..9e3d773 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ntm/service/impl/EgovNoteManageServiceImpl.java @@ -0,0 +1,138 @@ +package egovframework.com.uss.ion.ntm.service.impl; + +import java.util.List; +import java.util.Map; + +import egovframework.com.cmm.ComDefaultVO; +import egovframework.com.uss.ion.ntm.service.EgovNoteManageService; +import egovframework.com.uss.ion.ntm.service.NoteManageVO; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; +import org.springframework.web.bind.annotation.RequestParam; +/** + * 쪽지 관리(보내기)를 처리하는 ServiceImpl Class 구현 + * @author 공통서비스 장동한 + * @since 2010.06.16 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + *
    + * 
    + */ +@Service("egovNoteManageService") +public class EgovNoteManageServiceImpl extends EgovAbstractServiceImpl + implements EgovNoteManageService { + + @Resource(name = "noteManageDao") + private NoteManageDao dao; + + /* 쪽지관리 ID Generator Service */ + @Resource(name = "egovNoteManageIdGnrService") + private EgovIdGnrService noteIdgenService; + + /* 보낸쪽지함관리 ID Generator Service */ + @Resource(name = "egovNoteTrnsmitIdGnrService") + private EgovIdGnrService noteTrnsmitIdgenService; + + /* 받은쪽지함관리 ID Generator Service */ + @Resource(name = "egovNoteRecptnIdGnrService") + private EgovIdGnrService noteRecptnIdgenService; + + /** + * 쪽지관리 정보를 조회한다. + * @param noteManage -쪽지 관리(보내기) 정보가 담김 객체 + * @throws Exception + */ + @Override + public Map selectNoteManage(NoteManageVO noteManage) throws Exception { + return dao.selectNoteManage(noteManage); + } + + /** + * 쪽지 관리(보내기)를(을) 등록한다. + * @param noteManage -쪽지 관리(보내기) 정보가 담긴 객체 + * @param commandMap -Request 변수 + * @throws Exception + */ + @Override + public void insertNoteManage(NoteManageVO noteManage, @RequestParam Map commandMap)throws Exception{ + + /* **************************************************************** + * 쪽지관리 처리 + **************************************************************** */ + //쪽지 ID설정 + noteManage.setNoteId(noteIdgenService.getNextStringId()); + //쪽지 등록 + dao.insertNoteManage(noteManage); + + /* **************************************************************** + * 보낸쪽지 처리 + **************************************************************** */ + //보낸쪽지함 ID설정 + noteManage.setNoteTrnsmitId(noteTrnsmitIdgenService.getNextStringId()); + //발신자 아이디설정 + noteManage.setTrnsmiterId(noteManage.getFrstRegisterId()); + + //보낸쪽지등록 + dao.insertNoteTrnsmit(noteManage); + + //수신자 리스트 + String sRecptnEmpList = (String)commandMap.get("recptnEmpList"); + String[] sRecptnEmpListResult = sRecptnEmpList.split(","); + + //수신자구분 리스트 + String sRecptnSeList = (String)commandMap.get("recptnSeList"); + String[] sRecptnSeListResult = sRecptnSeList.split(","); + + + /* **************************************************************** + * 받은쪽지함 처리 + **************************************************************** */ + for(int i=0;i selectNoteEmpListPopup(ComDefaultVO searchVO) throws Exception{ + return dao.selectNoteEmpListPopup(searchVO); + } + + /** + * 수신자/참조자선택팝업 갯수를 조회한다. + * @param searchVO -조회할 정보가 담긴 VO + * @return int -조회된 데이터 건수 + * @throws Exception + */ + @Override + public int selectNoteEmpListPopupCnt(ComDefaultVO searchVO) throws Exception{ + return dao.selectNoteEmpListPopupCnt(searchVO); + } +} diff --git a/src/main/java/egovframework/com/uss/ion/ntm/service/impl/NoteManageDao.java b/src/main/java/egovframework/com/uss/ion/ntm/service/impl/NoteManageDao.java new file mode 100644 index 0000000..3774b2e --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ntm/service/impl/NoteManageDao.java @@ -0,0 +1,86 @@ +package egovframework.com.uss.ion.ntm.service.impl; + +import java.util.List; +import java.util.Map; + +import egovframework.com.cmm.ComDefaultVO; +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.ion.ntm.service.NoteManageVO; + +import org.springframework.stereotype.Repository; +/** + * 쪽지 관리(보내기)를 처리하는 Dao Class 구현 + * @author 공통콤포넌트 장동한 + * @since 2010.06.16 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일          수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한           최초 생성
    + *   2017.06.05   최두영          공통컴포넌트 3.7 개발
    + *
    + * 
    + */ +@Repository("noteManageDao") +public class NoteManageDao extends EgovComAbstractDAO { + + /** + * 쪽지관리 정보를 조회한다. + * @param noteManage -쪽지 관리(보내기) 정보가 담김 객체 + * @throws Exception + */ + public Map selectNoteManage(NoteManageVO noteManage) throws Exception { + return (Map)selectOne("NoteManage.selectNoteManage", noteManage); + } + + /** + * 쪽지 관리(보내기)를(을) 등록한다. + * @param noteManage -쪽지 관리(보내기) 정보가 담김 객체 + * @throws Exception + */ + public void insertNoteManage(NoteManageVO noteManage) throws Exception { + insert("NoteManage.insertNoteManage", noteManage); + } + + + /** + * 보낸쪽지를 등록한다. + * @param noteManage -쪽지 관리(보내기) 정보가 담김 객체 + * @throws Exception + */ + public void insertNoteTrnsmit(NoteManageVO noteManage) throws Exception { + insert("NoteManage.insertNoteTrnsmit", noteManage); + } + + + /** + * 받은쪽지를 등록한다. + * @param noteManage -쪽지 관리(보내기) 정보가 담김 객체 + * @throws Exception + */ + public void insertNoteRecptn(NoteManageVO noteManage) throws Exception { + insert("NoteManage.insertNoteRecptn", noteManage); + } + + /** + * 수신자/참조자선택팝업 목록을 조회한다. + * @param searchVO -조회할 정보가 담긴 VO + * @return List -회원정보 리스트 + * @throws Exception + */ + public List selectNoteEmpListPopup(ComDefaultVO searchVO) throws Exception { + return selectList("NoteManage.EovNoteEmpListPopup", searchVO); + } + + /** + * 수신자/참조자선택팝업 건수를 조회한다. + * @param searchVO -조회할 정보가 담긴 VO + * @return int -조회된 데이터 갯수 + * @throws Exception + */ + public int selectNoteEmpListPopupCnt(ComDefaultVO searchVO) throws Exception{ + return (Integer)selectOne("NoteManage.EovNoteEmpListPopupCnt", searchVO); + } +} diff --git a/src/main/java/egovframework/com/uss/ion/ntm/web/EgovNoteManageController.java b/src/main/java/egovframework/com/uss/ion/ntm/web/EgovNoteManageController.java new file mode 100644 index 0000000..6b0a96e --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ntm/web/EgovNoteManageController.java @@ -0,0 +1,265 @@ +package egovframework.com.uss.ion.ntm.web; + +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +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.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import egovframework.com.cmm.ComDefaultCodeVO; +import egovframework.com.cmm.ComDefaultVO; +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.service.EgovCmmUseService; +import egovframework.com.cmm.service.EgovFileMngService; +import egovframework.com.cmm.service.EgovFileMngUtil; +import egovframework.com.cmm.service.FileVO; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.ion.ntm.service.EgovNoteManageService; +import egovframework.com.uss.ion.ntm.service.NoteManageVO; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +/** + * 쪽지 관리(보내기)를 처리하는 Controller Class 구현 + * @author 공통서비스 장동한 + * @since 2010.06.16 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2010.06.16  장동한          최초 생성
    + *   2011.8.26	 정진오			IncludedInfo annotation 추가
    + *
    + * 
    + */ + +@Controller +public class EgovNoteManageController { + + @Autowired + private DefaultBeanValidator beanValidator; + + /** EgovMessageSource */ + @Resource(name = "egovMessageSource") + EgovMessageSource egovMessageSource; + + /** egovOnlinePollService */ + @Resource(name = "egovNoteManageService") + private EgovNoteManageService egovNoteManageService; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** 공통코드 서비스 */ + @Resource(name="EgovCmmUseService") + private EgovCmmUseService cmmUseService; + + /** 파일첨부 관리 서비스 */ + @Resource(name="EgovFileMngService") + private EgovFileMngService fileMngService; + + /** 파일첨부 Util */ + @Resource(name="EgovFileMngUtil") + private EgovFileMngUtil fileUtil; + + /** + * 쪽지 관리(보내기) 목록을 조회한다. + * @param noteManage -쪽지관리 Model + * @param commandMap -Request Variable + * @param model -Spring 제공하는 ModelMap + * @return String -리턴 URL + * @throws Exception + */ + @IncludedInfo(name="쪽지관리", order = 840 ,gid = 50) + @RequestMapping(value = "/uss/ion/ntm/registEgovNoteManage.do") + public String EgovNoteRecptnRegistForm(NoteManageVO noteManage, @RequestParam Map commandMap,ModelMap model) throws Exception { + + String sCmd = commandMap.get("cmd") == null ? "" : (String) commandMap.get("cmd"); + + //Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + //수신구분 + ComDefaultCodeVO voComCode = new ComDefaultCodeVO(); + voComCode.setCodeId("COM050"); + List listComCode = cmmUseService.selectCmmCodeDetail(voComCode); + model.addAttribute("recptnSe", listComCode); + + //답변처리 + if(sCmd.equals("reply")){ + model.addAttribute("cmd", sCmd); + + Map mapNoteManage = egovNoteManageService.selectNoteManage(noteManage); + + noteManage.setNoteSj("RE : " + (String)mapNoteManage.get("noteSj")); + /* + HTML EDIT 용 + noteManage.setNoteCn( + "



    " + + "[ 원 본 글 ]=================================================================
    " + + "* 발 신 자 : " + (String)mapNoteManage.get("trnsmiterNm") + "("+ (String)mapNoteManage.get("trnsmiterNm") +")
    " + + "* 발신시각 : "+ (String)mapNoteManage.get("trnsmiterPnttm") + "

    " + + (String)mapNoteManage.get("noteCn") + ); + */ + noteManage.setNoteCn( + "\r\n" + + "\r\n" + + "\r\n" + + "\r\n" + + "\r\n" + + "[ 원 본 글 ]================================================================" + "\r\n" + + "* 발 신 자 : " + (String)mapNoteManage.get("trnsmiterNm") + "("+ (String)mapNoteManage.get("trnsmiterNm") +")
    " + "\r\n" + + "* 발신시각 : "+ (String)mapNoteManage.get("trnsmiterPnttm") + "\r\n" + + (String)mapNoteManage.get("noteCn") + ); + + noteManage.setAtchFileId((String)mapNoteManage.get("atchFileId")); + + model.addAttribute("noteManage", noteManage); + model.addAttribute("noteManageMap", mapNoteManage); + }else{ + model.addAttribute("noteManage", new NoteManageVO()); + } + + return "egovframework/com/uss/ion/ntm/EgovNoteManage"; + + } + + /** + * 쪽지 관리(보내기) 목록을 조회한다.(POST형식) + * @param multiRequest -Multipart Request + * @param commandMap -Request Variable + * @param noteManage -쪽지관리 Model + * @param bindingResult -Validator 하기위한 객체 + * @param model -Spring 제공하는 ModelMap + * @return String -리턴 URL + * @throws Exception + */ + @RequestMapping(value = "/uss/ion/ntm/registEgovNoteManageActor.do") + public String EgovNoteRecptnRegist( + final MultipartHttpServletRequest multiRequest, + @RequestParam Map commandMap, + NoteManageVO noteManage, + BindingResult bindingResult, + ModelMap model) throws Exception { + + String sLocationUrl = "egovframework/com/uss/ion/ntm/EgovNoteManage"; + + //Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + //서버 validate 체크 + beanValidator.validate(noteManage, bindingResult); + if(bindingResult.hasErrors()){ + model.addAttribute("noteManage", noteManage); + return sLocationUrl; + } + //로그인 객체 선언 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + //아이디 설정 + noteManage.setFrstRegisterId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + noteManage.setLastUpdusrId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + + // 첨부파일 관련 첨부파일ID 생성 + List _result = null; + String _atchFileId = ""; + + final Map files = multiRequest.getFileMap(); + + if(!files.isEmpty()){ + _result = fileUtil.parseFileInf(files, "DSCH_", 0, "", ""); + _atchFileId = fileMngService.insertFileInfs(_result); //파일이 생성되고나면 생성된 첨부파일 ID를 리턴한다. + } + noteManage.setAtchFileId(_atchFileId); + + //쪽지등록 + egovNoteManageService.insertNoteManage(noteManage, commandMap); + //NoteManage 빈 객체 생성 + model.addAttribute("noteManage", new NoteManageVO()); + + //등록메세지 설정 + String ReusltScript = ""; + + ReusltScript += ""; + + model.addAttribute("reusltScript", ReusltScript); + + return sLocationUrl; + } + + + /** + * 쪽지 관리(보내기) 사용자 목록을 조회한다. + * @param searchVO -검색정보가 담긴 Model + * @param commandMap -Request Variable + * @param model -Spring 제공하는 ModelMap + * @return String -리턴 URL + * @throws Exception + */ + + @RequestMapping(value = "/uss/ion/ntm/listEgovNoteEmpListPopup.do") + public String EgovEgovNoteEmpList( + @ModelAttribute("searchVO") ComDefaultVO searchVO, + @RequestParam Map commandMap, + ModelMap model) throws Exception { + + + List resultList = egovNoteManageService.selectNoteEmpListPopup(searchVO); + model.addAttribute("resultList", resultList); + + /** 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()); + + List reusltList = egovNoteManageService.selectNoteEmpListPopup(searchVO); + model.addAttribute("resultList", reusltList); + + model.addAttribute("searchKeyword", commandMap.get("searchKeyword") == null ? "" : (String) commandMap.get("searchKeyword")); + model.addAttribute("searchCondition", commandMap.get("searchCondition") == null ? "" : (String) commandMap.get("searchCondition")); + + int totCnt = egovNoteManageService.selectNoteEmpListPopupCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/uss/ion/ntm/EgovNoteEmpList"; + } + + +} diff --git a/src/main/java/egovframework/com/uss/ion/ntr/service/EgovNoteRecptnService.java b/src/main/java/egovframework/com/uss/ion/ntr/service/EgovNoteRecptnService.java new file mode 100644 index 0000000..a4cb3b5 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ntr/service/EgovNoteRecptnService.java @@ -0,0 +1,54 @@ +package egovframework.com.uss.ion.ntr.service; + +import java.util.List; +import java.util.Map; +/** + * 받은쪽지함관리를 처리하는 Service Class 구현 + * @author 공통서비스 장동한 + * @since 2010.06.16 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + *
    + * 
    + */ +public interface EgovNoteRecptnService { + + /** + * 받은쪽지함관리 목록을 조회한다. + * @param noteRecptn -조회할 정보가 담긴 객체 + * @return List -조회목록이담긴List + * @throws Exception + */ + public List selectNoteRecptnList(NoteRecptn noteRecptn) throws Exception; + + /** + * 받은쪽지함관리를(을) 목록 전체 건수를(을) 조회한다. + * @param noteRecptn -조회할 정보가 담긴 객체 + * @return int -조회한건수 + * @throws Exception + */ + public int selectNoteRecptnListCnt(NoteRecptn noteRecptn) throws Exception; + + /** + * 받은쪽지함관리를(을) 상세조회 한다. + * @param noteRecptn -받은쪽지함관리 정보 담김 객체 + * @return Mp -조회정보가담긴Map + * @throws Exception + */ + public Map selectNoteRecptnDetail(NoteRecptn noteRecptn) throws Exception; + + /** + * 받은쪽지함관리를(을) 삭제한다. + * @param noteRecptn -받은쪽지함관리 정보 담김 객체 + * @throws Exception + */ + void deleteNoteRecptn(NoteRecptn noteRecptn) throws Exception; + +} diff --git a/src/main/java/egovframework/com/uss/ion/ntr/service/NoteRecptn.java b/src/main/java/egovframework/com/uss/ion/ntr/service/NoteRecptn.java new file mode 100644 index 0000000..d8fc0b4 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ntr/service/NoteRecptn.java @@ -0,0 +1,292 @@ +package egovframework.com.uss.ion.ntr.service; + +import java.io.Serializable; + +import egovframework.com.cmm.ComDefaultVO; + +/** + * 받은쪽지함관리 Model and VO Class 구현 + * @author 공통서비스 장동한 + * @since 2010.06.16 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + * 
    + * 
    + */ +@SuppressWarnings("serial") +public class NoteRecptn extends ComDefaultVO implements Serializable{ + + /** 쪽지 ID */ + private String noteId; + + /** 쪽지 송신 ID */ + private String noteTrnsmitId; + + /** 쪽지 수신 ID */ + private String noteRecptnId; + + /** 수신자 ID */ + private String rcverId; + + /** 개봉여부 */ + private String openYn; + + /** 수신구분 */ + private String recptnSe; + + /** 쪽지 제목 */ + private String noteSj; + + /** 쪽지 내용 */ + private String noteCn; + + /** 보낸 시작날짜 */ + private String searchFromDate; + + /** 보낸 종료날짜 */ + private String searchToDate; + + /** 쪽지 첨부파일 */ + private byte[] atchFileId; + + /** 최초등록시점 */ + private String frstRegisterPnttm; + + /** 최초등록아이디 */ + private String frstRegisterId; + + /** 최종수정일 */ + private String lastUpdusrPnttm; + + /** 최종수정자 아이디 */ + private String lastUpdusrId; + + /** + * @return the noteId + */ + public String getNoteId() { + return noteId; + } + + /** + * @param noteId the noteId to set + */ + public void setNoteId(String noteId) { + this.noteId = noteId; + } + + /** + * @return the noteTrnsmitId + */ + public String getNoteTrnsmitId() { + return noteTrnsmitId; + } + + /** + * @param noteTrnsmitId the noteTrnsmitId to set + */ + public void setNoteTrnsmitId(String noteTrnsmitId) { + this.noteTrnsmitId = noteTrnsmitId; + } + + /** + * @return the noteRecptnId + */ + public String getNoteRecptnId() { + return noteRecptnId; + } + + /** + * @param noteRecptnId the noteRecptnId to set + */ + public void setNoteRecptnId(String noteRecptnId) { + this.noteRecptnId = noteRecptnId; + } + + /** + * @return the rcverId + */ + public String getRcverId() { + return rcverId; + } + + /** + * @param rcverId the rcverId to set + */ + public void setRcverId(String rcverId) { + this.rcverId = rcverId; + } + + /** + * @return the openYn + */ + public String getOpenYn() { + return openYn; + } + + /** + * @param openYn the openYn to set + */ + public void setOpenYn(String openYn) { + this.openYn = openYn; + } + + /** + * @return the recptnSe + */ + public String getRecptnSe() { + return recptnSe; + } + + /** + * @param recptnSe the recptnSe to set + */ + public void setRecptnSe(String recptnSe) { + this.recptnSe = recptnSe; + } + + /** + * @return the noteSj + */ + public String getNoteSj() { + return noteSj; + } + + /** + * @param noteSj the noteSj to set + */ + public void setNoteSj(String noteSj) { + this.noteSj = noteSj; + } + + /** + * @return the noteCn + */ + public String getNoteCn() { + return noteCn; + } + + /** + * @param noteCn the noteCn to set + */ + public void setNoteCn(String noteCn) { + this.noteCn = noteCn; + } + + /** + * @return the searchFromDate + */ + public String getSearchFromDate() { + return searchFromDate; + } + + /** + * @param searchFromDate the searchFromDate to set + */ + public void setSearchFromDate(String searchFromDate) { + this.searchFromDate = searchFromDate; + } + + /** + * @return the searchToDate + */ + public String getSearchToDate() { + return searchToDate; + } + + /** + * @param searchToDate the searchToDate to set + */ + public void setSearchToDate(String searchToDate) { + this.searchToDate = searchToDate; + } + + /** + * @return the atchFileId + */ + public byte[] getAtchFileId() { + byte[] ret = null; + + if (atchFileId != null) { + ret = new byte[atchFileId.length]; + + for (int i = 0; i < atchFileId.length; i++) { + ret[i] = atchFileId[i]; + } + } + return ret; + } + + /** + * @param atchFileId the atchFileId to set + */ + public void setAtchFileId(byte[] atchFileId) { + this.atchFileId = new byte[atchFileId.length]; + + for (int i = 0; i < atchFileId.length; ++i) { + this.atchFileId[i] = atchFileId[i]; + } + } + + /** + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * @param frstRegisterPnttm the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * @param frstRegisterId the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * @param lastUpdusrPnttm the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * @param lastUpdusrId the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/ntr/service/impl/EgovNoteRecptnServiceImpl.java b/src/main/java/egovframework/com/uss/ion/ntr/service/impl/EgovNoteRecptnServiceImpl.java new file mode 100644 index 0000000..83212a6 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ntr/service/impl/EgovNoteRecptnServiceImpl.java @@ -0,0 +1,102 @@ +package egovframework.com.uss.ion.ntr.service.impl; + +import java.util.List; +import java.util.Map; + +import egovframework.com.uss.ion.ntr.service.EgovNoteRecptnService; +import egovframework.com.uss.ion.ntr.service.NoteRecptn; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; +/** + * 받은쪽지함관리를 처리하는 ServiceImpl Class 구현 + * @author 공통서비스 장동한 + * @since 2010.06.16 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + *
    + * 
    + */ +@Service("egovNoteRecptnService") +public class EgovNoteRecptnServiceImpl extends EgovAbstractServiceImpl + implements EgovNoteRecptnService { + + @Resource(name = "noteRecptnDao") + private NoteRecptnDao dao; + + /** + * 받은쪽지함관리를(을) 목록을 조회 한다. + * @param noteRecptn -조회할 정보가 담긴 객체 + * @return List -조회한목록 + * @throws Exception + */ + @Override + public List selectNoteRecptnList(NoteRecptn noteRecptn) throws Exception { + return dao.selectNoteRecptnList(noteRecptn); + } + + /** + * 받은쪽지함관리를(을) 목록 전체 건수를(을) 조회한다. + * @param noteRecptn -조회할 정보가 담긴 객체 + * @return int -조회한전체건수 + * @throws Exception + */ + @Override + public int selectNoteRecptnListCnt(NoteRecptn noteRecptn) throws Exception { + return dao.selectNoteRecptnListCnt(noteRecptn); + } + + /** + * 받은쪽지함관리를(을) 상세조회 한다. + * @param noteRecptn -받은쪽지함관리 Model + * @return Map -성세조회정보가 담긴 Map + * @throws Exception + */ + @Override + public Map selectNoteRecptnDetail(NoteRecptn noteRecptn) throws Exception { + //받은쪽지함관리를 개봉으로 상태를 바꾼다. + dao.updateNoteRecptnRelationOpenYn(noteRecptn); + return dao.selectNoteRecptnDetail(noteRecptn); + } + + /** + * 받은쪽지함관리를(을) 삭제한다. + * @param noteRecptn 받은쪽지함관리 정보가 담긴 객체 + * @return void + * @throws Exception + */ + @Override + public void deleteNoteRecptn(NoteRecptn noteRecptn) throws Exception { + + //보낸쪽지함 건수를 조회함 + int nNoteTrnsmitCnt = dao.selectNoteTrnsmitRelationCnt(noteRecptn); + + //받은쪽지함 건수를 조회함 + int nNoteRecptnCnt = dao.selectNoteRecptnRelationCnt(noteRecptn); + + System.out.println("nNoteTrnsmitCnt>"+nNoteTrnsmitCnt); + System.out.println("nNoteRecptnCnt>"+nNoteRecptnCnt); + if(nNoteTrnsmitCnt == 1 && nNoteRecptnCnt==1){ + //받은쪽지/쪽지관리 삭제 처리 + //dao.deleteNoteRecptnRelation(noteRecptn); + //받은쪽지함삭제 + dao.deleteNoteRecptn(noteRecptn); + //보낸쪽지함삭제 + dao.deleteNoteTrnsmit(noteRecptn); + //쪽지관리삭제 + dao.deleteNoteManage(noteRecptn); + }else{ + //받은쪽지 삭제 + dao.deleteNoteRecptn(noteRecptn); + } + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/ntr/service/impl/NoteRecptnDao.java b/src/main/java/egovframework/com/uss/ion/ntr/service/impl/NoteRecptnDao.java new file mode 100644 index 0000000..6166b26 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ntr/service/impl/NoteRecptnDao.java @@ -0,0 +1,122 @@ +package egovframework.com.uss.ion.ntr.service.impl; + +import java.util.List; +import java.util.Map; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.ion.ntr.service.NoteRecptn; + +import org.springframework.stereotype.Repository; +/** + * 받은쪽지함관리를 처리하는 Dao Class 구현 + * @author 공통콤포넌트 장동한 + * @since 2010.06.16 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + *   2017.09.14	 장동한		   표준프레임워크 3.7 개선
    + *
    + * 
    + */ +@Repository("noteRecptnDao") +public class NoteRecptnDao extends EgovComAbstractDAO { + + /** + * 받은쪽지함관리를(을) 목록을 한다. + * @param noteRecptn -조회할 정보가 담긴 객체 + * @return List -조회한목록 + * @throws Exception + */ + public List selectNoteRecptnList(NoteRecptn noteRecptn) throws Exception { + return selectList("NoteRecptn.selectNoteRecptn", noteRecptn); + } + + /** + * 받은쪽지함관리를(을) 목록 전체 건수를(을) 조회한다. + * @param noteRecptn -조회할 정보가 담긴 객체 + * @return int -조회한건수 + * @throws Exception + */ + public int selectNoteRecptnListCnt(NoteRecptn noteRecptn) throws Exception { + return (Integer)selectOne("NoteRecptn.selectNoteRecptnCnt", noteRecptn); + } + + /** + * 받은쪽지함관리를 개봉으로 상태를 바꾼다. + * @param noteRecptn -받은쪽지함관리 정보가 담김 객체 + * @throws Exception + */ + public void updateNoteRecptnRelationOpenYn(NoteRecptn noteRecptn) throws Exception { + update("NoteRecptn.updateNoteRecptnRelationOpenYn" , noteRecptn); + } + + /** + * 받은쪽지함관리를(을) 상세조회 한다. + * @param noteRecptn -받은쪽지함관리 정보가 담김 객체 + * @return NoteRecptn -조회한받은쪽지함객체 + * @throws Exception + */ + public Map selectNoteRecptnDetail(NoteRecptn noteRecptn) throws Exception { + return (Map)selectOne("NoteRecptn.selectNoteRecptnDetail", noteRecptn); + } + + /** + * 쪽지관리/쪽지관리,보낸보낸쪽지함, 받은쪽지함 삭제 + * @param noteRecptn -보낸쪽지함관리 정보가 담김 객체 + * @throws Exception + */ + public void deleteNoteRecptnRelation(NoteRecptn noteRecptn) throws Exception { + delete("NoteRecptn.deleteNoteRecptnRelation" , noteRecptn); + } + + /** + * 받은쪽지함관리를(을) 삭제한다. + * @param noteRecptn -받은쪽지함관리 정보가 담김 객체 + * @throws Exception + */ + public void deleteNoteRecptn(NoteRecptn noteRecptn) throws Exception { + delete("NoteRecptn.deleteNoteRecptn" , noteRecptn); + } + + /** + * 쪽지관리/보낸족지함삭제 + * @param noteRecptn -보낸쪽지함관리 정보가 담김 객체 + * @throws Exception + */ + public void deleteNoteTrnsmit(NoteRecptn noteRecptn) throws Exception { + delete("NoteRecptn.deleteNoteTrnsmit" , noteRecptn); + } + + /** + * 쪽지관리/쪽지관리삭제 + * @param noteRecptn -보낸쪽지함관리 정보가 담김 객체 + * @throws Exception + */ + public void deleteNoteManage(NoteRecptn noteRecptn) throws Exception { + delete("NoteRecptn.deleteNoteManage" , noteRecptn); + } + + /** + * 보낸쪽지함관리 건수를 조회한다. + * @param noteRecptn -조회할 정보가 담긴 객체 + * @return int -조회한건수 + * @throws Exception + */ + public int selectNoteTrnsmitRelationCnt(NoteRecptn noteRecptn) throws Exception { + return (Integer)selectOne("NoteRecptn.selectNoteTrnsmitRelationCnt", noteRecptn); + } + + /** + * 받은쪽지함관리 건수를 조회한다. + * @param noteRecptn 조회할 정보가 담긴 객체 + * @return int -조회한건수 + * @throws Exception + */ + public int selectNoteRecptnRelationCnt(NoteRecptn noteRecptn) throws Exception { + return (Integer)selectOne("NoteRecptn.selectNoteRecptnRelationCnt", noteRecptn); + } +} diff --git a/src/main/java/egovframework/com/uss/ion/ntr/web/EgovNoteRecptnController.java b/src/main/java/egovframework/com/uss/ion/ntr/web/EgovNoteRecptnController.java new file mode 100644 index 0000000..ff5f8f6 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ntr/web/EgovNoteRecptnController.java @@ -0,0 +1,221 @@ +package egovframework.com.uss.ion.ntr.web; + +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +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 egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.ion.ntr.service.EgovNoteRecptnService; +import egovframework.com.uss.ion.ntr.service.NoteRecptn; +import egovframework.com.uss.ion.nts.service.EgovNoteTrnsmitService; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +/** + * 받은쪽지함관리를 처리하는 Controller Class 구현 + * @author 공통서비스 장동한 + * @since 2010.06.16 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2010.06.16  장동한          최초 생성
    + *   2011.8.26	정진오			IncludedInfo annotation 추가
    + *
    + * 
    + */ + +@Controller +public class EgovNoteRecptnController { + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovNoteRecptnController.class); + + @Autowired + private DefaultBeanValidator beanValidator; + + /** EgovMessageSource */ + @Resource(name = "egovMessageSource") + EgovMessageSource egovMessageSource; + + /** egovOnlinePollService */ + @Resource(name = "egovNoteRecptnService") + private EgovNoteRecptnService egovNoteRecptnService; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** egovNoteTrnsmitService */ + @Resource(name = "egovNoteTrnsmitService") + private EgovNoteTrnsmitService egovNoteTrnsmitService; + /** + * 받은쪽지함관리 목록을 조회한다. + * @param request -HttpServletRequest 객체 + * @param response -HttpServletResponse 객체 + * @param searchVO -검색정보가 담긴 Model + * @param commandMap -Request Variable + * @param noteRecptn -받은쪽지함관리 Model + * @param model -Spring 제공하는 ModelMap + * @return String -리턴 URL + * @throws Exception + */ + @IncludedInfo(name="받은쪽지함관리", order = 850 ,gid = 50) + @RequestMapping(value = "/uss/ion/ntr/listNoteRecptn.do") + public String EgovNoteRecptnList( + HttpServletRequest request, + HttpServletResponse response, + @ModelAttribute("searchVO") NoteRecptn searchVO, + @RequestParam Map commandMap, + @ModelAttribute("noteRecptn") NoteRecptn noteRecptn, + ModelMap model) throws Exception { + + //변수 설정 + String sCmd = commandMap.get("cmd") == null ? "" : (String) commandMap.get("cmd"); + + //Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + //로그인 객체 선언 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + //삭제 모드로 실행시 + if(sCmd.equals("del")){ + //한개의 값으로 삭제가 넘어올때 처리 + if(commandMap.get("checkList") instanceof String){ + String sCheckList = (String)commandMap.get("checkList"); + + String[] sArrCheckListValue = sCheckList.split(","); + + LOGGER.debug("==================================EgovNoteRecptnList"); + LOGGER.debug("checkList {}", sCheckList); + LOGGER.debug("sArrCheckListValue[0]> {}", sArrCheckListValue[0]); + LOGGER.debug("sArrCheckListValue[1]> {}", sArrCheckListValue[1]); + + noteRecptn.setFrstRegisterId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + noteRecptn.setLastUpdusrId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + noteRecptn.setNoteId(sArrCheckListValue[0]); + noteRecptn.setNoteTrnsmitId(sArrCheckListValue[1]); + noteRecptn.setNoteRecptnId(sArrCheckListValue[2]); + + egovNoteRecptnService.deleteNoteRecptn(noteRecptn); + + } + + //여러개의 값으로 삭제가 넘어올때 처리 + if(commandMap.get("checkList") instanceof String[]){ + String[] sArrCheckList = (String[])commandMap.get("checkList"); + //log.debug("sArrCheckList" + sArrCheckList); + + for(int i=0;i reusltList = egovNoteRecptnService.selectNoteRecptnList(searchVO); + model.addAttribute("resultList", reusltList); + + model.addAttribute("searchKeyword", commandMap.get("searchKeyword") == null ? "" : (String) commandMap.get("searchKeyword")); + model.addAttribute("searchCondition", commandMap.get("searchCondition") == null ? "" : (String) commandMap.get("searchCondition")); + + int totCnt = egovNoteRecptnService.selectNoteRecptnListCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/uss/ion/ntr/EgovNoteRecptnList"; + + } + + /** + * 받은쪽지함관리 목록을 상세조회 조회한다. + * @param searchVO -검색정보가 담긴 Model + * @param commandMap -Request Variable + * @param noteRecptn -받은쪽지함관리 Model + * @param model -Spring 제공하는 ModelMap + * @return String -리턴 URL + * @throws Exception + */ + @SuppressWarnings("unused") + @RequestMapping(value = "/uss/ion/ntr/detailNoteRecptn.do") + public String EgovNoteRecptnDetail( + @ModelAttribute("searchVO") NoteRecptn searchVO, + @RequestParam Map commandMap, + @ModelAttribute("noteRecptn") NoteRecptn noteRecptn, + ModelMap model) throws Exception { + + String sLocationUrl = "egovframework/com/uss/ion/nts/EgovNoteTrnsmitDetail"; + + String sCmd = commandMap.get("cmd") == null ? "" : (String) commandMap.get("cmd"); + + if(sCmd.equals("del")){ + egovNoteRecptnService.deleteNoteRecptn(searchVO); + return "redirect:/uss/ion/ntr/listNoteRecptn.do"; + }else{ + //로그인 객체 선언/아이디설정 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + searchVO.setFrstRegisterId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + searchVO.setLastUpdusrId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + + Map noteRecptnMap = egovNoteRecptnService.selectNoteRecptnDetail(searchVO); + model.addAttribute("noteRecptn", noteRecptnMap); + + egovframework.com.uss.ion.nts.service.NoteTrnsmit noteTrnsmit = new egovframework.com.uss.ion.nts.service.NoteTrnsmit(); + noteTrnsmit.setNoteId((String)commandMap.get("noteId")); + + List resultRecptnEmp = egovNoteTrnsmitService.selectNoteTrnsmitCnfirm(noteTrnsmit); + model.addAttribute("resultRecptnEmp", resultRecptnEmp); + } + + return "egovframework/com/uss/ion/ntr/EgovNoteRecptnDetail"; + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/nts/service/EgovNoteTrnsmitService.java b/src/main/java/egovframework/com/uss/ion/nts/service/EgovNoteTrnsmitService.java new file mode 100644 index 0000000..f86cf90 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/nts/service/EgovNoteTrnsmitService.java @@ -0,0 +1,69 @@ +package egovframework.com.uss.ion.nts.service; + +import java.util.List; +import java.util.Map; +/** + * 보낸쪽지함관리를 처리하는 Service Class 구현 + * @author 공통서비스 장동한 + * @since 2010.06.16 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + *
    + * 
    + */ +public interface EgovNoteTrnsmitService { + + /** + * 보낸쪽지함관리 목록을 조회한다. + * @param noteTrnsmit -조회할 정보가 담긴 객체 + * @return List + * @throws Exception + */ + public List selectNoteTrnsmitList(NoteTrnsmit noteTrnsmit) throws Exception; + + /** + * 보낸쪽지함관리를(을) 목록 전체 건수를(을) 조회한다. + * @param searchVO -조회할 정보가 담긴 객체 + * @return int + * @throws Exception + */ + public int selectNoteTrnsmitListCnt(NoteTrnsmit noteTrnsmit) throws Exception; + + /** + * 보낸쪽지함관리를(을) 상세조회 한다. + * @param noteTrnsmit -조회할 정보가 담긴 객체 + * @return Map + * @throws Exception + */ + public Map selectNoteTrnsmitDetail(NoteTrnsmit noteTrnsmit) throws Exception; + + /** + * 보낸쪽지함관리를(을) 삭제한다. + * @param noteTrnsmit -보낸쪽지함관리 정보 담김 객체 + * @throws Exception + */ + void deleteNoteTrnsmit(NoteTrnsmit noteTrnsmit) throws Exception; + + /** + * 받은쪽지함관리를(을) 삭제한다. + * @param noteTrnsmit -보낸쪽지함관리 정보 담김 객체 + * @throws Exception + */ + void deleteNoteRecptn(NoteTrnsmit noteTrnsmit) throws Exception; + + /** + * 수신자목록을 조회한다. + * @param noteTrnsmit -조회할 정보가 담긴 객체 + * @return List + * @throws Exception + */ + public List selectNoteTrnsmitCnfirm(NoteTrnsmit noteTrnsmit) throws Exception; + +} diff --git a/src/main/java/egovframework/com/uss/ion/nts/service/NoteTrnsmit.java b/src/main/java/egovframework/com/uss/ion/nts/service/NoteTrnsmit.java new file mode 100644 index 0000000..5aaafa0 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/nts/service/NoteTrnsmit.java @@ -0,0 +1,265 @@ +package egovframework.com.uss.ion.nts.service; + +import java.io.Serializable; + +import egovframework.com.cmm.ComDefaultVO; + +/** + * 보낸쪽지함관리 Model and VO Class 구현 + * @author 공통서비스 장동한 + * @since 2010.06.16 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + * 
    + * 
    + */ +@SuppressWarnings("serial") +public class NoteTrnsmit extends ComDefaultVO implements Serializable{ + + /** 쪽지 ID */ + private String noteId; + + /** 쪽지 송신 ID */ + private String noteTrnsmitId; + + /** 쪽지 수신 ID */ + private String noteRecptnId; + + /** 쪽지 송신자 ID */ + private String trnsmiterId; + + /** 개봉여부 */ + private String openYn; + + /** 쪽지 제목 */ + private String noteSj; + + /** 쪽지 내용 */ + private String noteCn; + + /** 쪽지 첨부파일 */ + private String atchFileId; + + /** 보낸 시작날짜 */ + private String searchFromDate; + + /** 보낸 종료날짜 */ + private String searchToDate; + + /** 최초등록시점 */ + private String frstRegisterPnttm; + + /** 최초등록아이디 */ + private String frstRegisterId; + + /** 최종수정일 */ + private String lastUpdusrPnttm; + + /** 최종수정자 아이디 */ + private String lastUpdusrId; + + /** + * @return the noteId + */ + public String getNoteId() { + return noteId; + } + + /** + * @param noteId the noteId to set + */ + public void setNoteId(String noteId) { + this.noteId = noteId; + } + + /** + * @return the noteTrnsmitId + */ + public String getNoteTrnsmitId() { + return noteTrnsmitId; + } + + /** + * @param noteTrnsmitId the noteTrnsmitId to set + */ + public void setNoteTrnsmitId(String noteTrnsmitId) { + this.noteTrnsmitId = noteTrnsmitId; + } + + /** + * @return the noteRecptnId + */ + public String getNoteRecptnId() { + return noteRecptnId; + } + + /** + * @param noteRecptnId the noteRecptnId to set + */ + public void setNoteRecptnId(String noteRecptnId) { + this.noteRecptnId = noteRecptnId; + } + + /** + * @return the trnsmiterId + */ + public String getTrnsmiterId() { + return trnsmiterId; + } + + /** + * @param trnsmiterId the trnsmiterId to set + */ + public void setTrnsmiterId(String trnsmiterId) { + this.trnsmiterId = trnsmiterId; + } + + /** + * @return the openYn + */ + public String getOpenYn() { + return openYn; + } + + /** + * @param openYn the openYn to set + */ + public void setOpenYn(String openYn) { + this.openYn = openYn; + } + + /** + * @return the noteSj + */ + public String getNoteSj() { + return noteSj; + } + + /** + * @param noteSj the noteSj to set + */ + public void setNoteSj(String noteSj) { + this.noteSj = noteSj; + } + + /** + * @return the noteCn + */ + public String getNoteCn() { + return noteCn; + } + + /** + * @param noteCn the noteCn to set + */ + public void setNoteCn(String noteCn) { + this.noteCn = noteCn; + } + + /** + * @return the atchFileId + */ + public String getAtchFileId() { + return atchFileId; + } + + /** + * @param atchFileId the atchFileId to set + */ + public void setAtchFileId(String atchFileId) { + this.atchFileId = atchFileId; + } + + /** + * @return the searchFromDate + */ + public String getSearchFromDate() { + return searchFromDate; + } + + /** + * @param searchFromDate the searchFromDate to set + */ + public void setSearchFromDate(String searchFromDate) { + this.searchFromDate = searchFromDate; + } + + /** + * @return the searchToDate + */ + public String getSearchToDate() { + return searchToDate; + } + + /** + * @param searchToDate the searchToDate to set + */ + public void setSearchToDate(String searchToDate) { + this.searchToDate = searchToDate; + } + + /** + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * @param frstRegisterPnttm the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * @param frstRegisterId the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * @param lastUpdusrPnttm the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * @param lastUpdusrId the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + + + +} diff --git a/src/main/java/egovframework/com/uss/ion/nts/service/impl/EgovNoteTrnsmitServiceImpl.java b/src/main/java/egovframework/com/uss/ion/nts/service/impl/EgovNoteTrnsmitServiceImpl.java new file mode 100644 index 0000000..9eff4b6 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/nts/service/impl/EgovNoteTrnsmitServiceImpl.java @@ -0,0 +1,112 @@ +package egovframework.com.uss.ion.nts.service.impl; + +import java.util.List; +import java.util.Map; + +import egovframework.com.uss.ion.nts.service.EgovNoteTrnsmitService; +import egovframework.com.uss.ion.nts.service.NoteTrnsmit; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; +/** + * 보낸쪽지함관리를 처리하는 ServiceImpl Class 구현 + * @author 공통서비스 장동한 + * @since 2010.06.16 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + *
    + * 
    + */ +@Service("egovNoteTrnsmitService") +public class EgovNoteTrnsmitServiceImpl extends EgovAbstractServiceImpl + implements EgovNoteTrnsmitService { + + @Resource(name = "noteTrnsmitDao") + private NoteTrnsmitDao dao; + + + /** + * 보낸쪽지함관리를(을) 목록을 조회 한다. + * @param noteTrnsmit -조회할 정보가 담긴 객체 + * @return List -조회목록이담긴List + * @throws Exception + */ + @Override + public List selectNoteTrnsmitList(NoteTrnsmit noteTrnsmit) throws Exception { + return dao.selectNoteTrnsmitList(noteTrnsmit); + } + + /** + * 보낸쪽지함관리를(을) 목록 전체 건수를(을) 조회한다. + * @param noteTrnsmit -조회할 정보가 담긴 객체 + * @return int -조회한건수가담긴Integer + * @throws Exception + */ + @Override + public int selectNoteTrnsmitListCnt(NoteTrnsmit noteTrnsmit) throws Exception { + return dao.selectNoteTrnsmitListCnt(noteTrnsmit); + } + + /** + * 보낸쪽지함관리를(을) 상세조회 한다. + * @param noteTrnsmit -조회할 정보가 담긴 객체 + * @return Map -조회정보가담긴Map + * @throws Exception + */ + @Override + public Map selectNoteTrnsmitDetail(NoteTrnsmit noteTrnsmit) throws Exception { + return dao.selectNoteTrnsmitDetail(noteTrnsmit); + } + + /** + * 보낸쪽지함관리를(을) 삭제한다. + * @param noteTrnsmit -보낸쪽지함관리 정보가 담긴 객체 + * @throws Exception + */ + @Override + public void deleteNoteTrnsmit(NoteTrnsmit noteTrnsmit) throws Exception { + + //보낸쪽지함 건수를 조회함 + int nCnt = dao.selectTrnsmitRelationCnt(noteTrnsmit); + + if(nCnt == 0){ + //받은쪽지/쪽지관리 삭제 처리 + dao.deleteNoteTrnsmitRelation(noteTrnsmit); + //쪽지정보를 삭제한다. + dao.deleteNoteManage(noteTrnsmit); + }else{ + dao.deleteNoteTrnsmit(noteTrnsmit); + } + } + + /** + * 보낸쪽지함관리를(을) 삭제한다. + * @param noteTrnsmit -보낸쪽지함관리 정보가 담긴 객체 + * @throws Exception + */ + @Override + public void deleteNoteRecptn(NoteTrnsmit noteTrnsmit) throws Exception { + + dao.deleteNoteRecptn(noteTrnsmit); + } + + + /** + * 수신자목록을 조회한다. + * @param noteTrnsmit -보낸쪽지함관리 정보가 담긴 객체 + * @return List -조회목록이담긴List + * @throws Exception + */ + @Override + public List selectNoteTrnsmitCnfirm(NoteTrnsmit noteTrnsmit) throws Exception { + return dao.selectNoteTrnsmitCnfirm(noteTrnsmit); + } +} diff --git a/src/main/java/egovframework/com/uss/ion/nts/service/impl/NoteTrnsmitDao.java b/src/main/java/egovframework/com/uss/ion/nts/service/impl/NoteTrnsmitDao.java new file mode 100644 index 0000000..7de234b --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/nts/service/impl/NoteTrnsmitDao.java @@ -0,0 +1,114 @@ +package egovframework.com.uss.ion.nts.service.impl; + +import java.util.List; +import java.util.Map; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.ion.nts.service.NoteTrnsmit; + +import org.springframework.stereotype.Repository; +/** + * 보낸쪽지함관리를 처리하는 Dao Class 구현 + * @author 공통콤포넌트 장동한 + * @since 2010.06.16 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + *   2017.09.14	 장동한 		   표준프레임워크 3.7 개선
    + *
    + * 
    + */ +@Repository("noteTrnsmitDao") +public class NoteTrnsmitDao extends EgovComAbstractDAO { + + /** + * 보낸쪽지함관리를(을) 목록을 한다. + * @param noteTrnsmit -조회할 정보가 담긴 객체 + * @return List -조회한목록이담긴List + * @throws Exception + */ + public List selectNoteTrnsmitList(NoteTrnsmit noteTrnsmit) throws Exception { + return list("NoteTrnsmit.selectNoteTrnsmit", noteTrnsmit); + } + + /** + * 보낸쪽지함관리를(을) 목록 전체 건수를(을) 조회한다. + * @param noteTrnsmit -조회할 정보가 담긴 객체 + * @return int -조회한건수가담긴Integer + * @throws Exception + */ + public int selectNoteTrnsmitListCnt(NoteTrnsmit noteTrnsmit) throws Exception { + return (Integer)selectOne("NoteTrnsmit.selectNoteTrnsmitCnt", noteTrnsmit); + } + + /** + * 보낸쪽지함관리를(을) 상세조회 한다. + * @param noteTrnsmit -보낸쪽지함관리 정보가 담김 객체 + * @return Map -조회한정보가담긴Map + * @throws Exception + */ + public Map selectNoteTrnsmitDetail(NoteTrnsmit noteTrnsmit) throws Exception { + return (Map)selectOne("NoteTrnsmit.selectNoteTrnsmitDetail", noteTrnsmit); + } + + /** + * 보낸쪽지함관리를(을) 삭제한다. + * @param noteTrnsmit -보낸쪽지함관리 정보가 담김 객체 + * @throws Exception + */ + public void deleteNoteTrnsmit(NoteTrnsmit noteTrnsmit) throws Exception { + delete("NoteTrnsmit.deleteNoteTrnsmit" , noteTrnsmit); + } + + /** + * 받은쪽지함를(을) 삭제한다. + * @param noteTrnsmit -보낸쪽지함관리 정보가 담김 객체 + * @throws Exception + */ + public void deleteNoteRecptn(NoteTrnsmit noteTrnsmit) throws Exception { + delete("NoteTrnsmit.deleteNoteRecptn" , noteTrnsmit); + } + + /** + * 쪽지를(을) 삭제한다. + * @param noteTrnsmit -보낸쪽지함관리 정보가 담김 객체 + * @throws Exception + */ + public void deleteNoteManage(NoteTrnsmit noteTrnsmit) throws Exception { + delete("NoteTrnsmit.deleteNoteManage" , noteTrnsmit); + } + + /** + * 쪽지관리/보낸족지함삭제 + * @param noteTrnsmit -보낸쪽지함관리 정보가 담김 객체 + * @throws Exception + */ + public void deleteNoteTrnsmitRelation(NoteTrnsmit noteTrnsmit) throws Exception { + delete("NoteTrnsmit.deleteNoteTrnsmitRelation" , noteTrnsmit); + } + + /** + * 받은편지함 건수를 조회한다. + * @param noteTrnsmit -보낸쪽지함관리 정보가 담김 객체 + * @return int -조회한건수가담긴Integer + * @throws Exception + */ + public int selectTrnsmitRelationCnt(NoteTrnsmit noteTrnsmit) throws Exception { + return (Integer)selectOne("NoteTrnsmit.selectTrnsmitRelationCnt", noteTrnsmit); + } + + + /** + * 수신자목록을 조회한다. + * @param noteTrnsmit -보낸쪽지함관리 정보가 담김 객체 + * @return List -조회한목록이담긴List + * @throws Exception + */ + public List selectNoteTrnsmitCnfirm(NoteTrnsmit noteTrnsmit) throws Exception { + return list("NoteTrnsmit.selectNoteTrnsmitCnfirm", noteTrnsmit); + } +} diff --git a/src/main/java/egovframework/com/uss/ion/nts/web/EgovNoteTrnsmitController.java b/src/main/java/egovframework/com/uss/ion/nts/web/EgovNoteTrnsmitController.java new file mode 100644 index 0000000..ded5a1e --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/nts/web/EgovNoteTrnsmitController.java @@ -0,0 +1,243 @@ +package egovframework.com.uss.ion.nts.web; + +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +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 egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.ion.nts.service.EgovNoteTrnsmitService; +import egovframework.com.uss.ion.nts.service.NoteTrnsmit; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +/** + * 보낸쪽지함관리를 처리하는 Controller Class 구현 + * @author 공통서비스 장동한 + * @since 2010.06.16 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2010.06.16  장동한          최초 생성
    + *    2011.8.26	정진오			IncludedInfo annotation 추가
    + *
    + * 
    + */ + +@Controller +public class EgovNoteTrnsmitController { + + @Autowired + private DefaultBeanValidator beanValidator; + + /** EgovMessageSource */ + @Resource(name = "egovMessageSource") + EgovMessageSource egovMessageSource; + + /** egovOnlinePollService */ + @Resource(name = "egovNoteTrnsmitService") + private EgovNoteTrnsmitService egovNoteTrnsmitService; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovNoteTrnsmitController.class); + + /** + * 보낸쪽지함관리 목록을 조회한다. + * @param searchVO -검색정보가 담긴 객체 + * @param commandMap -Request Variable + * @param noteTrnsmit -보낸쪽지함정보가 담긴객체 + * @param model -Spring 제공하는 ModelMap + * @return String -리턴 URL + * @throws Exception + */ + @IncludedInfo(name="보낸쪽지함관리", order = 860 ,gid = 50) + @RequestMapping(value = "/uss/ion/nts/listNoteTrnsmit.do") + public String EgovNoteTrnsmitList( + @ModelAttribute("searchVO") NoteTrnsmit searchVO, + @ModelAttribute("userMap") @RequestParam Map commandMap, + @ModelAttribute("noteTrnsmit") NoteTrnsmit noteTrnsmit, + ModelMap model) throws Exception { + + //변수 설정 + String sCmd = commandMap.get("cmd") == null ? "" : (String) commandMap.get("cmd"); + + + System.out.println("userMap>"+commandMap); + + //Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + //로그인 객체 선언 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + //삭제 모드로 실행시 + if(sCmd.equals("del")){ + //한개의 값으로 삭제가 넘어올때 처리 + if(commandMap.get("checkList") instanceof String){ + String sCheckList = (String)commandMap.get("checkList"); + + String[] sArrCheckListValue = sCheckList.split(","); + + LOGGER.debug("==================================EgovNoteTrnsmitList"); + LOGGER.debug("checkList {}", sCheckList); + LOGGER.debug("sArrCheckListValue[0] > {}", sArrCheckListValue[0]); + LOGGER.debug("sArrCheckListValue[1] > {}", sArrCheckListValue[1]); + + noteTrnsmit.setFrstRegisterId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + noteTrnsmit.setLastUpdusrId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + noteTrnsmit.setNoteId(sArrCheckListValue[0]); + noteTrnsmit.setNoteTrnsmitId(sArrCheckListValue[1]); + + egovNoteTrnsmitService.deleteNoteTrnsmit(noteTrnsmit); + + } + + //여러개의 값으로 삭제가 넘어올때 처리 + if(commandMap.get("checkList") instanceof String[]){ + String[] sArrCheckList = (String[])commandMap.get("checkList"); + LOGGER.debug("sArrCheckList {}", (Object)sArrCheckList); + + for(int i=0;i reusltList = egovNoteTrnsmitService.selectNoteTrnsmitList(searchVO); + model.addAttribute("resultList", reusltList); + + model.addAttribute("searchKeyword", commandMap.get("searchKeyword") == null ? "" : (String) commandMap.get("searchKeyword")); + model.addAttribute("searchCondition", commandMap.get("searchCondition") == null ? "" : (String) commandMap.get("searchCondition")); + + int totCnt = egovNoteTrnsmitService.selectNoteTrnsmitListCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + + return "egovframework/com/uss/ion/nts/EgovNoteTrnsmitList"; + + } + + /** + * 보낸쪽지함관리 목록을 상세조회 조회한다. + * @param searchVO -검색정보가 담긴 객체 + * @param commandMap -Request Variable + * @param model -Spring 제공하는 ModelMap + * @return String -리턴 URL + * @throws Exception + */ + @RequestMapping(value = "/uss/ion/nts/detailNoteTrnsmit.do") + public String EgovNoteTrnsmitDetail( + @ModelAttribute("searchVO") NoteTrnsmit searchVO, + @RequestParam Map commandMap, + ModelMap model) throws Exception { + + String sLocationUrl = "egovframework/com/uss/ion/nts/EgovNoteTrnsmitDetail"; + + String sCmd = commandMap.get("cmd") == null ? "" : (String) commandMap.get("cmd"); + + //Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + //로그인 객체 선언 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + if(sCmd.equals("del")){ + searchVO.setFrstRegisterId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + searchVO.setLastUpdusrId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + //log.debug("EgovNoteTrnsmitDetail searchVO>"+searchVO); + egovNoteTrnsmitService.deleteNoteTrnsmit(searchVO); + + sLocationUrl = "redirect:/uss/ion/nts/listNoteTrnsmit.do"; + }else{ + Map noteTrnsmitMap = egovNoteTrnsmitService.selectNoteTrnsmitDetail(searchVO); + model.addAttribute("noteTrnsmit", noteTrnsmitMap); + + List resultRecptnEmp = egovNoteTrnsmitService.selectNoteTrnsmitCnfirm(searchVO); + model.addAttribute("resultRecptnEmp", resultRecptnEmp); + } + + return sLocationUrl; + } + + /** + * 수신자목록을 조회한다. + * @param noteTrnsmit -보낸쪽지함 정보가 담긴 객체 + * @param commandMap -Request Variable + * @param model -Spring 제공하는 ModelMap + * @return String -리턴 URL + * @throws Exception + */ + @RequestMapping(value = "/uss/ion/nts/selectNoteTrnsmitCnfirm.do") + public String EgovNoteTrnsmitCnfirm( + NoteTrnsmit noteTrnsmit, + @RequestParam Map commandMap, + ModelMap model) throws Exception { + + String sCmd = commandMap.get("cmd") == null ? "" : (String) commandMap.get("cmd"); + + if(sCmd.equals("del")){ + egovNoteTrnsmitService.deleteNoteRecptn(noteTrnsmit); + } + + List resultList = egovNoteTrnsmitService.selectNoteTrnsmitCnfirm(noteTrnsmit); + model.addAttribute("resultList", resultList); + + return "egovframework/com/uss/ion/nts/EgovNoteTrnsmitCnfirm"; + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/nws/service/EgovNewsService.java b/src/main/java/egovframework/com/uss/ion/nws/service/EgovNewsService.java new file mode 100644 index 0000000..1af0786 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/nws/service/EgovNewsService.java @@ -0,0 +1,21 @@ +package egovframework.com.uss.ion.nws.service; + +import java.util.List; + +import org.egovframe.rte.fdl.cmmn.exception.FdlException; + +public interface EgovNewsService { + + List selectNewsList(NewsVO searchVO); + + int selectNewsListCnt(NewsVO searchVO); + + void insertNews(NewsVO newsVO) throws FdlException; + + NewsVO selectNewsDetail(NewsVO newsVO) throws Exception; + + void updateNews(NewsVO newsVO); + + void deleteNews(NewsVO newsVO); + +} diff --git a/src/main/java/egovframework/com/uss/ion/nws/service/NewsDefaultVO.java b/src/main/java/egovframework/com/uss/ion/nws/service/NewsDefaultVO.java new file mode 100644 index 0000000..5ae488a --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/nws/service/NewsDefaultVO.java @@ -0,0 +1,198 @@ +package egovframework.com.uss.ion.nws.service; + +import java.io.Serializable; + +/** + * + * 뉴스정보를 처리하는 DefaultVO 클래스 + * @author 공통서비스 개발팀 박정규 + * @since 2009.04.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.01  박정규          최초 생성
    + *
    + * 
    + */ +public class NewsDefaultVO implements Serializable { + + private static final long serialVersionUID = -6388824544053968776L; + + /** 검색조건 */ + private String searchCondition = ""; + + /** 검색Keyword */ + private String searchKeyword = ""; + + /** 검색사용여부 */ + private String searchUseYn = ""; + + /** 현재페이지 */ + private int pageIndex = 1; + + /** 페이지갯수 */ + private int pageUnit = 10; + + /** 페이지사이즈 */ + private int pageSize = 10; + + /** firstIndex */ + private int firstIndex = 1; + + /** lastIndex */ + private int lastIndex = 1; + + /** recordCountPerPage */ + private int recordCountPerPage = 10; + + /** + * searchCondition attribute 를 리턴한다. + * @return the String + */ + public String getSearchCondition() { + return searchCondition; + } + + /** + * searchCondition attribute 값을 설정한다. + * @return searchCondition String + */ + public void setSearchCondition(String searchCondition) { + this.searchCondition = searchCondition; + } + + /** + * searchKeyword attribute 를 리턴한다. + * @return the String + */ + public String getSearchKeyword() { + return searchKeyword; + } + + /** + * searchKeyword attribute 값을 설정한다. + * @return searchKeyword String + */ + public void setSearchKeyword(String searchKeyword) { + this.searchKeyword = searchKeyword; + } + + /** + * searchUseYn attribute 를 리턴한다. + * @return the String + */ + public String getSearchUseYn() { + return searchUseYn; + } + + /** + * searchUseYn attribute 값을 설정한다. + * @return searchUseYn String + */ + public void setSearchUseYn(String searchUseYn) { + this.searchUseYn = searchUseYn; + } + + /** + * pageIndex attribute 를 리턴한다. + * @return the int + */ + public int getPageIndex() { + return pageIndex; + } + + /** + * pageIndex attribute 값을 설정한다. + * @return pageIndex int + */ + public void setPageIndex(int pageIndex) { + this.pageIndex = pageIndex; + } + + /** + * pageUnit attribute 를 리턴한다. + * @return the int + */ + public int getPageUnit() { + return pageUnit; + } + + /** + * pageUnit attribute 값을 설정한다. + * @return pageUnit int + */ + public void setPageUnit(int pageUnit) { + this.pageUnit = pageUnit; + } + + /** + * pageSize attribute 를 리턴한다. + * @return the int + */ + public int getPageSize() { + return pageSize; + } + + /** + * pageSize attribute 값을 설정한다. + * @return pageSize int + */ + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + /** + * firstIndex attribute 를 리턴한다. + * @return the int + */ + public int getFirstIndex() { + return firstIndex; + } + + /** + * firstIndex attribute 값을 설정한다. + * @return firstIndex int + */ + public void setFirstIndex(int firstIndex) { + this.firstIndex = firstIndex; + } + + /** + * lastIndex attribute 를 리턴한다. + * @return the int + */ + public int getLastIndex() { + return lastIndex; + } + + /** + * lastIndex attribute 값을 설정한다. + * @return lastIndex int + */ + public void setLastIndex(int lastIndex) { + this.lastIndex = lastIndex; + } + + /** + * recordCountPerPage attribute 를 리턴한다. + * @return the int + */ + public int getRecordCountPerPage() { + return recordCountPerPage; + } + + /** + * recordCountPerPage attribute 값을 설정한다. + * @return recordCountPerPage int + */ + public void setRecordCountPerPage(int recordCountPerPage) { + this.recordCountPerPage = recordCountPerPage; + } + + +} diff --git a/src/main/java/egovframework/com/uss/ion/nws/service/NewsVO.java b/src/main/java/egovframework/com/uss/ion/nws/service/NewsVO.java new file mode 100644 index 0000000..68b60ab --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/nws/service/NewsVO.java @@ -0,0 +1,215 @@ +package egovframework.com.uss.ion.nws.service; + +/** + * + * 뉴스정보를 처리하는 VO 클래스 + * @author 공통서비스 개발팀 박정규 + * @since 2009.04.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.01  박정규          최초 생성
    + *
    + * 
    + */ +public class NewsVO extends NewsDefaultVO { + + private static final long serialVersionUID = 1L; + + /** 뉴스 ID */ + private String newsId; + + /** 뉴스제목 */ + private String newsSj; + + /** 뉴스내용 */ + private String newsCn; + + /** 뉴스출처 */ + private String newsOrigin; + + /** 게시일자 */ + private String ntceDe; + + /** 첨부파일ID */ + private String atchFileId; + + /** 최초등록시점 */ + private String frstRegisterPnttm; + + /** 최초등록자ID */ + private String frstRegisterId; + + /** 최종수정시점 */ + private String lastUpdusrPnttm; + + /** 최종수정자ID */ + private String lastUpdusrId; + + /** + * newsId attribute 를 리턴한다. + * @return the String + */ + public String getNewsId() { + return newsId; + } + + /** + * newsId attribute 값을 설정한다. + * @return newsId String + */ + public void setNewsId(String newsId) { + this.newsId = newsId; + } + + /** + * newsSj attribute 를 리턴한다. + * @return the String + */ + public String getNewsSj() { + return newsSj; + } + + /** + * newsSj attribute 값을 설정한다. + * @return newsSj String + */ + public void setNewsSj(String newsSj) { + this.newsSj = newsSj; + } + + /** + * newsCn attribute 를 리턴한다. + * @return the String + */ + public String getNewsCn() { + return newsCn; + } + + /** + * newsCn attribute 값을 설정한다. + * @return newsCn String + */ + public void setNewsCn(String newsCn) { + this.newsCn = newsCn; + } + + /** + * newsOrigin attribute 를 리턴한다. + * @return the String + */ + public String getNewsOrigin() { + return newsOrigin; + } + + /** + * newsOrigin attribute 값을 설정한다. + * @return newsOrigin String + */ + public void setNewsOrigin(String newsOrigin) { + this.newsOrigin = newsOrigin; + } + + /** + * ntceDe attribute 를 리턴한다. + * @return the String + */ + public String getNtceDe() { + return ntceDe; + } + + /** + * ntceDe attribute 값을 설정한다. + * @return ntceDe String + */ + public void setNtceDe(String ntceDe) { + this.ntceDe = ntceDe; + } + + /** + * atchFileId attribute 를 리턴한다. + * @return the String + */ + public String getAtchFileId() { + return atchFileId; + } + + /** + * atchFileId attribute 값을 설정한다. + * @return atchFileId String + */ + public void setAtchFileId(String atchFileId) { + this.atchFileId = atchFileId; + } + + /** + * frstRegisterPnttm attribute 를 리턴한다. + * @return the String + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * frstRegisterPnttm attribute 값을 설정한다. + * @return frstRegisterPnttm String + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * frstRegisterId attribute 를 리턴한다. + * @return the String + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * frstRegisterId attribute 값을 설정한다. + * @return frstRegisterId String + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * lastUpdusrPnttm attribute 를 리턴한다. + * @return the String + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * lastUpdusrPnttm attribute 값을 설정한다. + * @return lastUpdusrPnttm String + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * lastUpdusrId attribute 를 리턴한다. + * @return the String + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * lastUpdusrId attribute 값을 설정한다. + * @return lastUpdusrId String + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + +} diff --git a/src/main/java/egovframework/com/uss/ion/nws/service/impl/EgovNewsDAO.java b/src/main/java/egovframework/com/uss/ion/nws/service/impl/EgovNewsDAO.java new file mode 100644 index 0000000..029359f --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/nws/service/impl/EgovNewsDAO.java @@ -0,0 +1,37 @@ +package egovframework.com.uss.ion.nws.service.impl; + +import java.util.List; + +import org.springframework.stereotype.Repository; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.ion.nws.service.NewsVO; + +@Repository("EgovNewsDAO") +public class EgovNewsDAO extends EgovComAbstractDAO { + + public List selectNewsList(NewsVO searchVO) { + return list("NewsManage.selectNewsList", searchVO); + } + + public int selectNewsListCnt(NewsVO searchVO) { + return (Integer) selectOne("NewsManage.selectNewsListCnt", searchVO); + } + + public void insertNews(NewsVO newsVO) { + insert("NewsManage.insertNews", newsVO); + } + + public NewsVO selectNewsDetail(NewsVO newsVO) { + return (NewsVO) selectOne("NewsManage.selectNewsDetail", newsVO); + } + + public void updateNews(NewsVO newsVO) { + update("NewsManage.updateNews", newsVO); + } + + public void deleteNews(NewsVO newsVO) { + delete("NewsManage.deleteNews", newsVO); + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/nws/service/impl/EgovNewsServiceImpl.java b/src/main/java/egovframework/com/uss/ion/nws/service/impl/EgovNewsServiceImpl.java new file mode 100644 index 0000000..58339c3 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/nws/service/impl/EgovNewsServiceImpl.java @@ -0,0 +1,61 @@ +package egovframework.com.uss.ion.nws.service.impl; + +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import egovframework.com.uss.ion.nws.service.EgovNewsService; +import egovframework.com.uss.ion.nws.service.NewsVO; +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.cmmn.exception.FdlException; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +@Service("EgovNewsService") +public class EgovNewsServiceImpl extends EgovAbstractServiceImpl implements EgovNewsService { + + @Resource(name="EgovNewsDAO") + private EgovNewsDAO egovNewsDao; + + /** ID Generation */ + @Resource(name="egovNewsManageIdGnrService") + private EgovIdGnrService idgenService; + + @Override + public List selectNewsList(NewsVO searchVO) { + return egovNewsDao.selectNewsList(searchVO); + } + + @Override + public int selectNewsListCnt(NewsVO searchVO) { + return egovNewsDao.selectNewsListCnt(searchVO); + } + + @Override + public void insertNews(NewsVO newsVO) throws FdlException { + String newsId = idgenService.getNextStringId(); + newsVO.setNewsId(newsId); + + egovNewsDao.insertNews(newsVO); + } + + @Override + public NewsVO selectNewsDetail(NewsVO newsVO) throws Exception { + NewsVO resultVO = egovNewsDao.selectNewsDetail(newsVO); + if (resultVO == null) + throw processException("info.nodata.msg"); + return resultVO; + } + + @Override + public void updateNews(NewsVO newsVO) { + egovNewsDao.updateNews(newsVO); + } + + @Override + public void deleteNews(NewsVO newsVO) { + egovNewsDao.deleteNews(newsVO); + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/nws/web/EgovNewsController.java b/src/main/java/egovframework/com/uss/ion/nws/web/EgovNewsController.java new file mode 100644 index 0000000..c611158 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/nws/web/EgovNewsController.java @@ -0,0 +1,275 @@ +package egovframework.com.uss.ion.nws.web; + +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +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.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.service.EgovFileMngService; +import egovframework.com.cmm.service.EgovFileMngUtil; +import egovframework.com.cmm.service.FileVO; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.ion.nws.service.EgovNewsService; +import egovframework.com.uss.ion.nws.service.NewsVO; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +@Controller +public class EgovNewsController { + + @Resource(name = "EgovNewsService") + private EgovNewsService egovNewsService; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + // 첨부파일 관련 + @Resource(name="EgovFileMngService") + private EgovFileMngService fileMngService; + + @Resource(name="EgovFileMngUtil") + private EgovFileMngUtil fileUtil; + + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + // Validation 관련 + @Autowired + private DefaultBeanValidator beanValidator; + + /** + * 뉴스정보 목록을 조회한다. + * @param searchVO + * @param model + * @return "/uss/ion/nws/EgovNewsList" + * @throws Exception + */ + @IncludedInfo(name="뉴스관리",order = 670 ,gid = 50) + @RequestMapping(value="/uss/ion/nws/selectNewsList.do") + public String selectNewsList(@ModelAttribute("searchVO") NewsVO searchVO, ModelMap model) throws Exception { + + /** EgovPropertyService.SiteList */ + 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()); + + List NewsList = egovNewsService.selectNewsList(searchVO); + model.addAttribute("resultList", NewsList); + + int totCnt = egovNewsService.selectNewsListCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/uss/ion/nws/EgovNewsList"; + } + + /** + * 뉴스정보 목록에 대한 상세정보를 조회한다. + * @param newsVO + * @param searchVO + * @param model + * @return "/uss/ion/nws/EgovNewsDetail" + * @throws Exception + */ + @RequestMapping("/uss/ion/nws/selectNewsDetail.do") + public String selectNewsDetail(NewsVO newsVO, + @ModelAttribute("searchVO") NewsVO searchVO, + ModelMap model) throws Exception { + + NewsVO vo = egovNewsService.selectNewsDetail(newsVO); + + model.addAttribute("result", vo); + + return "egovframework/com/uss/ion/nws/EgovNewsDetail"; + } + + /** + * 뉴스정보를 등록 전 단계처리 + * @param searchVO + * @param model + * @return "/uss/ion/nws/EgovNewsRegist" + * @throws Exception + */ + @RequestMapping("/uss/ion/nws/insertNewsView.do") + public String insertNewsView(@ModelAttribute("searchVO") NewsVO searchVO, Model model) throws Exception { + + model.addAttribute("newsVO", new NewsVO()); + + return "egovframework/com/uss/ion/nws/EgovNewsRegist"; + + } + + /** + * 뉴스정보를 등록한다. + * @param multiRequest + * @param searchVO + * @param newsVO + * @param bindingResult + * @return "forward:/uss/ion/nws/selectNewsList.do" + * @throws Exception + */ + @RequestMapping("/uss/ion/nws/insertNews.do") + public String insertNews(final MultipartHttpServletRequest multiRequest, @ModelAttribute("searchVO") NewsVO searchVO, + @ModelAttribute("newsVO") NewsVO newsVO, BindingResult bindingResult) throws Exception { + + + // 첨부파일 관련 첨부파일ID 생성 + List _result = null; + String _atchFileId = ""; + + //final Map files = multiRequest.getFileMap(); + final List files = multiRequest.getFiles("file_1"); + + if(!files.isEmpty()){ + _result = fileUtil.parseFileInf(files, "NEWS_", 0, "", ""); + _atchFileId = fileMngService.insertFileInfs(_result); //파일이 생성되고나면 생성된 첨부파일 ID를 리턴한다. + } + + // 리턴받은 첨부파일ID를 셋팅한다.. + newsVO.setAtchFileId(_atchFileId); // 첨부파일 ID + + beanValidator.validate(newsVO, bindingResult); + + if(bindingResult.hasErrors()){ + + return "egovframework/com/uss/ion/nws/EgovNewsRegist"; + + } + + // 로그인VO에서 사용자 정보 가져오기 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + String frstRegisterId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId()); + + newsVO.setFrstRegisterId(frstRegisterId); // 최초등록자ID + newsVO.setLastUpdusrId(frstRegisterId); // 최종수정자ID + + egovNewsService.insertNews(newsVO); + + return "forward:/uss/ion/nws/selectNewsList.do"; + } + + /** + * 뉴스정보를 수정하기 전 단계처리 + * @param newsId + * @param searchVO + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/uss/ion/nws/updateNewsView.do") + public String updateNewsView(@RequestParam("newsId") String newsId , + @ModelAttribute("searchVO") NewsVO searchVO, ModelMap model) + throws Exception { + + + NewsVO newsVO = new NewsVO(); + + // Primary Key 값 세팅 + newsVO.setNewsId(newsId); + model.addAttribute("newsVO", egovNewsService.selectNewsDetail(newsVO)); + + + return "egovframework/com/uss/ion/nws/EgovNewsUpdt"; + } + + /** + * 뉴스정보를 수정 처리한다 + * @param atchFileAt + * @param multiRequest + * @param searchVO + * @param newsVO + * @param bindingResult + * @param model + * @return "forward:/uss/ion/nws/NewsInfoListInqire.do" + * @throws Exception + */ + @RequestMapping("/uss/ion/nws/updateNews.do") + public String updateNewsInfo(final MultipartHttpServletRequest multiRequest, @ModelAttribute("searchVO") NewsVO searchVO, + @ModelAttribute("newsVO") NewsVO newsVO, BindingResult bindingResult, ModelMap model) throws Exception { + + // Validation + beanValidator.validate(newsVO, bindingResult); + if(bindingResult.hasErrors()){ + return "egovframework/com/uss/olh/nws/EgovNewsInfoUpdt"; + } + + + // 첨부파일 관련 ID 생성 start.... + String _atchFileId = newsVO.getAtchFileId(); + + //final Map files = multiRequest.getFileMap(); + final List files = multiRequest.getFiles("file_1"); + + if(!files.isEmpty()){ + if("".equals(_atchFileId)){ + List _result = fileUtil.parseFileInf(files, "NEWS_", 0, _atchFileId, ""); + _atchFileId = fileMngService.insertFileInfs(_result); + newsVO.setAtchFileId(_atchFileId); // 첨부파일 ID + + }else{ + FileVO fvo = new FileVO(); + fvo.setAtchFileId(_atchFileId); + int _cnt = fileMngService.getMaxFileSN(fvo); + List _result = fileUtil.parseFileInf(files, "NEWS_", _cnt, _atchFileId, ""); + fileMngService.updateFileInfs(_result); + } + } + // 첨부파일 관련 ID 생성 end... + + + // 로그인VO에서 사용자 정보 가져오기 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + String lastUpdusrId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId()); + newsVO.setLastUpdusrId(lastUpdusrId); // 최종수정자ID + + egovNewsService.updateNews(newsVO); + + return "forward:/uss/ion/nws/selectNewsList.do"; + + } + + /** + * 뉴스정보를 삭제한다. + * @param newsVO + * @param searchVO + * @return + * @throws Exception + */ + @RequestMapping("/uss/ion/nws/deleteNews.do") + public String deleteNews(NewsVO newsVO, @ModelAttribute("searchVO") NewsVO searchVO) throws Exception { + + egovNewsService.deleteNews(newsVO); + + return "forward:/uss/ion/nws/selectNewsList.do"; + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/pwm/service/EgovPopupManageService.java b/src/main/java/egovframework/com/uss/ion/pwm/service/EgovPopupManageService.java new file mode 100644 index 0000000..39af310 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/pwm/service/EgovPopupManageService.java @@ -0,0 +1,90 @@ +package egovframework.com.uss.ion.pwm.service; + +import java.util.List; + +/** + * 개요 + * - 팝업창에 대한 Service Interface를 정의한다. + * + * 상세내용 + * - 팝업창에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 팝업창의 조회기능은 목록조회, 상세조회, 팝업사용자 보기로 구분된다. + * @author 이창원 + * @version 1.0 + * @created 05-8-2009 오후 2:19:58 + */ +public interface EgovPopupManageService { + + /** + * 기 등록된 팝업창정보를 삭제한다. + * @param popupManage - 팝업창 model + * @return boolean - 반영성공 여부 + * + * @param popupManage + */ + public void deletePopup(PopupManageVO popupManageVO) throws Exception; + + /** + * 팝업창정보를 신규로 등록한다. + * @param popupManage - 팝업창 model + * @return boolean - 반영성공 여부 + * + * @param popupManage + */ + public void insertPopup(PopupManageVO popupManageVO) throws Exception; + + /** + * 기 등록된 팝업창정보를 수정한다. + * @param popupManage - 팝업창 model + * @return boolean - 반영성공 여부 + * + * @param popupManage + */ + public void updatePopup(PopupManageVO popupManageVO) throws Exception; + + /** + * 팝업창을 사용자 화면에서 볼수 있는 정보들을 조회한다. + * @param popupManageVO - 팝업창 Vo + * @return popupManageVO - 팝업창 Vo + * + * @param popupManageVO + */ + public PopupManageVO selectPopup(PopupManageVO popupManageVO) throws Exception; + + /** + * 팝업창의 취약점을 관리하기 위해 등록된 팝업창 화이트리스트를 조회한다. + * @param popupManageVO - 팝업창 Vo + * @return List - 팝업창 화이트리스트 목록 + * + * @param popupManageVO + */ + public List selectPopupWhiteList() throws Exception; + + /** + * 팝업창를 관리하기 위해 등록된 팝업창목록을 조회한다. + * @param popupManageVO - 팝업창 Vo + * @return List - 팝업창 목록 + * + * @param popupManageVO + */ + public List selectPopupList(PopupManageVO popupManageVO) throws Exception; + + /** + * 팝업창를 관리하기 위해 등록된 팝업창목록을 조회한다. + * @param popupManageVO - 팝업창 Vo + * @return List - 팝업창 목록 + * + * @param popupManageVO + */ + public int selectPopupListCount(PopupManageVO popupManageVO) throws Exception; + + /** + * 팝업창을 사용하기 위해 팝업창목록을 조회한다. + * @param popupManageVO - 팝업창 Vo + * @return List - 팝업창 목록 + * + * @param popupManageVO + */ + public List selectPopupMainList(PopupManageVO popupManageVO) throws Exception; + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/pwm/service/PopupManage.java b/src/main/java/egovframework/com/uss/ion/pwm/service/PopupManage.java new file mode 100644 index 0000000..693f52d --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/pwm/service/PopupManage.java @@ -0,0 +1,442 @@ +package egovframework.com.uss.ion.pwm.service; + +import java.io.Serializable; + +import egovframework.com.cmm.ComDefaultVO; + +/** + * 개요 + * - 팝업창에 대한 model 클래스를 정의한다. + * + * 상세내용 + * - 팝업창의 팝업창아이디, 팝업창 타이틀명, 실파일 URL, 파업창이 화면에 보여지는 위치정보, 팝업창의 사이즈, 게시시작일, 게시종료일, + * 그만보기 설정 여부, 게시여부 항목을 관리한다. + * @author 이창원 + * @version 1.0 + * @created 05-8-2009 오후 2:21:03 + */ +public class PopupManage extends ComDefaultVO implements Serializable { + + private static final long serialVersionUID = -9172690166674188881L; + /** + * 팝업창아이디 + */ + private String popupId; + /** + * 팝업창 타이틀명 + */ + private String popupTitleNm; + /** + * 실파일 URL + */ + private String fileUrl; + /** + * 팝업창이 화면에 보여지는 가로 위치정보 + */ + private String popupWlc; + + /** + * 팝업창이 화면에 보여지는 세로 위치정보 + */ + private String popupHlc; + + /** + * 팝업창의 높이 + */ + private String popupHSize; + + /** + * 팝업창의 넚이 + */ + private String popupWSize; + + /** + * 게시시작일 + */ + private String ntceBgnde; + /** + * 게시종료일 + */ + private String ntceEndde; + + /** 게시시작일(시간) */ + private String ntceBgndeHH; + + /** 게시시작일(분) */ + private String ntceBgndeMM; + + /** 게시종료일(시간) */ + private String ntceEnddeHH; + + /** 게시종료일(분) */ + private String ntceEnddeMM; + + /** + * 그만보기 설정 여부 + */ + private String stopVewAt; + /** + * 게시여부 + */ + private String ntceAt; + + /** 최초등록시점 */ + private String frstRegisterPnttm; + + /** 최초등록아이디 */ + private String frstRegisterId; + + /** 최종수정일 */ + private String lastUpdusrPnttm; + + /** 최종수정자 아이디 */ + private String lastUpdusrId; + + public PopupManage(){} + + /** + * popupId 리턴 + * + * @return the popupId + */ + public String getPopupId() { + return popupId; + } + + /** + * popupId 설정 + * + * @param popupId the popupId to set + */ + public void setPopupId(String popupId) { + this.popupId = popupId; + } + + /** + * popupTitleNm 리턴 + * + * @return the popupTitleNm + */ + public String getPopupTitleNm() { + return popupTitleNm; + } + + /** + * popupTitleNm 설정 + * + * @param popupTitleNm the popupTitleNm to set + */ + public void setPopupTitleNm(String popupTitleNm) { + this.popupTitleNm = popupTitleNm; + } + + /** + * fileUrl 리턴 + * + * @return the fileUrl + */ + public String getFileUrl() { + return fileUrl; + } + + /** + * fileUrl 설정 + * + * @param fileUrl the fileUrl to set + */ + public void setFileUrl(String fileUrl) { + this.fileUrl = fileUrl; + } + + /** + * popupWlc 리턴 + * + * @return the popupWlc + */ + public String getPopupWlc() { + return popupWlc; + } + + /** + * popupWlc 설정 + * + * @param popupWlc the popupWlc to set + */ + public void setPopupWlc(String popupWlc) { + this.popupWlc = popupWlc; + } + + /** + * popupHlc 리턴 + * + * @return the popupHlc + */ + public String getPopupHlc() { + return popupHlc; + } + + /** + * popupHlc 설정 + * + * @param popupHlc the popupHlc to set + */ + public void setPopupHlc(String popupHlc) { + this.popupHlc = popupHlc; + } + + /** + * popupHSize 리턴 + * + * @return the popupHSize + */ + public String getPopupHSize() { + return popupHSize; + } + + /** + * popupHSize 설정 + * + * @param popupHSize the popupHSize to set + */ + public void setPopupHSize(String popupHSize) { + this.popupHSize = popupHSize; + } + + /** + * popupWSize 리턴 + * + * @return the popupWSize + */ + public String getPopupWSize() { + return popupWSize; + } + + /** + * popupWSize 설정 + * + * @param popupWSize the popupWSize to set + */ + public void setPopupWSize(String popupWSize) { + this.popupWSize = popupWSize; + } + + /** + * ntceBgnde 리턴 + * + * @return the ntceBgnde + */ + public String getNtceBgnde() { + return ntceBgnde; + } + + /** + * ntceBgnde 설정 + * + * @param ntceBgnde the ntceBgnde to set + */ + public void setNtceBgnde(String ntceBgnde) { + this.ntceBgnde = ntceBgnde; + } + + /** + * ntceEndde 리턴 + * + * @return the ntceEndde + */ + public String getNtceEndde() { + return ntceEndde; + } + + /** + * ntceEndde 설정 + * + * @param ntceEndde the ntceEndde to set + */ + public void setNtceEndde(String ntceEndde) { + this.ntceEndde = ntceEndde; + } + + /** + * ntceBgndeHH 리턴 + * + * @return the ntceBgndeHH + */ + public String getNtceBgndeHH() { + return ntceBgndeHH; + } + + /** + * ntceBgndeHH 설정 + * + * @param ntceBgndeHH the ntceBgndeHH to set + */ + public void setNtceBgndeHH(String ntceBgndeHH) { + this.ntceBgndeHH = ntceBgndeHH; + } + + /** + * ntceBgndeMM 리턴 + * + * @return the ntceBgndeMM + */ + public String getNtceBgndeMM() { + return ntceBgndeMM; + } + + /** + * ntceBgndeMM 설정 + * + * @param ntceBgndeMM the ntceBgndeMM to set + */ + public void setNtceBgndeMM(String ntceBgndeMM) { + this.ntceBgndeMM = ntceBgndeMM; + } + + /** + * ntceEnddeHH 리턴 + * + * @return the ntceEnddeHH + */ + public String getNtceEnddeHH() { + return ntceEnddeHH; + } + + /** + * ntceEnddeHH 설정 + * + * @param ntceEnddeHH the ntceEnddeHH to set + */ + public void setNtceEnddeHH(String ntceEnddeHH) { + this.ntceEnddeHH = ntceEnddeHH; + } + + /** + * ntceEnddeMM 리턴 + * + * @return the ntceEnddeMM + */ + public String getNtceEnddeMM() { + return ntceEnddeMM; + } + + /** + * ntceEnddeMM 설정 + * + * @param ntceEnddeMM the ntceEnddeMM to set + */ + public void setNtceEnddeMM(String ntceEnddeMM) { + this.ntceEnddeMM = ntceEnddeMM; + } + + /** + * stopVewAt 리턴 + * + * @return the stopVewAt + */ + public String getStopVewAt() { + return stopVewAt; + } + + /** + * stopVewAt 설정 + * + * @param stopVewAt the stopVewAt to set + */ + public void setStopVewAt(String stopVewAt) { + this.stopVewAt = stopVewAt; + } + + /** + * ntceAt 리턴 + * + * @return the ntceAt + */ + public String getNtceAt() { + return ntceAt; + } + + /** + * ntceAt 설정 + * + * @param ntceAt the ntceAt to set + */ + public void setNtceAt(String ntceAt) { + this.ntceAt = ntceAt; + } + + /** + * frstRegisterPnttm 리턴 + * + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * frstRegisterPnttm 설정 + * + * @param frstRegisterPnttm the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * frstRegisterId 리턴 + * + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * frstRegisterId 설정 + * + * @param frstRegisterId the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * lastUpdusrPnttm 리턴 + * + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * lastUpdusrPnttm 설정 + * + * @param lastUpdusrPnttm the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * lastUpdusrId 리턴 + * + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * lastUpdusrId 설정 + * + * @param lastUpdusrId the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + + + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/pwm/service/PopupManageVO.java b/src/main/java/egovframework/com/uss/ion/pwm/service/PopupManageVO.java new file mode 100644 index 0000000..7383d6c --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/pwm/service/PopupManageVO.java @@ -0,0 +1,18 @@ +package egovframework.com.uss.ion.pwm.service; +/** + * 개요 + * - 팝업창에 대한 Vo 클래스를 정의한다. + * + * 상세내용 + * - 팝업창의 목록 항목을 관리한다. + * @author 이창원 + * @version 1.0 + * @created 05-8-2009 오후 2:21:04 + */ +public class PopupManageVO extends PopupManage { + + private static final long serialVersionUID = -4822974866080666897L; + + public PopupManageVO(){} + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/pwm/service/impl/EgovPopupManageServiceImpl.java b/src/main/java/egovframework/com/uss/ion/pwm/service/impl/EgovPopupManageServiceImpl.java new file mode 100644 index 0000000..fbc4109 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/pwm/service/impl/EgovPopupManageServiceImpl.java @@ -0,0 +1,137 @@ +package egovframework.com.uss.ion.pwm.service.impl; + +import java.util.List; + +import egovframework.com.uss.ion.pwm.service.EgovPopupManageService; +import egovframework.com.uss.ion.pwm.service.PopupManageVO; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +/** + * 개요 + * - 팝업창에 대한 ServiceImpl을 정의한다. + * + * 상세내용 + * - 팝업창에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 팝업창의 조회기능은 목록조회, 상세조회로, 사용자화면 보기로 구분된다. + * @author 이창원 + * @version 1.0 + * @created 05-8-2009 오후 2:19:58 + */ + +@Service("egovPopupManageService") +public class EgovPopupManageServiceImpl extends EgovAbstractServiceImpl implements EgovPopupManageService { + + @Resource(name = "popupManageDAO") + public PopupManageDAO dao; + + @Resource(name = "egovPopupManageIdGnrService") + private EgovIdGnrService idgenService; + + public EgovPopupManageServiceImpl() { + } + + /** + * 기 등록된 팝업창정보를 삭제한다. + * @param popupManage - 팝업창 model + * @return boolean - 반영성공 여부 + * + * @param popupManage + */ + @Override + public void deletePopup(PopupManageVO popupManageVO) throws Exception { + dao.deletePopup(popupManageVO); + } + + /** + * 팝업창정보를 신규로 등록한다. + * @param popupManage - 팝업창 model + * @return boolean - 반영성공 여부 + * + * @param popupManage + */ + @Override + public void insertPopup(PopupManageVO popupManageVO) throws Exception { + String sMakeId = idgenService.getNextStringId(); + popupManageVO.setPopupId(sMakeId); + dao.insertPopup(popupManageVO); + } + + /** + * 기 등록된 팝업창정보를 수정한다. + * @param popupManage - 팝업창 model + * @return boolean - 반영성공 여부 + * + * @param popupManage + */ + @Override + public void updatePopup(PopupManageVO popupManageVO) throws Exception { + dao.updatePopup(popupManageVO); + } + + /** + * 팝업창을 사용자 화면에서 볼수 있는 정보들을 조회한다. + * @param popupManageVO - 팝업창 Vo + * @return popupManageVO - 팝업창 Vo + * + * @param popupManageVO + */ + @Override + public PopupManageVO selectPopup(PopupManageVO popupManageVO) throws Exception { + return dao.selectPopup(popupManageVO); + } + + /** + * 팝업창의 취약점을 관리하기 위해 등록된 팝업창 화이트리스트를 조회한다. + * @param popupManageVO - 팝업창 Vo + * @return List - 팝업창 목록 + * + * @param popupManageVO + */ + @Override + public List selectPopupWhiteList() throws Exception { + return dao.selectPopupWhiteList(); + } + + /** + * 팝업창를 관리하기 위해 등록된 팝업창목록을 조회한다. + * @param popupManageVO - 팝업창 Vo + * @return List - 팝업창 목록 + * + * @param popupManageVO + */ + @Override + public List selectPopupList(PopupManageVO popupManageVO) throws Exception { + return dao.selectPopupList(popupManageVO); + } + + /** + * 팝업창를 관리하기 위해 등록된 팝업창목록을 조회한다. + * @param popupManageVO - 팝업창 Vo + * @return List - 팝업창 목록 + * + * @param popupManageVO + */ + @Override + public int selectPopupListCount(PopupManageVO popupManageVO) throws Exception { + return dao.selectPopupListCount(popupManageVO); + } + + /** + * 팝업창를 사용하기위해 위해 등록된 팝업창목록을 조회한다. + * @param popupManageVO - 팝업창 Vo + * @return List - 팝업창 목록 + * + * @param popupManageVO + */ + @Override + public List selectPopupMainList(PopupManageVO popupManageVO) throws Exception { + return dao.selectPopupMainList(popupManageVO); + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/pwm/service/impl/PopupManageDAO.java b/src/main/java/egovframework/com/uss/ion/pwm/service/impl/PopupManageDAO.java new file mode 100644 index 0000000..41b4431 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/pwm/service/impl/PopupManageDAO.java @@ -0,0 +1,114 @@ +package egovframework.com.uss.ion.pwm.service.impl; +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.ion.pwm.service.PopupManageVO; + +import org.springframework.stereotype.Repository; + +/** + * 개요 + * - 팝업창에 대한 DAO를 정의한다. + * + * 상세내용 + * - 팝업창에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 팝업창의 조회기능은 목록조회, 상세조회로, 사용자화면 보기로 구분된다. + * @author 이창원 + * @version 1.0 + * @created 05-8-2009 오후 2:21:04 + */ +@Repository("popupManageDAO") +public class PopupManageDAO extends EgovComAbstractDAO { + + public PopupManageDAO(){} + + /** + * 기 등록된 팝업창정보를 삭제한다. + * @param popupManage - 팝업창 model + * @return boolean - 반영성공 여부 + * + * @param popupManage + */ + public void deletePopup(PopupManageVO popupManageVO) throws Exception { + delete("PopupManage.deletePopupManage", popupManageVO); + } + + /** + * 팝업창정보를 신규로 등록한다. + * @param popupManage - 팝업창 model + * @return boolean - 반영성공 여부 + * + * @param popupManage + */ + public void insertPopup(PopupManageVO popupManageVO) throws Exception { + insert("PopupManage.insertPopupManage", popupManageVO); + } + + /** + * 기 등록된 팝업창정보를 수정한다. + * @param popupManage - 팝업창 model + * @return boolean - 반영성공 여부 + * + * @param popupManage + */ + public void updatePopup(PopupManageVO popupManageVO) throws Exception { + update("PopupManage.updatePopupManage", popupManageVO); + } + + /** + * 팝업창을 사용자 화면에서 볼수 있는 정보들을 조회한다. + * @param popupManageVO - 팝업창 Vo + * @return popupManageVO - 팝업창 Vo + * + * @param popupManageVO + */ + public PopupManageVO selectPopup(PopupManageVO popupManageVO) throws Exception { + return (PopupManageVO)selectOne("PopupManage.selectPopupManageDetail", popupManageVO); + } + + /** + * 팝업창를 관리하기 위해 등록된 팝업창 화이트리스트를 조회한다. + * @param popupManageVO - 팝업창 Vo + * @return List - 팝업창 화이트 목록 + * + * @param popupManageVO + */ + public List selectPopupWhiteList() throws Exception { + return selectList("PopupManage.selectPopupWhiteList"); + } + + /** + * 팝업창를 관리하기 위해 등록된 팝업창목록을 조회한다. + * @param popupManageVO - 팝업창 Vo + * @return List - 팝업창 목록 + * + * @param popupManageVO + */ + public List selectPopupList(PopupManageVO popupManageVO) throws Exception { + return selectList("PopupManage.selectPopupManage", popupManageVO); + } + + /** + * 팝업창를 관리하기 위해 등록된 팝업창목록 총갯수를 조회한다. + * @param popupManageVO - 팝업창 Vo + * @return List - 팝업창 목록 + * + * @param popupManageVO + */ + public int selectPopupListCount(PopupManageVO popupManageVO) throws Exception { + return (Integer)selectOne("PopupManage.selectPopupManageCnt", popupManageVO); + } + + /** + * 팝업창를 사용하기 위해 등록된 팝업창목록을 조회한다. + * @param popupManageVO - 팝업창 Vo + * @return List - 팝업창 목록 + * + * @param popupManageVO + */ + public List selectPopupMainList(PopupManageVO popupManageVO) throws Exception { + return selectList("PopupManage.selectPopupManageMain", popupManageVO); + } + + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/pwm/web/EgovPopupManageController.java b/src/main/java/egovframework/com/uss/ion/pwm/web/EgovPopupManageController.java new file mode 100644 index 0000000..2044c87 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/pwm/web/EgovPopupManageController.java @@ -0,0 +1,424 @@ +package egovframework.com.uss.ion.pwm.web; + +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +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 egovframework.com.cmm.ComDefaultCodeVO; +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.EgovWebUtil; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.ion.pwm.service.EgovPopupManageService; +import egovframework.com.uss.ion.pwm.service.PopupManageVO; +import egovframework.com.utl.fcc.service.EgovStringUtil; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.psl.dataaccess.util.EgovMap; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +/** + * 개요 + * - 팝업창에 대한 Controller를 정의한다. + * + * 상세내용 + * - 팝업창에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 팝업창의 조회기능은 목록조회, 상세조회로, 사용자 화면 보기로 구분된다. + * @author 이창원 + * @version 1.0 + * @created 05-8-2009 오후 2:19:57 + *
    +  * << 개정이력(Modification Information) >>
    +  *
    +  *  수정일              수정자           수정내용
    +  *  ---------   --------   ---------------------------
    +  *  2009.08.05   이창원           최초 생성
    +  *  2011.08.26   정진오           IncludedInfo annotation 추가
    +  *  2019.05.17   신용호           취약점 조치 및 보완
    +  *
    +  * 
    + */ + +@Controller +public class EgovPopupManageController { + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovPopupManageController.class); + + @Autowired + private DefaultBeanValidator beanValidator; + + /** EgovMessageSource */ + @Resource(name = "egovMessageSource") + EgovMessageSource egovMessageSource; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** EgovPopupManageService */ + @Resource(name = "egovPopupManageService") + private EgovPopupManageService egovPopupManageService; + + /** + * 팝업창관리 목록을 조회한다. + * @param popupManageVO + * @param model + * @return "egovframework/com/uss/ion/pwm/listPopupManage" + * @throws Exception + */ + @IncludedInfo(name = "팝업창관리", order = 720, gid = 50) + @RequestMapping(value = "/uss/ion/pwm/listPopup.do") + public String egovPopupManageList(@RequestParam Map commandMap, PopupManageVO popupManageVO, ModelMap model) + throws Exception { + + /** EgovPropertyService.sample */ + popupManageVO.setPageUnit(propertiesService.getInt("pageUnit")); + popupManageVO.setPageSize(propertiesService.getInt("pageSize")); + + /** pageing */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(popupManageVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(popupManageVO.getPageUnit()); + paginationInfo.setPageSize(popupManageVO.getPageSize()); + + popupManageVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + popupManageVO.setLastIndex(paginationInfo.getLastRecordIndex()); + popupManageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + List reusltList = egovPopupManageService.selectPopupList(popupManageVO); + model.addAttribute("resultList", reusltList); + + model.addAttribute("searchKeyword", + commandMap.get("searchKeyword") == null ? "" : (String)commandMap.get("searchKeyword")); + model.addAttribute("searchCondition", + commandMap.get("searchCondition") == null ? "" : (String)commandMap.get("searchCondition")); + + int totCnt = egovPopupManageService.selectPopupListCount(popupManageVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/uss/ion/pwm/EgovPopupList"; + } + + /** + * 통합링크관리 목록을 상세조회 조회한다. + * @param popupManageVO + * @param commandMap + * @param model + * @return + * "/uss/ion/pwm/detailPopupManage" + * @throws Exception + */ + @RequestMapping(value = "/uss/ion/pwm/detailPopup.do") + public String egovPopupManageDetail(PopupManageVO popupManageVO, @RequestParam Map commandMap, ModelMap model) + throws Exception { + + String sLocationUrl = "egovframework/com/uss/ion/pwm/EgovPopupDetail"; + + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); + + if (sCmd.equals("del")) { + egovPopupManageService.deletePopup(popupManageVO); + sLocationUrl = "forward:/uss/ion/pwm/listPopup.do"; + } else { + //상세정보 불러오기 + PopupManageVO popupManageVOs = egovPopupManageService.selectPopup(popupManageVO); + model.addAttribute("popupManageVO", popupManageVOs); + } + + return sLocationUrl; + } + + /** + * 통합링크관리를 수정한다. + * @param searchVO + * @param popupManageVO + * @param bindingResult + * @param model + * @return + * "/uss/ion/pwm/updtPopupManage" + * @throws Exception + */ + @RequestMapping(value = "/uss/ion/pwm/updtPopup.do") + public String egovPopupManageUpdt(@RequestParam Map commandMap, PopupManageVO popupManageVO, + BindingResult bindingResult, ModelMap model) throws Exception { + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + // 로그인 객체 선언 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + String sLocationUrl = "egovframework/com/uss/ion/pwm/EgovPopupUpdt"; + + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); + + //팝업창시작일자(시) + model.addAttribute("ntceBgndeHH", getTimeHH()); + //팝업창시작일자(분) + model.addAttribute("ntceBgndeMM", getTimeMM()); + //팝업창종료일자(시) + model.addAttribute("ntceEnddeHH", getTimeHH()); + //팝업창정료일자(분) + model.addAttribute("ntceEnddeMM", getTimeMM()); + + if (sCmd.equals("save")) { + sLocationUrl = "forward:/uss/ion/pwm/listPopup.do"; + //서버 validate 체크 + beanValidator.validate(popupManageVO, bindingResult); + if (bindingResult.hasErrors()) { + return sLocationUrl; + } + //아이디 설정 + popupManageVO.setFrstRegisterId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + popupManageVO.setLastUpdusrId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + //저장 + egovPopupManageService.updatePopup(popupManageVO); + } else { + + PopupManageVO popupManageVOs = egovPopupManageService.selectPopup(popupManageVO); + + String sNtceBgnde = popupManageVOs.getNtceBgnde(); + String sNtceEndde = popupManageVOs.getNtceEndde(); + + popupManageVOs.setNtceBgndeHH(sNtceBgnde.substring(8, 10)); + popupManageVOs.setNtceBgndeMM(sNtceBgnde.substring(10, 12)); + + popupManageVOs.setNtceEnddeHH(sNtceEndde.substring(8, 10)); + popupManageVOs.setNtceEnddeMM(sNtceEndde.substring(10, 12)); + + model.addAttribute("popupManageVO", popupManageVOs); + } + + return sLocationUrl; + } + + /** + * 통합링크관리를 등록한다. + * @param searchVO + * @param popupManageVO + * @param bindingResult + * @param model + * @return + * "/uss/ion/pwm/registPopupManage" + * @throws Exception + */ + @RequestMapping(value = "/uss/ion/pwm/registPopup.do") + public String egovPopupManageRegist(@RequestParam Map commandMap, + @ModelAttribute("popupManageVO") PopupManageVO popupManageVO, BindingResult bindingResult, + ModelMap model) throws Exception { + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + // 로그인 객체 선언 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + String sLocationUrl = "egovframework/com/uss/ion/pwm/EgovPopupRegist"; + + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); + LOGGER.info("cmd => {}", sCmd); + + if (sCmd.equals("save")) { + //서버 validate 체크 + beanValidator.validate(popupManageVO, bindingResult); + if (bindingResult.hasErrors()) { + return sLocationUrl; + } + //아이디 설정 + popupManageVO.setFrstRegisterId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + popupManageVO.setLastUpdusrId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + //저장 + egovPopupManageService.insertPopup(popupManageVO); + + sLocationUrl = "forward:/uss/ion/pwm/listPopup.do"; + } + + //팝업창시작일자(시) + model.addAttribute("ntceBgndeHH", getTimeHH()); + //팝업창시작일자(분) + model.addAttribute("ntceBgndeMM", getTimeMM()); + //팝업창종료일자(시) + model.addAttribute("ntceEnddeHH", getTimeHH()); + //팝업창정료일자(분) + model.addAttribute("ntceEnddeMM", getTimeMM()); + + return sLocationUrl; + } + + /** + * 팝업창정보를 조회한다. + * @param commandMap + * @param popupManageVO + * @return + * @throws Exception + */ + @RequestMapping(value = "/uss/ion/pwm/ajaxPopupManageInfo.do") + public void egovPopupManageInfoAjax(@RequestParam Map commandMap, HttpServletResponse response, + PopupManageVO popupManageVO) throws Exception { + + response.setHeader("Content-Type", "text/html;charset=utf-8"); + PrintWriter out = new PrintWriter(new OutputStreamWriter(response.getOutputStream(), "UTF-8")); + + LOGGER.debug("commandMap : {}", commandMap); + LOGGER.debug("popupManageVO : {}", popupManageVO); + + PopupManageVO popupManageVOs = egovPopupManageService.selectPopup(popupManageVO); + + String sPrint = ""; + sPrint = popupManageVOs.getFileUrl(); + sPrint = sPrint + "||" + popupManageVOs.getPopupWSize(); + sPrint = sPrint + "||" + popupManageVOs.getPopupHSize(); + sPrint = sPrint + "||" + popupManageVOs.getPopupHlc(); + sPrint = sPrint + "||" + popupManageVOs.getPopupWlc(); + sPrint = sPrint + "||" + popupManageVOs.getStopVewAt(); + out.print(EgovWebUtil.clearXSSMinimum(sPrint));//2022.01 Potential XSS in Servlet + out.flush(); + } + + /** + * 팝업창을 오픈 한다. + * @param commandMap + * @param popupManageVO + * @return + * @throws Exception + */ + @RequestMapping(value = "/uss/ion/pwm/openPopupManage.do") + public String egovPopupManagePopupOpen(@RequestParam("fileUrl") String fileUrl, + @RequestParam("stopVewAt") String stopVewAt, @RequestParam("popupId") String popupId, + ModelMap model) throws Exception { + + model.addAttribute("stopVewAt", stopVewAt); + model.addAttribute("popupId", popupId); + + fileUrl = EgovWebUtil.filePathBlackList(fileUrl); + + List popupWhiteList = egovPopupManageService.selectPopupWhiteList(); + LOGGER.debug("Open Popup > WhiteList Count = {}", popupWhiteList.size()); + if (fileUrl == null) { + fileUrl = ""; + } + for (Object obj : popupWhiteList) { + EgovMap map = (EgovMap)obj; + LOGGER.debug("Open Popup > whiteList fileUrl = " + map.get("fileUrl")); + if (fileUrl.equals(map.get("fileUrl"))) { + return fileUrl; + } + } + //System.out.println("===>>> "+popupWhiteList.size()); + LOGGER.debug("Open Popup > WhiteList mismatch! Please check Admin page!"); + return "egovframework/com/cmm/egovError"; + } + + /** + * 팝업창관리 메인 테스트 목록을 조회한다. + * @param popupManageVO + * @param model + * @return "egovframework/com/uss/ion/pwm/listMainPopup" + * @throws Exception + */ + @RequestMapping(value = "/uss/ion/pwm/listMainPopup.do") + public String egovPopupManageMainList(PopupManageVO popupManageVO, ModelMap model) throws Exception { + + List reusltList = egovPopupManageService.selectPopupMainList(popupManageVO); + model.addAttribute("resultList", reusltList); + + return "egovframework/com/uss/ion/pwm/EgovPopupMainList"; + } + + /** + * 시간을 LIST를 반환한다. + * @return List + * @throws + */ + @SuppressWarnings("unused") + private List getTimeHH() { + ArrayList listHH = new ArrayList(); + HashMap hmHHMM; + for (int i = 0; i <= 24; i++) { + String sHH = ""; + String strI = String.valueOf(i); + if (i < 10) { + sHH = "0" + strI; + } else { + sHH = strI; + } + + ComDefaultCodeVO codeVO = new ComDefaultCodeVO(); + codeVO.setCode(sHH); + codeVO.setCodeNm(sHH); + + listHH.add(codeVO); + } + + return listHH; + } + + /** + * 분을 LIST를 반환한다. + * @return List + * @throws + */ + @SuppressWarnings("unused") + private List getTimeMM() { + ArrayList listMM = new ArrayList(); + HashMap hmHHMM; + for (int i = 0; i <= 60; i++) { + + String sMM = ""; + String strI = String.valueOf(i); + if (i < 10) { + sMM = "0" + strI; + } else { + sMM = strI; + } + + ComDefaultCodeVO codeVO = new ComDefaultCodeVO(); + codeVO.setCode(sMM); + codeVO.setCodeNm(sMM); + + listMM.add(codeVO); + } + return listMM; + } + + /** + * 0을 붙여 반환 + * @return String + * @throws + */ + public String dateTypeIntForString(int iInput) { + String sOutput = ""; + if (Integer.toString(iInput).length() == 1) { + sOutput = "0" + Integer.toString(iInput); + } else { + sOutput = Integer.toString(iInput); + } + + return sOutput; + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/rec/service/EgovRecomendSiteService.java b/src/main/java/egovframework/com/uss/ion/rec/service/EgovRecomendSiteService.java new file mode 100644 index 0000000..475c6f3 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rec/service/EgovRecomendSiteService.java @@ -0,0 +1,21 @@ +package egovframework.com.uss.ion.rec.service; + +import java.util.List; + +import org.egovframe.rte.fdl.cmmn.exception.FdlException; + +public interface EgovRecomendSiteService { + + List selectRecomendSiteList(RecomendSiteVO searchVO); + + int selectRecomendSiteListCnt(RecomendSiteVO searchVO); + + void insertRecomendSite(RecomendSiteVO recomendSiteVO) throws FdlException; + + RecomendSiteVO selectRecomendSiteDetail(RecomendSiteVO recomendSiteVO) throws Exception; + + void updateRecomendSite(RecomendSiteVO recomendSiteVO); + + void deleteRecomendSite(RecomendSiteVO recomendSiteVO); + +} diff --git a/src/main/java/egovframework/com/uss/ion/rec/service/RecomendSiteDefaultVO.java b/src/main/java/egovframework/com/uss/ion/rec/service/RecomendSiteDefaultVO.java new file mode 100644 index 0000000..14acb60 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rec/service/RecomendSiteDefaultVO.java @@ -0,0 +1,198 @@ +package egovframework.com.uss.ion.rec.service; + +import java.io.Serializable; + +/** + * + * 추천사이트정보를 처리하는 DefaultVO 클래스 + * @author 공통서비스 개발팀 박정규 + * @since 2009.04.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.01  박정규          최초 생성
    + *
    + * 
    + */ +public class RecomendSiteDefaultVO implements Serializable { + + private static final long serialVersionUID = 907031098313356600L; + + /** 검색조건 */ + private String searchCondition = ""; + + /** 검색Keyword */ + private String searchKeyword = ""; + + /** 검색사용여부 */ + private String searchUseYn = ""; + + /** 현재페이지 */ + private int pageIndex = 1; + + /** 페이지갯수 */ + private int pageUnit = 10; + + /** 페이지사이즈 */ + private int pageSize = 10; + + /** firstIndex */ + private int firstIndex = 1; + + /** lastIndex */ + private int lastIndex = 1; + + /** recordCountPerPage */ + private int recordCountPerPage = 10; + + /** + * searchCondition attribute 를 리턴한다. + * @return the String + */ + public String getSearchCondition() { + return searchCondition; + } + + /** + * searchCondition attribute 값을 설정한다. + * @return searchCondition String + */ + public void setSearchCondition(String searchCondition) { + this.searchCondition = searchCondition; + } + + /** + * searchKeyword attribute 를 리턴한다. + * @return the String + */ + public String getSearchKeyword() { + return searchKeyword; + } + + /** + * searchKeyword attribute 값을 설정한다. + * @return searchKeyword String + */ + public void setSearchKeyword(String searchKeyword) { + this.searchKeyword = searchKeyword; + } + + /** + * searchUseYn attribute 를 리턴한다. + * @return the String + */ + public String getSearchUseYn() { + return searchUseYn; + } + + /** + * searchUseYn attribute 값을 설정한다. + * @return searchUseYn String + */ + public void setSearchUseYn(String searchUseYn) { + this.searchUseYn = searchUseYn; + } + + /** + * pageIndex attribute 를 리턴한다. + * @return the int + */ + public int getPageIndex() { + return pageIndex; + } + + /** + * pageIndex attribute 값을 설정한다. + * @return pageIndex int + */ + public void setPageIndex(int pageIndex) { + this.pageIndex = pageIndex; + } + + /** + * pageUnit attribute 를 리턴한다. + * @return the int + */ + public int getPageUnit() { + return pageUnit; + } + + /** + * pageUnit attribute 값을 설정한다. + * @return pageUnit int + */ + public void setPageUnit(int pageUnit) { + this.pageUnit = pageUnit; + } + + /** + * pageSize attribute 를 리턴한다. + * @return the int + */ + public int getPageSize() { + return pageSize; + } + + /** + * pageSize attribute 값을 설정한다. + * @return pageSize int + */ + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + /** + * firstIndex attribute 를 리턴한다. + * @return the int + */ + public int getFirstIndex() { + return firstIndex; + } + + /** + * firstIndex attribute 값을 설정한다. + * @return firstIndex int + */ + public void setFirstIndex(int firstIndex) { + this.firstIndex = firstIndex; + } + + /** + * lastIndex attribute 를 리턴한다. + * @return the int + */ + public int getLastIndex() { + return lastIndex; + } + + /** + * lastIndex attribute 값을 설정한다. + * @return lastIndex int + */ + public void setLastIndex(int lastIndex) { + this.lastIndex = lastIndex; + } + + /** + * recordCountPerPage attribute 를 리턴한다. + * @return the int + */ + public int getRecordCountPerPage() { + return recordCountPerPage; + } + + /** + * recordCountPerPage attribute 값을 설정한다. + * @return recordCountPerPage int + */ + public void setRecordCountPerPage(int recordCountPerPage) { + this.recordCountPerPage = recordCountPerPage; + } + + +} diff --git a/src/main/java/egovframework/com/uss/ion/rec/service/RecomendSiteVO.java b/src/main/java/egovframework/com/uss/ion/rec/service/RecomendSiteVO.java new file mode 100644 index 0000000..b764539 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rec/service/RecomendSiteVO.java @@ -0,0 +1,237 @@ +package egovframework.com.uss.ion.rec.service; + + +/** + * + * 추천사이트정보를 처리하는 VO 클래스 + * @author 공통서비스 개발팀 박정규 + * @since 2009.04.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.01  박정규          최초 생성
    + *
    + * 
    + */ +public class RecomendSiteVO extends RecomendSiteDefaultVO { + + private static final long serialVersionUID = 1L; + + /** 추천사이트 ID */ + private String recomendSiteId; + + /** 추천사이트 URL */ + private String recomendSiteUrl; + + /** 추천사이트명 */ + private String recomendSiteNm; + + /** 추천사이트설명 */ + private String recomendSiteDc; + + /** 추천사유내용 */ + private String recomendResnCn; + + /** 추천승인여부 */ + private String recomendConfmAt; + + /** 승인일자 */ + private String confmDe; + + /** 최초등록시점 */ + private String frstRegisterPnttm; + + /** 최초등록자ID */ + private String frstRegisterId; + + /** 최종수정시점 */ + private String lastUpdusrPnttm; + + /** 최종수정자ID */ + private String lastUpdusrId; + + /** + * recomendSiteId attribute 를 리턴한다. + * @return the String + */ + public String getRecomendSiteId() { + return recomendSiteId; + } + + /** + * recomendSiteId attribute 값을 설정한다. + * @return recomendSiteId String + */ + public void setRecomendSiteId(String recomendSiteId) { + this.recomendSiteId = recomendSiteId; + } + + /** + * recomendSiteUrl attribute 를 리턴한다. + * @return the String + */ + public String getRecomendSiteUrl() { + return recomendSiteUrl; + } + + /** + * recomendSiteUrl attribute 값을 설정한다. + * @return recomendSiteUrl String + */ + public void setRecomendSiteUrl(String recomendSiteUrl) { + this.recomendSiteUrl = recomendSiteUrl; + } + + /** + * recomendSiteNm attribute 를 리턴한다. + * @return the String + */ + public String getRecomendSiteNm() { + return recomendSiteNm; + } + + /** + * recomendSiteNm attribute 값을 설정한다. + * @return recomendSiteNm String + */ + public void setRecomendSiteNm(String recomendSiteNm) { + this.recomendSiteNm = recomendSiteNm; + } + + /** + * recomendSiteDc attribute 를 리턴한다. + * @return the String + */ + public String getRecomendSiteDc() { + return recomendSiteDc; + } + + /** + * recomendSiteDc attribute 값을 설정한다. + * @return recomendSiteDc String + */ + public void setRecomendSiteDc(String recomendSiteDc) { + this.recomendSiteDc = recomendSiteDc; + } + + /** + * recomendResnCn attribute 를 리턴한다. + * @return the String + */ + public String getRecomendResnCn() { + return recomendResnCn; + } + + /** + * recomendResnCn attribute 값을 설정한다. + * @return recomendResnCn String + */ + public void setRecomendResnCn(String recomendResnCn) { + this.recomendResnCn = recomendResnCn; + } + + /** + * recomendConfmAt attribute 를 리턴한다. + * @return the String + */ + public String getRecomendConfmAt() { + return recomendConfmAt; + } + + /** + * recomendConfmAt attribute 값을 설정한다. + * @return recomendConfmAt String + */ + public void setRecomendConfmAt(String recomendConfmAt) { + this.recomendConfmAt = recomendConfmAt; + } + + /** + * confmDe attribute 를 리턴한다. + * @return the String + */ + public String getConfmDe() { + return confmDe; + } + + /** + * confmDe attribute 값을 설정한다. + * @return confmDe String + */ + public void setConfmDe(String confmDe) { + this.confmDe = confmDe; + } + + /** + * frstRegisterPnttm attribute 를 리턴한다. + * @return the String + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * frstRegisterPnttm attribute 값을 설정한다. + * @return frstRegisterPnttm String + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * frstRegisterId attribute 를 리턴한다. + * @return the String + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * frstRegisterId attribute 값을 설정한다. + * @return frstRegisterId String + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * lastUpdusrPnttm attribute 를 리턴한다. + * @return the String + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * lastUpdusrPnttm attribute 값을 설정한다. + * @return lastUpdusrPnttm String + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * lastUpdusrId attribute 를 리턴한다. + * @return the String + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * lastUpdusrId attribute 값을 설정한다. + * @return lastUpdusrId String + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + + + +} diff --git a/src/main/java/egovframework/com/uss/ion/rec/service/impl/EgovRecomendSiteDAO.java b/src/main/java/egovframework/com/uss/ion/rec/service/impl/EgovRecomendSiteDAO.java new file mode 100644 index 0000000..63def65 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rec/service/impl/EgovRecomendSiteDAO.java @@ -0,0 +1,37 @@ +package egovframework.com.uss.ion.rec.service.impl; + +import java.util.List; + +import org.springframework.stereotype.Repository; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.ion.rec.service.RecomendSiteVO; + +@Repository("EgovRecomendSiteDAO") +public class EgovRecomendSiteDAO extends EgovComAbstractDAO{ + + public List selectRecomendSiteList(RecomendSiteVO searchVO) { + return list("RecomendSite.selectRecomendSiteList", searchVO); + } + + public int selectRecomendSiteListCnt(RecomendSiteVO searchVO) { + return (Integer) selectOne("RecomendSite.selectRecomendSiteListCnt", searchVO); + } + + public void insertRecomendSite(RecomendSiteVO recomendSiteVO) { + insert("RecomendSite.insertRecomendSite", recomendSiteVO); + } + + public RecomendSiteVO selectRecomendSiteDetail(RecomendSiteVO recomendSiteVO) { + return (RecomendSiteVO) selectOne("RecomendSite.selectRecomendSiteDetail", recomendSiteVO); + } + + public void updateRecomendSite(RecomendSiteVO recomendSiteVO) { + update("RecomendSite.updateRecomendSite", recomendSiteVO); + } + + public void deleteRecomendSite(RecomendSiteVO recomendSiteVO) { + delete("RecomendSite.deleteRecomendSite", recomendSiteVO); + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/rec/service/impl/EgovRecomendSiteServiceImpl.java b/src/main/java/egovframework/com/uss/ion/rec/service/impl/EgovRecomendSiteServiceImpl.java new file mode 100644 index 0000000..a6dd1b7 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rec/service/impl/EgovRecomendSiteServiceImpl.java @@ -0,0 +1,61 @@ +package egovframework.com.uss.ion.rec.service.impl; + +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import egovframework.com.uss.ion.rec.service.EgovRecomendSiteService; +import egovframework.com.uss.ion.rec.service.RecomendSiteVO; +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.cmmn.exception.FdlException; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +@Service("EgovRecomendSiteService") +public class EgovRecomendSiteServiceImpl extends EgovAbstractServiceImpl implements EgovRecomendSiteService { + + @Resource(name="EgovRecomendSiteDAO") + private EgovRecomendSiteDAO egovRecomendSiteDao; + + /** ID Generation */ + @Resource(name="egovRecomendSiteManageIdGnrService") + private EgovIdGnrService idgenService; + + @Override + public List selectRecomendSiteList(RecomendSiteVO searchVO) { + return egovRecomendSiteDao.selectRecomendSiteList(searchVO); + } + + @Override + public int selectRecomendSiteListCnt(RecomendSiteVO searchVO) { + return egovRecomendSiteDao.selectRecomendSiteListCnt(searchVO); + } + + @Override + public void insertRecomendSite(RecomendSiteVO recomendSiteVO) throws FdlException { + String recomendSiteId = idgenService.getNextStringId(); + recomendSiteVO.setRecomendSiteId(recomendSiteId); + + egovRecomendSiteDao.insertRecomendSite(recomendSiteVO); + } + + @Override + public RecomendSiteVO selectRecomendSiteDetail(RecomendSiteVO recomendSiteVO) throws Exception { + RecomendSiteVO resultVO = egovRecomendSiteDao.selectRecomendSiteDetail(recomendSiteVO); + if (resultVO == null) + throw processException("info.nodata.msg"); + return resultVO; + } + + @Override + public void updateRecomendSite(RecomendSiteVO recomendSiteVO) { + egovRecomendSiteDao.updateRecomendSite(recomendSiteVO); + } + + @Override + public void deleteRecomendSite(RecomendSiteVO recomendSiteVO) { + egovRecomendSiteDao.deleteRecomendSite(recomendSiteVO); + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/rec/web/EgovRecomendSiteController.java b/src/main/java/egovframework/com/uss/ion/rec/web/EgovRecomendSiteController.java new file mode 100644 index 0000000..7b24d83 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rec/web/EgovRecomendSiteController.java @@ -0,0 +1,238 @@ +package egovframework.com.uss.ion.rec.web; + +import java.util.List; + +import javax.annotation.Resource; + +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 egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.ion.rec.service.EgovRecomendSiteService; +import egovframework.com.uss.ion.rec.service.RecomendSiteVO; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +/** +* +* 추천사이트처리를 하는 Controller 클래스 +* @author 공통서비스 개발팀 박정규 +* @since 2009.04.01 +* @version 1.0 +* @see +* +*
    +* << 개정이력(Modification Information) >>
    +*
    +*   수정일      수정자           수정내용
    +*  -------    --------    ---------------------------
    +*   2009.04.01  박정규          최초 생성
    +*   2011.8.26	 정진오			IncludedInfo annotation 추가
    +*   2016.08.22	 김연호			표준프레임워크 3.6 개선
    +*
    +* 
    +*/ + +@Controller +public class EgovRecomendSiteController { + + @Resource(name = "EgovRecomendSiteService") + private EgovRecomendSiteService egovRecomendSiteService; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + // Validation 관련 + @Autowired + private DefaultBeanValidator beanValidator; + + /** + * 추천사이트정보 목록을 조회한다. + * @param searchVO + * @param model + * @return "/uss/ion/rec/EgovRecomendSiteList" + * @throws Exception + */ + @IncludedInfo(name="추천사이트관리", order = 700 ,gid = 50) + @RequestMapping(value="/uss/ion/rec/selectRecomendSiteList.do") + public String selectRecomendSiteList(@ModelAttribute("searchVO") RecomendSiteVO searchVO, ModelMap model) throws Exception { + + /** EgovPropertyService.SiteList */ + 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()); + + List RecomendSiteList = egovRecomendSiteService.selectRecomendSiteList(searchVO); + model.addAttribute("resultList", RecomendSiteList); + + int totCnt = egovRecomendSiteService.selectRecomendSiteListCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/uss/ion/rec/EgovRecomendSiteList"; + } + + /** + * 추천사이트정보 목록에 대한 상세정보를 조회한다. + * @param recomendSiteVO + * @param searchVO + * @param model + * @return "/uss/ion/rec/EgovRecomendSiteDetail" + * @throws Exception + */ + @RequestMapping("/uss/ion/rec/selectRecomendSiteDetail.do") + public String selectRecomendSiteDetail(RecomendSiteVO recomendSiteVO, + @ModelAttribute("searchVO") RecomendSiteVO searchVO, + ModelMap model) throws Exception { + + RecomendSiteVO vo = egovRecomendSiteService.selectRecomendSiteDetail(recomendSiteVO); + + model.addAttribute("result", vo); + + return "egovframework/com/uss/ion/rec/EgovRecomendSiteDetail"; + } + + /** + * 추천사이트정보를 등록하기 전 처리 + * @param searchVO + * @param model + * @return "/uss/ion/rec/EgovRecomendSiteRegist" + * @throws Exception + */ + @RequestMapping("/uss/ion/rec/insertRecomendSiteView.do") + public String insertRecomendSiteView(@ModelAttribute("searchVO") RecomendSiteVO searchVO, Model model) throws Exception { + + model.addAttribute("recomendSiteVO", new RecomendSiteVO()); + + return "egovframework/com/uss/ion/rec/EgovRecomendSiteRegist"; + + } + + /** + * 추천사이트정보를 등록한다. + * @param searchVO + * @param recomendSiteVO + * @param bindingResult + * @return "forward:/uss/ion/rec/selectRecomendSiteList.do" + * @throws Exception + */ + @RequestMapping("/uss/ion/rec/insertRecomendSite.do") + public String insertRecomendSite( + @ModelAttribute("searchVO") RecomendSiteVO searchVO, + @ModelAttribute("recomendSiteVO") RecomendSiteVO recomendSiteVO, + BindingResult bindingResult) + throws Exception { + + beanValidator.validate(recomendSiteVO, bindingResult); + if(bindingResult.hasErrors()){ + return "egovframework/com/uss/olh/rec/EgovRecomendSiteRegist"; + } + + // 로그인VO에서 사용자 정보 가져오기 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + String frstRegisterId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId()); + + recomendSiteVO.setFrstRegisterId(frstRegisterId); // 최초등록자ID + recomendSiteVO.setLastUpdusrId(frstRegisterId); // 최종수정자ID + + egovRecomendSiteService.insertRecomendSite(recomendSiteVO); + + + return "forward:/uss/ion/rec/selectRecomendSiteList.do"; + } + + /** + * 추천사이트정보를 수정하기 전 처리 + * @param recomendSiteId + * @param searchVO + * @param model + * @return "/uss/ion/rec/EgovRecomendSiteUpdt" + * @throws Exception + */ + @RequestMapping("/uss/ion/rec/updateRecomendSiteView.do") + public String updateRecomendSiteView(@RequestParam("recomendSiteId") String recomendSiteId , + @ModelAttribute("searchVO") RecomendSiteVO searchVO, ModelMap model) + throws Exception { + + + RecomendSiteVO recomendSiteVO = new RecomendSiteVO(); + + // Primary Key 값 세팅 + recomendSiteVO.setRecomendSiteId(recomendSiteId); + model.addAttribute("recomendSiteVO", egovRecomendSiteService.selectRecomendSiteDetail(recomendSiteVO)); + + + return "egovframework/com/uss/ion/rec/EgovRecomendSiteUpdt"; + } + + /** + * 추천사이트정보를 수정처리한다. + * @param searchVO + * @param recomendSiteManageVO + * @param bindingResult + * @return "forward:/uss/ion/rec/selectRecomendSiteList.do" + * @throws Exception + */ + @RequestMapping("/uss/ion/rec/updateRecomendSite.do") + public String updateRecomendSite(@ModelAttribute("searchVO") RecomendSiteVO searchVO, @ModelAttribute("recomendSiteVO") RecomendSiteVO recomendSiteVO, + BindingResult bindingResult) + throws Exception { + + // Validation + beanValidator.validate(recomendSiteVO, bindingResult); + if(bindingResult.hasErrors()){ + return "egovframework/com/uss/olh/rec/EgovRecomendSiteUpdt"; + } + + // 로그인VO에서 사용자 정보 가져오기 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + String lastUpdusrId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId()); + recomendSiteVO.setLastUpdusrId(lastUpdusrId); // 최종수정자ID + + egovRecomendSiteService.updateRecomendSite(recomendSiteVO); + + return "forward:/uss/ion/rec/selectRecomendSiteList.do"; + + } + + /** + * 추천사이트정보를 삭제처리한다. + * @param recomendSiteVO + * @param searchVO + * @return "forward:/uss/ion/rec/selectRecomendSiteList.do" + * @throws Exception + */ + @RequestMapping("/uss/ion/rec/deleteRecomendSite.do") + public String deleteRecomendSite(RecomendSiteVO recomendSiteVO, @ModelAttribute("searchVO") RecomendSiteVO searchVO) throws Exception { + + egovRecomendSiteService.deleteRecomendSite(recomendSiteVO); + + return "forward:/uss/ion/rec/selectRecomendSiteList.do"; + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/rmm/service/EgovRoughMapService.java b/src/main/java/egovframework/com/uss/ion/rmm/service/EgovRoughMapService.java new file mode 100644 index 0000000..fb684b0 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rmm/service/EgovRoughMapService.java @@ -0,0 +1,74 @@ +package egovframework.com.uss.ion.rmm.service; + +import java.util.List; + +/** + * 개요 + * - 위치정보연계에 대한 Service Interface를 정의한다. + * + * 상세내용 + * - 건물의 위치정보에 대한 등록, 수정, 삭제, 상세조회 기능을 제공한다. + * - 건물의 위치정보의 조회기능은 목록, 상세조회로 구분된다. + * + * @author 옥찬우 + * @since 2014.08.27 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일			수정자		수정내용
    + *  -----------		------		---------
    + *   2014.08.27		옥찬우		최초 생성
    + *
    + * 
    + */ + +public interface EgovRoughMapService { + + /** + * 건물의 위치정보 목록을 조회하는 Service interface 메서드 + * @param roughMapVO + * @return Map 주변건물 위치정보 리스트 + * @throws Exception + */ + List selectRoughMapList(RoughMapDefaultVO searchVO) throws Exception; + + /** + * 글 총 갯수를 조회한다 + * @param searchVO + * @return 총 갯수 + */ + int selectRoughMapListTotCnt(RoughMapDefaultVO searchVO); + + /** + * 건물의 위치정보를 상세조회하는 Service interface 메서드 + * @param roughMapVO + * @return RoughMap 주변건물 위치정보 + * @throws Exception + */ + RoughMapVO selectRoughMapDetail(RoughMapVO roughMapVO) throws Exception; + + /** + * 건물의 위치정보를 등록하는 Service interface 메서드 + * @param roughMap + * @throws Exception + */ + void insertRoughMap(RoughMapVO roughMap) throws Exception; + + /** + * 건물의 위치정보를 수정하는 Service interface 메서드 + * @param roughMap + * @throws Exception + */ + void updateRoughMap(RoughMapVO roughMap) throws Exception; + + /** + * 건물의 위치정보를 삭제하는 Service interface 메서드 + * @param roughMap + * @throws Exception + */ + void deleteRoughMap(RoughMapVO roughMap) throws Exception; + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/rmm/service/RoughMapDefaultVO.java b/src/main/java/egovframework/com/uss/ion/rmm/service/RoughMapDefaultVO.java new file mode 100644 index 0000000..f5e80d6 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rmm/service/RoughMapDefaultVO.java @@ -0,0 +1,202 @@ +package egovframework.com.uss.ion.rmm.service; + +import java.io.Serializable; + +/** + * 개요 + * - 약도관리에 대한 VO 클래스를 정의한다. + * + * 상세내용 + * - 약도정보 조회를 위해 필요한 정보를 관리한다. + * + * @author 옥찬우 + * @since 2014.08.27 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일			수정자		수정내용
    + *  -----------		------		---------
    + *   2014.08.27		옥찬우		최초 생성
    + *
    + * 
    + */ + +public class RoughMapDefaultVO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** 첫페이지 인덱스 */ + private int firstIndex = 1; + + /** * 마지막페이지 인덱스 */ + private int lastIndex = 1; + + /** 현재페이지 */ + private int pageIndex = 1; + + /** 페이지 사이즈 */ + private int pageSize = 10; + + /** 페이지 개수 */ + private int pageUnit = 10; + + /** 페이지당 레코드 개수 */ + private int recordCountPerPage = 10; + + /** 검색조건 */ + private String searchCondition = ""; + + /** 검색단어 */ + private String searchKeyword = ""; + + /** 검색사용여부 */ + private String searchUseYn = ""; + + /** + * 첫페이지 인덱스를 가져온다. + * @return int 첫페이지 인덱스 + */ + public int getFirstIndex(){ + return firstIndex; + } + + /** + * 첫페이지 인덱스를 저장한다. + * @param firstIndex + */ + public void setFirstIndex(int firstIndex){ + this.firstIndex = firstIndex; + } + + /** + * 마지막페이지 인덱스를 가져온다. + * @return int 마지막페이지 인덱스 + */ + public int getLastIndex(){ + return lastIndex; + } + + /** + * 마지막페이지 인덱스를 저장한다. + * @param lastIndex + */ + public void setLastIndex(int lastIndex){ + this.lastIndex = lastIndex; + } + + /** + * 현재페이지를 가져온다. + * @return int 현재페이지 + */ + public int getPageIndex(){ + return pageIndex; + } + + /** + * 현재페이지를 저장한다. + * @param pageIndex + */ + public void setPageIndex(int pageIndex){ + this.pageIndex = pageIndex; + } + + /** + * 페이지 사이즈를 가져온다. + * @return int 페이지 사이즈 + */ + public int getPageSize(){ + return pageSize; + } + + /** + * 페이지 사이즈를 저장한다. + * @param pageSize + */ + public void setPageSize(int pageSize){ + this.pageSize = pageSize; + } + + /** + * 페이지 개수를 가져온다. + * @return int 페이지 개수 + */ + public int getPageUnit(){ + return pageUnit; + } + + /** + * 페이지 개수를 저장한다. + * @param pageUnit + */ + public void setPageUnit(int pageUnit){ + this.pageUnit = pageUnit; + } + + /** + * 페이지당 레코드 개수를 가져온다. + * @return int 페이지당 레코드 개수 + */ + public int getRecordCountPerPage(){ + return recordCountPerPage; + } + + /** + * 페이지당 레코드 개수를 저장한다. + * @param recordCountPerPage + */ + public void setRecordCountPerPage(int recordCountPerPage){ + this.recordCountPerPage = recordCountPerPage; + } + + /** + * 검색조건을 가져온다. + * @return String 검색조건 + */ + public String getSearchCondition(){ + return searchCondition; + } + + /** + * 검색조건을 저장한다. + * @param searchCondition + */ + public void setSearchCondition(String searchCondition){ + this.searchCondition = searchCondition; + } + + /** + * 검색단어를 가져온다. + * @return String 검색단어 + */ + public String getSearchKeyword(){ + return searchKeyword; + } + + /** + * 검색단어를 저장한다. + * @param searchKeyword + */ + public void setSearchKeyword(String searchKeyword){ + this.searchKeyword = searchKeyword; + } + + /** + * 검색사용여부를 가져온다. + * @return String 검색사용여부 + */ + public String getSearchUseYn(){ + return searchUseYn; + } + + /** + * 검색사용여부를 저장한다. + * @param searchUseYn + */ + public void setSearchUseYn(String searchUseYn){ + this.searchUseYn = searchUseYn; + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/rmm/service/RoughMapVO.java b/src/main/java/egovframework/com/uss/ion/rmm/service/RoughMapVO.java new file mode 100644 index 0000000..38d4736 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rmm/service/RoughMapVO.java @@ -0,0 +1,277 @@ +package egovframework.com.uss.ion.rmm.service; + +/** + * 개요 + * - 약도에 대한 Model을 정의한다. + * + * 상세내용 + * - 약도 정보를 관리한다. + * + * @author 옥찬우 + * @since 2014.08.27 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일			수정자		수정내용
    + *  -----------		------		---------
    + *   2014.08.27		옥찬우		최초 생성
    + *
    + * 
    + */ + +public class RoughMapVO extends RoughMapDefaultVO { + + private static final long serialVersionUID = -2344076278228282853L; + + /** roughMap ID */ + private String roughMapId; + + /** roughMap 제목 */ + private String roughMapSj; + + /** roughMap 상세주소 */ + private String roughMapAddress; + + /** 지도 위도 */ + private String la; + + /** 지도 경도 */ + private String lo; + + /** 마커 위도 */ + private String markerLa; + + /** 마커 경도 */ + private String markerLo; + + /** 인포윈도우(말풍선) */ + private String infoWindow; + + /** 지도 확대수준 */ + private String zoomLevel; + + /** 최초등록시점 */ + private String frstRegisterPnttm; + + /** 최초등록자ID */ + private String frstRegisterId; + + /** 최종수정시점 */ + private String lastUpdusrPnttm; + + /** 최종수정자ID */ + private String lastUpdusrId; + + /** + * roughMapId attribute를 리턴한다. + * @return the Integer + */ + public String getRoughMapId() { + return roughMapId; + } + + /** + * roughMapId를 저장한다. + * @param roughMapId + */ + public void setRoughMapId(String roughMapId) { + this.roughMapId = roughMapId; + } + + /** + * roughMapSj attribute를 리턴한다. + * @return the String + */ + public String getRoughMapSj() { + return roughMapSj; + } + + /** + * roughMapSj를 저장한다. + * @param roughMapSj + */ + public void setRoughMapSj(String roughMapSj) { + this.roughMapSj = roughMapSj; + } + + /** + * roughMapAddress attribute를 리턴한다. + * @return the String + */ + public String getRoughMapAddress() { + return roughMapAddress; + } + + /** + * roughMapAddress를 저장한다. + * @param roughMapAddress + */ + public void setRoughMapAddress(String roughMapAddress) { + this.roughMapAddress = roughMapAddress; + } + + /** + * la attribute를 리턴한다. + * @return the String + */ + public String getLa() { + return la; + } + + /** + * la를 저장한다. + * @param la + */ + public void setLa(String la) { + this.la = la; + } + + /** + * lo attribute를 리턴한다. + * @return the String + */ + public String getLo() { + return lo; + } + + /** + * lo를 저장한다. + * @param lo + */ + public void setLo(String lo) { + this.lo = lo; + } + + /** + * markerLa attribute를 리턴한다. + * @return the String + */ + public String getMarkerLa() { + return markerLa; + } + + /** + * markerLa를 저장한다. + * @param markerLa + */ + public void setMarkerLa(String markerLa) { + this.markerLa = markerLa; + } + + /** + * markerLo attribute를 리턴한다. + * @return the String + */ + public String getMarkerLo() { + return markerLo; + } + + /** + * markerLo를 저장한다. + * @param markerLo + */ + public void setMarkerLo(String markerLo) { + this.markerLo = markerLo; + } + + /** + * @return the String + * infoWindow attribute를 리턴한다. + */ + public String getInfoWindow() { + return infoWindow; + } + + + /** + * infoWindow를 저장한다. + * @param infoWindow + */ + public void setInfoWindow(String infoWindow) { + this.infoWindow = infoWindow; + } + + /** + * mapLevel attribute를 리턴한다. + * @return the String + */ + public String getZoomLevel() { + return zoomLevel; + } + + /** + * mapLevel를 저장한다. + * @param mapLevel + */ + public void setZoomLevel(String zoomLevel) { + this.zoomLevel = zoomLevel; + } + + /** + * frstRegisterPnttm attribute를 리턴한다. + * @return the String + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * frstRegisterPnttm를 저장한다. + * @param frstRegisterPnttm + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * frstRegisterId attribute를 리턴한다. + * @return the String + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * frstRegisterId를 저장한다. + * @param frstRegisterId + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * lastUpdusrPnttm attribute를 리턴한다. + * @return the String + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * lastUpdusrPnttm를 저장한다. + * @param lastUpdusrPnttm + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * lastUpdusrId attribute를 리턴한다. + * @return the String + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * lastUpdusrId를 저장한다. + * @param lastUpdusrId + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/rmm/service/impl/EgovRoughMapDAO.java b/src/main/java/egovframework/com/uss/ion/rmm/service/impl/EgovRoughMapDAO.java new file mode 100644 index 0000000..f108b99 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rmm/service/impl/EgovRoughMapDAO.java @@ -0,0 +1,96 @@ +package egovframework.com.uss.ion.rmm.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.ion.rmm.service.RoughMapDefaultVO; +import egovframework.com.uss.ion.rmm.service.RoughMapVO; + +import org.springframework.stereotype.Repository; + +/** + * 개요 + * - 건물 위치정보에 대한 DB상의 접근, 변경을 처리한다. + * + * 상세내용 + * - 건물 위치정보에 대한 등록, 수정, 삭제 기능을 제공한다. + * - 건물 위치정보의 조회기능은 목록, 상세조회로 구분된다. + * + * @author 옥찬우 + * @since 2014.08.27 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일			수정자		수정내용
    + *  -----------		------		---------
    + *   2014.08.27		옥찬우		최초 생성
    + *
    + * 
    + */ + +@Repository("roughMapDAO") +public class EgovRoughMapDAO extends EgovComAbstractDAO { + + /** + * 약도 목록을 조회한다. + * @param roughMapVO + * @return List 건물 위치정보 리스트 + * @throws Exception + */ + public List selectRoughMapList(RoughMapDefaultVO searchVO) throws Exception { + return selectList("RoughMapDAO.selectRoughMapList", searchVO); + } + + /** + * 약도 목록의 건수를 조회 한다. + * @param roughMapVO + * @return int 건물 위치정보 목록 건수 + * @throws Exception + */ + public int selectRoughMapListTotCnt(RoughMapDefaultVO searchVO){ + return (Integer)selectOne("RoughMapDAO.selectRoughMapListTotCnt", searchVO); + } + + /** + * 약도를 조회한다. + * @param roughMapVO + * @return RoughMap + * @throws Exception + */ + public RoughMapVO selectRoughMap(RoughMapVO roughMapVO) throws Exception { + return (RoughMapVO)selectOne("RoughMapDAO.selectRoughMapDetail", roughMapVO); + } + + /** + * 약도를 DB에 등록한다. + * + * @param roughMap + * @throws Exception + */ + public void insertRoughMap(RoughMapVO roughMap) throws Exception { + insert("RoughMapDAO.insertRoughMap", roughMap); + } + + /** + * 약도를 DB에서 수정한다. + * + * @param roughMap + * @throws Exception + */ + public void updateRoughMap(RoughMapVO roughMap) throws Exception { + update("RoughMapDAO.updateRoughMap", roughMap); + } + + /** + * 약도를 DB에서 삭제한다. + * + * @param roughMap + * @throws Exception + */ + public void deleteRoughMap(RoughMapVO roughMap) throws Exception { + delete("RoughMapDAO.deleteRoughMap", roughMap); + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/rmm/service/impl/EgovRoughMapServiceImpl.java b/src/main/java/egovframework/com/uss/ion/rmm/service/impl/EgovRoughMapServiceImpl.java new file mode 100644 index 0000000..a2b71ae --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rmm/service/impl/EgovRoughMapServiceImpl.java @@ -0,0 +1,110 @@ +package egovframework.com.uss.ion.rmm.service.impl; + +import java.util.List; + +import egovframework.com.uss.ion.rmm.service.EgovRoughMapService; +import egovframework.com.uss.ion.rmm.service.RoughMapDefaultVO; +import egovframework.com.uss.ion.rmm.service.RoughMapVO; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +/** + * 개요 + * - 위치정보연계에 대한 Service Interface를 구현한다. + * + * 상세내용 + * - 건물의 위치정보에 대한 등록, 수정, 삭제, 상세조회 기능을 제공한다. + * - 건물의 위치정보의 조회기능은 목록, 상세조회로 구분된다. + * + * @author 옥찬우 + * @since 2014.08.27 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일			수정자		수정내용
    + *  -----------		------		---------
    + *   2014.08.27		옥찬우		최초 생성
    + *
    + * 
    + */ + +@Service("EgovRoughMapService") +public class EgovRoughMapServiceImpl extends EgovAbstractServiceImpl implements EgovRoughMapService { + + /** RoughMapDAO */ + @Resource(name="roughMapDAO") + private EgovRoughMapDAO roughMapDAO; + + /** ID Generation */ + @Resource(name="egovRoughMapIdGnrService") + private EgovIdGnrService idgenService; + + /** + * 건물의 위치정보 목록을 조회한다. + * @param roughMapVO + * @return Map 건물 위치정보 조회결과 리스트, 조회건수 + * @throws Exception + */ + @Override + public List selectRoughMapList(RoughMapDefaultVO searchVO) throws Exception { + return roughMapDAO.selectRoughMapList(searchVO); + } + + @Override + public int selectRoughMapListTotCnt(RoughMapDefaultVO searchVO) { + return roughMapDAO.selectRoughMapListTotCnt(searchVO); + } + + /** + * 건물의 위치정보를 조회한다. + * + * @param roughMapVO + * @return Geolocation 건물의 위치정보 + * @throws Exception + */ + @Override + public RoughMapVO selectRoughMapDetail(RoughMapVO roughMapVO) throws Exception { + return roughMapDAO.selectRoughMap(roughMapVO); + } + + /** + * 건물의 위치정보를 DB에 등록한다. + * @param roughMap + * @throws Exception + */ + @Override + public void insertRoughMap(RoughMapVO roughMap) throws Exception { + String roughMapId = idgenService.getNextStringId(); + + roughMap.setRoughMapId(roughMapId); + roughMapDAO.insertRoughMap(roughMap); + } + + /** + * 건물의 위치정보를 수정한다. + * @param roughMap + * @throws Exception + */ + @Override + public void updateRoughMap(RoughMapVO roughMap) throws Exception { + roughMapDAO.updateRoughMap(roughMap); + } + + /** + * 건물의 위치정보를 삭제한다. + * @param roughMap + * @throws Exception + */ + @Override + public void deleteRoughMap(RoughMapVO roughMap) throws Exception { + roughMapDAO.deleteRoughMap(roughMap); + } +} diff --git a/src/main/java/egovframework/com/uss/ion/rmm/web/EgovRoughMapController.java b/src/main/java/egovframework/com/uss/ion/rmm/web/EgovRoughMapController.java new file mode 100644 index 0000000..ab5497c --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rmm/web/EgovRoughMapController.java @@ -0,0 +1,263 @@ +package egovframework.com.uss.ion.rmm.web; + +import java.util.List; + +import javax.annotation.Resource; + +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.springmodules.validation.commons.DefaultBeanValidator; + +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.ion.rmm.service.EgovRoughMapService; +import egovframework.com.uss.ion.rmm.service.RoughMapDefaultVO; +import egovframework.com.uss.ion.rmm.service.RoughMapVO; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +/** + * 개요 + * - 약도 관리에 대한 Controller를 정의한다. + * + * 상세내용 + * - 약도에 대한 등록, 수정, 삭제, 조회, 상세조회 요청 사항을 Service와 매핑 처리한다. + * + * @author 옥찬우 + * @since 2014.08.27 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일			수정자		수정내용
    + *  -----------		------		---------
    + *   2014.08.27		옥찬우		최초 생성
    + *
    + * 
    + */ + +@Controller +public class EgovRoughMapController { + + /** EgovRoughMapService */ + @Resource(name="EgovRoughMapService") + private EgovRoughMapService egovRoughMapService; + + /** EgovPropertyService */ + @Resource(name="propertiesService") + protected EgovPropertyService propertyService; + + /** DefaultBeanValidator */ + @Autowired + private DefaultBeanValidator beanValidator; + + /** + * 약도 목록 조회 Service interface 호출 및 결과를 반환한다. + * @param RoughMapDefaultVO + * @param model + * @return String 약도 목록 조회 화면 + * @throws Exception + */ + @IncludedInfo(name="약도 관리", order = 943, gid = 50) + @RequestMapping("/com/uss/ion/rmm/selectRoughMapList.do") + public String selectRoughMapList(@ModelAttribute("searchVO") RoughMapDefaultVO searchVO, ModelMap model) throws Exception { + + // 권한 체크 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if(!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + 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()); + + List roughMapList = egovRoughMapService.selectRoughMapList(searchVO); + + int totCnt = egovRoughMapService.selectRoughMapListTotCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + + model.addAttribute("resultList", roughMapList); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/uss/ion/rmm/EgovRoughMapList"; + } + + /** + * 약도 상세조회 Service interface 호출 및 결과를 반환한다. + * @param RoughMapDefaultVO + * @param model + * @return String 건물 위치정보 상세조회 화면 + * @throws Exception + */ + @RequestMapping("/com/uss/ion/rmm/selectRoughMapDetail.do") + public String selectRoughMap(RoughMapVO roughMapVO, ModelMap model) throws Exception { + + // 권한 체크 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if(!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + RoughMapVO roughMap = egovRoughMapService.selectRoughMapDetail(roughMapVO); + model.addAttribute("roughMap", roughMap); + + return "egovframework/com/uss/ion/rmm/EgovRoughMapDetail"; + } + + /** + * 약도 등록 화면으로 이동한다. + * @param RoughMapDefaultVO + * @param model + * @return String 건물 위치정보 등록 화면 + * @throws Exception + */ + @RequestMapping(value="/com/uss/ion/rmm/registRoughMap.do") + public String goRoughMapRegist(@ModelAttribute("roughMap") RoughMapVO roughMap, Model model) throws Exception { + // 권한 체크 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if(!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + return "egovframework/com/uss/ion/rmm/EgovRoughMapRegist"; + } + + /** + * 약도 등록 Service interface 호출 및 결과를 반환한다. + * @param RoughMapVO + * @return String 건물 위치정보 목록 조회 화면 + * @throws Exception + */ + @RequestMapping("/com/uss/ion/rmm/insertRoughMap.do") + public String insertRoughMap(@ModelAttribute("roughMap") RoughMapVO roughMap, BindingResult bindingResult) throws Exception { + + // 권한 체크 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if(!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + beanValidator.validate(roughMap, bindingResult); + + if(bindingResult.hasErrors()){ + return "egovframework/com/uss/ion/rmm/EgovRoughMapRegist"; + } + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + if (isAuthenticated) { + roughMap.setFrstRegisterId(user == null ? "" : EgovStringUtil.isNullToString(user.getId())); + roughMap.setLastUpdusrId(user == null ? "" : EgovStringUtil.isNullToString(user.getId())); // 최종수정자ID + egovRoughMapService.insertRoughMap(roughMap); + } + + return "forward:/com/uss/ion/rmm/selectRoughMapList.do"; + } + + /** + * 약도 수정 화면으로 이동한다. + * @param RoughMapDefaultVO + * @param model + * @return String 건물 위치정보 수정 화면 + * @throws Exception + */ + @RequestMapping(value="/com/uss/ion/rmm/updateRoughMapView.do") + public String goRoughMapUpdt(@ModelAttribute("roughMap") RoughMapVO roughMap, ModelMap model) throws Exception { + + // 권한 체크 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if(!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + roughMap = egovRoughMapService.selectRoughMapDetail(roughMap); + + model.addAttribute("result", roughMap); + model.addAttribute("roughMap", roughMap); + + return "egovframework/com/uss/ion/rmm/EgovRoughMapUpdt"; + } + + /** + * 약도 수정 Service interface 호출 및 결과를 반환한다. + * @param RoughMapVO + * @return String 건물 위치정보 목록 조회 화면 + * @throws Exception + */ + @RequestMapping(value="/com/uss/ion/rmm/updateRoughMap.do") + public String updateRoughMap(@ModelAttribute("roughMap") RoughMapVO roughMap, BindingResult bindingResult) throws Exception { + + // 권한 체크 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if(!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + beanValidator.validate(roughMap, bindingResult); + + if(bindingResult.hasErrors()){ + return "egovframework/com/uss/ion/rmm/EgovRoughMapUpdt"; + } + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + if (isAuthenticated) { + roughMap.setLastUpdusrId(user == null ? "" : EgovStringUtil.isNullToString(user.getId())); + egovRoughMapService.updateRoughMap(roughMap); + } + + return "forward:/com/uss/ion/rmm/selectRoughMapList.do"; + } + + /** + * 약도 삭제 Service interface 호출 및 결과를 반환한다. + * @param RoughMapVO + * @return String 건물 위치정보 목록 조회 화면 + * @throws Exception + */ + @RequestMapping(value="/com/uss/ion/rmm/deleteRoughMap.do") + public String deleteRoughMap(@ModelAttribute("roughMap") RoughMapVO roughMap) throws Exception { + + // 권한 체크 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if(!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + // 사용자 인증여부 판단 + if (isAuthenticated) { + roughMap.setFrstRegisterId(user == null ? "" : EgovStringUtil.isNullToString(user.getId())); + egovRoughMapService.deleteRoughMap(roughMap); + } + + return "forward:/com/uss/ion/rmm/selectRoughMapList.do"; + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/rsm/service/EgovRecentSrchwrdService.java b/src/main/java/egovframework/com/uss/ion/rsm/service/EgovRecentSrchwrdService.java new file mode 100644 index 0000000..8a9a6c3 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rsm/service/EgovRecentSrchwrdService.java @@ -0,0 +1,113 @@ +package egovframework.com.uss.ion.rsm.service; + +import java.util.List; + +/** + * 최근검색어를 처리하는 Service Class 구현 + * @author 공통서비스 장동한 + * @since 2009.07.03 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + *
    + * 
    + */ +public interface EgovRecentSrchwrdService { + + /** + * 최근검색어관리 목록을 조회한다. + * @param searchVO 조회할 정보가 담긴 VO + * @return List + * @throws Exception + */ + public List selectRecentSrchwrdList(RecentSrchwrd searchVO) throws Exception; + + /** + * 최근검색어관리를(을) 목록 전체 건수를(을) 조회한다. + * @param searchVO 조회할 정보가 담긴 VO + * @return int + * @throws Exception + */ + public int selectRecentSrchwrdListCnt(RecentSrchwrd searchVO) throws Exception; + + /** + * 최근검색어관리를(을) 상세조회 한다. + * @param RecentSrchwrd 최근검색어관리 정보가 담김 VO + * @return List + * @throws Exception + */ + public RecentSrchwrd selectRecentSrchwrdDetail(RecentSrchwrd recentSrchwrd) throws Exception; + + /** + * 최근검색어관리를(을) 등록한다. + * @param recentSrchwrd 최근검색어관리 정보가 담김 VO + * @throws Exception + */ + void insertRecentSrchwrd(RecentSrchwrd recentSrchwrd) throws Exception; + + /** + * 최근검색어관리를(을) 수정한다. + * @param recentSrchwrd 최근검색어관리 정보가 담김 VO + * @throws Exception + */ + void updateRecentSrchwrd(RecentSrchwrd recentSrchwrd) throws Exception; + + /** + * 최근검색어관리를(을) 삭제한다. + * @param recentSrchwrd 최근검색어관리 정보가 담김 VO + * @throws Exception + */ + void deleteRecentSrchwrd(RecentSrchwrd recentSrchwrd) throws Exception; + + /** + * 최근검색어결과 목록을 조회한다. + * @param searchVO 조회할 정보가 담긴 VO + * @return List + * @throws Exception + */ + public List selectRecentSrchwrdResultInquire(RecentSrchwrd recentSrchwrd) throws Exception; + + /** + * 최근검색어결과 목록을 조회한다. + * @param searchVO 조회할 정보가 담긴 VO + * @return List + * @throws Exception + */ + public List selectRecentSrchwrdResultList(RecentSrchwrd searchVO) throws Exception; + + /** + * 최근검색어결과를(을) 목록 전체 건수를(을) 조회한다. + * @param searchVO 조회할 정보가 담긴 VO + * @return int + * @throws Exception + */ + public int selectRecentSrchwrdResultListCnt(RecentSrchwrd searchVO) throws Exception; + + /** + * 최근검색어결과를(을) 등록한다. + * @param recentSrchwrd 최근검색어관리 정보가 담김 VO + * @throws Exception + */ + void insertRecentSrchwrdResult(RecentSrchwrd recentSrchwrd) throws Exception; + + /** + * 최근검색어결과를(을) 건별로 삭제 한다. + * @param recentSrchwrd 최근검색어관리 정보가 담김 VO + * @throws Exception + */ + void deleteRecentSrchwrdResult(RecentSrchwrd recentSrchwrd) throws Exception; + + /** + * 최근검색어결과를(을) 관리별로 삭제 한다. + * @param recentSrchwrd 최근검색어관리 정보가 담김 VO + * @throws Exception + */ + void deleteRecentSrchwrdResultAll(RecentSrchwrd recentSrchwrd) throws Exception; + +} diff --git a/src/main/java/egovframework/com/uss/ion/rsm/service/RecentSrchwrd.java b/src/main/java/egovframework/com/uss/ion/rsm/service/RecentSrchwrd.java new file mode 100644 index 0000000..ed8c96a --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rsm/service/RecentSrchwrd.java @@ -0,0 +1,299 @@ +package egovframework.com.uss.ion.rsm.service; + +import java.io.Serializable; + +import egovframework.com.cmm.ComDefaultVO; + +/** + * 최근검색어 VO Class 구현 + * @author 공통서비스 장동한 + * @since 2009.07.03 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + *
    + * 
    + */ +public class RecentSrchwrd extends ComDefaultVO implements Serializable { + + private static final long serialVersionUID = 4031295690314547576L; + + /** 최근검색어관리ID */ + private String srchwrdManageId; + + /** 최근검색어관리명 */ + private String srchwrdManageNm; + + /** 최근검색어관리URL */ + private String srchwrdManageUrl; + + /** 최근검색어사용자검색여부 */ + private String srchwrdManageUseYn; + + /** 최근검색어ID */ + private String srchwrdId; + + /** 최근검색어명 */ + private String srchwrdNm; + + /** 최근건색어건수 */ + private String srchwrdCnt; + + /** 최초등록시점 */ + private String frstRegisterPnttm; + + /** 최초등록아이디 */ + private String frstRegisterId; + + /** 최종수정일 */ + private String lastUpdusrPnttm; + + /** 최종수정자 아이디 */ + private String lastUpdusrId; + + /** 컨트롤 명령어 */ + private String cmd; + + /** Ajax검색어 */ + private String q; + + /** + * srchwrdManageId 리턴 + * + * @return the srchwrdManageId + */ + public String getSrchwrdManageId() { + return srchwrdManageId; + } + + /** + * srchwrdManageId 설정 + * + * @param srchwrdManageId the srchwrdManageId to set + */ + public void setSrchwrdManageId(String srchwrdManageId) { + this.srchwrdManageId = srchwrdManageId; + } + + /** + * srchwrdManageNm 리턴 + * + * @return the srchwrdManageNm + */ + public String getSrchwrdManageNm() { + return srchwrdManageNm; + } + + /** + * srchwrdManageNm 설정 + * + * @param srchwrdManageNm the srchwrdManageNm to set + */ + public void setSrchwrdManageNm(String srchwrdManageNm) { + this.srchwrdManageNm = srchwrdManageNm; + } + + /** + * srchwrdManageUrl 리턴 + * + * @return the srchwrdManageUrl + */ + public String getSrchwrdManageUrl() { + return srchwrdManageUrl; + } + + /** + * srchwrdManageUrl 설정 + * + * @param srchwrdManageUrl the srchwrdManageUrl to set + */ + public void setSrchwrdManageUrl(String srchwrdManageUrl) { + this.srchwrdManageUrl = srchwrdManageUrl; + } + + /** + * srchwrdManageUseYn 리턴 + * + * @return the srchwrdManageUseYn + */ + public String getSrchwrdManageUseYn() { + return srchwrdManageUseYn; + } + + /** + * srchwrdManageUseYn 설정 + * + * @param srchwrdManageUseYn the srchwrdManageUseYn to set + */ + public void setSrchwrdManageUseYn(String srchwrdManageUseYn) { + this.srchwrdManageUseYn = srchwrdManageUseYn; + } + + /** + * srchwrdId 리턴 + * + * @return the srchwrdId + */ + public String getSrchwrdId() { + return srchwrdId; + } + + /** + * srchwrdId 설정 + * + * @param srchwrdId the srchwrdId to set + */ + public void setSrchwrdId(String srchwrdId) { + this.srchwrdId = srchwrdId; + } + + /** + * srchwrdNm 리턴 + * + * @return the srchwrdNm + */ + public String getSrchwrdNm() { + return srchwrdNm; + } + + /** + * srchwrdNm 설정 + * + * @param srchwrdNm the srchwrdNm to set + */ + public void setSrchwrdNm(String srchwrdNm) { + this.srchwrdNm = srchwrdNm; + } + + /** + * srchwrdCnt 리턴 + * + * @return the srchwrdCnt + */ + public String getSrchwrdCnt() { + return srchwrdCnt; + } + + /** + * srchwrdCnt 설정 + * + * @param srchwrdCnt the srchwrdCnt to set + */ + public void setSrchwrdCnt(String srchwrdCnt) { + this.srchwrdCnt = srchwrdCnt; + } + + /** + * frstRegisterPnttm 리턴 + * + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * frstRegisterPnttm 설정 + * + * @param frstRegisterPnttm the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * frstRegisterId 리턴 + * + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * frstRegisterId 설정 + * + * @param frstRegisterId the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * lastUpdusrPnttm 리턴 + * + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * lastUpdusrPnttm 설정 + * + * @param lastUpdusrPnttm the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * lastUpdusrId 리턴 + * + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * lastUpdusrId 설정 + * + * @param lastUpdusrId the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + /** + * cmd 리턴 + * + * @return the cmd + */ + public String getCmd() { + return cmd; + } + + /** + * cmd 설정 + * + * @param cmd the cmd to set + */ + public void setCmd(String cmd) { + this.cmd = cmd; + } + + /** + * q 리턴 + * + * @return the q + */ + public String getQ() { + return q; + } + + /** + * q 설정 + * + * @param q the q to set + */ + public void setQ(String q) { + this.q = q; + } + +} + diff --git a/src/main/java/egovframework/com/uss/ion/rsm/service/impl/EgovRecentSrchwrdServiceImpl.java b/src/main/java/egovframework/com/uss/ion/rsm/service/impl/EgovRecentSrchwrdServiceImpl.java new file mode 100644 index 0000000..13397fb --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rsm/service/impl/EgovRecentSrchwrdServiceImpl.java @@ -0,0 +1,173 @@ +package egovframework.com.uss.ion.rsm.service.impl; + +import java.util.List; + +import egovframework.com.uss.ion.rsm.service.EgovRecentSrchwrdService; +import egovframework.com.uss.ion.rsm.service.RecentSrchwrd; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +/** + * 최근검색어를 처리하는 ServiceImpl Class 구현 + * @author 공통서비스 장동한 + * @since 2009.07.03 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + *
    + * 
    + */ +@Service("egovRecentSrchwrdService") +public class EgovRecentSrchwrdServiceImpl extends EgovAbstractServiceImpl + implements EgovRecentSrchwrdService { + + @Resource(name = "onlineRecentSrchwrdDao") + private RecentSrchwrdDao dao; + + @Resource(name = "egovSrchwrdIdGnrService") + private EgovIdGnrService egovSrchwrdIdGnrService; + + @Resource(name = "egovSrchwrdManageIdGnrService") + private EgovIdGnrService egovSrchwrdManageIdGnrService; + /** + * 최근검색어관리를(을) 목록을 조회 한다. + * @param searchVO 조회할 정보가 담김 VO + * @return List + * @throws Exception + */ + @Override + public List selectRecentSrchwrdList(RecentSrchwrd searchVO) throws Exception { + return dao.selectRecentSrchwrdList(searchVO); + } + + /** + * 최근검색어관리를(을) 목록 전체 건수를(을) 조회한다. + * @param searchVO 조회할 정보가 담긴 VO + * @return int + * @throws Exception + */ + @Override + public int selectRecentSrchwrdListCnt(RecentSrchwrd searchVO) throws Exception { + return dao.selectRecentSrchwrdListCnt(searchVO); + } + + /** + * 최근검색어관리를(을) 상세조회 한다. + * @param recentSrchwrd 최근검색어관리 정보가 담김 VO + * @return List + * @throws Exception + */ + @Override + public RecentSrchwrd selectRecentSrchwrdDetail( RecentSrchwrd recentSrchwrd) throws Exception { + return dao.selectRecentSrchwrdDetail(recentSrchwrd); + } + + /** + * 최근검색어관리를(을) 등록한다. + * @param recentSrchwrd 최근검색어관리 정보가 담김 VO + * @throws Exception + */ + @Override + public void insertRecentSrchwrd(RecentSrchwrd recentSrchwrd)throws Exception { + String sMakeId = egovSrchwrdManageIdGnrService.getNextStringId(); + recentSrchwrd.setSrchwrdManageId(sMakeId); + dao.insertRecentSrchwrd(recentSrchwrd); + } + + /** + * 최근검색어관리를(을) 수정한다. + * @param recentSrchwrd 최근검색어관리 정보가 담김 VO + * @throws Exception + */ + @Override + public void updateRecentSrchwrd(RecentSrchwrd recentSrchwrd) throws Exception { + dao.updateRecentSrchwrd(recentSrchwrd); + } + + /** + * 최근검색어관리를(을) 삭제한다. + * @param recentSrchwrd 최근검색어관리 정보가 담김 VO + * @throws Exception + */ + @Override + public void deleteRecentSrchwrd(RecentSrchwrd recentSrchwrd) throws Exception { + dao.deleteRecentSrchwrd(recentSrchwrd); + } + + + /** + * 최근검색어결과를(을) 목록을 조회 한다. + * @param searchVO 조회할 정보가 담김 VO + * @return List + * @throws Exception + */ + @Override + public List selectRecentSrchwrdResultInquire(RecentSrchwrd recentSrchwrd) throws Exception { + return dao.selectRecentSrchwrdResultInquire(recentSrchwrd); + } + + /** + * 최근검색어결과를(을) 목록을 조회 한다. + * @param searchVO 조회할 정보가 담김 VO + * @return List + * @throws Exception + */ + @Override + public List selectRecentSrchwrdResultList(RecentSrchwrd searchVO) throws Exception { + return dao.selectRecentSrchwrdResultList(searchVO); + } + + /** + * 최근검색어결과를(을) 목록 전체 건수를(을) 조회한다. + * @param searchVO 조회할 정보가 담긴 VO + * @return int + * @throws Exception + */ + @Override + public int selectRecentSrchwrdResultListCnt(RecentSrchwrd searchVO) throws Exception { + return dao.selectRecentSrchwrdResultListCnt(searchVO); + } + + /** + * 최근검색어결과를(을) 등록한다. + * @param recentSrchwrd 최근검색어관리 정보가 담김 VO + * @throws Exception + */ + @Override + public void insertRecentSrchwrdResult(RecentSrchwrd recentSrchwrd)throws Exception { + String sMakeId = egovSrchwrdIdGnrService.getNextStringId(); + recentSrchwrd.setSrchwrdId(sMakeId); + dao.insertRecentSrchwrdResult(recentSrchwrd); + } + + /** + * 최근검색어결과를(을) 건별로 삭제 한다. + * @param recentSrchwrd 최근검색어관리 정보가 담김 VO + * @throws Exception + */ + @Override + public void deleteRecentSrchwrdResult(RecentSrchwrd recentSrchwrd) throws Exception { + dao.deleteRecentSrchwrdResult(recentSrchwrd); + } + + /** + * 최근검색어결과를(을) 관리별로 삭제 한다. + * @param recentSrchwrd 최근검색어관리 정보가 담김 VO + * @throws Exception + */ + @Override + public void deleteRecentSrchwrdResultAll(RecentSrchwrd recentSrchwrd) throws Exception { + dao.deleteRecentSrchwrdResultAll(recentSrchwrd); + } + + +} diff --git a/src/main/java/egovframework/com/uss/ion/rsm/service/impl/RecentSrchwrdDao.java b/src/main/java/egovframework/com/uss/ion/rsm/service/impl/RecentSrchwrdDao.java new file mode 100644 index 0000000..39c1e51 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rsm/service/impl/RecentSrchwrdDao.java @@ -0,0 +1,141 @@ +package egovframework.com.uss.ion.rsm.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.ion.rsm.service.RecentSrchwrd; + +import org.springframework.stereotype.Repository; + +/** + * 최근검색어를 처리하는 Dao Class 구현 + * @author 공통서비스 장동한 + * @since 2009.07.03 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + *
    + * 
    + */ +@Repository("onlineRecentSrchwrdDao") +public class RecentSrchwrdDao extends EgovComAbstractDAO { + + /** + * 최근검색어관리를(을) 목록을 한다. + * @param searchVO 조회할 정보가 담긴 VO + * @return List + * @throws Exception + */ + public List selectRecentSrchwrdList(RecentSrchwrd searchVO) throws Exception { + return selectList("RecentSrchwrd.selectRecentSrchwrd", searchVO); + } + + /** + * 최근검색어관리를(을) 목록 전체 건수를(을) 조회한다. + * @param searchVO 조회할 정보가 담긴 VO + * @return int + * @throws Exception + */ + public int selectRecentSrchwrdListCnt(RecentSrchwrd searchVO) throws Exception { + return (Integer)selectOne("RecentSrchwrd.selectRecentSrchwrdCnt", searchVO); + } + + /** + * 최근검색어관리를(을) 상세조회 한다. + * @param recentSrchwrdVO 최근검색어 정보가 담김 VO + * @return List + * @throws Exception + */ + public RecentSrchwrd selectRecentSrchwrdDetail(RecentSrchwrd recentSrchwrd) throws Exception { + return (RecentSrchwrd)selectOne("RecentSrchwrd.selectRecentSrchwrdDetail", recentSrchwrd); + } + + /** + * 최근검색어관리를(을) 등록한다. + * @param qrecentSrchwrdVO 최근검색어 정보가 담김 VO + * @throws Exception + */ + public void insertRecentSrchwrd(RecentSrchwrd recentSrchwrd) throws Exception { + insert("RecentSrchwrd.insertRecentSrchwrd", recentSrchwrd); + } + + /** + * 최근검색어관리를(을) 수정한다. + * @param recentSrchwrdVO 최근검색어 정보가 담김 VO + * @throws Exception + */ + public void updateRecentSrchwrd(RecentSrchwrd recentSrchwrd) throws Exception { + update("RecentSrchwrd.updateRecentSrchwrd", recentSrchwrd); + } + + /** + * 최근검색어관리를(을) 삭제한다. + * @param recentSrchwrdVO 최근검색어 정보가 담김 VO + * @throws Exception + */ + public void deleteRecentSrchwrd(RecentSrchwrd recentSrchwrd) throws Exception { + delete("RecentSrchwrd.deleteRecentSrchwrd", recentSrchwrd); + } + + /** + * 최근검색어결과를(을) 목록을 한다. + * @param recentSrchwrdVO 최근검색어 정보 담김 VO + * @return List + * @throws Exception + */ + public List selectRecentSrchwrdResultInquire(RecentSrchwrd recentSrchwrd) throws Exception { + return selectList("RecentSrchwrd.selectRecentSrchwrdResultInquire", recentSrchwrd); + } + + /** + * 최근검색어결과를(을) 목록을 한다. + * @param recentSrchwrdVO 최근검색어 정보 담김 VO + * @return List + * @throws Exception + */ + public List selectRecentSrchwrdResultList(RecentSrchwrd searchVO) throws Exception { + return selectList("RecentSrchwrd.selectRecentSrchwrdResult", searchVO); + } + + /** + * 최근검색어결과를(을) 목록 전체 건수를(을) 조회한다. + * @param searchVO 조회할 정보가 담긴 VO + * @return int + * @throws Exception + */ + public int selectRecentSrchwrdResultListCnt(RecentSrchwrd searchVO) throws Exception { + return (Integer)selectOne("RecentSrchwrd.selectRecentSrchwrdCntResult", searchVO); + } + + /** + * 최근검색어결과를를(을) 등록한다. + * @param recentSrchwrd 최근검색어결과 정보가 담김 VO + * @throws Exception + */ + public void insertRecentSrchwrdResult(RecentSrchwrd recentSrchwrd) throws Exception { + insert("RecentSrchwrd.insertRecentSrchwrdResult", recentSrchwrd); + } + + /** + * 최근검색어결과 건별 삭제 + * @param recentSrchwrd 최근검색어결과 정보가 담김 VO + * @throws Exception + */ + public void deleteRecentSrchwrdResult(RecentSrchwrd recentSrchwrd) throws Exception { + delete("RecentSrchwrd.deleteRecentSrchwrdResult", recentSrchwrd); + } + + /** + * 최근검색어결과 관리별 삭제 + * @param recentSrchwrd 최근검색어결과 정보가 담김 VO + * @throws Exception + */ + public void deleteRecentSrchwrdResultAll(RecentSrchwrd recentSrchwrd) throws Exception { + delete("RecentSrchwrd.deleteRecentSrchwrdResultAll", recentSrchwrd); + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/rsm/web/AjaxXmlView.java b/src/main/java/egovframework/com/uss/ion/rsm/web/AjaxXmlView.java new file mode 100644 index 0000000..440ed60 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rsm/web/AjaxXmlView.java @@ -0,0 +1,47 @@ +package egovframework.com.uss.ion.rsm.web; + +import java.io.PrintWriter; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.web.servlet.view.AbstractView; + +import egovframework.com.cmm.EgovWebUtil; + +/** +* +*
    +* << 개정이력(Modification Information) >>
    +*
    +*   수정일      수정자           수정내용
    +*  ------- 	   --------    ---------------------------
    +*   2011.10.10  이기하		보안점검 조치(널포인트 역참조 방지)
    +* 
    +*/ + +public class AjaxXmlView extends AbstractView { + + @SuppressWarnings("rawtypes") + @Override + protected void renderMergedOutputModel(Map model, HttpServletRequest request, HttpServletResponse response) + throws Exception { + PrintWriter writer = null; + try { + response.setContentType("text/xml"); + response.setHeader("Cache-Control", "no-cache"); + response.setCharacterEncoding("UTF-8"); + + writer = response.getWriter(); + // writer.write((String) model.get("ajaxXml")); + writer.write(EgovWebUtil.clearXSSMaximum((String)model.get("ajaxXml")));//Request로 들어오는 Parameter만 XSS 처리 필요 + + } finally { + // 2011.10.10 보안점검 조치(널포인트 역참조 방지) + if (writer != null) { + writer.close(); + } + } + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/rsm/web/EgovRecentSrchwrdController.java b/src/main/java/egovframework/com/uss/ion/rsm/web/EgovRecentSrchwrdController.java new file mode 100644 index 0000000..2ac6d87 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rsm/web/EgovRecentSrchwrdController.java @@ -0,0 +1,394 @@ +package egovframework.com.uss.ion.rsm.web; + +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +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.springframework.web.servlet.ModelAndView; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import net.sourceforge.ajaxtags.xml.AjaxXmlBuilder; + +import egovframework.com.cmm.ComDefaultVO; +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.ion.rsm.service.EgovRecentSrchwrdService; +import egovframework.com.uss.ion.rsm.service.RecentSrchwrd; +import egovframework.com.utl.fcc.service.EgovStringUtil; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.psl.dataaccess.util.EgovMap; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +/** + * 최근검색어를 처리하는 Controller Class 구현 + * @author 공통서비스 장동한 + * @since 2009.07.03 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + *   2011.12.15  이기하          검색어 없을 시 미저장,
    + *                               사용자 검색여부 'N'일 때 자동검색 미사용 수정
    + *
    + * 
    + */ + +@Controller +public class EgovRecentSrchwrdController { + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovRecentSrchwrdController.class); + + @Autowired + private DefaultBeanValidator beanValidator; + + /** EgovMessageSource */ + @Resource(name = "egovMessageSource") + EgovMessageSource egovMessageSource; + + /** EgovRecentSrchwrdService */ + @Resource(name = "egovRecentSrchwrdService") + private EgovRecentSrchwrdService egovRecentSrchwrdService; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** + * 최근검색어관리 목록을 조회한다. + * @param searchVO + * @param commandMap + * @param recentSrchwrdVO + * @param model + * @return "egovframework/com/uss/ion/rsm/EgovRecentSrchwrdList" + * @throws Exception + */ + @SuppressWarnings("unused") + @IncludedInfo(name = "최근검색어 조회", order = 760, gid = 50) + @RequestMapping(value = "/uss/ion/rsm/listRecentSrchwrd.do") + public String egovRecentSrchwrdList( + @ModelAttribute("searchVO") RecentSrchwrd searchVO, @RequestParam Map commandMap, + RecentSrchwrd recentSrchwrdVO, ModelMap model) + throws Exception { + + String sSearchMode = commandMap.get("searchMode") == null ? "" : (String)commandMap.get("searchMode"); + + /** 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()); + + List reusltList = egovRecentSrchwrdService.selectRecentSrchwrdList(searchVO); + model.addAttribute("resultList", reusltList); + + model.addAttribute("searchKeyword", + commandMap.get("searchKeyword") == null ? "" : (String)commandMap.get("searchKeyword")); + model.addAttribute("searchCondition", + commandMap.get("searchCondition") == null ? "" : (String)commandMap.get("searchCondition")); + + int totCnt = egovRecentSrchwrdService.selectRecentSrchwrdListCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/uss/ion/rsm/EgovRecentSrchwrdList"; + } + + /** + * 최근검색어관리 목록을 상세조회 조회한다. + * @param searchVO + * @param recentSrchwrdVO + * @param commandMap + * @param model + * @return "govframework/com/uss/ion/rsm/EgovRecentSrchwrdDetail" + * @throws Exception + */ + @RequestMapping(value = "/uss/ion/rsm/detailRecentSrchwrd.do") + public String egovRecentSrchwrdDetail( + @ModelAttribute("searchVO") ComDefaultVO searchVO, + RecentSrchwrd recentSrchwrd, @RequestParam Map commandMap, + ModelMap model) throws Exception { + + String sLocationUrl = "egovframework/com/uss/ion/rsm/EgovRecentSrchwrdDetail"; + + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); + + if (sCmd.equals("del")) { + egovRecentSrchwrdService.deleteRecentSrchwrd(recentSrchwrd); + sLocationUrl = "redirect:/uss/ion/rsm/listRecentSrchwrd.do"; + } else { + RecentSrchwrd recentSrchwrdVO = egovRecentSrchwrdService.selectRecentSrchwrdDetail(recentSrchwrd); + model.addAttribute("recentSrchwrd", recentSrchwrdVO); + } + + return sLocationUrl; + } + + /** + * 최근검색어관리를 수정한다. + * @param searchVO + * @param commandMap + * @param recentSrchwrdVO + * @param bindingResult + * @param model + * @return "egovframework/com/uss/ion/rsm/EgovRecentSrchwrdUpdt" + * @throws Exception + */ + @RequestMapping(value = "/uss/ion/rsm/updtRecentSrchwrd.do") + public String egovRecentSrchwrdModify( + @RequestParam Map commandMap, + RecentSrchwrd recentSrchwrd, + BindingResult bindingResult, ModelMap model) throws Exception { + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + // 로그인 객체 선언 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + String sLocationUrl = "egovframework/com/uss/ion/rsm/EgovRecentSrchwrdUpdt"; + + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); + + if (sCmd.equals("save")) { + //서버 validate 체크 + beanValidator.validate(recentSrchwrd, bindingResult); + if (bindingResult.hasErrors()) { + return sLocationUrl; + } + //아이디 설정 + recentSrchwrd.setFrstRegisterId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + recentSrchwrd.setLastUpdusrId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + //저장 + egovRecentSrchwrdService.updateRecentSrchwrd(recentSrchwrd); + sLocationUrl = "redirect:/uss/ion/rsm/listRecentSrchwrd.do"; + } else { + RecentSrchwrd recentSrchwrdVO = egovRecentSrchwrdService.selectRecentSrchwrdDetail(recentSrchwrd); + model.addAttribute("recentSrchwrd", recentSrchwrdVO); + } + + return sLocationUrl; + } + + /** + * 최근검색어관리를 등록한다. + * @param searchVO + * @param commandMap + * @param recentSrchwrdVO + * @param bindingResult + * @param model + * @return + * "/uss/ion/rsm/EgovOnlinePollRegist" + * @throws Exception + */ + @RequestMapping(value = "/uss/ion/rsm/registRecentSrchwrd.do") + public String egovRecentSrchwrdRegist( + @RequestParam Map commandMap, + @ModelAttribute("recentSrchwrd") RecentSrchwrd recentSrchwrd, + BindingResult bindingResult, ModelMap model) throws Exception { + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + // 로그인 객체 선언 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + String sLocationUrl = "egovframework/com/uss/ion/rsm/EgovRecentSrchwrdRegist"; + + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); + LOGGER.info("cmd => {}", sCmd); + + if (sCmd.equals("save")) { + //서버 validate 체크 + beanValidator.validate(recentSrchwrd, bindingResult); + if (bindingResult.hasErrors()) { + return sLocationUrl; + } + //아이디 설정 + recentSrchwrd.setFrstRegisterId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + recentSrchwrd.setLastUpdusrId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + + //저장 + egovRecentSrchwrdService.insertRecentSrchwrd(recentSrchwrd); + sLocationUrl = "redirect:/uss/ion/rsm/listRecentSrchwrd.do"; + } + + return sLocationUrl; + } + + /** + * 최근검색어결과 목록을 조회한다. + * @param searchVO + * @param commandMap + * @param recentSrchwrdVO + * @param model + * @return "egovframework/com/uss/ion/rsm/EgovOnlinePollList" + * @throws Exception + */ + @SuppressWarnings("unused") + @RequestMapping(value = "/uss/ion/rsm/listRecentSrchwrdResult.do") + public String egovRecentSrchwrdResultList( + @ModelAttribute("searchVO") RecentSrchwrd searchVO, + @RequestParam Map commandMap, + ModelMap model) + throws Exception { + + String sSearchMode = commandMap.get("searchMode") == null ? "" : (String)commandMap.get("searchMode"); + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); + + /** 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()); + + //건별삭제 + if (sCmd.equals("del")) { + egovRecentSrchwrdService.deleteRecentSrchwrdResult(searchVO); + //관리별삭제 + } else if (sCmd.equals("delAll")) { + egovRecentSrchwrdService.deleteRecentSrchwrdResultAll(searchVO); + } + + List reusltList = egovRecentSrchwrdService.selectRecentSrchwrdResultList(searchVO); + model.addAttribute("resultList", reusltList); + + model.addAttribute("searchKeyword", + commandMap.get("searchKeyword") == null ? "" : (String)commandMap.get("searchKeyword")); + model.addAttribute("searchCondition", + commandMap.get("searchCondition") == null ? "" : (String)commandMap.get("searchCondition")); + + model.addAttribute("srchwrdManageId", + commandMap.get("srchwrdManageId") == null ? "" : (String)commandMap.get("srchwrdManageId")); + + int totCnt = egovRecentSrchwrdService.selectRecentSrchwrdResultListCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/uss/ion/rsm/EgovRecentSrchwrdResultList"; + } + + /** + * 최근검색어 결과를 조회한다. + * @param searchVO + * @param model + * @return "model" + * @throws Exception + */ + @RequestMapping(value = "/uss/ion/rsm/listRecentSrchwrdResultSerach.do") + protected ModelAndView egovRecentSrchwrdResultSerachList( + @RequestParam("searchKeyword") String searchKeyword, + RecentSrchwrd recentSrchwrd) throws Exception { + + recentSrchwrd.setQ(searchKeyword); + LOGGER.debug("recentSrchwrd : {}", recentSrchwrd); + + ModelAndView model = new ModelAndView(new AjaxXmlView()); + + RecentSrchwrd recentSrchwrdVO = egovRecentSrchwrdService.selectRecentSrchwrdDetail(recentSrchwrd); + + List reusltList = null; + + // 사용자검색여부 'Y'인 경우만 검색어 조회 + if (recentSrchwrdVO.getSrchwrdManageUseYn().equals("Y")) { + reusltList = egovRecentSrchwrdService.selectRecentSrchwrdResultInquire(recentSrchwrd); + } else { // 2012.11 KISA 보안조치 + reusltList = new ArrayList(); + } + + AjaxXmlBuilder ajaxXmlBuilder = new AjaxXmlBuilder(); + + EgovMap emResult = new EgovMap(); + for (int i = 0; i < reusltList.size(); i++) { + emResult = (EgovMap)reusltList.get(i); + ajaxXmlBuilder.addItem((String)emResult.get("recentSrchwrdNm"), (String)emResult.get("recentSrchwrdNm"), + false); + } + + model.addObject("ajaxXml", ajaxXmlBuilder.toString()); + + return model; + } + + /** + * 최근검색어를 등록한다. + * @param commandMap + * @param recentSrchwrd + * @param model + * @return + * @throws Exception + */ + @RequestMapping(value = "/uss/ion/rsm/registRecentSrchwrdResult.do") + public void egovRecentSrchwrdRegist( + @RequestParam Map commandMap, + HttpServletResponse response, + RecentSrchwrd recentSrchwrd) throws Exception { + + response.setHeader("Content-Type", "text/html;charset=utf-8"); + PrintWriter out = new PrintWriter(new OutputStreamWriter(response.getOutputStream(), "UTF-8")); + + LOGGER.debug("commandMap : {}", commandMap); + LOGGER.debug("recentSrchwrd : {}", recentSrchwrd); + + // 로그인 객체 선언 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + //아이디 설정 + recentSrchwrd.setFrstRegisterId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + recentSrchwrd.setLastUpdusrId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + + // System.out.println("recentSrchwrd.getSrchwrdNm() : "+ recentSrchwrd.getSrchwrdNm()); + + //검색어가 없을 시 미저장 + if (recentSrchwrd.getSrchwrdNm() != null && !recentSrchwrd.getSrchwrdNm().equals("")) { + egovRecentSrchwrdService.insertRecentSrchwrdResult(recentSrchwrd); + } + + out.print("Success"); + + out.flush(); + + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/rsn/service/EgovRssService.java b/src/main/java/egovframework/com/uss/ion/rsn/service/EgovRssService.java new file mode 100644 index 0000000..d46d889 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rsn/service/EgovRssService.java @@ -0,0 +1,55 @@ +package egovframework.com.uss.ion.rsn.service; + +import java.util.List; +import java.util.Map; +/** + * RSS서비스를 처리하는 Service Class 구현 + * @author 공통서비스 장동한 + * @since 2010.06.16 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + *
    + * 
    + */ +public interface EgovRssService { + + /** + * RSS서비스 테이블을 조회 한다. + * @param param -조회할 정보가 담긴 객체 + * @return List -조회한목록이담긴List + * @throws Exception + */ + public List selectRssTagServiceTable(Map param) throws Exception; + + /** + * RSS서비스 목록을 조회한다. + * @param rssInfo -조회할 정보가 담긴 객체 + * @return List -조회한목록이담긴List + * @throws Exception + */ + public List selectRssTagServiceList(RssInfo rssInfo) throws Exception; + + /** + * RSS서비스를(을) 목록 전체 건수를(을) 조회한다. + * @param rssInfo -조회할 정보가 담긴 객체 + * @return -조회한건수가담긴Integer + * @throws Exception + */ + public int selectRssTagServiceListCnt(RssInfo rssInfo) throws Exception; + + /** + * RSS서비스를(을) 상세조회 한다. + * @param rssInfo -조회할 정보가 담긴 객체 + * @return int -조회한건수가담긴Integer + * @throws Exception + */ + public Map selectRssTagServiceDetail(RssInfo rssInfo) throws Exception; + +} diff --git a/src/main/java/egovframework/com/uss/ion/rsn/service/RssInfo.java b/src/main/java/egovframework/com/uss/ion/rsn/service/RssInfo.java new file mode 100644 index 0000000..2bfeff2 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rsn/service/RssInfo.java @@ -0,0 +1,315 @@ +package egovframework.com.uss.ion.rsn.service; + +import java.io.Serializable; + +import egovframework.com.cmm.ComDefaultVO; + +/** + * RSS서비스 Model and VO Class 구현 + * @author 공통서비스 장동한 + * @since 2010.06.16 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + * 
    + * 
    + */ +@SuppressWarnings("serial") +public class RssInfo extends ComDefaultVO implements Serializable{ + + /** RSS태그관리 아이디 */ + private String rssId; + + /** 서비스명 */ + private String trgetSvcNm; + + /** 서비스TABLE */ + private String trgetSvcTable; + + /** 헤더 TITLE */ + private String hderTitle; + + /** 헤더 LINK */ + private String hderLink; + + /** 헤더 DESCRIPTION */ + private String hderDescription; + + /** 헤더 TAG */ + private String hderTag; + + /** 헤더 ETC */ + private String hderEtc; + + /** 본문 TITLE */ + private String bdtTitle; + + /** 본문 LINK */ + private String bdtLink; + + /** 본문 DESCRIPTION */ + private String bdtDescription; + + /** 본문 TAG */ + private String bdtTag; + + /** 본문 ETC */ + private String bdtEtc; + + /** 최초등록시점 */ + private String frstRegisterPnttm; + + /** 최초등록아이디 */ + private String frstRegisterId; + + /** 최종수정일 */ + private String lastUpdusrPnttm; + + /** 최종수정자 아이디 */ + private String lastUpdusrId; + + /** + * @return the rssId + */ + public String getRssId() { + return rssId; + } + + /** + * @param rssId the rssId to set + */ + public void setRssId(String rssId) { + this.rssId = rssId; + } + + /** + * @return the trgetSvcNm + */ + public String getTrgetSvcNm() { + return trgetSvcNm; + } + + /** + * @param trgetSvcNm the trgetSvcNm to set + */ + public void setTrgetSvcNm(String trgetSvcNm) { + this.trgetSvcNm = trgetSvcNm; + } + + /** + * @return the trgetSvcTable + */ + public String getTrgetSvcTable() { + return trgetSvcTable; + } + + /** + * @param trgetSvcTable the trgetSvcTable to set + */ + public void setTrgetSvcTable(String trgetSvcTable) { + this.trgetSvcTable = trgetSvcTable; + } + + /** + * @return the hderTitle + */ + public String getHderTitle() { + return hderTitle; + } + + /** + * @param hderTitle the hderTitle to set + */ + public void setHderTitle(String hderTitle) { + this.hderTitle = hderTitle; + } + + /** + * @return the hderLink + */ + public String getHderLink() { + return hderLink; + } + + /** + * @param hderLink the hderLink to set + */ + public void setHderLink(String hderLink) { + this.hderLink = hderLink; + } + + /** + * @return the hderDescription + */ + public String getHderDescription() { + return hderDescription; + } + + /** + * @param hderDescription the hderDescription to set + */ + public void setHderDescription(String hderDescription) { + this.hderDescription = hderDescription; + } + + /** + * @return the hderTag + */ + public String getHderTag() { + return hderTag; + } + + /** + * @param hderTag the hderTag to set + */ + public void setHderTag(String hderTag) { + this.hderTag = hderTag; + } + + /** + * @return the hderEtc + */ + public String getHderEtc() { + return hderEtc; + } + + /** + * @param hderEtc the hderEtc to set + */ + public void setHderEtc(String hderEtc) { + this.hderEtc = hderEtc; + } + + /** + * @return the bdtTitle + */ + public String getBdtTitle() { + return bdtTitle; + } + + /** + * @param bdtTitle the bdtTitle to set + */ + public void setBdtTitle(String bdtTitle) { + this.bdtTitle = bdtTitle; + } + + /** + * @return the bdtLink + */ + public String getBdtLink() { + return bdtLink; + } + + /** + * @param bdtLink the bdtLink to set + */ + public void setBdtLink(String bdtLink) { + this.bdtLink = bdtLink; + } + + /** + * @return the bdtDescription + */ + public String getBdtDescription() { + return bdtDescription; + } + + /** + * @param bdtDescription the bdtDescription to set + */ + public void setBdtDescription(String bdtDescription) { + this.bdtDescription = bdtDescription; + } + + /** + * @return the bdtTag + */ + public String getBdtTag() { + return bdtTag; + } + + /** + * @param bdtTag the bdtTag to set + */ + public void setBdtTag(String bdtTag) { + this.bdtTag = bdtTag; + } + + /** + * @return the bdtEtc + */ + public String getBdtEtc() { + return bdtEtc; + } + + /** + * @param bdtEtc the bdtEtc to set + */ + public void setBdtEtc(String bdtEtc) { + this.bdtEtc = bdtEtc; + } + + /** + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * @param frstRegisterPnttm the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * @param frstRegisterId the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * @param lastUpdusrPnttm the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * @param lastUpdusrId the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + + +} diff --git a/src/main/java/egovframework/com/uss/ion/rsn/service/impl/EgovRssServiceImpl.java b/src/main/java/egovframework/com/uss/ion/rsn/service/impl/EgovRssServiceImpl.java new file mode 100644 index 0000000..162f5ff --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rsn/service/impl/EgovRssServiceImpl.java @@ -0,0 +1,130 @@ +package egovframework.com.uss.ion.rsn.service.impl; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import egovframework.com.uss.ion.rsn.service.EgovRssService; +import egovframework.com.uss.ion.rsn.service.RssInfo; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; +/** + * RSS서비스를 처리하는 ServiceImpl Class 구현 + * @author 공통서비스 장동한 + * @since 2010.06.16 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + *
    + * 
    + */ +@Service("egovRssService") +public class EgovRssServiceImpl extends EgovAbstractServiceImpl + implements EgovRssService { + + @Resource(name = "rssInfoDao") + private RssDao dao; + + /** + * RSS서비스 테이블을 조회 한다. + * @param param -조회할 정보가 담긴 객체 + * @return List -조회한목록이담긴List + * @throws Exception + */ + @SuppressWarnings("unchecked") + @Override + public List> selectRssTagServiceTable(Map param) throws Exception{ + + List listResult = dao.selectRssTagServiceTable(param); + List> listReturn = new ArrayList>(); + + String sBDT_TITLE = (String)param.get("BDT_TITLE"); + String sBDT_LINK = (String)param.get("BDT_LINK"); + String sBDT_DESCRIPTION = (String)param.get("BDT_DESCRIPTION"); + String sBDT_TAG = (String)param.get("BDT_TAG"); + String sBDT_ETC = (String)param.get("BDT_ETC"); + + Map mapRow; + + for(int i=0;i < listResult.size();i++){ + + mapRow = (Map)listResult.get(i); + //null 처리 + String sM_BDT_TITLE = sBDT_TITLE == null ? "": sBDT_TITLE; + String sM_BDT_LINK = sBDT_LINK == null ? "": sBDT_LINK; + String sM_BDT_DESCRIPTION = sBDT_DESCRIPTION == null ? "": sBDT_DESCRIPTION; + String sM_BDT_TAG = sBDT_TAG == null ? "": sBDT_TAG; + String sM_BDT_ETC = sBDT_ETC == null ? "": sBDT_ETC; + + Object[] Keys = mapRow.keySet().toArray(); + + for(Object key : Keys){ + if(mapRow.get(key) instanceof String ){ + //null 처리 + if(mapRow.get(key) != null && key != null){ + sM_BDT_TITLE=sM_BDT_TITLE.replaceAll("#"+key+"#", mapRow.get(key)); + sM_BDT_LINK=sM_BDT_LINK.replaceAll("#"+key+"#", mapRow.get(key)); + sM_BDT_DESCRIPTION=sM_BDT_DESCRIPTION.replaceAll("#"+key+"#", mapRow.get(key)); + sM_BDT_TAG=sM_BDT_TAG.replaceAll("#"+key+"#", mapRow.get(key)); + sM_BDT_ETC=sM_BDT_ETC.replaceAll("#"+key+"#", mapRow.get(key)); + } + } + } + + mapRow.put("BDT_TITLE", sM_BDT_TITLE); + mapRow.put("BDT_LINK", sM_BDT_LINK); + mapRow.put("BDT_DESCRIPTION", sM_BDT_DESCRIPTION); + mapRow.put("BDT_TAG", sM_BDT_TAG); + mapRow.put("BDT_ETC", sM_BDT_ETC); + + listReturn.add(mapRow); + + } + + return listReturn; + } + + /** + * RSS서비스를(을) 목록을 조회 한다. + * @param rssInfo -조회할 정보가 담긴 객체 + * @return List -조회한목록이담긴List + * @throws Exception + */ + @Override + public List selectRssTagServiceList(RssInfo rssInfo) throws Exception { + return dao.selectRssTagServiceList(rssInfo); + } + + /** + * RSS서비스를(을) 목록 전체 건수를(을) 조회한다. + * @param rssInfo -조회할 정보가 담긴 객체 + * @return int -조회한건수가담긴Integer + * @throws Exception + */ + @Override + public int selectRssTagServiceListCnt(RssInfo rssInfo) throws Exception { + return dao.selectRssTagServiceListCnt(rssInfo); + } + + /** + * RSS서비스를(을) 상세조회 한다. + * @param rssInfo -조회할 정보가 담긴 객체 + * @return Map -조회한정보가담긴Map + * @throws Exception + */ + @Override + public Map selectRssTagServiceDetail(RssInfo rssInfo) throws Exception { + return dao.selectRssTagServiceDetail(rssInfo); + } + + + +} diff --git a/src/main/java/egovframework/com/uss/ion/rsn/service/impl/RssDao.java b/src/main/java/egovframework/com/uss/ion/rsn/service/impl/RssDao.java new file mode 100644 index 0000000..cd4c6b1 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rsn/service/impl/RssDao.java @@ -0,0 +1,69 @@ +package egovframework.com.uss.ion.rsn.service.impl; + +import java.util.List; +import java.util.Map; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.ion.rsn.service.RssInfo; + +import org.springframework.stereotype.Repository; +/** + * RSS서비스를 처리하는 Dao Class 구현 + * @author 공통콤포넌트 장동한 + * @since 2010.06.16 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + *
    + * 
    + */ +@Repository("rssInfoDao") +public class RssDao extends EgovComAbstractDAO { + + /** + * RSS서비스 테이블을 조회 한다. + * @param param -조회할 정보가 담긴 객체 + * @return List -조회한목록이담긴List + * @throws Exception + */ + public List selectRssTagServiceTable(Map param) throws Exception { + return selectList("RssTagService.selectRssTagServiceTable",param); + } + + /** + * RSS서비스를(을) 목록을 한다. + * @param rssInfo -조회할 정보가 담긴 객체 + * @return List + * @throws Exception + */ + public List selectRssTagServiceList(RssInfo rssInfo) throws Exception { + return selectList("RssTagService.selectRssTagService",rssInfo); + } + + /** + * RSS서비스를(을) 목록 전체 건수를(을) 조회한다. + * @param rssInfo -조회할 정보가 담긴 객체 + * @return int -조회한건수가담긴Integer + * @throws Exception + */ + public int selectRssTagServiceListCnt(RssInfo rssInfo) throws Exception { + return (Integer)selectOne("RssTagService.selectRssTagServiceCnt", rssInfo); + } + + /** + * RSS서비스를(을) 상세조회 한다. + * @param rssInfo -조회할 정보가 담긴 객체 + * @return Map -조회한정보가담긴Map + * @throws Exception + */ + public Map selectRssTagServiceDetail(RssInfo rssInfo) throws Exception { + return (Map)selectOne("RssTagService.selectRssTagServiceDetail", rssInfo); + } + + + +} diff --git a/src/main/java/egovframework/com/uss/ion/rsn/web/EgovRssController.java b/src/main/java/egovframework/com/uss/ion/rsn/web/EgovRssController.java new file mode 100644 index 0000000..122149f --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rsn/web/EgovRssController.java @@ -0,0 +1,133 @@ +package egovframework.com.uss.ion.rsn.web; + +import java.util.List; +import java.util.Map; + +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.EgovWebUtil; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.uss.ion.rsn.service.EgovRssService; +import egovframework.com.uss.ion.rsn.service.RssInfo; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +import javax.annotation.Resource; + +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; +/** + * RSS서비스를 처리하는 Controller Class 구현 + * @author 공통서비스 장동한 + * @since 2010.06.16 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2010.06.16  장동한          최초 생성
    + *
    + * 
    + */ +@Controller +public class EgovRssController { + + @Autowired + private DefaultBeanValidator beanValidator; + + /** EgovMessageSource */ + @Resource(name = "egovMessageSource") + EgovMessageSource egovMessageSource; + + /** egovOnlinePollService */ + @Resource(name = "egovRssService") + private EgovRssService egovRssService; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** + * RSS서비스 목록을 조회한다. + * @param searchVO -검색정보가 담긴 객체 + * @param commandMap -Request Variable + * @param -RSS서비스 객체 + * @param model -Spring 제공하는 ModelMap + * @return String -리턴 URL + * @throws Exception + */ + @IncludedInfo(name="RSS태그서비스", order = 822 ,gid = 50) + @RequestMapping(value = "/uss/ion/rsn/listRssTagService.do") + public String EgovRssTagServiceList( + @ModelAttribute("searchVO") RssInfo searchVO, + @RequestParam Map commandMap, + RssInfo rssInfo, ModelMap model) + throws Exception { + + /** 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()); + + List reusltList = egovRssService.selectRssTagServiceList(searchVO); + model.addAttribute("resultList", reusltList); + + model.addAttribute("searchKeyword", commandMap.get("searchKeyword") == null ? "" : (String) commandMap.get("searchKeyword")); + model.addAttribute("searchCondition", commandMap.get("searchCondition") == null ? "" : (String) commandMap.get("searchCondition")); + + int totCnt = egovRssService.selectRssTagServiceListCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/uss/ion/rsn/EgovRssTagServiceList"; + + } + + /** + * RSS서비스 목록을 상세조회 조회한다. + * @param rssInfo -RSS서비스 객체 + * @param commandMap -Request Variable + * @param model -Spring 제공하는 ModelMap + * @return String -리턴 URL + * @throws Exception + */ + @SuppressWarnings("unchecked") + @RequestMapping(value = "/uss/ion/rsn/detailRssTagService.do") + public String EgovRssTagServiceDetail( + RssInfo rssInfo, + @RequestParam Map commandMap, + ModelMap model) throws Exception { + + String sRssId = commandMap.get("rssId") == null ? "" : (String) commandMap.get("rssId"); + + if(!sRssId.equals("")){ + + Map mapRssInfo = (Map) egovRssService.selectRssTagServiceDetail(rssInfo); + model.addAttribute("mapRssInfo",mapRssInfo); + + mapRssInfo.put("TRGET_SVC_TABLE", EgovWebUtil.removeSQLInjectionRisk(mapRssInfo.get("TRGET_SVC_TABLE"))); // 2012.11 KISA 보안조치 + + model.addAttribute("mapRssInfoList", egovRssService.selectRssTagServiceTable(mapRssInfo)); + + } + + return "egovframework/com/uss/ion/rsn/EgovRssTagService"; + } + + +} diff --git a/src/main/java/egovframework/com/uss/ion/rss/service/EgovRssTagManageService.java b/src/main/java/egovframework/com/uss/ion/rss/service/EgovRssTagManageService.java new file mode 100644 index 0000000..f68a7ed --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rss/service/EgovRssTagManageService.java @@ -0,0 +1,83 @@ +package egovframework.com.uss.ion.rss.service; + +import java.util.List; +import java.util.Map; +/** + * RSS태그관리를 처리하는 Service Class 구현 + * @author 공통서비스 장동한 + * @since 2010.06.16 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + *
    + * 
    + */ +public interface EgovRssTagManageService { + + /** + * JDBC 테이블 목록을조회한다. + * @return List + * @throws Exception + */ + public List selectRssTagManageTableList() throws Exception; + + /** + * JDBC 테이블 컬럼 목록을 조회한다. + * @param map - 컬럼조회정보 + * @return List + * @throws Exception + */ + public List selectRssTagManageTableColumnList(Map map) throws Exception; + + /** + * RSS태그관리 목록을 조회한다. + * @param rssManage -조회할 정보가 담긴 객체 + * @return List + * @throws Exception + */ + public List selectRssTagManageList(RssManage rssManage) throws Exception; + + /** + * RSS태그관리를(을) 목록 전체 건수를(을) 조회한다. + * @param rssManage -조회할 정보가 담긴 객체 + * @return int -조회한건수가담긴Integer + * @throws Exception + */ + public int selectRssTagManageListCnt(RssManage rssManage) throws Exception; + + /** + * RSS태그관리를(을) 상세조회 한다. + * @param rssManage -RSS태그관리 정보 담김 객체 + * @return List + * @throws Exception + */ + public RssManage selectRssTagManageDetail(RssManage rssManage) throws Exception; + + /** + * RSS태그관리를(을) 등록한다. + * @param rssManage -RSS태그관리 정보 담김 객체 + * @throws Exception + */ + void insertRssTagManage(RssManage rssManage) throws Exception; + + /** + * RSS태그관리를(을) 수정한다. + * @param rssManage -RSS태그관리 정보 담김 객체 + * @throws Exception + */ + void updateRssTagManage(RssManage rssManage) throws Exception; + + /** + * RSS태그관리를(을) 삭제한다. + * @param rssManage -RSS태그관리 정보 담김 VO + * @throws Exception + */ + void deleteRssTagManage(RssManage rssManage) throws Exception; + +} diff --git a/src/main/java/egovframework/com/uss/ion/rss/service/RssManage.java b/src/main/java/egovframework/com/uss/ion/rss/service/RssManage.java new file mode 100644 index 0000000..8bec337 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rss/service/RssManage.java @@ -0,0 +1,333 @@ +package egovframework.com.uss.ion.rss.service; + +import java.io.Serializable; + +import egovframework.com.cmm.ComDefaultVO; + +/** + * RSS태그관리 Model and VO Class 구현 + * @author 공통서비스 장동한 + * @since 2010.06.16 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + * 
    + * 
    + */ +@SuppressWarnings("serial") +public class RssManage extends ComDefaultVO implements Serializable{ + + /** RSS태그관리 아이디 */ + private String rssId; + + /** 대상서비스명 */ + private String trgetSvcNm; + + /** 대상테이블명 */ + private String trgetSvcTable; + + /** 대상서비스목록갯수 */ + private int trgetSvcListCo; + + /** 헤더 TITLE */ + private String hderTitle; + + /** 헤더 LINK */ + private String hderLink; + + /** 헤더 DESCRIPTION */ + private String hderDescription; + + /** 헤더 TAG */ + private String hderTag; + + /** 헤더 ETC */ + private String hderEtc; + + /** 본문 TITLE */ + private String bdtTitle; + + /** 본문 LINK */ + private String bdtLink; + + /** 본문 DESCRIPTION */ + private String bdtDescription; + + /** 본문 TAG */ + private String bdtTag; + + /** 본문 ETC */ + private String bdtEtc; + + /** 최초등록시점 */ + private String frstRegisterPnttm; + + /** 최초등록아이디 */ + private String frstRegisterId; + + /** 최종수정일 */ + private String lastUpdusrPnttm; + + /** 최종수정자 아이디 */ + private String lastUpdusrId; + + /** + * @return the rssId + */ + public String getRssId() { + return rssId; + } + + /** + * @param rssId the rssId to set + */ + public void setRssId(String rssId) { + this.rssId = rssId; + } + + /** + * @return the trgetSvcNm + */ + public String getTrgetSvcNm() { + return trgetSvcNm; + } + + /** + * @param trgetSvcNm the trgetSvcNm to set + */ + public void setTrgetSvcNm(String trgetSvcNm) { + this.trgetSvcNm = trgetSvcNm; + } + + /** + * @return the trgetSvcTable + */ + public String getTrgetSvcTable() { + return trgetSvcTable; + } + + /** + * @param trgetSvcTable the trgetSvcTable to set + */ + public void setTrgetSvcTable(String trgetSvcTable) { + this.trgetSvcTable = trgetSvcTable; + } + + /** + * @return the trgetSvcListCo + */ + public int getTrgetSvcListCo() { + return trgetSvcListCo; + } + + /** + * @param trgetSvcListCo the trgetSvcListCo to set + */ + public void setTrgetSvcListCo(int trgetSvcListCo) { + this.trgetSvcListCo = trgetSvcListCo; + } + + /** + * @return the hderTitle + */ + public String getHderTitle() { + return hderTitle; + } + + /** + * @param hderTitle the hderTitle to set + */ + public void setHderTitle(String hderTitle) { + this.hderTitle = hderTitle; + } + + /** + * @return the hderLink + */ + public String getHderLink() { + return hderLink; + } + + /** + * @param hderLink the hderLink to set + */ + public void setHderLink(String hderLink) { + this.hderLink = hderLink; + } + + /** + * @return the hderDescription + */ + public String getHderDescription() { + return hderDescription; + } + + /** + * @param hderDescription the hderDescription to set + */ + public void setHderDescription(String hderDescription) { + this.hderDescription = hderDescription; + } + + /** + * @return the hderTag + */ + public String getHderTag() { + return hderTag; + } + + /** + * @param hderTag the hderTag to set + */ + public void setHderTag(String hderTag) { + this.hderTag = hderTag; + } + + /** + * @return the hderEtc + */ + public String getHderEtc() { + return hderEtc; + } + + /** + * @param hderEtc the hderEtc to set + */ + public void setHderEtc(String hderEtc) { + this.hderEtc = hderEtc; + } + + /** + * @return the bdtTitle + */ + public String getBdtTitle() { + return bdtTitle; + } + + /** + * @param bdtTitle the bdtTitle to set + */ + public void setBdtTitle(String bdtTitle) { + this.bdtTitle = bdtTitle; + } + + /** + * @return the bdtLink + */ + public String getBdtLink() { + return bdtLink; + } + + /** + * @param bdtLink the bdtLink to set + */ + public void setBdtLink(String bdtLink) { + this.bdtLink = bdtLink; + } + + /** + * @return the bdtDescription + */ + public String getBdtDescription() { + return bdtDescription; + } + + /** + * @param bdtDescription the bdtDescription to set + */ + public void setBdtDescription(String bdtDescription) { + this.bdtDescription = bdtDescription; + } + + /** + * @return the bdtTag + */ + public String getBdtTag() { + return bdtTag; + } + + /** + * @param bdtTag the bdtTag to set + */ + public void setBdtTag(String bdtTag) { + this.bdtTag = bdtTag; + } + + /** + * @return the bdtEtc + */ + public String getBdtEtc() { + return bdtEtc; + } + + /** + * @param bdtEtc the bdtEtc to set + */ + public void setBdtEtc(String bdtEtc) { + this.bdtEtc = bdtEtc; + } + + /** + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * @param frstRegisterPnttm the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * @param frstRegisterId the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * @param lastUpdusrPnttm the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * @param lastUpdusrId the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + + + +} diff --git a/src/main/java/egovframework/com/uss/ion/rss/service/impl/EgovRssTagManageServiceImpl.java b/src/main/java/egovframework/com/uss/ion/rss/service/impl/EgovRssTagManageServiceImpl.java new file mode 100644 index 0000000..f9edb56 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rss/service/impl/EgovRssTagManageServiceImpl.java @@ -0,0 +1,127 @@ +package egovframework.com.uss.ion.rss.service.impl; + +import java.util.List; +import java.util.Map; + +import egovframework.com.uss.ion.rss.service.EgovRssTagManageService; +import egovframework.com.uss.ion.rss.service.RssManage; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; +/** + * RSS태그관리를 처리하는 ServiceImpl Class 구현 + * @author 공통서비스 장동한 + * @since 2010.06.16 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + *
    + * 
    + */ +@Service("egovRssManageService") +public class EgovRssTagManageServiceImpl extends EgovAbstractServiceImpl + implements EgovRssTagManageService { + + /* RSS관리 DAO */ + @Resource(name = "rssManageDao") + private RssTagManageDao dao; + + /* RSS ID Generator Service */ + @Resource(name = "egovRssTagManageIdGnrService") + private EgovIdGnrService idgenService; + + /** + * JDBC 테이블 목록을조회한다. + * @return List -조회한목록이담긴List + * @throws Exception + */ + @Override + public List selectRssTagManageTableList() throws Exception { + return dao.selectRssTagManageTableList(); + } + /** + * JDBC 테이블 컬럼 목록을 조회한다. + * @param map - 컬럼조회정보 + * @return List -조회한목록이담긴List + * @throws Exception + */ + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public List selectRssTagManageTableColumnList(Map map) throws Exception { + return dao.selectRssTagManageTableColumnList(map); + } + /** + * RSS태그관리를(을) 목록을 조회 한다. + * @param rssManage -조회할 정보가 담긴 객체 + * @return List -조회한목록이담긴List + * @throws Exception + */ + @Override + public List selectRssTagManageList(RssManage rssManage) throws Exception { + return dao.selectRssTagManageList(rssManage); + } + + /** + * RSS태그관리를(을) 목록 전체 건수를(을) 조회한다. + * @param searchVO -조회할 정보가 담긴 객체 + * @return int -조회한건수가담긴Integer + * @throws Exception + */ + @Override + public int selectRssTagManageListCnt(RssManage rssManage) throws Exception { + return dao.selectRssTagManageListCnt(rssManage); + } + + /** + * RSS태그관리를(을) 상세조회 한다. + * @param searchVO -조회할 정보가 담긴 객체 + * @return List -조회한목록이담긴List + * @throws Exception + */ + @Override + public RssManage selectRssTagManageDetail(RssManage rssManage) throws Exception { + return dao.selectRssTagManageDetail(rssManage); + } + + /** + * RSS태그관리를(을) 등록한다. + * @param rssManage -RSS태그관리 정보가 담긴 객체 + * @throws Exception + */ + @Override + public void insertRssTagManage(RssManage rssManage)throws Exception { + + rssManage.setRssId(idgenService.getNextStringId()); + + dao.insertRssTagManage(rssManage); + } + + /** + * RSS태그관리를(을) 수정한다. + * @param rssManage -RSS태그관리 정보가 담긴 객체 + * @throws Exception + */ + @Override + public void updateRssTagManage(RssManage rssManage) throws Exception { + dao.updateRssTagManage(rssManage); + } + + /** + * RSS태그관리를(을) 삭제한다. + * @param rssManage -RSS태그관리 정보가 담긴 객체 + * @throws Exception + */ + @Override + public void deleteRssTagManage(RssManage rssManage) throws Exception { + dao.deleteRssTagManage(rssManage); + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/rss/service/impl/RssTagManageDao.java b/src/main/java/egovframework/com/uss/ion/rss/service/impl/RssTagManageDao.java new file mode 100644 index 0000000..204e8b3 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rss/service/impl/RssTagManageDao.java @@ -0,0 +1,210 @@ +package egovframework.com.uss.ion.rss.service.impl; + +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Repository; + +import egovframework.com.cmm.ComDefaultCodeVO; +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.cmm.util.EgovResourceCloseHelper; +import egovframework.com.uss.ion.rss.service.RssManage; +import egovframework.com.utl.fcc.service.EgovStringUtil; + +/** + * RSS태그관리를 처리하는 Dao Class 구현 + * @author 공통콤포넌트 장동한 + * @since 2010.06.16 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + *   2011.10.18  서준식          Altibase DB 처리를 위한 코드 추가
    + *   2018.10.22  신용호          connection close 관련 수정
    + *   2018.12.05  신용호          selectRssTagManageTableList(),selectRssTagManageTableColumnList() 테이블 목록 화이트리스트 제약
    + *   2019.05.10  신용호          WhiteList 기능 보완
    + * 
    + */ +@Repository("rssManageDao") +public class RssTagManageDao extends EgovComAbstractDAO { + + // RSS에 허용할 테이블 목록 - context-whitelist.xml에서 관리 + @Resource(name = "egovRSSWhitelist") + protected List tableWhiteList; + + /** + * JDBC 테이블 목록을조회한다. + * @return List -조회한목록이담긴List + * @throws Exception + */ + public List selectRssTagManageTableList() throws Exception { + + String TABLE_NAME = "TABLE_NAME"; + String TABLE_SCHEMA = "TABLE_SCHEM"; + String[] TABLE_AND_VIEW_TYPES = { "TABLE", "VIEW" }; + ArrayList arrListResult = new ArrayList(); + + Connection conn = null; + DatabaseMetaData dbmd = null; + ResultSet tables = null; + + try { + + conn = getSqlSession().getConnection(); // getSqlMapClientTemplate().getDataSource().getConnection(); + dbmd = conn.getMetaData(); + + tables = dbmd.getTables(null, null, null, TABLE_AND_VIEW_TYPES); + while (tables.next()) { + + // KISA 보안약점 조치 (2018-12-05, 신용호) + String tableName = tables.getString(TABLE_NAME); + if (tableName==null) tableName=""; + // WhiteList 기능 보완 (2019-05-10, 신용호) + if ( tableWhiteList.contains(tableName.toLowerCase()) == true ) { + ComDefaultCodeVO codeVO = new ComDefaultCodeVO(); + codeVO.setCode(tables.getString(TABLE_NAME)); + codeVO.setCodeNm(tables.getString(TABLE_SCHEMA)); + arrListResult.add((ComDefaultCodeVO) codeVO); + } + } + + } finally { + //EgovResourceCloseHelper.closeDBObjects(tables, conn); + EgovResourceCloseHelper.closeDBObjects(tables); + } + + return arrListResult; + + } + + /** + * JDBC 테이블 컬럼 목록을 조회한다. + * @param map - 컬럼조회정보 + * @return List -조회한목록이담긴List + * @throws Exception + */ + public List> selectRssTagManageTableColumnList(Map map) throws Exception { + + String sTableName = (String) map.get("tableName"); + String sDbType = (String) map.get("dbType"); + String sSQL = ""; + ArrayList> arrListResult = new ArrayList>(); + + Connection conn = null; + PreparedStatement st = null; + ResultSet rs = null; + + try { + conn = getSqlSession().getConnection(); //getSqlMapClientTemplate().getDataSource().getConnection(); + + // KISA 보안약점 조치 (2018-12-05, 신용호) + // WhiteList 기능 보완 (2019-05-10, 신용호) + if ( tableWhiteList.contains(sTableName.toLowerCase()) == true ) { + + if ( sDbType.equals("mysql") || sDbType.equals("maria") || sDbType.equals("postgres") ) { + sSQL = "SELECT * FROM (sTableName) LIMIT 1 "; + sSQL = sSQL.replace("(sTableName)",sTableName); + + } else { + sSQL = "SELECT * FROM (sTableName) WHERE ROWNUM <= 1 "; + sSQL = sSQL.replace("(sTableName)",sTableName); + } + + if (!sDbType.equals("altibase")) {//2011.10.18 + st = conn.prepareStatement(sSQL, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); + } else { + st = conn.prepareStatement(sSQL); + } + + rs = st.executeQuery(); + + ResultSetMetaData rsMetaData = rs.getMetaData(); + int numberOfColumns = rsMetaData == null ? 0 : rsMetaData.getColumnCount(); + + for (int i = 1; i < numberOfColumns + 1; i++) { + Map hmResult = new HashMap(); + hmResult.put("code", (String) (rsMetaData == null ? "" : EgovStringUtil.isNullToString(rsMetaData.getTableName(i))) ); + hmResult.put("codeNm", (String) (rsMetaData == null ? "" : EgovStringUtil.isNullToString(rsMetaData.getColumnName(i))) ); + + arrListResult.add(hmResult); + } + } + } finally { + //EgovResourceCloseHelper.closeDBObjects(rs, st, conn); + EgovResourceCloseHelper.closeDBObjects(rs, st); + } + + return arrListResult; + } + + /** + * RSS태그관리를(을) 목록을 한다. + * @param rssManage -조회할 정보가 담긴 객체 + * @return -조회한목록이담긴List + * @throws Exception + */ + public List selectRssTagManageList(RssManage rssManage) throws Exception { + return (List) selectList("RssTagManage.selectRssTagManage", rssManage); + + } + + /** + * RSS태그관리를(을) 목록 전체 건수를(을) 조회한다. + * @param rssManage -조회할 정보가 담긴 객체 + * @return -조회한건수가담긴Integer + * @throws Exception + */ + public int selectRssTagManageListCnt(RssManage rssManage) throws Exception { + return (Integer) selectOne("RssTagManage.selectRssTagManageCnt", rssManage); + } + + /** + * RSS태그관리를(을) 상세조회 한다. + * @param rssManage -RSS태그관리 정보가 담김 객체 + * @return RssManage -RSS태그관리 정보가 담김 객체 + * @throws Exception + */ + public RssManage selectRssTagManageDetail(RssManage rssManage) throws Exception { + return (RssManage) selectOne("RssTagManage.selectRssTagManageDetail", rssManage); + } + + /** + * RSS태그관리를(을) 등록한다. + * @param rssManage -RSS태그관리 정보가 담김 객체 + * @throws Exception + */ + public void insertRssTagManage(RssManage rssManage) throws Exception { + insert("RssTagManage.insertRssTagManage", rssManage); + } + + /** + * RSS태그관리를(을) 수정한다. + * @param rssManage -RSS태그관리 정보가 담김 객체 + * @throws Exception + */ + public void updateRssTagManage(RssManage rssManage) throws Exception { + update("RssTagManage.updateRssTagManage", rssManage); + } + + /** + * RSS태그관리를(을) 삭제한다. + * @param rssManage -RSS태그관리 정보가 담김 객체 + * @throws Exception + */ + public void deleteRssTagManage(RssManage rssManage) throws Exception { + delete("RssTagManage.deleteRssTagManage", rssManage); + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/rss/web/EgovRssTagManageController.java b/src/main/java/egovframework/com/uss/ion/rss/web/EgovRssTagManageController.java new file mode 100644 index 0000000..9b433e7 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rss/web/EgovRssTagManageController.java @@ -0,0 +1,306 @@ +package egovframework.com.uss.ion.rss.web; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +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 egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.ion.rss.service.EgovRssTagManageService; +import egovframework.com.uss.ion.rss.service.RssManage; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +/** + * RSS태그관리를 처리하는 Controller Class 구현 + * @author 공통서비스 장동한 + * @since 2010.06.16 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2010.06.16  장동한          최초 생성
    + *   2011.8.26	정진오			IncludedInfo annotation 추가
    + *
    + * 
    + */ + +@Controller +public class EgovRssTagManageController { + + @Autowired + private DefaultBeanValidator beanValidator; + + /** EgovMessageSource */ + @Resource(name = "egovMessageSource") + EgovMessageSource egovMessageSource; + + /** egovOnlinePollService */ + @Resource(name = "egovRssManageService") + private EgovRssTagManageService egovRssManageService; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** + * RSS태그관리 목록을 조회한다. + * @param commandMap -Request Variable + * @param model -Spring 제공하는 ModelMap + * @return String -리턴 URL + * @throws Exception + */ + //@IncludedInfo(name="RSS태그관리", order = 821) + @RequestMapping(value = "/uss/ion/rss/listRssTagManageTableColumnList.do") + public String EgovRssTagManageTableColumnList(@RequestParam Map commandMap, + ModelMap model) throws Exception { + + String sDbType = egovMessageSource.getMessage("Globals.DbType"); + String sTableName = commandMap.get("tableName") == null ? "" : (String) commandMap.get("tableName"); + + HashMap hmParam = new HashMap(); + + hmParam.put("dbType", sDbType); + hmParam.put("tableName", sTableName); + + ArrayList arrListResult = (ArrayList)egovRssManageService.selectRssTagManageTableColumnList(hmParam); + + model.addAttribute("ColumnList",arrListResult); + return "egovframework/com/uss/ion/rss/EgovRssTagManageTableColumnList"; + } + + /** + * RSS태그관리 목록을 조회한다. + * @param searchVO -검색정보가 담긴 객체 + * @param commandMap -Request Variable + * @param rssManage -RSS태그관리 객체 + * @param model -Spring 제공하는 ModelMap + * @return String -리턴 URL + * @throws Exception + */ + @IncludedInfo(name="RSS태그관리", listUrl="/uss/ion/rss/listRssTagManage.do", order = 820 ,gid = 50) + @RequestMapping(value = "/uss/ion/rss/listRssTagManage.do") + public String EgovRssTagManageList( + @ModelAttribute("searchVO") RssManage searchVO, + @RequestParam Map commandMap, + @RequestParam(value="checkList", required=false) List checkList, + RssManage rssManage, ModelMap model) + throws Exception { + + //변수 설정 + String sCmd = commandMap.get("cmd") == null ? "" : (String) commandMap.get("cmd"); + + //Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + //로그인 객체 선언 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + //삭제 모드로 실행시 + if(sCmd.equals("del")){ + + for(String checkData : checkList) { + + rssManage.setFrstRegisterId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + rssManage.setLastUpdusrId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + rssManage.setRssId(checkData); + + egovRssManageService.deleteRssTagManage(rssManage); + } + + //페이지 인텍스 설정 + searchVO.setPageIndex(1); + } + + /** 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()); + + List reusltList = egovRssManageService.selectRssTagManageList(searchVO); + model.addAttribute("resultList", reusltList); + + model.addAttribute("searchKeyword", commandMap.get("searchKeyword") == null ? "" : (String) commandMap.get("searchKeyword")); + model.addAttribute("searchCondition", commandMap.get("searchCondition") == null ? "" : (String) commandMap.get("searchCondition")); + + int totCnt = egovRssManageService.selectRssTagManageListCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/uss/ion/rss/EgovRssTagManageList"; + + } + + /** + * RSS태그관리 목록을 상세조회 조회한다. + * @param searchVO -검색정보가 담긴 객체 + * @param rssManage -RSS태그관리 객체 + * @param commandMap -Request Variable + * @param model -Spring 제공하는 ModelMap + * @return String -리턴 URL + * @throws Exception + */ + @RequestMapping(value = "/uss/ion/rss/detailRssTagManage.do") + public String EgovRssTagManageDetail( + @ModelAttribute("searchVO") RssManage searchVO, + RssManage rssManage, @RequestParam Map commandMap, + ModelMap model) throws Exception { + + String sLocationUrl = "egovframework/com/uss/ion/rss/EgovRssTagManageDetail"; + + String sCmd = commandMap.get("cmd") == null ? "" : (String) commandMap.get("cmd"); + + if (sCmd.equals("del")) { + egovRssManageService.deleteRssTagManage(rssManage); + sLocationUrl = "redirect:/uss/ion/rss/listRssTagManage.do"; + } else { + //상세정보 불러오기 + RssManage rssManages = egovRssManageService.selectRssTagManageDetail(rssManage); + model.addAttribute("rssManage", rssManages); + } + + return sLocationUrl; + + } + + /** + * RSS태그관리를 수정한다. + * @param searchVO -검색정보가 담긴 객체 + * @param commandMap -Request Variable + * @param rssManage -RSS태그관리 객체 + * @param BindingResult -Validator 하기위한 객체 + * @param model -Spring 제공하는 ModelMap + * @return String -리턴 URL + * @throws Exception + */ + @RequestMapping(value = "/uss/ion/rss/updtRssTagManage.do") + public String EgovRssTagManageModify( + @ModelAttribute("searchVO") RssManage searchVO, + @RequestParam Map commandMap, + @ModelAttribute("rssManage") RssManage rssManage, + BindingResult bindingResult, ModelMap model) throws Exception { + + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + // 로그인 객체 선언 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + String sLocationUrl = "egovframework/com/uss/ion/rss/EgovRssTagManageUpdt"; + + String sCmd = commandMap.get("cmd") == null ? "" : (String) commandMap.get("cmd"); + + if (sCmd.equals("save")) { + + //서버 validate 체크 + beanValidator.validate(rssManage, bindingResult); + if(bindingResult.hasErrors()){ + return sLocationUrl; + } + //아이디 설정 + rssManage.setFrstRegisterId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + rssManage.setLastUpdusrId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + //저장 + egovRssManageService.updateRssTagManage(rssManage); + sLocationUrl = "forward:/uss/ion/rss/listRssTagManage.do"; + } else { + + //테이블 목록 불러오기 + model.addAttribute("trgetSvcTableList", egovRssManageService.selectRssTagManageTableList()); + + //수정정보 불러오기 + RssManage rssManageVO = egovRssManageService.selectRssTagManageDetail(rssManage); + model.addAttribute("rssManage", rssManageVO); + } + + return sLocationUrl; + } + + /** + * RSS태그관리를 등록한다. + * @param searchVO -검색정보가 담긴 객체 + * @param commandMap -Request Variable + * @param rssManage -RSS태그관리 객체 + * @param BindingResult -Validator 하기위한 객체 + * @param model -Spring 제공하는 ModelMap + * @return String -리턴 URL + * @throws Exception + */ + @RequestMapping(value = "/uss/ion/rss/registRssTagManage.do") + public String EgovRssTagManageRegist( + @ModelAttribute("searchVO") RssManage searchVO, + @RequestParam Map commandMap, + @ModelAttribute("rssManage") RssManage rssManage, + BindingResult bindingResult, ModelMap model) throws Exception { + + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + // 로그인 객체 선언 + LoginVO loginVO = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser(); + + String sLocationUrl = "egovframework/com/uss/ion/rss/EgovRssTagManageRegist"; + + String sCmd = commandMap.get("cmd") == null ? "" : (String) commandMap.get("cmd"); + + if (sCmd.equals("save")) { + //서버 validate 체크 + beanValidator.validate(rssManage, bindingResult); + if(bindingResult.hasErrors()){ + return sLocationUrl; + } + //아이디 설정 + rssManage.setFrstRegisterId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + rssManage.setLastUpdusrId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + //저장 + egovRssManageService.insertRssTagManage(rssManage); + + sLocationUrl = "forward:/uss/ion/rss/listRssTagManage.do"; + }else{ + model.addAttribute("trgetSvcTableList", egovRssManageService.selectRssTagManageTableList()); + + } + + return sLocationUrl; + } + + +} diff --git a/src/main/java/egovframework/com/uss/ion/rwd/service/EgovRwardManageService.java b/src/main/java/egovframework/com/uss/ion/rwd/service/EgovRwardManageService.java new file mode 100644 index 0000000..dc74aec --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rwd/service/EgovRwardManageService.java @@ -0,0 +1,78 @@ +package egovframework.com.uss.ion.rwd.service; + +import java.util.List; + +/** + * 개요 + * - 포상관리에 대한 Service Interface를 정의한다. + * + * 상세내용 + * - 포상관리에 대한 등록, 수정, 삭제, 조회, 승인처리 기능을 제공한다. + * - 포상관리의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ +public interface EgovRwardManageService { + + /** + * 포상관리 정보를 관리하기 위해 등록된 로그인화면이미지 목록을 조회한다. + * @param rwardManageVO - 포상관리 VO + * @return List - 포상관리 목록 + */ + public List selectRwardManageList(RwardManageVO rwardManageVO) throws Exception; + + /** + * 포상관리 목록 총 갯수를 조회한다. + * @param rwardManageVO - 포상관리 VO + * @return int - 포상관리 카운트 수 + */ + public int selectRwardManageListTotCnt(RwardManageVO rwardManageVO) throws Exception ; + + /** + * 등록된 포상관리의 상세정보를 조회한다. + * @param rwardManageVO - 포상관리 VO + * @return RwardManageVO - 포상관리 VO + */ + public RwardManageVO selectRwardManage(RwardManageVO rwardManageVO) throws Exception; + + /** + * 포상관리 정보를 신규로 등록한다. + * @param rwardManage - 포상관리 model + */ + public void insertRwardManage(RwardManage rwardManage) throws Exception; + + /** + * 기 등록된 포상관리 정보를 수정한다. + * @param rwardManage - 포상관리 model + */ + public void updtRwardManage(RwardManage rwardManage) throws Exception; + + /** + * 기 등록된 포상관리 정보를 삭제한다. + * @param rwardManage - 포상관리 model + */ + public void deleteRwardManage(RwardManage rwardManage) throws Exception; + + /*** 승인처리관련 ***/ + /** + * 포상관리정보 승인 처리를 위해 신청된 포상관리 목록을 조회한다. + * @param rwardManageVO - 포상관리 VO + * @return List - 포상관리 목록 + */ + public List selectRwardManageConfmList(RwardManageVO rwardManageVO) throws Exception; + + /** + * 포상관리정보 승인 처리를 위해 신청된 포상관리 목록 총 갯수를 조회한다. + * @param rwardManageVO - 포상관리 VO + * @return int - 포상관리 카운트 수 + */ + public int selectRwardManageConfmListTotCnt(RwardManageVO rwardManageVO) throws Exception ; + + /** + * 포상정보를 승인/반려처리 한다. + * @param rwardManage - 포상관리 model + */ + public void updtRwardManageConfm(RwardManage rwardManage) throws Exception; + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/rwd/service/RwardManage.java b/src/main/java/egovframework/com/uss/ion/rwd/service/RwardManage.java new file mode 100644 index 0000000..7fd7f4c --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rwd/service/RwardManage.java @@ -0,0 +1,340 @@ +package egovframework.com.uss.ion.rwd.service; + +import egovframework.com.cmm.ComDefaultVO; + +/** + * 개요 + * - 포상관리에 대한 model 클래스를 정의한다. + * + * 상세내용 + * - 포상관리의 포상자ID,포상코드,포상일자,공적내용,결재자ID,승인여부,결재일시,반려사유,최초등록자ID,최초등록시점,최종수정자ID,최종수정시점 항목을 관리한다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +public class RwardManage extends ComDefaultVO { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + + /** + * 포상ID + */ + private String rwardId; + + /** + * 포상자ID + */ + private String rwardManId; + + /** + * 포상자명 + */ + private String rwardManNm; + + public String getRwardManNm() { + return rwardManNm; + } + + public void setRwardManNm(String rwardManNm) { + this.rwardManNm = rwardManNm; + } + + /** + * 포상코드 + */ + private String rwardCd; + + /** + * 포상일자 + */ + private String rwardDe; + + /** + * 포상명 + */ + private String rwardNm; + + /** + * 공적내용 + */ + private String pblenCn; + + /** + * 결재자ID + */ + private String sanctnerId; + + /** + * 승인여부 + */ + private String confmAt; + + /** + * 결재일시 + */ + private String sanctnDt; + + /** + * 반려사유 + */ + private String returnResn; + + /** + * 첨부파일ID + */ + private String atchFileId; + + /** + * 약식결재ID + */ + private String infrmlSanctnId; + + /** + * 최초등록자ID + */ + private String frstRegisterId; + + /** + * 최초등록시점 + */ + private String frstRegisterPnttm; + + /** + * 최종수정자ID + */ + private String lastUpdusrId; + + /** + * 최종수정시점 + */ + private String lastUpdusrPnttm; + + /** + * @return the rwardId + */ + public String getRwardId() { + return rwardId; + } + + /** + * @param rwardId the rwardId to set + */ + public void setRwardId(String rwardId) { + this.rwardId = rwardId; + } + + /** + * @return the rwardManId + */ + public String getRwardManId() { + return rwardManId; + } + + /** + * @param rwardManId the rwardManId to set + */ + public void setRwardManId(String rwardManId) { + this.rwardManId = rwardManId; + } + + /** + * @return the rwardCd + */ + public String getRwardCd() { + return rwardCd; + } + + /** + * @param rwardCd the rwardCd to set + */ + public void setRwardCd(String rwardCd) { + this.rwardCd = rwardCd; + } + + /** + * @return the rwardDe + */ + public String getRwardDe() { + return rwardDe; + } + + /** + * @param rwardDe the rwardDe to set + */ + public void setRwardDe(String rwardDe) { + this.rwardDe = rwardDe; + } + + /** + * @return the rwardNm + */ + public String getRwardNm() { + return rwardNm; + } + + /** + * @param rwardNm the rwardNm to set + */ + public void setRwardNm(String rwardNm) { + this.rwardNm = rwardNm; + } + + /** + * @return the pblenCn + */ + public String getPblenCn() { + return pblenCn; + } + + /** + * @param pblenCn the pblenCn to set + */ + public void setPblenCn(String pblenCn) { + this.pblenCn = pblenCn; + } + + /** + * @return the sanctnerId + */ + public String getSanctnerId() { + return sanctnerId; + } + + /** + * @param sanctnerId the sanctnerId to set + */ + public void setSanctnerId(String sanctnerId) { + this.sanctnerId = sanctnerId; + } + + /** + * @return the confmAt + */ + public String getConfmAt() { + return confmAt; + } + + /** + * @param confmAt the confmAt to set + */ + public void setConfmAt(String confmAt) { + this.confmAt = confmAt; + } + + /** + * @return the sanctnDt + */ + public String getSanctnDt() { + return sanctnDt; + } + + /** + * @param sanctnDt the sanctnDt to set + */ + public void setSanctnDt(String sanctnDt) { + this.sanctnDt = sanctnDt; + } + + /** + * @return the returnResn + */ + public String getReturnResn() { + return returnResn; + } + + /** + * @param returnResn the returnResn to set + */ + public void setReturnResn(String returnResn) { + this.returnResn = returnResn; + } + + /** + * @return the atchFileId + */ + public String getAtchFileId() { + return atchFileId; + } + + /** + * @param atchFileId the atchFileId to set + */ + public void setAtchFileId(String atchFileId) { + this.atchFileId = atchFileId; + } + + /** + * @return the infrmlSanctnId + */ + public String getInfrmlSanctnId() { + return infrmlSanctnId; + } + + /** + * @param infrmlSanctnId the infrmlSanctnId to set + */ + public void setInfrmlSanctnId(String infrmlSanctnId) { + this.infrmlSanctnId = infrmlSanctnId; + } + + /** + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * @param frstRegisterId the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * @param frstRegisterPnttm the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * @param lastUpdusrId the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + /** + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * @param lastUpdusrPnttm the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/rwd/service/RwardManageVO.java b/src/main/java/egovframework/com/uss/ion/rwd/service/RwardManageVO.java new file mode 100644 index 0000000..a88b315 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rwd/service/RwardManageVO.java @@ -0,0 +1,231 @@ +package egovframework.com.uss.ion.rwd.service; + +import java.io.Serializable; +import java.util.List; + +/** + * 개요 + * - 포상관리에 대한 Vo 클래스를 정의한다. + * + * 상세내용 + * - 포상관리의 목록 항목을 관리한다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +public class RwardManageVO extends RwardManage implements Serializable { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + /** + * 포상자 목록 + */ + List rwardManageList; + + /** + * @return the rwardManageList + */ + public List getRwardManageList() { + return rwardManageList; + } + /** + * @param RwardManage the rwardManage to set + */ + public void setRwardManageList(List rwardManageList) { + this.rwardManageList = rwardManageList; + } + + /** + * 포상자명 + */ + private String rwardManNm; + + /** + * 승인자명 + */ + private String sanctnerNm; + + /** + * 포상코드명 + */ + private String rwardCdNm; + + /** + * 사용자 소속명 + */ + private String orgnztNm; + + /** + * 승인자 소속명 + */ + private String sanctnerOrgnztNm; + + /** + * 검색시작일자 + */ + private String searchFromDate; + + /** + * 검색종료일자 + */ + private String searchToDate; + + /** + * 검색 성명 + */ + private String searchNm; + + /** + * 검색 진행구분 + */ + private String searchConfmAt; + + /** + * searchToDateView + */ + private String searchToDateView; + + /** + * searchFromDateView + */ + private String searchFromDateView; + + + /** + * @return the searchToDateView + */ + public String getSearchToDateView() { + return searchToDateView; + } + /** + * @param searchToDateView the searchToDateView to set + */ + public void setSearchToDateView(String searchToDateView) { + this.searchToDateView = searchToDateView; + } + /** + * @return the searchFromDateView + */ + public String getSearchFromDateView() { + return searchFromDateView; + } + /** + * @param searchFromDateView the searchFromDateView to set + */ + public void setSearchFromDateView(String searchFromDateView) { + this.searchFromDateView = searchFromDateView; + } + + + /** + * @return the rwardManNm + */ + public String getRwardManNm() { + return rwardManNm; + } + /** + * @param rwardManNm the rwardManNm to set + */ + public void setRwardManNm(String rwardManNm) { + this.rwardManNm = rwardManNm; + } + /** + * @return the sanctnerNm + */ + public String getSanctnerNm() { + return sanctnerNm; + } + /** + * @param sanctnerNm the sanctnerNm to set + */ + public void setSanctnerNm(String sanctnerNm) { + this.sanctnerNm = sanctnerNm; + } + /** + * @return the rwardCdNm + */ + public String getRwardCdNm() { + return rwardCdNm; + } + /** + * @param rwardCdNm the rwardCdNm to set + */ + public void setRwardCdNm(String rwardCdNm) { + this.rwardCdNm = rwardCdNm; + } + /** + * @return the orgnztNm + */ + public String getOrgnztNm() { + return orgnztNm; + } + /** + * @param orgnztNm the orgnztNm to set + */ + public void setOrgnztNm(String orgnztNm) { + this.orgnztNm = orgnztNm; + } + /** + * @return the sanctnerOrgnztNm + */ + public String getSanctnerOrgnztNm() { + return sanctnerOrgnztNm; + } + /** + * @param sanctnerOrgnztNm the sanctnerOrgnztNm to set + */ + public void setSanctnerOrgnztNm(String sanctnerOrgnztNm) { + this.sanctnerOrgnztNm = sanctnerOrgnztNm; + } + /** + * @return the searchFromDate + */ + public String getSearchFromDate() { + return searchFromDate; + } + /** + * @param searchFromDate the searchFromDate to set + */ + public void setSearchFromDate(String searchFromDate) { + this.searchFromDate = searchFromDate; + } + /** + * @return the searchToDate + */ + public String getSearchToDate() { + return searchToDate; + } + /** + * @param searchToDate the searchToDate to set + */ + public void setSearchToDate(String searchToDate) { + this.searchToDate = searchToDate; + } + /** + * @return the searchNm + */ + public String getSearchNm() { + return searchNm; + } + /** + * @param searchNm the searchNm to set + */ + public void setSearchNm(String searchNm) { + this.searchNm = searchNm; + } + /** + * @return the searchConfmAt + */ + public String getSearchConfmAt() { + return searchConfmAt; + } + /** + * @param searchConfmAt the searchConfmAt to set + */ + public void setSearchConfmAt(String searchConfmAt) { + this.searchConfmAt = searchConfmAt; + } +} diff --git a/src/main/java/egovframework/com/uss/ion/rwd/service/impl/EgovRwardManageServiceImpl.java b/src/main/java/egovframework/com/uss/ion/rwd/service/impl/EgovRwardManageServiceImpl.java new file mode 100644 index 0000000..36c7304 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rwd/service/impl/EgovRwardManageServiceImpl.java @@ -0,0 +1,211 @@ +package egovframework.com.uss.ion.rwd.service.impl; + +import java.util.List; + +import egovframework.com.uss.ion.ism.service.EgovInfrmlSanctnService; +import egovframework.com.uss.ion.ism.service.InfrmlSanctn; +import egovframework.com.uss.ion.rwd.service.EgovRwardManageService; +import egovframework.com.uss.ion.rwd.service.RwardManage; +import egovframework.com.uss.ion.rwd.service.RwardManageVO; +import egovframework.com.utl.fcc.service.EgovDateUtil; +import egovframework.com.utl.fcc.service.EgovStringUtil; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +/** + * 개요 + * - 포상관리에 대한 ServiceImpl 클래스를 정의한다. + * + * 상세내용 + * - 포상관리에 대한 등록, 수정, 삭제, 조회, 승인처리 기능을 제공한다. + * - 포상관리의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +@Service("egovRwardManageService") +public class EgovRwardManageServiceImpl extends EgovAbstractServiceImpl implements EgovRwardManageService { + + @Resource(name="rwardManageDAO") + private RwardManageDAO rwardManageDAO; + + /** ID Generation */ + @Resource(name="egovRwardManageIdGnrService") + private EgovIdGnrService idgenRwardManageService; + + @Resource(name="EgovInfrmlSanctnService") + protected EgovInfrmlSanctnService infrmlSanctnService; + + /** + * 포상관리정보를 관리하기 위해 등록된 포상관리 목록을 조회한다. + * @param rwardManageVO - 포상관리 VO + * @return List - 포상관리 목록 + */ + public List selectRwardManageList(RwardManageVO rwardManageVO) throws Exception{ + rwardManageVO.setSearchFromDate(EgovStringUtil.removeMinusChar(rwardManageVO.getSearchFromDate())); + rwardManageVO.setSearchToDate(EgovStringUtil.removeMinusChar(rwardManageVO.getSearchToDate())); + List result = rwardManageDAO.selectRwardManageList(rwardManageVO); + + + int num = result.size(); + + for (int i = 0 ; i < num ; i ++ ){ + RwardManageVO rwardManageVO1 = result.get(i); + rwardManageVO1.setRwardDe(EgovDateUtil.formatDate(rwardManageVO1.getRwardDe(), "-")); + result.set(i, rwardManageVO1); + } + return result; + } + + /** + * 포상관리목록 총 갯수를 조회한다. + * @param rwardManageVO - 포상관리 VO + * @return int - 포상관리 카운트 수 + */ + public int selectRwardManageListTotCnt(RwardManageVO rwardManageVO) throws Exception { + return rwardManageDAO.selectRwardManageListTotCnt(rwardManageVO); + } + + /** + * 등록된 포상관리의 상세정보를 조회한다. + * @param rwardManageVO - 포상관리 VO + * @return RwardManageVO - 포상관리 VO + */ + public RwardManageVO selectRwardManage(RwardManageVO rwardManageVO) throws Exception { + + RwardManageVO rwardManageVOTemp = rwardManageDAO.selectRwardManage(rwardManageVO); + rwardManageVOTemp.setRwardDe(EgovDateUtil.formatDate(rwardManageVOTemp.getRwardDe(), "-")); + + return rwardManageVOTemp; + } + + /** + * 포상관리정보를 신규로 등록한다. + * @param rwardManage - 포상관리 model + */ + public void insertRwardManage(RwardManage rwardManage) throws Exception { + + /* + * 포상 승인처리 신청 infrmlSanctnService.insertInfrmlSanctn("000", vcatnManage); + */ + rwardManage.setRwardDe(EgovStringUtil.removeMinusChar(rwardManage.getRwardDe())); + InfrmlSanctn infrmlSanctn = infrmlSanctnService.insertInfrmlSanctn(converToInfrmlSanctnObject(rwardManage)); //신청 + rwardManage.setInfrmlSanctnId(infrmlSanctn.getInfrmlSanctnId()); + rwardManage.setConfmAt(infrmlSanctn.getConfmAt()); + + String sRwardId = idgenRwardManageService.getNextStringId(); + rwardManage.setRwardId(sRwardId); + + rwardManageDAO.insertRwardManage(rwardManage); + } + + /** + * 기 등록된 포상관리정보를 수정한다. + * @param rwardManage - 포상관리 model + */ + public void updtRwardManage(RwardManage rwardManage) throws Exception { + rwardManage.setRwardDe(EgovStringUtil.removeMinusChar(rwardManage.getRwardDe())); + rwardManageDAO.updtRwardManage(rwardManage); + } + + /** + * 기 등록된 포상관리정보를 삭제한다. + * @param rwardManage - 포상관리 model + */ + public void deleteRwardManage(RwardManage rwardManage) throws Exception { + /* + * 포상 승인처리 삭제 infrmlSanctnService.deleteInfrmlSanctn("000", vcatnManage); + */ + rwardManage.setRwardDe(EgovStringUtil.removeMinusChar(rwardManage.getRwardDe())); + infrmlSanctnService.deleteInfrmlSanctn(converToInfrmlSanctnObject(rwardManage)); //삭제 + rwardManageDAO.deleteRwardManage(rwardManage); + } + + + + /** + * 포상관리정보 승인 처리를 위해 신청된 포상관리 목록을 조회한다. + * @param rwardManageVO - 포상관리 VO + * @return List - 포상관리 목록 + */ + public List selectRwardManageConfmList(RwardManageVO rwardManageVO) throws Exception{ + rwardManageVO.setSearchFromDate(EgovStringUtil.removeMinusChar(rwardManageVO.getSearchFromDate())); + rwardManageVO.setSearchToDate(EgovStringUtil.removeMinusChar(rwardManageVO.getSearchToDate())); + List result = rwardManageDAO.selectRwardManageConfmList(rwardManageVO); + + int num = result.size(); + + for (int i = 0 ; i < num ; i ++ ){ + RwardManageVO rwardManageVO1 = result.get(i); + rwardManageVO1.setRwardDe(EgovDateUtil.formatDate(rwardManageVO1.getRwardDe(), "-")); + result.set(i, rwardManageVO1); + } + return result; + } + + /** + * 포상승인목록 총 갯수를 조회한다. + * @param rwardManageVO - 포상관리 VO + * @return int - 포상관리 카운트 수 + */ + public int selectRwardManageConfmListTotCnt(RwardManageVO rwardManageVO) throws Exception { + return rwardManageDAO.selectRwardManageConfmListTotCnt(rwardManageVO); + } + + /** + * 포상정보를 승인/반려처리 한다. + * @param rwardManage - 포상관리 model + */ + public void updtRwardManageConfm(RwardManage rwardManage) throws Exception { + InfrmlSanctn infrmlSanctn = new InfrmlSanctn(); + rwardManage.setRwardDe(EgovStringUtil.removeMinusChar(rwardManage.getRwardDe())); + //KISA 보안약점 조치 (2018-10-29, 윤창원) + if("C".equals(rwardManage.getConfmAt())){ + /* + * 승인처리 + */ + infrmlSanctn = infrmlSanctnService.updateInfrmlSanctnConfm(converToInfrmlSanctnObject(rwardManage)); //승인 + //infrmlSanctn = infrmlSanctnService.updateInfrmlSanctnConfm("002", rwardManage); + }else if("R".equals(rwardManage.getConfmAt())){ + /* + * 반려처리 + */ + infrmlSanctn = infrmlSanctnService.updateInfrmlSanctnReturn(converToInfrmlSanctnObject(rwardManage)); //반려 + //infrmlSanctn = infrmlSanctnService.updateInfrmlSanctnReturn("002", rwardManage); + } + rwardManage.setSanctnDt(infrmlSanctn.getSanctnDt()); + rwardManage.setConfmAt(infrmlSanctn.getConfmAt()); + + rwardManageDAO.updtRwardManageConfm(rwardManage); + } + + /** + * RwardManage model을 InfrmlSanctn model로 변환한다. + * @param RwardManage + * @return InfrmlSanctn + * @param rwardManage + */ + private InfrmlSanctn converToInfrmlSanctnObject(RwardManage rwardManage) throws Exception{ + InfrmlSanctn infrmlSanctn = new InfrmlSanctn(); + infrmlSanctn.setJobSeCode("002"); // 업무구분코드 (공통코드 COM75) + infrmlSanctn.setApplcntId(rwardManage.getRwardManId()); // 포상자ID + infrmlSanctn.setReqstDe(rwardManage.getRwardDe()); // 포상일자 + infrmlSanctn.setSanctnerId(rwardManage.getSanctnerId()); // 결재자ID + infrmlSanctn.setConfmAt(rwardManage.getConfmAt()); // 승인구분 + infrmlSanctn.setSanctnDt(rwardManage.getSanctnDt()); // 결재일시 + infrmlSanctn.setReturnResn(rwardManage.getReturnResn()); // 반려사유 + infrmlSanctn.setFrstRegisterId(rwardManage.getFrstRegisterId()); + infrmlSanctn.setFrstRegisterPnttm(rwardManage.getFrstRegisterId()); + infrmlSanctn.setLastUpdusrId(rwardManage.getLastUpdusrId()); + infrmlSanctn.setLastUpdusrPnttm(rwardManage.getLastUpdusrPnttm()); + infrmlSanctn.setInfrmlSanctnId(rwardManage.getInfrmlSanctnId());// 약식결재ID + return infrmlSanctn; + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/rwd/service/impl/RwardManageDAO.java b/src/main/java/egovframework/com/uss/ion/rwd/service/impl/RwardManageDAO.java new file mode 100644 index 0000000..9217b72 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rwd/service/impl/RwardManageDAO.java @@ -0,0 +1,107 @@ + + +package egovframework.com.uss.ion.rwd.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.ion.rwd.service.RwardManage; +import egovframework.com.uss.ion.rwd.service.RwardManageVO; + +import org.springframework.stereotype.Repository; + +/** + * 개요 + * - 포상관리에 대한 DAO 클래스를 정의한다. + * + * 상세내용 + * - 포상관리에 대한 등록, 수정, 삭제, 조회, 승인처리 기능을 제공한다. + * - 포상관리의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +@Repository("rwardManageDAO") +public class RwardManageDAO extends EgovComAbstractDAO { + + /** + * 포상관리정보를 관리하기 위해 등록된 포상관리 목록을 조회한다. + * @param rwardManageVO - 포상관리 VO + * @return List - 포상관리 목록 + */ + public List selectRwardManageList(RwardManageVO rwardManageVO) throws Exception { + return selectList("rwardManageDAO.selectRwardManageList", rwardManageVO); + } + + /** + * 포상관리목록 총 갯수를 조회한다. + * @param rwardManageVO - 포상관리 VO + * @return int + * @exception Exception + */ + public int selectRwardManageListTotCnt(RwardManageVO rwardManageVO) throws Exception { + return (Integer)selectOne("rwardManageDAO.selectRwardManageListTotCnt", rwardManageVO); + } + + /** + * 등록된 포상관리의 상세정보를 조회한다. + * @param rwardManageVO - 포상관리 VO + * @return RwardManageVO - 포상관리 VO + */ + public RwardManageVO selectRwardManage(RwardManageVO rwardManageVO) throws Exception { + return (RwardManageVO) selectOne("rwardManageDAO.selectRwardManage", rwardManageVO); + } + + /** + * 포상관리정보를 신규로 등록한다. + * @param rwardManage - 포상관리 model + */ + public void insertRwardManage(RwardManage rwardManage) throws Exception { + insert("rwardManageDAO.insertRwardManage", rwardManage); + } + + /** + * 기 등록된 포상관리정보를 수정한다. + * @param rwardManage - 포상관리 model + */ + public void updtRwardManage(RwardManage rwardManage) throws Exception { + update("rwardManageDAO.updtRwardManage", rwardManage); + } + + /** + * 기 등록된 포상관리정보를 삭제한다. + * @param rwardManage - 포상관리 model + */ + public void deleteRwardManage(RwardManage rwardManage) throws Exception { + delete("rwardManageDAO.deleteRwardManage",rwardManage); + } + + /*** 승인처리관련 ***/ + /** + * 포상관리정보 승인 처리를 위해 신청된 포상관리 목록을 조회한다. + * @param rwardManageVO - 포상관리 VO + * @return List - 포상관리 목록 + */ + public List selectRwardManageConfmList(RwardManageVO rwardManageVO) throws Exception { + return selectList("rwardManageDAO.selectRwardManageConfmList", rwardManageVO); + } + + /** + * 포상관리정보 승인 처리를 위해 신청된 포상관리 목록 총 갯수를 조회한다. + * @param rwardManageVO - 포상관리 VO + * @return int + * @exception Exception + */ + public int selectRwardManageConfmListTotCnt(RwardManageVO rwardManageVO) throws Exception { + return (Integer)selectOne("rwardManageDAO.selectRwardManageConfmListTotCnt", rwardManageVO); + } + + /** + *포상정보를 승인/반려처리 한다. + * @param rwardManage - 포상관리 model + */ + public void updtRwardManageConfm(RwardManage rwardManage) throws Exception { + update("rwardManageDAO.updtRwardManageConfm", rwardManage); + } +} diff --git a/src/main/java/egovframework/com/uss/ion/rwd/web/EgovRwardManageController.java b/src/main/java/egovframework/com/uss/ion/rwd/web/EgovRwardManageController.java new file mode 100644 index 0000000..600414e --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/rwd/web/EgovRwardManageController.java @@ -0,0 +1,436 @@ +package egovframework.com.uss.ion.rwd.web; + +import java.util.List; +import java.util.Map; + +import egovframework.com.cmm.ComDefaultCodeVO; +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.service.EgovCmmUseService; +import egovframework.com.cmm.service.EgovFileMngService; +import egovframework.com.cmm.service.EgovFileMngUtil; +import egovframework.com.cmm.service.FileVO; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.ion.rwd.service.EgovRwardManageService; +import egovframework.com.uss.ion.rwd.service.RwardManage; +import egovframework.com.uss.ion.rwd.service.RwardManageVO; +import egovframework.com.utl.fcc.service.EgovStringUtil; + +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +import javax.annotation.Resource; + +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.springframework.web.bind.support.SessionStatus; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springmodules.validation.commons.DefaultBeanValidator; + +/** + * 개요 + * - 포상관리에 대한 controller 클래스를 정의한다. + * + * 상세내용 + * - 포상관리에 대한 등록, 수정, 삭제, 조회 기능을 제공한다. + * - 포상관리의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + * + * << 개정이력(Modification Information) >> + * + * 수정일 수정자 수정내용 + * ------- -------- --------------------------- + * 2011.08.16 정진오 VcatnManageVO Dependency 제거, 사용하지 않는 객체 선언 + * 2011.8.26 정진오 IncludedInfo annotation 추가 + * + * + + */ + +@Controller +public class EgovRwardManageController { + + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name = "egovRwardManageService") + private EgovRwardManageService egovRwardManageService; + + @Resource(name="EgovCmmUseService") + private EgovCmmUseService cmmUseService; + + // 첨부파일 관련 + @Resource(name="EgovFileMngService") + private EgovFileMngService fileMngService; + + @Resource(name="EgovFileMngUtil") + private EgovFileMngUtil fileUtil; + + @Autowired + private DefaultBeanValidator beanValidator; + + /** + * 포상관리 목록화면 이동 + * @return String + * @exception Exception + */ + @RequestMapping("/uss/ion/rwd/EgovRwardManageListView.do") + public String selectRwardManageListView(/*@ModelAttribute("vcatnManageVO") VcatnManageVO vcatnManageVO,*/ // 2011.8.16 수정분 + ModelMap model) throws Exception { + List rwardCdCodeList = null; + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM055"); + rwardCdCodeList = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("rwardCodeList", rwardCdCodeList); + + return "egovframework/com/uss/ion/rwd/EgovRwardManageList"; + } + + /** + * 포상관리정보를 관리하기 위해 등록된 포상관리 목록을 조회한다. + * @param rwardManageVO - 포상관리 VO + * @return String - 리턴 Url + */ + @IncludedInfo(name="포상관리", order = 920 ,gid = 50) + @RequestMapping(value="/uss/ion/rwd/selectRwardManageList.do") + public String selectRwardManageList(@ModelAttribute("rwardManageVO") RwardManageVO rwardManageVO, + ModelMap model) throws Exception { + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(rwardManageVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(rwardManageVO.getPageUnit()); + paginationInfo.setPageSize(rwardManageVO.getPageSize()); + + rwardManageVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + rwardManageVO.setLastIndex(paginationInfo.getLastRecordIndex()); + rwardManageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + rwardManageVO.setRwardManageList(egovRwardManageService.selectRwardManageList(rwardManageVO)); + + model.addAttribute("rwardManageList", rwardManageVO.getRwardManageList()); + + int totCnt = egovRwardManageService.selectRwardManageListTotCnt(rwardManageVO); + paginationInfo.setTotalRecordCount(totCnt); + + List rwardCdCodeList = null; + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM055"); + rwardCdCodeList = cmmUseService.selectCmmCodeDetail(vo); + + model.addAttribute("rwardCodeList", rwardCdCodeList); + model.addAttribute("paginationInfo", paginationInfo ); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/uss/ion/rwd/EgovRwardManageList"; + } + + /** + * 등록된 포상관리의 상세정보를 조회한다. + * @param rwardManageVO - 포상관리 VO + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/rwd/EgovRwardManageDetail.do") + public String selectRwardManage( @ModelAttribute("rwardManage") RwardManage rwardManage, + @ModelAttribute("rwardManageVO") RwardManageVO rwardManageVO, + @RequestParam Map commandMap, + ModelMap model) throws Exception { + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); // 상세정보 구분 + rwardManageVO.setRwardDe(EgovStringUtil.removeMinusChar(rwardManageVO.getRwardDe())); + + + + // 등록 상세정보 + RwardManageVO rwardManageVOTemp = egovRwardManageService.selectRwardManage(rwardManageVO); + + model.addAttribute("rwardManageVO", rwardManageVOTemp); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + if(sCmd.equals("updt")){ + RwardManage rwardManage_1 = new RwardManage(); + + rwardManage_1.setRwardId(rwardManageVOTemp.getRwardId()); + rwardManage_1.setRwardNm(rwardManageVOTemp.getRwardNm()); + rwardManage_1.setPblenCn(rwardManageVOTemp.getPblenCn()); + rwardManage_1.setRwardManId(rwardManageVOTemp.getRwardManId()); + rwardManage_1.setRwardCd(rwardManageVOTemp.getRwardCd()); + rwardManage_1.setRwardDe(rwardManageVOTemp.getRwardDe()); + rwardManage_1.setInfrmlSanctnId(rwardManageVOTemp.getInfrmlSanctnId()); + rwardManage_1.setSanctnerId(rwardManageVOTemp.getSanctnerId()); + + List rwardCdCodeList = null; + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM055"); + rwardCdCodeList = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("rwardCodeList", rwardCdCodeList); + model.addAttribute("rwardManage", rwardManage_1); + return "egovframework/com/uss/ion/rwd/EgovRwardUpdt"; + }else{ + return "egovframework/com/uss/ion/rwd/EgovRwardDetail"; + } + + } + + /** + * 포상관리 등록 화면으로 이동한다. + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/rwd/EgovRwardRegist.do") + public String insertViewRwardManage(@ModelAttribute("rwardManage") RwardManage rwardManage, + @ModelAttribute("rwardManageVO") RwardManageVO rwardManageVO, + ModelMap model) throws Exception { + List rwardCdCodeList = null; + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM055"); + rwardCdCodeList = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("rwardCodeList", rwardCdCodeList); + return "egovframework/com/uss/ion/rwd/EgovRwardRegist"; + } + + /** + * 포상관리정보를 신규로 등록한다. + * @param rwardManage - 포상관리 model + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/rwd/insertRwardManage.do") + public String insertRwardManage(final MultipartHttpServletRequest multiRequest, + @ModelAttribute("rwardManage") RwardManage rwardManage, + @ModelAttribute("rwardManageVO") RwardManageVO rwardManageVO, + BindingResult bindingResult, + SessionStatus status, + ModelMap model) throws Exception { + + beanValidator.validate(rwardManage, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + model.addAttribute("rwardManageVO", rwardManageVO); + return "egovframework/com/uss/ion/rwd/EgovRwardRegist"; + } else { + // 첨부파일 관련 첨부파일ID 생성 + List _result = null; + String _atchFileId = ""; + + //final Map files = multiRequest.getFileMap(); + final List files = multiRequest.getFiles("file_1"); + + if(!files.isEmpty()){ + _result = fileUtil.parseFileInf(files, "RWD_", 0, "", ""); + _atchFileId = fileMngService.insertFileInfs(_result); //파일이 생성되고나면 생성된 첨부파일 ID를 리턴한다. + } + // 리턴받은 첨부파일ID를 셋팅한다.. + rwardManage.setAtchFileId(_atchFileId); // 첨부파일 ID + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + rwardManage.setFrstRegisterId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); // 최초등록자ID + egovRwardManageService.insertRwardManage(rwardManage); + status.setComplete(); + model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); + + return "forward:/uss/ion/rwd/selectRwardManageList.do"; + + } + } + + /** + * 기 등록된 포상관리정보를 수정한다. + * @param rwardManage - 포상관리 model + * @return String - 리턴 Url + */ + @SuppressWarnings("unused") + @RequestMapping(value="/uss/ion/rwd/updtRwardManage.do") + public String updtRwardManage(@RequestParam("atchFileAt") String atchFileAt , + final MultipartHttpServletRequest multiRequest, + @ModelAttribute("rwardManage") RwardManage rwardManage, + @ModelAttribute("rwardManageVO") RwardManageVO rwardManageVO, + BindingResult bindingResult, + SessionStatus status, + ModelMap model) throws Exception { + beanValidator.validate(rwardManage, bindingResult); //validation 수행 + if (bindingResult.hasErrors()) { + model.addAttribute("rwardManageVO", rwardManageVO); + model.addAttribute("rwardManage", rwardManage); + return "egovframework/com/uss/ion/rwd/EgovRwardUpdt"; + } else { + // 첨부파일 관련 ID 생성 start.... + String _atchFileId = rwardManage.getAtchFileId(); + + //final Map files = multiRequest.getFileMap(); + final List files = multiRequest.getFiles("file_1"); + //System.out.println("updtRwardManage 1"); + if(!files.isEmpty()){ + //System.out.println("updtRwardManage 2"); + if("N".equals(atchFileAt)){ + + //System.out.println("updtRwardManage 3"); + List _result = fileUtil.parseFileInf(files, "RWD_", 0, _atchFileId, ""); + _atchFileId = fileMngService.insertFileInfs(_result); + + // 첨부파일 ID 셋팅 + rwardManage.setAtchFileId(_atchFileId); // 첨부파일 ID + + }else{ + //System.out.println("updtRwardManage 4"); + FileVO fvo = new FileVO(); + fvo.setAtchFileId(_atchFileId); + int _cnt = fileMngService.getMaxFileSN(fvo); + List _result = fileUtil.parseFileInf(files, "RWD_", _cnt, _atchFileId, ""); + fileMngService.updateFileInfs(_result); + } + } + // 첨부파일 관련 ID 생성 end... + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + rwardManage.setRwardDe(EgovStringUtil.removeMinusChar(rwardManage.getRwardDe())); + egovRwardManageService.updtRwardManage(rwardManage); + return "forward:/uss/ion/rwd/selectRwardManageList.do"; + } + } + + /** + * 기 등록된 포상관리정보를 삭제한다. + * @param rwardManage - 포상관리 model + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/rwd/deleteRwardManage.do") + public String deleteRwardManage( @ModelAttribute("rwardManage") RwardManage rwardManage, + SessionStatus status, + ModelMap model) throws Exception { + rwardManage.setRwardDe(EgovStringUtil.removeMinusChar(rwardManage.getRwardDe())); + + // 첨부파일 삭제를 위한 ID 생성 start.... + String _atchFileId = rwardManage.getAtchFileId(); + + //포상 삭제 처리 + egovRwardManageService.deleteRwardManage(rwardManage); + + // 첨부파일을 삭제하기 위한 Vo + FileVO fvo = new FileVO(); + fvo.setAtchFileId(_atchFileId); + + fileMngService.deleteAllFileInf(fvo); + // 첨부파일 삭제 End............. + + status.setComplete(); + model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); + return "forward:/uss/ion/rwd/selectRwardManageList.do"; + } + + /*** 승인관련 ***/ + /** + * 포상관리정보 승인 처리를 위해 신청된 포상관리 목록을 조회한다. + * @param rwardManageVO - 포상관리 VO + * @return String - 리턴 Url + */ + @IncludedInfo(name="포상승인관리", order = 921 ,gid = 50) + @RequestMapping(value="/uss/ion/rwd/EgovRwardConfmList.do") + public String selectRwardManageConfmList(@ModelAttribute("rwardManageVO") RwardManageVO rwardManageVO, + ModelMap model) throws Exception { + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(rwardManageVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(rwardManageVO.getPageUnit()); + paginationInfo.setPageSize(rwardManageVO.getPageSize()); + + rwardManageVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + rwardManageVO.setLastIndex(paginationInfo.getLastRecordIndex()); + rwardManageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + if (user == null) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + rwardManageVO.setSanctnerId(user.getUniqId()); //사용자가 승인권자인지 조건값 setting selectRwardManageList + + rwardManageVO.setRwardManageList(egovRwardManageService.selectRwardManageConfmList(rwardManageVO)); + + model.addAttribute("rwardManageList", rwardManageVO.getRwardManageList()); + + int totCnt = egovRwardManageService.selectRwardManageConfmListTotCnt(rwardManageVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + List rwardCdCodeList = null; + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM055"); + rwardCdCodeList = cmmUseService.selectCmmCodeDetail(vo); + + model.addAttribute("rwardCodeList", rwardCdCodeList); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/uss/ion/rwd/EgovRwardConfmList"; + } + + /** + * 포상승인관리 상세정보를 조회한다. + * @param rwardManageVO - 포상관리 VO + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/rwd/EgovRwardConfm.do") + public String selectRwardConfm( @ModelAttribute("rwardManageVO") RwardManageVO rwardManageVO, + @ModelAttribute("rwardManage") RwardManage rwardManage, + ModelMap model) throws Exception { + rwardManageVO.setRwardDe(EgovStringUtil.removeMinusChar(rwardManageVO.getRwardDe())); + + // 등록 상세정보 + RwardManageVO rwardManageVOTemp = egovRwardManageService.selectRwardManage(rwardManageVO); + + RwardManage rwardManageTemp = new RwardManage(); + + rwardManageTemp.setRwardId(rwardManageVOTemp.getRwardId()); + rwardManageTemp.setRwardNm(rwardManageVOTemp.getRwardNm()); + rwardManageTemp.setPblenCn(rwardManageVOTemp.getPblenCn()); + rwardManageTemp.setRwardManId(rwardManageVOTemp.getRwardManId()); + rwardManageTemp.setRwardCd(rwardManageVOTemp.getRwardCd()); + rwardManageTemp.setRwardDe(rwardManageVOTemp.getRwardDe()); + rwardManageTemp.setSanctnerId(rwardManageVOTemp.getSanctnerId()); + rwardManageTemp.setInfrmlSanctnId(rwardManageVOTemp.getInfrmlSanctnId()); + + model.addAttribute("rwardManage", rwardManageTemp); + model.addAttribute("rwardManageVO", rwardManageVOTemp); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/uss/ion/rwd/EgovRwardConfm"; + } + + /** + * 신청된 포상을 승인처리한다. + * @param rwardManage - 포상관리 model + * @return String - 리턴 Url + */ + @RequestMapping(value="/uss/ion/rwd/updtRwardConfm.do") + public String updtRwardManageConfm( @ModelAttribute("rwardManage") RwardManage rwardManage, + BindingResult bindingResult, + SessionStatus status, + ModelMap model) throws Exception { + beanValidator.validate(rwardManage, bindingResult); //validation 수행 + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + // KISA 보안취약점 조치 (2018-12-10, 신용호) + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if(!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + if (bindingResult.hasErrors()) { + model.addAttribute("rwardManageVO", rwardManage); + return "egovframework/com/uss/ion/vct/EgovRwardConfm"; + } else { + + rwardManage.setSanctnerId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + rwardManage.setLastUpdusrId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + rwardManage.setRwardDe(EgovStringUtil.removeMinusChar(rwardManage.getRwardDe())); + + egovRwardManageService.updtRwardManageConfm(rwardManage); + return "forward:/uss/ion/rwd/EgovRwardConfmList.do"; + } + } +} diff --git a/src/main/java/egovframework/com/uss/ion/sit/service/EgovSiteService.java b/src/main/java/egovframework/com/uss/ion/sit/service/EgovSiteService.java new file mode 100644 index 0000000..04b82b2 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/sit/service/EgovSiteService.java @@ -0,0 +1,21 @@ +package egovframework.com.uss.ion.sit.service; + +import java.util.List; + +import org.egovframe.rte.fdl.cmmn.exception.FdlException; + +public interface EgovSiteService { + + List selectSiteList(SiteVO searchVO); + + int selectSiteListCnt(SiteVO searchVO); + + SiteVO selectSiteDetail(SiteVO siteVO) throws Exception; + + void insertSite(SiteVO siteVO) throws FdlException; + + void updateSite(SiteVO siteVO); + + void deleteSite(SiteVO siteVO); + +} diff --git a/src/main/java/egovframework/com/uss/ion/sit/service/SiteDefaultVO.java b/src/main/java/egovframework/com/uss/ion/sit/service/SiteDefaultVO.java new file mode 100644 index 0000000..c2b6074 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/sit/service/SiteDefaultVO.java @@ -0,0 +1,199 @@ +package egovframework.com.uss.ion.sit.service; + +import java.io.Serializable; + +/** + * + * 사이트정보를 처리하는 클래스 + * @author 공통서비스 개발팀 박정규 + * @since 2009.04.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.01  박정규          최초 생성
    + *
    + * 
    + */ +public class SiteDefaultVO implements Serializable { + + private static final long serialVersionUID = -8481725059952489640L; + + /** 검색조건 */ + private String searchCondition = ""; + + /** 검색Keyword */ + private String searchKeyword = ""; + + /** 검색사용여부 */ + private String searchUseYn = ""; + + /** 현재페이지 */ + private int pageIndex = 1; + + /** 페이지갯수 */ + private int pageUnit = 10; + + /** 페이지사이즈 */ + private int pageSize = 10; + + /** firstIndex */ + private int firstIndex = 1; + + /** lastIndex */ + private int lastIndex = 1; + + /** recordCountPerPage */ + private int recordCountPerPage = 10; + + /** + * searchCondition attribute 를 리턴한다. + * @return the String + */ + public String getSearchCondition() { + return searchCondition; + } + + /** + * searchCondition attribute 값을 설정한다. + * @return searchCondition String + */ + public void setSearchCondition(String searchCondition) { + this.searchCondition = searchCondition; + } + + /** + * searchKeyword attribute 를 리턴한다. + * @return the String + */ + public String getSearchKeyword() { + return searchKeyword; + } + + /** + * searchKeyword attribute 값을 설정한다. + * @return searchKeyword String + */ + public void setSearchKeyword(String searchKeyword) { + this.searchKeyword = searchKeyword; + } + + /** + * searchUseYn attribute 를 리턴한다. + * @return the String + */ + public String getSearchUseYn() { + return searchUseYn; + } + + /** + * searchUseYn attribute 값을 설정한다. + * @return searchUseYn String + */ + public void setSearchUseYn(String searchUseYn) { + this.searchUseYn = searchUseYn; + } + + /** + * pageIndex attribute 를 리턴한다. + * @return the int + */ + public int getPageIndex() { + return pageIndex; + } + + /** + * pageIndex attribute 값을 설정한다. + * @return pageIndex int + */ + public void setPageIndex(int pageIndex) { + this.pageIndex = pageIndex; + } + + /** + * pageUnit attribute 를 리턴한다. + * @return the int + */ + public int getPageUnit() { + return pageUnit; + } + + /** + * pageUnit attribute 값을 설정한다. + * @return pageUnit int + */ + public void setPageUnit(int pageUnit) { + this.pageUnit = pageUnit; + } + + /** + * pageSize attribute 를 리턴한다. + * @return the int + */ + public int getPageSize() { + return pageSize; + } + + /** + * pageSize attribute 값을 설정한다. + * @return pageSize int + */ + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + /** + * firstIndex attribute 를 리턴한다. + * @return the int + */ + public int getFirstIndex() { + return firstIndex; + } + + /** + * firstIndex attribute 값을 설정한다. + * @return firstIndex int + */ + public void setFirstIndex(int firstIndex) { + this.firstIndex = firstIndex; + } + + /** + * lastIndex attribute 를 리턴한다. + * @return the int + */ + public int getLastIndex() { + return lastIndex; + } + + /** + * lastIndex attribute 값을 설정한다. + * @return lastIndex int + */ + public void setLastIndex(int lastIndex) { + this.lastIndex = lastIndex; + } + + /** + * recordCountPerPage attribute 를 리턴한다. + * @return the int + */ + public int getRecordCountPerPage() { + return recordCountPerPage; + } + + /** + * recordCountPerPage attribute 값을 설정한다. + * @return recordCountPerPage int + */ + public void setRecordCountPerPage(int recordCountPerPage) { + this.recordCountPerPage = recordCountPerPage; + } + + + +} diff --git a/src/main/java/egovframework/com/uss/ion/sit/service/SiteVO.java b/src/main/java/egovframework/com/uss/ion/sit/service/SiteVO.java new file mode 100644 index 0000000..2c42548 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/sit/service/SiteVO.java @@ -0,0 +1,312 @@ +package egovframework.com.uss.ion.sit.service; + +/** + * + * 사이트정보를 처리하는 VO 클래스 + * @author 공통서비스 개발팀 박정규 + * @since 2009.04.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.01  박정규          최초 생성
    + *
    + * 
    + */ +public class SiteVO extends SiteDefaultVO { + + private static final long serialVersionUID = 1L; + + /** 사이트 ID */ + private String siteId; + + /** 사이트 URL */ + private String siteUrl; + + /** 사이트명 */ + private String siteNm; + + /** 사이트설명 */ + private String siteDc; + + /** 사이트주제분류코드 */ + private String siteThemaClCode; + + /** 사이트주제분류명 */ + private String siteThemaClNm; + + /** 활성여부 */ + private String actvtyAt; + + /** 활성여부명 */ + private String actvtyAtNm; + + /** 사용여부 */ + private String useAt; + + /** 사용여부명 */ + private String useAtNm; + + /** 등록자명 */ + private String emplyrNm; + + /** 최초등록시점 */ + private String frstRegisterPnttm; + + /** 최초등록자ID */ + private String frstRegisterId; + + /** 최종수정시점 */ + private String lastUpdusrPnttm; + + /** 최종수정자ID */ + private String lastUpdusrId; + + /** + * siteId attribute 를 리턴한다. + * @return the String + */ + public String getSiteId() { + return siteId; + } + + /** + * siteId attribute 값을 설정한다. + * @return siteId String + */ + public void setSiteId(String siteId) { + this.siteId = siteId; + } + + /** + * siteUrl attribute 를 리턴한다. + * @return the String + */ + public String getSiteUrl() { + return siteUrl; + } + + /** + * siteUrl attribute 값을 설정한다. + * @return siteUrl String + */ + public void setSiteUrl(String siteUrl) { + this.siteUrl = siteUrl; + } + + /** + * siteNm attribute 를 리턴한다. + * @return the String + */ + public String getSiteNm() { + return siteNm; + } + + /** + * siteNm attribute 값을 설정한다. + * @return siteNm String + */ + public void setSiteNm(String siteNm) { + this.siteNm = siteNm; + } + + /** + * siteDc attribute 를 리턴한다. + * @return the String + */ + public String getSiteDc() { + return siteDc; + } + + /** + * siteDc attribute 값을 설정한다. + * @return siteDc String + */ + public void setSiteDc(String siteDc) { + this.siteDc = siteDc; + } + + /** + * siteThemaClCode attribute 를 리턴한다. + * @return the String + */ + public String getSiteThemaClCode() { + return siteThemaClCode; + } + + /** + * siteThemaClCode attribute 값을 설정한다. + * @return siteThemaClCode String + */ + public void setSiteThemaClCode(String siteThemaClCode) { + this.siteThemaClCode = siteThemaClCode; + } + + /** + * siteThemaClNm attribute 를 리턴한다. + * @return the String + */ + public String getSiteThemaClNm() { + return siteThemaClNm; + } + + /** + * siteThemaClNm attribute 값을 설정한다. + * @return siteThemaClNm String + */ + public void setSiteThemaClNm(String siteThemaClNm) { + this.siteThemaClNm = siteThemaClNm; + } + + /** + * actvtyAt attribute 를 리턴한다. + * @return the String + */ + public String getActvtyAt() { + return actvtyAt; + } + + /** + * actvtyAt attribute 값을 설정한다. + * @return actvtyAt String + */ + public void setActvtyAt(String actvtyAt) { + this.actvtyAt = actvtyAt; + } + + /** + * actvtyAtNm attribute 를 리턴한다. + * @return the String + */ + public String getActvtyAtNm() { + return actvtyAtNm; + } + + /** + * actvtyAtNm attribute 값을 설정한다. + * @return actvtyAtNm String + */ + public void setActvtyAtNm(String actvtyAtNm) { + this.actvtyAtNm = actvtyAtNm; + } + + /** + * useAt attribute 를 리턴한다. + * @return the String + */ + public String getUseAt() { + return useAt; + } + + /** + * useAt attribute 값을 설정한다. + * @return useAt String + */ + public void setUseAt(String useAt) { + this.useAt = useAt; + } + + /** + * useAtNm attribute 를 리턴한다. + * @return the String + */ + public String getUseAtNm() { + return useAtNm; + } + + /** + * useAtNm attribute 값을 설정한다. + * @return useAtNm String + */ + public void setUseAtNm(String useAtNm) { + this.useAtNm = useAtNm; + } + + /** + * emplyrNm attribute 를 리턴한다. + * @return the String + */ + public String getEmplyrNm() { + return emplyrNm; + } + + /** + * emplyrNm attribute 값을 설정한다. + * @return emplyrNm String + */ + public void setEmplyrNm(String emplyrNm) { + this.emplyrNm = emplyrNm; + } + + /** + * frstRegisterPnttm attribute 를 리턴한다. + * @return the String + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * frstRegisterPnttm attribute 값을 설정한다. + * @return frstRegisterPnttm String + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * frstRegisterId attribute 를 리턴한다. + * @return the String + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * frstRegisterId attribute 값을 설정한다. + * @return frstRegisterId String + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * lastUpdusrPnttm attribute 를 리턴한다. + * @return the String + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * lastUpdusrPnttm attribute 값을 설정한다. + * @return lastUpdusrPnttm String + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * lastUpdusrId attribute 를 리턴한다. + * @return the String + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * lastUpdusrId attribute 값을 설정한다. + * @return lastUpdusrId String + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + + + +} diff --git a/src/main/java/egovframework/com/uss/ion/sit/service/impl/EgovSiteDAO.java b/src/main/java/egovframework/com/uss/ion/sit/service/impl/EgovSiteDAO.java new file mode 100644 index 0000000..1069c67 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/sit/service/impl/EgovSiteDAO.java @@ -0,0 +1,37 @@ +package egovframework.com.uss.ion.sit.service.impl; + +import java.util.List; + +import org.springframework.stereotype.Repository; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.ion.sit.service.SiteVO; + +@Repository("EgovSiteDAO") +public class EgovSiteDAO extends EgovComAbstractDAO { + + public List selectSiteList(SiteVO searchVO) { + return list("SiteManage.selectSiteList", searchVO); + } + + public int selectSiteListCnt(SiteVO searchVO) { + return (Integer) selectOne("SiteManage.selectSiteListCnt", searchVO); + } + + public SiteVO selectSiteDetail(SiteVO siteVO) { + return (SiteVO) selectOne("SiteManage.selectSiteDetail", siteVO); + } + + public void insertSite(SiteVO siteVO) { + insert("SiteManage.insertSite", siteVO); + } + + public void updateSite(SiteVO siteVO) { + update("SiteManage.updateSite", siteVO); + } + + public void deleteSite(SiteVO siteVO) { + delete("SiteManage.deleteSite", siteVO); + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/sit/service/impl/EgovSiteServiceImpl.java b/src/main/java/egovframework/com/uss/ion/sit/service/impl/EgovSiteServiceImpl.java new file mode 100644 index 0000000..942da54 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/sit/service/impl/EgovSiteServiceImpl.java @@ -0,0 +1,61 @@ +package egovframework.com.uss.ion.sit.service.impl; + +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import egovframework.com.uss.ion.sit.service.EgovSiteService; +import egovframework.com.uss.ion.sit.service.SiteVO; +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.cmmn.exception.FdlException; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +@Service("EgovSiteService") +public class EgovSiteServiceImpl extends EgovAbstractServiceImpl implements EgovSiteService { + + @Resource(name="EgovSiteDAO") + private EgovSiteDAO egovSiteDao; + + /** ID Generation */ + @Resource(name="egovSiteManageIdGnrService") + private EgovIdGnrService idgenService; + + @Override + public List selectSiteList(SiteVO searchVO) { + return egovSiteDao.selectSiteList(searchVO); + } + + @Override + public int selectSiteListCnt(SiteVO searchVO) { + return egovSiteDao.selectSiteListCnt(searchVO); + } + + @Override + public SiteVO selectSiteDetail(SiteVO siteVO) throws Exception { + SiteVO resultVO = egovSiteDao.selectSiteDetail(siteVO); + if (resultVO == null) + throw processException("info.nodata.msg"); + return resultVO; + } + + @Override + public void insertSite(SiteVO siteVO) throws FdlException { + String siteId = idgenService.getNextStringId(); + siteVO.setSiteId(siteId); + + egovSiteDao.insertSite(siteVO); + } + + @Override + public void updateSite(SiteVO siteVO) { + egovSiteDao.updateSite(siteVO); + } + + @Override + public void deleteSite(SiteVO siteVO) { + egovSiteDao.deleteSite(siteVO); + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/sit/web/EgovSiteController.java b/src/main/java/egovframework/com/uss/ion/sit/web/EgovSiteController.java new file mode 100644 index 0000000..b68eec2 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/sit/web/EgovSiteController.java @@ -0,0 +1,251 @@ +package egovframework.com.uss.ion.sit.web; + +import java.util.List; + +import javax.annotation.Resource; + +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 egovframework.com.cmm.ComDefaultCodeVO; +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.service.EgovCmmUseService; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.ion.sit.service.EgovSiteService; +import egovframework.com.uss.ion.sit.service.SiteVO; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +/** +* +* 사이트정보를 처리하는 Controller 클래스 +* @author 공통서비스 개발팀 박정규 +* @since 2009.04.01 +* @version 1.0 +* @see +* +*
    +* << 개정이력(Modification Information) >>
    +*
    +*   수정일      수정자           수정내용
    +*  -------    --------    ---------------------------
    +*   2009.04.01  박정규          최초 생성
    +*   2011.8.26	정진오			IncludedInfo annotation 추가
    +*
    +* 
    +*/ + +@Controller +public class EgovSiteController { + + @Resource(name = "EgovSiteService") + private EgovSiteService egovSiteService; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + @Resource(name="EgovCmmUseService") + private EgovCmmUseService cmmUseService; + + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + // Validation 관련 + @Autowired + private DefaultBeanValidator beanValidator; + + /** + * 사이트목록을 조회한다. + * @param searchVO + * @param model + * @return "/uss/ion/sit/EgovSiteList" + * @throws Exception + */ + @IncludedInfo(name="사이트관리", order = 680 ,gid = 50) + @RequestMapping(value="/uss/ion/sit/selectSiteList.do") + public String selectSiteList(@ModelAttribute("searchVO") SiteVO searchVO, ModelMap model) throws Exception { + + /** EgovPropertyService.SiteList */ + 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()); + + List SiteList = egovSiteService.selectSiteList(searchVO); + model.addAttribute("resultList", SiteList); + + int totCnt = egovSiteService.selectSiteListCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/uss/ion/sit/EgovSiteList"; + } + + /** + * 사이트정보 목록에 대한 상세정보를 조회한다. + * @param siteVO + * @param searchVO + * @param model + * @return "/uss/ion/sit/EgovSiteDetail" + * @throws Exception + */ + @RequestMapping("/uss/ion/sit/selectSiteDetail.do") + public String selectSiteDetail(SiteVO siteVO, @ModelAttribute("searchVO") SiteVO searchVO, ModelMap model) throws Exception { + + SiteVO vo = egovSiteService.selectSiteDetail(siteVO); + + model.addAttribute("result", vo); + + return "egovframework/com/uss/ion/sit/EgovSiteDetail"; + } + + /** + * 사이트정보 등록전 단계 + * @param searchVO + * @param model + * @return "/uss/ion/sit/EgovSiteRegist" + * @throws Exception + */ + @RequestMapping("/uss/ion/sit/insertSiteView.do") + public String insertSiteView(@ModelAttribute("searchVO") SiteVO searchVO, Model model) throws Exception { + + // 공통코드를 가져오기 위한 Vo + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM023"); + + List _result = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("siteThemaClCode", _result); + + + model.addAttribute("siteVO", new SiteVO()); + + return "egovframework/com/uss/ion/sit/EgovSiteRegist"; + + } + + /** + * 사이트정보를 등록한다. + * @param searchVO + * @param siteVO + * @param bindingResult + * @return "forward:/uss/ion/sit/selectSiteList.do" + * @throws Exception + */ + @RequestMapping("/uss/ion/sit/insertSite.do") + public String insertSite( + @ModelAttribute("searchVO") SiteVO searchVO, + @ModelAttribute("siteVO") SiteVO siteVO, + BindingResult bindingResult) + throws Exception { + + beanValidator.validate(siteVO, bindingResult); + if(bindingResult.hasErrors()){ + return "egovframework/com/uss/olh/sit/EgovSiteRegist"; + } + + // 로그인VO에서 사용자 정보 가져오기 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + String frstRegisterId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId()); + + siteVO.setFrstRegisterId(frstRegisterId); // 최초등록자ID + siteVO.setLastUpdusrId(frstRegisterId); // 최종수정자ID + + egovSiteService.insertSite(siteVO); + + return "forward:/uss/ion/sit/selectSiteList.do"; + } + + /** + * 사이트정보 수정 전 처리 + * @param siteId + * @param searchVO + * @param model + * @return "/uss/ion/sit/EgovSiteUpdt" + * @throws Exception + */ + @RequestMapping("/uss/ion/sit/updateSiteView.do") + public String updateSiteView(@RequestParam("siteId") String siteId , + @ModelAttribute("searchVO") SiteVO searchVO, ModelMap model) + throws Exception { + + // 공통코드를 가져오기 위한 Vo + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM023"); + + List _result = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("siteThemaClCode", _result); + + SiteVO siteVO = new SiteVO(); + + // Primary Key 값 세팅 + siteVO.setSiteId(siteId); + + model.addAttribute("siteVO", egovSiteService.selectSiteDetail(siteVO)); + + return "egovframework/com/uss/ion/sit/EgovSiteUpdt"; + } + + /** + * 사이트정보를 수정한다. + * @param searchVO + * @param siteVO + * @param bindingResult + * @return "forward:/uss/ion/sit/selectSiteList.do" + * @throws Exception + */ + @RequestMapping("/uss/ion/sit/updateSite.do") + public String updateSite(@ModelAttribute("searchVO") SiteVO searchVO, @ModelAttribute("siteVO") SiteVO siteVO, BindingResult bindingResult) + throws Exception { + + // Validation + beanValidator.validate(siteVO, bindingResult); + if(bindingResult.hasErrors()){ + return "egovframework/com/uss/ion/sit/EgovSiteUpdt"; + } + + // 로그인VO에서 사용자 정보 가져오기 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + String lastUpdusrId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId()); + siteVO.setLastUpdusrId(lastUpdusrId); // 최종수정자ID + + egovSiteService.updateSite(siteVO); + + return "forward:/uss/ion/sit/selectSiteList.do"; + + } + + /** + * 사이트정보를 삭제처리한다. + * @param siteVO + * @param searchVO + * @return "forward:/uss/ion/sit/selectSiteList.do" + * @throws Exception + */ + @RequestMapping("/uss/ion/sit/deleteSite.do") + public String deleteSite(SiteVO siteVO, @ModelAttribute("searchVO") SiteVO searchVO) throws Exception { + + egovSiteService.deleteSite(siteVO); + + return "forward:/uss/ion/sit/selectSiteList.do"; + } +} diff --git a/src/main/java/egovframework/com/uss/ion/tir/service/EgovTwitterRecptnService.java b/src/main/java/egovframework/com/uss/ion/tir/service/EgovTwitterRecptnService.java new file mode 100644 index 0000000..bf13dd7 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/tir/service/EgovTwitterRecptnService.java @@ -0,0 +1,33 @@ +package egovframework.com.uss.ion.tir.service; + +import java.util.List; +import java.util.Map; +/** + * 트위터수신을 처리하는 Service Class 구현 + * @author 공통서비스 장동한 + * @since 2010.06.16 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + *
    + * 
    + */ +public interface EgovTwitterRecptnService { + + /** + * 트위터 목록을 조회한다. + * @param sTwitterId -트위터 아이디 + * @param sTwitterPw -트위터 비밀번호 + * @param nPageSize -페이징 갯수 + * @return List -조회 결과 + * @throws Exception -Exception Throws + */ + public List twitterRecptnList(Map map, int nPageSize) throws Exception; + +} diff --git a/src/main/java/egovframework/com/uss/ion/tir/service/EgovTwitterTrnsmitService.java b/src/main/java/egovframework/com/uss/ion/tir/service/EgovTwitterTrnsmitService.java new file mode 100644 index 0000000..5e51045 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/tir/service/EgovTwitterTrnsmitService.java @@ -0,0 +1,67 @@ +package egovframework.com.uss.ion.tir.service; + +import java.util.Map; + +import twitter4j.Status; +/** + * 트위터송신을 처리하는 Service Class 구현 + * @author 공통서비스 장동한 + * @since 2010.06.16 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + *
    + * 
    + */ +public interface EgovTwitterTrnsmitService { + + + /** + * 트위터를 송신하다. + * @param sTwitterId -트위터 아이디 + * @param sTwitterPw -트위터 비밀번호 + * @param sTwitterText -트위터 등록 메세지 + */ + public Status twitterTrnsmitRegist(Map map, String sTwitterText) throws Exception; + + /** + * 트위터 계정을 건수를 조회 한다. + * @param param -조회할 정보가 담긴 객체 + * @return Map - 조회 정보가 담긴 Map + * @throws Exception + */ + public Map selectTwitterAccount(Map param) throws Exception; + + /** + * 트위터 계정을 건수를 조회 한다. + * @param param -조회할 정보가 담긴 객체 + * @return int - 조회 정보가 담긴 Integer + * @throws Exception + */ + public int selectTwitterAccountCheck(Map param) throws Exception; + + /** + * 트위터 계정을 신규로 등록한다. + * @param param - 조회할 정보가 담긴 Map + */ + public void insertTwitterAccount(Map param) throws Exception; + + /** + * 트위터 계정을 수정한다. + * @param param - 조회할 정보가 담긴 Map + */ + public void updtTwitterAccount(Map param) throws Exception; + + /** + * 트위터 계정을 삭제한다. + * @param param - 조회할 정보가 담긴 Map + */ + public void deleteTwitterAccount(Map param) throws Exception; + +} diff --git a/src/main/java/egovframework/com/uss/ion/tir/service/TwitterInfo.java b/src/main/java/egovframework/com/uss/ion/tir/service/TwitterInfo.java new file mode 100644 index 0000000..19ad7d1 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/tir/service/TwitterInfo.java @@ -0,0 +1,179 @@ +package egovframework.com.uss.ion.tir.service; + +import java.io.Serializable; + +import egovframework.com.cmm.ComDefaultVO; + +/** + * 트위터수신 Model and VO Class 구현 + * @author 공통서비스 장동한 + * @since 2010.06.16 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + * 
    + * 
    + */ +@SuppressWarnings("serial") +public class TwitterInfo extends ComDefaultVO implements Serializable{ + + /** 트위터 아이디 */ + private String twitterId; + + /** 트위터 비밀번호 */ + private String twitterPw; + + /** 트위터 이름 */ + private String twitterNmae; + + /** 트위터 스크린명 */ + private String twitterScreenName; + + /** 트위터 URL */ + private String twitterURL; + + /** 트위터 텍스트 */ + private String twitterText; + + /** 트위터 등록일 */ + private String twitterCreatedAt; + + /** 트위터 프로파일 이미지명 */ + private String twitterProfileImageURL; + + /** 트위터 소스 */ + private String twitterSource; + + /** + * @return the twitterId + */ + public String getTwitterId() { + return twitterId; + } + + /** + * @param twitterId the twitterId to set + */ + public void setTwitterId(String twitterId) { + this.twitterId = twitterId; + } + + /** + * @return the twitterPw + */ + public String getTwitterPw() { + return twitterPw; + } + + /** + * @param twitterPw the twitterPw to set + */ + public void setTwitterPw(String twitterPw) { + this.twitterPw = twitterPw; + } + + /** + * @return the twitterNmae + */ + public String getTwitterNmae() { + return twitterNmae; + } + + /** + * @param twitterNmae the twitterNmae to set + */ + public void setTwitterNmae(String twitterNmae) { + this.twitterNmae = twitterNmae; + } + + /** + * @return the twitterScreenName + */ + public String getTwitterScreenName() { + return twitterScreenName; + } + + /** + * @param twitterScreenName the twitterScreenName to set + */ + public void setTwitterScreenName(String twitterScreenName) { + this.twitterScreenName = twitterScreenName; + } + + /** + * @return the twitterURL + */ + public String getTwitterURL() { + return twitterURL; + } + + /** + * @param twitterURL the twitterURL to set + */ + public void setTwitterURL(String twitterURL) { + this.twitterURL = twitterURL; + } + + /** + * @return the twitterText + */ + public String getTwitterText() { + return twitterText; + } + + /** + * @param twitterText the twitterText to set + */ + public void setTwitterText(String twitterText) { + this.twitterText = twitterText; + } + + /** + * @return the twitterCreatedAt + */ + public String getTwitterCreatedAt() { + return twitterCreatedAt; + } + + /** + * @param twitterCreatedAt the twitterCreatedAt to set + */ + public void setTwitterCreatedAt(String twitterCreatedAt) { + this.twitterCreatedAt = twitterCreatedAt; + } + + /** + * @return the twitterProfileImageURL + */ + public String getTwitterProfileImageURL() { + return twitterProfileImageURL; + } + + /** + * @param twitterProfileImageURL the twitterProfileImageURL to set + */ + public void setTwitterProfileImageURL(String twitterProfileImageURL) { + this.twitterProfileImageURL = twitterProfileImageURL; + } + + /** + * @return the twitterSource + */ + public String getTwitterSource() { + return twitterSource; + } + + /** + * @param twitterSource the twitterSource to set + */ + public void setTwitterSource(String twitterSource) { + this.twitterSource = twitterSource; + } + + + +} diff --git a/src/main/java/egovframework/com/uss/ion/tir/service/impl/EgovTwitterDao.java b/src/main/java/egovframework/com/uss/ion/tir/service/impl/EgovTwitterDao.java new file mode 100644 index 0000000..85f9746 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/tir/service/impl/EgovTwitterDao.java @@ -0,0 +1,69 @@ +package egovframework.com.uss.ion.tir.service.impl; + +import java.util.Map; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; + +import org.springframework.stereotype.Repository; +/** + * RSS태그관리를 처리하는 Dao Class 구현 + * @author 공통콤포넌트 장동한 + * @since 2010.10.04 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2010.10.04  장동한          최초 생성
    + *
    + * 
    + */ +@Repository("twitterDao") +public class EgovTwitterDao extends EgovComAbstractDAO { + + /** + * 트위터 계정을 조회 한다. + * @param param -조회할 정보가 담긴 객체 + * @return Map - 조회 정보가 담긴 Map + * @throws Exception + */ + public Map selectTwitterAccount(Map param) throws Exception { + return (Map)selectOne("Twitter.selectTwitterAccount",param); + } + + + /** + * 트위터 계정을 건수를 조회 한다. + * @param param -조회할 정보가 담긴 객체 + * @return int - 조회 정보가 담긴 Integer + * @throws Exception + */ + public int selectTwitterAccountCheck(Map param) throws Exception { + return (Integer)selectOne("Twitter.selectTwitterAccountCheck",param); + } + + /** + * 트위터 계정을 신규로 등록한다. + * @param param - 조회할 정보가 담긴 Map + */ + public void insertTwitterAccount(Map param) throws Exception { + insert("Twitter.insertTwitterAccount", param); + } + + /** + * 트위터 계정을 수정한다. + * @param param - 조회할 정보가 담긴 Map + */ + public void updtTwitterAccount(Map param) throws Exception { + update("Twitter.updateTwitterAccount", param); + } + + /** + * 트위터 계정을 삭제한다. + * @param param - 조회할 정보가 담긴 Map + */ + public void deleteTwitterAccount(Map param) throws Exception { + delete("Twitter.deleteTwitterAccount",param); + } +} diff --git a/src/main/java/egovframework/com/uss/ion/tir/service/impl/EgovTwitterRecptnServiceImpl.java b/src/main/java/egovframework/com/uss/ion/tir/service/impl/EgovTwitterRecptnServiceImpl.java new file mode 100644 index 0000000..24b85a0 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/tir/service/impl/EgovTwitterRecptnServiceImpl.java @@ -0,0 +1,109 @@ +package egovframework.com.uss.ion.tir.service.impl; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import egovframework.com.uss.ion.tir.service.EgovTwitterRecptnService; +import egovframework.com.uss.ion.tir.service.TwitterInfo; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import org.springframework.stereotype.Service; + +import twitter4j.Paging; +import twitter4j.Status; +import twitter4j.Twitter; +import twitter4j.TwitterFactory; +import twitter4j.auth.AccessToken; +import twitter4j.conf.Configuration; +import twitter4j.conf.ConfigurationBuilder; +/** + * 트위터수신을 처리하는 ServiceImpl Class 구현 + * @author 공통서비스 장동한 + * @since 2010.06.16 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + *
    + * 
    + */ +@Service("egovTwitterRecptnService") +public class EgovTwitterRecptnServiceImpl extends EgovAbstractServiceImpl + implements EgovTwitterRecptnService { + + /** + * 트위터 목록을 조회한다. + * @param sTwitterId -트위터 아이디 + * @param sTwitterPw -트위터 비밀번호 + * @param nPageSize -페이징 갯수 + * @return List -조회 결과 + * @throws Exception -Exception Throws + */ + @Override + @SuppressWarnings({ "rawtypes", "unchecked" }) + public List twitterRecptnList(Map map, int nPageSize) throws Exception { + + String sCONSUMER_KEY = (String)map.get("sCONSUMER_KEY"); + String sCONSUMER_SECRET = (String)map.get("sCONSUMER_SECRET"); + + //트위터 객체선언 + Twitter twitter = new TwitterFactory().getInstance(); + + //CONSUMER KEY, CONSUMER SECRET 설정 + twitter.setOAuthConsumer(sCONSUMER_KEY, sCONSUMER_SECRET); + //twitter.setOAuthConsumer((String)map.get("sCONSUMER_KEY"), (String)map.get("sCONSUMER_SECRET")); + //엑서스 토큰 키 설정 + AccessToken accessToken = new AccessToken((String)map.get("atoken"), (String)map.get("astoken")); + + //엑서스 토큰 설정 + twitter.setOAuthAccessToken(accessToken); + + //트위터 Status 객체 + List statuses; + //반환 트위터 모록 + List listRtn = new ArrayList(); + //트위터 페이징 객체 + Paging page = new Paging(); + //페이지 갯수 설정 + page.count(nPageSize); + //인덱스 설정 + page.setPage(1); + //트위터 타임라인 설정 + statuses = twitter.getUserTimeline(page); + //statuses = twitter.getUserTimeline(new Paging(1, nPageSize)); + //statuses = twitter.getFriendsTimeline((new Paging(1, nPageSize)); + + for(Status status : statuses) { + + //트위터 정보 객체 선언 + TwitterInfo twitterInfo = new TwitterInfo(); + // 트위터 이름 + twitterInfo.setTwitterNmae(status.getUser().getName()); + // 트위터 스크린명 + twitterInfo.setTwitterScreenName(status.getUser().getScreenName()); + // 트위터 URL + twitterInfo.setTwitterURL( String.valueOf(status.getUser().getURL()) ); + // 트위터 텍스트 + twitterInfo.setTwitterText(status.getText()); + ///DATE -> 변환을 하기위한 SimpleDateFormat 설정 + java.text.SimpleDateFormat format = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + // 트위터 등록일 + twitterInfo.setTwitterCreatedAt( format.format(status.getCreatedAt()) ); + // 트위터 프로파일 이미지명 + twitterInfo.setTwitterProfileImageURL(String.valueOf(status.getUser().getProfileImageURL())); + // 트위터 소스 status.getSource() + twitterInfo.setTwitterSource(""); + + listRtn.add(twitterInfo); + } + + + return listRtn; + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/tir/service/impl/EgovTwitterTrnsmitServiceImpl.java b/src/main/java/egovframework/com/uss/ion/tir/service/impl/EgovTwitterTrnsmitServiceImpl.java new file mode 100644 index 0000000..43d872d --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/tir/service/impl/EgovTwitterTrnsmitServiceImpl.java @@ -0,0 +1,112 @@ +package egovframework.com.uss.ion.tir.service.impl; + +import java.util.Map; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import egovframework.com.uss.ion.tir.service.EgovTwitterTrnsmitService; +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import twitter4j.Status; +import twitter4j.Twitter; +import twitter4j.TwitterFactory; +import twitter4j.auth.AccessToken; +import twitter4j.conf.Configuration; +import twitter4j.conf.ConfigurationBuilder; +/** + * 트위터수신을 처리하는 ServiceImpl Class 구현 + * @author 공통서비스 장동한 + * @since 2010.06.16 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + *
    + * 
    + */ +@Service("egovTwitterTrnsmitService") +public class EgovTwitterTrnsmitServiceImpl extends EgovAbstractServiceImpl + implements EgovTwitterTrnsmitService { + + /* 트위터 DAO */ + @Resource(name = "twitterDao") + private EgovTwitterDao dao; + + /** + * 트위터를 송신하다. + * @param sTwitterId -트위터 아이디 + * @param sTwitterPw -트위터 비밀번호 + * @param sTwitterText -트위터 등록 메세지 + */ + @Override + public Status twitterTrnsmitRegist(Map map, String sTwitterText) throws Exception{ + + String sCONSUMER_KEY = (String)map.get("sCONSUMER_KEY"); + String sCONSUMER_SECRET = (String)map.get("sCONSUMER_SECRET"); + //트위터 객체선언 + Twitter twitter = new TwitterFactory().getInstance(); + //CONSUMER KEY, CONSUMER SECRET 설정 + twitter.setOAuthConsumer(sCONSUMER_KEY, sCONSUMER_SECRET); + //엑서스 토큰 키 설정 + AccessToken accessToken = new AccessToken((String)map.get("atoken"), (String)map.get("astoken")); + //엑서스 토큰 설정 + twitter.setOAuthAccessToken(accessToken); + //트위터 글 게시 + return twitter.updateStatus(sTwitterText); + + } + + /** + * 트위터 계정을 건수를 조회 한다. + * @param param -조회할 정보가 담긴 객체 + * @return Map - 조회 정보가 담긴 Map + * @throws Exception + */ + @Override + public Map selectTwitterAccount(Map param) throws Exception { + return dao.selectTwitterAccount(param); + } + + /** + * 트위터 계정을 건수를 조회 한다. + * @param param -조회할 정보가 담긴 객체 + * @return int - 조회 정보가 담긴 Integer + * @throws Exception + */ + @Override + public int selectTwitterAccountCheck(Map param) throws Exception { + return dao.selectTwitterAccountCheck(param); + } + + /** + * 트위터 계정을 신규로 등록한다. + * @param param - 조회할 정보가 담긴 Map + */ + @Override + public void insertTwitterAccount(Map param) throws Exception { + dao.insertTwitterAccount(param); + } + + /** + * 트위터 계정을 수정한다. + * @param param - 조회할 정보가 담긴 Map + */ + @Override + public void updtTwitterAccount(Map param) throws Exception { + dao.updtTwitterAccount(param); + } + + /** + * 트위터 계정을 삭제한다. + * @param param - 조회할 정보가 담긴 Map + */ + @Override + public void deleteTwitterAccount(Map param) throws Exception { + dao.deleteTwitterAccount(param); + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/tir/web/EgovTwitterController.java b/src/main/java/egovframework/com/uss/ion/tir/web/EgovTwitterController.java new file mode 100644 index 0000000..3989099 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/tir/web/EgovTwitterController.java @@ -0,0 +1,406 @@ +package egovframework.com.uss.ion.tir.web; + +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.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.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.util.WebUtils; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.ion.tir.service.EgovTwitterRecptnService; +import egovframework.com.uss.ion.tir.service.EgovTwitterTrnsmitService; +import egovframework.com.uss.ion.tir.service.TwitterInfo; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +import twitter4j.Twitter; +import twitter4j.TwitterFactory; +import twitter4j.auth.AccessToken; + +/** + * 트위터 수신, 송신를 처리하는 Controller Class 구현 + * @author 공통서비스 장동한 + * @since 2010.10.04 + * @version 1.0 + * @see + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2010.10.04  장동한          최초 생성
    + *   2011.8.26	정진오			IncludedInfo annotation 추가
    + *
    + * 
    + */ + +@Controller +public class EgovTwitterController { + + @Autowired + private DefaultBeanValidator beanValidator; + + /** EgovMessageSource */ + @Resource(name = "egovMessageSource") + EgovMessageSource egovMessageSource; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** 트위터 수신(조회) 서비스 */ + @Resource(name = "egovTwitterRecptnService") + private EgovTwitterRecptnService egovTwitterRecptnService; + + /** 트위터 송신(목록) 서비스 */ + @Resource(name = "egovTwitterTrnsmitService") + private EgovTwitterTrnsmitService egovTwitterTrnsmitService; + + /** + * 트위터를 메인 인증 페이지조회 + * @param commandMap -Request Variable + * @return String -리턴 URL + * @throws Exception -Exception Throws + */ + @IncludedInfo(name = "Twitter연동", order = 830, gid = 50) + @RequestMapping(value = "/uss/ion/tir/selectTwitterMain.do") + public String EgovTwitterMain(@RequestParam Map commandMap, ModelMap model) throws Exception { + return "egovframework/com/uss/ion/tir/EgovTwitterMain"; + } + + /** + * 트위터를 인증키 관리 페이지를 조회한다. + * @param model -Spring 제공하는 ModelMap + * @return String -리턴 URL + * @throws Exception -Exception Throws + */ + @RequestMapping(value = "/uss/ion/tir/selectTwitterAccount.do", method = RequestMethod.GET) + public String EgovTwitterAccountGet(ModelMap model) throws Exception { + + // Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + // 로그인 객체 선언 + LoginVO loginVO = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser(); + + HashMap hmPram = new HashMap(); + hmPram.put("usid", loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + + Map mapResult = egovTwitterTrnsmitService.selectTwitterAccount(hmPram); + + //Consumer key/Consumer secret 키 값 조회 + if (mapResult == null) { + model.addAttribute("consumerKey", ""); + model.addAttribute("consumerSecret", ""); + } else { + model.addAttribute("consumerKey", mapResult.get("CONSUMER_KEY")); + model.addAttribute("consumerSecret", mapResult.get("CONSUMER_SECRET")); + } + + return "egovframework/com/uss/ion/tir/EgovTwitterAccount"; + } + + /** + * 트위터를 인증키 관리 페이지를 수정한다. + * @param model -Spring 제공하는 ModelMap + * @return String -리턴 URL + * @throws Exception -Exception Throws + */ + @SuppressWarnings("unused") + @RequestMapping(value = "/uss/ion/tir/selectTwitterAccount.do", method = RequestMethod.POST) + public String EgovTwitterAccountPost(HttpServletRequest request, HttpServletResponse response, ModelMap model) throws Exception { + + // Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + // 로그인 객체 선언 + LoginVO loginVO = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser(); + + String sConsumerKey = request.getParameter("ConsumerKey") == null ? "" : (String) request.getParameter("ConsumerKey"); + String sConsumerSecret = request.getParameter("ConsumerSecret") == null ? "" : (String) request.getParameter("ConsumerSecret"); + + HashMap hmPram = new HashMap(); + hmPram.put("usid", loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + + Map mapResult = egovTwitterTrnsmitService.selectTwitterAccount(hmPram); + + hmPram.put("usid", loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + hmPram.put("consumerKey", sConsumerKey); + hmPram.put("consumerSecret", sConsumerSecret); + hmPram.put("frstRegisterId", loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + hmPram.put("lastUpdusrId", loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + + if (egovTwitterTrnsmitService.selectTwitterAccountCheck(hmPram) > 0) { + egovTwitterTrnsmitService.updtTwitterAccount(hmPram); + } else { + egovTwitterTrnsmitService.insertTwitterAccount(hmPram); + } + + //저장된키 키 Attribute 설정 + model.addAttribute("consumerKey", sConsumerKey); + model.addAttribute("consumerSecret", sConsumerSecret); + + //트위터 세션정보 삭제 + WebUtils.setSessionAttribute(request, "sCONSUMER_KEY", null); + WebUtils.setSessionAttribute(request, "sCONSUMER_SECRET", null); + WebUtils.setSessionAttribute(request, "atoken", null); + WebUtils.setSessionAttribute(request, "astoken", null); + + //저장메세지 설정 + String ReusltScript = ""; + + ReusltScript += ""; + + model.addAttribute("reusltScript", ReusltScript); + + return "egovframework/com/uss/ion/tir/EgovTwitterAccount"; + } + + /** + * 트위터를 인증 페이지를 조회한다. + * @param model -Spring 제공하는 ModelMap + * @return String -리턴 URL + * @throws Exception -Exception Throws + */ + @RequestMapping(value = "/uss/ion/tir/selectTwitterPopup.do") + public String EgovTwitterPopupGet(ModelMap model) throws Exception { + + // Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + // 로그인 객체 선언 + LoginVO loginVO = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser(); + + HashMap hmPram = new HashMap(); + hmPram.put("usid", loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + + Map mapResult = egovTwitterTrnsmitService.selectTwitterAccount(hmPram); + + //Consumer key/Consumer secret 키 값 조회 + if (mapResult == null) { + model.addAttribute("consumerKey", ""); + model.addAttribute("consumerSecret", ""); + } else { + model.addAttribute("consumerKey", mapResult.get("CONSUMER_KEY")); + model.addAttribute("consumerSecret", mapResult.get("CONSUMER_SECRET")); + } + + return "egovframework/com/uss/ion/tir/EgovTwitterPopup"; + } + + /** + * 트위터를 인증 페이지를 조회한다. + * @param searchVO -트위터 Model + * @param commandMap -Request Variable + * @param twitterInfo -트위터 Model + * @param model -Spring 제공하는 ModelMap + * @return String -리턴 URL + * @throws Exception -Exception Throws + */ + @RequestMapping(value = "/uss/ion/tir/selectTwitterPopupActor.do") + public String EgovTwitterPopupPost(@RequestParam Map commandMap, ModelMap model) throws Exception { + + String sCheckKey = commandMap.get("chkKey") == null ? "" : (String) commandMap.get("chkKey"); + + String sConsumerKey = commandMap.get("ConsumerKey") == null ? "" : (String) commandMap.get("ConsumerKey"); + String sConsumerSecret = commandMap.get("ConsumerSecret") == null ? "" : (String) commandMap.get("ConsumerSecret"); + + // Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + // 로그인 객체 선언 + LoginVO loginVO = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser(); + + HashMap hmPram = new HashMap(); + hmPram.put("usid", loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + hmPram.put("consumerKey", sConsumerKey); + hmPram.put("consumerSecret", sConsumerSecret); + hmPram.put("frstRegisterId", loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + hmPram.put("lastUpdusrId", loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + + System.out.println("EgovTwitterPopupPost>"); + System.out.println("selectTwitterAccountCheck>" + egovTwitterTrnsmitService.selectTwitterAccountCheck(hmPram)); + + //Consumer key/Consumer secret 키 값 저장 체크시 + if (sCheckKey.equals("1")) { + if (egovTwitterTrnsmitService.selectTwitterAccountCheck(hmPram) > 0) { + egovTwitterTrnsmitService.updtTwitterAccount(hmPram); + } else { + egovTwitterTrnsmitService.insertTwitterAccount(hmPram); + } + + } else { + egovTwitterTrnsmitService.deleteTwitterAccount(hmPram); + } + + return "egovframework/com/uss/ion/tir/EgovTwitterPopupActor"; + } + + /** + * 트위터를 인증 페이지를 조회한다. + * @param model -Spring 제공하는 ModelMap + * @return String -리턴 URL + * @throws Exception -Exception Throws + */ + @RequestMapping(value = "/uss/ion/tir/selectTwitterPopupProcess.do") + public String EgovTwitterPopupProcess(ModelMap model) throws Exception { + return "egovframework/com/uss/ion/tir/EgovTwitterPopupProcess"; + } + + /** + * 트위터를 수신을 조회 처리한다. + * @param searchVO -트위터 Model + * @param commandMap -Request Variable + * @param twitterInfo -트위터 Model + * @param model -Spring 제공하는 ModelMap + * @param request -HttpServletRequest 객체 + * @param response -HttpServletResponse 객체 + * @return String -리턴 URL + * @throws Exception -Exception Throws + */ + @RequestMapping(value = "/uss/ion/tir/listTwitterRecptn.do") + public String EgovTwitterRecptnPost(@ModelAttribute("searchVO") TwitterInfo searchVO, @ModelAttribute("twitterInfo") TwitterInfo twitterInfo, HttpServletRequest request, + HttpServletResponse response, ModelMap model) throws Exception { + + //리턴 URL + String sLocationUrl = "egovframework/com/uss/ion/tir/EgovTwitterRecptn"; + + /** 페이징 정보 설정 */ + searchVO.setPageUnit(propertiesService.getInt("pageUnit")); + searchVO.setPageSize(propertiesService.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()); + + String sCONSUMER_KEY = (String) WebUtils.getSessionAttribute(request, "sCONSUMER_KEY"); + String sCONSUMER_SECRET = (String) WebUtils.getSessionAttribute(request, "sCONSUMER_SECRET"); + + String atoken = (String) WebUtils.getSessionAttribute(request, "atoken"); + String astoken = (String) WebUtils.getSessionAttribute(request, "astoken"); + + int nPageSize = 50; + + HashMap hmParam = new HashMap(); + + if (request.getParameter("pageSize") != null) { + if (!request.getParameter("pageSize").equals("")) { + nPageSize = Integer.parseInt(String.valueOf(request.getParameter("pageSize"))); + } + } + + //인증키값 설정 + hmParam.put("sCONSUMER_KEY", sCONSUMER_KEY); + hmParam.put("sCONSUMER_SECRET", sCONSUMER_SECRET); + hmParam.put("atoken", atoken); + hmParam.put("astoken", astoken); + + //트위터 객체선언 + Twitter twitter = new TwitterFactory().getInstance(); + twitter.setOAuthConsumer(sCONSUMER_KEY, sCONSUMER_SECRET); + + //CONSUMER KEY, CONSUMER SECRET 설정 + //twitter.setOAuthConsumer(sCONSUMER_KEY, sCONSUMER_SECRET); + //엑서스 토큰 키 설정 + AccessToken accessToken = new AccessToken(atoken, astoken); + //엑서스 토큰 설정 + twitter.setOAuthAccessToken(accessToken); + + //twitter.verifyCredentials(); + //twitter.getFriendsTimeline().subList(0, 100); + + model.addAttribute("resultList", egovTwitterRecptnService.twitterRecptnList(hmParam, nPageSize)); + model.addAttribute("pageSize", nPageSize); //전체 페이지 갯수 + + return sLocationUrl; + + } + + /** + * 트위터를 송신 페이지를 조회 한다. + * @param model -Spring 제공하는 ModelMap + * @return String -리턴 URL + * @throws Exception -Exception Throws + */ + @RequestMapping(value = "/uss/ion/tir/registTwitterTrnsmit.do", method = RequestMethod.GET) + public String EgovTwitterTrnsmitGet(ModelMap model) throws Exception { + + model.addAttribute("twitterInfo", new TwitterInfo()); + return "egovframework/com/uss/ion/tir/EgovTwitterTrnsmit"; + } + + /** + * 트위터를 송신을 등록 처리 한다. + * @param searchVO -트위터 Model + * @param commandMap -Request Variable + * @param twitterInfo -트위터 Model + * @param request -HttpServletRequest 객체 + * @param response -HttpServletResponse 객체 + * @param model -Spring 제공하는 ModelMap + * @return String -리턴 URL + * @throws Exception -Exception Throws + */ + @RequestMapping(value = "/uss/ion/tir/registTwitterTrnsmit.do", method = RequestMethod.POST) + public String EgovTwitterTrnsmitPost(TwitterInfo twitterInfo, HttpServletRequest request, HttpServletResponse response, ModelMap model) throws Exception { + + String sCONSUMER_KEY = (String) WebUtils.getSessionAttribute(request, "sCONSUMER_KEY"); + String sCONSUMER_SECRET = (String) WebUtils.getSessionAttribute(request, "sCONSUMER_SECRET"); + + String atoken = (String) WebUtils.getSessionAttribute(request, "atoken"); + String astoken = (String) WebUtils.getSessionAttribute(request, "astoken"); + + HashMap hmParam = new HashMap(); + + //인증키값 설정 + hmParam.put("sCONSUMER_KEY", sCONSUMER_KEY); + hmParam.put("sCONSUMER_SECRET", sCONSUMER_SECRET); + hmParam.put("atoken", atoken); + hmParam.put("astoken", astoken); + System.out.println("[Controller]===>>> atoken = "+atoken); + System.out.println("[Controller]===>>> astoken = "+astoken); + //트위터 글 게시 + twitter4j.Status status = egovTwitterTrnsmitService.twitterTrnsmitRegist(hmParam, twitterInfo.getTwitterText()); + model.addAttribute("status", status); + + return "egovframework/com/uss/ion/tir/EgovTwitterTrnsmitResult"; + } +} diff --git a/src/main/java/egovframework/com/uss/ion/uas/service/EgovUserAbsnceService.java b/src/main/java/egovframework/com/uss/ion/uas/service/EgovUserAbsnceService.java new file mode 100644 index 0000000..76d8929 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/uas/service/EgovUserAbsnceService.java @@ -0,0 +1,65 @@ +/** + * 개요 + * - 사용자부재에 대한 Service Interface를 정의한다. + * + * 상세내용 + * - 사용자부재에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 사용자부재의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이문준 + * @version 1.0 + * @created 03-8-2009 오후 2:09:36 + */ + +package egovframework.com.uss.ion.uas.service; + +import java.util.List; + +public interface EgovUserAbsnceService { + + /** + * 사용자부재정보를 관리하기 위해 등록된 사용자부재 목록을 조회한다. + * @param userAbsnceVO - 사용자부재 VO + * @return List - 사용자부재 목록 + */ + public List selectUserAbsnceList(UserAbsnceVO userAbsnceVO) throws Exception; + + /** + * 사용자부재목록 총 갯수를 조회한다. + * @param userAbsnceVO - 사용자부재 VO + * @return int - 사용자부재 카운트 수 + */ + public int selectUserAbsnceListTotCnt(UserAbsnceVO userAbsnceVO) throws Exception; + + /** + * 등록된 사용자부재 상세정보를 조회한다. + * @param userAbsnceVO - 사용자부재 VO + * @return UserAbsnceVO - 사용자부재 VO + */ + public UserAbsnceVO selectUserAbsnce(UserAbsnceVO userAbsnceVO) throws Exception; + + /** + * 사용자부재정보를 신규로 등록한다. + * @param userAbsnce - 사용자부재 model + * @param userAbsnceVO - 사용자부재 VO + */ + public UserAbsnceVO insertUserAbsnce(UserAbsnce userAbsnce, UserAbsnceVO userAbsnceVO) throws Exception; + + /** + * 기 등록된 사용자부재정보를 수정한다. + * @param userAbsnce - 사용자부재 model + */ + public void updateUserAbsnce(UserAbsnce userAbsnce) throws Exception; + + /** + * 기 등록된 사용자부재정보를 삭제한다. + * @param userAbsnce - 사용자부재 model + */ + public void deleteUserAbsnce(UserAbsnce userAbsnce) throws Exception; + + /** + * 사용자부재정보가 특정화면에 반영된 결과를 조회한다. + * @param userAbsnceVO - 사용자부재 VO + * @return UserAbsnceVO - 사용자부재 VO + */ + public UserAbsnceVO selectUserAbsnceResult(UserAbsnceVO userAbsnceVO) throws Exception; +} diff --git a/src/main/java/egovframework/com/uss/ion/uas/service/UserAbsnce.java b/src/main/java/egovframework/com/uss/ion/uas/service/UserAbsnce.java new file mode 100644 index 0000000..4e762bd --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/uas/service/UserAbsnce.java @@ -0,0 +1,119 @@ +/** + * 개요 + * - 사용자부재에 대한 model 클래스를 정의한다. + * + * 상세내용 + * - 사용자부재의 사용자ID, 사용자부재여부 항목을 관리한다. + * @author 이문준 + * @version 1.0 + * @created 03-8-2009 오후 2:09:34 + */ + +package egovframework.com.uss.ion.uas.service; + +import egovframework.com.cmm.ComDefaultVO; + +public class UserAbsnce extends ComDefaultVO { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + /** + * 사용자ID + */ + private String userId; + /** + * 사용자명 + */ + private String userNm; + /** + * 사용자부재여부 + */ + private String userAbsnceAt; + /** + * 최종등록자ID + */ + private String lastUpdusrId; + /** + * 최종등록시점 + */ + private String lastUpdusrPnttm; + /** + * 등록여부 + */ + private String regYn; + + /** + * @return the userId + */ + public String getUserId() { + return userId; + } + /** + * @param userId the userId to set + */ + public void setUserId(String userId) { + this.userId = userId; + } + /** + * @return the userNm + */ + public String getUserNm() { + return userNm; + } + /** + * @param userNm the userNm to set + */ + public void setUserNm(String userNm) { + this.userNm = userNm; + } + /** + * @return the userAbsnceAt + */ + public String getUserAbsnceAt() { + return userAbsnceAt; + } + /** + * @param userAbsnceAt the userAbsnceAt to set + */ + public void setUserAbsnceAt(String userAbsnceAt) { + this.userAbsnceAt = userAbsnceAt; + } + /** + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + /** + * @param lastUpdusrId the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + /** + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + /** + * @param lastUpdusrPnttm the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + /** + * @return the regYn + */ + public String getRegYn() { + return regYn; + } + /** + * @param regYn the regYn to set + */ + public void setRegYn(String regYn) { + this.regYn = regYn; + } +} diff --git a/src/main/java/egovframework/com/uss/ion/uas/service/UserAbsnceVO.java b/src/main/java/egovframework/com/uss/ion/uas/service/UserAbsnceVO.java new file mode 100644 index 0000000..b9040e4 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/uas/service/UserAbsnceVO.java @@ -0,0 +1,74 @@ +/** + * 개요 + * - 사용자부재에 대한 Vo 클래스를 정의한다. + * + * 상세내용 + * - 사용자부재의 목록 항목을 관리한다. + * @author 이문준 + * @version 1.0 + * @created 03-8-2009 오후 2:09:37 + */ + +package egovframework.com.uss.ion.uas.service; + +import java.util.List; + +public class UserAbsnceVO extends UserAbsnce { + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + /** + * 사용자부재 목록 + */ + List userAbsnceList; + /** + * 삭제대상 목록 + */ + String[] delYn; + /** + * 부재여부 조회조건 + */ + String selAbsnceAt; + + /** + * @return the userAbsnceList + */ + public List getUserAbsnceList() { + return userAbsnceList; + } + /** + * @param userAbsnceList the userAbsnceList to set + */ + public void setUserAbsnceList(List userAbsnceList) { + this.userAbsnceList = userAbsnceList; + } + /** + * @return the delYn + */ + public String[] getDelYn() { + return delYn; + } + /** + * @param delYn the delYn to set + */ + public void setDelYn(String[] delYn) { + this.delYn = delYn; + } + /** + * @return the selAbsnceAt + */ + public String getSelAbsnceAt() { + return selAbsnceAt; + } + /** + * @param selAbsnceAt the selAbsnceAt to set + */ + public void setSelAbsnceAt(String selAbsnceAt) { + this.selAbsnceAt = selAbsnceAt; + } + + + + +} diff --git a/src/main/java/egovframework/com/uss/ion/uas/service/impl/EgovUserAbsnceServiceImpl.java b/src/main/java/egovframework/com/uss/ion/uas/service/impl/EgovUserAbsnceServiceImpl.java new file mode 100644 index 0000000..cddcde2 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/uas/service/impl/EgovUserAbsnceServiceImpl.java @@ -0,0 +1,95 @@ +/** + * 개요 + * - 사용자부재에 대한 ServiceImpl 클래스를 정의한다. + * + * 상세내용 + * - 사용자부재에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 사용자부재의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이문준 + * @version 1.0 + * @created 03-8-2009 오후 2:09:36 + */ + +package egovframework.com.uss.ion.uas.service.impl; + +import java.util.List; + +import egovframework.com.uss.ion.uas.service.EgovUserAbsnceService; +import egovframework.com.uss.ion.uas.service.UserAbsnce; +import egovframework.com.uss.ion.uas.service.UserAbsnceVO; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +@Service("egovUserAbsnceService") +public class EgovUserAbsnceServiceImpl extends EgovAbstractServiceImpl implements EgovUserAbsnceService { + + @Resource(name="userAbsnceDAO") + private UserAbsnceDAO userAbsnceDAO; + + /** + * 사용자부재정보를 관리하기 위해 등록된 사용자부재 목록을 조회한다. + * @param userAbsnceVO - 사용자부재 VO + * @return List - 사용자부재 목록 + */ + public List selectUserAbsnceList(UserAbsnceVO userAbsnceVO) throws Exception { + return userAbsnceDAO.selectUserAbsnceList(userAbsnceVO); + } + + /** + * 사용자부재정보목록 총 갯수를 조회한다. + * @param userAbsnceVO - 사용자부재 VO + * @return int - 사용자부재 카운트 수 + */ + public int selectUserAbsnceListTotCnt(UserAbsnceVO userAbsnceVO) throws Exception { + return userAbsnceDAO.selectUserAbsnceListTotCnt(userAbsnceVO); + } + + /** + * 등록된 사용자부재 상세정보를 조회한다. + * @param userAbsnceVO - 사용자부재 VO + * @return UserAbsnceVO - 사용자부재 VO + */ + public UserAbsnceVO selectUserAbsnce(UserAbsnceVO userAbsnceVO) throws Exception { + return userAbsnceDAO.selectUserAbsnce(userAbsnceVO); + } + + /** + * 사용자부재정보를 신규로 등록한다. + * @param userAbsnce - 사용자부재 model + * @return UserAbsnceVO - 사용자부재 VO + */ + public UserAbsnceVO insertUserAbsnce(UserAbsnce userAbsnce, UserAbsnceVO userAbsnceVO) throws Exception { + userAbsnceDAO.insertUserAbsnce(userAbsnce); + userAbsnceVO.setUserId(userAbsnce.getUserId()); + return selectUserAbsnce(userAbsnceVO); + } + + /** + * 기 등록된 사용자부재정보를 수정한다. + * @param userAbsnce - 사용자부재 model + */ + public void updateUserAbsnce(UserAbsnce userAbsnce) throws Exception { + userAbsnceDAO.updateUserAbsnce(userAbsnce); + } + + /** + * 기 등록된 사용자부재정보를 삭제한다. + * @param userAbsnce - 사용자부재 model + */ + public void deleteUserAbsnce(UserAbsnce userAbsnce) throws Exception { + userAbsnceDAO.deleteUserAbsnce(userAbsnce); + } + + /** + * 사용자부재정보가 특정화면에 반영된 결과를 조회한다. + * @param userAbsnceVO - 사용자부재 VO + * @return UserAbsnceVO - 사용자부재 VO + */ + public UserAbsnceVO selectUserAbsnceResult(UserAbsnceVO userAbsnceVO) throws Exception { + return null; + } +} diff --git a/src/main/java/egovframework/com/uss/ion/uas/service/impl/UserAbsnceDAO.java b/src/main/java/egovframework/com/uss/ion/uas/service/impl/UserAbsnceDAO.java new file mode 100644 index 0000000..d162b4f --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/uas/service/impl/UserAbsnceDAO.java @@ -0,0 +1,86 @@ +/** + * 개요 + * - 사용자부재에 대한 DAO 클래스를 정의한다. + * + * 상세내용 + * - 사용자부재에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 사용자부재의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이문준 + * @version 1.0 + * @created 03-8-2009 오후 2:09:35 + */ + +package egovframework.com.uss.ion.uas.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.ion.uas.service.UserAbsnce; +import egovframework.com.uss.ion.uas.service.UserAbsnceVO; + +import org.springframework.stereotype.Repository; + +@Repository("userAbsnceDAO") +public class UserAbsnceDAO extends EgovComAbstractDAO { + + /** + * 사용자부재정보를 관리하기 위해 등록된 사용자부재 목록을 조회한다. + * @param userAbsnceVO - 사용자부재 VO + * @return List - 사용자부재 목록 + */ + public List selectUserAbsnceList(UserAbsnceVO userAbsnceVO) throws Exception { + return selectList("userAbsnceDAO.selectUserAbsnceList", userAbsnceVO); + } + + /** + * 사용자부재목록 총 갯수를 조회한다. + * @param mainImageVO - 사용자부재 VO + * @return int + * @exception Exception + */ + public int selectUserAbsnceListTotCnt(UserAbsnceVO userAbsnceVO) throws Exception { + return (Integer)selectOne("userAbsnceDAO.selectUserAbsnceListTotCnt", userAbsnceVO); + } + + /** + * 등록된 사용자부재 상세정보를 조회한다. + * @param userAbsnceVO - 사용자부재 VO + * @return UserAbsnceVO - 사용자부재 VO + */ + public UserAbsnceVO selectUserAbsnce(UserAbsnceVO userAbsnceVO) throws Exception { + return (UserAbsnceVO) selectOne("userAbsnceDAO.selectUserAbsnce", userAbsnceVO); + } + + /** + * 사용자부재정보를 신규로 등록한다. + * @param userAbsnce - 사용자부재 model + */ + public void insertUserAbsnce(UserAbsnce userAbsnce) throws Exception { + insert("userAbsnceDAO.insertUserAbsnce", userAbsnce); + } + + /** + * 기 등록된 사용자부재정보를 수정한다. + * @param userAbsnce - 사용자부재 model + */ + public void updateUserAbsnce(UserAbsnce userAbsnce) throws Exception { + update("userAbsnceDAO.updateUserAbsnce", userAbsnce); + } + + /** + * 기 등록된 사용자부재정보를 삭제한다. + * @param userAbsnce - 사용자부재 model + */ + public void deleteUserAbsnce(UserAbsnce userAbsnce) throws Exception { + delete("userAbsnceDAO.deleteUserAbsnce", userAbsnce); + } + + /** + * 사용자부재정보가 특정화면에 반영된 결과를 조회한다. + * @param userAbsnceVO - 사용자부재 VO + * @return UserAbsnceVO - 사용자부재 VO + */ + public UserAbsnceVO selectUserAbsnceResult(UserAbsnceVO userAbsnceVO) throws Exception { + return null; + } +} diff --git a/src/main/java/egovframework/com/uss/ion/uas/web/EgovUserAbsnceController.java b/src/main/java/egovframework/com/uss/ion/uas/web/EgovUserAbsnceController.java new file mode 100644 index 0000000..99000f9 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/uas/web/EgovUserAbsnceController.java @@ -0,0 +1,260 @@ +/** + * 개요 + * - 사용자부재에 대한 controller 클래스를 정의한다. + * + * 상세내용 + * - 사용자부재에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 사용자부재의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이문준 + * @version 1.0 + * @created 03-8-2009 오후 2:09:35 + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.8.03  이문준          최초 생성
    + *   2011.8.26	정진오			IncludedInfo annotation 추가
    + *
    + * 
    + */ + +package egovframework.com.uss.ion.uas.web; + +import javax.annotation.Resource; + +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 egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.ion.uas.service.EgovUserAbsnceService; +import egovframework.com.uss.ion.uas.service.UserAbsnce; +import egovframework.com.uss.ion.uas.service.UserAbsnceVO; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + + +@Controller +public class EgovUserAbsnceController { + + + + + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name = "egovUserAbsnceService") + private EgovUserAbsnceService egovUserAbsnceService; + + @Autowired + private DefaultBeanValidator beanValidator; + + /** + * 사용자부재 목록화면 이동 + * @return String + * @exception Exception + */ + @IncludedInfo(name="사용자부재관리", order = 790 ,gid = 50) + @RequestMapping("/uss/ion/uas/selectUserAbsnceListView.do") + public String selectUserAbsnceListView() throws Exception { + + return "egovframework/com/uss/ion/uas/EgovUserAbsnceList"; + } + + /** + * 사용자부재정보를 관리하기 위해 등록된 사용자부재 목록을 조회한다. + * @param userAbsnceVO - 사용자부재 VO + * @return String - 리턴 Url + */ + @RequestMapping("/uss/ion/uas/selectUserAbsnceList.do") + public String selectUserAbsnceList(@RequestParam("selAbsnceAt") String selAbsnceAt, + @ModelAttribute("userAbsnceVO") UserAbsnceVO userAbsnceVO, + ModelMap model) throws Exception { + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(userAbsnceVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(userAbsnceVO.getPageUnit()); + paginationInfo.setPageSize(userAbsnceVO.getPageSize()); + + userAbsnceVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + userAbsnceVO.setLastIndex(paginationInfo.getLastRecordIndex()); + userAbsnceVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + userAbsnceVO.setSelAbsnceAt(selAbsnceAt); + userAbsnceVO.setUserAbsnceList(egovUserAbsnceService.selectUserAbsnceList(userAbsnceVO)); + + model.addAttribute("userAbsnceList", userAbsnceVO.getUserAbsnceList()); + + int totCnt = egovUserAbsnceService.selectUserAbsnceListTotCnt(userAbsnceVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/uss/ion/uas/EgovUserAbsnceList"; + } + + /** + * 등록된 사용자부재 상세정보를 조회한다. + * @param userAbsnceVO - 사용자부재 VO + * @return String - 리턴 Url + */ + @RequestMapping("/uss/ion/uas/getUserAbsnce.do") + public String selectUserAbsnce(@RequestParam("userId") String userId, + @ModelAttribute("userAbsnceVO") UserAbsnceVO userAbsnceVO, + ModelMap model) throws Exception { + + userAbsnceVO.setUserId(userId); + model.addAttribute("userAbsnce", egovUserAbsnceService.selectUserAbsnce(userAbsnceVO)); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + UserAbsnceVO vo = (UserAbsnceVO)model.get("userAbsnce"); + + if(vo.getRegYn().equals("N")) + return "egovframework/com/uss/ion/uas/EgovUserAbsnceRegist"; + else + return "egovframework/com/uss/ion/uas/EgovUserAbsnceUpdt"; + } + + /** + * 사용자부재정보를 신규로 등록한다. + * @param userAbsnce - 사용자부재 model + * @return String - 리턴 Url + */ + @RequestMapping("/uss/ion/uas/addViewUserAbsnce.do") + public String insertUserAbsnceView(@RequestParam("userId") String userId, + @ModelAttribute("userAbsnceVO") UserAbsnceVO userAbsnceVO, + ModelMap model) throws Exception { + userAbsnceVO.setUserId(userId); + model.addAttribute("userAbsnce", egovUserAbsnceService.selectUserAbsnce(userAbsnceVO)); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + +// return "egovframework/com/uss/ion/uas/EgovUserAbsnceRegist"; + return "forward:/uss/ion/uas/selectUserAbsnceList.do"; + + } + + /** + * 사용자부재정보를 신규로 등록한다. + * @param userAbsnce - 사용자부재 model + * @return String - 리턴 Url + */ + @RequestMapping("/uss/ion/uas/addUserAbsnce.do") + public String insertUserAbsnce(@ModelAttribute("userAbsnce") UserAbsnce userAbsnce, + @ModelAttribute("userAbsnceVO") UserAbsnceVO userAbsnceVO, + BindingResult bindingResult, + ModelMap model) throws Exception { + + beanValidator.validate(userAbsnce, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + model.addAttribute("userAbsnceVO", userAbsnceVO); + return "egovframework/com/uss/ion/msi/EgovMainImageRegist"; + } else { + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + userAbsnce.setLastUpdusrId(user == null ? "" : EgovStringUtil.isNullToString(user.getId())); + + model.addAttribute("userAbsnce", egovUserAbsnceService.insertUserAbsnce(userAbsnce, userAbsnceVO)); + model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); + +// return "egovframework/com/uss/ion/uas/EgovUserAbsnceUpdt"; + return "forward:/uss/ion/uas/selectUserAbsnceList.do"; + } + } + + /** + * 기 등록된 사용자부재정보를 수정한다. + * @param userAbsnce - 사용자부재 model + * @return String - 리턴 Url + */ + @RequestMapping("/uss/ion/uas/updtUserAbsnce.do") + public String updateUserAbsnce(@ModelAttribute("userAbsnce") UserAbsnce userAbsnce, + BindingResult bindingResult, + ModelMap model) throws Exception { + + if (bindingResult.hasErrors()) { + model.addAttribute("userAbsnceVO", userAbsnce); + return "egovframework/com/uss/ion/uas/EgovUserAbsnceUpdt"; + } else { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + userAbsnce.setLastUpdusrId(user == null ? "" : EgovStringUtil.isNullToString(user.getId())); + + egovUserAbsnceService.updateUserAbsnce(userAbsnce); +// return "forward:/uss/ion/uas/getUserAbsnce.do"; + return "forward:/uss/ion/uas/selectUserAbsnceList.do"; + } + } + + /** + * 기 등록된 사용자부재정보를 삭제한다. + * @param userAbsnce - 사용자부재 model + * @return String - 리턴 Url + */ + @RequestMapping("/uss/ion/uas/removeUserAbsnce.do") + public String deleteUserAbsnce(@ModelAttribute("userAbsnce") UserAbsnce userAbsnce, + ModelMap model) throws Exception { + + egovUserAbsnceService.deleteUserAbsnce(userAbsnce); + model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); + return "forward:/uss/ion/uas/selectUserAbsnceList.do"; + } + + /** + * 기 등록된 사용자부재정보를 삭제한다. + * @param userAbsnce - 사용자부재 model + * @return String - 리턴 Url + */ + @RequestMapping("/uss/ion/uas/removeUserAbsnceList.do") + public String deleteUserAbsnceList(@RequestParam("userIds") String userIds , + @ModelAttribute("userAbsnce") UserAbsnce userAbsnce, + ModelMap model) throws Exception { + + String [] strUserIds = userIds.split(";"); + + for(int i=0; i + * << 개정이력(Modification Information) >> + * + * 수정일 수정자 수정내용 + * ------- -------- --------------------------- + * 2009.07.03 장동한 최초 생성 + * + * + */ +public interface EgovUnityLinkService { + + /** + * 통합링크관리 메인 셈플 목록을 조회한다. + * @param unityLink 통합링크관리 정보 담김 VO + * @return List + * @throws Exception + */ + public List selectUnityLinkSample(UnityLink unityLink) throws Exception; + + /** + * 통합링크관리 목록을 조회한다. + * @param searchVO 조회할 정보가 담긴 VO + * @return List + * @throws Exception + */ + public List selectUnityLinkList(ComDefaultVO searchVO) throws Exception; + + /** + * 통합링크관리를(을) 목록 전체 건수를(을) 조회한다. + * @param searchVO 조회할 정보가 담긴 VO + * @return int + * @throws Exception + */ + public int selectUnityLinkListCnt(ComDefaultVO searchVO) throws Exception; + + /** + * 통합링크관리를(을) 상세조회 한다. + * @param unityLink 통합링크관리 정보 담김 VO + * @return List + * @throws Exception + */ + public UnityLink selectUnityLinkDetail(UnityLink unityLink) throws Exception; + + /** + * 통합링크관리를(을) 등록한다. + * @param unityLink 통합링크관리 정보 담김 VO + * @throws Exception + */ + void insertUnityLink(UnityLink unityLink) throws Exception; + + /** + * 통합링크관리를(을) 수정한다. + * @param unityLink 통합링크관리 정보 담김 VO + * @throws Exception + */ + void updateUnityLink(UnityLink unityLink) throws Exception; + + /** + * 통합링크관리를(을) 삭제한다. + * @param unityLink 통합링크관리 정보 담김 VO + * @throws Exception + */ + void deleteUnityLink(UnityLink unityLink) throws Exception; + +} diff --git a/src/main/java/egovframework/com/uss/ion/ulm/service/UnityLink.java b/src/main/java/egovframework/com/uss/ion/ulm/service/UnityLink.java new file mode 100644 index 0000000..a7ae109 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ulm/service/UnityLink.java @@ -0,0 +1,235 @@ +package egovframework.com.uss.ion.ulm.service; + +import java.io.Serializable; + +/** + * 통합링크관리 VO Class 구현 + * @author 공통서비스 장동한 + * @since 2009.07.03 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + *
    + * 
    + */ +public class UnityLink implements Serializable { + + private static final long serialVersionUID = 1607776015478505197L; + + /** 통합링크 아이디 */ + private String unityLinkId; + + /** 통합링크 그룹 */ + private String unityLinkSeCode; + + /** 통합링크 명 */ + private String unityLinkNm; + + /** 통합링크 URL */ + private String unityLinkUrl; + + /** 통합링크 설명 */ + private String unityLinkDc; + + /** 최초등록시점 */ + private String frstRegisterPnttm; + + /** 최초등록아이디 */ + private String frstRegisterId; + + /** 최종수정일 */ + private String lastUpdusrPnttm; + + /** 최종수정자 아이디 */ + private String lastUpdusrId; + + /** 컨트롤 명령어 */ + private String cmd; + + /** + * unityLinkId 리턴 + * + * @return the unityLinkId + */ + public String getUnityLinkId() { + return unityLinkId; + } + + /** + * unityLinkId 설정 + * + * @param unityLinkId the unityLinkId to set + */ + public void setUnityLinkId(String unityLinkId) { + this.unityLinkId = unityLinkId; + } + + /** + * unityLinkSeCode 리턴 + * + * @return the unityLinkSeCode + */ + public String getUnityLinkSeCode() { + return unityLinkSeCode; + } + + /** + * unityLinkSeCode 설정 + * + * @param unityLinkSeCode the unityLinkSeCode to set + */ + public void setUnityLinkSeCode(String unityLinkSeCode) { + this.unityLinkSeCode = unityLinkSeCode; + } + + /** + * unityLinkNm 리턴 + * + * @return the unityLinkNm + */ + public String getUnityLinkNm() { + return unityLinkNm; + } + + /** + * unityLinkNm 설정 + * + * @param unityLinkNm the unityLinkNm to set + */ + public void setUnityLinkNm(String unityLinkNm) { + this.unityLinkNm = unityLinkNm; + } + + /** + * unityLinkUrl 리턴 + * + * @return the unityLinkUrl + */ + public String getUnityLinkUrl() { + return unityLinkUrl; + } + + /** + * unityLinkUrl 설정 + * + * @param unityLinkUrl the unityLinkUrl to set + */ + public void setUnityLinkUrl(String unityLinkUrl) { + this.unityLinkUrl = unityLinkUrl; + } + + /** + * unityLinkDc 리턴 + * + * @return the unityLinkDc + */ + public String getUnityLinkDc() { + return unityLinkDc; + } + + /** + * unityLinkDc 설정 + * + * @param unityLinkDc the unityLinkDc to set + */ + public void setUnityLinkDc(String unityLinkDc) { + this.unityLinkDc = unityLinkDc; + } + + /** + * frstRegisterPnttm 리턴 + * + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * frstRegisterPnttm 설정 + * + * @param frstRegisterPnttm the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * frstRegisterId 리턴 + * + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * frstRegisterId 설정 + * + * @param frstRegisterId the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * lastUpdusrPnttm 리턴 + * + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * lastUpdusrPnttm 설정 + * + * @param lastUpdusrPnttm the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * lastUpdusrId 리턴 + * + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * lastUpdusrId 설정 + * + * @param lastUpdusrId the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + /** + * cmd 리턴 + * + * @return the cmd + */ + public String getCmd() { + return cmd; + } + + /** + * cmd 설정 + * + * @param cmd the cmd to set + */ + public void setCmd(String cmd) { + this.cmd = cmd; + } + + + +} diff --git a/src/main/java/egovframework/com/uss/ion/ulm/service/impl/EgovUnityLinkServiceImpl.java b/src/main/java/egovframework/com/uss/ion/ulm/service/impl/EgovUnityLinkServiceImpl.java new file mode 100644 index 0000000..6e7f744 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ulm/service/impl/EgovUnityLinkServiceImpl.java @@ -0,0 +1,116 @@ +package egovframework.com.uss.ion.ulm.service.impl; + +import java.util.List; + +import egovframework.com.cmm.ComDefaultVO; +import egovframework.com.uss.ion.ulm.service.EgovUnityLinkService; +import egovframework.com.uss.ion.ulm.service.UnityLink; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +/** + * 통합링크관리를 처리하는 ServiceImpl Class 구현 + * @author 공통서비스 장동한 + * @since 2009.07.03 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + *
    + * 
    + */ +@Service("egovUnityLinkService") +public class EgovUnityLinkServiceImpl extends EgovAbstractServiceImpl + implements EgovUnityLinkService { + + @Resource(name = "onlineUnityLinkDao") + private UnityLinkDao dao; + + @Resource(name = "egovUnityLinkIdGnrService") + private EgovIdGnrService idgenService; + + /** + *통합링크관리 메인 셈플 목록을 조회한다. + * @param unityLink 통합링크관리 정보 담김 VO + * @return List + * @throws Exception + */ + @Override + public List selectUnityLinkSample(UnityLink unityLink) throws Exception { + return dao.selectUnityLinkSample(unityLink); + } + + /** + * 통합링크관리를(을) 목록을 조회 한다. + * @param searchVO 조회할 정보가 담김 VO + * @return List + * @throws Exception + */ + @Override + public List selectUnityLinkList(ComDefaultVO searchVO) throws Exception { + return dao.selectUnityLinkList(searchVO); + } + + /** + * 통합링크관리를(을) 목록 전체 건수를(을) 조회한다. + * @param searchVO 조회할 정보가 담긴 VO + * @return int + * @throws Exception + */ + @Override + public int selectUnityLinkListCnt(ComDefaultVO searchVO) throws Exception { + return dao.selectUnityLinkListCnt(searchVO); + } + + /** + * 통합링크관리를(을) 상세조회 한다. + * @param unityLink 조회할 정보가 담김 VO + * @return List + * @throws Exception + */ + @Override + public UnityLink selectUnityLinkDetail(UnityLink unityLink) throws Exception { + return dao.selectUnityLinkDetail(unityLink); + } + + /** + * 통합링크관리를(을) 등록한다. + * @param unityLink 조회할 정보가 담긴 VO + * @throws Exception + */ + @Override + public void insertUnityLink(UnityLink unityLink)throws Exception { + String sMakeId = idgenService.getNextStringId(); + unityLink.setUnityLinkId(sMakeId); + dao.insertUnityLink(unityLink); + } + + /** + * 통합링크관리를(을) 수정한다. + * @param searchVO 조회할 정보가 담긴 VO + * @throws Exception + */ + @Override + public void updateUnityLink(UnityLink unityLink) throws Exception { + dao.updateUnityLink(unityLink); + } + + /** + * 통합링크관리를(을) 삭제한다. + * @param searchVO 조회할 정보가 담긴 VO + * @throws Exception + */ + @Override + public void deleteUnityLink(UnityLink unityLink) throws Exception { + dao.deleteUnityLink(unityLink); + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/ulm/service/impl/UnityLinkDao.java b/src/main/java/egovframework/com/uss/ion/ulm/service/impl/UnityLinkDao.java new file mode 100644 index 0000000..a9982b4 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ulm/service/impl/UnityLinkDao.java @@ -0,0 +1,96 @@ +package egovframework.com.uss.ion.ulm.service.impl; + +import java.util.List; + +import egovframework.com.cmm.ComDefaultVO; +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.ion.ulm.service.UnityLink; + +import org.springframework.stereotype.Repository; + +/** + * 통합링크관리를 처리하는 Dao Class 구현 + * @author 공통서비스 장동한 + * @since 2009.07.03 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + *
    + * 
    + */ +@Repository("onlineUnityLinkDao") +public class UnityLinkDao extends EgovComAbstractDAO { + + /** + * 통합링크관리 메인 셈플 목록을 조회한다. + * @param popupManageVO - 팝업창 Vo + * @return List - 팝업창 목록 + * + * @param popupManageVO + */ + public List selectUnityLinkSample(UnityLink unityLink) throws Exception { + return selectList("UnityLink.selectUnityLinkSample", unityLink); + } + + /** + * 통합링크관리를(을) 목록을 한다. + * @param searchVO 조회할 정보가 담긴 VO + * @return List + * @throws Exception + */ + public List selectUnityLinkList(ComDefaultVO searchVO) throws Exception { + return selectList("UnityLink.selectUnityLink", searchVO); + } + + /** + * 통합링크관리를(을) 목록 전체 건수를(을) 조회한다. + * @param searchVO 조회할 정보가 담긴 VO + * @return int + * @throws Exception + */ + public int selectUnityLinkListCnt(ComDefaultVO searchVO) throws Exception { + return (Integer)selectOne("UnityLink.selectUnityLinkCnt", searchVO); + } + + /** + * 통합링크관리를(을) 상세조회 한다. + * @param unityLink 통합링크관리 정보가 담김 VO + * @return List + * @throws Exception + */ + public UnityLink selectUnityLinkDetail(UnityLink unityLink) throws Exception { + return (UnityLink)selectOne("UnityLink.selectUnityLinkDetail", unityLink); + } + + /** + * 통합링크관리를(을) 등록한다. + * @param unityLink 통합링크관리 정보가 담김 VO + * @throws Exception + */ + public void insertUnityLink(UnityLink unityLink) throws Exception { + insert("UnityLink.insertUnityLink", unityLink); + } + + /** + * 통합링크관리를(을) 수정한다. + * @param unityLink 통합링크관리 정보가 담김 VO + * @throws Exception + */ + public void updateUnityLink(UnityLink unityLink) throws Exception { + update("UnityLink.updateUnityLink", unityLink); + } + + /** + * 통합링크관리를(을) 삭제한다. + * @param unityLink 통합링크관리 정보가 담김 VO + * @throws Exception + */ + public void deleteUnityLink(UnityLink unityLink) throws Exception { + delete("UnityLink.deleteUnityLink", unityLink); + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/ulm/web/EgovUnityLinkController.java b/src/main/java/egovframework/com/uss/ion/ulm/web/EgovUnityLinkController.java new file mode 100644 index 0000000..5ab3ef0 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/ulm/web/EgovUnityLinkController.java @@ -0,0 +1,302 @@ +package egovframework.com.uss.ion.ulm.web; + +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +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 egovframework.com.cmm.ComDefaultCodeVO; +import egovframework.com.cmm.ComDefaultVO; +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.service.EgovCmmUseService; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.ion.ulm.service.EgovUnityLinkService; +import egovframework.com.uss.ion.ulm.service.UnityLink; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +/** + * 통합링크관리를 처리하는 Controller Class 구현 + * @author 공통서비스 장동한 + * @since 2009.07.03 + * @version 1.0 + * @see + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.07.03  장동한          최초 생성
    + *   2011.8.26	정진오			IncludedInfo annotation 추가
    + *
    + * 
    + */ + +@Controller +public class EgovUnityLinkController { + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovUnityLinkController.class); + + @Autowired + private DefaultBeanValidator beanValidator; + + /** EgovMessageSource */ + @Resource(name = "egovMessageSource") + EgovMessageSource egovMessageSource; + + /** egovOnlinePollService */ + @Resource(name = "egovUnityLinkService") + private EgovUnityLinkService egovUnityLinkService; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** Egov Common Code Service */ + @Resource(name="EgovCmmUseService") + private EgovCmmUseService cmmUseService; + + /** + * 통합링크관리 메인 셈플 목록을 조회한다. + * @param searchVO + * @param commandMap + * @param unityLinkVO + * @param model + * @return "egovframework/com/uss/ion/ulm/UnityLinkSample" + * @throws Exception + */ + @RequestMapping(value = "/uss/ion/ulm/listUnityLinkSample.do") + public String egovUnityLinkSample1List( + UnityLink unityLinkVO, + ModelMap model) + throws Exception { + + List reusltList = egovUnityLinkService.selectUnityLinkSample(unityLinkVO); + model.addAttribute("resultList", reusltList); + + return "egovframework/com/uss/ion/ulm/UnityLinkSample"; + } + + /** + * 통합링크관리 목록을 조회한다. + * @param searchVO + * @param commandMap + * @param unityLinkVO + * @param model + * @return "egovframework/com/uss/ion/ulm/EgovOnlinePollList" + * @throws Exception + */ + @SuppressWarnings("unused") + @IncludedInfo(name="통합링크관리", order = 780 ,gid = 50) + @RequestMapping(value = "/uss/ion/ulm/listUnityLink.do") + public String egovUnityLinkList( + @ModelAttribute("searchVO") ComDefaultVO searchVO, @RequestParam Map commandMap, + UnityLink unityLinkVO, ModelMap model) + throws Exception { + + String sSearchMode = commandMap.get("searchMode") == null ? "" : (String) commandMap.get("searchMode"); + + /** 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()); + + List reusltList = egovUnityLinkService.selectUnityLinkList(searchVO); + model.addAttribute("resultList", reusltList); + + model.addAttribute("searchKeyword", commandMap.get("searchKeyword") == null ? "" : (String) commandMap.get("searchKeyword")); + model.addAttribute("searchCondition", commandMap.get("searchCondition") == null ? "" : (String) commandMap.get("searchCondition")); + + int totCnt = egovUnityLinkService.selectUnityLinkListCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + //통합링크구분설정 + ComDefaultCodeVO voComCode = new ComDefaultCodeVO(); + voComCode = new ComDefaultCodeVO(); + voComCode.setCodeId("COM039"); + List listComCode = cmmUseService.selectCmmCodeDetail(voComCode); + model.addAttribute("unityLinkSeCodeList", listComCode ); + + return "egovframework/com/uss/ion/ulm/EgovUnityLinkList"; + } + + /** + * 통합링크관리 목록을 상세조회 조회한다. + * @param searchVO + * @param unityLinkVO + * @param commandMap + * @param model + * @return + * "/uss/ion/ulm/EgovOnlinePollDetail" + * @throws Exception + */ + @RequestMapping(value = "/uss/ion/ulm/detailUnityLink.do") + public String egovUnityLinkDetail( + @ModelAttribute("searchVO") ComDefaultVO searchVO, + UnityLink unityLink, @RequestParam Map commandMap, + ModelMap model) throws Exception { + + String sLocationUrl = "egovframework/com/uss/ion/ulm/EgovUnityLinkDetail"; + + String sCmd = commandMap.get("cmd") == null ? "" : (String) commandMap.get("cmd"); + + if (sCmd.equals("del")) { + egovUnityLinkService.deleteUnityLink(unityLink); + sLocationUrl = "forward:/uss/ion/ulm/listUnityLink.do"; + } else { + //통합링크구분설정 + ComDefaultCodeVO voComCode = new ComDefaultCodeVO(); + voComCode = new ComDefaultCodeVO(); + voComCode.setCodeId("COM039"); + List listComCode = cmmUseService.selectCmmCodeDetail(voComCode); + model.addAttribute("unityLinkSeCodeList", listComCode ); + //상세정보 불러오기 + UnityLink unityLinkVO = egovUnityLinkService.selectUnityLinkDetail(unityLink); + model.addAttribute("unityLink", unityLinkVO); + } + + return sLocationUrl; + } + + /** + * 통합링크관리를 수정한다. + * @param searchVO + * @param commandMap + * @param unityLinkVO + * @param bindingResult + * @param model + * @return + * "/uss/ion/ulm/EgovOnlinePollUpdt" + * @throws Exception + */ + @RequestMapping(value = "/uss/ion/ulm/updtUnityLink.do") + public String egovUnityLinkModify( + @ModelAttribute("searchVO") ComDefaultVO searchVO, + @RequestParam Map commandMap, + UnityLink unityLink, + BindingResult bindingResult, ModelMap model) throws Exception { + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + // 로그인 객체 선언 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + String sLocationUrl = "egovframework/com/uss/ion/ulm/EgovUnityLinkUpdt"; + + String sCmd = commandMap.get("cmd") == null ? "" : (String) commandMap.get("cmd"); + + if (sCmd.equals("save")) { + + //서버 validate 체크 + beanValidator.validate(unityLink, bindingResult); + if(bindingResult.hasErrors()){ + return sLocationUrl; + } + //아이디 설정 + unityLink.setFrstRegisterId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + unityLink.setLastUpdusrId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + //저장 + egovUnityLinkService.updateUnityLink(unityLink); + sLocationUrl = "forward:/uss/ion/ulm/listUnityLink.do"; + } else { + //통합링크구분설정 + ComDefaultCodeVO voComCode = new ComDefaultCodeVO(); + voComCode = new ComDefaultCodeVO(); + voComCode.setCodeId("COM039"); + List listComCode = cmmUseService.selectCmmCodeDetail(voComCode); + model.addAttribute("unityLinkSeCodeList", listComCode ); + //수정정보 불러오기 + UnityLink unityLinkVO = egovUnityLinkService.selectUnityLinkDetail(unityLink); + model.addAttribute("unityLink", unityLinkVO); + } + + return sLocationUrl; + } + + /** + * 통합링크관리를 등록한다. + * @param searchVO + * @param commandMap + * @param unityLinkVO + * @param bindingResult + * @param model + * @return + * "/uss/ion/ulm/EgovOnlinePollRegist" + * @throws Exception + */ + @RequestMapping(value = "/uss/ion/ulm/registUnityLink.do") + public String egovUnityLinkRegist( + @ModelAttribute("searchVO") ComDefaultVO searchVO, + @RequestParam Map commandMap, + @ModelAttribute("unityLink") UnityLink unityLink, + BindingResult bindingResult, ModelMap model) throws Exception { + // 0. Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + // 로그인 객체 선언 + LoginVO loginVO = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser(); + + String sLocationUrl = "egovframework/com/uss/ion/ulm/EgovUnityLinkRegist"; + + String sCmd = commandMap.get("cmd") == null ? "" : (String) commandMap.get("cmd"); + LOGGER.info("cmd => {}", sCmd); + + if (sCmd.equals("save")) { + //서버 validate 체크 + beanValidator.validate(unityLink, bindingResult); + if(bindingResult.hasErrors()){ + return sLocationUrl; + } + //아이디 설정 + unityLink.setFrstRegisterId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + unityLink.setLastUpdusrId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + //저장 + egovUnityLinkService.insertUnityLink(unityLink); + + sLocationUrl = "forward:/uss/ion/ulm/listUnityLink.do"; + } else { + //통합링크구분설정 + ComDefaultCodeVO voComCode = new ComDefaultCodeVO(); + voComCode = new ComDefaultCodeVO(); + voComCode.setCodeId("COM039"); + List listComCode = cmmUseService.selectCmmCodeDetail(voComCode); + model.addAttribute("unityLinkSeCodeList", listComCode ); + } + + return sLocationUrl; + } + + +} diff --git a/src/main/java/egovframework/com/uss/ion/vct/service/EgovVcatnManageService.java b/src/main/java/egovframework/com/uss/ion/vct/service/EgovVcatnManageService.java new file mode 100644 index 0000000..3d4a83d --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/vct/service/EgovVcatnManageService.java @@ -0,0 +1,103 @@ +package egovframework.com.uss.ion.vct.service; + +import java.util.List; + +/** + * 개요 + * - 휴가관리에 대한 Service Interface를 정의한다. + * + * 상세내용 + * - 휴가관리에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 휴가관리의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +public interface EgovVcatnManageService { + + /** + * 휴가관리 정보를 관리하기 위해 등록된 로그인화면이미지 목록을 조회한다. + * @param vcatnManageVO - 휴가관리 VO + * @return List - 휴가관리 목록 + */ + public List selectVcatnManageList(VcatnManageVO vcatnManageVO) throws Exception; + + /** + * 휴가관리 목록 총 갯수를 조회한다. + * @param vcatnManageVO - 휴가관리 VO + * @return int - 휴가관리 카운트 수 + */ + public int selectVcatnManageListTotCnt(VcatnManageVO vcatnManageVO) throws Exception ; + + /** + * 등록된 휴가관리의 상세정보를 조회한다. + * @param vcatnManageVO - 휴가관리 VO + * @return VcatnManageVO - 휴가관리 VO + */ + public VcatnManageVO selectVcatnManage(VcatnManageVO vcatnManageVO) throws Exception; + + /** + * 휴가관리 정보를 신규로 등록한다. + * @param vcatnManage - 휴가관리 model + */ + public String insertVcatnManage(VcatnManage vcatnManage, VcatnManageVO vcatnManageVO) throws Exception; + + /** + * 기 등록된 휴가관리 정보를 수정한다. + * @param vcatnManage - 휴가관리 model + */ + public String updtVcatnManage(VcatnManage vcatnManage, VcatnManageVO vcatnManageVO) throws Exception; + + /** + * 기 등록된 휴가관리 정보를 삭제한다. + * @param vcatnManage - 휴가관리 model + */ + public void deleteVcatnManage(VcatnManage vcatnManage) throws Exception; + + /** + * 휴가일자 중복여부 체크 + * @param vcatnManageVO - 휴가관리 VO + * @return int + * @exception Exception + */ + public int selectVcatnManageDplctAt(VcatnManageVO vcatnManageVO) throws Exception; + + + /*** 승인처리관련 ***/ + /** + * 휴가관리정보 승인 처리를 위해 신청된 휴가관리 목록을 조회한다. + * @param vcatnManageVO - 휴가관리 VO + * @return List - 휴가관리 목록 + */ + public List selectVcatnManageConfmList(VcatnManageVO vcatnManageVO) throws Exception; + + /** + * 휴가관리정보 승인 처리를 위해 신청된 휴가관리 목록 총 갯수를 조회한다. + * @param vcatnManageVO - 휴가관리 VO + * @return int - 휴가관리 카운트 수 + */ + public int selectVcatnManageConfmListTotCnt(VcatnManageVO vcatnManageVO) throws Exception ; + + /** + * 신청된 휴가를 승인처리한다. + * @param vcatnManage - 휴가관리 model + */ + public void updtVcatnManageConfm(VcatnManage vcatnManage) throws Exception; + + + /*** 연차관련 ***/ + /** + * 개인별 연차관리의 상세정보를 조회한다. + * @param vcatnManageVO - 휴가관리 VO + * @return VcatnManageVO - 휴가관리 VO + */ + public VcatnManageVO selectIndvdlYrycManage(String sUsid) throws Exception; + + /** + * 신청된 휴가를 승인처리한다. + * @param vcatnManage - 휴가관리 model + */ + public void updtIndvdlYrycManage(IndvdlYrycManage indvdlYrycManage) throws Exception; + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/vct/service/IndvdlYrycManage.java b/src/main/java/egovframework/com/uss/ion/vct/service/IndvdlYrycManage.java new file mode 100644 index 0000000..aac35ae --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/vct/service/IndvdlYrycManage.java @@ -0,0 +1,192 @@ +package egovframework.com.uss.ion.vct.service; + +import egovframework.com.cmm.ComDefaultVO; + +/** + * 개요 + * - 개인별 연차관리에 대한 model 클래스를 정의한다. + * + * 상세내용 + * - 연차관리의 발생연도,사용자ID,연차발생갯수,사용연차갯수,잔여연차갯수,최초등록자ID,최초등록시점,최종수정자ID,최종수정시점 항목을 관리한다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +public class IndvdlYrycManage extends ComDefaultVO { + + private static final long serialVersionUID = -6215242195948154486L; + + /** + * 발생연도 + */ + private String occrrncYear; + + /** + * 사용자ID + */ + private String usid; + + /** + * 발생연차갯수 + */ + private double occrncYrycCo; + + /** + * 사용연차갯수 + */ + private double useYrycCo; + + /** + * 잔여연차갯수 + */ + private double remndrYrycCo; + + /** + * 최초등록자ID + */ + private String frstRegisterId; + + /** + * 최초등록시점 + */ + private String frstRegisterPnttm; + + /** + * 최종수정자ID + */ + private String lastUpdusrId; + + /** + * 최종수정시점 + */ + private String lastUpdusrPnttm; + + /** + * @return the occrrncYear + */ + public String getOccrrncYear() { + return occrrncYear; + } + + /** + * @param occrrncYear the occrrncYear to set + */ + public void setOccrrncYear(String occrrncYear) { + this.occrrncYear = occrrncYear; + } + + /** + * @return the usid + */ + public String getUsid() { + return usid; + } + + /** + * @param usid the usid to set + */ + public void setUsid(String usid) { + this.usid = usid; + } + + /** + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * @param frstRegisterId the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * @param frstRegisterPnttm the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * @param lastUpdusrId the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + /** + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * @param lastUpdusrPnttm the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * @return the occrncYrycCo + */ + public double getOccrncYrycCo() { + return occrncYrycCo; + } + + /** + * @param occrncYrycCo the occrncYrycCo to set + */ + public void setOccrncYrycCo(double occrncYrycCo) { + this.occrncYrycCo = occrncYrycCo; + } + + /** + * @return the useYrycCo + */ + public double getUseYrycCo() { + return useYrycCo; + } + + /** + * @param useYrycCo the useYrycCo to set + */ + public void setUseYrycCo(double useYrycCo) { + this.useYrycCo = useYrycCo; + } + + /** + * @return the remndrYrycCo + */ + public double getRemndrYrycCo() { + return remndrYrycCo; + } + + /** + * @param remndrYrycCo the remndrYrycCo to set + */ + public void setRemndrYrycCo(double remndrYrycCo) { + this.remndrYrycCo = remndrYrycCo; + } + + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/vct/service/VcatnManage.java b/src/main/java/egovframework/com/uss/ion/vct/service/VcatnManage.java new file mode 100644 index 0000000..2d5139e --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/vct/service/VcatnManage.java @@ -0,0 +1,383 @@ +package egovframework.com.uss.ion.vct.service; + +import egovframework.com.cmm.ComDefaultVO; + +/** + * 개요 + * - 휴가관리에 대한 model 클래스를 정의한다. + * + * 상세내용 + * - 휴가관리의 신청자ID,휴가구분,시작일자,종료일자,신청일자,휴가사유,발생년도,결재자ID,승인여부,결재일시,반려사유,최초등록자ID,최초등록시점,최종수정자ID,최종수정시점 항목을 관리한다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +public class VcatnManage extends ComDefaultVO { + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + + /** + * 신청자ID + */ + private String applcntId; + + /** + * 휴가구분 + */ + private String vcatnSe; + + /** + * 시작일자 + */ + private String bgnde; + + /** + * 종료일자 + */ + private String endde; + + /** + * 신청일자 + */ + private String reqstDe; + + /** + * 휴가사유 + */ + private String vcatnResn; + + /** + * 발생연도 + */ + private String occrrncYear; + + /** + * 정오구분 + */ + private String noonSe; + + /** + * 결재자ID + */ + private String sanctnerId; + + /** + * 승인여부 + */ + private String confmAt; + + /** + * 결재일시 + */ + private String sanctnDt; + + /** + * 반려사유 + */ + private String returnResn; + + /** + * 약식결재ID + */ + private String infrmlSanctnId; + + + /** + * 최초등록자ID + */ + private String frstRegisterId; + + /** + * 최초등록시점 + */ + private String frstRegisterPnttm; + + /** + * 최종수정자ID + */ + private String lastUpdusrId; + + /** + * 최종수정시점 + */ + private String lastUpdusrPnttm; + + /** + * sanctnDtNm + */ + private String sanctnDtNm; + + /** + * orgnztNm + */ + private String orgnztNm; + + /** + * @return the sanctnDtNm + */ + public String getSanctnDtNm() { + return sanctnDtNm; + } + + /** + * @param sanctnDtNm the sanctnDtNm to set + */ + public void setSanctnDtNm(String sanctnDtNm) { + this.sanctnDtNm = sanctnDtNm; + } + + /** + * @return the orgnztNm + */ + public String getOrgnztNm() { + return orgnztNm; + } + + /** + * @param orgnztNm the orgnztNm to set + */ + public void setOrgnztNm(String orgnztNm) { + this.orgnztNm = orgnztNm; + } + + /** + * @return the applcntId + */ + public String getApplcntId() { + return applcntId; + } + + /** + * @param applcntId the applcntId to set + */ + public void setApplcntId(String applcntId) { + this.applcntId = applcntId; + } + + /** + * @return the vcatnSe + */ + public String getVcatnSe() { + return vcatnSe; + } + + /** + * @param vcatnSe the vcatnSe to set + */ + public void setVcatnSe(String vcatnSe) { + this.vcatnSe = vcatnSe; + } + + /** + * @return the bgnde + */ + public String getBgnde() { + return bgnde; + } + + /** + * @param bgnde the bgnde to set + */ + public void setBgnde(String bgnde) { + this.bgnde = bgnde; + } + + /** + * @return the endde + */ + public String getEndde() { + return endde; + } + + /** + * @param endde the endde to set + */ + public void setEndde(String endde) { + this.endde = endde; + } + + /** + * @return the reqstDe + */ + public String getReqstDe() { + return reqstDe; + } + + /** + * @param reqstDe the reqstDe to set + */ + public void setReqstDe(String reqstDe) { + this.reqstDe = reqstDe; + } + + /** + * @return the vcatnResn + */ + public String getVcatnResn() { + return vcatnResn; + } + + /** + * @param vcatnResn the vcatnResn to set + */ + public void setVcatnResn(String vcatnResn) { + this.vcatnResn = vcatnResn; + } + + /** + * @return the occrrncYear + */ + public String getOccrrncYear() { + return occrrncYear; + } + + /** + * @param occrrncYear the occrrncYear to set + */ + public void setOccrrncYear(String occrrncYear) { + this.occrrncYear = occrrncYear; + } + + /** + * @return the sanctnerId + */ + public String getSanctnerId() { + return sanctnerId; + } + + /** + * @param sanctnerId the sanctnerId to set + */ + public void setSanctnerId(String sanctnerId) { + this.sanctnerId = sanctnerId; + } + + /** + * @return the confmAt + */ + public String getConfmAt() { + return confmAt; + } + + /** + * @param confmAt the confmAt to set + */ + public void setConfmAt(String confmAt) { + this.confmAt = confmAt; + } + + /** + * @return the sanctnDt + */ + public String getSanctnDt() { + return sanctnDt; + } + + /** + * @param sanctnDt the sanctnDt to set + */ + public void setSanctnDt(String sanctnDt) { + this.sanctnDt = sanctnDt; + } + + /** + * @return the returnResn + */ + public String getReturnResn() { + return returnResn; + } + + /** + * @param returnResn the returnResn to set + */ + public void setReturnResn(String returnResn) { + this.returnResn = returnResn; + } + + /** + * @return the infrmlSanctnId + */ + public String getInfrmlSanctnId() { + return infrmlSanctnId; + } + + /** + * @param infrmlSanctnId the infrmlSanctnId to set + */ + public void setInfrmlSanctnId(String infrmlSanctnId) { + this.infrmlSanctnId = infrmlSanctnId; + } + + /** + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * @param frstRegisterId the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * @param frstRegisterPnttm the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * @param lastUpdusrId the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + /** + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * @param lastUpdusrPnttm the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * @return the noonSe + */ + public String getNoonSe() { + return noonSe; + } + + /** + * @param noonSe the noonSe to set + */ + public void setNoonSe(String noonSe) { + this.noonSe = noonSe; + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/vct/service/VcatnManageVO.java b/src/main/java/egovframework/com/uss/ion/vct/service/VcatnManageVO.java new file mode 100644 index 0000000..2f8895e --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/vct/service/VcatnManageVO.java @@ -0,0 +1,403 @@ +package egovframework.com.uss.ion.vct.service; + +import java.io.Serializable; +import java.util.List; + +/** + * 개요 + * - 휴가관리에 대한 Vo 클래스를 정의한다. + * + * 상세내용 + * - 휴가관리의 목록 항목을 관리한다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +public class VcatnManageVO extends VcatnManage implements Serializable { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + + /** + * 휴가 목록 + */ + List vcatnManageList; + + /** + * 신청자명 + */ + private String applcntNm; + + /** + * 승인자명 + */ + private String sanctnerNm; + + /** + * 휴가구분명 + */ + private String vcatnSeNm; + + /** + * 사용자ID + */ + private String usid; + + /** + * 발생연차갯수 + */ + private double occrncYrycCo = 0.0; + + /** + * 사용연차갯수 + */ + private double useYrycCo = 0.0; + + /** + * 잔여연차갯수 + */ + private double remndrYrycCo = 0.0; + + /** + * 사용자 소속명 + + private String orgnztNm; + */ + /** + * 승인자 소속명 + */ + private String sanctnerOrgnztNm; + + /** + * 검색 연도 + */ + private String searchYear; + + /** + * 검색 월 + */ + private String searchMonth; + + /** + * 검색 성명 + */ + private String searchNm; + + /** + * 검색 진행구분 + */ + private String searchConfmAt; + + /** + * sTempBgnde + */ + private String tempBgnde; + + /** + * sTempEndde + */ + private String tempEndde; + + /** + * tempUsNm + */ + private String tempUsNm; + + /** + * tempOrgnztNm + */ + private String tempOrgnztNm; + + + /** + * 신청자ID + */ + private String applcntIdKey; + + /** + * 휴가구분 + */ + private String vcatnSeKey; + + /** + * 시작일자 + */ + private String bgndeKey; + + /** + * 종료일자 + */ + private String enddeKey; + + /** + * @return the tempUsNm + */ + public String getTempUsNm() { + return tempUsNm; + } + /** + * @param tempUsNm the tempUsNm to set + */ + public void setTempUsNm(String tempUsNm) { + this.tempUsNm = tempUsNm; + } + /** + * @return the tempOrgnztNm + */ + public String getTempOrgnztNm() { + return tempOrgnztNm; + } + /** + * @param tempOrgnztNm the tempOrgnztNm to set + */ + public void setTempOrgnztNm(String tempOrgnztNm) { + this.tempOrgnztNm = tempOrgnztNm; + } + /** + * @return the tempBgnde + */ + public String getTempBgnde() { + return tempBgnde; + } + /** + * @param tempBgnde the tempBgnde to set + */ + public void setTempBgnde(String tempBgnde) { + this.tempBgnde = tempBgnde; + } + /** + * @return the tempEndde + */ + public String getTempEndde() { + return tempEndde; + } + /** + * @param tempEndde the tempEndde to set + */ + public void setTempEndde(String tempEndde) { + this.tempEndde = tempEndde; + } + /** + * @return the vcatnManageList + */ + public List getVcatnManageList() { + return vcatnManageList; + } + /** + * @param VcatnManage the vcatnManage to set + */ + public void setVcatnManageList(List vcatnManageList) { + this.vcatnManageList = vcatnManageList; + } + /** + * @return the applcntNm + */ + public String getApplcntNm() { + return applcntNm; + } + /** + * @param applcntNm the applcntNm to set + */ + public void setApplcntNm(String applcntNm) { + this.applcntNm = applcntNm; + } + /** + * @return the sanctnerNm + */ + public String getSanctnerNm() { + return sanctnerNm; + } + + /** + * @param sanctnerNm the sanctnerNm to set + */ + public void setSanctnerNm(String sanctnerNm) { + this.sanctnerNm = sanctnerNm; + } + + /** + * @return the vcatnSeNm + */ + public String getVcatnSeNm() { + return vcatnSeNm; + } + /** + * @param vcatnSeNm the vcatnSeNm to set + */ + public void setVcatnSeNm(String vcatnSeNm) { + this.vcatnSeNm = vcatnSeNm; + } + /** + * @return the usid + */ + public String getUsid() { + return usid; + } + /** + * @param usid the usid to set + */ + public void setUsid(String usid) { + this.usid = usid; + } + + /** + * @return the orgnztNm + + public String getOrgnztNm() { + return orgnztNm; + } + */ + /** + * @param orgnztNm the orgnztNm to set + + public void setOrgnztNm(String orgnztNm) { + this.orgnztNm = orgnztNm; + } */ + /** + * @return the sanctnerOrgnztNm + */ + public String getSanctnerOrgnztNm() { + return sanctnerOrgnztNm; + } + /** + * @param sanctnerOrgnztNm the sanctnerOrgnztNm to set + */ + public void setSanctnerOrgnztNm(String sanctnerOrgnztNm) { + this.sanctnerOrgnztNm = sanctnerOrgnztNm; + } + /** + * @return the occrncYrycCo + */ + public double getOccrncYrycCo() { + return occrncYrycCo; + } + /** + * @param occrncYrycCo the occrncYrycCo to set + */ + public void setOccrncYrycCo(double occrncYrycCo) { + this.occrncYrycCo = occrncYrycCo; + } + /** + * @return the useYrycCo + */ + public double getUseYrycCo() { + return useYrycCo; + } + /** + * @param useYrycCo the useYrycCo to set + */ + public void setUseYrycCo(double useYrycCo) { + this.useYrycCo = useYrycCo; + } + /** + * @return the remndrYrycCo + */ + public double getRemndrYrycCo() { + return remndrYrycCo; + } + /** + * @param remndrYrycCo the remndrYrycCo to set + */ + public void setRemndrYrycCo(double remndrYrycCo) { + this.remndrYrycCo = remndrYrycCo; + } + /** + * @return the searchYear + */ + public String getSearchYear() { + return searchYear; + } + /** + * @param searchYear the searchYear to set + */ + public void setSearchYear(String searchYear) { + this.searchYear = searchYear; + } + /** + * @return the searchMonth + */ + public String getSearchMonth() { + return searchMonth; + } + /** + * @param searchMonth the searchMonth to set + */ + public void setSearchMonth(String searchMonth) { + this.searchMonth = searchMonth; + } + /** + * @return the searchNm + */ + public String getSearchNm() { + return searchNm; + } + /** + * @param searchNm the searchNm to set + */ + public void setSearchNm(String searchNm) { + this.searchNm = searchNm; + } + /** + * @return the searchConfmAt + */ + public String getSearchConfmAt() { + return searchConfmAt; + } + /** + * @param searchConfmAt the searchConfmAt to set + */ + public void setSearchConfmAt(String searchConfmAt) { + this.searchConfmAt = searchConfmAt; + } + /** + * @return the applcntIdKey + */ + public String getApplcntIdKey() { + return applcntIdKey; + } + /** + * @param applcntIdKey the applcntIdKey to set + */ + public void setApplcntIdKey(String applcntIdKey) { + this.applcntIdKey = applcntIdKey; + } + /** + * @return the vcatnSeKey + */ + public String getVcatnSeKey() { + return vcatnSeKey; + } + /** + * @param vcatnSeKey the vcatnSeKey to set + */ + public void setVcatnSeKey(String vcatnSeKey) { + this.vcatnSeKey = vcatnSeKey; + } + /** + * @return the bgndeKey + */ + public String getBgndeKey() { + return bgndeKey; + } + /** + * @param bgndeKey the bgndeKey to set + */ + public void setBgndeKey(String bgndeKey) { + this.bgndeKey = bgndeKey; + } + /** + * @return the enddeKey + */ + public String getEnddeKey() { + return enddeKey; + } + /** + * @param enddeKey the enddeKey to set + */ + public void setEnddeKey(String enddeKey) { + this.enddeKey = enddeKey; + } +} diff --git a/src/main/java/egovframework/com/uss/ion/vct/service/impl/EgovVcatnManageServiceImpl.java b/src/main/java/egovframework/com/uss/ion/vct/service/impl/EgovVcatnManageServiceImpl.java new file mode 100644 index 0000000..5278f58 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/vct/service/impl/EgovVcatnManageServiceImpl.java @@ -0,0 +1,528 @@ +package egovframework.com.uss.ion.vct.service.impl; + +import java.util.Calendar; +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.ion.ism.service.EgovInfrmlSanctnService; +import egovframework.com.uss.ion.ism.service.InfrmlSanctn; +import egovframework.com.uss.ion.vct.service.EgovVcatnManageService; +import egovframework.com.uss.ion.vct.service.IndvdlYrycManage; +import egovframework.com.uss.ion.vct.service.VcatnManage; +import egovframework.com.uss.ion.vct.service.VcatnManageVO; +import egovframework.com.utl.fcc.service.EgovDateUtil; +import egovframework.com.utl.fcc.service.EgovStringUtil; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +/** + * 개요 + * - 휴가관리에 대한 ServiceImpl 클래스를 정의한다. + * + * 상세내용 + * - 휴가관리에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 휴가관리의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +@Service("egovVcatnManageService") +public class EgovVcatnManageServiceImpl extends EgovAbstractServiceImpl implements EgovVcatnManageService { + + @Resource(name = "vcatnManageDAO") + private VcatnManageDAO vcatnManageDAO; + + @Resource(name = "EgovInfrmlSanctnService") + protected EgovInfrmlSanctnService infrmlSanctnService; + + /** + * 휴가관리정보를 관리하기 위해 등록된 휴가관리 목록을 조회한다. + * @param vcatnManageVO - 휴가관리 VO + * @return List - 휴가관리 목록 + */ + @Override + public List selectVcatnManageList(VcatnManageVO vcatnManageVO) throws Exception { + + List result = vcatnManageDAO.selectVcatnManageList(vcatnManageVO); + int num = result.size(); + + for (int i = 0; i < num; i++) { + VcatnManageVO vcatnManageVO1 = result.get(i); + vcatnManageVO1.setBgnde(EgovDateUtil.formatDate(vcatnManageVO1.getBgnde(), "-")); + vcatnManageVO1.setEndde(EgovDateUtil.formatDate(vcatnManageVO1.getEndde(), "-")); + result.set(i, vcatnManageVO1); + } + return result; + } + + /** + * 휴가관리목록 총 갯수를 조회한다. + * @param vcatnManageVO - 휴가관리 VO + * @return int - 휴가관리 카운트 수 + */ + @Override + public int selectVcatnManageListTotCnt(VcatnManageVO vcatnManageVO) throws Exception { + return vcatnManageDAO.selectVcatnManageListTotCnt(vcatnManageVO); + } + + /** + * 등록된 휴가관리의 상세정보를 조회한다. + * @param vcatnManageVO - 휴가관리 VO + * @return VcatnManageVO - 휴가관리 VO + */ + @Override + public VcatnManageVO selectVcatnManage(VcatnManageVO vcatnManageVO) throws Exception { + + //VcatnManageVO vcatnManageVOTemp = new VcatnManageVO(); + + VcatnManageVO vcatnManageVOTemp = vcatnManageDAO.selectVcatnManage(vcatnManageVO); + vcatnManageVOTemp.setBgnde(EgovDateUtil.formatDate(vcatnManageVOTemp.getBgnde(), "-")); + vcatnManageVOTemp.setEndde(EgovDateUtil.formatDate(vcatnManageVOTemp.getEndde(), "-")); + + // 연차정보 + VcatnManageVO vcatnManageVO1 = selectIndvdlYrycManage(vcatnManageVO.getApplcntId()); + vcatnManageVOTemp.setOccrrncYear(vcatnManageVO1.getOccrrncYear()); + vcatnManageVOTemp.setUsid(vcatnManageVO1.getUsid()); + vcatnManageVOTemp.setOccrncYrycCo(vcatnManageVO1.getOccrncYrycCo()); + vcatnManageVOTemp.setUseYrycCo(vcatnManageVO1.getUseYrycCo()); + vcatnManageVOTemp.setRemndrYrycCo(vcatnManageVO1.getRemndrYrycCo()); + + return vcatnManageVOTemp; + } + + /** + * 휴가관리정보를 신규로 등록한다. + * @param vcatnManage - 휴가관리 model + * @return String + * 01 : 입력성공, 02 : 연차휴가 등록실패(잔여연차 부족), 03: 반차휴가 등록실패(잔여연차 부족) + */ + @Override + public String insertVcatnManage(VcatnManage vcatnManage, VcatnManageVO vcatnManageVO) throws Exception { + java.util.Calendar cal = java.util.Calendar.getInstance(); + String sYear = Integer.toString(cal.get(java.util.Calendar.YEAR)); + String sMonth = Integer.toString(cal.get(java.util.Calendar.MONTH) + 1); + if (sMonth.length() == 1) { + sMonth = "0" + sMonth; + } + String sDay = Integer.toString(cal.get(java.util.Calendar.DATE)); + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + // KISA 보안취약점 조치 (2018-12-10, 신용호) + String uniqId = ""; + if (user != null) { + uniqId = user.getUniqId(); + } + vcatnManage.setOccrrncYear(sYear); + vcatnManage.setReqstDe(sYear + sMonth + sDay); + /* + * 휴가 승인처리 신청 infrmlSanctnService.insertInfrmlSanctn("000", vcatnManage); + */ + vcatnManage.setBgnde(EgovStringUtil.removeMinusChar(vcatnManage.getBgnde())); + vcatnManage.setEndde(EgovStringUtil.removeMinusChar(vcatnManage.getEndde())); + vcatnManage.setReqstDe(EgovStringUtil.removeMinusChar(vcatnManage.getReqstDe())); + InfrmlSanctn infrmlSanctn = infrmlSanctnService.insertInfrmlSanctn(converToInfrmlSanctnObject(vcatnManage)); + //InfrmlSanctn infrmlSanctn = infrmlSanctnService.insertInfrmlSanctn("003", vcatnManage); + vcatnManage.setInfrmlSanctnId(infrmlSanctn.getInfrmlSanctnId()); + VcatnManageVO vcatnManageVO1 = selectIndvdlYrycManage(uniqId); + double iUseYrycCo = vcatnManageVO1.getUseYrycCo(); //연차테이블의 사용 연차갯수 + double iRemndrYrycCo = vcatnManageVO1.getRemndrYrycCo(); //연차테이블의 잔여 연차갯수 + double iCountYryc = 0.0; + + /* + * 시작일자 와 종료일자 사이의 일자 갯수 - 공휴일 or 주말 제외 + */ + // 휴가구분이 연차인 경우 + if ("01".equals(vcatnManage.getVcatnSe())) { + // 연차 휴가 연도 체크 + if (!getVcatnYearSE(vcatnManage)) { + return "09"; + } + iCountYryc = getDateCalc(vcatnManage.getBgnde(), vcatnManage.getEndde()); + if (iCountYryc == 0) { + return "99"; //연차설정오류 + } else if ((iRemndrYrycCo - iCountYryc) < 0) { + return "02"; + } else { + vcatnManageDAO.insertVcatnManage(vcatnManage); + IndvdlYrycManage indvdlYrycManage = new IndvdlYrycManage(); + indvdlYrycManage.setUseYrycCo(iUseYrycCo + iCountYryc); + indvdlYrycManage.setRemndrYrycCo(iRemndrYrycCo - iCountYryc); + indvdlYrycManage.setLastUpdusrId(vcatnManage.getApplcntId()); + indvdlYrycManage.setOccrrncYear(vcatnManage.getOccrrncYear()); + indvdlYrycManage.setUsid(vcatnManage.getApplcntId()); + updtIndvdlYrycManage(indvdlYrycManage); + return "01"; + } + } + // 휴가구분이 반차인 경우 + else if ("02".equals(vcatnManage.getVcatnSe())) { + + // 연차 휴가 연도 체크 + if (!getVcatnYearSE(vcatnManage)) { + return "09"; + } + iCountYryc = getDateCalc(vcatnManage.getBgnde(), vcatnManage.getBgnde()); //반차는 시작일자 종료일자 동일함. 시작일자로만 체크 + if (iCountYryc == 0) { + return "99"; //연차설정오류 + } else if ((iRemndrYrycCo - 0.5) < 0) { + return "03"; + } else { + vcatnManageDAO.insertVcatnManage(vcatnManage); + IndvdlYrycManage indvdlYrycManage = new IndvdlYrycManage(); + indvdlYrycManage.setUseYrycCo(iUseYrycCo + 0.5); + indvdlYrycManage.setRemndrYrycCo(iRemndrYrycCo - 0.5); + indvdlYrycManage.setLastUpdusrId(vcatnManage.getApplcntId()); + indvdlYrycManage.setOccrrncYear(vcatnManage.getOccrrncYear()); + indvdlYrycManage.setUsid(vcatnManage.getApplcntId()); + updtIndvdlYrycManage(indvdlYrycManage); + + return "01"; + } + } else { + vcatnManageDAO.insertVcatnManage(vcatnManage); + return "01"; + } + } + + /** + * 기 등록된 휴가관리정보를 수정한다. + * @param vcatnManage - 휴가관리 model + */ + @Override + public String updtVcatnManage(VcatnManage vcatnManage, VcatnManageVO vcatnManageVO) throws Exception { + int iTemp = 0; + String sTempMessage = null; + String sTempApplcntId = vcatnManage.getApplcntId(); + String sTempVcatnSe = vcatnManage.getVcatnSe(); + String sTempBgnde = vcatnManage.getBgnde(); + String sTempEndde = vcatnManage.getEndde(); + + /* 삭제처리 */ + vcatnManage.setApplcntId(vcatnManageVO.getApplcntIdKey()); + vcatnManage.setVcatnSe(vcatnManageVO.getVcatnSeKey()); + vcatnManage.setBgnde(EgovStringUtil.removeMinusChar(vcatnManageVO.getBgndeKey())); + vcatnManage.setEndde(EgovStringUtil.removeMinusChar(vcatnManageVO.getEnddeKey())); + + deleteVcatnManage(vcatnManage); + /* 등록처리 */ + vcatnManage.setApplcntId(sTempApplcntId); + vcatnManage.setVcatnSe(sTempVcatnSe); + vcatnManage.setBgnde(EgovStringUtil.removeMinusChar(sTempBgnde)); + vcatnManage.setEndde(EgovStringUtil.removeMinusChar(sTempEndde)); + if (vcatnManage.getSanctnerId() != null) { + vcatnManage.setConfmAt("A"); + } + + vcatnManageVO.setSearchKeyword(vcatnManage.getBgnde()); + //시작일자 포함여부 + iTemp = selectVcatnManageDplctAt(vcatnManageVO); + vcatnManageVO.setSearchKeyword(vcatnManage.getEndde()); + //종료일자 포함여부 + iTemp += selectVcatnManageDplctAt(vcatnManageVO); + + if (iTemp == 0) { + sTempMessage = insertVcatnManage(vcatnManage, vcatnManageVO); + System.out.println("updtVcatnManage 4:" + sTempMessage); + return sTempMessage; + } else { + sTempMessage = "10"; + System.out.println("updtVcatnManage 5:" + sTempMessage); + return sTempMessage; + } + /* + vcatnManage.setBgnde(EgovStringUtil.removeMinusChar(vcatnManage.getBgnde())); + vcatnManage.setEndde(EgovStringUtil.removeMinusChar(vcatnManage.getEndde())); + vcatnManage.setReqstDe(EgovStringUtil.removeMinusChar(vcatnManage.getReqstDe())); + vcatnManageDAO.updtVcatnManage(vcatnManage); + + return "01"; + */ + } + + /** + * 기 등록된 휴가관리정보를 삭제한다. + * @param vcatnManage - 휴가관리 model + */ + @Override + @SuppressWarnings("unused") + public void deleteVcatnManage(VcatnManage vcatnManage) throws Exception { + /* + * 휴가 승인처리 삭제 infrmlSanctnService.insertInfrmlSanctn("000", vcatnManage); + */ + vcatnManage.setBgnde(EgovStringUtil.removeMinusChar(vcatnManage.getBgnde())); + vcatnManage.setEndde(EgovStringUtil.removeMinusChar(vcatnManage.getEndde())); + vcatnManage.setReqstDe(EgovStringUtil.removeMinusChar(vcatnManage.getReqstDe())); + infrmlSanctnService.deleteInfrmlSanctn(converToInfrmlSanctnObject(vcatnManage)); + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + // 개인연차조회 + VcatnManageVO vcatnManageVO1 = selectIndvdlYrycManage(vcatnManage.getApplcntId()); + double iUseYrycCo = vcatnManageVO1.getUseYrycCo(); //연차테이블의 사용 연차갯수 + double iRemndrYrycCo = vcatnManageVO1.getRemndrYrycCo(); //연차테이블의 잔여 연차갯수 + double iCountYryc = 0.0; + /* + * 시작일자 와 종료일자 사이의 일자 갯수 - 공휴일 or 주말 제외 + */ + // 휴가구분이 연차인 경우 + if ("01".equals(vcatnManage.getVcatnSe())) { + + iCountYryc = getDateCalc(vcatnManage.getBgnde(), vcatnManage.getEndde()); + IndvdlYrycManage indvdlYrycManage = new IndvdlYrycManage(); + indvdlYrycManage.setUseYrycCo(iUseYrycCo - iCountYryc); + indvdlYrycManage.setRemndrYrycCo(iRemndrYrycCo + iCountYryc); + indvdlYrycManage.setLastUpdusrId(vcatnManage.getApplcntId()); + indvdlYrycManage.setOccrrncYear(vcatnManage.getOccrrncYear()); + indvdlYrycManage.setUsid(vcatnManage.getApplcntId()); + + updtIndvdlYrycManage(indvdlYrycManage); + vcatnManageDAO.deleteVcatnManage(vcatnManage); + + } + // 휴가구분이 반차인 경우 + else if ("02".equals(vcatnManage.getVcatnSe())) {//KISA 보안약점 조치 (2018-10-29, 윤창원) + + IndvdlYrycManage indvdlYrycManage = new IndvdlYrycManage(); + indvdlYrycManage.setUseYrycCo(iUseYrycCo - 0.5); + indvdlYrycManage.setRemndrYrycCo(iRemndrYrycCo + 0.5); + indvdlYrycManage.setLastUpdusrId(vcatnManage.getApplcntId()); + indvdlYrycManage.setOccrrncYear(vcatnManage.getOccrrncYear()); + indvdlYrycManage.setUsid(vcatnManage.getApplcntId()); + updtIndvdlYrycManage(indvdlYrycManage); + vcatnManageDAO.deleteVcatnManage(vcatnManage); + + } else { + vcatnManageDAO.deleteVcatnManage(vcatnManage); + } + } + + /** + * 휴가일자 중복여부 체크 + * @param vcatnManageVO - 휴가관리 VO + * @return int + * @exception Exception + */ + @Override + public int selectVcatnManageDplctAt(VcatnManageVO vcatnManageVO) throws Exception { + return vcatnManageDAO.selectVcatnManageDplctAt(vcatnManageVO); + } + + /*** 승인처리관련 ***/ + /** + * 휴가관리정보 승인 처리를 위해 신청된 휴가관리 목록을 조회한다. + * @param vcatnManageVO - 휴가관리 VO + * @return List - 휴가관리 목록 + */ + @Override + public List selectVcatnManageConfmList(VcatnManageVO vcatnManageVO) throws Exception { + + List result = vcatnManageDAO.selectVcatnManageConfmList(vcatnManageVO); + int num = result.size(); + + for (int i = 0; i < num; i++) { + VcatnManageVO vcatnManageVO1 = result.get(i); + vcatnManageVO1.setBgnde(EgovDateUtil.formatDate(vcatnManageVO1.getBgnde(), "-")); + vcatnManageVO1.setEndde(EgovDateUtil.formatDate(vcatnManageVO1.getEndde(), "-")); + result.set(i, vcatnManageVO1); + } + return result; + } + + /** + * 휴가관리정보 승인 처리를 위해 신청된 휴가관리 목록 총 갯수를 조회한다. + * @param vcatnManageVO - 휴가관리 VO + * @return int - 휴가관리 카운트 수 + */ + @Override + public int selectVcatnManageConfmListTotCnt(VcatnManageVO vcatnManageVO) throws Exception { + return vcatnManageDAO.selectVcatnManageConfmListTotCnt(vcatnManageVO); + } + + /** + * 신청된 휴가를 승인처리한다. + * @param vcatnManage - 휴가관리 model + */ + @Override + public void updtVcatnManageConfm(VcatnManage vcatnManage) throws Exception { + InfrmlSanctn infrmlSanctn = new InfrmlSanctn(); + vcatnManage.setBgnde(EgovStringUtil.removeMinusChar(vcatnManage.getBgnde())); + vcatnManage.setEndde(EgovStringUtil.removeMinusChar(vcatnManage.getEndde())); + vcatnManage.setReqstDe(EgovStringUtil.removeMinusChar(vcatnManage.getReqstDe())); + + //KISA 보안약점 조치 (2018-10-29, 윤창원) + if ("C".equals(vcatnManage.getConfmAt())) { + /* + * 승인처리 + */ + infrmlSanctn = infrmlSanctnService.updateInfrmlSanctnConfm(converToInfrmlSanctnObject(vcatnManage)); + + vcatnManage.setSanctnDt(infrmlSanctn.getSanctnDt()); + vcatnManage.setConfmAt(infrmlSanctn.getConfmAt()); + + vcatnManageDAO.updtVcatnManageConfm(vcatnManage); + + } else if ("R".equals(vcatnManage.getConfmAt())) { + /* + * 반려처리 + */ + infrmlSanctn = infrmlSanctnService.updateInfrmlSanctnReturn(converToInfrmlSanctnObject(vcatnManage)); + vcatnManage.setSanctnDt(infrmlSanctn.getSanctnDt()); + vcatnManage.setConfmAt(infrmlSanctn.getConfmAt()); + + // 연차 반환처리 + // 개인연차조회 + VcatnManageVO vcatnManageVO1 = selectIndvdlYrycManage(vcatnManage.getApplcntId()); + double iUseYrycCo = vcatnManageVO1.getUseYrycCo(); //연차테이블의 사용 연차갯수 + double iRemndrYrycCo = vcatnManageVO1.getRemndrYrycCo(); //연차테이블의 잔여 연차갯수 + double iCountYryc = 0.0; + + /* + * 시작일자 와 종료일자 사이의 일자 갯수 - 공휴일 or 주말 제외 + */ + // 휴가구분이 연차인 경우 + if ("01".equals(vcatnManage.getVcatnSe())) { + + iCountYryc = getDateCalc(vcatnManage.getBgnde(), vcatnManage.getEndde()); + + IndvdlYrycManage indvdlYrycManage = new IndvdlYrycManage(); + indvdlYrycManage.setUseYrycCo(iUseYrycCo - iCountYryc); + indvdlYrycManage.setRemndrYrycCo(iRemndrYrycCo + iCountYryc); + indvdlYrycManage.setLastUpdusrId(vcatnManage.getApplcntId()); + indvdlYrycManage.setOccrrncYear(vcatnManage.getOccrrncYear()); + indvdlYrycManage.setUsid(vcatnManage.getApplcntId()); + + updtIndvdlYrycManage(indvdlYrycManage); + } + // 휴가구분이 반차인 경우 + else if ("02".equals(vcatnManage.getVcatnSe())) { + + IndvdlYrycManage indvdlYrycManage = new IndvdlYrycManage(); + indvdlYrycManage.setUseYrycCo(iUseYrycCo - 0.5); + indvdlYrycManage.setRemndrYrycCo(iRemndrYrycCo + 0.5); + indvdlYrycManage.setLastUpdusrId(vcatnManage.getApplcntId()); + indvdlYrycManage.setOccrrncYear(vcatnManage.getOccrrncYear()); + indvdlYrycManage.setUsid(vcatnManage.getApplcntId()); + updtIndvdlYrycManage(indvdlYrycManage); + } + vcatnManageDAO.updtVcatnManageConfm(vcatnManage); + } + } + + /*** 연차관련 ***/ + /** + * 개인별 연차관리의 상세정보를 조회한다. + * @param vcatnManageVO - 휴가관리 VO + * @return VcatnManageVO - 휴가관리 VO + */ + @Override + public VcatnManageVO selectIndvdlYrycManage(String sUsid) throws Exception { + + VcatnManageVO vcatnManageVO = new VcatnManageVO(); + java.util.Calendar cal = java.util.Calendar.getInstance(); + String sYear = Integer.toString(cal.get(java.util.Calendar.YEAR)); + + vcatnManageVO.setOccrrncYear(sYear); + vcatnManageVO.setUsid(sUsid); + + return vcatnManageDAO.selectIndvdlYrycManage(vcatnManageVO); + } + + /** + * 개인별 연차를 수정 처리한다. + * @param vcatnManage - 휴가관리 model + */ + @Override + public void updtIndvdlYrycManage(IndvdlYrycManage indvdlYrycManage) throws Exception { + vcatnManageDAO.updtIndvdlYrycManage(indvdlYrycManage); + } + + /****** 일수 계산 ******/ + /** + * 해당일자의 날짜사이 일수를 구한다 + * @param String fromDay, String toDay + * @return double + * @exception Exception + */ + private double getDateCalc(String fromDay, String toDay) throws Exception { + + // 시작일자 + int fromYear = Integer.parseInt(fromDay.substring(0, 4)); + int fromMonth = Integer.parseInt(fromDay.substring(4, 6)) - 1; + int fromDate = Integer.parseInt(fromDay.substring(6, 8)); + // 종료일자 + int toYear = Integer.parseInt(toDay.substring(0, 4)); + int toMonth = Integer.parseInt(toDay.substring(4, 6)) - 1; + int toDate = Integer.parseInt(toDay.substring(6, 8)); + + Calendar startDay = Calendar.getInstance(); + startDay.set(fromYear, fromMonth, fromDate); + + Calendar endDay = Calendar.getInstance(); + endDay.set(toYear, toMonth, toDate); + + double Count = 0.0; + + // 시작일자 부터 종료일자까지 while + while (!startDay.after(endDay)) { + // 토요일, 일요일은 일수 count에서 제외 + if (startDay.get(Calendar.DAY_OF_WEEK) != 1 && startDay.get(Calendar.DAY_OF_WEEK) != 7) { + Count++; + } + startDay.add(Calendar.DATE, 1); + } + + return Count; + } + + /** + * 휴가일자 해당연차발생연도에 속하는지 여부 체크 + * @param VcatnManage vcatnManage + * @return boolean + * @exception Exception + */ + private boolean getVcatnYearSE(VcatnManage vcatnManage) throws Exception { + + boolean bRetrunValue = false; + java.util.Calendar cal = java.util.Calendar.getInstance(); + + int iYear = cal.get(java.util.Calendar.YEAR); + // 시작일자 + int iYearBgnVcatn = Integer.parseInt(vcatnManage.getBgnde().substring(0, 4)); + // 종료일자 + int iYearEndVcatn = Integer.parseInt(vcatnManage.getEndde().substring(0, 4)); + if (iYear == iYearBgnVcatn && iYear == iYearEndVcatn) { + bRetrunValue = true; + } + return bRetrunValue; + } + + /** + * VcatnManage model을 InfrmlSanctn model로 변환한다. + * @param VcatnManage + * @return InfrmlSanctn + * @param vcatnManage + */ + private InfrmlSanctn converToInfrmlSanctnObject(VcatnManage vcatnManage) throws Exception { + InfrmlSanctn infrmlSanctn = new InfrmlSanctn(); + infrmlSanctn.setJobSeCode("003"); // 업무구분코드 (공통코드 COM75) + infrmlSanctn.setApplcntId(vcatnManage.getApplcntId()); // 신청자ID + infrmlSanctn.setReqstDe(vcatnManage.getReqstDe()); // 신청일자 + infrmlSanctn.setSanctnerId(vcatnManage.getSanctnerId()); // 결재자ID + infrmlSanctn.setConfmAt(vcatnManage.getConfmAt()); // 승인구분 + infrmlSanctn.setSanctnDt(vcatnManage.getSanctnDt()); // 결재일시 + infrmlSanctn.setReturnResn(vcatnManage.getReturnResn()); // 반려사유 + infrmlSanctn.setFrstRegisterId(vcatnManage.getFrstRegisterId()); + infrmlSanctn.setFrstRegisterPnttm(vcatnManage.getFrstRegisterId()); + infrmlSanctn.setLastUpdusrId(vcatnManage.getLastUpdusrId()); + infrmlSanctn.setLastUpdusrPnttm(vcatnManage.getLastUpdusrPnttm()); + infrmlSanctn.setInfrmlSanctnId(vcatnManage.getInfrmlSanctnId());// 약식결재ID + return infrmlSanctn; + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/vct/service/impl/VcatnManageDAO.java b/src/main/java/egovframework/com/uss/ion/vct/service/impl/VcatnManageDAO.java new file mode 100644 index 0000000..23c05f6 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/vct/service/impl/VcatnManageDAO.java @@ -0,0 +1,141 @@ +package egovframework.com.uss.ion.vct.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.ion.vct.service.IndvdlYrycManage; +import egovframework.com.uss.ion.vct.service.VcatnManage; +import egovframework.com.uss.ion.vct.service.VcatnManageVO; + +import org.springframework.stereotype.Repository; + +/** + * 개요 + * - 휴가관리에 대한 DAO 클래스를 정의한다. + * + * 상세내용 + * - 휴가관리에 대한 등록, 수정, 삭제, 조회, 반영확인 기능을 제공한다. + * - 휴가관리의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + */ + +@Repository("vcatnManageDAO") +public class VcatnManageDAO extends EgovComAbstractDAO { + + /** + * 휴가관리정보를 관리하기 위해 등록된 휴가관리 목록을 조회한다. + * @param vcatnManageVO - 휴가관리 VO + * @return List - 휴가관리 목록 + */ + public List selectVcatnManageList(VcatnManageVO vcatnManageVO) throws Exception { + return selectList("vcatnManageDAO.selectVcatnManageList", vcatnManageVO); + } + + /** + * 휴가관리목록 총 갯수를 조회한다. + * @param vcatnManageVO - 휴가관리 VO + * @return int + * @exception Exception + */ + public int selectVcatnManageListTotCnt(VcatnManageVO vcatnManageVO) throws Exception { + return (Integer)selectOne("vcatnManageDAO.selectVcatnManageListTotCnt", vcatnManageVO); + } + + /** + * 등록된 휴가관리의 상세정보를 조회한다. + * @param vcatnManageVO - 휴가관리 VO + * @return VcatnManageVO - 휴가관리 VO + */ + public VcatnManageVO selectVcatnManage(VcatnManageVO vcatnManageVO) throws Exception { + return (VcatnManageVO) selectOne("vcatnManageDAO.selectVcatnManage", vcatnManageVO); + } + + /** + * 휴가관리정보를 신규로 등록한다. + * @param vcatnManage - 휴가관리 model + */ + public void insertVcatnManage(VcatnManage vcatnManage) throws Exception { + insert("vcatnManageDAO.insertVcatnManage", vcatnManage); + } + + /** + * 기 등록된 휴가관리정보를 수정한다. + * @param vcatnManage - 휴가관리 model + */ + public void updtVcatnManage(VcatnManage vcatnManage) throws Exception { + update("vcatnManageDAO.updateVcatnManage", vcatnManage); + } + + /** + * 기 등록된 휴가관리정보를 삭제한다. + * @param vcatnManage - 휴가관리 model + */ + public void deleteVcatnManage(VcatnManage vcatnManage) throws Exception { + delete("vcatnManageDAO.deleteVcatnManage",vcatnManage); + } + + /** + * 휴가일자 중복여부 체크 + * @param vcatnManageVO - 휴가관리 VO + * @return int + * @exception Exception + */ + public int selectVcatnManageDplctAt(VcatnManageVO vcatnManageVO) throws Exception { + return (Integer)selectOne("vcatnManageDAO.selectVcatnManageDplctAt", vcatnManageVO); + } + + + /*** 승인관련 ***/ + /** + * 휴가관리정보 승인 처리를 위해 신청된 휴가관리 목록을 조회한다. + * @param vcatnManageVO - 휴가관리 VO + * @return List - 휴가관리 목록 + */ + public List selectVcatnManageConfmList(VcatnManageVO vcatnManageVO) throws Exception { + return selectList("vcatnManageDAO.selectVcatnManageConfmList", vcatnManageVO); + } + + /** + * 휴가관리정보 승인 처리를 위해 신청된 휴가관리 목록 총 갯수를 조회한다. + * @param vcatnManageVO - 휴가관리 VO + * @return int + * @exception Exception + */ + public int selectVcatnManageConfmListTotCnt(VcatnManageVO vcatnManageVO) throws Exception { + return (Integer)selectOne("vcatnManageDAO.selectVcatnManageConfmListTotCnt", vcatnManageVO); + } + + /** + * 신청된 휴가를 승인처리한다. + * @param vcatnManage - 휴가관리 model + */ + public void updtVcatnManageConfm(VcatnManage vcatnManage) throws Exception { + update("vcatnManageDAO.updateVcatnManageConfm", vcatnManage); + } + + + + /*** 연차관련 ***/ + /** + * 개인별 연차관리의 상세정보를 조회한다. + * @param vcatnManageVO - 휴가관리 VO + * @return VcatnManageVO - 휴가관리 VO + */ + public VcatnManageVO selectIndvdlYrycManage(VcatnManageVO vcatnManageVO) throws Exception { + return (VcatnManageVO) selectOne("vcatnManageDAO.selectIndvdlYrycManage", vcatnManageVO); + } + + + /** + * 연차정보를 수정처리한다. + * @param vcatnManage - 휴가관리 model + */ + public void updtIndvdlYrycManage(IndvdlYrycManage indvdlYrycManage) throws Exception { + + + update("vcatnManageDAO.updateIndvdlYrycManage", indvdlYrycManage); + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/vct/web/EgovVcatnManageController.java b/src/main/java/egovframework/com/uss/ion/vct/web/EgovVcatnManageController.java new file mode 100644 index 0000000..c2a376e --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/vct/web/EgovVcatnManageController.java @@ -0,0 +1,560 @@ +package egovframework.com.uss.ion.vct.web; + +//import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +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.springframework.web.bind.support.SessionStatus; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import egovframework.com.cmm.ComDefaultCodeVO; +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.service.EgovCmmUseService; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.ion.vct.service.EgovVcatnManageService; +import egovframework.com.uss.ion.vct.service.VcatnManage; +import egovframework.com.uss.ion.vct.service.VcatnManageVO; +import egovframework.com.utl.fcc.service.EgovDateUtil; +import egovframework.com.utl.fcc.service.EgovStringUtil; + +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +/** + * 개요 + * - 휴가관리에 대한 controller 클래스를 정의한다. + * + * 상세내용 + * - 휴가관리에 대한 등록, 수정, 삭제, 조회 기능을 제공한다. + * - 휴가관리의 조회기능은 목록조회, 상세조회로 구분된다. + * @author 이용 + * @version 1.0 + * @created 06-15-2010 오후 2:08:56 + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.6.15  이용          최초 생성
    + *   2011.8.26	정진오			IncludedInfo annotation 추가
    + *
    + * 
    + */ + +@Controller +public class EgovVcatnManageController { + + @Resource(name = "egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name = "egovVcatnManageService") + private EgovVcatnManageService egovVcatnManageService; + + @Resource(name = "EgovCmmUseService") + private EgovCmmUseService cmmUseService; + + @Autowired + private DefaultBeanValidator beanValidator; + + /** + * 휴가관리 목록화면 이동 + * @return String + * @exception Exception + */ + @RequestMapping("/uss/ion/vct/EgovVcatnManageListView.do") + public String selectVcatnManageListView() throws Exception { + + return "egovframework/com/uss/ion/vct/EgovVcatnManageList"; + } + + /** + * 휴가관리정보를 관리하기 위해 등록된 휴가관리 목록을 조회한다. + * @param vcatnManageVO - 휴가관리 VO + * @return String - 리턴 Url + */ + @IncludedInfo(name = "휴가관리", order = 900, gid = 50) + @RequestMapping(value = "/uss/ion/vct/EgovVcatnManageList.do") + public String selectVcatnManageList(@ModelAttribute("vcatnManageVO") VcatnManageVO vcatnManageVO, + ModelMap model) throws Exception { + + String searchKeyword = vcatnManageVO.getSearchKeyword(); + + java.util.Calendar cal = java.util.Calendar.getInstance(); + String[] yearList = new String[5]; + for (int x = 0; x < 5; x++) { + yearList[x] = Integer.toString(cal.get(java.util.Calendar.YEAR) - x); + } + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + if (user == null) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + vcatnManageVO = egovVcatnManageService.selectIndvdlYrycManage(user.getUniqId()); + + if (vcatnManageVO == null) { + model.addAttribute("messageTemp", + egovMessageSource.getMessage("comUssIonVct.vcatnManageList.validate.move")); // 휴가 사용을 위한 개인연차 등록을 위해 개인연차관리 콤포넌트로 이동 + return "egovframework/com/uss/ion/yrc/EgovIndvdlYrycManageList"; + } else { + + vcatnManageVO.setSearchKeyword(searchKeyword); + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(vcatnManageVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(vcatnManageVO.getPageUnit()); + paginationInfo.setPageSize(vcatnManageVO.getPageSize()); + + vcatnManageVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + vcatnManageVO.setLastIndex(paginationInfo.getLastRecordIndex()); + vcatnManageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + model.addAttribute("vcatnManageVO", vcatnManageVO); + + vcatnManageVO.setApplcntId(user.getUniqId()); + vcatnManageVO.setVcatnManageList(egovVcatnManageService.selectVcatnManageList(vcatnManageVO)); + + model.addAttribute("vcatnManageList", vcatnManageVO.getVcatnManageList()); + + int totCnt = egovVcatnManageService.selectVcatnManageListTotCnt(vcatnManageVO); + paginationInfo.setTotalRecordCount(totCnt); + + String accessControll = user.getOrgnztId(); + + model.addAttribute("access", accessControll); + model.addAttribute("yearList", yearList); + model.addAttribute("paginationInfo", paginationInfo); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/uss/ion/vct/EgovVcatnManageList"; + } + } + + /** + * 등록된 휴가관리의 상세정보를 조회한다. + * @param vcatnManageVO - 휴가관리 VO + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/ion/vct/EgovVcatnManageDetail.do") + public String selectVcatnManage(@ModelAttribute("vcatnManageVO") VcatnManageVO vcatnManageVO, + @ModelAttribute("vcatnManage") VcatnManage vcatnManage, + @RequestParam Map commandMap, + ModelMap model) throws Exception { + + List vcatnSeCodeList = null; + String sCmd = commandMap.get("cmd") == null ? "" : (String)commandMap.get("cmd"); // 상세정보 구분 + vcatnManageVO.setBgnde(EgovStringUtil.removeMinusChar(vcatnManageVO.getBgnde())); + vcatnManageVO.setEndde(EgovStringUtil.removeMinusChar(vcatnManageVO.getEndde())); + + // 등록 상세정보 + VcatnManageVO vcatnManageVOTemp = egovVcatnManageService.selectVcatnManage(vcatnManageVO); + + model.addAttribute("vcatnManageVO", vcatnManageVOTemp); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + if (sCmd.equals("updt")) { + + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM056"); + vcatnSeCodeList = cmmUseService.selectCmmCodeDetail(vo); + + model.addAttribute("vcatnSeCode", vcatnSeCodeList); + model.addAttribute("vcatnManage", vcatnManageVOTemp); + return "egovframework/com/uss/ion/vct/EgovVcatnUpdt"; + } else { + return "egovframework/com/uss/ion/vct/EgovVcatnDetail"; + } + } + + /** + * 휴가관리 등록 화면으로 이동한다. + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/ion/vct/EgovVcatnRegist.do") + public String insertViewVcatnManage(@ModelAttribute("vcatnManage") VcatnManage vcatnManage, + @ModelAttribute("vcatnManageVO") VcatnManageVO vcatnManageVO, + ModelMap model) throws Exception { + List vcatnSeCodeList = null; + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + VcatnManageVO vcatnManageVO1 = egovVcatnManageService + .selectIndvdlYrycManage(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + vcatnManageVO1.setApplcntId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + vcatnManageVO1.setApplcntNm(user == null ? "" : EgovStringUtil.isNullToString(user.getName())); + vcatnManageVO1.setOrgnztNm(user == null ? "" : EgovStringUtil.isNullToString(user.getOrgnztNm())); + + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM056"); + vcatnSeCodeList = cmmUseService.selectCmmCodeDetail(vo); + + model.addAttribute("vcatnSeCode", vcatnSeCodeList); + model.addAttribute("vcatnManageVO", vcatnManageVO1); + + return "egovframework/com/uss/ion/vct/EgovVcatnRegist"; + } + + /** + * 휴가관리정보를 신규로 등록한다. + * @param vcatnManage - 휴가관리 model + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/ion/vct/insertVcatnManage.do") + public String insertVcatnManage(@ModelAttribute("vcatnManage") VcatnManage vcatnManage, + @ModelAttribute("vcatnManageVO") VcatnManageVO vcatnManageVO, + BindingResult bindingResult, + SessionStatus status, + @RequestParam Map commandMap, + ModelMap model) throws Exception { + + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + //승인권자 소속명, 성명 유지 + model.addAttribute("infSanctnDtNm", + commandMap.get("sanctnDtNm") == null ? "" : (String)commandMap.get("sanctnDtNm")); + model.addAttribute("infOrgnztNm", commandMap.get("orgnztNm") == null ? "" : (String)commandMap.get("orgnztNm")); + + String sEnddeView = commandMap.get("enddeView") == null ? "" : (String)commandMap.get("enddeView"); // 종료일자 구분 + if (!sEnddeView.equals("")) { + vcatnManage.setEndde(sEnddeView); + } + + String sTemp = null; + String sTempMessage = null; + int iTemp = 0; + + beanValidator.validate(vcatnManage, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + model.addAttribute("vcatnManageVO", vcatnManageVO); + return "egovframework/com/uss/ion/vct/EgovVcatnRegist"; + } + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + if (user != null) { + if (vcatnManage.getSanctnerId() != null) { + vcatnManage.setConfmAt("A"); + } + vcatnManage.setApplcntId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + vcatnManage.setFrstRegisterId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + + vcatnManageVO.setApplcntId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + vcatnManageVO.setSearchKeyword(EgovStringUtil.removeMinusChar(vcatnManage.getBgnde())); + //시작일자 포함여부 + iTemp = egovVcatnManageService.selectVcatnManageDplctAt(vcatnManageVO); + vcatnManageVO.setSearchKeyword(EgovStringUtil.removeMinusChar(vcatnManage.getEndde())); + //종료일자 포함여부 + iTemp += egovVcatnManageService.selectVcatnManageDplctAt(vcatnManageVO); + + if (iTemp == 0) { + status.setComplete(); + sTemp = egovVcatnManageService.insertVcatnManage(vcatnManage, vcatnManageVO); + + if (sTemp.equals("01")) { + model.addAttribute("message", egovMessageSource.getMessage("comUssIonVct.common.inputSuccess")); + return "forward:/uss/ion/vct/EgovVcatnManageList.do"; + } else { + if (sTemp.equals("99")) { + sTempMessage = egovMessageSource.getMessage("comUssIonVct.common.validate.vacationSelectError"); + } else if (sTemp.equals("09")) { + sTempMessage = egovMessageSource.getMessage("comUssIonVct.common.validate.thatYearOnly"); + } else if (sTemp.equals("02")) { + sTempMessage = egovMessageSource.getMessage("comUssIonVct.common.validate.vacationFail"); + } else if (sTemp.equals("03")) { + sTempMessage = egovMessageSource.getMessage("comUssIonVct.common.validate.halfVacationFail"); + } else { + sTempMessage = "undefined error"; + } + model.addAttribute("errorMessage", sTempMessage); + + VcatnManageVO vcatnManageVO1 = egovVcatnManageService.selectIndvdlYrycManage(user.getUniqId()); + vcatnManageVO1.setApplcntId(user.getUniqId()); + vcatnManageVO1.setApplcntNm(user.getName()); + vcatnManageVO1.setOrgnztNm(user.getOrgnztNm()); + vcatnManageVO1.setTempBgnde(EgovDateUtil.formatDate(vcatnManage.getBgnde(), "-")); + vcatnManageVO1.setTempEndde(EgovDateUtil.formatDate(vcatnManage.getEndde(), "-")); + + model.addAttribute("vcatnManageVO", vcatnManageVO1); + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM056"); + List vcatnSeCodeList = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("vcatnSeCode", vcatnSeCodeList); + + return "egovframework/com/uss/ion/vct/EgovVcatnRegist"; + } + } else { + + model.addAttribute("errorMessage", + egovMessageSource.getMessage("comUssIonVct.common.validate.duplicate")); + + VcatnManageVO vcatnManageVO1 = egovVcatnManageService + .selectIndvdlYrycManage(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + vcatnManageVO1.setApplcntId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + vcatnManageVO1.setApplcntNm(user == null ? "" : EgovStringUtil.isNullToString(user.getName())); + vcatnManageVO1.setOrgnztNm(user == null ? "" : EgovStringUtil.isNullToString(user.getOrgnztNm())); + model.addAttribute("vcatnManageVO", vcatnManageVO1); + + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM056"); + List vcatnSeCodeList = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("vcatnSeCode", vcatnSeCodeList); + + return "egovframework/com/uss/ion/vct/EgovVcatnRegist"; + } + } else { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + } + + /** + * 기 등록된 휴가관리정보를 수정한다. + * @param vcatnManage - 휴가관리 model + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/ion/vct/updtVcatnManage.do") + public String updtVcatnManage(@ModelAttribute("vcatnManage") VcatnManage vcatnManage, + @ModelAttribute("vcatnManageVO") VcatnManageVO vcatnManageVO, + BindingResult bindingResult, + SessionStatus status, + ModelMap model) throws Exception { + String sTemp = null; + String sTempMessage = null; + int iTemp = 0; + /* + beanValidator.validate(vcatnManage, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + model.addAttribute("vcatnManageVO", vcatnManageVO); + return "egovframework/com/uss/ion/vct/EgovVcatnUpdt"; + } else { + + vcatnManage.setBgnde(EgovStringUtil.removeMinusChar(vcatnManage.getBgnde())); + vcatnManage.setEndde(EgovStringUtil.removeMinusChar(vcatnManage.getEndde())); + sTempMessage = egovVcatnManageService.updtVcatnManage(vcatnManage, vcatnManageVO); + return "forward:/uss/ion/vct/EgovVcatnManageList.do"; + } + */ + // KISA 보안취약점 조치 (2018-12-10, 신용호) + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if (!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + if (user != null) { + vcatnManage.setFrstRegisterId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + sTemp = egovVcatnManageService.updtVcatnManage(vcatnManage, vcatnManageVO); + if (iTemp != 10) { + status.setComplete(); + //sTemp = egovVcatnManageService.insertVcatnManage(vcatnManage, vcatnManageVO); + + if (sTemp.equals("01")) { + model.addAttribute("message", egovMessageSource.getMessage("comUssIonVct.common.inputSuccess")); + return "forward:/uss/ion/vct/EgovVcatnManageList.do"; + } else { + + if (sTemp.equals("99")) { + sTempMessage = egovMessageSource.getMessage("comUssIonVct.common.validate.vacationSelectError"); + } else if (sTemp.equals("09")) { + sTempMessage = egovMessageSource.getMessage("comUssIonVct.common.validate.thatYearOnly"); + } else if (sTemp.equals("02")) { + sTempMessage = egovMessageSource.getMessage("comUssIonVct.common.validate.vacationFail"); + } else if (sTemp.equals("03")) { + sTempMessage = egovMessageSource.getMessage("comUssIonVct.common.validate.halfVacationFail"); + } else { + sTempMessage = "undefined error"; + } + + model.addAttribute("errorMessage", sTempMessage); + + VcatnManageVO vcatnManageVO1 = egovVcatnManageService.selectIndvdlYrycManage(user.getUniqId()); + vcatnManageVO1.setApplcntId(user.getUniqId()); + vcatnManageVO1.setApplcntNm(user.getName()); + vcatnManageVO1.setOrgnztNm(user.getOrgnztNm()); + vcatnManageVO1.setTempBgnde(EgovDateUtil.formatDate(vcatnManage.getBgnde(), "-")); + vcatnManageVO1.setTempEndde(EgovDateUtil.formatDate(vcatnManage.getEndde(), "-")); + + model.addAttribute("vcatnManageVO", vcatnManageVO1); + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM056"); + List vcatnSeCodeList = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("vcatnSeCode", vcatnSeCodeList); + + return "egovframework/com/uss/ion/vct/EgovVcatnUpdt"; + } + } else { + + model.addAttribute("errorMessage", + egovMessageSource.getMessage("comUssIonVct.common.validate.duplicate")); + + VcatnManageVO vcatnManageVO1 = egovVcatnManageService.selectIndvdlYrycManage(user.getUniqId()); + vcatnManageVO1.setApplcntId(user.getUniqId()); + vcatnManageVO1.setApplcntNm(user.getName()); + vcatnManageVO1.setOrgnztNm(user.getOrgnztNm()); + model.addAttribute("vcatnManageVO", vcatnManageVO1); + + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM056"); + List vcatnSeCodeList = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("vcatnSeCode", vcatnSeCodeList); + + return "egovframework/com/uss/ion/vct/EgovVcatnUpdt"; + } + } else { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + } + + /** + * 기 등록된 휴가관리정보를 삭제한다. + * @param vcatnManage - 휴가관리 model + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/ion/vct/deleteVcatnManage.do") + public String deleteVcatnManage(@ModelAttribute("vcatnManage") VcatnManage vcatnManage, + SessionStatus status, + ModelMap model) throws Exception { + vcatnManage.setBgnde(EgovStringUtil.removeMinusChar(vcatnManage.getBgnde())); + vcatnManage.setEndde(EgovStringUtil.removeMinusChar(vcatnManage.getEndde())); + egovVcatnManageService.deleteVcatnManage(vcatnManage); + status.setComplete(); + model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); + return "forward:/uss/ion/vct/EgovVcatnManageList.do"; + } + + /*** 승인관련 ***/ + /** + * 휴가관리정보 승인 처리를 위해 신청된 휴가관리 목록을 조회한다. + * @param vcatnManageVO - 휴가관리 VO + * @return String - 리턴 Url + */ + @IncludedInfo(name = "휴가승인관리", order = 901, gid = 50) + @RequestMapping(value = "/uss/ion/vct/EgovVcatnConfmList.do") + public String selectVcatnManageConfmList(@ModelAttribute("vcatnManageVO") VcatnManageVO vcatnManageVO, + ModelMap model) throws Exception { + + java.util.Calendar cal = java.util.Calendar.getInstance(); + String[] yearList = new String[5]; + for (int x = 0; x < 5; x++) { + yearList[x] = Integer.toString(cal.get(java.util.Calendar.YEAR) - x); + } + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(vcatnManageVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(vcatnManageVO.getPageUnit()); + paginationInfo.setPageSize(vcatnManageVO.getPageSize()); + + vcatnManageVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + vcatnManageVO.setLastIndex(paginationInfo.getLastRecordIndex()); + vcatnManageVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + if (user == null) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + vcatnManageVO.setSanctnerId(user.getUniqId()); //사용자가 승인권자인지 조건값 setting + + vcatnManageVO.setSearchKeyword(vcatnManageVO.getSearchYear() + vcatnManageVO.getSearchMonth()); + vcatnManageVO.setVcatnManageList(egovVcatnManageService.selectVcatnManageConfmList(vcatnManageVO)); + + model.addAttribute("vcatnManageList", vcatnManageVO.getVcatnManageList()); + + int totCnt = egovVcatnManageService.selectVcatnManageConfmListTotCnt(vcatnManageVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("yearList", yearList); + model.addAttribute("paginationInfo", paginationInfo); + + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/uss/ion/vct/EgovVcatnConfmList"; + } + + /** + * 휴가승인관리 상세정보를 조회한다. + * @param vcatnManageVO - 휴가관리 VO + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/ion/vct/EgovVcatnConfm.do") + public String selectVcatnConfm(@ModelAttribute("vcatnManageVO") VcatnManageVO vcatnManageVO, + @ModelAttribute("vcatnManage") VcatnManage vcatnManage, + ModelMap model) throws Exception { + vcatnManageVO.setBgnde(EgovStringUtil.removeMinusChar(vcatnManageVO.getBgnde())); + vcatnManageVO.setEndde(EgovStringUtil.removeMinusChar(vcatnManageVO.getEndde())); + + // 등록 상세정보 + VcatnManageVO vcatnManageVOTemp = egovVcatnManageService.selectVcatnManage(vcatnManageVO); + + model.addAttribute("vcatnManageVO", vcatnManageVOTemp); + model.addAttribute("vcatnManage", vcatnManageVOTemp); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + + return "egovframework/com/uss/ion/vct/EgovVcatnConfm"; + } + + /** + * 신청된 휴가를 승인처리한다. + * @param vcatnManage - 휴가관리 model + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/ion/vct/updtVcatnConfm.do") + public String updtVcatnManageConfm(@ModelAttribute("vcatnManageVO") VcatnManageVO vcatnManageVO, + @ModelAttribute("vcatnManage") VcatnManage vcatnManage, + BindingResult bindingResult, + SessionStatus status, + ModelMap model) throws Exception { + + vcatnManage.setBgnde(EgovStringUtil.removeMinusChar(vcatnManage.getBgnde())); + vcatnManage.setEndde(EgovStringUtil.removeMinusChar(vcatnManage.getEndde())); + beanValidator.validate(vcatnManage, bindingResult); //validation 수행 + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + // KISA 보안취약점 조치 (2018-12-10, 신용호) + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if (!isAuthenticated) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + if (bindingResult.hasErrors()) { + model.addAttribute("vcatnManageVO", vcatnManageVO); + return "egovframework/com/uss/ion/vct/EgovVcatnConfm"; + } else { + vcatnManage.setSanctnerId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + vcatnManage.setLastUpdusrId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + + egovVcatnManageService.updtVcatnManageConfm(vcatnManage); + return "forward:/uss/ion/vct/EgovVcatnConfmList.do"; + } + } + + /** + * 휴가정보 반려처리 화면을 호출한다. + * @param vcatnManage - 휴가관리 model + * @return String + * + * @param vcatnManage + */ + @RequestMapping("/uss/ion/vct/EgovVcatnReturn.do") + public String selectSanctnerListPopup(@ModelAttribute("vcatnManage") VcatnManage vcatnManage, + ModelMap model) throws Exception { + return "egovframework/com/uss/ion/vct/EgovVcatnReturn"; + } +} diff --git a/src/main/java/egovframework/com/uss/ion/wik/bmk/service/EgovWikiBookmarkService.java b/src/main/java/egovframework/com/uss/ion/wik/bmk/service/EgovWikiBookmarkService.java new file mode 100644 index 0000000..e9466af --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/wik/bmk/service/EgovWikiBookmarkService.java @@ -0,0 +1,59 @@ +package egovframework.com.uss.ion.wik.bmk.service; + +import java.util.List; + +/** + * 위키북마크를 처리하는 Service Class 구현 + * @author 공통콤포넌트 장동한 + * @since 2010.10.20 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2010.10.20  장동한          최초 생성
    + *
    + * 
    + */ +public interface EgovWikiBookmarkService { + + /** + * 위키북마크 목록을 조회한다. + * @param wikiBookmark -조회할 정보가 담긴 객체 + * @return List + * @throws Exception + */ + public List selectWikiBookmarkList(WikiBookmark wikiBookmark) throws Exception; + + /** + * 위키북마크를(을) 목록 전체 건수를(을) 조회한다. + * @param wikiBookmark -조회할 정보가 담긴 객체 + * @return int -조회한건수가담긴Integer + * @throws Exception + */ + public int selectWikiBookmarkListCnt(WikiBookmark wikiBookmark) throws Exception; + + /** + * 위키북마크를(을) 중복을 조회한다. + * @param wikiBookmark -조회할 정보가 담긴 객체 + * @return int -조회한건수가담긴Integer + * @throws Exception + */ + public int selectWikiBookmarkDuplicationCnt(WikiBookmark wikiBookmark) throws Exception; + + /** + * 위키북마크를(을) 등록한다. + * @param wikiBookmark -위키북마크 정보 담김 객체 + * @throws Exception + */ + void insertWikiBookmark(WikiBookmark wikiBookmark) throws Exception; + + /** + * 위키북마크를(을) 삭제한다. + * @param wikiBookmark -위키북마크 정보 담김 객체 + * @throws Exception + */ + void deleteWikiBookmark(WikiBookmark wikiBookmark) throws Exception; + +} diff --git a/src/main/java/egovframework/com/uss/ion/wik/bmk/service/WikiBookmark.java b/src/main/java/egovframework/com/uss/ion/wik/bmk/service/WikiBookmark.java new file mode 100644 index 0000000..a371b4d --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/wik/bmk/service/WikiBookmark.java @@ -0,0 +1,146 @@ +package egovframework.com.uss.ion.wik.bmk.service; + +import java.io.Serializable; + +import egovframework.com.cmm.ComDefaultVO; + +/** + * 위키북마크 Model and VO Class 구현 + * @author 공통콤포넌트 장동한 + * @since 2010.10.20 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2010.10.20  장동한          최초 생성
    + * 
    + * 
    + */ +@SuppressWarnings("serial") +public class WikiBookmark extends ComDefaultVO implements Serializable{ + + /** 위키 북마크 아이디 */ + private String wikiBkmkId; + + /** 사용자ID */ + private String usid; + + /** 북마크명 */ + private String wikiBkmkNm; + + /** 최초등록시점 */ + private String frstRegisterPnttm; + + /** 최초등록아이디 */ + private String frstRegisterId; + + /** 최종수정일 */ + private String lastUpdusrPnttm; + + /** 최종수정자 아이디 */ + private String lastUpdusrId; + + /** + * @return the wikiBookMarkId + */ + public String getWikiBkmkId() { + return wikiBkmkId; + } + + /** + * @param wikiBookMarkId the wikiBookMarkId to set + */ + public void setWikiBkmkId(String wikiBookmarkId) { + this.wikiBkmkId = wikiBookmarkId; + } + + /** + * @return the usid + */ + public String getUsid() { + return usid; + } + + /** + * @param usid the usid to set + */ + public void setUsid(String usid) { + this.usid = usid; + } + + /** + * @return the bookMark + */ + public String getWikiBkmkNm() { + return wikiBkmkNm; + } + + /** + * @param bookMark the bookMark to set + */ + public void setWikiBkmkNm(String bookMark) { + this.wikiBkmkNm = bookMark; + } + + /** + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * @param frstRegisterPnttm the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * @param frstRegisterId the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * @param lastUpdusrPnttm the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * @param lastUpdusrId the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + + + +} diff --git a/src/main/java/egovframework/com/uss/ion/wik/bmk/service/impl/EgovWikiBookmarkServiceImpl.java b/src/main/java/egovframework/com/uss/ion/wik/bmk/service/impl/EgovWikiBookmarkServiceImpl.java new file mode 100644 index 0000000..608b37c --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/wik/bmk/service/impl/EgovWikiBookmarkServiceImpl.java @@ -0,0 +1,114 @@ +package egovframework.com.uss.ion.wik.bmk.service.impl; + +import java.util.List; + +import egovframework.com.uss.ion.wik.bmk.service.EgovWikiBookmarkService; +import egovframework.com.uss.ion.wik.bmk.service.WikiBookmark; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +import javax.annotation.Resource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +/** + * 위키북마크를 처리하는 ServiceImpl Class 구현 + * @author 공통콤포넌트 장동한 + * @since 2010.10.20 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2010.10.20  장동한          최초 생성
    + *
    + * 
    + */ +@Service("egovWikiBookmarkService") +public class EgovWikiBookmarkServiceImpl extends EgovAbstractServiceImpl implements EgovWikiBookmarkService { + + /* 위키북마크 DAO */ + @Resource(name = "wikiBookmarkDao") + private WikiBookmarkDao dao; + + /* WIKI_ID Generator Service */ + @Resource(name = "egovWikiBookmarkIdGnrService") + private EgovIdGnrService idgenService; + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovWikiBookmarkServiceImpl.class); + + /** + * 위키북마크 목록을 조회한다. + * @param wikiBookmark -조회할 정보가 담긴 객체 + * @return List + * @throws Exception + */ + @Override + public List selectWikiBookmarkList(WikiBookmark wikiBookmark) throws Exception{ + return dao.selectWikiBookmarkList(wikiBookmark); + } + + /** + * 위키북마크를(을) 목록 전체 건수를(을) 조회한다. + * @param wikiBookmark -조회할 정보가 담긴 객체 + * @return int -조회한건수가담긴Integer + * @throws Exception + */ + @Override + public int selectWikiBookmarkListCnt(WikiBookmark wikiBookmark) throws Exception{ + return dao.selectWikiBookmarkListCnt(wikiBookmark); + } + + /** + * 위키북마크를(을) 중복을 조회한다. + * @param wikiBookmark -조회할 정보가 담긴 객체 + * @return int -조회한건수가담긴Integer + * @throws Exception + */ + @Override + public int selectWikiBookmarkDuplicationCnt(WikiBookmark wikiBookmark) throws Exception{ + return dao.selectWikiBookmarkDuplicationCnt(wikiBookmark); + } + + /** + * 위키북마크를(을) 등록한다. + * @param wikiBookmark -위키북마크 정보 담김 객체 + * @throws Exception + */ + @Override + public void insertWikiBookmark(WikiBookmark wikiBookmark) throws Exception{ + //아이디 가져오기 + + String sUsid = dao.selectWikiBookmarkEmpUniqId(wikiBookmark); + + LOGGER.debug("EgovWikiBookmarkServiceImpl.java sUsid > {}", sUsid); + + //아이디 비교 + if(sUsid != null){ + //위키북마크 키 설정 + wikiBookmark.setWikiBkmkId(idgenService.getNextStringId()); + //아이디 설정 + wikiBookmark.setUsid(sUsid); + wikiBookmark.setFrstRegisterId(sUsid); + wikiBookmark.setLastUpdusrId(sUsid); + dao.insertWikiBookmark(wikiBookmark); + LOGGER.debug("insertWikiBookmark > {}", sUsid); + }; + + } + + /** + * 위키북마크를(을) 삭제한다. + * @param wikiBookmark -위키북마크 정보 담김 객체 + * @throws Exception + */ + @Override + public void deleteWikiBookmark(WikiBookmark wikiBookmark) throws Exception{ + dao.deleteWikiBookmark(wikiBookmark); + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/wik/bmk/service/impl/WikiBookmarkDao.java b/src/main/java/egovframework/com/uss/ion/wik/bmk/service/impl/WikiBookmarkDao.java new file mode 100644 index 0000000..644910e --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/wik/bmk/service/impl/WikiBookmarkDao.java @@ -0,0 +1,84 @@ +package egovframework.com.uss.ion.wik.bmk.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.ion.wik.bmk.service.WikiBookmark; + +import org.springframework.stereotype.Repository; + +/** + * 위키북마크를 처리하는 Dao Class 구현 + * @author 공통콤포넌트 장동한 + * @since 2010.10.20 + * @version 1.0 + * @see
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2010.10.20  장동한          최초 생성
    + *
    + * 
    + */ +@Repository("wikiBookmarkDao") +public class WikiBookmarkDao extends EgovComAbstractDAO { + /** + * 위키북마크 목록을 조회한다. + * @param wikiBookmark -조회할 정보가 담긴 객체 + * @return List + * @throws Exception + */ + public List selectWikiBookmarkList(WikiBookmark wikiBookmark) throws Exception{ + return selectList("WikiBookmark.selectWikiBookmarkList", wikiBookmark); + } + + /** + * 위키북마크를(을) 중복을 조회한다. + * @param wikiBookmark -조회할 정보가 담긴 객체 + * @return int -조회한건수가담긴Integer + * @throws Exception + */ + public int selectWikiBookmarkDuplicationCnt(WikiBookmark wikiBookmark) throws Exception{ + return (Integer)selectOne("WikiBookmark.selectWikiBookmarkDuplicationCnt", wikiBookmark); + } + + /** + * 위키북마크를(을) 목록 전체 건수를(을) 조회한다. + * @param wikiBookmark -조회할 정보가 담긴 객체 + * @return int -조회한건수가담긴Integer + * @throws Exception + */ + public int selectWikiBookmarkListCnt(WikiBookmark wikiBookmark) throws Exception{ + return (Integer)selectOne("WikiBookmark.selectWikiBookmarkListCnt", wikiBookmark); + } + + /** + * 사용자 아이디를 조회한다. + * @param wikiBookmark -조회할 정보가 담긴 객체 + * @return int -조회한건수가담긴Integer + * @throws Exception + */ + public String selectWikiBookmarkEmpUniqId(WikiBookmark wikiBookmark) throws Exception{ + return (String)selectOne("WikiBookmark.selectWikiBookmarkEmpUniqId", wikiBookmark); + } + + + /** + * 위키북마크를(을) 등록한다. + * @param wikiBookmark -위키북마크 정보 담김 객체 + * @throws Exception + */ + void insertWikiBookmark(WikiBookmark wikiBookmark) throws Exception{ + insert("WikiBookmark.insertWikiBookmark",wikiBookmark); + } + + /** + * 위키북마크를(을) 수정한다. + * @param wikiBookmark -위키북마크 정보 담김 객체 + * @throws Exception + */ + void deleteWikiBookmark(WikiBookmark wikiBookmark) throws Exception{ + delete("WikiBookmark.deleteWikiBookmark", wikiBookmark); + } +} diff --git a/src/main/java/egovframework/com/uss/ion/wik/bmk/web/EgovWikiBookmarkController.java b/src/main/java/egovframework/com/uss/ion/wik/bmk/web/EgovWikiBookmarkController.java new file mode 100644 index 0000000..f8d2617 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/wik/bmk/web/EgovWikiBookmarkController.java @@ -0,0 +1,168 @@ +package egovframework.com.uss.ion.wik.bmk.web; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +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 egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.ion.wik.bmk.service.EgovWikiBookmarkService; +import egovframework.com.uss.ion.wik.bmk.service.WikiBookmark; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +/** + * 위키북마크를 처리하는 Controller Class 구현 + * @author 공통콤포넌트 장동한 + * @since 2010.10.20 + * @version 1.0 + * @see + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2010.10.20  장동한          최초 생성
    + *   2011.8.26	정진오			IncludedInfo annotation 추가
    + *
    + * 
    + */ + + +@Controller +public class EgovWikiBookmarkController { + + @Autowired + private DefaultBeanValidator beanValidator; + + /** EgovMessageSource */ + @Resource(name = "egovMessageSource") + EgovMessageSource egovMessageSource; + + /** egovOnlinePollService */ + @Resource(name = "egovWikiBookmarkService") + private EgovWikiBookmarkService egovWikiBookmarkService; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovWikiBookmarkController.class); + + /** + * 위키북마크 목록을 조회한다. + * @param searchVO -위키북마크 model + * @param searchVO -위키북마크 model + * @param commandMap -Request Variable + * @param model -Spring 제공하는 ModelMap + * @return String -리턴 URL + * @throws Exception + */ + @IncludedInfo(name="Wiki기능", order = 810 ,gid = 50) + @RequestMapping(value = "/uss/ion/wik/bmk/listWikiBookmark.do") + public String EgovWikiBookmarkList( + @ModelAttribute("searchVO") WikiBookmark searchVO, + WikiBookmark wikiBookmark, + @RequestParam Map commandMap, + @RequestParam(value="checkList", required=false) List checkList, + ModelMap model) throws Exception { + + //변수 설정 + String sCmd = commandMap.get("cmd") == null ? "" : (String) commandMap.get("cmd"); + + //Spring Security 사용자권한 처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + //로그인 객체 선언 + LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + + //삭제 모드로 실행시 + if(sCmd.equals("del")){ + + for(String checkData : checkList) { + LOGGER.debug("===>>> checkData = "+checkData); + wikiBookmark.setWikiBkmkId(checkData); + egovWikiBookmarkService.deleteWikiBookmark(wikiBookmark); + } + + //페이지 인텍스 설정 + searchVO.setPageIndex(1); + + return "redirect:/uss/ion/wik/bmk/listWikiBookmark.do"; + } + + + /** 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()); + + searchVO.setFrstRegisterId(loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getUniqId())); + + List reusltList = egovWikiBookmarkService.selectWikiBookmarkList(searchVO); + model.addAttribute("resultList", reusltList); + + model.addAttribute("searchKeyword", commandMap.get("searchKeyword") == null ? "" : (String) commandMap.get("searchKeyword")); + model.addAttribute("searchCondition", commandMap.get("searchCondition") == null ? "" : (String) commandMap.get("searchCondition")); + + int totCnt = egovWikiBookmarkService.selectWikiBookmarkListCnt(searchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + return "egovframework/com/uss/ion/wik/bmk/EgovWikiBookmarkList"; + } + + /** + * 위키북마크를 등록 한다. + * @param wikiBookmark -위키북마크 model + * @param model -Spring 제공하는 ModelMap + * @return String -리턴 URL + * @throws Exception + */ + @RequestMapping(value = "/uss/ion/wik/bmk/registWikiBookmark.do") + public String EgovWikiBookmarkRegist( + WikiBookmark wikiBookmark, + ModelMap model) throws Exception { + + String sDupl = "N"; + + if(wikiBookmark.getUsid() != null && wikiBookmark.getWikiBkmkNm() != null){ + if(egovWikiBookmarkService.selectWikiBookmarkDuplicationCnt(wikiBookmark) > 0){ + sDupl = "Y"; + }else{ + egovWikiBookmarkService.insertWikiBookmark(wikiBookmark); + } + } + //log.debug("Controller EgovWikiBookmarkRegist.WikiBookmark>" + wikiBookmark); + //중복 설정 + model.addAttribute("S_DUPL", sDupl); + return "egovframework/com/uss/ion/wik/bmk/EgovWikiBookmarkRegist"; + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/yrc/service/EgovIndvdlYrycManageService.java b/src/main/java/egovframework/com/uss/ion/yrc/service/EgovIndvdlYrycManageService.java new file mode 100644 index 0000000..7e09694 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/yrc/service/EgovIndvdlYrycManageService.java @@ -0,0 +1,48 @@ +package egovframework.com.uss.ion.yrc.service; + +import java.util.List; + +/** + * 개요 + * - 개인연차관리에 대한 Service Interface를 정의한다. + * + * 상세내용 + * - 개인연차관리에 대한 등록, 수정, 삭제, 조회 기능을 제공한다. + * @author 이기하 + * @version 1.0 + * @created 2014.11.14 + */ + +public interface EgovIndvdlYrycManageService { + + /** + * 개인연차를 조회처리한다. + * @param indvdlYrycManage - 개인연차관리 model + */ + public List selectIndvdlYrycManageList(IndvdlYrycManage indvdlYrycManage) throws Exception; + + /** + * 연차목록 총 갯수를 조회한다. + * @param indvdlYrycManage - 개인연차관리 model + */ + public int selectIndvdlYrycManageListTotCnt(IndvdlYrycManage indvdlYrycManage) throws Exception; + + /** + * 개인연차를 입력처리한다. + * @param indvdlYrycManage - 개인연차관리 model + */ + public void insertIndvdlYrycManage(IndvdlYrycManage indvdlYrycManage) throws Exception; + + /** + * 개인연차를 수정한다. + * @param indvdlYrycManage - 개인연차관리 model + */ + public void updtIndvdlYrycManage(IndvdlYrycManage indvdlYrycManage) throws Exception; + + /** + * 개인연차를 삭제한다. + * @param indvdlYrycManage - 개인연차관리 model + */ + public void deleteIndvdlYrycManage(IndvdlYrycManage indvdlYrycManage) throws Exception; + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/yrc/service/IndvdlYrycManage.java b/src/main/java/egovframework/com/uss/ion/yrc/service/IndvdlYrycManage.java new file mode 100644 index 0000000..96ff2f3 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/yrc/service/IndvdlYrycManage.java @@ -0,0 +1,211 @@ +package egovframework.com.uss.ion.yrc.service; + +import egovframework.com.cmm.ComDefaultVO; + +/** + * 개요 + * - 개인별 연차관리에 대한 model 클래스를 정의한다. + * + * 상세내용 + * - 연차관리의 발생연도,사용자ID,연차발생갯수,사용연차갯수,잔여연차갯수,최초등록자ID,최초등록시점,최종수정자ID,최종수정시점 항목을 관리한다. + * @author 이기하 + * @version 1.0 + * @created 2014.11.14 + */ + +public class IndvdlYrycManage extends ComDefaultVO { + + private static final long serialVersionUID = 1L; + + /** + * 발생연도 + */ + private String occrrncYear; + + /** + * 사용자ID + */ + private String mberId; + + /** + * 사용자 이름 + */ + private String mberNm; + + /** + * 발생연차갯수 + */ + private double occrncYrycCo; + + /** + * 사용연차갯수 + */ + private double useYrycCo; + + /** + * 잔여연차갯수 + */ + private double remndrYrycCo; + + /** + * 최초등록자ID + */ + private String frstRegisterId; + + /** + * 최초등록시점 + */ + private String frstRegisterPnttm; + + /** + * 최종수정자ID + */ + private String lastUpdusrId; + + /** + * 최종수정시점 + */ + private String lastUpdusrPnttm; + + /** + * @return the occrrncYear + */ + public String getOccrrncYear() { + return occrrncYear; + } + + /** + * @param occrrncYear the occrrncYear to set + */ + public void setOccrrncYear(String occrrncYear) { + this.occrrncYear = occrrncYear; + } + + /** + * @return the mberId + */ + public String getMberId() { + return mberId; + } + + /** + * @param mberId the mberId to set + */ + public void setMberId(String mberId) { + this.mberId = mberId; + } + + + /** + * @return the mberNm + */ + public String getMberNm() { + return mberNm; + } + + /** + * @param mberId the mberNm to set + */ + public void setMberNm(String mberNm) { + this.mberNm = mberNm; + } + + /** + * @return the frstRegisterId + */ + public String getFrstRegisterId() { + return frstRegisterId; + } + + /** + * @param frstRegisterId the frstRegisterId to set + */ + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + + /** + * @return the frstRegisterPnttm + */ + public String getFrstRegisterPnttm() { + return frstRegisterPnttm; + } + + /** + * @param frstRegisterPnttm the frstRegisterPnttm to set + */ + public void setFrstRegisterPnttm(String frstRegisterPnttm) { + this.frstRegisterPnttm = frstRegisterPnttm; + } + + /** + * @return the lastUpdusrId + */ + public String getLastUpdusrId() { + return lastUpdusrId; + } + + /** + * @param lastUpdusrId the lastUpdusrId to set + */ + public void setLastUpdusrId(String lastUpdusrId) { + this.lastUpdusrId = lastUpdusrId; + } + + /** + * @return the lastUpdusrPnttm + */ + public String getLastUpdusrPnttm() { + return lastUpdusrPnttm; + } + + /** + * @param lastUpdusrPnttm the lastUpdusrPnttm to set + */ + public void setLastUpdusrPnttm(String lastUpdusrPnttm) { + this.lastUpdusrPnttm = lastUpdusrPnttm; + } + + /** + * @return the occrncYrycCo + */ + public double getOccrncYrycCo() { + return occrncYrycCo; + } + + /** + * @param occrncYrycCo the occrncYrycCo to set + */ + public void setOccrncYrycCo(double occrncYrycCo) { + this.occrncYrycCo = occrncYrycCo; + } + + /** + * @return the useYrycCo + */ + public double getUseYrycCo() { + return useYrycCo; + } + + /** + * @param useYrycCo the useYrycCo to set + */ + public void setUseYrycCo(double useYrycCo) { + this.useYrycCo = useYrycCo; + } + + /** + * @return the remndrYrycCo + */ + public double getRemndrYrycCo() { + return remndrYrycCo; + } + + /** + * @param remndrYrycCo the remndrYrycCo to set + */ + public void setRemndrYrycCo(double remndrYrycCo) { + this.remndrYrycCo = remndrYrycCo; + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/ion/yrc/service/impl/EgovIndvdlYrycManageServiceImpl.java b/src/main/java/egovframework/com/uss/ion/yrc/service/impl/EgovIndvdlYrycManageServiceImpl.java new file mode 100644 index 0000000..d20d447 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/yrc/service/impl/EgovIndvdlYrycManageServiceImpl.java @@ -0,0 +1,78 @@ +package egovframework.com.uss.ion.yrc.service.impl; + +import java.util.List; + +import egovframework.com.uss.ion.yrc.service.EgovIndvdlYrycManageService; +import egovframework.com.uss.ion.yrc.service.IndvdlYrycManage; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +/** + * 개요 + * - 연차관리에 대한 ServiceImpl 클래스를 정의한다. + * + * 상세내용 + * - 연차관리에 대한 등록, 수정, 삭제, 조회 기능을 제공한다. + * - 연차관리의 조회기능은 목록조회로 구분된다. + * @author 이기하 + * @version 1.0 + * @created 2014.11.14 + */ + +@Service("egovIndvdlYrycManageService") +public class EgovIndvdlYrycManageServiceImpl extends EgovAbstractServiceImpl implements EgovIndvdlYrycManageService { + + @Resource(name="indvdlYrycDAO") + private IndvdlYrycDAO indvdlYrycDAO; + + /** + * 개인별 연차를 조회 처리한다. + * @param indvdlYrycManage - 연차관리 model + */ + @Override + public List selectIndvdlYrycManageList(IndvdlYrycManage indvdlYrycManage) throws Exception { + List result = indvdlYrycDAO.selectIndvdlYrycManageList(indvdlYrycManage); + return result; + } + + /** + * 개인별 연차 리스트 갯수를 조회 처리한다. + * @param indvdlYrycManage - 연차관리 model + */ + @Override + public int selectIndvdlYrycManageListTotCnt(IndvdlYrycManage indvdlYrycManage) throws Exception { + return indvdlYrycDAO.selectIndvdlYrycManageListTotCnt(indvdlYrycManage); + } + + /** + * 개인별 연차를 입력 처리한다. + * @param indvdlYrycManage - 연차관리 model + */ + @Override + public void insertIndvdlYrycManage(IndvdlYrycManage indvdlYrycManage) throws Exception { + indvdlYrycDAO.insertIndvdlYrycManage(indvdlYrycManage); + } + + /** + * 개인별 연차를 수정 처리한다. + * @param indvdlYrycManage - 연차관리 model + */ + @Override + public void updtIndvdlYrycManage(IndvdlYrycManage indvdlYrycManage) throws Exception { + indvdlYrycDAO.updtIndvdlYrycManage(indvdlYrycManage); + } + + /** + * 개인별 연차를 삭제 처리한다. + * @param indvdlYrycManage - 연차관리 model + */ + @Override + public void deleteIndvdlYrycManage(IndvdlYrycManage indvdlYrycManage) throws Exception { + indvdlYrycDAO.deleteIndvdlYrycManage(indvdlYrycManage); + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/yrc/service/impl/IndvdlYrycDAO.java b/src/main/java/egovframework/com/uss/ion/yrc/service/impl/IndvdlYrycDAO.java new file mode 100644 index 0000000..d86aae0 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/yrc/service/impl/IndvdlYrycDAO.java @@ -0,0 +1,64 @@ +package egovframework.com.uss.ion.yrc.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.ion.yrc.service.IndvdlYrycManage; + +import org.springframework.stereotype.Repository; + +/** + * 개요 + * - 연차관리에 대한 DAO 클래스를 정의한다. + * + * 상세내용 + * - 연차관리에 대한 등록, 수정, 삭제, 조회 기능을 제공한다. + * @author 이기하 + * @version 1.0 + * @created 2014.11.14 + */ + +@Repository("indvdlYrycDAO") +public class IndvdlYrycDAO extends EgovComAbstractDAO { + + /** + * 연차를 조회처리한다. + * @param indvdlYrycManage - 연차관리 model + */ + public List selectIndvdlYrycManageList(IndvdlYrycManage indvdlYrycManage) throws Exception { + return selectList("indvdlYrycDAO.selectIndvdlYrycManageList", indvdlYrycManage); + } + + /** + * 연차목록 총 갯수를 조회한다. + * @param indvdlYrycManage - 연차관리 model + */ + public int selectIndvdlYrycManageListTotCnt(IndvdlYrycManage indvdlYrycManage) throws Exception { + return (Integer)selectOne("indvdlYrycDAO.selectIndvdlYrycManageListTotCnt", indvdlYrycManage); + } + + /** + * 연차를 입력처리한다. + * @param indvdlYrycManage - 연차관리 model + */ + public void insertIndvdlYrycManage(IndvdlYrycManage indvdlYrycManage) throws Exception { + insert("indvdlYrycDAO.insertIndvdlYrycManage", indvdlYrycManage); + } + + /** + * 연차를 수정처리한다. + * @param indvdlYrycManage - 연차관리 model + */ + public void updtIndvdlYrycManage(IndvdlYrycManage indvdlYrycManage) throws Exception { + update("indvdlYrycDAO.updateIndvdlYrycManage", indvdlYrycManage); + } + + /** + * 연차를 삭제처리한다. + * @param indvdlYrycManage - 연차관리 model + */ + public void deleteIndvdlYrycManage(IndvdlYrycManage indvdlYrycManage) throws Exception { + delete("indvdlYrycDAO.deleteIndvdlYrycManage", indvdlYrycManage); + } + +} diff --git a/src/main/java/egovframework/com/uss/ion/yrc/web/EgovIndvdlYrycManageController.java b/src/main/java/egovframework/com/uss/ion/yrc/web/EgovIndvdlYrycManageController.java new file mode 100644 index 0000000..bf8dd68 --- /dev/null +++ b/src/main/java/egovframework/com/uss/ion/yrc/web/EgovIndvdlYrycManageController.java @@ -0,0 +1,151 @@ +package egovframework.com.uss.ion.yrc.web; + +import java.util.List; + +import javax.annotation.Resource; + +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.RequestMethod; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.ion.yrc.service.EgovIndvdlYrycManageService; +import egovframework.com.uss.ion.yrc.service.IndvdlYrycManage; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.fdl.string.EgovDateUtil; + +/** + * 개요 + * - 개인연차관리에 대한 controller 클래스를 정의한다. + * + * 상세내용 + * - 개인연차관리에 대한 등록, 수정, 삭제, 조회 기능을 제공한다. + * @author 표준프레임워크센터 + * @version 1.0 + * @created 2014.11.14 + *
    + * << 개정이력(Modification Information) >>
    + *
    + *     수정일      	수정자          수정내용
    + *  -----------    --------    ---------------------------
    + *   2014.11.14		이기하          최초 생성
    + *
    + * 
    + */ + +@Controller +public class EgovIndvdlYrycManageController { + + @Resource(name = "egovIndvdlYrycManageService") + private EgovIndvdlYrycManageService egovIndvdlYrycManageService; + + @Autowired + private DefaultBeanValidator beanValidator; + + /** + * 개인연차관리정보를 관리하기 위해 등록된 개인연차관리 목록을 조회한다. + * @param IndvdlYrycManage - 개인연차관리 VO + * @return String - 리턴 Url + */ + @IncludedInfo(name="개인연차관리", order = 902 ,gid = 50) + @RequestMapping(value="/uss/ion/yrc/EgovIndvdlYrycManageList.do") + public String selectIndvdlYrycManageList(IndvdlYrycManage indvdlYrycManage, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + if (user == null) { + return "egovframework/com/uat/uia/EgovLoginUsr"; + } + + indvdlYrycManage.setMberId(user.getUniqId()); + + List indvdlYrycManageList = egovIndvdlYrycManageService.selectIndvdlYrycManageList(indvdlYrycManage); + model.addAttribute("resultList", indvdlYrycManageList); + + return "egovframework/com/uss/ion/yrc/EgovIndvdlYrycManageList"; + } + /** + * 개인별연차관리 등록 화면으로 이동한다. + * @param indvdlYrycManage - 연차관리 model + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/ion/yrc/EgovIndvdlYrycRegist.do", method=RequestMethod.GET) + public String insertViewIndvdlYrycManage(@ModelAttribute IndvdlYrycManage indvdlYrycManage, ModelMap model) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + indvdlYrycManage.setMberId(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + indvdlYrycManage.setMberNm(user == null ? "" : EgovStringUtil.isNullToString(user.getName())); + + List indvdlYrycManageList = egovIndvdlYrycManageService.selectIndvdlYrycManageList(indvdlYrycManage); + indvdlYrycManage.setOccrrncYear(EgovDateUtil.getCurrentYearAsString()); + + int totCnt = egovIndvdlYrycManageService.selectIndvdlYrycManageListTotCnt(indvdlYrycManage); + + model.addAttribute("resultList", indvdlYrycManageList); + model.addAttribute("totCnt", totCnt); + + return "egovframework/com/uss/ion/yrc/EgovIndvdlYrycRegist"; + } + + /** + * 개인별연차관리 등록한다. + * @param indvdlYrycManage - 연차관리 model + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/ion/yrc/EgovIndvdlYrycRegist.do", method=RequestMethod.POST) + public String insertIndvdlYrycManage(@ModelAttribute IndvdlYrycManage indvdlYrycManage, BindingResult bindingResult, + ModelMap model) throws Exception { + + beanValidator.validate(indvdlYrycManage, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + model.addAttribute("indvdlYrycManage", indvdlYrycManage); + return "egovframework/com/uss/ion/yrc/EgovIndvdlYrycRegist"; + } else { + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + indvdlYrycManage.setMberId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + indvdlYrycManage.setRemndrYrycCo(indvdlYrycManage.getOccrncYrycCo() - indvdlYrycManage.getUseYrycCo()); + + int totCnt = egovIndvdlYrycManageService.selectIndvdlYrycManageListTotCnt(indvdlYrycManage); + + if (totCnt >= 1) { + egovIndvdlYrycManageService.updtIndvdlYrycManage(indvdlYrycManage); + } else { + egovIndvdlYrycManageService.insertIndvdlYrycManage(indvdlYrycManage); + } + + List indvdlYrycManageList = egovIndvdlYrycManageService.selectIndvdlYrycManageList(indvdlYrycManage); + model.addAttribute("resultList", indvdlYrycManageList); + model.addAttribute("totCnt", totCnt); + + return "egovframework/com/uss/ion/yrc/EgovIndvdlYrycManageList"; + } + } + + /** + * 개인별연차관리 삭제한다. + * @param indvdlYrycManage - 연차관리 model + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/ion/yrc/deleteIndvdlYryc.do", method=RequestMethod.POST) + public String deleteIndvdlYrycManage(IndvdlYrycManage indvdlYrycManage) throws Exception { + + LoginVO user = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser(); + indvdlYrycManage.setMberId((user == null || user.getUniqId() == null) ? "" : user.getUniqId()); + + int totCnt = egovIndvdlYrycManageService.selectIndvdlYrycManageListTotCnt(indvdlYrycManage); + + if (totCnt >= 1) { + egovIndvdlYrycManageService.deleteIndvdlYrycManage(indvdlYrycManage); + } + + return "egovframework/com/uss/ion/yrc/EgovIndvdlYrycManageList"; + } + +} diff --git a/src/main/java/egovframework/com/uss/umt/service/DeptManageVO.java b/src/main/java/egovframework/com/uss/umt/service/DeptManageVO.java new file mode 100644 index 0000000..34d1b32 --- /dev/null +++ b/src/main/java/egovframework/com/uss/umt/service/DeptManageVO.java @@ -0,0 +1,50 @@ +package egovframework.com.uss.umt.service; + +import egovframework.com.cmm.ComDefaultVO; + +public class DeptManageVO extends ComDefaultVO { + + private static final long serialVersionUID = 1L; + private String orgnztId; + private String orgnztNm; + private String orgnztDc; + + /** + * @return the orgnztId + */ + public String getOrgnztId() { + return orgnztId; + } + /** + * @param orgnztId the orgnztId to set + */ + public void setOrgnztId(String orgnztId) { + this.orgnztId = orgnztId; + } + /** + * @return the orgnztNm + */ + public String getOrgnztNm() { + return orgnztNm; + } + /** + * @param orgnztNm the orgnztNm to set + */ + public void setOrgnztNm(String orgnztNm) { + this.orgnztNm = orgnztNm; + } + /** + * @return the orgnztDc + */ + public String getOrgnztDc() { + return orgnztDc; + } + /** + * @param orgnztDc the orgnztDc to set + */ + public void setOrgnztDc(String orgnztDc) { + this.orgnztDc = orgnztDc; + } + + +} diff --git a/src/main/java/egovframework/com/uss/umt/service/EgovDeptManageService.java b/src/main/java/egovframework/com/uss/umt/service/EgovDeptManageService.java new file mode 100644 index 0000000..5192db8 --- /dev/null +++ b/src/main/java/egovframework/com/uss/umt/service/EgovDeptManageService.java @@ -0,0 +1,57 @@ +package egovframework.com.uss.umt.service; + +import java.util.List; + +public interface EgovDeptManageService { + + /** + * 부서를 관리하기 위해 등록된 부서목록을 조회한다. + * @param deptManageVO - 부서 Vo + * @return List - 부서 목록 + * + * @param deptManageVO + */ + public List selectDeptManageList(DeptManageVO deptManageVO) throws Exception; + + /** + * 부서목록 총 갯수를 조회한다. + * @param deptManageVO - 부서 Vo + * @return int - 부서 카운트 수 + * + * @param deptManageVO + */ + public int selectDeptManageListTotCnt(DeptManageVO deptManageVO) throws Exception; + + /** + * 등록된 부서의 상세정보를 조회한다. + * @param deptManageVO - 부서 Vo + * @return deptManageVO - 부서 Vo + * + * @param deptManageVO + */ + public DeptManageVO selectDeptManage(DeptManageVO deptManageVO) throws Exception; + + /** + * 부서정보를 신규로 등록한다. + * @param deptManageVO - 부서 model + * + * @param deptManageVO + */ + public void insertDeptManage(DeptManageVO deptManageVO) throws Exception; + + /** + * 기 등록된 부서정보를 수정한다. + * @param deptManageVO - 부서 model + * + * @param deptManageVO + */ + public void updateDeptManage(DeptManageVO deptManageVO) throws Exception; + + /** + * 기 등록된 부서정보를 삭제한다. + * @param deptManageVO - 부서 model + * + * @param deptManageVO + */ + public void deleteDeptManage(DeptManageVO deptManageVO) throws Exception; +} diff --git a/src/main/java/egovframework/com/uss/umt/service/EgovEntrprsManageService.java b/src/main/java/egovframework/com/uss/umt/service/EgovEntrprsManageService.java new file mode 100644 index 0000000..d0294d1 --- /dev/null +++ b/src/main/java/egovframework/com/uss/umt/service/EgovEntrprsManageService.java @@ -0,0 +1,101 @@ +package egovframework.com.uss.umt.service; + +import java.util.List; + +/** + * 기업회원관리에 관한 인터페이스클래스를 정의한다. + * @author 공통서비스 개발팀 조재영 + * @since 2009.04.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.10  조재영          최초 생성
    + *   2017.07.21  장동한 			로그인인증제한 작업
    + *
    + * 
    + */ +public interface EgovEntrprsManageService { + + /** + * 기업회원의 기본정보를 화면에서 입력하여 항목의 정합성을 체크하고 데이터베이스에 저장 + * @param entrprsManageVO 기업회원등록정보 + * @return result 등록결과 + * @throws Exception + */ + public String insertEntrprsmber(EntrprsManageVO entrprsManageVO) throws Exception; + + /** + * 기 등록된 사용자 중 검색조건에 맞는기업회원의 정보를 데이터베이스에서 읽어와 화면에 출력 + * @param entrprsmberId 조회대상 기업회원아이디 + * @return entrprsManageVO 기업회원정보 + * @throws Exception + */ + public EntrprsManageVO selectEntrprsmber(String entrprsmberId) throws Exception; + + /** + * 화면에 조회된 기업회원의 기본정보를 수정하여 항목의 정합성을 체크하고 수정된 데이터를 데이터베이스에 반영 + * @param entrprsManageVO 기업회원수정정보 + * @throws Exception + */ + public void updateEntrprsmber(EntrprsManageVO entrprsManageVO) throws Exception; + + /** + * 화면에 조회된 기업회원의 정보를 데이터베이스에서 삭제 + * @param checkedIdForDel 삭제대상기업회원아이디 + * @throws Exception + */ + public void deleteEntrprsmber(String checkedIdForDel) throws Exception; + + /** + * 기업회원용 약관정보 조회 + * @param stplatId 기업회원약관아이디 + * @return stplatList 기업회원약관정보 + * @throws Exception + */ + public List selectStplat(String stplatId) throws Exception; + + /** + * 기업회원암호수정 + * @param entrprsManageVO 기업회원수정정보(비밀번호) + * @throws Exception + */ + public void updatePassword(EntrprsManageVO entrprsManageVO) throws Exception; + + /** + * 기업회원이 비밀번호를 기억하지 못할 때 비밀번호를 찾을 수 있도록 함 + * @param passVO 기업회원암호 조회조건정보 + * @return entrprsManageVO 기업회원암호정보 + * @throws Exception + */ + public EntrprsManageVO selectPassword(EntrprsManageVO passVO) throws Exception; + + /** + * 기 등록된기업 회원 중 검색조건에 맞는 회원들의 정보를 데이터베이스에서 읽어와 화면에 출력 + * @param userSearchVO 검색조건 + * @return List 기업회원목록정보 + * @throws Exception + */ + public List selectEntrprsMberList(UserDefaultVO userSearchVO) throws Exception; + + /** + * 기업회원 총 갯수를 조회한다. + * @param userSearchVO 검색조건 + * @return 사용자 총 갯수(int) + * @throws Exception + */ + public int selectEntrprsMberListTotCnt(UserDefaultVO userSearchVO) throws Exception; + + + /** + * 로그인인증제한 해제 + * @param entrprsManageVO 기업회원정보 + * @return void + * @throws Exception + */ + public void updateLockIncorrect(EntrprsManageVO entrprsManageVO) throws Exception; +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/umt/service/EgovMberManageService.java b/src/main/java/egovframework/com/uss/umt/service/EgovMberManageService.java new file mode 100644 index 0000000..7222c8b --- /dev/null +++ b/src/main/java/egovframework/com/uss/umt/service/EgovMberManageService.java @@ -0,0 +1,101 @@ +package egovframework.com.uss.umt.service; + +import java.util.List; + +/** + * 일반회원관리에 관한 인터페이스클래스를 정의한다. + * @author 공통서비스 개발팀 조재영 + * @since 2009.04.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.10  조재영          최초 생성
    + *   2017.07.21  장동한 			로그인인증제한 작업
    + *
    + * 
    + */ +public interface EgovMberManageService { + + /** + * 사용자의 기본정보를 화면에서 입력하여 항목의 정합성을 체크하고 데이터베이스에 저장 + * @param mberManageVO 일반회원 등록정보 + * @return 등록결과 + * @throws Exception + */ + public String insertMber(MberManageVO mberManageVO) throws Exception; + + /** + * 기 등록된 사용자 중 검색조건에 맞는 일반회원의 정보를 데이터베이스에서 읽어와 화면에 출력 + * @param mberId 상세조회대상 일반회원아이디 + * @return mberManageVO 일반회원상세정보 + * @throws Exception + */ + public MberManageVO selectMber(String mberId) throws Exception; + + /** + * 기 등록된 회원 중 검색조건에 맞는 회원들의 정보를 데이터베이스에서 읽어와 화면에 출력 + * @param userSearchVO 검색조건 + * @return List 일반회원목록정보 + * @throws Exception + */ + public List selectMberList(UserDefaultVO userSearchVO) throws Exception; + + /** + * 일반회원 총 갯수를 조회한다. + * @param userSearchVO 검색조건 + * @return 일반회원총갯수(int) + * @throws Exception + */ + public int selectMberListTotCnt(UserDefaultVO userSearchVO) throws Exception; + + /** + * 화면에 조회된 일반회원의 기본정보를 수정하여 항목의 정합성을 체크하고 수정된 데이터를 데이터베이스에 반영 + * @param mberManageVO 일반회원수정정보 + * @throws Exception + */ + public void updateMber(MberManageVO mberManageVO) throws Exception; + + /** + * 화면에 조회된 사용자의 정보를 데이터베이스에서 삭제 + * @param checkedIdForDel 삭제대상 일반회원아이디 + * @throws Exception + */ + public void deleteMber(String checkedIdForDel) throws Exception; + + /** + * 일반회원 약관확인 + * @param stplatId 일반회원약관아이디 + * @return 일반회원약관정보(List) + * @throws Exception + */ + public List selectStplat(String stplatId) throws Exception; + + /** + * 일반회원암호수정 + * @param mberManageVO 일반회원수정정보(비밀번호) + * @throws Exception + */ + public void updatePassword(MberManageVO mberManageVO) throws Exception; + + /** + * 일반회원이 비밀번호를 기억하지 못할 때 비밀번호를 찾을 수 있도록 함 + * @param passVO 일반회원암호 조회조건정보 + * @return mberManageVO 일반회원암호정보 + * @throws Exception + */ + public MberManageVO selectPassword(MberManageVO passVO) throws Exception; + + /** + * 로그인인증제한 해제 + * @param mberManageVO 일반회원정보 + * @return void + * @throws Exception + */ + public void updateLockIncorrect(MberManageVO mberManageVO) throws Exception; + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/umt/service/EgovUserManageService.java b/src/main/java/egovframework/com/uss/umt/service/EgovUserManageService.java new file mode 100644 index 0000000..33ff66c --- /dev/null +++ b/src/main/java/egovframework/com/uss/umt/service/EgovUserManageService.java @@ -0,0 +1,109 @@ +package egovframework.com.uss.umt.service; +import java.util.List; + +/** + * 사용자관리에 관한 인터페이스클래스를 정의한다. + * @author 공통서비스 개발팀 조재영 + * @since 2009.04.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.10  조재영          최초 생성
    + *   2017.07.21  장동한 			로그인인증제한 작업
    + *
    + * 
    + */ +public interface EgovUserManageService { + + /** + * 입력한 사용자아이디의 중복여부를 체크하여 사용가능여부를 확인 + * @param checkId 중복여부 확인대상 아이디 + * @return 사용가능여부(아이디 사용회수 int) + * @throws Exception + */ + public int checkIdDplct(String checkId) throws Exception; + + /** + * 화면에 조회된 사용자의 정보를 데이터베이스에서 삭제 + * @param checkedIdForDel 삭제대상 업무사용자아이디 + * @throws Exception + */ + public void deleteUser(String checkedIdForDel) throws Exception; + + /** + * @param userManageVO 업무사용자 등록정보 + * @return result 등록결과 + * @throws Exception + */ + public String insertUser(UserManageVO userManageVO) throws Exception; + + /** + * 기 등록된 사용자 중 검색조건에 맞는 사용자의 정보를 데이터베이스에서 읽어와 화면에 출력 + * @param emplyrId 상세조회대상 업무사용자 아이디 + * @return userManageVO 업무사용자 상세정보 + * @throws Exception + */ + public UserManageVO selectUser(String emplyrId) throws Exception; + + /** + * 기 등록된 특정 사용자의 정보를 데이터베이스에서 읽어와 화면에 출력 + * @param userSearchVO 검색조건 + * @return List 업무사용자 목록정보 + * @throws Exception + */ + public List selectUserList(UserDefaultVO userSearchVO) throws Exception; + + /** + * 기 등록된 특정 사용자목록의 전체수를 확인 + * @param userSearchVO 검색조건 + * @return 총사용자갯수(int) + * @throws Exception + */ + public int selectUserListTotCnt(UserDefaultVO userSearchVO) throws Exception; + + /** + * 화면에 조회된 사용자의 기본정보를 수정하여 항목의 정합성을 체크하고 수정된 데이터를 데이터베이스에 반영 + * @param userManageVO 업무사용자 수정정보 + * @throws Exception + */ + public void updateUser(UserManageVO userManageVO) throws Exception; + + /** + * 사용자정보 수정시 히스토리 정보를 추가 + * @param userManageVO 업무사용자 수정정보 + * @return result 등록결과 + * @throws Exception + */ + public String insertUserHistory(UserManageVO userManageVO) throws Exception; + + /** + * 업무사용자 암호 수정 + * @param userManageVO 업무사용자 수정정보(비밀번호) + * @throws Exception + */ + public void updatePassword(UserManageVO userManageVO) throws Exception; + + /** + * 사용자가 비밀번호를 기억하지 못할 때 비밀번호를 찾을 수 있도록 함 + * @param passVO 업무사용자 암호 조회조건정보 + * @return userManageVO 업무사용자 암호정보 + * @throws Exception + */ + public UserManageVO selectPassword(UserManageVO passVO) throws Exception; + + + /** + * 로그인인증제한 해제 + * @param userManageVO 업무사용자 수정정보 + * @return void + * @throws Exception + */ + public void updateLockIncorrect(UserManageVO userManageVO) throws Exception; + + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/umt/service/EntrprsManageVO.java b/src/main/java/egovframework/com/uss/umt/service/EntrprsManageVO.java new file mode 100644 index 0000000..4b0059c --- /dev/null +++ b/src/main/java/egovframework/com/uss/umt/service/EntrprsManageVO.java @@ -0,0 +1,498 @@ +package egovframework.com.uss.umt.service; + +/** + * 기업회원VO클래스로서 기업회원관리 비지니스로직 처리용 항목을 구성한다. + * @author 공통서비스 개발팀 조재영 + * @since 2009.04.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.10  조재영          최초 생성
    + *   2017.07.21  장동한 			로그인인증제한 작업
    + *
    + * 
    + */ +public class EntrprsManageVO extends UserDefaultVO{ + + private static final long serialVersionUID = -6532736688851136256L; + + /** 이전비밀번호 - 비밀번호 변경시 사용*/ + private String oldPassword = ""; + + /** + * 사용자고유아이디 + */ + private String uniqId=""; + /** + * 사용자 유형 + */ + private String userTy; + /** + * 주소 + */ + private String adres; + /** + * 상세주소 + */ + private String detailAdres; + /** + * 신청자 주민등록번호 + */ + private String applcntIhidnum; + /** + * 신청자 명 + */ + private String applcntNm; + /** + * 사업자번호 + */ + private String bizrno; + /** + * 회사명 + */ + private String cmpnyNm; + /** + * 대표이사 + */ + private String cxfc; + /** + * 기업 회원 ID + */ + private String entrprsmberId; + /** + * 기업 회원 비밀번호 + */ + private String entrprsMberPassword; + /** + * 기업 회원 비밀번호 정답 + */ + private String entrprsMberPasswordCnsr; + /** + * 기업 회원 비밀번호 힌트 + */ + private String entrprsMberPasswordHint; + /** + * 기업 회원 상태 + */ + private String entrprsMberSttus; + /** + * 기업구분코드 + */ + private String entrprsSeCode; + /** + * 팩스번호 + */ + private String fxnum; + /** + * 그룹 ID + */ + private String groupId; + /** + * 업종코드 + */ + private String indutyCode; + /** + * 법인등록번호 + */ + private String jurirno; + /** + * 지역번호 + */ + private String areaNo; + /** + * 회사끝전화번호 + */ + private String entrprsEndTelno; + /** + * 회사중간전화번호 + */ + private String entrprsMiddleTelno; + /** + * 가입 일자 + */ + private String sbscrbDe; + /** + * 우편번호 + */ + private String zip; + /** + * 신청자 이메일주소 + */ + private String applcntEmailAdres; + + private String lockAt; + public String getLockAt() {return lockAt;} + public void setLockAt(String lockAt) {this.lockAt = lockAt;} + + /** + * oldPassword attribute 값을 리턴한다. + * @return String + */ + public String getOldPassword() { + return oldPassword; + } + /** + * oldPassword attribute 값을 설정한다. + * @param oldPassword String + */ + public void setOldPassword(String oldPassword) { + this.oldPassword = oldPassword; + } + /** + * uniqId attribute 값을 리턴한다. + * @return String + */ + public String getUniqId() { + return uniqId; + } + /** + * uniqId attribute 값을 설정한다. + * @param uniqId String + */ + public void setUniqId(String uniqId) { + this.uniqId = uniqId; + } + /** + * userTy attribute 값을 리턴한다. + * @return String + */ + public String getUserTy() { + return userTy; + } + /** + * userTy attribute 값을 설정한다. + * @param userTy String + */ + public void setUserTy(String userTy) { + this.userTy = userTy; + } + /** + * adres attribute 값을 리턴한다. + * @return String + */ + public String getAdres() { + return adres; + } + /** + * adres attribute 값을 설정한다. + * @param adres String + */ + public void setAdres(String adres) { + this.adres = adres; + } + /** + * detailAdres attribute 값을 리턴한다. + * @return String + */ + public String getDetailAdres() { + return detailAdres; + } + /** + * detailAdres attribute 값을 설정한다. + * @param detailAdres String + */ + public void setDetailAdres(String detailAdres) { + this.detailAdres = detailAdres; + } + /** + * applcntIhidnum attribute 값을 리턴한다. + * @return String + */ + public String getApplcntIhidnum() { + return applcntIhidnum; + } + /** + * applcntIhidnum attribute 값을 설정한다. + * @param applcntIhidnum String + */ + public void setApplcntIhidnum(String applcntIhidnum) { + this.applcntIhidnum = applcntIhidnum; + } + /** + * applcntNm attribute 값을 리턴한다. + * @return String + */ + public String getApplcntNm() { + return applcntNm; + } + /** + * applcntNm attribute 값을 설정한다. + * @param applcntNm String + */ + public void setApplcntNm(String applcntNm) { + this.applcntNm = applcntNm; + } + /** + * bizrno attribute 값을 리턴한다. + * @return String + */ + public String getBizrno() { + return bizrno; + } + /** + * bizrno attribute 값을 설정한다. + * @param bizrno String + */ + public void setBizrno(String bizrno) { + this.bizrno = bizrno; + } + /** + * cmpnyNm attribute 값을 리턴한다. + * @return String + */ + public String getCmpnyNm() { + return cmpnyNm; + } + /** + * cmpnyNm attribute 값을 설정한다. + * @param cmpnyNm String + */ + public void setCmpnyNm(String cmpnyNm) { + this.cmpnyNm = cmpnyNm; + } + /** + * cxfc attribute 값을 리턴한다. + * @return String + */ + public String getCxfc() { + return cxfc; + } + /** + * cxfc attribute 값을 설정한다. + * @param cxfc String + */ + public void setCxfc(String cxfc) { + this.cxfc = cxfc; + } + /** + * entrprsmberId attribute 값을 리턴한다. + * @return String + */ + public String getEntrprsmberId() { + return entrprsmberId; + } + /** + * entrprsmberId attribute 값을 설정한다. + * @param entrprsmberId String + */ + public void setEntrprsmberId(String entrprsmberId) { + this.entrprsmberId = entrprsmberId; + } + /** + * entrprsMberPassword attribute 값을 리턴한다. + * @return String + */ + public String getEntrprsMberPassword() { + return entrprsMberPassword; + } + /** + * entrprsMberPassword attribute 값을 설정한다. + * @param entrprsMberPassword String + */ + public void setEntrprsMberPassword(String entrprsMberPassword) { + this.entrprsMberPassword = entrprsMberPassword; + } + /** + * entrprsMberPasswordCnsr attribute 값을 리턴한다. + * @return String + */ + public String getEntrprsMberPasswordCnsr() { + return entrprsMberPasswordCnsr; + } + /** + * entrprsMberPasswordCnsr attribute 값을 설정한다. + * @param entrprsMberPasswordCnsr String + */ + public void setEntrprsMberPasswordCnsr(String entrprsMberPasswordCnsr) { + this.entrprsMberPasswordCnsr = entrprsMberPasswordCnsr; + } + /** + * entrprsMberPasswordHint attribute 값을 리턴한다. + * @return String + */ + public String getEntrprsMberPasswordHint() { + return entrprsMberPasswordHint; + } + /** + * entrprsMberPasswordHint attribute 값을 설정한다. + * @param entrprsMberPasswordHint String + */ + public void setEntrprsMberPasswordHint(String entrprsMberPasswordHint) { + this.entrprsMberPasswordHint = entrprsMberPasswordHint; + } + /** + * entrprsMberSttus attribute 값을 리턴한다. + * @return String + */ + public String getEntrprsMberSttus() { + return entrprsMberSttus; + } + /** + * entrprsMberSttus attribute 값을 설정한다. + * @param entrprsMberSttus String + */ + public void setEntrprsMberSttus(String entrprsMberSttus) { + this.entrprsMberSttus = entrprsMberSttus; + } + /** + * entrprsSeCode attribute 값을 리턴한다. + * @return String + */ + public String getEntrprsSeCode() { + return entrprsSeCode; + } + /** + * entrprsSeCode attribute 값을 설정한다. + * @param entrprsSeCode String + */ + public void setEntrprsSeCode(String entrprsSeCode) { + this.entrprsSeCode = entrprsSeCode; + } + /** + * fxnum attribute 값을 리턴한다. + * @return String + */ + public String getFxnum() { + return fxnum; + } + /** + * fxnum attribute 값을 설정한다. + * @param fxnum String + */ + public void setFxnum(String fxnum) { + this.fxnum = fxnum; + } + /** + * groupId attribute 값을 리턴한다. + * @return String + */ + public String getGroupId() { + return groupId; + } + /** + * groupId attribute 값을 설정한다. + * @param groupId String + */ + public void setGroupId(String groupId) { + this.groupId = groupId; + } + /** + * indutyCode attribute 값을 리턴한다. + * @return String + */ + public String getIndutyCode() { + return indutyCode; + } + /** + * indutyCode attribute 값을 설정한다. + * @param indutyCode String + */ + public void setIndutyCode(String indutyCode) { + this.indutyCode = indutyCode; + } + /** + * jurirno attribute 값을 리턴한다. + * @return String + */ + public String getJurirno() { + return jurirno; + } + /** + * jurirno attribute 값을 설정한다. + * @param jurirno String + */ + public void setJurirno(String jurirno) { + this.jurirno = jurirno; + } + /** + * areaNo attribute 값을 리턴한다. + * @return String + */ + public String getAreaNo() { + return areaNo; + } + /** + * areaNo attribute 값을 설정한다. + * @param areaNo String + */ + public void setAreaNo(String areaNo) { + this.areaNo = areaNo; + } + /** + * entrprsEndTelno attribute 값을 리턴한다. + * @return String + */ + public String getEntrprsEndTelno() { + return entrprsEndTelno; + } + /** + * entrprsEndTelno attribute 값을 설정한다. + * @param entrprsEndTelno String + */ + public void setEntrprsEndTelno(String entrprsEndTelno) { + this.entrprsEndTelno = entrprsEndTelno; + } + /** + * entrprsMiddleTelno attribute 값을 리턴한다. + * @return String + */ + public String getEntrprsMiddleTelno() { + return entrprsMiddleTelno; + } + /** + * entrprsMiddleTelno attribute 값을 설정한다. + * @param entrprsMiddleTelno String + */ + public void setEntrprsMiddleTelno(String entrprsMiddleTelno) { + this.entrprsMiddleTelno = entrprsMiddleTelno; + } + /** + * sbscrbDe attribute 값을 리턴한다. + * @return String + */ + public String getSbscrbDe() { + return sbscrbDe; + } + /** + * sbscrbDe attribute 값을 설정한다. + * @param sbscrbDe String + */ + public void setSbscrbDe(String sbscrbDe) { + this.sbscrbDe = sbscrbDe; + } + /** + * zip attribute 값을 리턴한다. + * @return String + */ + public String getZip() { + return zip; + } + /** + * zip attribute 값을 설정한다. + * @param zip String + */ + public void setZip(String zip) { + this.zip = zip; + } + /** + * applcntEmailAdres attribute 값을 리턴한다. + * @return String + */ + public String getApplcntEmailAdres() { + return applcntEmailAdres; + } + /** + * applcntEmailAdres attribute 값을 설정한다. + * @param applcntEmailAdres String + */ + public void setApplcntEmailAdres(String applcntEmailAdres) { + this.applcntEmailAdres = applcntEmailAdres; + } + + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/umt/service/MberManageVO.java b/src/main/java/egovframework/com/uss/umt/service/MberManageVO.java new file mode 100644 index 0000000..4e529d8 --- /dev/null +++ b/src/main/java/egovframework/com/uss/umt/service/MberManageVO.java @@ -0,0 +1,425 @@ +package egovframework.com.uss.umt.service; + +/** + * 일반회원VO클래스로서 일반회원관리 비지니스로직 처리용 항목을 구성한다. + * @author 공통서비스 개발팀 조재영 + * @since 2009.04.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.10  조재영          최초 생성
    + *   2017.07.21  장동한 			로그인인증제한 작업
    + *
    + * 
    + */ +public class MberManageVO extends UserDefaultVO{ + + private static final long serialVersionUID = -4255594107023139972L; + + /** 이전비밀번호 - 비밀번호 변경시 사용*/ + private String oldPassword = ""; + + /** + * 사용자고유아이디 + */ + private String uniqId=""; + /** + * 사용자 유형 + */ + private String userTy; + /** + * 주소 + */ + private String adres; + /** + * 상세주소 + */ + private String detailAdres; + /** + * 끝전화번호 + */ + private String endTelno; + /** + * 팩스번호 + */ + private String mberFxnum; + /** + * 그룹 ID + */ + private String groupId; + /** + * 주민등록번호 + */ + private String ihidnum; + /** + * 성별코드 + */ + private String sexdstnCode; + /** + * 회원 ID + */ + private String mberId; + /** + * 회원명 + */ + private String mberNm; + /** + * 회원상태 + */ + private String mberSttus; + /** + * 지역번호 + */ + private String areaNo; + /** + * 중간전화번호 + */ + private String middleTelno; + /** + * 핸드폰번호 + */ + private String moblphonNo; + /** + * 비밀번호 + */ + private String password; + /** + * 비밀번호 정답 + */ + private String passwordCnsr; + /** + * 비밀번호 힌트 + */ + private String passwordHint; + /** + * 가입 일자 + */ + private String sbscrbDe; + /** + * 우편번호 + */ + private String zip; + /** + * 이메일주소 + */ + private String mberEmailAdres; + + private String lockAt; + public String getLockAt() {return lockAt;} + public void setLockAt(String lockAt) {this.lockAt = lockAt;} + + /** + * oldPassword attribute 값을 리턴한다. + * @return String + */ + public String getOldPassword() { + return oldPassword; + } + /** + * oldPassword attribute 값을 설정한다. + * @param oldPassword String + */ + public void setOldPassword(String oldPassword) { + this.oldPassword = oldPassword; + } + /** + * uniqId attribute 값을 리턴한다. + * @return String + */ + public String getUniqId() { + return uniqId; + } + /** + * uniqId attribute 값을 설정한다. + * @param uniqId String + */ + public void setUniqId(String uniqId) { + this.uniqId = uniqId; + } + /** + * userTy attribute 값을 리턴한다. + * @return String + */ + public String getUserTy() { + return userTy; + } + /** + * userTy attribute 값을 설정한다. + * @param userTy String + */ + public void setUserTy(String userTy) { + this.userTy = userTy; + } + /** + * adres attribute 값을 리턴한다. + * @return String + */ + public String getAdres() { + return adres; + } + /** + * adres attribute 값을 설정한다. + * @param adres String + */ + public void setAdres(String adres) { + this.adres = adres; + } + /** + * detailAdres attribute 값을 리턴한다. + * @return String + */ + public String getDetailAdres() { + return detailAdres; + } + /** + * detailAdres attribute 값을 설정한다. + * @param detailAdres String + */ + public void setDetailAdres(String detailAdres) { + this.detailAdres = detailAdres; + } + /** + * endTelno attribute 값을 리턴한다. + * @return String + */ + public String getEndTelno() { + return endTelno; + } + /** + * endTelno attribute 값을 설정한다. + * @param endTelno String + */ + public void setEndTelno(String endTelno) { + this.endTelno = endTelno; + } + /** + * mberFxnum attribute 값을 리턴한다. + * @return String + */ + public String getMberFxnum() { + return mberFxnum; + } + /** + * mberFxnum attribute 값을 설정한다. + * @param mberFxnum String + */ + public void setMberFxnum(String mberFxnum) { + this.mberFxnum = mberFxnum; + } + /** + * groupId attribute 값을 리턴한다. + * @return String + */ + public String getGroupId() { + return groupId; + } + /** + * groupId attribute 값을 설정한다. + * @param groupId String + */ + public void setGroupId(String groupId) { + this.groupId = groupId; + } + /** + * ihidnum attribute 값을 리턴한다. + * @return String + */ + public String getIhidnum() { + return ihidnum; + } + /** + * ihidnum attribute 값을 설정한다. + * @param ihidnum String + */ + public void setIhidnum(String ihidnum) { + this.ihidnum = ihidnum; + } + /** + * sexdstnCode attribute 값을 리턴한다. + * @return String + */ + public String getSexdstnCode() { + return sexdstnCode; + } + /** + * sexdstnCode attribute 값을 설정한다. + * @param sexdstnCode String + */ + public void setSexdstnCode(String sexdstnCode) { + this.sexdstnCode = sexdstnCode; + } + /** + * mberId attribute 값을 리턴한다. + * @return String + */ + public String getMberId() { + return mberId; + } + /** + * mberId attribute 값을 설정한다. + * @param mberId String + */ + public void setMberId(String mberId) { + this.mberId = mberId; + } + /** + * mberNm attribute 값을 리턴한다. + * @return String + */ + public String getMberNm() { + return mberNm; + } + /** + * mberNm attribute 값을 설정한다. + * @param mberNm String + */ + public void setMberNm(String mberNm) { + this.mberNm = mberNm; + } + /** + * mberSttus attribute 값을 리턴한다. + * @return String + */ + public String getMberSttus() { + return mberSttus; + } + /** + * mberSttus attribute 값을 설정한다. + * @param mberSttus String + */ + public void setMberSttus(String mberSttus) { + this.mberSttus = mberSttus; + } + /** + * areaNo attribute 값을 리턴한다. + * @return String + */ + public String getAreaNo() { + return areaNo; + } + /** + * areaNo attribute 값을 설정한다. + * @param areaNo String + */ + public void setAreaNo(String areaNo) { + this.areaNo = areaNo; + } + /** + * middleTelno attribute 값을 리턴한다. + * @return String + */ + public String getMiddleTelno() { + return middleTelno; + } + /** + * middleTelno attribute 값을 설정한다. + * @param middleTelno String + */ + public void setMiddleTelno(String middleTelno) { + this.middleTelno = middleTelno; + } + /** + * moblphonNo attribute 값을 리턴한다. + * @return String + */ + public String getMoblphonNo() { + return moblphonNo; + } + /** + * moblphonNo attribute 값을 설정한다. + * @param moblphonNo String + */ + public void setMoblphonNo(String moblphonNo) { + this.moblphonNo = moblphonNo; + } + /** + * password attribute 값을 리턴한다. + * @return String + */ + public String getPassword() { + return password; + } + /** + * password attribute 값을 설정한다. + * @param password String + */ + public void setPassword(String password) { + this.password = password; + } + /** + * passwordCnsr attribute 값을 리턴한다. + * @return String + */ + public String getPasswordCnsr() { + return passwordCnsr; + } + /** + * passwordCnsr attribute 값을 설정한다. + * @param passwordCnsr String + */ + public void setPasswordCnsr(String passwordCnsr) { + this.passwordCnsr = passwordCnsr; + } + /** + * passwordHint attribute 값을 리턴한다. + * @return String + */ + public String getPasswordHint() { + return passwordHint; + } + /** + * passwordHint attribute 값을 설정한다. + * @param passwordHint String + */ + public void setPasswordHint(String passwordHint) { + this.passwordHint = passwordHint; + } + /** + * sbscrbDe attribute 값을 리턴한다. + * @return String + */ + public String getSbscrbDe() { + return sbscrbDe; + } + /** + * sbscrbDe attribute 값을 설정한다. + * @param sbscrbDe String + */ + public void setSbscrbDe(String sbscrbDe) { + this.sbscrbDe = sbscrbDe; + } + /** + * zip attribute 값을 리턴한다. + * @return String + */ + public String getZip() { + return zip; + } + /** + * zip attribute 값을 설정한다. + * @param zip String + */ + public void setZip(String zip) { + this.zip = zip; + } + /** + * mberEmailAdres attribute 값을 리턴한다. + * @return String + */ + public String getMberEmailAdres() { + return mberEmailAdres; + } + /** + * mberEmailAdres attribute 값을 설정한다. + * @param mberEmailAdres String + */ + public void setMberEmailAdres(String mberEmailAdres) { + this.mberEmailAdres = mberEmailAdres; + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/umt/service/StplatVO.java b/src/main/java/egovframework/com/uss/umt/service/StplatVO.java new file mode 100644 index 0000000..bde6532 --- /dev/null +++ b/src/main/java/egovframework/com/uss/umt/service/StplatVO.java @@ -0,0 +1,82 @@ +package egovframework.com.uss.umt.service; + +import java.io.Serializable; + +/** + * 가입약관VO클래스로서가입약관확인시 비지니스로직 처리용 항목을 구성한다. + * @author 공통서비스 개발팀 조재영 + * @since 2009.04.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.10  조재영          최초 생성
    + *
    + * 
    + */ +public class StplatVO implements Serializable { + + private static final long serialVersionUID = 3744005602026645L; + + /** 약관아이디*/ + private String useStplatId; + + /** 사용약관안내*/ + private String useStplatCn; + + /** 정보동의안내*/ + private String infoProvdAgeCn; + + /** + * useStplatId attribute 값을 리턴한다. + * @return String + */ + public String getUseStplatId() { + return useStplatId; + } + + /** + * useStplatId attribute 값을 설정한다. + * @param useStplatId String + */ + public void setUseStplatId(String useStplatId) { + this.useStplatId = useStplatId; + } + + /** + * useStplatCn attribute 값을 리턴한다. + * @return String + */ + public String getUseStplatCn() { + return useStplatCn; + } + + /** + * useStplatCn attribute 값을 설정한다. + * @param useStplatCn String + */ + public void setUseStplatCn(String useStplatCn) { + this.useStplatCn = useStplatCn; + } + + /** + * infoProvdAgeCn attribute 값을 리턴한다. + * @return String + */ + public String getInfoProvdAgeCn() { + return infoProvdAgeCn; + } + + /** + * infoProvdAgeCn attribute 값을 설정한다. + * @param infoProvdAgeCn String + */ + public void setInfoProvdAgeCn(String infoProvdAgeCn) { + this.infoProvdAgeCn = infoProvdAgeCn; + } + +} diff --git a/src/main/java/egovframework/com/uss/umt/service/UserDefaultVO.java b/src/main/java/egovframework/com/uss/umt/service/UserDefaultVO.java new file mode 100644 index 0000000..d505ee9 --- /dev/null +++ b/src/main/java/egovframework/com/uss/umt/service/UserDefaultVO.java @@ -0,0 +1,217 @@ +package egovframework.com.uss.umt.service; + +import java.io.Serializable; + +/** + * 사용자정보 VO클래스로서일반회원, 기업회원, 업무사용자의 비지니스로직 처리시 기타조건성 항을 구성한다. + * @author 공통서비스 개발팀 조재영 + * @since 2009.04.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.10  조재영          최초 생성
    + *
    + * 
    + */ +public class UserDefaultVO implements Serializable { + + private static final long serialVersionUID = 4829684178121022508L; + + /** 검색조건-회원상태 (0, A, D, P)*/ + private String sbscrbSttus = "0"; + + /** 검색조건 */ + private String searchCondition = ""; + + /** 검색Keyword */ + private String searchKeyword = ""; + + /** 검색사용여부 */ + private String searchUseYn = ""; + + /** 현재페이지 */ + private int pageIndex = 1; + + /** 페이지갯수 */ + private int pageUnit = 10; + + /** 페이지사이즈 */ + private int pageSize = 10; + + /** firstIndex */ + private int firstIndex = 1; + + /** lastIndex */ + private int lastIndex = 1; + + /** recordCountPerPage */ + private int recordCountPerPage = 10; + + /** + * sbscrbSttus attribute 값을 리턴한다. + * @return String + */ + public String getSbscrbSttus() { + return sbscrbSttus; + } + + /** + * sbscrbSttus attribute 값을 설정한다. + * @param sbscrbSttus String + */ + public void setSbscrbSttus(String sbscrbSttus) { + this.sbscrbSttus = sbscrbSttus; + } + + /** + * searchCondition attribute 값을 리턴한다. + * @return String + */ + public String getSearchCondition() { + return searchCondition; + } + + /** + * searchCondition attribute 값을 설정한다. + * @param searchCondition String + */ + public void setSearchCondition(String searchCondition) { + this.searchCondition = searchCondition; + } + + /** + * searchKeyword attribute 값을 리턴한다. + * @return String + */ + public String getSearchKeyword() { + return searchKeyword; + } + + /** + * searchKeyword attribute 값을 설정한다. + * @param searchKeyword String + */ + public void setSearchKeyword(String searchKeyword) { + this.searchKeyword = searchKeyword; + } + + /** + * searchUseYn attribute 값을 리턴한다. + * @return String + */ + public String getSearchUseYn() { + return searchUseYn; + } + + /** + * searchUseYn attribute 값을 설정한다. + * @param searchUseYn String + */ + public void setSearchUseYn(String searchUseYn) { + this.searchUseYn = searchUseYn; + } + + /** + * pageIndex attribute 값을 리턴한다. + * @return int + */ + public int getPageIndex() { + return pageIndex; + } + + /** + * pageIndex attribute 값을 설정한다. + * @param pageIndex int + */ + public void setPageIndex(int pageIndex) { + this.pageIndex = pageIndex; + } + + /** + * pageUnit attribute 값을 리턴한다. + * @return int + */ + public int getPageUnit() { + return pageUnit; + } + + /** + * pageUnit attribute 값을 설정한다. + * @param pageUnit int + */ + public void setPageUnit(int pageUnit) { + this.pageUnit = pageUnit; + } + + /** + * pageSize attribute 값을 리턴한다. + * @return int + */ + public int getPageSize() { + return pageSize; + } + + /** + * pageSize attribute 값을 설정한다. + * @param pageSize int + */ + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + /** + * firstIndex attribute 값을 리턴한다. + * @return int + */ + public int getFirstIndex() { + return firstIndex; + } + + /** + * firstIndex attribute 값을 설정한다. + * @param firstIndex int + */ + public void setFirstIndex(int firstIndex) { + this.firstIndex = firstIndex; + } + + /** + * lastIndex attribute 값을 리턴한다. + * @return int + */ + public int getLastIndex() { + return lastIndex; + } + + /** + * lastIndex attribute 값을 설정한다. + * @param lastIndex int + */ + public void setLastIndex(int lastIndex) { + this.lastIndex = lastIndex; + } + + /** + * recordCountPerPage attribute 값을 리턴한다. + * @return int + */ + public int getRecordCountPerPage() { + return recordCountPerPage; + } + + /** + * recordCountPerPage attribute 값을 설정한다. + * @param recordCountPerPage int + */ + public void setRecordCountPerPage(int recordCountPerPage) { + this.recordCountPerPage = recordCountPerPage; + } + + + +} diff --git a/src/main/java/egovframework/com/uss/umt/service/UserManageVO.java b/src/main/java/egovframework/com/uss/umt/service/UserManageVO.java new file mode 100644 index 0000000..a6a6a8f --- /dev/null +++ b/src/main/java/egovframework/com/uss/umt/service/UserManageVO.java @@ -0,0 +1,605 @@ +package egovframework.com.uss.umt.service; + +/** + * 업무사용자VO클래스로서 업무사용자관리 비지니스로직 처리용 항목을 구성한다. + * @author 공통서비스 개발팀 조재영 + * @since 2009.04.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.10  조재영          최초 생성
    + *   2017.07.21  장동한 			로그인인증제한 작업
    + *
    + * 
    + */ +public class UserManageVO extends UserDefaultVO{ + + private static final long serialVersionUID = 3640820362821490939L; + + /** 이전비밀번호 - 비밀번호 변경시 사용*/ + private String oldPassword = ""; + + /** + * 가입일 + */ + private String sbscrbDe; + /** + * 사용자고유아이디 + */ + private String uniqId=""; + /** + * 사용자 유형 + */ + private String userTy; + /** + * 지역번호 + */ + private String areaNo; + /** + * 생일 + */ + private String brth; + /** + * 상세주소 + */ + private String detailAdres; + /** + * 이메일주소 + */ + private String emailAdres; + /** + * 사원번호 + */ + private String emplNo; + /** + * 사용자 ID + */ + private String emplyrId; + /** + * 사용자 명 + */ + private String emplyrNm; + /** + * 사용자 상태 + */ + private String emplyrSttusCode; + /** + * 팩스번호 + */ + private String fxnum; + /** + * 그룹 ID + */ + private String groupId; + /** + * 집 주소 + */ + private String homeadres; + /** + * 집끝전화번호 + */ + private String homeendTelno; + /** + * 집중간전화번호 + */ + private String homemiddleTelno; + /** + * 주민등록번호 + */ + private String ihidnum; + /** + * 소속기관코드 + */ + private String insttCode; + /** + * 검색조건 회원타입 + */ + private String mberTy; + /** + * 핸드폰번호 + */ + private String moblphonNo; + /** + * 직위명 + */ + private String ofcpsNm; + /** + * 사무실전화번호 + */ + private String offmTelno; + /** + * 조직 ID + */ + private String orgnztId; + /** + * 비밀번호 + */ + private String password; + /** + * 비밀번호 정답 + */ + private String passwordCnsr; + /** + * 비밀번호 힌트 + */ + private String passwordHint; + /** + * 검색조건 가입일자 시작일 + */ + private String sbscrbDeBegin; + /** + * 검색조건 가입일자 종료일 + */ + private String sbscrbDeEnd; + /** + * 성별코드 + */ + private String sexdstnCode; + /** + * 우편번호 + */ + private String zip; + /** + * DN 값 + */ + private String subDn; + + private String lockAt; + public String getLockAt() {return lockAt;} + public void setLockAt(String lockAt) {this.lockAt = lockAt;} + + /** + * oldPassword attribute 값을 리턴한다. + * @return String + */ + public String getOldPassword() { + return oldPassword; + } + /** + * oldPassword attribute 값을 설정한다. + * @param oldPassword String + */ + public void setOldPassword(String oldPassword) { + this.oldPassword = oldPassword; + } + /** + * sbscrbDe attribute 값을 리턴한다. + * @return String + */ + public String getSbscrbDe() { + return sbscrbDe; + } + /** + * sbscrbDe attribute 값을 설정한다. + * @param sbscrbDe String + */ + public void setSbscrbDe(String sbscrbDe) { + this.sbscrbDe = sbscrbDe; + } + /** + * uniqId attribute 값을 리턴한다. + * @return String + */ + public String getUniqId() { + return uniqId; + } + /** + * uniqId attribute 값을 설정한다. + * @param uniqId String + */ + public void setUniqId(String uniqId) { + this.uniqId = uniqId; + } + /** + * userTy attribute 값을 리턴한다. + * @return String + */ + public String getUserTy() { + return userTy; + } + /** + * userTy attribute 값을 설정한다. + * @param userTy String + */ + public void setUserTy(String userTy) { + this.userTy = userTy; + } + /** + * areaNo attribute 값을 리턴한다. + * @return String + */ + public String getAreaNo() { + return areaNo; + } + /** + * areaNo attribute 값을 설정한다. + * @param areaNo String + */ + public void setAreaNo(String areaNo) { + this.areaNo = areaNo; + } + /** + * brth attribute 값을 리턴한다. + * @return String + */ + public String getBrth() { + return brth; + } + /** + * brth attribute 값을 설정한다. + * @param brth String + */ + public void setBrth(String brth) { + this.brth = brth; + } + /** + * detailAdres attribute 값을 리턴한다. + * @return String + */ + public String getDetailAdres() { + return detailAdres; + } + /** + * detailAdres attribute 값을 설정한다. + * @param detailAdres String + */ + public void setDetailAdres(String detailAdres) { + this.detailAdres = detailAdres; + } + /** + * emailAdres attribute 값을 리턴한다. + * @return String + */ + public String getEmailAdres() { + return emailAdres; + } + /** + * emailAdres attribute 값을 설정한다. + * @param emailAdres String + */ + public void setEmailAdres(String emailAdres) { + this.emailAdres = emailAdres; + } + /** + * emplNo attribute 값을 리턴한다. + * @return String + */ + public String getEmplNo() { + return emplNo; + } + /** + * emplNo attribute 값을 설정한다. + * @param emplNo String + */ + public void setEmplNo(String emplNo) { + this.emplNo = emplNo; + } + /** + * emplyrId attribute 값을 리턴한다. + * @return String + */ + public String getEmplyrId() { + return emplyrId; + } + /** + * emplyrId attribute 값을 설정한다. + * @param emplyrId String + */ + public void setEmplyrId(String emplyrId) { + this.emplyrId = emplyrId; + } + /** + * emplyrNm attribute 값을 리턴한다. + * @return String + */ + public String getEmplyrNm() { + return emplyrNm; + } + /** + * emplyrNm attribute 값을 설정한다. + * @param emplyrNm String + */ + public void setEmplyrNm(String emplyrNm) { + this.emplyrNm = emplyrNm; + } + /** + * emplyrSttusCode attribute 값을 리턴한다. + * @return String + */ + public String getEmplyrSttusCode() { + return emplyrSttusCode; + } + /** + * emplyrSttusCode attribute 값을 설정한다. + * @param emplyrSttusCode String + */ + public void setEmplyrSttusCode(String emplyrSttusCode) { + this.emplyrSttusCode = emplyrSttusCode; + } + /** + * fxnum attribute 값을 리턴한다. + * @return String + */ + public String getFxnum() { + return fxnum; + } + /** + * fxnum attribute 값을 설정한다. + * @param fxnum String + */ + public void setFxnum(String fxnum) { + this.fxnum = fxnum; + } + /** + * groupId attribute 값을 리턴한다. + * @return String + */ + public String getGroupId() { + return groupId; + } + /** + * groupId attribute 값을 설정한다. + * @param groupId String + */ + public void setGroupId(String groupId) { + this.groupId = groupId; + } + /** + * homeadres attribute 값을 리턴한다. + * @return String + */ + public String getHomeadres() { + return homeadres; + } + /** + * homeadres attribute 값을 설정한다. + * @param homeadres String + */ + public void setHomeadres(String homeadres) { + this.homeadres = homeadres; + } + /** + * homeendTelno attribute 값을 리턴한다. + * @return String + */ + public String getHomeendTelno() { + return homeendTelno; + } + /** + * homeendTelno attribute 값을 설정한다. + * @param homeendTelno String + */ + public void setHomeendTelno(String homeendTelno) { + this.homeendTelno = homeendTelno; + } + /** + * homemiddleTelno attribute 값을 리턴한다. + * @return String + */ + public String getHomemiddleTelno() { + return homemiddleTelno; + } + /** + * homemiddleTelno attribute 값을 설정한다. + * @param homemiddleTelno String + */ + public void setHomemiddleTelno(String homemiddleTelno) { + this.homemiddleTelno = homemiddleTelno; + } + /** + * ihidnum attribute 값을 리턴한다. + * @return String + */ + public String getIhidnum() { + return ihidnum; + } + /** + * ihidnum attribute 값을 설정한다. + * @param ihidnum String + */ + public void setIhidnum(String ihidnum) { + this.ihidnum = ihidnum; + } + /** + * insttCode attribute 값을 리턴한다. + * @return String + */ + public String getInsttCode() { + return insttCode; + } + /** + * insttCode attribute 값을 설정한다. + * @param insttCode String + */ + public void setInsttCode(String insttCode) { + this.insttCode = insttCode; + } + /** + * mberTy attribute 값을 리턴한다. + * @return String + */ + public String getMberTy() { + return mberTy; + } + /** + * mberTy attribute 값을 설정한다. + * @param mberTy String + */ + public void setMberTy(String mberTy) { + this.mberTy = mberTy; + } + /** + * moblphonNo attribute 값을 리턴한다. + * @return String + */ + public String getMoblphonNo() { + return moblphonNo; + } + /** + * moblphonNo attribute 값을 설정한다. + * @param moblphonNo String + */ + public void setMoblphonNo(String moblphonNo) { + this.moblphonNo = moblphonNo; + } + /** + * ofcpsNm attribute 값을 리턴한다. + * @return String + */ + public String getOfcpsNm() { + return ofcpsNm; + } + /** + * ofcpsNm attribute 값을 설정한다. + * @param ofcpsNm String + */ + public void setOfcpsNm(String ofcpsNm) { + this.ofcpsNm = ofcpsNm; + } + /** + * offmTelno attribute 값을 리턴한다. + * @return String + */ + public String getOffmTelno() { + return offmTelno; + } + /** + * offmTelno attribute 값을 설정한다. + * @param offmTelno String + */ + public void setOffmTelno(String offmTelno) { + this.offmTelno = offmTelno; + } + /** + * orgnztId attribute 값을 리턴한다. + * @return String + */ + public String getOrgnztId() { + return orgnztId; + } + /** + * orgnztId attribute 값을 설정한다. + * @param orgnztId String + */ + public void setOrgnztId(String orgnztId) { + this.orgnztId = orgnztId; + } + /** + * password attribute 값을 리턴한다. + * @return String + */ + public String getPassword() { + return password; + } + /** + * password attribute 값을 설정한다. + * @param password String + */ + public void setPassword(String password) { + this.password = password; + } + /** + * passwordCnsr attribute 값을 리턴한다. + * @return String + */ + public String getPasswordCnsr() { + return passwordCnsr; + } + /** + * passwordCnsr attribute 값을 설정한다. + * @param passwordCnsr String + */ + public void setPasswordCnsr(String passwordCnsr) { + this.passwordCnsr = passwordCnsr; + } + /** + * passwordHint attribute 값을 리턴한다. + * @return String + */ + public String getPasswordHint() { + return passwordHint; + } + /** + * passwordHint attribute 값을 설정한다. + * @param passwordHint String + */ + public void setPasswordHint(String passwordHint) { + this.passwordHint = passwordHint; + } + /** + * sbscrbDeBegin attribute 값을 리턴한다. + * @return String + */ + public String getSbscrbDeBegin() { + return sbscrbDeBegin; + } + /** + * sbscrbDeBegin attribute 값을 설정한다. + * @param sbscrbDeBegin String + */ + public void setSbscrbDeBegin(String sbscrbDeBegin) { + this.sbscrbDeBegin = sbscrbDeBegin; + } + /** + * sbscrbDeEnd attribute 값을 리턴한다. + * @return String + */ + public String getSbscrbDeEnd() { + return sbscrbDeEnd; + } + /** + * sbscrbDeEnd attribute 값을 설정한다. + * @param sbscrbDeEnd String + */ + public void setSbscrbDeEnd(String sbscrbDeEnd) { + this.sbscrbDeEnd = sbscrbDeEnd; + } + /** + * sexdstnCode attribute 값을 리턴한다. + * @return String + */ + public String getSexdstnCode() { + return sexdstnCode; + } + /** + * sexdstnCode attribute 값을 설정한다. + * @param sexdstnCode String + */ + public void setSexdstnCode(String sexdstnCode) { + this.sexdstnCode = sexdstnCode; + } + /** + * zip attribute 값을 리턴한다. + * @return String + */ + public String getZip() { + return zip; + } + /** + * zip attribute 값을 설정한다. + * @param zip String + */ + public void setZip(String zip) { + this.zip = zip; + } + /** + * subDn attribute 값을 리턴한다. + * @return String + */ + public String getSubDn() { + return subDn; + } + /** + * subDn attribute 값을 설정한다. + * @param subDn String + */ + public void setSubDn(String subDn) { + this.subDn = subDn; + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/umt/service/impl/DeptManageDAO.java b/src/main/java/egovframework/com/uss/umt/service/impl/DeptManageDAO.java new file mode 100644 index 0000000..397ea62 --- /dev/null +++ b/src/main/java/egovframework/com/uss/umt/service/impl/DeptManageDAO.java @@ -0,0 +1,70 @@ +package egovframework.com.uss.umt.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.umt.service.DeptManageVO; + +import org.springframework.stereotype.Repository; + +@Repository("deptManageDAO") +public class DeptManageDAO extends EgovComAbstractDAO { + + /** + * 부서를 관리하기 위해 등록된 부서목록을 조회한다. + * @param deptManageVO - 부서 Vo + * @return List - 부서 목록 + * @exception Exception + */ + public List selectDeptManageList(DeptManageVO deptManageVO) throws Exception { + return selectList("deptManageDAO.selectDeptManageList", deptManageVO); + } + + /** + * 부서목록 총 갯수를 조회한다. + * @param deptManageVO - 부서 Vo + * @return int - 부서 카운트 수 + * @exception Exception + */ + public int selectDeptManageListTotCnt(DeptManageVO deptManageVO) throws Exception { + return (Integer)selectOne("deptManageDAO.selectDeptManageListTotCnt", deptManageVO); + } + + /** + * 등록된 부서의 상세정보를 조회한다. + * @param deptManageVO - 부서 Vo + * @return deptManageVO - 부서 Vo + * + * @param bannerVO + */ + public DeptManageVO selectDeptManage(DeptManageVO deptManageVO) throws Exception { + return (DeptManageVO) selectOne("deptManageDAO.selectDeptManage", deptManageVO); + } + + /** + * 부서정보를 신규로 등록한다. + * @param deptManageVO - 부서 model + */ + public void insertDeptManage(DeptManageVO deptManageVO) throws Exception { + insert("deptManageDAO.insertDeptManage", deptManageVO); + } + + /** + * 기 등록된 부서정보를 수정한다. + * @param deptManageVO - 부서 model + */ + public void updateDeptManage(DeptManageVO deptManageVO) throws Exception { + update("deptManageDAO.updateDeptManage", deptManageVO); + } + + /** + * 기 등록된 부서정보를 삭제한다. + * @param deptManageVO - 부서 model + * + * @param banner + */ + public void deleteDeptManage(DeptManageVO deptManageVO) throws Exception { + delete("deptManageDAO.deleteDeptManage", deptManageVO); + } + +} diff --git a/src/main/java/egovframework/com/uss/umt/service/impl/EgovDeptManageServiceImpl.java b/src/main/java/egovframework/com/uss/umt/service/impl/EgovDeptManageServiceImpl.java new file mode 100644 index 0000000..aa7ec30 --- /dev/null +++ b/src/main/java/egovframework/com/uss/umt/service/impl/EgovDeptManageServiceImpl.java @@ -0,0 +1,82 @@ +package egovframework.com.uss.umt.service.impl; + +import java.util.List; + +import egovframework.com.uss.umt.service.DeptManageVO; +import egovframework.com.uss.umt.service.EgovDeptManageService; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +@Service("egovDeptManageService") +public class EgovDeptManageServiceImpl extends EgovAbstractServiceImpl implements EgovDeptManageService { + + @Resource(name="deptManageDAO") + private DeptManageDAO deptManageDAO; + + /** + * 부서를 관리하기 위해 등록된 부서목록을 조회한다. + * @param deptManageVO - 부서 Vo + * @return List - 부서 목록 + * + * @param deptManageVO + */ + public List selectDeptManageList(DeptManageVO deptManageVO) throws Exception { + return deptManageDAO.selectDeptManageList(deptManageVO); + } + + /** + * 부서목록 총 갯수를 조회한다. + * @param deptManageVO - 부서 Vo + * @return int - 부서 카운트 수 + * + * @param deptManageVO + */ + public int selectDeptManageListTotCnt(DeptManageVO deptManageVO) throws Exception { + return deptManageDAO.selectDeptManageListTotCnt(deptManageVO); + } + + /** + * 등록된 부서의 상세정보를 조회한다. + * @param deptManageVO - 부서 Vo + * @return deptManageVO - 부서 Vo + * + * @param deptManageVO + */ + public DeptManageVO selectDeptManage(DeptManageVO deptManageVO) throws Exception { + return deptManageDAO.selectDeptManage(deptManageVO); + } + + /** + * 부서정보를 신규로 등록한다. + * @param deptManageVO - 부서 model + * + * @param deptManageVO + */ + public void insertDeptManage(DeptManageVO deptManageVO) throws Exception { + deptManageDAO.insertDeptManage(deptManageVO); + } + + /** + * 기 등록된 부서정보를 수정한다. + * @param deptManageVO - 부서 model + * + * @param deptManageVO + */ + public void updateDeptManage(DeptManageVO deptManageVO) throws Exception { + deptManageDAO.updateDeptManage(deptManageVO); + } + + /** + * 기 등록된 부서정보를 삭제한다. + * @param deptManageVO - 부서 model + * + * @param deptManageVO + */ + public void deleteDeptManage(DeptManageVO deptManageVO) throws Exception { + deptManageDAO.deleteDeptManage(deptManageVO); + } +} diff --git a/src/main/java/egovframework/com/uss/umt/service/impl/EgovEntrprsManageServiceImpl.java b/src/main/java/egovframework/com/uss/umt/service/impl/EgovEntrprsManageServiceImpl.java new file mode 100644 index 0000000..18654dd --- /dev/null +++ b/src/main/java/egovframework/com/uss/umt/service/impl/EgovEntrprsManageServiceImpl.java @@ -0,0 +1,192 @@ +package egovframework.com.uss.umt.service.impl; + +import java.util.List; + +import egovframework.com.uss.umt.service.EgovEntrprsManageService; +import egovframework.com.uss.umt.service.EntrprsManageVO; +import egovframework.com.uss.umt.service.UserDefaultVO; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import egovframework.com.utl.sim.service.EgovFileScrty; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +/** + * 기업회원관리에 관한 비지니스클래스를 정의한다. + * @author 공통서비스 개발팀 조재영 + * @since 2009.04.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.10  조재영          최초 생성
    + *   2014.12.08	 이기하			암호화방식 변경(EgovFileScrty.encryptPassword)
    + *   2017.07.21  장동한 			로그인인증제한 작업
    + *
    + * 
    + */ +@Service("entrprsManageService") +public class EgovEntrprsManageServiceImpl extends EgovAbstractServiceImpl implements EgovEntrprsManageService { + + /** userManageDAO */ + @Resource(name="userManageDAO") + private UserManageDAO userManageDAO; + + /** mberManageDAO */ + @Resource(name="mberManageDAO") + private MberManageDAO mberManageDAO; + + /** entrprsManageDAO */ + @Resource(name="entrprsManageDAO") + private EntrprsManageDAO entrprsManageDAO; + + /** egovUsrCnfrmIdGnrService */ + @Resource(name="egovUsrCnfrmIdGnrService") + private EgovIdGnrService idgenService; + + /** + * 기업회원의 기본정보를 화면에서 입력하여 항목의 정합성을 체크하고 데이터베이스에 저장 + * @param entrprsManageVO 기업회원등록정보 + * @return result 등록결과 + * @throws Exception + */ + @Override + public String insertEntrprsmber(EntrprsManageVO entrprsManageVO) throws Exception { + //고유아이디 셋팅 + String uniqId = idgenService.getNextStringId(); + entrprsManageVO.setUniqId(uniqId); + //패스워드 암호화 + String pass = EgovFileScrty.encryptPassword(entrprsManageVO.getEntrprsMberPassword(), EgovStringUtil.isNullToString(entrprsManageVO.getEntrprsmberId()));//KISA 보안약점 조치 (2018-10-29, 윤창원) + entrprsManageVO.setEntrprsMberPassword(pass); + + String result = entrprsManageDAO.insertEntrprsmber(entrprsManageVO); + return result; + } + + /** + * 기 등록된 사용자 중 검색조건에 맞는기업회원의 정보를 데이터베이스에서 읽어와 화면에 출력 + * @param uniqId 조회대상 기업회원아이디 + * @return entrprsManageVO 기업회원정보 + * @throws Exception + */ + @Override + public EntrprsManageVO selectEntrprsmber(String uniqId) { + EntrprsManageVO entrprsManageVO = entrprsManageDAO.selectEntrprsmber(uniqId); + return entrprsManageVO; + } + + /** + * 화면에 조회된 기업회원의 기본정보를 수정하여 항목의 정합성을 체크하고 수정된 데이터를 데이터베이스에 반영 + * @param entrprsManageVO 기업회원수정정보 + * @throws Exception + */ + @Override + public void updateEntrprsmber(EntrprsManageVO entrprsManageVO) throws Exception { + //패스워드 암호화 + String pass = EgovFileScrty.encryptPassword(entrprsManageVO.getEntrprsMberPassword(), EgovStringUtil.isNullToString(entrprsManageVO.getEntrprsmberId()));//KISA 보안약점 조치 (2018-10-29, 윤창원) + entrprsManageVO.setEntrprsMberPassword(pass); + entrprsManageDAO.updateEntrprsmber(entrprsManageVO); + } + + /** + * 화면에 조회된 기업회원의 정보를 데이터베이스에서 삭제 + * @param checkedIdForDel 삭제대상기업회원아이디 + * @throws Exception + */ + @Override + public void deleteEntrprsmber(String checkedIdForDel) { + //log.debug("jjyser_delete-->"+checkedIdForDel); + String [] delId = checkedIdForDel.split(","); + for (int i=0; i selectStplat(String stplatId) { + List stplatList = entrprsManageDAO.selectStplat(stplatId); + return stplatList; + } + + /** + * 기업회원 암호 수정 + * @param passVO 기업회원수정정보(비밀번호) + * @throws Exception + */ + @Override + public void updatePassword(EntrprsManageVO passVO) { + entrprsManageDAO.updatePassword(passVO); + } + + /** + * 기업회원이 비밀번호를 기억하지 못할 때 비밀번호를 찾을 수 있도록 함 + * @param passVO 기업회원암호 조회조건정보 + * @return entrprsManageVO 기업회원암호정보 + * @throws Exception + */ + @Override + public EntrprsManageVO selectPassword(EntrprsManageVO passVO) { + EntrprsManageVO entrprsManageVO = entrprsManageDAO.selectPassword(passVO); + return entrprsManageVO; + } + + /** + * 기 등록된기업 회원 중 검색조건에 맞는 회원들의 정보를 데이터베이스에서 읽어와 화면에 출력 + * @param userSearchVO 검색조건 + * @return List 기업회원목록정보 + * @throws Exception + */ + @Override + public List selectEntrprsMberList(UserDefaultVO userSearchVO) { + return entrprsManageDAO.selectEntrprsMberList(userSearchVO); + } + + /** + * 기업회원 총 갯수를 조회한다. + * @param userSearchVO 검색조건 + * @return 사용자 총 갯수(int) + * @throws Exception + */ + @Override + public int selectEntrprsMberListTotCnt(UserDefaultVO userSearchVO) { + return entrprsManageDAO.selectEntrprsMberListTotCnt(userSearchVO); + } + + /** + * 로그인인증제한 해제 + * @param entrprsManageVO 기업회원정보 + * @return void + * @throws Exception + */ + @Override + public void updateLockIncorrect(EntrprsManageVO entrprsManageVO) throws Exception { + entrprsManageDAO.updateLockIncorrect(entrprsManageVO); + } + + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/umt/service/impl/EgovMberManageServiceImpl.java b/src/main/java/egovframework/com/uss/umt/service/impl/EgovMberManageServiceImpl.java new file mode 100644 index 0000000..4724199 --- /dev/null +++ b/src/main/java/egovframework/com/uss/umt/service/impl/EgovMberManageServiceImpl.java @@ -0,0 +1,187 @@ +package egovframework.com.uss.umt.service.impl; + +import java.util.List; + +import egovframework.com.uss.umt.service.EgovMberManageService; +import egovframework.com.uss.umt.service.MberManageVO; +import egovframework.com.uss.umt.service.UserDefaultVO; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import egovframework.com.utl.sim.service.EgovFileScrty; + +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +/** + * 일반회원관리에 관한비지니스클래스를 정의한다. + * @author 공통서비스 개발팀 조재영 + * @since 2009.04.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.10  조재영          최초 생성
    + *   2014.12.08	 이기하			암호화방식 변경(EgovFileScrty.encryptPassword)
    + *   2017.07.21  장동한 			로그인인증제한 작업
    + *
    + * 
    + */ +@Service("mberManageService") +public class EgovMberManageServiceImpl extends EgovAbstractServiceImpl implements EgovMberManageService { + + /** userManageDAO */ + @Resource(name="userManageDAO") + private UserManageDAO userManageDAO; + + /** mberManageDAO */ + @Resource(name="mberManageDAO") + private MberManageDAO mberManageDAO; + + /** entrprsManageDAO */ + @Resource(name="entrprsManageDAO") + private EntrprsManageDAO entrprsManageDAO; + + /** egovUsrCnfrmIdGnrService */ + @Resource(name="egovUsrCnfrmIdGnrService") + private EgovIdGnrService idgenService; + + /** + * 사용자의 기본정보를 화면에서 입력하여 항목의 정합성을 체크하고 데이터베이스에 저장 + * @param mberManageVO 일반회원 등록정보 + * @return result 등록결과 + * @throws Exception + */ + @Override + public String insertMber(MberManageVO mberManageVO) throws Exception { + //고유아이디 셋팅 + String uniqId = idgenService.getNextStringId(); + mberManageVO.setUniqId(uniqId); + //패스워드 암호화 + String pass = EgovFileScrty.encryptPassword(mberManageVO.getPassword(), EgovStringUtil.isNullToString(mberManageVO.getMberId()));//KISA 보안약점 조치 (2018-10-29, 윤창원) + mberManageVO.setPassword(pass); + + String result = mberManageDAO.insertMber(mberManageVO); + return result; + } + + /** + * 기 등록된 사용자 중 검색조건에 맞는 일반회원의 정보를 데이터베이스에서 읽어와 화면에 출력 + * @param uniqId 상세조회대상 일반회원아이디 + * @return mberManageVO 일반회원상세정보 + * @throws Exception + */ + @Override + public MberManageVO selectMber(String uniqId) { + MberManageVO mberManageVO = mberManageDAO.selectMber(uniqId); + return mberManageVO; + } + + /** + * 기 등록된 회원 중 검색조건에 맞는 회원들의 정보를 데이터베이스에서 읽어와 화면에 출력 + * @param userSearchVO 검색조건 + * @return List 일반회원목록정보 + */ + @Override + public List selectMberList(UserDefaultVO userSearchVO) { + return mberManageDAO.selectMberList(userSearchVO); + } + + /** + * 일반회원 총 갯수를 조회한다. + * @param userSearchVO 검색조건 + * @return 일반회원총갯수(int) + */ + @Override + public int selectMberListTotCnt(UserDefaultVO userSearchVO) { + return mberManageDAO.selectMberListTotCnt(userSearchVO); + } + + /** + * 화면에 조회된 일반회원의 기본정보를 수정하여 항목의 정합성을 체크하고 수정된 데이터를 데이터베이스에 반영 + * @param mberManageVO 일반회원수정정보 + * @throws Exception + */ + @Override + public void updateMber(MberManageVO mberManageVO) throws Exception { + //패스워드 암호화 + String pass = EgovFileScrty.encryptPassword(mberManageVO.getPassword(), EgovStringUtil.isNullToString(mberManageVO.getMberId()));//KISA 보안약점 조치 (2018-10-29, 윤창원) + mberManageVO.setPassword(pass); + mberManageDAO.updateMber(mberManageVO); + } + + /** + * 화면에 조회된 사용자의 정보를 데이터베이스에서 삭제 + * @param checkedIdForDel 삭제대상 일반회원아이디 + * @throws Exception + */ + @Override + public void deleteMber(String checkedIdForDel) { + String [] delId = checkedIdForDel.split(","); + for (int i=0; i selectStplat(String stplatId) { + return mberManageDAO.selectStplat(stplatId); + } + + /** + * 일반회원암호수정 + * @param mberManageVO 일반회원수정정보(비밀번호) + * @throws Exception + */ + @Override + public void updatePassword(MberManageVO mberManageVO) { + mberManageDAO.updatePassword(mberManageVO); + } + + /** + * 일반회원이 비밀번호를 기억하지 못할 때 비밀번호를 찾을 수 있도록 함 + * @param passVO 일반회원암호 조회조건정보 + * @return mberManageVO 일반회원암호정보 + * @throws Exception + */ + @Override + public MberManageVO selectPassword(MberManageVO passVO) { + MberManageVO mberManageVO = mberManageDAO.selectPassword(passVO); + return mberManageVO; + } + + + /** + * 로그인인증제한 해제 + * @param mberManageVO 일반회원정보 + * @return void + * @throws Exception + */ + @Override + public void updateLockIncorrect(MberManageVO mberManageVO) throws Exception { + mberManageDAO.updateLockIncorrect(mberManageVO); + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/umt/service/impl/EgovUserManageServiceImpl.java b/src/main/java/egovframework/com/uss/umt/service/impl/EgovUserManageServiceImpl.java new file mode 100644 index 0000000..0dfa63a --- /dev/null +++ b/src/main/java/egovframework/com/uss/umt/service/impl/EgovUserManageServiceImpl.java @@ -0,0 +1,202 @@ +package egovframework.com.uss.umt.service.impl; + +import java.util.List; + +import egovframework.com.uss.umt.service.EgovUserManageService; +import egovframework.com.uss.umt.service.UserDefaultVO; +import egovframework.com.uss.umt.service.UserManageVO; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import egovframework.com.utl.sim.service.EgovFileScrty; +import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +/** + * 사용자관리에 관한 비지니스 클래스를 정의한다. + * @author 공통서비스 개발팀 조재영 + * @since 2009.04.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.10  조재영          최초 생성
    + *   2014.12.08	 이기하			암호화방식 변경(EgovFileScrty.encryptPassword)
    + *   2017.07.21  장동한 			로그인인증제한 작업
    + *
    + * 
    + */ +@Service("userManageService") +public class EgovUserManageServiceImpl extends EgovAbstractServiceImpl implements EgovUserManageService { + + /** userManageDAO */ + @Resource(name="userManageDAO") + private UserManageDAO userManageDAO; + + /** mberManageDAO */ + @Resource(name="mberManageDAO") + private MberManageDAO mberManageDAO; + + /** entrprsManageDAO */ + @Resource(name="entrprsManageDAO") + private EntrprsManageDAO entrprsManageDAO; + + /** egovUsrCnfrmIdGnrService */ + @Resource(name="egovUsrCnfrmIdGnrService") + private EgovIdGnrService idgenService; + + /** + * 입력한 사용자아이디의 중복여부를 체크하여 사용가능여부를 확인 + * @param checkId 중복여부 확인대상 아이디 + * @return 사용가능여부(아이디 사용회수 int) + * @throws Exception + */ + @Override + public int checkIdDplct(String checkId) { + return userManageDAO.checkIdDplct(checkId); + } + + /** + * 화면에 조회된 사용자의 정보를 데이터베이스에서 삭제 + * @param checkedIdForDel 삭제대상 업무사용자아이디 + * @throws Exception + */ + @Override + public void deleteUser(String checkedIdForDel) { + //KISA 보안약점 조치 (2018-10-29, 윤창원) + String [] delId = EgovStringUtil.isNullToString(checkedIdForDel).split(","); + for (int i=0; i 업무사용자 목록정보 + * @throws Exception + */ + @Override + public List selectUserList(UserDefaultVO userSearchVO) { + List result = userManageDAO.selectUserList(userSearchVO); + return result; + } + + /** + * 기 등록된 특정 사용자목록의 전체수를 확인 + * @param userSearchVO 검색조건 + * @return 총사용자갯수(int) + * @throws Exception + */ + @Override + public int selectUserListTotCnt(UserDefaultVO userSearchVO) { + return userManageDAO.selectUserListTotCnt(userSearchVO); + } + + /** + * 화면에 조회된 사용자의 기본정보를 수정하여 항목의 정합성을 체크하고 수정된 데이터를 데이터베이스에 반영 + * @param userManageVO 업무사용자 수정정보 + * @throws Exception + */ + @Override + public void updateUser(UserManageVO userManageVO) throws Exception { + //패스워드 암호화 + String pass = EgovFileScrty.encryptPassword(userManageVO.getPassword(), EgovStringUtil.isNullToString(userManageVO.getEmplyrId()));//KISA 보안약점 조치 (2018-10-29, 윤창원) + userManageVO.setPassword(pass); + + userManageDAO.updateUser(userManageVO); + } + + /** + * 사용자정보 수정시 히스토리 정보를 추가 + * @param userManageVO 업무사용자 수정정보 + * @return result 등록결과 + * @throws Exception + */ + @Override + public String insertUserHistory(UserManageVO userManageVO) { + return userManageDAO.insertUserHistory(userManageVO); + } + + /** + * 업무사용자 암호 수정 + * @param userManageVO 업무사용자 수정정보(비밀번호) + * @throws Exception + */ + @Override + public void updatePassword(UserManageVO userManageVO) { + userManageDAO.updatePassword(userManageVO); + } + + /** + * 사용자가 비밀번호를 기억하지 못할 때 비밀번호를 찾을 수 있도록 함 + * @param passVO 업무사용자 암호 조회조건정보 + * @return userManageVO 업무사용자 암호정보 + * @throws Exception + */ + @Override + public UserManageVO selectPassword(UserManageVO passVO) { + UserManageVO userManageVO = userManageDAO.selectPassword(passVO); + return userManageVO; + } + + + /** + * 로그인인증제한 해제 + * @param userManageVO 업무사용자 수정정보 + * @return void + * @throws Exception + */ + @Override + public void updateLockIncorrect(UserManageVO userManageVO) throws Exception { + userManageDAO.updateLockIncorrect(userManageVO); + } + + + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/umt/service/impl/EntrprsManageDAO.java b/src/main/java/egovframework/com/uss/umt/service/impl/EntrprsManageDAO.java new file mode 100644 index 0000000..4cacf3c --- /dev/null +++ b/src/main/java/egovframework/com/uss/umt/service/impl/EntrprsManageDAO.java @@ -0,0 +1,117 @@ +package egovframework.com.uss.umt.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.umt.service.EntrprsManageVO; +import egovframework.com.uss.umt.service.UserDefaultVO; + +import org.springframework.stereotype.Repository; + +/** + * 기업회원관리에 관한 데이터 접근 클래스를 정의한다. + * @author 공통서비스 개발팀 조재영 + * @since 2009.04.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.10  조재영          최초 생성
    + *   2017.07.21  장동한 			로그인인증제한 작업
    + *
    + * 
    + */ +@Repository("entrprsManageDAO") +public class EntrprsManageDAO extends EgovComAbstractDAO{ + + /** + * 화면에 조회된 기업회원의 정보를 데이터베이스에서 삭제 + * @param delId + */ + public void deleteEntrprsmber(String delId){ + delete("entrprsManageDAO.deleteEntrprs_S", delId); + } + + /** + * 기업회원의 기본정보를 화면에서 입력하여 항목의 정합성을 체크하고 데이터베이스에 저장 + * @param entrprsManageVO 기업회원 등록정보 + * @return String 등록결과 + */ + public String insertEntrprsmber(EntrprsManageVO entrprsManageVO){ + return String.valueOf((int)insert("entrprsManageDAO.insertEntrprs_S", entrprsManageVO)); + } + + /** + * 기 등록된 사용자 중 검색조건에 맞는 기업회원의 정보를 데이터베이스에서 읽어와 화면에 출력 + * @param entrprsmberId 상세조회대상 기업회원아이디 + * @return EntrprsManageVO 기업회원 상세정보 + */ + public EntrprsManageVO selectEntrprsmber(String entrprsmberId){ + return (EntrprsManageVO) selectOne("entrprsManageDAO.selectEntrprs_S", entrprsmberId); + } + + /** + * 화면에 조회된 사용자의 기본정보를 수정하여 항목의 정합성을 체크하고 수정된 데이터를 데이터베이스에 반영 + * @param entrprsManageVO 기업회원 수정정보 + */ + public void updateEntrprsmber(EntrprsManageVO entrprsManageVO){ + update("entrprsManageDAO.updateEntrprs_S",entrprsManageVO); + } + + /** + * 약관정보를 조회 + * @param stplatId 기업회원 약관아이디 + * @return List 기업회원약관정보 + */ + public List selectStplat(String stplatId) { + return list("entrprsManageDAO.selectStplat_S", stplatId); + } + + /** + * 기업회원 암호수정 + * @param passVO 기업회원수정정보(비밀번호) + */ + public void updatePassword(EntrprsManageVO passVO) { + update("entrprsManageDAO.updatePassword_S", passVO); + } + + /** + * 기업회원이 비밀번호를 기억하지 못할 때 비밀번호를 찾을 수 있도록 함 + * @param entrprsManageVO 기업회원암호 조회조건정보 + * @return EntrprsManageVO 기업회원암호정보 + */ + public EntrprsManageVO selectPassword(EntrprsManageVO entrprsManageVO){ + return (EntrprsManageVO) selectOne("entrprsManageDAO.selectPassword_S", entrprsManageVO); + } + + /** + * 기 등록된 특정 기업회원의 정보를 데이터베이스에서 읽어와 화면에 출력 + * @param userSearchVO 검색조건 + * @return List + */ + @SuppressWarnings("unchecked") + public List selectEntrprsMberList(UserDefaultVO userSearchVO){ + return (List) list("entrprsManageDAO.selectEntrprsMberList", userSearchVO); + } + /** + * 기업회원 총 갯수를 조회한다. + * @param userSearchVO 검색조건 + * @return int 기업회원총갯수 + */ + public int selectEntrprsMberListTotCnt(UserDefaultVO userSearchVO) { + return (Integer)selectOne("entrprsManageDAO.selectEntrprsMberListTotCnt", userSearchVO); + } + + + /** + * 로그인인증제한 해제 + * @param entrprsManageVO 기업회원정보 + */ + public void updateLockIncorrect(EntrprsManageVO entrprsManageVO) { + update("entrprsManageDAO.updateLockIncorrect", entrprsManageVO); + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/umt/service/impl/MberManageDAO.java b/src/main/java/egovframework/com/uss/umt/service/impl/MberManageDAO.java new file mode 100644 index 0000000..1a1be3c --- /dev/null +++ b/src/main/java/egovframework/com/uss/umt/service/impl/MberManageDAO.java @@ -0,0 +1,119 @@ +package egovframework.com.uss.umt.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.umt.service.MberManageVO; +import egovframework.com.uss.umt.service.UserDefaultVO; + +import org.springframework.stereotype.Repository; + +/** + * 일반회원관리에 관한 데이터 접근 클래스를 정의한다. + * @author 공통서비스 개발팀 조재영 + * @since 2009.04.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.10  조재영          최초 생성
    + *   2017.07.21  장동한 			로그인인증제한 작업
    + *
    + * 
    + */ +@Repository("mberManageDAO") +public class MberManageDAO extends EgovComAbstractDAO{ + + /** + * 기 등록된 특정 일반회원의 정보를 데이터베이스에서 읽어와 화면에 출력 + * @param userSearchVO 검색조건 + * @return List 기업회원 목록정보 + */ + @SuppressWarnings("unchecked") + public List selectMberList(UserDefaultVO userSearchVO){ + return (List) list("mberManageDAO.selectMberList", userSearchVO); + } + + /** + * 일반회원 총 갯수를 조회한다. + * @param userSearchVO 검색조건 + * @return int 일반회원총갯수 + */ + public int selectMberListTotCnt(UserDefaultVO userSearchVO) { + return (Integer)selectOne("mberManageDAO.selectMberListTotCnt", userSearchVO); + } + + /** + * 화면에 조회된 일반회원의 정보를 데이터베이스에서 삭제 + * @param delId 삭제 대상 일반회원아이디 + */ + public void deleteMber(String delId){ + delete("mberManageDAO.deleteMber_S", delId); + } + + /** + * 일반회원의 기본정보를 화면에서 입력하여 항목의 정합성을 체크하고 데이터베이스에 저장 + * @param mberManageVO 일반회원 등록정보 + * @return String 등록결과 + */ + public String insertMber(MberManageVO mberManageVO){ + return String.valueOf((int)insert("mberManageDAO.insertMber_S", mberManageVO)); + } + + /** + * 기 등록된 사용자 중 검색조건에 맞는일반회원의 정보를 데이터베이스에서 읽어와 화면에 출력 + * @param mberId 상세조회대상 일반회원아이디 + * @return MberManageVO 일반회원 상세정보 + */ + public MberManageVO selectMber(String mberId){ + return (MberManageVO) selectOne("mberManageDAO.selectMber_S", mberId); + } + + /** + * 화면에 조회된일반회원의 기본정보를 수정하여 항목의 정합성을 체크하고 수정된 데이터를 데이터베이스에 반영 + * @param mberManageVO 일반회원수정정보 + */ + public void updateMber(MberManageVO mberManageVO){ + update("mberManageDAO.updateMber_S",mberManageVO); + } + + /** + * 일반회원 약관확인 + * @param stplatId 일반회원약관아이디 + * @return List 일반회원약관정보 + */ + public List selectStplat(String stplatId){ + return list("mberManageDAO.selectStplat_S", stplatId); + } + + /** + * 일반회원 암호수정 + * @param passVO 기업회원수정정보(비밀번호) + */ + public void updatePassword(MberManageVO passVO) { + update("mberManageDAO.updatePassword_S", passVO); + } + + /** + * 일반회원이 비밀번호를 기억하지 못할 때 비밀번호를 찾을 수 있도록 함 + * @param mberManageVO 일반회원암호 조회조건정보 + * @return MberManageVO 일반회원 암호정보 + */ + public MberManageVO selectPassword(MberManageVO mberManageVO){ + return (MberManageVO) selectOne("mberManageDAO.selectPassword_S", mberManageVO); + } + + + /** + * 로그인인증제한 해제 + * @param mberManageVO 일반회원정보 + */ + public void updateLockIncorrect(MberManageVO mberManageVO) { + update("mberManageDAO.updateLockIncorrect", mberManageVO); + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/umt/service/impl/UserManageDAO.java b/src/main/java/egovframework/com/uss/umt/service/impl/UserManageDAO.java new file mode 100644 index 0000000..6a8c04d --- /dev/null +++ b/src/main/java/egovframework/com/uss/umt/service/impl/UserManageDAO.java @@ -0,0 +1,128 @@ +package egovframework.com.uss.umt.service.impl; + +import java.util.List; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import egovframework.com.uss.umt.service.UserDefaultVO; +import egovframework.com.uss.umt.service.UserManageVO; + +import org.springframework.stereotype.Repository; + +/** + * 사용자관리에 관한 데이터 접근 클래스를 정의한다. + * @author 공통서비스 개발팀 조재영 + * @since 2009.04.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.10  조재영          최초 생성
    + *   2017.07.21  장동한 			로그인인증제한 작업
    + *
    + * 
    + */ +@Repository("userManageDAO") +public class UserManageDAO extends EgovComAbstractDAO{ + + /** + * 입력한 사용자아이디의 중복여부를 체크하여 사용가능여부를 확인 + * @param checkId 중복체크대상 아이디 + * @return int 사용가능여부(아이디 사용회수 ) + */ + public int checkIdDplct(String checkId){ + return (Integer)selectOne("userManageDAO.checkIdDplct_S", checkId); + } + + /** + * 화면에 조회된 사용자의 정보를 데이터베이스에서 삭제 + * @param delId 삭제대상 업무사용자 아이디 + */ + public void deleteUser(String delId){ + delete("userManageDAO.deleteUser_S", delId); + } + + + /** + * 사용자의 기본정보를 화면에서 입력하여 항목의 정합성을 체크하고 데이터베이스에 저장 + * @param userManageVO 업무사용자 등록정보 + * @return String result 등록결과 + */ + public String insertUser(UserManageVO userManageVO){ + return String.valueOf((int)insert("userManageDAO.insertUser_S", userManageVO)); + } + + /** + * 기 등록된 사용자 중 검색조건에 맞는 사용자들의 정보를 데이터베이스에서 읽어와 화면에 출력 + * @param uniqId 상세조회대상 업무사용자아이디 + * @return UserManageVO 업무사용자 상세정보 + */ + public UserManageVO selectUser(String uniqId){ + return (UserManageVO) selectOne("userManageDAO.selectUser_S", uniqId); + } + + /** + * 기 등록된 특정 사용자의 정보를 데이터베이스에서 읽어와 화면에 출력 + * @param userSearchVO 검색조건 + * @return List 업무사용자 목록정보 + */ + public List selectUserList(UserDefaultVO userSearchVO){ + return list("userManageDAO.selectUserList_S", userSearchVO); + } + + /** + * 사용자총 갯수를 조회한다. + * @param userSearchVO 검색조건 + * @return int 업무사용자 총갯수 + */ + public int selectUserListTotCnt(UserDefaultVO userSearchVO) { + return (Integer)selectOne("userManageDAO.selectUserListTotCnt_S", userSearchVO); + } + + /** + * 화면에 조회된 사용자의 기본정보를 수정하여 항목의 정합성을 체크하고 수정된 데이터를 데이터베이스에 반영 + * @param userManageVO 업무사용자 수정정보 + */ + public void updateUser(UserManageVO userManageVO){ + update("userManageDAO.updateUser_S",userManageVO); + } + + /** + * 사용자정보 수정시 히스토리 정보를 추가 + * @param userManageVO 업무사용자 히스토리 정보 + * @return String 히스토리 등록결과 + */ + public String insertUserHistory(UserManageVO userManageVO){ + return String.valueOf((int)insert("userManageDAO.insertUserHistory_S", userManageVO)); + } + + /** + * 업무사용자 암호수정 + * @param passVO 업무사용자수정정보(비밀번호) + */ + public void updatePassword(UserManageVO passVO) { + update("userManageDAO.updatePassword_S", passVO); + } + + /** + * 업무사용자가 비밀번호를 기억하지 못할 때 비밀번호를 찾을 수 있도록 함 + * @param userManageVO 업무 사용자암호 조회조건정보 + * @return UserManageVO 업무사용자 암호정보 + */ + public UserManageVO selectPassword(UserManageVO userManageVO){ + return (UserManageVO) selectOne("userManageDAO.selectPassword_S", userManageVO); + } + + + /** + * 로그인인증제한 해제 + * @param passVO 업무사용자 + */ + public void updateLockIncorrect(UserManageVO userManageVO) { + update("userManageDAO.updateLockIncorrect", userManageVO); + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/umt/web/EgovDeptManageController.java b/src/main/java/egovframework/com/uss/umt/web/EgovDeptManageController.java new file mode 100644 index 0000000..ec34b4e --- /dev/null +++ b/src/main/java/egovframework/com/uss/umt/web/EgovDeptManageController.java @@ -0,0 +1,206 @@ +package egovframework.com.uss.umt.web; + +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.umt.service.DeptManageVO; +import egovframework.com.uss.umt.service.EgovDeptManageService; + +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +import javax.annotation.Resource; + +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; + +/** + * 부서관련 처리를 비지니스 클래스로 전달하고 처리된결과를 해당 웹 화면으로 전달하는 Controller를 정의한다 + * @author 공통서비스 개발팀 조재영 + * @since 2009.00.00 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.02.01  lee.m.j     최초 생성
    + *   2015.06.16  조정국      서비스 화면 접근시 조회결과를 표시하도록 수정
    + *   2021.05.30  정진오      로그인인증제한
    + * 
    + */ + +@Controller +public class EgovDeptManageController { + + @Resource(name = "egovMessageSource") + EgovMessageSource egovMessageSource; + + @Resource(name = "egovDeptManageService") + private EgovDeptManageService egovDeptManageService; + + /** Message ID Generation */ + @Resource(name = "egovDeptManageIdGnrService") + private EgovIdGnrService egovDeptManageIdGnrService; + + @Autowired + private DefaultBeanValidator beanValidator; + + /** + * 부서 목록화면 이동 + * @return String + * @exception Exception + */ + @IncludedInfo(name = "부서관리", order = 461, gid = 50) + @RequestMapping("/uss/umt/dpt/selectDeptManageListView.do") + public String selectDeptManageListView() throws Exception { + + // 2021.05.30, 정진오, 로그인인증제한 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "index"; + } + + return "forward:/uss/umt/dpt/selectDeptManageList.do"; + } + + /** + * 부서를 관리하기 위해 등록된 부서목록을 조회한다. + * @param bannerVO - 배너 VO + * @return String - 리턴 URL + * @throws Exception + */ + + @RequestMapping(value = "/uss/umt/dpt/selectDeptManageList.do") + public String selectDeptManageList(@ModelAttribute("deptManageVO") DeptManageVO deptManageVO, ModelMap model) throws Exception { + + /** 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()); + + model.addAttribute("deptManageList", egovDeptManageService.selectDeptManageList(deptManageVO)); + + int totCnt = egovDeptManageService.selectDeptManageListTotCnt(deptManageVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + return "egovframework/com/uss/umt/EgovDeptManageList"; + } + + /** + * 등록된 부서의 상세정보를 조회한다. + * @param bannerVO - 부서 Vo + * @return String - 리턴 Url + */ + + @RequestMapping(value = "/uss/umt/dpt/getDeptManage.do") + public String selectDeptManage(@RequestParam("orgnztId") String orgnztId, @ModelAttribute("deptManageVO") DeptManageVO deptManageVO, ModelMap model) throws Exception { + + deptManageVO.setOrgnztId(orgnztId); + + model.addAttribute("deptManage", egovDeptManageService.selectDeptManage(deptManageVO)); + model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); + return "egovframework/com/uss/umt/EgovDeptManageUpdt"; + } + + /** + * 부서등록 화면으로 이동한다. + * @param banner - 부서 model + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/umt/dpt/addViewDeptManage.do") + public String insertViewDeptManage(@ModelAttribute("deptManageVO") DeptManageVO deptManageVO, ModelMap model) throws Exception { + + model.addAttribute("deptManage", deptManageVO); + return "egovframework/com/uss/umt/EgovDeptManageInsert"; + } + + /** + * 부서정보를 신규로 등록한다. + * @param banner - 부서 model + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/umt/dpt/addDeptManage.do") + public String insertDeptManage(@ModelAttribute("deptManageVO") DeptManageVO deptManageVO, BindingResult bindingResult, ModelMap model) throws Exception { + + beanValidator.validate(deptManageVO, bindingResult); //validation 수행 + + deptManageVO.setOrgnztId(egovDeptManageIdGnrService.getNextStringId()); + + if (bindingResult.hasErrors()) { + return "egovframework/com/uss/umt/EgovDeptManageInsert"; + } else { + egovDeptManageService.insertDeptManage(deptManageVO); + model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); + return "forward:/uss/umt/dpt/selectDeptManageList.do"; + } + } + + /** + * 기 등록된 부서정보를 수정한다. + * @param banner - 부서 model + * @return String - 리턴 Url + */ + @RequestMapping(value = "/uss/umt/dpt/updtDeptManage.do") + public String updateDeptManage(@ModelAttribute("deptManageVO") DeptManageVO deptManageVO, BindingResult bindingResult, ModelMap model) throws Exception { + beanValidator.validate(deptManageVO, bindingResult); //validation 수행 + + if (bindingResult.hasErrors()) { + return "egovframework/com/uss/umt/EgovDeptManageUpdt"; + } else { + egovDeptManageService.updateDeptManage(deptManageVO); + model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); + return "forward:/uss/umt/dpt/selectDeptManageList.do"; + } + } + + /** + * 기 등록된 부서정보를 삭제한다. + * @param banner Banner + * @return String + * @exception Exception + */ + @RequestMapping(value = "/uss/umt/dpt/removeDeptManage.do") + public String deleteDeptManage(@ModelAttribute("deptManageVO") DeptManageVO deptManageVO, Model model) throws Exception { + + egovDeptManageService.deleteDeptManage(deptManageVO); + model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); + return "forward:/uss/umt/dpt/selectDeptManageList.do"; + } + + /** + * 기 등록된 부서정보목록을 일괄 삭제한다. + * @param banners String + * @param banner Banner + * @return String + * @exception Exception + */ + @RequestMapping(value = "/uss/umt/dpt/removeDeptManageList.do") + public String deleteDeptManageList(@RequestParam("deptManages") String deptManages, @ModelAttribute("deptManageVO") DeptManageVO deptManageVO, ModelMap model) throws Exception { + + String[] strDeptManages = deptManages.split(";"); + for (int i = 0; i < strDeptManages.length; i++) { + deptManageVO.setOrgnztId(strDeptManages[i]); + egovDeptManageService.deleteDeptManage(deptManageVO); + } + + model.addAttribute("message", egovMessageSource.getMessage("success.common.delete")); + return "forward:/uss/umt/dpt/selectDeptManageList.do"; + } + +} diff --git a/src/main/java/egovframework/com/uss/umt/web/EgovEntrprsManageController.java b/src/main/java/egovframework/com/uss/umt/web/EgovEntrprsManageController.java new file mode 100644 index 0000000..977c167 --- /dev/null +++ b/src/main/java/egovframework/com/uss/umt/web/EgovEntrprsManageController.java @@ -0,0 +1,576 @@ +package egovframework.com.uss.umt.web; + +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +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 egovframework.com.cmm.ComDefaultCodeVO; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.service.EgovCmmUseService; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.umt.service.EgovEntrprsManageService; +import egovframework.com.uss.umt.service.EntrprsManageVO; +import egovframework.com.uss.umt.service.UserDefaultVO; +import egovframework.com.utl.sim.service.EgovFileScrty; + +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +/** + * 기업회원관련 요청을 비지니스 클래스로 전달하고 처리된결과를 해당 웹 화면으로 전달하는 Controller를 정의한다 + * @author 공통서비스 개발팀 조재영 + * @since 2009.04.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.10  조재영         최초 생성
    + *   2011.08.26	 정진오         IncludedInfo annotation 추가
    + *   2014.12.08  이기하         암호화방식 변경(EgovFileScrty.encryptPassword)
    + *   2015.06.16  조정국         수정시 유효성체크 후 에러발생 시 목록으로 이동하여 에러메시지 표시
    + *   2015.06.19  조정국         미인증 사용자에 대한 보안처리 기준 수정 (!isAuthenticated)
    + *   2017.07.21  장동한         로그인인증제한 작업
    + *   2020.07.18  윤주호         암호 설정 규칙 강화 및 버그 수정
    + *   2021.05.30  정진오         디지털원패스 정보 조회
    + * 
    + */ + +@Controller +public class EgovEntrprsManageController { + + /** entrprsManageService */ + @Resource(name = "entrprsManageService") + private EgovEntrprsManageService entrprsManageService; + + /** cmmUseService */ + @Resource(name = "EgovCmmUseService") + private EgovCmmUseService cmmUseService; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** DefaultBeanValidator beanValidator */ + @Autowired + private DefaultBeanValidator beanValidator; + + /** 비밀번호 힌트 조회 목록*/ + @ModelAttribute("passwordHint_result") + private List getPasswordHintResult(ComDefaultCodeVO vo) throws Exception { + vo.setCodeId("COM022"); + return cmmUseService.selectCmmCodeDetail(vo); + } + + /** 성별 조회 목록 */ + @ModelAttribute("sexdstnCode_result") + private List getSexdstnCode_result(ComDefaultCodeVO vo) throws Exception { + vo.setCodeId("COM014"); + return cmmUseService.selectCmmCodeDetail(vo); + } + + /** 사용자 상태 조회 목록 */ + @ModelAttribute("entrprsMberSttus_result") + private List getEntrprsMberSttus_result(ComDefaultCodeVO vo) throws Exception { + vo.setCodeId("COM013"); + return cmmUseService.selectCmmCodeDetail(vo); + } + + /** 그룹 정보 조회 목록 */ + @ModelAttribute("groupId_result") + private List getGroupId_result(ComDefaultCodeVO vo) throws Exception { + vo.setTableNm("COMTNORGNZTINFO"); + return cmmUseService.selectGroupIdDetail(vo); + } + + /** 기업 구분 조회 목록 */ + @ModelAttribute("entrprsSeCode_result") + private List getEntrprsSeCode_result(ComDefaultCodeVO vo) throws Exception { + vo.setCodeId("COM026"); + return cmmUseService.selectCmmCodeDetail(vo); + } + + /** 업종 구분 조회 목록 */ + @ModelAttribute("indutyCode_result") + private List getIndutyCode_result(ComDefaultCodeVO vo) throws Exception { + vo.setCodeId("COM027"); + return cmmUseService.selectCmmCodeDetail(vo); + } + + /** + * 기업회원 등록화면으로 이동한다. + * @param userSearchVO 검색조건정보 + * @param entrprsManageVO 기업회원 초기화정보 + * @param model 화면모델 + * @return uss/umt/EgovEntrprsMberInsert + * @throws Exception + */ + @RequestMapping("/uss/umt/EgovEntrprsMberInsertView.do") + public String insertEntrprsMberView(@ModelAttribute("userSearchVO") UserDefaultVO userSearchVO, + @ModelAttribute("entrprsManageVO") EntrprsManageVO entrprsManageVO, Model model) + throws Exception { + + // 미인증 사용자에 대한 보안처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "index"; + } + + // ComDefaultCodeVO vo = new ComDefaultCodeVO(); + + //패스워드힌트목록을 코드정보로부터 조회 + // vo.setCodeId("COM022"); + // List passwordHint_result = cmmUseService.selectCmmCodeDetail(vo); + //성별구분코드를 코드정보로부터 조회 + // vo.setCodeId("COM014"); + // List sexdstnCode_result = cmmUseService.selectCmmCodeDetail(vo); + //사용자상태코드를 코드정보로부터 조회 + // vo.setCodeId("COM013"); + // List entrprsMberSttus_result = cmmUseService.selectCmmCodeDetail(vo); + //그룹정보를 조회 - GROUP_ID정보 + // vo.setTableNm("COMTNORGNZTINFO"); + // List groupId_result = cmmUseService.selectGroupIdDetail(vo); + //기업구분코드를 코드정보로부터 조회 - COM026 + // vo.setCodeId("COM026"); + // List entrprsSeCode_result = cmmUseService.selectCmmCodeDetail(vo); + //업종코드를 코드정보로부터 조회 - COM027 + // vo.setCodeId("COM027"); + // List indutyCode_result = cmmUseService.selectCmmCodeDetail(vo); + + // model.addAttribute("passwordHint_result", passwordHint_result); //패스워트힌트목록 + // model.addAttribute("sexdstnCode_result", sexdstnCode_result); //성별구분코드목록 + // model.addAttribute("entrprsMberSttus_result", entrprsMberSttus_result);//사용자상태코드목록 + // model.addAttribute("groupId_result", groupId_result); //그룹정보 목록 + // model.addAttribute("entrprsSeCode_result", entrprsSeCode_result); //기업구분코드 목록 + // model.addAttribute("indutyCode_result", indutyCode_result); //업종코드목록 + + return "egovframework/com/uss/umt/EgovEntrprsMberInsert"; + } + + /** + * 기업회원등록처리후 목록화면으로 이동한다. + * @param entrprsManageVO 신규기업회원정보 + * @param bindingResult 입력값검증용 bindingResult + * @param model 화면모델 + * @return forward:/uss/umt/EgovEntrprsMberManage.do + * @throws Exception + */ + @RequestMapping("/uss/umt/EgovEntrprsMberInsert.do") + public String insertEntrprsMber(@ModelAttribute("entrprsManageVO") EntrprsManageVO entrprsManageVO, + BindingResult bindingResult, Model model) throws Exception { + + // 미인증 사용자에 대한 보안처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "index"; + } + + beanValidator.validate(entrprsManageVO, bindingResult); + if (bindingResult.hasErrors()) { + return "egovframework/com/uss/umt/EgovEntrprsMberInsert"; + } else { + if (entrprsManageVO != null && entrprsManageVO.getGroupId() != null + && entrprsManageVO.getGroupId().equals("")) {//2022.01 Null pointers should not be dereferenced + entrprsManageVO.setGroupId(null); + } + entrprsManageService.insertEntrprsmber(entrprsManageVO); + //Exception 없이 진행시 등록성공메시지 + model.addAttribute("resultMsg", "success.common.insert"); + } + return "forward:/uss/umt/EgovEntrprsMberManage.do"; + + } + + /** + * 기업회원정보 수정을 위해기업회원정보를 상세조회한다. + * @param entrprsmberId 상세조회 대상 기업회원아이디 + * @param userSearchVO 조회조건정보 + * @param model 화면모델 + * @return uss/umt/EgovEntrprsMberSelectUpdt + * @throws Exception + */ + @RequestMapping("/uss/umt/EgovEntrprsMberSelectUpdtView.do") + public String updateEntrprsMberView(@RequestParam("selectedId") String entrprsmberId, + @ModelAttribute("searchVO") UserDefaultVO userSearchVO, HttpServletRequest request, Model model) + throws Exception { + + // 미인증 사용자에 대한 보안처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "index"; + } + + EntrprsManageVO entrprsManageVO = new EntrprsManageVO(); + entrprsManageVO = entrprsManageService.selectEntrprsmber(entrprsmberId); + model.addAttribute("entrprsManageVO", entrprsManageVO); + model.addAttribute("userSearchVO", userSearchVO); + + // ComDefaultCodeVO vo = new ComDefaultCodeVO(); + //패스워드힌트목록을 코드정보로부터 조회 + // vo.setCodeId("COM022"); + // List passwordHint_result = cmmUseService.selectCmmCodeDetail(vo); + // //성별구분코드를 코드정보로부터 조회 + // vo.setCodeId("COM014"); + // List sexdstnCode_result = cmmUseService.selectCmmCodeDetail(vo); + // //사용자상태코드를 코드정보로부터 조회 + // vo.setCodeId("COM013"); + // List entrprsMberSttus_result = cmmUseService.selectCmmCodeDetail(vo); + // //그룹정보를 조회 - GROUP_ID정보 + // vo.setTableNm("COMTNORGNZTINFO"); + // List groupId_result = cmmUseService.selectGroupIdDetail(vo); + // //기업구분코드를 코드정보로부터 조회 - COM026 + // vo.setCodeId("COM026"); + // List entrprsSeCode_result = cmmUseService.selectCmmCodeDetail(vo); + // //업종코드를 코드정보로부터 조회 - COM027 + // vo.setCodeId("COM027"); + // List indutyCode_result = cmmUseService.selectCmmCodeDetail(vo); + + // model.addAttribute("passwordHint_result", passwordHint_result); //패스워트힌트목록 + // model.addAttribute("sexdstnCode_result", sexdstnCode_result); //성별구분코드목록 + // model.addAttribute("entrprsMberSttus_result", entrprsMberSttus_result);//사용자상태코드목록 + // model.addAttribute("groupId_result", groupId_result); //그룹정보 목록 + // model.addAttribute("entrprsSeCode_result", entrprsSeCode_result); //기업구분코드 목록 + // model.addAttribute("indutyCode_result", indutyCode_result); //업종코드목록 + + // 2021.05.30, 정진오, 디지털원패스 정보 조회 + LoginVO loginVO = (LoginVO)request.getSession().getAttribute("loginVO"); + String onepassUserId = loginVO.getUniqId(); + String onepassUserkey = loginVO.getOnepassUserkey(); + String onepassIntfToken = loginVO.getOnepassIntfToken(); + if (entrprsmberId.equals(onepassUserId)) { + model.addAttribute("onepassUserkey", onepassUserkey); //디지털원패스 사용자키 + model.addAttribute("onepassIntfToken", onepassIntfToken); //디지털원패스 사용자세션값 + } else { + model.addAttribute("onepassUserkey", ""); + model.addAttribute("onepassIntfToken", ""); + } + + return "egovframework/com/uss/umt/EgovEntrprsMberSelectUpdt"; + } + + /** + * 로그인인증제한 해제 + * @param entrprsManageVO 기업회원정보 + * @param model 화면모델 + * @return uss/umt/EgovEntrprsMberSelectUpdtView.do + * @throws Exception + */ + @RequestMapping("/uss/umt/EgovEntrprsMberLockIncorrect.do") + public String updateLockIncorrect(EntrprsManageVO entrprsManageVO, Model model) throws Exception { + + // 미인증 사용자에 대한 보안처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "index"; + } + + entrprsManageService.updateLockIncorrect(entrprsManageVO); + + return "forward:/uss/umt/EgovEntrprsMberSelectUpdtView.do"; + } + + /** + * 기업회원정보 수정후 목록조회 화면으로 이동한다. + * @param entrprsManageVO 수정할 기업회원정보 + * @param bindingResult 입력값 검증용 bindingResult + * @param model 화면모델 + * @return forward:/uss/umt/EgovEntrprsMberManage.do + * @throws Exception + */ + @RequestMapping("/uss/umt/EgovEntrprsMberSelectUpdt.do") + public String updateEntrprsMber(@ModelAttribute("entrprsManageVO") EntrprsManageVO entrprsManageVO, + BindingResult bindingResult, Model model) throws Exception { + + // 미인증 사용자에 대한 보안처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "index"; + } + + beanValidator.validate(entrprsManageVO, bindingResult); + if (bindingResult.hasErrors()) { + model.addAttribute("resultMsg", bindingResult.getAllErrors().get(0).getDefaultMessage()); + return "forward:/uss/umt/EgovEntrprsMberSelectUpdtView.do"; + } else { + if ("".equals(entrprsManageVO.getGroupId())) { + entrprsManageVO.setGroupId(null); + } + entrprsManageService.updateEntrprsmber(entrprsManageVO); + //Exception 없이 진행시 수정성공메시지 + model.addAttribute("resultMsg", "success.common.update"); + return "forward:/uss/umt/EgovEntrprsMberManage.do"; + } + } + + /** + * 기업회원정보삭제후 목록조회 화면으로 이동한다. + * @param checkedIdForDel 삭제대상아이디 정보 + * @param userSearchVO 조회조건정보 + * @param model 화면모델 + * @return "forward:/uss/umt/EgovUserManage.do" + * @throws Exception + */ + @RequestMapping("/uss/umt/EgovEntrprsMberDelete.do") + public String deleteEntrprsMber(@RequestParam("checkedIdForDel") String checkedIdForDel, + @ModelAttribute("searchVO") UserDefaultVO userSearchVO, HttpServletRequest request, Model model) + throws Exception { + + // 미인증 사용자에 대한 보안처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "index"; + } + + // 2021.05.30, 정진오, 디지털원패스 정보 조회 + LoginVO loginVO = (LoginVO)request.getSession().getAttribute("loginVO"); + String onepassUserkey = loginVO.getOnepassUserkey(); + String onepassIntfToken = loginVO.getOnepassIntfToken(); + if (onepassUserkey.isEmpty() && onepassIntfToken.isEmpty()) { + entrprsManageService.deleteEntrprsmber(checkedIdForDel); + model.addAttribute("resultMsg", "success.common.delete"); + } else { + model.addAttribute("resultMsg", "digital.onepass.delete.alert"); + } + + return "forward:/uss/umt/EgovEntrprsMberManage.do"; + } + + /** + * 기업회원목록을 조회한다. (pageing) + * @param userSearchVO 검색조건정보 + * @param model 화면모델 + * @return uss/umt/EgovEntrprsMberManage + * @throws Exception + */ + @IncludedInfo(name = "기업회원관리", order = 450, gid = 50) + @RequestMapping(value = "/uss/umt/EgovEntrprsMberManage.do") + public String selectEntrprsMberList(@ModelAttribute("userSearchVO") UserDefaultVO userSearchVO, ModelMap model) + throws Exception { + + // 미인증 사용자에 대한 보안처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "index"; + } + + /** EgovPropertyService.sample */ + 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()); + + List entrprsList = entrprsManageService.selectEntrprsMberList(userSearchVO); + model.addAttribute("resultList", entrprsList); + + int totCnt = entrprsManageService.selectEntrprsMberListTotCnt(userSearchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + //사용자상태코드를 코드정보로부터 조회 + // ComDefaultCodeVO vo = new ComDefaultCodeVO(); + // vo.setCodeId("COM013"); + // List entrprsMberSttus_result = cmmUseService.selectCmmCodeDetail(vo); + // model.addAttribute("entrprsMberSttus_result", entrprsMberSttus_result);//기업회원상태코드목록 + + return "egovframework/com/uss/umt/EgovEntrprsMberManage"; + } + + /** + * 기업회원가입신청 등록화면으로 이동한다. + * @param userSearchVO 검색조건정보 + * @param entrprsManageVO 기업회원초기화정보 + * @param commandMap 파라메터전송 commandMap + * @param model 화면모델 + * @return uss/umt/EgovEntrprsMberSbscrb + * @throws Exception + */ + @RequestMapping("/uss/umt/EgovEntrprsMberSbscrbView.do") + public String sbscrbEntrprsMberView(@ModelAttribute("userSearchVO") UserDefaultVO userSearchVO, + @ModelAttribute("entrprsManageVO") EntrprsManageVO entrprsManageVO, + @RequestParam Map commandMap, Model model) throws Exception { + + // ComDefaultCodeVO vo = new ComDefaultCodeVO(); + // //패스워드힌트목록을 코드정보로부터 조회 + // vo.setCodeId("COM022"); + // List passwordHint_result = cmmUseService.selectCmmCodeDetail(vo); + // //성별구분코드를 코드정보로부터 조회 + // vo.setCodeId("COM014"); + // List sexdstnCode_result = cmmUseService.selectCmmCodeDetail(vo); + // //기업구분코드를 코드정보로부터 조회 - COM026 + // vo.setCodeId("COM026"); + // List entrprsSeCode_result = cmmUseService.selectCmmCodeDetail(vo); + // //업종코드를 코드정보로부터 조회 - COM027 + // vo.setCodeId("COM027"); + // List indutyCode_result = cmmUseService.selectCmmCodeDetail(vo); + + // model.addAttribute("passwordHint_result", passwordHint_result); //패스워트힌트목록 + // model.addAttribute("sexdstnCode_result", sexdstnCode_result); //성별구분코드목록 + // model.addAttribute("entrprsSeCode_result", entrprsSeCode_result); //기업구분코드 목록 + // model.addAttribute("indutyCode_result", indutyCode_result); //업종코드목록 + if (!"".equals(commandMap.get("realname"))) { + model.addAttribute("applcntNm", commandMap.get("realname")); //실명인증된 이름 - 주민번호인증 + model.addAttribute("applcntIhidnum", commandMap.get("ihidnum")); //실명인증된 주민등록번호 - 주민번호 인증 + } + if (!"".equals(commandMap.get("realName"))) { + model.addAttribute("applcntNm", commandMap.get("realName")); //실명인증된 이름 - ipin인증 + } + entrprsManageVO.setEntrprsMberSttus("DEFAULT"); + + return "egovframework/com/uss/umt/EgovEntrprsMberSbscrb"; + } + + /** + * 기업회원가입신청 등록처리후 로그인화면으로 이동한다. + * @param entrprsManageVO 기업회원가입신청정보 + * @return forward:/uat/uia/egovLoginUsr.do + * @throws Exception + */ + @RequestMapping("/uss/umt/EgovEntrprsMberSbscrb.do") + public String sbscrbEntrprsMber(@ModelAttribute("entrprsManageVO") EntrprsManageVO entrprsManageVO) + throws Exception { + + //가입상태 초기화 + entrprsManageVO.setEntrprsMberSttus("A"); + //그룹정보 초기화 + //entrprsManageVO.setGroupId("1"); + //기업회원가입신청 등록시 기업회원등록기능을 사용하여 등록한다. + entrprsManageService.insertEntrprsmber(entrprsManageVO); + return "forward:/uat/uia/egovLoginUsr.do"; + } + + /** + * 기업회원 약관확인 화면을 조회한다. + * @param model 화면모델 + * @return uss/umt/EgovStplatCnfirm + * @throws Exception + */ + @RequestMapping("/uss/umt/EgovStplatCnfirmEntrprs.do") + public String sbscrbEntrprsMber(Model model) throws Exception { + + //기업회원용 약관 아이디 설정 + String stplatId = "STPLAT_0000000000002"; + //회원가입유형 설정-기업회원 + String sbscrbTy = "USR02"; + //약관정보 조회 + List stplatList = entrprsManageService.selectStplat(stplatId); + model.addAttribute("stplatList", stplatList); //약관정보포함 + model.addAttribute("sbscrbTy", sbscrbTy); //회원가입유형포함 + + return "egovframework/com/uss/umt/EgovStplatCnfirm"; + } + + /** + * 기업회원 암호 수정처리 후 화면 이동한다. + * @param model 화면모델 + * @param commandMap 파라메터전달용 commandMap + * @param userSearchVO 검색조건정보 + * @param entrprsManageVO 기업회원수정정보 + * @return uss/umt/EgovEntrprsPasswordUpdt + * @throws Exception + */ + @RequestMapping(value = "/uss/umt/EgovEntrprsPasswordUpdt.do") + public String updatePassword(ModelMap model, @RequestParam Map commandMap, + @ModelAttribute("searchVO") UserDefaultVO userSearchVO, + @ModelAttribute("entrprsManageVO") EntrprsManageVO entrprsManageVO) throws Exception { + + // 미인증 사용자에 대한 보안처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "index"; + } + + String oldPassword = (String)commandMap.get("oldPassword"); + String newPassword = (String)commandMap.get("newPassword"); + String newPassword2 = (String)commandMap.get("newPassword2"); + String uniqId = (String)commandMap.get("uniqId"); + + boolean isCorrectPassword = false; + EntrprsManageVO resultVO = new EntrprsManageVO(); + entrprsManageVO.setEntrprsMberPassword(newPassword); + entrprsManageVO.setOldPassword(oldPassword); + entrprsManageVO.setUniqId(uniqId); + + String resultMsg = ""; + resultVO = entrprsManageService.selectPassword(entrprsManageVO); + //패스워드 암호화 + String encryptPass = EgovFileScrty.encryptPassword(oldPassword, entrprsManageVO.getEntrprsmberId()); + if (encryptPass.equals(resultVO.getEntrprsMberPassword())) { + if (newPassword.equals(newPassword2)) { + isCorrectPassword = true; + } else { + isCorrectPassword = false; + resultMsg = "fail.user.passwordUpdate2"; + } + } else { + isCorrectPassword = false; + resultMsg = "fail.user.passwordUpdate1"; + } + + if (isCorrectPassword) { + entrprsManageVO + .setEntrprsMberPassword(EgovFileScrty.encryptPassword(newPassword, entrprsManageVO.getEntrprsmberId())); + entrprsManageService.updatePassword(entrprsManageVO); + model.addAttribute("entrprsManageVO", entrprsManageVO); + resultMsg = "success.common.update"; + } else { + model.addAttribute("entrprsManageVO", entrprsManageVO); + } + model.addAttribute("userSearchVO", userSearchVO); + model.addAttribute("resultMsg", resultMsg); + + return "egovframework/com/uss/umt/EgovEntrprsPasswordUpdt"; + } + + /** + * 기업회원암호 수정 화면 이동 + * @param model 화면모델 + * @param commandMap 파라메터전송용 commandMap + * @param userSearchVO 검색조건정보 + * @param entrprsManageVO 기업회원수정정보 + * @return uss/umt/EgovEntrprsPasswordUpdt + * @throws Exception + */ + @RequestMapping(value = "/uss/umt/EgovEntrprsPasswordUpdtView.do") + public String updatePasswordView(ModelMap model, @RequestParam Map commandMap, + @ModelAttribute("searchVO") UserDefaultVO userSearchVO, + @ModelAttribute("entrprsManageVO") EntrprsManageVO entrprsManageVO) throws Exception { + + // 미인증 사용자에 대한 보안처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "index"; + } + + String userTyForPassword = (String)commandMap.get("userTyForPassword"); + entrprsManageVO.setUserTy(userTyForPassword); + + model.addAttribute("userSearchVO", userSearchVO); + model.addAttribute("entrprsManageVO", entrprsManageVO); + return "egovframework/com/uss/umt/EgovEntrprsPasswordUpdt"; + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/umt/web/EgovMberManageController.java b/src/main/java/egovframework/com/uss/umt/web/EgovMberManageController.java new file mode 100644 index 0000000..6f25bc7 --- /dev/null +++ b/src/main/java/egovframework/com/uss/umt/web/EgovMberManageController.java @@ -0,0 +1,550 @@ +package egovframework.com.uss.umt.web; + +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +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 egovframework.com.cmm.ComDefaultCodeVO; +import egovframework.com.cmm.LoginVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.service.EgovCmmUseService; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.umt.service.EgovMberManageService; +import egovframework.com.uss.umt.service.MberManageVO; +import egovframework.com.uss.umt.service.UserDefaultVO; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import egovframework.com.utl.sim.service.EgovFileScrty; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +/** + * 일반회원관련 요청을 비지니스 클래스로 전달하고 처리된결과를 해당 웹 화면으로 전달하는 Controller를 정의한다 + * @author 공통서비스 개발팀 조재영 + * @since 2009.04.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.10  조재영         최초 생성
    + *   2011.08.26  정진오         IncludedInfo annotation 추가
    + *   2014.12.08  이기하         암호화방식 변경(EgovFileScrty.encryptPassword)
    + *   2015.06.16  조정국         수정시 유효성체크 후 에러발생 시 목록으로 이동하여 에러메시지 표시
    + *   2015.06.19  조정국         미인증 사용자에 대한 보안처리 기준 수정 (!isAuthenticated)
    + *   2017.07.21  장동한         로그인인증제한 작업
    + *   2021.05.30  정진오         디지털원패스 정보 조회
    + *
    + * 
    + */ + +@Controller +public class EgovMberManageController { + + /** mberManageService */ + @Resource(name = "mberManageService") + private EgovMberManageService mberManageService; + + /** cmmUseService */ + @Resource(name = "EgovCmmUseService") + private EgovCmmUseService cmmUseService; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** DefaultBeanValidator beanValidator */ + @Autowired + private DefaultBeanValidator beanValidator; + + /** + * 일반회원목록을 조회한다. (pageing) + * @param userSearchVO 검색조건정보 + * @param model 화면모델 + * @return uss/umt/EgovMberManage + * @throws Exception + */ + @IncludedInfo(name = "일반회원관리", order = 470, gid = 50) + @RequestMapping(value = "/uss/umt/EgovMberManage.do") + public String selectMberList(@ModelAttribute("userSearchVO") UserDefaultVO userSearchVO, ModelMap model) throws Exception { + + // 미인증 사용자에 대한 보안처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "index"; + } + + /** 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()); + + List mberList = mberManageService.selectMberList(userSearchVO); + model.addAttribute("resultList", mberList); + + int totCnt = mberManageService.selectMberListTotCnt(userSearchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + //일반회원 상태코드를 코드정보로부터 조회 + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM013"); + List mberSttus_result = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("entrprsMberSttus_result", mberSttus_result);//기업회원상태코드목록 + + return "egovframework/com/uss/umt/EgovMberManage"; + } + + /** + * 일반회원등록화면으로 이동한다. + * @param userSearchVO 검색조건정보 + * @param mberManageVO 일반회원초기화정보 + * @param model 화면모델 + * @return uss/umt/EgovMberInsert + * @throws Exception + */ + @RequestMapping("/uss/umt/EgovMberInsertView.do") + public String insertMberView(@ModelAttribute("userSearchVO") UserDefaultVO userSearchVO, @ModelAttribute("mberManageVO") MberManageVO mberManageVO, Model model) + throws Exception { + + // 미인증 사용자에 대한 보안처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "index"; + } + + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + + //패스워드힌트목록을 코드정보로부터 조회 + vo.setCodeId("COM022"); + List passwordHint_result = cmmUseService.selectCmmCodeDetail(vo); + //성별구분코드를 코드정보로부터 조회 + vo.setCodeId("COM014"); + List sexdstnCode_result = cmmUseService.selectCmmCodeDetail(vo); + //사용자상태코드를 코드정보로부터 조회 + vo.setCodeId("COM013"); + List mberSttus_result = cmmUseService.selectCmmCodeDetail(vo); + //그룹정보를 조회 - GROUP_ID정보 + vo.setTableNm("COMTNORGNZTINFO"); + List groupId_result = cmmUseService.selectGroupIdDetail(vo); + + model.addAttribute("passwordHint_result", passwordHint_result); //패스워트힌트목록 + model.addAttribute("sexdstnCode_result", sexdstnCode_result); //성별구분코드목록 + model.addAttribute("mberSttus_result", mberSttus_result); //사용자상태코드목록 + model.addAttribute("groupId_result", groupId_result); //그룹정보 목록 + + return "egovframework/com/uss/umt/EgovMberInsert"; + } + + /** + * 일반회원등록처리후 목록화면으로 이동한다. + * @param mberManageVO 일반회원등록정보 + * @param bindingResult 입력값검증용 bindingResult + * @param model 화면모델 + * @return forward:/uss/umt/EgovMberManage.do + * @throws Exception + */ + @RequestMapping("/uss/umt/EgovMberInsert.do") + public String insertMber(@ModelAttribute("mberManageVO") MberManageVO mberManageVO, BindingResult bindingResult, Model model) throws Exception { + + // 미인증 사용자에 대한 보안처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "index"; + } + + beanValidator.validate(mberManageVO, bindingResult); + if (bindingResult.hasErrors()) { + + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + + //패스워드힌트목록을 코드정보로부터 조회 + vo.setCodeId("COM022"); + List passwordHint_result = cmmUseService.selectCmmCodeDetail(vo); + //성별구분코드를 코드정보로부터 조회 + vo.setCodeId("COM014"); + List sexdstnCode_result = cmmUseService.selectCmmCodeDetail(vo); + //사용자상태코드를 코드정보로부터 조회 + vo.setCodeId("COM013"); + List mberSttus_result = cmmUseService.selectCmmCodeDetail(vo); + //그룹정보를 조회 - GROUP_ID정보 + vo.setTableNm("COMTNORGNZTINFO"); + List groupId_result = cmmUseService.selectGroupIdDetail(vo); + + model.addAttribute("passwordHint_result", passwordHint_result); //패스워트힌트목록 + model.addAttribute("sexdstnCode_result", sexdstnCode_result); //성별구분코드목록 + model.addAttribute("mberSttus_result", mberSttus_result); //사용자상태코드목록 + model.addAttribute("groupId_result", groupId_result); //그룹정보 목록 + + return "egovframework/com/uss/umt/EgovMberInsert"; + } else { + if ("".equals(mberManageVO.getGroupId())) {//KISA 보안약점 조치 (2018-10-29, 윤창원) + mberManageVO.setGroupId(null); + } + mberManageService.insertMber(mberManageVO); + //Exception 없이 진행시 등록 성공메시지 + model.addAttribute("resultMsg", "success.common.insert"); + } + return "forward:/uss/umt/EgovMberManage.do"; + } + + /** + * 일반회원정보 수정을 위해 일반회원정보를 상세조회한다. + * @param mberId 상세조회대상 일반회원아이디 + * @param userSearchVO 검색조건 + * @param model 화면모델 + * @return uss/umt/EgovMberSelectUpdt + * @throws Exception + */ + @RequestMapping("/uss/umt/EgovMberSelectUpdtView.do") + public String updateMberView(@RequestParam("selectedId") String mberId, @ModelAttribute("searchVO") UserDefaultVO userSearchVO, HttpServletRequest request, Model model) throws Exception { + + // 미인증 사용자에 대한 보안처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "index"; + } + + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + + //패스워드힌트목록을 코드정보로부터 조회 + vo.setCodeId("COM022"); + List passwordHint_result = cmmUseService.selectCmmCodeDetail(vo); + + //성별구분코드를 코드정보로부터 조회 + vo.setCodeId("COM014"); + List sexdstnCode_result = cmmUseService.selectCmmCodeDetail(vo); + + //사용자상태코드를 코드정보로부터 조회 + vo.setCodeId("COM013"); + List mberSttus_result = cmmUseService.selectCmmCodeDetail(vo); + + //그룹정보를 조회 - GROUP_ID정보 + vo.setTableNm("COMTNORGNZTINFO"); + List groupId_result = cmmUseService.selectGroupIdDetail(vo); + + model.addAttribute("passwordHint_result", passwordHint_result); //패스워트힌트목록 + model.addAttribute("sexdstnCode_result", sexdstnCode_result); //성별구분코드목록 + model.addAttribute("mberSttus_result", mberSttus_result); //사용자상태코드목록 + model.addAttribute("groupId_result", groupId_result); //그룹정보 목록 + + MberManageVO mberManageVO = mberManageService.selectMber(mberId); + model.addAttribute("mberManageVO", mberManageVO); + model.addAttribute("userSearchVO", userSearchVO); + + // 2021.05.30, 정진오, 디지털원패스 정보 조회 + LoginVO loginVO = (LoginVO)request.getSession().getAttribute("loginVO"); + String onepassUserId = loginVO.getUniqId(); + String onepassUserkey = loginVO.getOnepassUserkey(); + String onepassIntfToken = loginVO.getOnepassIntfToken(); + if (mberId.equals(onepassUserId)) { + model.addAttribute("onepassUserkey", onepassUserkey); //디지털원패스 사용자키 + model.addAttribute("onepassIntfToken", onepassIntfToken); //디지털원패스 사용자세션값 + } else { + model.addAttribute("onepassUserkey", ""); + model.addAttribute("onepassIntfToken", ""); + } + + return "egovframework/com/uss/umt/EgovMberSelectUpdt"; + } + + /** + * 로그인인증제한 해제 + * @param mberManageVO 일반회원등록정보 + * @param model 화면모델 + * @return uss/umt/EgovMberSelectUpdtView.do + * @throws Exception + */ + @RequestMapping("/uss/umt/EgovMberLockIncorrect.do") + public String updateLockIncorrect(MberManageVO mberManageVO, Model model) throws Exception { + + + // 미인증 사용자에 대한 보안처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "index"; + } + + mberManageService.updateLockIncorrect(mberManageVO); + + return "forward:/uss/umt/EgovMberSelectUpdtView.do"; + } + + /** + * 일반회원정보 수정후 목록조회 화면으로 이동한다. + * @param mberManageVO 일반회원수정정보 + * @param bindingResult 입력값검증용 bindingResult + * @param model 화면모델 + * @return forward:/uss/umt/EgovMberManage.do + * @throws Exception + */ + @RequestMapping("/uss/umt/EgovMberSelectUpdt.do") + public String updateMber(@ModelAttribute("mberManageVO") MberManageVO mberManageVO, BindingResult bindingResult, Model model) throws Exception { + + // 미인증 사용자에 대한 보안처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "index"; + } + + beanValidator.validate(mberManageVO, bindingResult); + if (bindingResult.hasErrors()) { + model.addAttribute("resultMsg", bindingResult.getAllErrors().get(0).getDefaultMessage()); + return "forward:/uss/umt/EgovMberManage.do"; + } else { + if ("".equals(mberManageVO.getGroupId())) {//KISA 보안약점 조치 (2018-10-29, 윤창원) + mberManageVO.setGroupId(null); + } + mberManageService.updateMber(mberManageVO); + //Exception 없이 진행시 수정성공메시지 + model.addAttribute("resultMsg", "success.common.update"); + return "forward:/uss/umt/EgovMberManage.do"; + } + } + + /** + * 일반회원정보삭제후 목록조회 화면으로 이동한다. + * @param checkedIdForDel 삭제대상 아이디 정보 + * @param userSearchVO 검색조건정보 + * @param model 화면모델 + * @return forward:/uss/umt/EgovMberManage.do + * @throws Exception + */ + @RequestMapping("/uss/umt/EgovMberDelete.do") + public String deleteMber(@RequestParam("checkedIdForDel") String checkedIdForDel, @ModelAttribute("searchVO") UserDefaultVO userSearchVO, HttpServletRequest request, Model model) throws Exception { + + // 미인증 사용자에 대한 보안처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "index"; + } + + // 2021.05.30, 정진오, 디지털원패스 정보 조회 + LoginVO loginVO = (LoginVO)request.getSession().getAttribute("loginVO"); + String onepassUserkey = loginVO.getOnepassUserkey(); + String onepassIntfToken = loginVO.getOnepassIntfToken(); + if (onepassUserkey.isEmpty() && onepassIntfToken.isEmpty()) { + mberManageService.deleteMber(checkedIdForDel); + model.addAttribute("resultMsg", "success.common.delete"); + } else { + model.addAttribute("resultMsg", "digital.onepass.delete.alert"); + } + + return "forward:/uss/umt/EgovMberManage.do"; + } + + // 탈퇴 처리 기능에 대한 예시 + @RequestMapping("/uss/umt/EgovMberWithdraw.do") + public String withdrawMber(Model model) throws Exception { + LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser(); + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + String returnPage = "/"; // 탈퇴 처리 후 화면 지정 + + if (!isAuthenticated) { + model.addAttribute("resultMsg", "fail.common.delete"); + + return "redirect:" + returnPage; + } + + mberManageService.deleteMber(user == null ? "" : EgovStringUtil.isNullToString(user.getUniqId())); + //Exception 없이 진행시 삭제성공메시지 + model.addAttribute("resultMsg", "success.common.delete"); + + return "redirect:" + returnPage; + } + + /** + * 일반회원가입신청 등록화면으로 이동한다. + * @param userSearchVO 검색조건 + * @param mberManageVO 일반회원가입신청정보 + * @param commandMap 파라메터전달용 commandMap + * @param model 화면모델 + * @return uss/umt/EgovMberSbscrb + * @throws Exception + */ + @RequestMapping("/uss/umt/EgovMberSbscrbView.do") + public String sbscrbMberView(@ModelAttribute("userSearchVO") UserDefaultVO userSearchVO, @ModelAttribute("mberManageVO") MberManageVO mberManageVO, + @RequestParam Map commandMap, Model model) throws Exception { + + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + + //패스워드힌트목록을 코드정보로부터 조회 + vo.setCodeId("COM022"); + List passwordHint_result = cmmUseService.selectCmmCodeDetail(vo); + //성별구분코드를 코드정보로부터 조회 + vo.setCodeId("COM014"); + List sexdstnCode_result = cmmUseService.selectCmmCodeDetail(vo); + + model.addAttribute("passwordHint_result", passwordHint_result); //패스워트힌트목록 + model.addAttribute("sexdstnCode_result", sexdstnCode_result); //성별구분코드목록 + if (!"".equals(commandMap.get("realname"))) { + model.addAttribute("mberNm", commandMap.get("realname")); //실명인증된 이름 - 주민번호 인증 + model.addAttribute("ihidnum", commandMap.get("ihidnum")); //실명인증된 주민등록번호 - 주민번호 인증 + } + if (!"".equals(commandMap.get("realName"))) { + model.addAttribute("mberNm", commandMap.get("realName")); //실명인증된 이름 - ipin인증 + } + + mberManageVO.setMberSttus("DEFAULT"); + + return "egovframework/com/uss/umt/EgovMberSbscrb"; + } + + /** + * 일반회원가입신청등록처리후로그인화면으로 이동한다. + * @param mberManageVO 일반회원가입신청정보 + * @return forward:/uat/uia/egovLoginUsr.do + * @throws Exception + */ + @RequestMapping("/uss/umt/EgovMberSbscrb.do") + public String sbscrbMber(@ModelAttribute("mberManageVO") MberManageVO mberManageVO) throws Exception { + + //가입상태 초기화 + mberManageVO.setMberSttus("A"); + //그룹정보 초기화 + //mberManageVO.setGroupId("1"); + //일반회원가입신청 등록시 일반회원등록기능을 사용하여 등록한다. + mberManageService.insertMber(mberManageVO); + return "forward:/uat/uia/egovLoginUsr.do"; + } + + /** + * 일반회원 약관확인 + * @param model 화면모델 + * @return uss/umt/EgovStplatCnfirm + * @throws Exception + */ + @RequestMapping("/uss/umt/EgovStplatCnfirmMber.do") + public String sbscrbEntrprsMber(Model model) throws Exception { + + // 미인증 사용자에 대한 보안처리 + //Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + //if (!isAuthenticated) { + // return "index"; + //} + + //일반회원용 약관 아이디 설정 + String stplatId = "STPLAT_0000000000001"; + //회원가입유형 설정-일반회원 + String sbscrbTy = "USR01"; + //약관정보 조회 + List stplatList = mberManageService.selectStplat(stplatId); + model.addAttribute("stplatList", stplatList); //약관정보 포함 + model.addAttribute("sbscrbTy", sbscrbTy); //회원가입유형 포함 + + return "egovframework/com/uss/umt/EgovStplatCnfirm"; + } + + /** + * @param model 화면모델 + * @param commandMap 파라메터전달용 commandMap + * @param userSearchVO 검색조건 + * @param mberManageVO 일반회원수정정보(비밀번호) + * @return uss/umt/EgovMberPasswordUpdt + * @throws Exception + */ + @RequestMapping(value = "/uss/umt/EgovMberPasswordUpdt.do") + public String updatePassword(ModelMap model, @RequestParam Map commandMap, @ModelAttribute("searchVO") UserDefaultVO userSearchVO, + @ModelAttribute("mberManageVO") MberManageVO mberManageVO) throws Exception { + + // 미인증 사용자에 대한 보안처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "index"; + } + + String oldPassword = (String) commandMap.get("oldPassword"); + String newPassword = (String) commandMap.get("newPassword"); + String newPassword2 = (String) commandMap.get("newPassword2"); + String uniqId = (String) commandMap.get("uniqId"); + + boolean isCorrectPassword = false; + MberManageVO resultVO = new MberManageVO(); + mberManageVO.setPassword(newPassword); + mberManageVO.setOldPassword(oldPassword); + mberManageVO.setUniqId(uniqId); + + String resultMsg = ""; + resultVO = mberManageService.selectPassword(mberManageVO); + //패스워드 암호화 + String encryptPass = EgovFileScrty.encryptPassword(oldPassword, mberManageVO.getMberId()); + if (encryptPass.equals(resultVO.getPassword())) { + if (newPassword.equals(newPassword2)) { + isCorrectPassword = true; + } else { + isCorrectPassword = false; + resultMsg = "fail.user.passwordUpdate2"; + } + } else { + isCorrectPassword = false; + resultMsg = "fail.user.passwordUpdate1"; + } + + if (isCorrectPassword) { + mberManageVO.setPassword(EgovFileScrty.encryptPassword(newPassword, mberManageVO.getMberId())); + mberManageService.updatePassword(mberManageVO); + model.addAttribute("mberManageVO", mberManageVO); + resultMsg = "success.common.update"; + } else { + model.addAttribute("mberManageVO", mberManageVO); + } + model.addAttribute("userSearchVO", userSearchVO); + model.addAttribute("resultMsg", resultMsg); + + return "egovframework/com/uss/umt/EgovMberPasswordUpdt"; + } + + /** + * 일반회원 암호 수정 화면 이동 + * @param model 화면모델 + * @param commandMap 파라메터전달용 commandMap + * @param userSearchVO 검색조건 + * @param mberManageVO 일반회원수정정보(비밀번호) + * @return uss/umt/EgovMberPasswordUpdt + * @throws Exception + */ + @RequestMapping(value = "/uss/umt/EgovMberPasswordUpdtView.do") + public String updatePasswordView(ModelMap model, @RequestParam Map commandMap, @ModelAttribute("searchVO") UserDefaultVO userSearchVO, + @ModelAttribute("mberManageVO") MberManageVO mberManageVO) throws Exception { + + // 미인증 사용자에 대한 보안처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "index"; + } + + String userTyForPassword = (String) commandMap.get("userTyForPassword"); + mberManageVO.setUserTy(userTyForPassword); + + model.addAttribute("userSearchVO", userSearchVO); + model.addAttribute("mberManageVO", mberManageVO); + + return "egovframework/com/uss/umt/EgovMberPasswordUpdt"; + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/uss/umt/web/EgovUserManageController.java b/src/main/java/egovframework/com/uss/umt/web/EgovUserManageController.java new file mode 100644 index 0000000..2d73f90 --- /dev/null +++ b/src/main/java/egovframework/com/uss/umt/web/EgovUserManageController.java @@ -0,0 +1,496 @@ +package egovframework.com.uss.umt.web; + +import java.util.List; +import java.util.Map; + +import egovframework.com.cmm.ComDefaultCodeVO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.cmm.service.EgovCmmUseService; +import egovframework.com.cmm.util.EgovUserDetailsHelper; +import egovframework.com.uss.umt.service.EgovUserManageService; +import egovframework.com.uss.umt.service.UserDefaultVO; +import egovframework.com.uss.umt.service.UserManageVO; +import egovframework.com.utl.sim.service.EgovFileScrty; +import org.egovframe.rte.fdl.property.EgovPropertyService; +import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +import javax.annotation.Resource; + +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.springframework.web.servlet.ModelAndView; +import org.springmodules.validation.commons.DefaultBeanValidator; + +/** + * 업무사용자관련 요청을 비지니스 클래스로 전달하고 처리된결과를 해당 웹 화면으로 전달하는 Controller를 정의한다 + * @author 공통서비스 개발팀 조재영 + * @since 2009.04.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.04.10  조재영          최초 생성
    + *   2011.08.26	 정진오			IncludedInfo annotation 추가
    + *   2014.12.08	 이기하			암호화방식 변경(EgovFileScrty.encryptPassword)
    + *   2015.06.16	 조정국			수정시 유효성체크 후 에러발생 시 목록으로 이동하여 에러메시지 표시
    + *   2015.06.19	 조정국			미인증 사용자에 대한 보안처리 기준 수정 (!isAuthenticated)
    + *   2017.07.21  장동한 			로그인인증제한 작업
    + *
    + * 
    + */ + +@Controller +public class EgovUserManageController { + + /** userManageService */ + @Resource(name = "userManageService") + private EgovUserManageService userManageService; + + /** cmmUseService */ + @Resource(name = "EgovCmmUseService") + private EgovCmmUseService cmmUseService; + + /** EgovPropertyService */ + @Resource(name = "propertiesService") + protected EgovPropertyService propertiesService; + + /** DefaultBeanValidator beanValidator */ + @Autowired + private DefaultBeanValidator beanValidator; + + /** + * 사용자목록을 조회한다. (pageing) + * @param userSearchVO 검색조건정보 + * @param model 화면모델 + * @return cmm/uss/umt/EgovUserManage + * @throws Exception + */ + @IncludedInfo(name = "업무사용자관리", order = 460, gid = 50) + @RequestMapping(value = "/uss/umt/EgovUserManage.do") + public String selectUserList(@ModelAttribute("userSearchVO") UserDefaultVO userSearchVO, ModelMap model) throws Exception { + + // 미인증 사용자에 대한 보안처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "index"; + } + + /** 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()); + + List userList = userManageService.selectUserList(userSearchVO); + model.addAttribute("resultList", userList); + + int totCnt = userManageService.selectUserListTotCnt(userSearchVO); + paginationInfo.setTotalRecordCount(totCnt); + model.addAttribute("paginationInfo", paginationInfo); + + //사용자상태코드를 코드정보로부터 조회 + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + vo.setCodeId("COM013"); + List emplyrSttusCode_result = cmmUseService.selectCmmCodeDetail(vo); + model.addAttribute("emplyrSttusCode_result", emplyrSttusCode_result);//사용자상태코드목록 + + return "egovframework/com/uss/umt/EgovUserManage"; + } + + /** + * 사용자등록화면으로 이동한다. + * @param userSearchVO 검색조건정보 + * @param userManageVO 사용자초기화정보 + * @param model 화면모델 + * @return cmm/uss/umt/EgovUserInsert + * @throws Exception + */ + @RequestMapping("/uss/umt/EgovUserInsertView.do") + public String insertUserView(@ModelAttribute("userSearchVO") UserDefaultVO userSearchVO, @ModelAttribute("userManageVO") UserManageVO userManageVO, Model model) + throws Exception { + + // 미인증 사용자에 대한 보안처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "index"; + } + + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + + //패스워드힌트목록을 코드정보로부터 조회 + vo.setCodeId("COM022"); + List passwordHint_result = cmmUseService.selectCmmCodeDetail(vo); + //성별구분코드를 코드정보로부터 조회 + vo.setCodeId("COM014"); + List sexdstnCode_result = cmmUseService.selectCmmCodeDetail(vo); + //사용자상태코드를 코드정보로부터 조회 + vo.setCodeId("COM013"); + List emplyrSttusCode_result = cmmUseService.selectCmmCodeDetail(vo); + //소속기관코드를 코드정보로부터 조회 - COM025 + vo.setCodeId("COM025"); + List insttCode_result = cmmUseService.selectCmmCodeDetail(vo); + //조직정보를 조회 - ORGNZT_ID정보 + vo.setTableNm("COMTNORGNZTINFO"); + List orgnztId_result = cmmUseService.selectOgrnztIdDetail(vo); + //그룹정보를 조회 - GROUP_ID정보 + vo.setTableNm("COMTNORGNZTINFO"); + List groupId_result = cmmUseService.selectGroupIdDetail(vo); + + model.addAttribute("passwordHint_result", passwordHint_result); //패스워트힌트목록 + model.addAttribute("sexdstnCode_result", sexdstnCode_result); //성별구분코드목록 + model.addAttribute("emplyrSttusCode_result", emplyrSttusCode_result);//사용자상태코드목록 + model.addAttribute("insttCode_result", insttCode_result); //소속기관코드목록 + model.addAttribute("orgnztId_result", orgnztId_result); //조직정보 목록 + model.addAttribute("groupId_result", groupId_result); //그룹정보 목록 + + return "egovframework/com/uss/umt/EgovUserInsert"; + } + + /** + * 사용자등록처리후 목록화면으로 이동한다. + * @param userManageVO 사용자등록정보 + * @param bindingResult 입력값검증용 bindingResult + * @param model 화면모델 + * @return forward:/uss/umt/EgovUserManage.do + * @throws Exception + */ + @RequestMapping("/uss/umt/EgovUserInsert.do") + public String insertUser(@ModelAttribute("userManageVO") UserManageVO userManageVO, BindingResult bindingResult, Model model) throws Exception { + + // 미인증 사용자에 대한 보안처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "index"; + } + + beanValidator.validate(userManageVO, bindingResult); + if (bindingResult.hasErrors()) { + return "egovframework/com/uss/umt/EgovUserInsert"; + } else { + if ("".equals(userManageVO.getOrgnztId())) {//KISA 보안약점 조치 (2018-10-29, 윤창원) + userManageVO.setOrgnztId(null); + } + if ("".equals(userManageVO.getGroupId())) {//KISA 보안약점 조치 (2018-10-29, 윤창원) + userManageVO.setGroupId(null); + } + userManageService.insertUser(userManageVO); + //Exception 없이 진행시 등록성공메시지 + model.addAttribute("resultMsg", "success.common.insert"); + } + return "forward:/uss/umt/EgovUserManage.do"; + } + + /** + * 사용자정보 수정을 위해 사용자정보를 상세조회한다. + * @param uniqId 상세조회대상 사용자아이디 + * @param userSearchVO 검색조건 + * @param model 화면모델 + * @return uss/umt/EgovUserSelectUpdt + * @throws Exception + */ + @RequestMapping("/uss/umt/EgovUserSelectUpdtView.do") + public String updateUserView(@RequestParam("selectedId") String uniqId, @ModelAttribute("searchVO") UserDefaultVO userSearchVO, Model model) throws Exception { + + // 미인증 사용자에 대한 보안처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "index"; + } + + ComDefaultCodeVO vo = new ComDefaultCodeVO(); + + //패스워드힌트목록을 코드정보로부터 조회 + vo.setCodeId("COM022"); + List passwordHint_result = cmmUseService.selectCmmCodeDetail(vo); + //성별구분코드를 코드정보로부터 조회 + vo.setCodeId("COM014"); + List sexdstnCode_result = cmmUseService.selectCmmCodeDetail(vo); + //사용자상태코드를 코드정보로부터 조회 + vo.setCodeId("COM013"); + List emplyrSttusCode_result = cmmUseService.selectCmmCodeDetail(vo); + //소속기관코드를 코드정보로부터 조회 - COM025 + vo.setCodeId("COM025"); + List insttCode_result = cmmUseService.selectCmmCodeDetail(vo); + //조직정보를 조회 - ORGNZT_ID정보 + vo.setTableNm("COMTNORGNZTINFO"); + List orgnztId_result = cmmUseService.selectOgrnztIdDetail(vo); + //그룹정보를 조회 - GROUP_ID정보 + vo.setTableNm("COMTNORGNZTINFO"); + List groupId_result = cmmUseService.selectGroupIdDetail(vo); + + model.addAttribute("passwordHint_result", passwordHint_result); //패스워트힌트목록 + model.addAttribute("sexdstnCode_result", sexdstnCode_result); //성별구분코드목록 + model.addAttribute("emplyrSttusCode_result", emplyrSttusCode_result);//사용자상태코드목록 + model.addAttribute("insttCode_result", insttCode_result); //소속기관코드목록 + model.addAttribute("orgnztId_result", orgnztId_result); //조직정보 목록 + model.addAttribute("groupId_result", groupId_result); //그룹정보 목록 + + UserManageVO userManageVO = new UserManageVO(); + userManageVO = userManageService.selectUser(uniqId); + model.addAttribute("userSearchVO", userSearchVO); + model.addAttribute("userManageVO", userManageVO); + + return "egovframework/com/uss/umt/EgovUserSelectUpdt"; + } + + /** + * 로그인인증제한 해제 + * @param userManageVO 사용자정보 + * @param model 화면모델 + * @return uss/umt/EgovUserSelectUpdtView.do + * @throws Exception + */ + @RequestMapping("/uss/umt/EgovUserLockIncorrect.do") + public String updateLockIncorrect(UserManageVO userManageVO, Model model) + throws Exception { + + // 미인증 사용자에 대한 보안처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "index"; + } + + userManageService.updateLockIncorrect(userManageVO); + + return "forward:/uss/umt/EgovUserSelectUpdtView.do"; + } + + /** + * 사용자정보 수정후 목록조회 화면으로 이동한다. + * @param userManageVO 사용자수정정보 + * @param bindingResult 입력값검증용 bindingResult + * @param model 화면모델 + * @return forward:/uss/umt/EgovUserManage.do + * @throws Exception + */ + @RequestMapping("/uss/umt/EgovUserSelectUpdt.do") + public String updateUser(@ModelAttribute("userManageVO") UserManageVO userManageVO, BindingResult bindingResult, Model model) throws Exception { + + // 미인증 사용자에 대한 보안처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "index"; + } + + beanValidator.validate(userManageVO, bindingResult); + if (bindingResult.hasErrors()) { + model.addAttribute("resultMsg", bindingResult.getAllErrors().get(0).getDefaultMessage()); + return "forward:/uss/umt/EgovUserManage.do"; + } else { + //업무사용자 수정시 히스토리 정보를 등록한다. + userManageService.insertUserHistory(userManageVO); + if ("".equals(userManageVO.getOrgnztId())) {//KISA 보안약점 조치 (2018-10-29, 윤창원) + userManageVO.setOrgnztId(null); + } + if ("".equals(userManageVO.getGroupId())) {//KISA 보안약점 조치 (2018-10-29, 윤창원) + userManageVO.setGroupId(null); + } + userManageService.updateUser(userManageVO); + //Exception 없이 진행시 수정성공메시지 + model.addAttribute("resultMsg", "success.common.update"); + return "forward:/uss/umt/EgovUserManage.do"; + } + } + + /** + * 사용자정보삭제후 목록조회 화면으로 이동한다. + * @param checkedIdForDel 삭제대상아이디 정보 + * @param userSearchVO 검색조건 + * @param model 화면모델 + * @return forward:/uss/umt/EgovUserManage.do + * @throws Exception + */ + @RequestMapping("/uss/umt/EgovUserDelete.do") + public String deleteUser(@RequestParam("checkedIdForDel") String checkedIdForDel, @ModelAttribute("searchVO") UserDefaultVO userSearchVO, Model model) throws Exception { + + // 미인증 사용자에 대한 보안처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "index"; + } + + userManageService.deleteUser(checkedIdForDel); + //Exception 없이 진행시 등록성공메시지 + model.addAttribute("resultMsg", "success.common.delete"); + return "forward:/uss/umt/EgovUserManage.do"; + } + + /** + * 입력한 사용자아이디의 중복확인화면 이동 + * @param model 화면모델 + * @return uss/umt/EgovIdDplctCnfirm + * @throws Exception + */ + @RequestMapping(value = "/uss/umt/EgovIdDplctCnfirmView.do") + public String checkIdDplct(ModelMap model) throws Exception { + + // 미인증 사용자에 대한 보안처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "index"; + } + + model.addAttribute("checkId", ""); + model.addAttribute("usedCnt", "-1"); + return "egovframework/com/uss/umt/EgovIdDplctCnfirm"; + } + + /** + * 입력한 사용자아이디의 중복여부를 체크하여 사용가능여부를 확인 + * @param commandMap 파라메터전달용 commandMap + * @param model 화면모델 + * @return uss/umt/EgovIdDplctCnfirm + * @throws Exception + */ + @RequestMapping(value = "/uss/umt/EgovIdDplctCnfirm.do") + public String checkIdDplct(@RequestParam Map commandMap, ModelMap model) throws Exception { + + // 미인증 사용자에 대한 보안처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "index"; + } + + String checkId = (String) commandMap.get("checkId"); + checkId = new String(checkId.getBytes("ISO-8859-1"), "UTF-8"); + + if (checkId == null || checkId.equals("")) + return "forward:/uss/umt/EgovIdDplctCnfirmView.do"; + + int usedCnt = userManageService.checkIdDplct(checkId); + model.addAttribute("usedCnt", usedCnt); + model.addAttribute("checkId", checkId); + + return "egovframework/com/uss/umt/EgovIdDplctCnfirm"; + } + + + /** + * 입력한 사용자아이디의 중복여부를 체크하여 사용가능여부를 확인 + * @param commandMap 파라메터전달용 commandMap + * @param model 화면모델 + * @return uss/umt/EgovIdDplctCnfirm + * @throws Exception + */ + @RequestMapping(value = "/uss/umt/EgovIdDplctCnfirmAjax.do") + public ModelAndView checkIdDplctAjax(@RequestParam Map commandMap) throws Exception { + + ModelAndView modelAndView = new ModelAndView(); + modelAndView.setViewName("jsonView"); + + String checkId = (String) commandMap.get("checkId"); + //checkId = new String(checkId.getBytes("ISO-8859-1"), "UTF-8"); + + int usedCnt = userManageService.checkIdDplct(checkId); + modelAndView.addObject("usedCnt", usedCnt); + modelAndView.addObject("checkId", checkId); + + return modelAndView; + } + + /** + * 업무사용자 암호 수정처리 후 화면 이동 + * @param model 화면모델 + * @param commandMap 파라메터전달용 commandMap + * @param userSearchVO 검색조 건 + * @param userManageVO 사용자수정정보(비밀번호) + * @return uss/umt/EgovUserPasswordUpdt + * @throws Exception + */ + @RequestMapping(value = "/uss/umt/EgovUserPasswordUpdt.do") + public String updatePassword(ModelMap model, @RequestParam Map commandMap, @ModelAttribute("searchVO") UserDefaultVO userSearchVO, + @ModelAttribute("userManageVO") UserManageVO userManageVO) throws Exception { + + // 미인증 사용자에 대한 보안처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "index"; + } + + String oldPassword = (String) commandMap.get("oldPassword"); + String newPassword = (String) commandMap.get("newPassword"); + String newPassword2 = (String) commandMap.get("newPassword2"); + String uniqId = (String) commandMap.get("uniqId"); + + boolean isCorrectPassword = false; + UserManageVO resultVO = new UserManageVO(); + userManageVO.setPassword(newPassword); + userManageVO.setOldPassword(oldPassword); + userManageVO.setUniqId(uniqId); + + String resultMsg = ""; + resultVO = userManageService.selectPassword(userManageVO); + //패스워드 암호화 + String encryptPass = EgovFileScrty.encryptPassword(oldPassword, userManageVO.getEmplyrId()); + if (encryptPass.equals(resultVO.getPassword())) { + if (newPassword.equals(newPassword2)) { + isCorrectPassword = true; + } else { + isCorrectPassword = false; + resultMsg = "fail.user.passwordUpdate2"; + } + } else { + isCorrectPassword = false; + resultMsg = "fail.user.passwordUpdate1"; + } + + if (isCorrectPassword) { + userManageVO.setPassword(EgovFileScrty.encryptPassword(newPassword, userManageVO.getEmplyrId())); + userManageService.updatePassword(userManageVO); + model.addAttribute("userManageVO", userManageVO); + resultMsg = "success.common.update"; + } else { + model.addAttribute("userManageVO", userManageVO); + } + model.addAttribute("userSearchVO", userSearchVO); + model.addAttribute("resultMsg", resultMsg); + + return "egovframework/com/uss/umt/EgovUserPasswordUpdt"; + } + + /** + * 업무사용자 암호 수정 화면 이동 + * @param model 화면모델 + * @param commandMap 파라메터전달용 commandMap + * @param userSearchVO 검색조건 + * @param userManageVO 사용자수정정보(비밀번호) + * @return uss/umt/EgovUserPasswordUpdt + * @throws Exception + */ + @RequestMapping(value = "/uss/umt/EgovUserPasswordUpdtView.do") + public String updatePasswordView(ModelMap model, @RequestParam Map commandMap, @ModelAttribute("searchVO") UserDefaultVO userSearchVO, + @ModelAttribute("userManageVO") UserManageVO userManageVO) throws Exception { + + // 미인증 사용자에 대한 보안처리 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (!isAuthenticated) { + return "index"; + } + + String userTyForPassword = (String) commandMap.get("userTyForPassword"); + userManageVO.setUserTy(userTyForPassword); + + model.addAttribute("userManageVO", userManageVO); + model.addAttribute("userSearchVO", userSearchVO); + return "egovframework/com/uss/umt/EgovUserPasswordUpdt"; + } + +} diff --git a/src/main/java/egovframework/com/utl/fcc/service/EgovDateFormat.java b/src/main/java/egovframework/com/utl/fcc/service/EgovDateFormat.java new file mode 100644 index 0000000..53c9428 --- /dev/null +++ b/src/main/java/egovframework/com/utl/fcc/service/EgovDateFormat.java @@ -0,0 +1,146 @@ +package egovframework.com.utl.fcc.service; + +import java.text.DateFormat; +import java.util.Date; +import java.util.Locale; + +/** + * 날짜 및 시간에 대한 변환을 수행하는 클래스 + */ +public class EgovDateFormat { + + /** + * 기본 Locale에 해당하는 형식으로 날짜를 변환한다. + * + * @param date 날짜 + * @return 날짜 문자열 + */ + public static String formatDate(Date date) { + return DateFormat.getDateInstance().format(date); + } + + /** + * Locale에 해당하는 형식으로 날짜를 변환한다. + * + * @param locale 로케일 + * @param date 날짜 + * @return 날짜 문자열 + */ + public static String formatDate(Locale locale, Date date) { + return DateFormat.getDateInstance(DateFormat.DEFAULT, locale).format(date); + } + + /** + * 주어진 스타일에 따라, 기본 Locale에 해당하는 형식으로 날짜를 변환한다. + * + * @param style 날짜 스타일 (사용 가능한 값 : {@link DateFormat#FULL}, {@link DateFormat#LONG}, {@link DateFormat#MEDIUM}, {@link DateFormat#SHORT}, {@link DateFormat#DEFAULT}) + * @param date 날짜 + * @return 날짜 문자열 + */ + public static String formatDate(int style, Date date) { + return DateFormat.getDateInstance(style).format(date); + } + + /** + * 주어진 스타일에 따라, Locale에 해당하는 형식으로 날짜를 변환한다. + * + * @param style 날짜 스타일 (사용 가능한 값 : {@link DateFormat#FULL}, {@link DateFormat#LONG}, {@link DateFormat#MEDIUM}, {@link DateFormat#SHORT}, {@link DateFormat#DEFAULT}) + * @param locale 로케일 + * @param date 날짜 + * @return 날짜 문자열 + */ + public static String formatDate(int style, Locale locale, Date date) { + return DateFormat.getDateInstance(style, locale).format(date); + } + + /** + * 기본 Locale에 해당하는 형식으로 날짜 및 시간을 변환한다. + * + * @param date 날짜 및 시간 + * @return 날짜 및 시간 문자열 + */ + public static String formatDateTime(Date date) { + return DateFormat.getDateTimeInstance().format(date); + } + + /** + * Locale에 해당하는 형식으로 날짜 및 시간을 변환한다. + * + * @param locale 로케일 + * @param date 날짜 및 시간 + * @return 날짜 및 시간 문자열 + */ + public static String formatDateTime(Locale locale, Date date) { + return DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, locale).format(date); + } + + /** + * 주어진 스타일에 따라, 기본 Locale에 해당하는 형식으로 날짜 및 시간을 변환한다. + * + * @param dateStyle 날짜 스타일 (사용 가능한 값 : {@link DateFormat#FULL}, {@link DateFormat#LONG}, {@link DateFormat#MEDIUM}, {@link DateFormat#SHORT}, {@link DateFormat#DEFAULT}) + * @param timeStyle 시간 스타일 (사용 가능한 값 : {@link DateFormat#FULL}, {@link DateFormat#LONG}, {@link DateFormat#MEDIUM}, {@link DateFormat#SHORT}, {@link DateFormat#DEFAULT}) + * @param date 날짜 및 시간 + * @return 날짜 및 시간 문자열 + */ + public static String formatDateTime(int dateStyle, int timeStyle, Date date) { + return DateFormat.getDateTimeInstance(dateStyle, timeStyle).format(date); + } + + /** + * 주어진 스타일에 따라, Locale에 해당하는 형식으로 날짜 및 시간을 변환한다. + * + * @param dateStyle 날짜 스타일 (사용 가능한 값 : {@link DateFormat#FULL}, {@link DateFormat#LONG}, {@link DateFormat#MEDIUM}, {@link DateFormat#SHORT}, {@link DateFormat#DEFAULT}) + * @param timeStyle 시간 스타일 (사용 가능한 값 : {@link DateFormat#FULL}, {@link DateFormat#LONG}, {@link DateFormat#MEDIUM}, {@link DateFormat#SHORT}, {@link DateFormat#DEFAULT}) + * @param locale 로케일 + * @param date 날짜 및 시간 + * @return 날짜 및 시간 문자열 + */ + public static String formatDateTime(int dateStyle, int timeStyle, Locale locale, Date date) { + return DateFormat.getDateTimeInstance(dateStyle, timeStyle, locale).format(date); + } + + /** + * 기본 Locale에 해당하는 형식으로 시간을 변환한다. + * + * @param date 시간 + * @return 시간 문자열 + */ + public static String formatTime(Date date) { + return DateFormat.getTimeInstance().format(date); + } + + /** + * Locale에 해당하는 형식으로 시간을 변환한다. + * + * @param locale 로케일 + * @param date 시간 + * @return 시간 문자열 + */ + public static String formatTime(Locale locale, Date date) { + return DateFormat.getTimeInstance(DateFormat.DEFAULT, locale).format(date); + } + + /** + * 주어진 스타일에 따라, 기본 Locale에 해당하는 형식으로 시간을 변환한다. + * + * @param style 시간 스타일 (사용 가능한 값 : {@link DateFormat#FULL}, {@link DateFormat#LONG}, {@link DateFormat#MEDIUM}, {@link DateFormat#SHORT}, {@link DateFormat#DEFAULT}) + * @param date 시간 + * @return 시간 문자열 + */ + public static String formatTime(int style, Date date) { + return DateFormat.getTimeInstance(style).format(date); + } + + /** + * 주어진 스타일에 따라, Locale에 해당하는 형식으로 시간을 변환한다. + * + * @param style 시간 스타일 (사용 가능한 값 : {@link DateFormat#FULL}, {@link DateFormat#LONG}, {@link DateFormat#MEDIUM}, {@link DateFormat#SHORT}, {@link DateFormat#DEFAULT}) + * @param locale 로케일 + * @param date 시간 + * @return 시간 문자열 + */ + public static String formatTime(int style, Locale locale, Date date) { + return DateFormat.getTimeInstance(style, locale).format(date); + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/utl/fcc/service/EgovDateUtil.java b/src/main/java/egovframework/com/utl/fcc/service/EgovDateUtil.java new file mode 100644 index 0000000..91c5857 --- /dev/null +++ b/src/main/java/egovframework/com/utl/fcc/service/EgovDateUtil.java @@ -0,0 +1,865 @@ +package egovframework.com.utl.fcc.service; + +import java.security.SecureRandom; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; +import java.util.TimeZone; + +import com.ibm.icu.util.ChineseCalendar; + +/** + * + * Date 에 대한 Util 클래스 + * @author 공통서비스 개발팀 이중호 + * @since 2009.02.01 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.02.01  이중호          최초 생성
    + *
    + * 
    + */ +public class EgovDateUtil { + + /** + *

    yyyyMMdd 혹은 yyyy-MM-dd 형식의 날짜 문자열을 입력 받아 년, 월, 일을 + * 증감한다. 년, 월, 일은 가감할 수를 의미하며, 음수를 입력할 경우 감한다.

    + * + *
    +	 * DateUtil.addYearMonthDay("19810828", 0, 0, 19)  = "19810916"
    +	 * DateUtil.addYearMonthDay("20060228", 0, 0, -10) = "20060218"
    +	 * DateUtil.addYearMonthDay("20060228", 0, 0, 10)  = "20060310"
    +	 * DateUtil.addYearMonthDay("20060228", 0, 0, 32)  = "20060401"
    +	 * DateUtil.addYearMonthDay("20050331", 0, -1, 0)  = "20050228"
    +	 * DateUtil.addYearMonthDay("20050301", 0, 2, 30)  = "20050531"
    +	 * DateUtil.addYearMonthDay("20050301", 1, 2, 30)  = "20060531"
    +	 * DateUtil.addYearMonthDay("20040301", 2, 0, 0)   = "20060301"
    +	 * DateUtil.addYearMonthDay("20040229", 2, 0, 0)   = "20060228"
    +	 * DateUtil.addYearMonthDay("20040229", 2, 0, 1)   = "20060301"
    +	 * 
    + * + * @param dateStr 날짜 문자열(yyyyMMdd, yyyy-MM-dd의 형식) + * @param year 가감할 년. 0이 입력될 경우 가감이 없다 + * @param month 가감할 월. 0이 입력될 경우 가감이 없다 + * @param day 가감할 일. 0이 입력될 경우 가감이 없다 + * @return yyyyMMdd 형식의 날짜 문자열 + * @throws IllegalArgumentException 날짜 포맷이 정해진 바와 다를 경우. + * 입력 값이 null인 경우. + */ + public static String addYearMonthDay(String sDate, int year, int month, int day) { + + String dateStr = validChkDate(sDate); + + Calendar cal = Calendar.getInstance(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd", Locale.getDefault()); + try { + cal.setTime(sdf.parse(dateStr)); + } catch (ParseException e) { + throw new IllegalArgumentException("Invalid date format: " + dateStr); + } + + if (year != 0) { + cal.add(Calendar.YEAR, year); + } + if (month != 0) { + cal.add(Calendar.MONTH, month); + } + if (day != 0) { + cal.add(Calendar.DATE, day); + } + + return sdf.format(cal.getTime()); + } + + /** + *

    yyyyMMdd 혹은 yyyy-MM-dd 형식의 날짜 문자열을 입력 받아 년을 + * 증감한다. year는 가감할 수를 의미하며, 음수를 입력할 경우 감한다.

    + * + *
    +	 * DateUtil.addYear("20000201", 62)  = "20620201"
    +	 * DateUtil.addYear("20620201", -62) = "20000201"
    +	 * DateUtil.addYear("20040229", 2)   = "20060228"
    +	 * DateUtil.addYear("20060228", -2)  = "20040228"
    +	 * DateUtil.addYear("19000101", 200) = "21000101"
    +	 * 
    + * + * @param dateStr 날짜 문자열(yyyyMMdd, yyyy-MM-dd의 형식) + * @param year 가감할 년. 0이 입력될 경우 가감이 없다 + * @return yyyyMMdd 형식의 날짜 문자열 + * @throws IllegalArgumentException 날짜 포맷이 정해진 바와 다를 경우. + * 입력 값이 null인 경우. + */ + public static String addYear(String dateStr, int year) { + return addYearMonthDay(dateStr, year, 0, 0); + } + + /** + *

    yyyyMMdd 혹은 yyyy-MM-dd 형식의 날짜 문자열을 입력 받아 월을 + * 증감한다. month는 가감할 수를 의미하며, 음수를 입력할 경우 감한다.

    + * + *
    +	 * DateUtil.addMonth("20010201", 12)  = "20020201"
    +	 * DateUtil.addMonth("19800229", 12)  = "19810228"
    +	 * DateUtil.addMonth("20040229", 12)  = "20050228"
    +	 * DateUtil.addMonth("20050228", -12) = "20040228"
    +	 * DateUtil.addMonth("20060131", 1)   = "20060228"
    +	 * DateUtil.addMonth("20060228", -1)  = "20060128"
    +	 * 
    + * + * @param dateStr 날짜 문자열(yyyyMMdd, yyyy-MM-dd의 형식) + * @param month 가감할 월. 0이 입력될 경우 가감이 없다 + * @return yyyyMMdd 형식의 날짜 문자열 + * @throws IllegalArgumentException 날짜 포맷이 정해진 바와 다를 경우. + * 입력 값이 null인 경우. + */ + public static String addMonth(String dateStr, int month) { + return addYearMonthDay(dateStr, 0, month, 0); + } + + /** + *

    yyyyMMdd 혹은 yyyy-MM-dd 형식의 날짜 문자열을 입력 받아 일(day)를 + * 증감한다. day는 가감할 수를 의미하며, 음수를 입력할 경우 감한다. + *

    + * 위에 정의된 addDays 메서드는 사용자가 ParseException을 반드시 처리해야 하는 불편함이 + * 있기 때문에 추가된 메서드이다.

    + * + *
    +	 * DateUtil.addDay("19991201", 62) = "20000201"
    +	 * DateUtil.addDay("20000201", -62) = "19991201"
    +	 * DateUtil.addDay("20050831", 3) = "20050903"
    +	 * DateUtil.addDay("20050831", 3) = "20050903"
    +	 * // 2006년 6월 31일은 실제로 존재하지 않는 날짜이다 -> 20060701로 간주된다
    +	 * DateUtil.addDay("20060631", 1) = "20060702"
    +	 * 
    + * + * @param dateStr 날짜 문자열(yyyyMMdd, yyyy-MM-dd의 형식) + * @param day 가감할 일. 0이 입력될 경우 가감이 없다 + * @return yyyyMMdd 형식의 날짜 문자열 + * @throws IllegalArgumentException 날짜 포맷이 정해진 바와 다를 경우. + * 입력 값이 null인 경우. + */ + public static String addDay(String dateStr, int day) { + return addYearMonthDay(dateStr, 0, 0, day); + } + + /** + *

    yyyyMMdd 혹은 yyyy-MM-dd 형식의 날짜 문자열 dateStr1 + * dateStr2 사이의 일 수를 구한다.
    + * dateStr2dateStr1 보다 과거 날짜일 경우에는 + * 음수를 반환한다. 동일한 경우에는 0을 반환한다.

    + * + *
    +	 * DateUtil.getDaysDiff("20060228","20060310") = 10
    +	 * DateUtil.getDaysDiff("20060101","20070101") = 365
    +	 * DateUtil.getDaysDiff("19990228","19990131") = -28
    +	 * DateUtil.getDaysDiff("20060801","20060802") = 1
    +	 * DateUtil.getDaysDiff("20060801","20060801") = 0
    +	 * 
    + * + * @param dateStr1 날짜 문자열(yyyyMMdd, yyyy-MM-dd의 형식) + * @param dateStr2 날짜 문자열(yyyyMMdd, yyyy-MM-dd의 형식) + * @return 일 수 차이. + * @throws IllegalArgumentException 날짜 포맷이 정해진 바와 다를 경우. + * 입력 값이 null인 경우. + */ + public static int getDaysDiff(String sDate1, String sDate2) { + String dateStr1 = validChkDate(sDate1); + String dateStr2 = validChkDate(sDate2); + + if (!checkDate(sDate1) || !checkDate(sDate2)) { + throw new IllegalArgumentException("Invalid date format: args[0]=" + sDate1 + " args[1]=" + sDate2); + } + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd", Locale.getDefault()); + + Date date1 = null; + Date date2 = null; + try { + date1 = sdf.parse(dateStr1); + date2 = sdf.parse(dateStr2); + } catch (ParseException e) { + throw new IllegalArgumentException("Invalid date format: args[0]=" + dateStr1 + " args[1]=" + dateStr2); + } + + if (date1 != null && date2 != null) { + int days1 = (int) ((date1.getTime() / 3600000) / 24); + int days2 = (int) ((date2.getTime() / 3600000) / 24); + return days2 - days1; + } else { + return 0; + } + + } + + /** + *

    yyyyMMdd 혹은 yyyy-MM-dd 형식의 날짜 문자열을 입력 받아 유효한 날짜인지 검사.

    + * + *
    +	 * DateUtil.checkDate("1999-02-35") = false
    +	 * DateUtil.checkDate("2000-13-31") = false
    +	 * DateUtil.checkDate("2006-11-31") = false
    +	 * DateUtil.checkDate("2006-2-28")  = false
    +	 * DateUtil.checkDate("2006-2-8")   = false
    +	 * DateUtil.checkDate("20060228")   = true
    +	 * DateUtil.checkDate("2006-02-28") = true
    +	 * 
    + * + * @param dateStr 날짜 문자열(yyyyMMdd, yyyy-MM-dd의 형식) + * @return 유효한 날짜인지 여부 + */ + public static boolean checkDate(String sDate) { + String dateStr = validChkDate(sDate); + + String year = dateStr.substring(0, 4); + String month = dateStr.substring(4, 6); + String day = dateStr.substring(6); + + return checkDate(year, month, day); + } + + /** + *

    입력한 년, 월, 일이 유효한지 검사.

    + * + * @param year 연도 + * @param month 월 + * @param day 일 + * @return 유효한 날짜인지 여부 + */ + public static boolean checkDate(String year, String month, String day) { + try { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy.MM.dd", Locale.getDefault()); + + Date result = formatter.parse(year + "." + month + "." + day); + String resultStr = formatter.format(result); + if (resultStr.equalsIgnoreCase(year + "." + month + "." + day)) + return true; + else + return false; + } catch (ParseException e) { + return false; + } + } + + /** + * 날짜형태의 String의 날짜 포맷 및 TimeZone을 변경해 주는 메서드 + * + * @param strSource 바꿀 날짜 String + * @param fromDateFormat 기존의 날짜 형태 + * @param toDateFormat 원하는 날짜 형태 + * @param strTimeZone 변경할 TimeZone(""이면 변경 안함) + * @return 소스 String의 날짜 포맷을 변경한 String + */ + public static String convertDate(String strSource, String fromDateFormat, String toDateFormat, String strTimeZone) { + SimpleDateFormat simpledateformat = null; + Date date = null; + String fromFormat = ""; + String toFormat = ""; + + if (EgovStringUtil.isNullToString(strSource).trim().equals("")) { + return ""; + } + if (EgovStringUtil.isNullToString(fromDateFormat).trim().equals("")) + fromFormat = "yyyyMMddHHmmss"; // default값 + if (EgovStringUtil.isNullToString(toDateFormat).trim().equals("")) + toFormat = "yyyy-MM-dd HH:mm:ss"; // default값 + + try { + simpledateformat = new SimpleDateFormat(fromFormat, Locale.getDefault()); + date = simpledateformat.parse(strSource); + if (!EgovStringUtil.isNullToString(strTimeZone).trim().equals("")) { + simpledateformat.setTimeZone(TimeZone.getTimeZone(strTimeZone)); + } + simpledateformat = new SimpleDateFormat(toFormat, Locale.getDefault()); + } catch (ParseException exception) { + throw new RuntimeException(exception); + } + + return simpledateformat.format(date); + + } + + /** + * yyyyMMdd 형식의 날짜문자열을 원하는 캐릭터(ch)로 쪼개 돌려준다
    + *
    +	* ex) 20030405, ch(.) -> 2003.04.05
    +	* ex) 200304, ch(.) -> 2003.04
    +	* ex) 20040101,ch(/) --> 2004/01/01 로 리턴
    +	* 
    + * + * @param date yyyyMMdd 형식의 날짜문자열 + * @param ch 구분자 + * @return 변환된 문자열 + */ + public static String formatDate(String sDate, String ch) { + String dateStr = validChkDate(sDate); + + String str = dateStr.trim(); + String yyyy = ""; + String mm = ""; + String dd = ""; + + if (str.length() == 8) { + yyyy = str.substring(0, 4); + if (yyyy.equals("0000")) { + return ""; + } + + mm = str.substring(4, 6); + if (mm.equals("00")) { + return yyyy; + } + + dd = str.substring(6, 8); + if (dd.equals("00")) { + return yyyy + ch + mm; + } + + return yyyy + ch + mm + ch + dd; + + } else if (str.length() == 6) { + yyyy = str.substring(0, 4); + if (yyyy.equals("0000")) { + return ""; + } + + mm = str.substring(4, 6); + if (mm.equals("00")) { + return yyyy; + } + + return yyyy + ch + mm; + + } else if (str.length() == 4) { + yyyy = str.substring(0, 4); + if (yyyy.equals("0000")) { + return ""; + } else { + return yyyy; + } + } else { + return ""; + } + } + + /** + * HH24MISS 형식의 시간문자열을 원하는 캐릭터(ch)로 쪼개 돌려준다
    + *
    +	 *     ex) 151241, ch(/) -> 15/12/31
    +	 * 
    + * + * @param str HH24MISS 형식의 시간문자열 + * @param ch 구분자 + * @return 변환된 문자열 + */ + public static String formatTime(String sTime, String ch) { + String timeStr = validChkTime(sTime); + return timeStr.substring(0, 2) + ch + timeStr.substring(2, 4) + ch + timeStr.substring(4, 6); + } + + /** + * 연도를 입력 받아 해당 연도 2월의 말일(일수)를 문자열로 반환한다. + * + * @param year + * @return 해당 연도 2월의 말일(일수) + */ + public String leapYear(int year) { + if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) { + return "29"; + } + + return "28"; + } + + /** + *

    입력받은 연도가 윤년인지 아닌지 검사한다.

    + * + *
    +	 * DateUtil.isLeapYear(2004) = false
    +	 * DateUtil.isLeapYear(2005) = true
    +	 * DateUtil.isLeapYear(2006) = true
    +	 * 
    + * + * @param year 연도 + * @return 윤년 여부 + */ + public static boolean isLeapYear(int year) { + if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) { + return false; + } + return true; + } + + /** + * 현재(한국기준) 날짜정보를 얻는다.
    + * 표기법은 yyyy-mm-dd
    + * @return String yyyymmdd형태의 현재 한국시간.
    + */ + public static String getToday() { + return getCurrentDate(""); + } + + /** + * 현재(한국기준) 날짜정보를 얻는다.
    + * 표기법은 yyyy-mm-dd
    + * @return String yyyymmdd형태의 현재 한국시간.
    + */ + public static String getCurrentDate(String dateType) { + Calendar aCalendar = Calendar.getInstance(); + + int year = aCalendar.get(Calendar.YEAR); + int month = aCalendar.get(Calendar.MONTH) + 1; + int date = aCalendar.get(Calendar.DATE); + String strDate = Integer.toString(year) + + ((month < 10) ? "0" + Integer.toString(month) : Integer.toString(month)) + + ((date < 10) ? "0" + Integer.toString(date) : Integer.toString(date)); + + if (!"".equals(dateType)) { + strDate = convertDate(strDate, "yyyyMMdd", dateType); + } + + return strDate; + } + + /** + * 날짜형태의 String의 날짜 포맷만을 변경해 주는 메서드 + * @param sDate 날짜 + * @param sTime 시간 + * @param sFormatStr 포멧 스트링 문자열 + * @return 지정한 날짜/시간을 지정한 포맷으로 출력 + * @See Letter Date or Time Component Presentation Examples + G Era designator Text AD + y Year Year 1996; 96 + M Month in year Month July; Jul; 07 + w Week in year Number 27 + W Week in month Number 2 + D Day in year Number 189 + d Day in month Number 10 + F Day of week in month Number 2 + E Day in week Text Tuesday; Tue + a Am/pm marker Text PM + H Hour in day (0-23) Number 0 + k Hour in day (1-24) Number 24 + K Hour in am/pm (0-11) Number 0 + h Hour in am/pm (1-12) Number 12 + m Minute in hour Number 30 + s Second in minute Number 55 + S Millisecond Number 978 + z Time zone General time zone Pacific Standard Time; PST; GMT-08:00 + Z Time zone RFC 822 time zone -0800 + + Date and Time Pattern Result + "yyyy.MM.dd G 'at' HH:mm:ss z" 2001.07.04 AD at 12:08:56 PDT + "EEE, MMM d, ''yy" Wed, Jul 4, '01 + "h:mm a" 12:08 PM + "hh 'o''clock' a, zzzz" 12 o'clock PM, Pacific Daylight Time + "K:mm a, z" 0:08 PM, PDT + "yyyyy.MMMMM.dd GGG hh:mm aaa" 02001.July.04 AD 12:08 PM + "EEE, d MMM yyyy HH:mm:ss Z" Wed, 4 Jul 2001 12:08:56 -0700 + "yyMMddHHmmssZ" 010704120856-0700 + + */ + public static String convertDate(String sDate, String sTime, String sFormatStr) { + String dateStr = validChkDate(sDate); + String timeStr = validChkTime(sTime); + + Calendar cal = null; + cal = Calendar.getInstance(); + + cal.set(Calendar.YEAR, Integer.parseInt(dateStr.substring(0, 4))); + cal.set(Calendar.MONTH, Integer.parseInt(dateStr.substring(4, 6)) - 1); + cal.set(Calendar.DAY_OF_MONTH, Integer.parseInt(dateStr.substring(6, 8))); + cal.set(Calendar.HOUR_OF_DAY, Integer.parseInt(timeStr.substring(0, 2))); + cal.set(Calendar.MINUTE, Integer.parseInt(timeStr.substring(2, 4))); + + SimpleDateFormat sdf = new SimpleDateFormat(sFormatStr, Locale.ENGLISH); + + return sdf.format(cal.getTime()); + } + + /** + * 입력받은 일자 사이의 임의의 일자를 반환 + * @param sDate1 시작일자 + * @param sDate2 종료일자 + * @return 임의일자 + */ + public static String getRandomDate(String sDate1, String sDate2) { + String dateStr1 = validChkDate(sDate1); + String dateStr2 = validChkDate(sDate2); + + String randomDate = null; + + int sYear, sMonth, sDay; + int eYear, eMonth, eDay; + + sYear = Integer.parseInt(dateStr1.substring(0, 4)); + sMonth = Integer.parseInt(dateStr1.substring(4, 6)); + sDay = Integer.parseInt(dateStr1.substring(6, 8)); + + eYear = Integer.parseInt(dateStr2.substring(0, 4)); + eMonth = Integer.parseInt(dateStr2.substring(4, 6)); + eDay = Integer.parseInt(dateStr2.substring(6, 8)); + + GregorianCalendar beginDate = new GregorianCalendar(sYear, sMonth - 1, sDay, 0, 0); + GregorianCalendar endDate = new GregorianCalendar(eYear, eMonth - 1, eDay, 23, 59); + + if (endDate.getTimeInMillis() < beginDate.getTimeInMillis()) { + throw new IllegalArgumentException("Invalid input date : " + sDate1 + "~" + sDate2); + } + + SecureRandom r = new SecureRandom(); + + r.setSeed(new Date().getTime()); + + long rand = ((r.nextLong() >>> 1) % (endDate.getTimeInMillis() - beginDate.getTimeInMillis() + 1)) + beginDate.getTimeInMillis(); + + GregorianCalendar cal = new GregorianCalendar(); + //SimpleDateFormat calformat = new SimpleDateFormat("yyyy-MM-dd"); + SimpleDateFormat calformat = new SimpleDateFormat("yyyyMMdd", Locale.ENGLISH); + cal.setTimeInMillis(rand); + randomDate = calformat.format(cal.getTime()); + + // 랜덤문자열를 리턴 + return randomDate; + } + + /** + * 입력받은 양력일자를 변환하여 음력일자로 반환 + * @param sDate 양력일자 + * @return 음력일자 + */ + public static Map toLunar(String sDate) { + String dateStr = validChkDate(sDate); + + Map hm = new HashMap(); + hm.put("day", ""); + hm.put("leap", "0"); + + if (dateStr.length() != 8) { + return hm; + } + + Calendar cal; + ChineseCalendar lcal; + + cal = Calendar.getInstance(); + lcal = new ChineseCalendar(); + + cal.set(Calendar.YEAR, Integer.parseInt(dateStr.substring(0, 4))); + cal.set(Calendar.MONTH, Integer.parseInt(dateStr.substring(4, 6)) - 1); + cal.set(Calendar.DAY_OF_MONTH, Integer.parseInt(dateStr.substring(6, 8))); + + lcal.setTimeInMillis(cal.getTimeInMillis()); + + String year = String.valueOf(lcal.get(ChineseCalendar.EXTENDED_YEAR) - 2637); + String month = String.valueOf(lcal.get(ChineseCalendar.MONTH) + 1); + String day = String.valueOf(lcal.get(ChineseCalendar.DAY_OF_MONTH)); + String leap = String.valueOf(lcal.get(ChineseCalendar.IS_LEAP_MONTH)); + + String pad4Str = "0000"; + String pad2Str = "00"; + + String retYear = (pad4Str + year).substring(year.length()); + String retMonth = (pad2Str + month).substring(month.length()); + String retDay = (pad2Str + day).substring(day.length()); + + String SDay = retYear + retMonth + retDay; + + hm.put("day", SDay); + hm.put("leap", leap); + + return hm; + } + + /** + * 입력받은 음력일자를 변환하여 양력일자로 반환 + * @param sDate 음력일자 + * @param iLeapMonth 음력윤달여부(IS_LEAP_MONTH) + * @return 양력일자 + */ + public static String toSolar(String sDate, int iLeapMonth) { + String dateStr = validChkDate(sDate); + + Calendar cal; + ChineseCalendar lcal; + + cal = Calendar.getInstance(); + lcal = new ChineseCalendar(); + + lcal.set(ChineseCalendar.EXTENDED_YEAR, Integer.parseInt(dateStr.substring(0, 4)) + 2637); + lcal.set(ChineseCalendar.MONTH, Integer.parseInt(dateStr.substring(4, 6)) - 1); + lcal.set(ChineseCalendar.DAY_OF_MONTH, Integer.parseInt(dateStr.substring(6, 8))); + lcal.set(ChineseCalendar.IS_LEAP_MONTH, iLeapMonth); + + cal.setTimeInMillis(lcal.getTimeInMillis()); + + String year = String.valueOf(cal.get(Calendar.YEAR)); + String month = String.valueOf(cal.get(Calendar.MONTH) + 1); + String day = String.valueOf(cal.get(Calendar.DAY_OF_MONTH)); + + String pad4Str = "0000"; + String pad2Str = "00"; + + String retYear = (pad4Str + year).substring(year.length()); + String retMonth = (pad2Str + month).substring(month.length()); + String retDay = (pad2Str + day).substring(day.length()); + + return retYear + retMonth + retDay; + } + + /** + * 입력받은 요일의 영문명을 국문명의 요일로 반환 + * @param sWeek 영문 요일명 + * @return 국문 요일명 + */ + public static String convertWeek(String sWeek) { + String retStr = null; + + if (sWeek.equals("SUN")) { + retStr = "일요일"; + } else if (sWeek.equals("MON")) { + retStr = "월요일"; + } else if (sWeek.equals("TUE")) { + retStr = "화요일"; + } else if (sWeek.equals("WED")) { + retStr = "수요일"; + } else if (sWeek.equals("THR")) { + retStr = "목요일"; + } else if (sWeek.equals("FRI")) { + retStr = "금요일"; + } else if (sWeek.equals("SAT")) { + retStr = "토요일"; + } + + return retStr; + } + + /** + * 입력일자의 유효 여부를 확인 + * @param sDate 일자 + * @return 유효 여부 + */ + public static boolean validDate(String sDate) { + String dateStr = validChkDate(sDate); + + Calendar cal; + boolean ret = false; + + cal = Calendar.getInstance(); + + cal.set(Calendar.YEAR, Integer.parseInt(dateStr.substring(0, 4))); + cal.set(Calendar.MONTH, Integer.parseInt(dateStr.substring(4, 6)) - 1); + cal.set(Calendar.DAY_OF_MONTH, Integer.parseInt(dateStr.substring(6, 8))); + + String year = String.valueOf(cal.get(Calendar.YEAR)); + String month = String.valueOf(cal.get(Calendar.MONTH) + 1); + String day = String.valueOf(cal.get(Calendar.DAY_OF_MONTH)); + + String pad4Str = "0000"; + String pad2Str = "00"; + + String retYear = (pad4Str + year).substring(year.length()); + String retMonth = (pad2Str + month).substring(month.length()); + String retDay = (pad2Str + day).substring(day.length()); + + String retYMD = retYear + retMonth + retDay; + + if (sDate.equals(retYMD)) { + ret = true; + } + + return ret; + } + + /** + * 입력일자, 요일의 유효 여부를 확인 + * @param sDate 일자 + * @param sWeek 요일 (DAY_OF_WEEK) + * @return 유효 여부 + */ + public static boolean validDate(String sDate, int sWeek) { + String dateStr = validChkDate(sDate); + + Calendar cal; + boolean ret = false; + + cal = Calendar.getInstance(); + + cal.set(Calendar.YEAR, Integer.parseInt(dateStr.substring(0, 4))); + cal.set(Calendar.MONTH, Integer.parseInt(dateStr.substring(4, 6)) - 1); + cal.set(Calendar.DAY_OF_MONTH, Integer.parseInt(dateStr.substring(6, 8))); + + int Week = cal.get(Calendar.DAY_OF_WEEK); + + if (validDate(sDate)) { + if (sWeek == Week) { + ret = true; + } + } + + return ret; + } + + /** + * 입력시간의 유효 여부를 확인 + * @param sTime 입력시간 + * @return 유효 여부 + */ + public static boolean validTime(String sTime) { + String timeStr = validChkTime(sTime); + + Calendar cal; + boolean ret = false; + + cal = Calendar.getInstance(); + + cal.set(Calendar.HOUR_OF_DAY, Integer.parseInt(timeStr.substring(0, 2))); + cal.set(Calendar.MINUTE, Integer.parseInt(timeStr.substring(2, 4))); + + String HH = String.valueOf(cal.get(Calendar.HOUR_OF_DAY)); + String MM = String.valueOf(cal.get(Calendar.MINUTE)); + + String pad2Str = "00"; + + String retHH = (pad2Str + HH).substring(HH.length()); + String retMM = (pad2Str + MM).substring(MM.length()); + + String retTime = retHH + retMM; + + if (sTime.equals(retTime)) { + ret = true; + } + + return ret; + } + + /** + * 입력된 일자에 연, 월, 일을 가감한 날짜의 요일을 반환 + * @param sDate 날짜 + * @param year 연 + * @param month 월 + * @param day 일 + * @return 계산된 일자의 요일(DAY_OF_WEEK) + */ + public static String addYMDtoWeek(String sDate, int year, int month, int day) { + String dateStr = validChkDate(sDate); + + dateStr = addYearMonthDay(dateStr, year, month, day); + + Calendar cal = Calendar.getInstance(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd", Locale.ENGLISH); + try { + cal.setTime(sdf.parse(dateStr)); + } catch (ParseException e) { + throw new IllegalArgumentException("Invalid date format: " + dateStr); + } + + SimpleDateFormat rsdf = new SimpleDateFormat("E", Locale.ENGLISH); + + return rsdf.format(cal.getTime()); + } + + /** + * 입력된 일자에 연, 월, 일, 시간, 분을 가감한 날짜, 시간을 포멧스트링 형식으로 반환 + * @param sDate 날짜 + * @param sTime 시간 + * @param year 연 + * @param month 월 + * @param day 일 + * @param hour 시간 + * @param minute 분 + * @param formatStr 포멧스트링 + * @return + */ + public static String addYMDtoDayTime(String sDate, String sTime, int year, int month, int day, int hour, int minute, String formatStr) { + String dateStr = validChkDate(sDate); + String timeStr = validChkTime(sTime); + + dateStr = addYearMonthDay(dateStr, year, month, day); + + dateStr = convertDate(dateStr, timeStr, "yyyyMMddHHmm"); + + Calendar cal = Calendar.getInstance(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmm", Locale.ENGLISH); + + try { + cal.setTime(sdf.parse(dateStr)); + } catch (ParseException e) { + throw new IllegalArgumentException("Invalid date format: " + dateStr); + } + + if (hour != 0) { + cal.add(Calendar.HOUR, hour); + } + + if (minute != 0) { + cal.add(Calendar.MINUTE, minute); + } + + SimpleDateFormat rsdf = new SimpleDateFormat(formatStr, Locale.ENGLISH); + + return rsdf.format(cal.getTime()); + } + + /** + * 입력된 일자를 int 형으로 반환 + * @param sDate 일자 + * @return int(일자) + */ + public static int datetoInt(String sDate) { + return Integer.parseInt(convertDate(sDate, "0000", "yyyyMMdd")); + } + + /** + * 입력된 시간을 int 형으로 반환 + * @param sTime 시간 + * @return int(시간) + */ + public static int timetoInt(String sTime) { + return Integer.parseInt(convertDate("00000101", sTime, "HHmm")); + } + + /** + * 입력된 일자 문자열을 확인하고 8자리로 리턴 + * @param sDate + * @return + */ + public static String validChkDate(String dateStr) { + if (dateStr == null || !(dateStr.trim().length() == 8 || dateStr.trim().length() == 10)) { + throw new IllegalArgumentException("Invalid date format: " + dateStr); + } + + if (dateStr.length() == 10) { + return EgovStringUtil.removeMinusChar(dateStr); + } + + return dateStr; + } + + /** + * 입력된 일자 문자열을 확인하고 8자리로 리턴 + * @param sDate + * @return + */ + public static String validChkTime(String timeStr) { + if (timeStr == null || !(timeStr.trim().length() == 4)) { + throw new IllegalArgumentException("Invalid time format: " + timeStr); + } + + if (timeStr.length() == 5) { + timeStr = EgovStringUtil.remove(timeStr, ':'); + } + + return timeStr; + } + +} diff --git a/src/main/java/egovframework/com/utl/fcc/service/EgovEhgtCalcUtil.java b/src/main/java/egovframework/com/utl/fcc/service/EgovEhgtCalcUtil.java new file mode 100644 index 0000000..7a8aed3 --- /dev/null +++ b/src/main/java/egovframework/com/utl/fcc/service/EgovEhgtCalcUtil.java @@ -0,0 +1,294 @@ +/** + * @Class Name : EgovEhgtCalcUtil.java + * @Description : 대한민국, 미국,유럽연합, 일본, 중국연합 사이의 환율계산기능을 + * 제공하는 Business Interface class + * @Modification Information + * @ + * @ 수정일 수정자 수정내용 + * @ ------- -------- --------------------------- + * @ 2009.01.13 박정규 최초 생성 + * + * @author 공통 서비스 개발팀 박정규 + * @since 2009. 01. 13 + * @version 1.0 + * @see + * + */ + +package egovframework.com.utl.fcc.service; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.math.BigDecimal; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; + +import egovframework.com.cmm.util.EgovResourceCloseHelper; + +import javax.swing.text.html.HTMLEditorKit; +import javax.swing.text.html.parser.ParserDelegator; + +public class EgovEhgtCalcUtil { + + // 환율.... + static final char EGHT_USD = 'U'; // 미국 + static final char EGHT_JPY = 'J'; // 일본 + static final char EGHT_EUR = 'E'; // 유럽연합 + static final char EGHT_CNY = 'C'; // 중국연합 + + static final char EGHT_KWR = 'K'; // 대한민국 + + static StringBuffer sb = new StringBuffer(); + + /** + * 대한민국(KRW), 미국(USD), 유럽연합(EUR), 일본(JPY), 중국원화(CNY) 사이의 환율을 계산하는 기능이다 + * 환율표 - 매매기준율 => 미국(USD) - 1485.00(USD), 일본-100(JPY) - 1596.26(JPY) + * 계산법: 대한민원(KRW) - 1,000원 -> 미국(USD)로 변환 시 => 1,000(원)/1485(매매기준율) = 0.67(URS) + * 계산법: 일본(JPY) - 100,000원 -> 대한민국(KRW) 변환 시 => (100,000(원) * 1596.26(매매기준율)) / 100(100엔당 기준표이므로) = 1,596,260.00 (KRW) + * 계산법: 일본(JPY) - 100,000원 -> 미국(USD) 변환 시 => ( + * (100,000(원) * 1596.26(매매기준율)) / 100(100엔당 기준표이므로) = 1,596,260.00 (KRW)) / 1,485.00 = 1,074.92 (USD) + * @param srcType - 환율기준 + * @param srcAmount - 금액 + * @param cnvrType - 변환환율 + * @return 환율금액 + * @exception MyException + * @see + */ + public void readHtmlParsing(String str) { + HttpURLConnection con = null; + InputStream is = null; + InputStreamReader reader = null; + try { + //입력받은 URL에 연결하여 InputStream을 통해 읽은 후 파싱 한다. + URL url = new URL(str); + + con = (HttpURLConnection) url.openConnection(); + + is = con.getInputStream(); + reader = new InputStreamReader(is, "euc-kr"); + //InputStreamReader reader = new InputStreamReader(con.getInputStream(), "utf-8"); + + new ParserDelegator().parse(reader, new CallbackHandler(), true); + + con.disconnect(); + + } catch (MalformedURLException e) { + throw new RuntimeException(e); + } catch (IOException e) { + throw new RuntimeException(e); + } finally { + EgovResourceCloseHelper.close(reader, is); + + if (con != null) { + con.disconnect(); + } + } + } + + //파서는 콜백 형식으로 되어 있다. 각 태그가 들어 올때 적절한 메소드가 호출됨 + private class CallbackHandler extends HTMLEditorKit.ParserCallback { + + public void handleText(char[] data, int pos) { + + String srcStr = new String(data); + + srcStr = EgovStringUtil.strip(srcStr, " "); + + sb.append(srcStr).append("/"); + } + } + + public static String getEhgtCalc(String srcType, long srcAmount, String cnvrType) throws Exception { + + String rtnStr = null; + + String[] eghtStdrRt = null; // Html에서 파싱한 환율매매기준율을 저장하기 위한 문자열배열 + + double srcStdrRt = 0.00; // 원래 매매기준율 + double cnvrStdrRt = 0.00; // 변환 매매기준율 + + //double cnvrAmount = 0.00; // 변환금액 + String sCnvrAmount = null; // 변환금액 + + String srcStr = null; + String cnvrStr = null; + + String srcTypeCnvr = srcType.toUpperCase(); + String cnvrTypeCnvr = cnvrType.toUpperCase(); + + EgovEhgtCalcUtil parser = new EgovEhgtCalcUtil(); + + parser.readHtmlParsing("http://community.fxkeb.com/fxportal/jsp/RS/DEPLOY_EXRATE/4176_0.html"); + + if (sb == null) { + throw new RuntimeException("StringBuffer is null!!"); + } + + eghtStdrRt = EgovStringUtil.split(sb.toString(), "/"); + + if (eghtStdrRt == null || (eghtStdrRt.length == 0)) + throw new RuntimeException("String Split Error!"); + + char srcChr = srcTypeCnvr.charAt(0); + char cnvrChr = cnvrTypeCnvr.charAt(0); + + // 원래 환율기준 정의 + switch (srcChr) { + + case EGHT_USD: // 미국 + srcStr = "USD"; + break; + + case EGHT_JPY: // 일본 + srcStr = "JPY"; + break; + + case EGHT_EUR: // 유럽연합 + srcStr = "EUR"; + break; + + case EGHT_CNY: // 중국연합 + srcStr = "CNY"; + break; + + default: + srcStr = "USD"; + break; + } + + // 변환하고자 하는 환율기준 정의 + switch (cnvrChr) { + + case EGHT_USD: // 미국 + cnvrStr = "USD"; + break; + + case EGHT_JPY: // 일본 + cnvrStr = "JPY"; + break; + + case EGHT_EUR: // 유럽연합 + cnvrStr = "EUR"; + break; + + case EGHT_CNY: // 중국연합 + cnvrStr = "CNY"; + break; + + default: + cnvrStr = "KRW"; + break; + } + + // 변환하고자 하는 국가의 환율매매기준율 추출... + for (int i = 0; i < eghtStdrRt.length; i++) { + + // 원래 매매기준율 추출 + if (eghtStdrRt[i].equals(srcStr)) { + srcStdrRt = Double.parseDouble(eghtStdrRt[i + 1]); + + if (i == (eghtStdrRt.length - 1)) + break; + } + + // 변환 매매기준율 추출 + if (eghtStdrRt[i].equals(cnvrStr)) { + cnvrStdrRt = Double.parseDouble(eghtStdrRt[i + 1]); + + if (i == (eghtStdrRt.length - 1)) + break; + } + } + + // 정확한 계산을 위한 BigDecimal 형태로 구현. + BigDecimal bSrcAmount = new BigDecimal(String.valueOf(srcAmount)); // 변환하고자 하는 금액 + BigDecimal bSrcStdrRt = new BigDecimal(String.valueOf(srcStdrRt)); // 원래 매매 비율 + BigDecimal bCnvrStdrRt = new BigDecimal(String.valueOf(cnvrStdrRt)); // 변환 매매 비율 + BigDecimal bStdr = new BigDecimal("100"); // 변환 매매 비율 + + // 원래 매매기준율 및 변환매매기준율 기준으로 환율금액 계산 + switch (srcChr) { + + case EGHT_KWR: // 대한민국 + if (cnvrChr == 'K') + //변환금액 = 변환대상금액; + sCnvrAmount = bSrcAmount.toString(); + else if (cnvrChr == 'J') + //변환금액 = (변환대상금액 / 변환매매비율) * 100; + sCnvrAmount = (bSrcAmount.divide(bCnvrStdrRt, 4, 4)).multiply(bStdr).setScale(2, 4).toString(); + else + //변환금액 = (변환대상금액 / 변환매매비율); + sCnvrAmount = bSrcAmount.divide(bCnvrStdrRt, 2, 4).toString(); + break; + + case EGHT_USD: // 미국 + if (cnvrChr == 'U') + //변환금액 = 변환대상금액; + sCnvrAmount = bSrcAmount.toString(); + else if (cnvrChr == 'K') + //변환금액 = 변환대상금액 * 원래 매매 비율; + sCnvrAmount = bSrcAmount.multiply(bSrcStdrRt).setScale(2, 4).toString(); + else if (cnvrChr == 'J') + //cnvrAmount = ((변환대상금액 * 원래 매매 비율) / 변환 매매 비율) * 100; + sCnvrAmount = ((bSrcAmount.multiply(bSrcStdrRt).setScale(4, 4)).divide(bCnvrStdrRt, 2, 4)).multiply(bStdr).setScale(2, 4).toString(); + else + //cnvrAmount = (변환대상금액 * 원래 매매 비율) / 변환 매매 비율; + sCnvrAmount = (bSrcAmount.multiply(bSrcStdrRt).setScale(4, 4)).divide(bCnvrStdrRt, 2, 4).toString(); + break; + + case EGHT_EUR: // 유럽연합 + if (cnvrChr == 'E') + //변환금액 = 변환대상금액; + sCnvrAmount = bSrcAmount.toString(); + else if (cnvrChr == 'K') + //cnvrAmount = 변환대상금액 * 원래 매매 비율; + sCnvrAmount = bSrcAmount.multiply(bSrcStdrRt).setScale(2, 4).toString(); + else if (cnvrChr == 'J') + //cnvrAmount = ((변환대상금액 * 원래 매매 비율) / 변환 매매 비율) * 100; + sCnvrAmount = ((bSrcAmount.multiply(bSrcStdrRt).setScale(4, 4)).divide(bCnvrStdrRt, 2, 4)).multiply(bStdr).setScale(2, 4).toString(); + else + //cnvrAmount = (변환대상금액 * 원래 매매 비율) / 변환 매매 비율; + sCnvrAmount = (bSrcAmount.multiply(bSrcStdrRt).setScale(4, 4)).divide(bCnvrStdrRt, 2, 4).toString(); + break; + + case EGHT_JPY: // 일본 + if (cnvrChr == 'J') + //변환금액 = 변환대상금액; + sCnvrAmount = bSrcAmount.toString(); + else if (cnvrChr == 'K') + //cnvrAmount = (변환대상금액 * 원래 매매 비율) / 100; + sCnvrAmount = (bSrcAmount.multiply(bSrcStdrRt).setScale(4, 4)).divide(bStdr, 2, 4).toString(); + else + //cnvrAmount = ((변환대상금액 * 원래 매매 비율) / 100) / 변환 매매 비율; + sCnvrAmount = ((bSrcAmount.multiply(bSrcStdrRt).setScale(4, 4)).divide(bStdr, 2, 4)).divide(bCnvrStdrRt, 2, 4).toString(); + break; + + case EGHT_CNY: // 중국연합 + if (cnvrChr == 'C') + //변환금액 = 변환대상금액; + sCnvrAmount = bSrcAmount.toString(); + else if (cnvrChr == 'K') + //cnvrAmount = 변환대상금액 * 원래 매매 비율; + sCnvrAmount = bSrcAmount.multiply(bSrcStdrRt).setScale(2, 4).toString(); + else if (cnvrChr == 'J') + //cnvrAmount = ((변환대상금액 * 원래 매매 비율) / 변환 매매 비율) * 100; + sCnvrAmount = ((bSrcAmount.multiply(bSrcStdrRt).setScale(4, 4)).divide(bCnvrStdrRt, 2, 4)).multiply(bStdr).setScale(2, 4).toString(); + else + //cnvrAmount = (변환대상금액 * 원래 매매 비율) / 변환 매매 비율; + sCnvrAmount = (bSrcAmount.multiply(bSrcStdrRt).setScale(4, 4)).divide(bCnvrStdrRt, 2, 4).toString(); + break; + + default: + //변환금액 = (변환대상금액 / 변환매매비율); + sCnvrAmount = bSrcAmount.divide(bCnvrStdrRt, 2, 4).toString(); + break; + } + + rtnStr = sCnvrAmount + " " + cnvrStr; + + return rtnStr; + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/utl/fcc/service/EgovFileUploadUtil.java b/src/main/java/egovframework/com/utl/fcc/service/EgovFileUploadUtil.java new file mode 100644 index 0000000..15378fa --- /dev/null +++ b/src/main/java/egovframework/com/utl/fcc/service/EgovFileUploadUtil.java @@ -0,0 +1,231 @@ +package egovframework.com.utl.fcc.service; + +import java.io.File; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.util.WebUtils; + +import egovframework.com.cmm.EgovWebUtil; + +/** + * @Class Name : EgovFileUploadUtil.java + * @Description : Spring 기반 File Upload 유틸리티 + * @Modification Information + * + * 수정일 수정자 수정내용 + * ---------- -------- --------------------------- + * 2009.08.26 한성곤 최초 생성 + * 2018.08.17 신용호 uploadFilesExt(확장자 기록) 추가 + * 2019.12.06 신용호 checkFileExtension(), checkFileMaxSize() 추가 + * 2020.08.05 신용호 uploadFilesExt Parameter 수정 + * 2021.02.16 신용호 WebUtils.getNativeRequest(request,MultipartHttpServletRequest.class); + * + * @author 공통컴포넌트 개발팀 한성곤 + * @since 2009.08.26 + * @version 1.0 + * @see + */ +public class EgovFileUploadUtil extends EgovFormBasedFileUtil { + /** + * 파일을 Upload 처리한다. + * + * @param request + * @param where + * @param maxFileSize + * @return + * @throws Exception + */ + public static List uploadFiles(HttpServletRequest request, String where, long maxFileSize) + throws Exception { + List list = new ArrayList(); + + //MultipartHttpServletRequest mptRequest = (MultipartHttpServletRequest) request; + MultipartHttpServletRequest mptRequest = WebUtils.getNativeRequest(request, MultipartHttpServletRequest.class); + + if (mptRequest != null) {//2022.01 Possible null pointer dereference due to return value of called method 조치 + Iterator fileIter = mptRequest.getFileNames(); + + while (fileIter.hasNext()) { + MultipartFile mFile = mptRequest.getFile((String)fileIter.next()); + + EgovFormBasedFileVo vo = new EgovFormBasedFileVo(); + + String tmp = mFile.getOriginalFilename(); + if(tmp != null) {//2022.01 Possible null pointer dereference due to return value of called method + if (tmp.lastIndexOf("\\") >= 0) { + tmp = tmp.substring(tmp.lastIndexOf("\\") + 1); + } + + vo.setFileName(tmp); + vo.setContentType(mFile.getContentType()); + vo.setServerSubPath(getTodayString()); + vo.setPhysicalName(getPhysicalFileName()); + vo.setSize(mFile.getSize()); + + if (tmp.lastIndexOf(".") >= 0) { + vo.setPhysicalName(vo.getPhysicalName()); // 2012.11 KISA 보안조치 + } + + if (mFile.getSize() > 0) { + InputStream is = null; + + try { + is = mFile.getInputStream(); + saveFile(is, new File(EgovWebUtil.filePathBlackList( + where + SEPERATOR + vo.getServerSubPath() + SEPERATOR + vo.getPhysicalName()))); + } finally { + if (is != null) { + is.close(); + } + } + list.add(vo); + } + } + } + } + + return list; + } + + /** + * 파일을 Upload(확장명 저장 및 확장자 제한) 처리한다. + * + * @param request + * @param where + * @param maxFileSize + * @return + * @throws Exception + */ + public static List uploadFilesExt(MultipartHttpServletRequest mptRequest, String where, + long maxFileSize, String extensionWhiteList) throws Exception { + List list = new ArrayList(); + + if (mptRequest != null) { + Iterator fileIter = mptRequest.getFileNames(); + + while (fileIter.hasNext()) { + MultipartFile mFile = mptRequest.getFile((String)fileIter.next()); + + EgovFormBasedFileVo vo = new EgovFormBasedFileVo(); + + String tmp = mFile.getOriginalFilename(); + + if(tmp != null) {//2022.01 Possible null pointer dereference due to return value of called method + if (tmp.lastIndexOf("\\") >= 0) { + tmp = tmp.substring(tmp.lastIndexOf("\\") + 1); + } + String ext = ""; + if (tmp.lastIndexOf(".") > 0) { + ext = getFileExtension(tmp).toLowerCase(); + } else { + throw new SecurityException("Unacceptable file extension."); // 허용되지 않는 확장자 처리 + } + if (extensionWhiteList.indexOf(ext) < 0) { + throw new SecurityException("Unacceptable file extension."); // 허용되지 않는 확장자 처리 + } + + vo.setFileName(tmp); + vo.setContentType(mFile.getContentType()); + vo.setServerSubPath(getTodayString()); + vo.setPhysicalName(getPhysicalFileName() + "." + ext); + vo.setSize(mFile.getSize()); + + if (tmp.lastIndexOf(".") >= 0) { + vo.setPhysicalName(vo.getPhysicalName()); // 2012.11 KISA 보안조치 + } + + if (mFile.getSize() > 0) { + InputStream is = null; + + try { + is = mFile.getInputStream(); + saveFile(is, new File(EgovWebUtil.filePathBlackList( + where + SEPERATOR + vo.getServerSubPath() + SEPERATOR + vo.getPhysicalName()))); + } finally { + if (is != null) { + is.close(); + } + } + list.add(vo); + } + } + } + } + + return list; + } + + /** + * 파일 확장자를 추출한다. + * + * @param fileNamePath + * @return 확장자 : "" 또는 추출된 확장자 + */ + public static String getFileExtension(String fileNamePath) { + + if (fileNamePath == null) { + return ""; + } + String ext = fileNamePath.substring(fileNamePath.lastIndexOf(".") + 1, fileNamePath.length()); + + return (ext == null) ? "" : ext; + } + + /** + * 파일 확장자의 허용유무를 검증한다. + * + * @param fileNamePath + * @param whiteListExtensions : ex) .png.pdf.txt + * @return true : 허용 + * @return true : 불가 + */ + public static boolean checkFileExtension(String fileNamePath, String whiteListExtensions) { + String extension = getFileExtension(fileNamePath); + + if ("".equals(extension)) { + return false; + } + + if (whiteListExtensions == null) { + return false; + } + if ("".equals(whiteListExtensions)) { + return false; + } + + if (whiteListExtensions.indexOf("." + extension) >= 0) { + return true; + } else { + return false; + } + } + + /** + * 최대 파일 사이즈 허용유무를 검증한다. + * + * @param multipartFile + * @param maxFileSize : ex) 1048576 = 1M , 1K = 1024 + * @return true : 허용 + * @return true : 불가 + */ + public static boolean checkFileMaxSize(MultipartFile multipartFile, long maxFileSize) { + + if (multipartFile == null) { + return false; + } + + if (multipartFile.getSize() <= maxFileSize) { + return true; + } else { + return false; + } + } + +} diff --git a/src/main/java/egovframework/com/utl/fcc/service/EgovFormBasedFileUtil.java b/src/main/java/egovframework/com/utl/fcc/service/EgovFormBasedFileUtil.java new file mode 100644 index 0000000..cac6edc --- /dev/null +++ b/src/main/java/egovframework/com/utl/fcc/service/EgovFormBasedFileUtil.java @@ -0,0 +1,291 @@ +package egovframework.com.utl.fcc.service; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Locale; + +import javax.servlet.http.HttpServletResponse; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import egovframework.com.cmm.EgovWebUtil; +import egovframework.com.cmm.util.EgovResourceCloseHelper; + +/** + * @Class Name : EgovFormBasedFileUtil.java + * @Description : Form-based File Upload 유틸리티 + * @Modification Information + * + * 수정일 수정자 수정내용 + * ---------- -------- --------------------------- + * 2009.08.26 한성곤 최초 생성 + * 2017.03.03 조성원 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + * 2019.12.09 신용호 KISA 보안약점 조치 (위험한 형식 파일 업로드) : uploadFiles 삭제 => EgovFileUploadUtil.uploadFilesExt(확장자 기록) 대체 + * + * @author 공통컴포넌트 개발팀 한성곤 + * @since 2009.08.26 + * @version 1.0 + * @see + */ +public class EgovFormBasedFileUtil { + /** Buffer size */ + public static final int BUFFER_SIZE = 8192; + + public static final String SEPERATOR = File.separator; + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovFormBasedFileUtil.class); + + /** + * 오늘 날짜 문자열 취득. + * ex) 20090101 + * @return + */ + public static String getTodayString() { + SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd", Locale.getDefault()); + + return format.format(new Date()); + } + + /** + * 물리적 파일명 생성. + * @return + */ + public static String getPhysicalFileName() { + return EgovFormBasedUUID.randomUUID().toString().replaceAll("-", "").toUpperCase(); + } + + /** + * 파일명 변환. + * @param filename String + * @return + * @throws Exception + */ + protected static String convert(String filename) throws Exception { + //return java.net.URLEncoder.encode(filename, "utf-8"); + return filename; + } + + /** + * Stream으로부터 파일을 저장함. + * @param is InputStream + * @param file File + * @throws IOException + */ + public static long saveFile(InputStream is, File file) throws IOException { + //KISA 보안약점 조치 (2018-10-29, 윤창원) + if (file.getParentFile() == null) { + LOGGER.debug("file.getParentFile() is null"); + throw new RuntimeException("file.getParentFile() is null"); + } + + // 디렉토리 생성 + if (!file.getParentFile().exists()) { + //2017.03.03 조성원 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + if(file.getParentFile().mkdirs()){ + LOGGER.debug("[file.mkdirs] file : Directory Creation Success"); + }else{ + LOGGER.error("[file.mkdirs] file : Directory Creation Fail"); + } + } + + OutputStream os = null; + long size = 0L; + + try { + os = new FileOutputStream(file); + + int bytesRead = 0; + byte[] buffer = new byte[BUFFER_SIZE]; + + while ((bytesRead = is.read(buffer, 0, BUFFER_SIZE)) != -1) { + size += bytesRead; + os.write(buffer, 0, bytesRead); + } + } finally { + EgovResourceCloseHelper.close(os); + } + + return size; + } + + /** + * 파일을 Upload 처리한다. (삭제) + * EgovFileUploadUtil.uploadFilesExt(확장자 확인) 대체 + * + * @param request + * @param where + * @param maxFileSize + * @return + * @throws Exception + */ + /* + public static List uploadFiles(HttpServletRequest request, String where, long maxFileSize) throws Exception { + List list = new ArrayList(); + + // Check that we have a file upload request + boolean isMultipart = ServletFileUpload.isMultipartContent(request); + + if (isMultipart) { + // Create a new file upload handler + ServletFileUpload upload = new ServletFileUpload(); + upload.setFileSizeMax(maxFileSize); // SizeLimitExceededException + + // Parse the request + FileItemIterator iter = upload.getItemIterator(request); + while (iter.hasNext()) { + FileItemStream item = iter.next(); + String name = item.getFieldName(); + InputStream stream = item.openStream(); + if (item.isFormField()) { + LOGGER.info("Form field '{}' with value '{}' detected.", name, Streams.asString(stream)); + } else { + LOGGER.info("File field '{}' with file name '{}' detected.", name, item.getName()); + + if ("".equals(item.getName())) { + continue; + } + + // Process the input stream + EgovFormBasedFileVo vo = new EgovFormBasedFileVo(); + + String tmp = item.getName(); + + if (tmp.lastIndexOf("\\") >= 0) { + tmp = tmp.substring(tmp.lastIndexOf("\\") + 1); + } + + vo.setFileName(tmp); + vo.setContentType(item.getContentType()); + vo.setServerSubPath(getTodayString()); + vo.setPhysicalName(getPhysicalFileName()); + + if (tmp.lastIndexOf(".") >= 0) { + vo.setPhysicalName(vo.getPhysicalName() + tmp.substring(tmp.lastIndexOf("."))); + } + + long size = saveFile(stream, new File(EgovWebUtil.filePathBlackList(where) + SEPERATOR + vo.getServerSubPath() + SEPERATOR + vo.getPhysicalName())); + + vo.setSize(size); + + list.add(vo); + } + } + } else { + throw new IOException("form's 'enctype' attribute have to be 'multipart/form-data'"); + } + + return list; + }*/ + + /** + * 파일을 Download 처리한다. + * + * @param response + * @param where + * @param serverSubPath + * @param physicalName + * @param original + * @throws Exception + */ + public static void downloadFile(HttpServletResponse response, String where, String serverSubPath, String physicalName, String original) throws Exception { + String downFileName = where + SEPERATOR + serverSubPath + SEPERATOR + physicalName; + + File file = new File(EgovWebUtil.filePathBlackList(downFileName)); + + if (!file.exists()) { + throw new FileNotFoundException(downFileName); + } + + if (!file.isFile()) { + throw new FileNotFoundException(downFileName); + } + + byte[] b = new byte[BUFFER_SIZE]; + + original = original.replaceAll("\r", "").replaceAll("\n", ""); + response.setContentType("application/octet-stream"); + response.setHeader("Content-Disposition", "attachment; filename=\"" + convert(original) + "\";"); + response.setHeader("Content-Transfer-Encoding", "binary"); + response.setHeader("Pragma", "no-cache"); + response.setHeader("Expires", "0"); + + BufferedInputStream fin = null; + BufferedOutputStream outs = null; + + try { + fin = new BufferedInputStream(new FileInputStream(file)); + outs = new BufferedOutputStream(response.getOutputStream()); + + int read = 0; + + while ((read = fin.read(b)) != -1) { + outs.write(b, 0, read); + } + } finally { + EgovResourceCloseHelper.close(outs, fin); + } + } + + /** + * 이미지에 대한 미리보기 기능을 제공한다. + * + * mimeType의 경우는 JSP 상에서 다음과 같이 얻을 수 있다. + * getServletConfig().getServletContext().getMimeType(name); + * + * @param response + * @param where + * @param serverSubPath + * @param physicalName + * @param mimeType + * @throws Exception + */ + public static void viewFile(HttpServletResponse response, String where, String serverSubPath, String physicalName, String mimeTypeParam) throws Exception { + String mimeType = mimeTypeParam; + String downFileName = where + SEPERATOR + serverSubPath + SEPERATOR + physicalName; + + File file = new File(EgovWebUtil.filePathBlackList(downFileName)); + + if (!file.exists()) { + throw new FileNotFoundException(downFileName); + } + + if (!file.isFile()) { + throw new FileNotFoundException(downFileName); + } + + byte[] b = new byte[BUFFER_SIZE]; + + if (mimeType == null) { + mimeType = "application/octet-stream;"; + } + + response.setContentType(EgovWebUtil.removeCRLF(mimeType)); + response.setHeader("Content-Disposition", "filename=image;"); + + BufferedInputStream fin = null; + BufferedOutputStream outs = null; + + try { + fin = new BufferedInputStream(new FileInputStream(file)); + outs = new BufferedOutputStream(response.getOutputStream()); + + int read = 0; + + while ((read = fin.read(b)) != -1) { + outs.write(b, 0, read); + } + } finally { + EgovResourceCloseHelper.close(outs, fin); + } + } +} diff --git a/src/main/java/egovframework/com/utl/fcc/service/EgovFormBasedFileVo.java b/src/main/java/egovframework/com/utl/fcc/service/EgovFormBasedFileVo.java new file mode 100644 index 0000000..48512db --- /dev/null +++ b/src/main/java/egovframework/com/utl/fcc/service/EgovFormBasedFileVo.java @@ -0,0 +1,104 @@ +package egovframework.com.utl.fcc.service; + +import java.io.Serializable; + +/** + * @Class Name : EgovFormBasedFileVo.java + * @Description : Form-based File Upload VO + * @Modification Information + * + * 수정일 수정자 수정내용 + * ------- -------- --------------------------- + * 2009.08.26 한성곤 최초 생성 + * + * @author 공통컴포넌트 개발팀 한성곤 + * @since 2009.08.26 + * @version 1.0 + * @see + * + * Copyright (C) 2008 by MOPAS All right reserved. + */ +@SuppressWarnings("serial") +public class EgovFormBasedFileVo implements Serializable { + /** 파일명 */ + private String fileName = ""; + /** ContextType */ + private String contentType = ""; + /** 하위 디렉토리 지정 */ + private String serverSubPath = ""; + /** 물리적 파일명 */ + private String physicalName = ""; + /** 파일 사이즈 */ + private long size = 0L; + + /** + * fileName attribute를 리턴한다. + * @return the fileName + */ + public String getFileName() { + return fileName; + } + /** + * fileName attribute 값을 설정한다. + * @param fileName the fileName to set + */ + public void setFileName(String fileName) { + this.fileName = fileName; + } + /** + * contentType attribute를 리턴한다. + * @return the contentType + */ + public String getContentType() { + return contentType; + } + /** + * contentType attribute 값을 설정한다. + * @param contentType the contentType to set + */ + public void setContentType(String contentType) { + this.contentType = contentType; + } + /** + * serverSubPath attribute를 리턴한다. + * @return the serverSubPath + */ + public String getServerSubPath() { + return serverSubPath; + } + /** + * serverSubPath attribute 값을 설정한다. + * @param serverSubPath the serverSubPath to set + */ + public void setServerSubPath(String serverSubPath) { + this.serverSubPath = serverSubPath; + } + /** + * physicalName attribute를 리턴한다. + * @return the physicalName + */ + public String getPhysicalName() { + return physicalName; + } + /** + * physicalName attribute 값을 설정한다. + * @param physicalName the physicalName to set + */ + public void setPhysicalName(String physicalName) { + this.physicalName = physicalName; + } + /** + * size attribute를 리턴한다. + * @return the size + */ + public long getSize() { + return size; + } + /** + * size attribute 값을 설정한다. + * @param size the size to set + */ + public void setSize(long size) { + this.size = size; + } +} diff --git a/src/main/java/egovframework/com/utl/fcc/service/EgovFormBasedUUID.java b/src/main/java/egovframework/com/utl/fcc/service/EgovFormBasedUUID.java new file mode 100644 index 0000000..6df377b --- /dev/null +++ b/src/main/java/egovframework/com/utl/fcc/service/EgovFormBasedUUID.java @@ -0,0 +1,521 @@ +package egovframework.com.utl.fcc.service; + +import java.io.Serializable; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; + +/** + * + * A class that represents an immutable universally unique identifier (UUID). A + * UUID represents a 128-bit value. + * + *

    + * There exist different variants of these global identifiers. The methods of + * this class are for manipulating the Leach-Salz variant, although the + * constructors allow the creation of any variant of UUID (described below). + * + *

    + * The layout of a variant 2 (Leach-Salz) UUID is as follows: + * + * The most significant long consists of the following unsigned fields: + * + *

    + *   0xFFFFFFFF00000000 time_low
    + *   0x00000000FFFF0000 time_mid
    + *   0x000000000000F000 version
    + *   0x0000000000000FFF time_hi
    + * 
    + * + * The least significant long consists of the following unsigned fields: + * + *
    + *   0xC000000000000000 variant
    + *   0x3FFF000000000000 clock_seq
    + *   0x0000FFFFFFFFFFFF node
    + * 
    + * + *

    + * The variant field contains a value which identifies the layout of the + * UUID. The bit layout described above is valid only for a + * UUID with a variant value of 2, which indicates the Leach-Salz + * variant. + * + *

    + * The version field holds a value that describes the type of this UUID. + * There are four different basic types of UUIDs: time-based, DCE security, + * name-based, and randomly generated UUIDs. These types have a version value of + * 1, 2, 3 and 4, respectively. + * + *

    + * For more information including algorithms used to create UUIDs, + * see the Internet-Draft UUIDs + * and GUIDs or the standards body definition at ISO/IEC 11578:1996. + * + * @version 1.14, 07/12/04 + * @since 1.5 + */ +@SuppressWarnings("serial") +public class EgovFormBasedUUID implements Serializable { + /* + * The most significant 64 bits of this UUID. + * + * @serial + */ + private final long mostSigBits; + + /* + * The least significant 64 bits of this UUID. + * + * @serial + */ + private final long leastSigBits; + + /* + * The version number associated with this UUID. Computed on demand. + */ + private transient int version = -1; + + /* + * The variant number associated with this UUID. Computed on demand. + */ + private transient int variant = -1; + + /* + * The timestamp associated with this UUID. Computed on demand. + */ + private transient volatile long timestamp = -1; + + /* + * The clock sequence associated with this UUID. Computed on demand. + */ + private transient int sequence = -1; + + /* + * The node number associated with this UUID. Computed on demand. + */ + private transient long node = -1; + + /* + * The hashcode of this UUID. Computed on demand. + */ + private transient int hashCode = -1; + + /* + * The random number generator used by this class to create random based + * UUIDs. + */ + private static volatile SecureRandom numberGenerator = null; + + // Constructors and Factories + + /* + * Private constructor which uses a byte array to construct the new UUID. + */ + private EgovFormBasedUUID(byte[] data) { + long msb = 0; + long lsb = 0; + for (int i = 0; i < 8; i++) + msb = (msb << 8) | (data[i] & 0xff); + for (int i = 8; i < 16; i++) + lsb = (lsb << 8) | (data[i] & 0xff); + this.mostSigBits = msb; + this.leastSigBits = lsb; + } + + /** + * Constructs a new UUID using the specified data. + * mostSigBits is used for the most significant 64 bits of the + * UUID and leastSigBits becomes the least significant + * 64 bits of the UUID. + * + * @param mostSigBits + * @param leastSigBits + */ + public EgovFormBasedUUID(long mostSigBits, long leastSigBits) { + this.mostSigBits = mostSigBits; + this.leastSigBits = leastSigBits; + } + + /** + * Static factory to retrieve a type 4 (pseudo randomly generated) UUID. + * + * The UUID is generated using a cryptographically strong + * pseudo random number generator. + * + * @return a randomly generated UUID. + */ + public static EgovFormBasedUUID randomUUID() { + SecureRandom ng = numberGenerator; + if (ng == null) { + numberGenerator = ng = new SecureRandom(); + } + + byte[] randomBytes = new byte[16]; + ng.nextBytes(randomBytes); + randomBytes[6] &= 0x0f; /* clear version */ + randomBytes[6] |= 0x40; /* set to version 4 */ + randomBytes[8] &= 0x3f; /* clear variant */ + randomBytes[8] |= 0x80; /* set to IETF variant */ + + return new EgovFormBasedUUID(randomBytes); + } + + /** + * Static factory to retrieve a type 3 (name based) UUID based on + * the specified byte array. + * + * @param name + * a byte array to be used to construct a UUID. + * @return a UUID generated from the specified array. + */ + public static EgovFormBasedUUID nameUUIDFromBytes(byte[] name) { + MessageDigest md; + try { + // 2011.10.10 보안점검 후속조치 암호화 알고리즘 변경(MD5 -> SHA-256) + //md = MessageDigest.getInstance("MD5"); + md = MessageDigest.getInstance("SHA-256"); + } catch (NoSuchAlgorithmException nsae) { + //throw new InternalError("MD5 not supported"); + throw new InternalError("SHA-256 not supported"); + } + // 2011.10.10 보안점검 후속조치 + if (md == null) { + throw new RuntimeException("MessageDigest is null!!"); + } + // 2014.09.20 보안점검 후속 조치 + // Random 방식의 salt 추가 + SecureRandom ng = new SecureRandom(); + byte[] randomBytes = new byte[16]; + ng.nextBytes(randomBytes); + + md.reset(); + md.update(randomBytes); + byte[] sha = md.digest(name); + + + byte[] md5Bytes = new byte[8]; + System.arraycopy(sha, 0, md5Bytes, 0, 8); + //2011.10.10 보안점검 후속조치 끝 + + md5Bytes[6] &= 0x0f; /* clear version */ + md5Bytes[6] |= 0x30; /* set to version 3 */ + md5Bytes[8] &= 0x3f; /* clear variant */ + md5Bytes[8] |= 0x80; /* set to IETF variant */ + + return new EgovFormBasedUUID(md5Bytes); + } + + /** + * Creates a UUID from the string standard representation as + * described in the {@link #toString} method. + * + * @param name + * a string that specifies a UUID. + * @return a UUID with the specified value. + * @throws IllegalArgumentException + * if name does not conform to the string representation as + * described in {@link #toString}. + */ + public static EgovFormBasedUUID fromString(String name) { + String[] components = name.split("-"); + if (components.length != 5) + throw new IllegalArgumentException("Invalid UUID string: " + name); + for (int i = 0; i < 5; i++) + components[i] = "0x" + components[i]; + + long mostSigBits = Long.decode(components[0]).longValue(); + mostSigBits <<= 16; + mostSigBits |= Long.decode(components[1]).longValue(); + mostSigBits <<= 16; + mostSigBits |= Long.decode(components[2]).longValue(); + + long leastSigBits = Long.decode(components[3]).longValue(); + leastSigBits <<= 48; + leastSigBits |= Long.decode(components[4]).longValue(); + + return new EgovFormBasedUUID(mostSigBits, leastSigBits); + } + + // Field Accessor Methods + + /** + * Returns the least significant 64 bits of this UUID's 128 bit value. + * + * @return the least significant 64 bits of this UUID's 128 bit value. + */ + public long getLeastSignificantBits() { + return leastSigBits; + } + + /** + * Returns the most significant 64 bits of this UUID's 128 bit value. + * + * @return the most significant 64 bits of this UUID's 128 bit value. + */ + public long getMostSignificantBits() { + return mostSigBits; + } + + /** + * The version number associated with this UUID. The version + * number describes how this UUID was generated. + * + * The version number has the following meaning: + *

    + *

      + *
    • 1 Time-based UUID + *
    • 2 DCE security UUID + *
    • 3 Name-based UUID + *
    • 4 Randomly generated UUID + *
    + * + * @return the version number of this UUID. + */ + public int version() { + if (version < 0) { + // Version is bits masked by 0x000000000000F000 in MS long + version = (int) ((mostSigBits >> 12) & 0x0f); + } + return version; + } + + /** + * The variant number associated with this UUID. The variant + * number describes the layout of the UUID. + * + * The variant number has the following meaning: + *

    + *

      + *
    • 0 Reserved for NCS backward compatibility + *
    • 2 The Leach-Salz variant (used by this class) + *
    • 6 Reserved, Microsoft Corporation backward compatibility + *
    • 7 Reserved for future definition + *
    + * + * @return the variant number of this UUID. + */ + public int variant() { + if (variant < 0) { + // This field is composed of a varying number of bits + if ((leastSigBits >>> 63) == 0) { + variant = 0; + } else if ((leastSigBits >>> 62) == 2) { + variant = 2; + } else { + variant = (int) (leastSigBits >>> 61); + } + } + return variant; + } + + /** + * The timestamp value associated with this UUID. + * + *

    + * The 60 bit timestamp value is constructed from the time_low, time_mid, + * and time_hi fields of this UUID. The resulting timestamp is + * measured in 100-nanosecond units since midnight, October 15, 1582 UTC. + *

    + * + * The timestamp value is only meaningful in a time-based UUID, which has + * version type 1. If this UUID is not a time-based UUID then + * this method throws UnsupportedOperationException. + * + * @throws UnsupportedOperationException + * if this UUID is not a version 1 UUID. + */ + public long timestamp() { + if (version() != 1) { + throw new UnsupportedOperationException("Not a time-based UUID"); + } + long result = timestamp; + if (result < 0) { + result = (mostSigBits & 0x0000000000000FFFL) << 48; + result |= ((mostSigBits >> 16) & 0xFFFFL) << 32; + result |= mostSigBits >>> 32; + timestamp = result; + } + return result; + } + + /** + * The clock sequence value associated with this UUID. + * + *

    + * The 14 bit clock sequence value is constructed from the clock sequence + * field of this UUID. The clock sequence field is used to guarantee + * temporal uniqueness in a time-based UUID. + *

    + * + * The clockSequence value is only meaningful in a time-based UUID, which + * has version type 1. If this UUID is not a time-based UUID then this + * method throws UnsupportedOperationException. + * + * @return the clock sequence of this UUID. + * @throws UnsupportedOperationException + * if this UUID is not a version 1 UUID. + */ + public int clockSequence() { + if (version() != 1) { + throw new UnsupportedOperationException("Not a time-based UUID"); + } + if (sequence < 0) { + sequence = (int) ((leastSigBits & 0x3FFF000000000000L) >>> 48); + } + return sequence; + } + + /** + * The node value associated with this UUID. + * + *

    + * The 48 bit node value is constructed from the node field of this UUID. + * This field is intended to hold the IEEE 802 address of the machine that + * generated this UUID to guarantee spatial uniqueness. + *

    + * + * The node value is only meaningful in a time-based UUID, which has version + * type 1. If this UUID is not a time-based UUID then this method throws + * UnsupportedOperationException. + * + * @return the node value of this UUID. + * @throws UnsupportedOperationException + * if this UUID is not a version 1 UUID. + */ + public long node() { + if (version() != 1) { + throw new UnsupportedOperationException("Not a time-based UUID"); + } + if (node < 0) { + node = leastSigBits & 0x0000FFFFFFFFFFFFL; + } + return node; + } + + // Object Inherited Methods + + /** + * Returns a String object representing this + * UUID. + * + *

    + * The UUID string representation is as described by this BNF : + * + *

    +     *    UUID                   = <time_low> "-" <time_mid> "-"
    +     *                             <time_high_and_version> "-"
    +     *                             <variant_and_sequence> "-"
    +     *                             <node>
    +     *    time_low               = 4*<hexOctet>
    +     *    time_mid               = 2*<hexOctet>
    +     *    time_high_and_version  = 2*<hexOctet>
    +     *    variant_and_sequence   = 2*<hexOctet>
    +     *    node                   = 6*<hexOctet>
    +     *    hexOctet               = <hexDigit><hexDigit>
    +     *    hexDigit               =
    +     *          "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
    +     *          | "a" | "b" | "c" | "d" | "e" | "f"
    +     *          | "A" | "B" | "C" | "D" | "E" | "F"
    +     * 
    + * + * @return a string representation of this UUID. + */ + @Override + public String toString() { + return (digits(mostSigBits >> 32, 8) + "-" + + digits(mostSigBits >> 16, 4) + "-" + digits(mostSigBits, 4) + + "-" + digits(leastSigBits >> 48, 4) + "-" + digits( + leastSigBits, 12)); + } + + /** Returns val represented by the specified number of hex digits. */ + private static String digits(long val, int digits) { + long hi = 1L << (digits * 4); + return Long.toHexString(hi | (val & (hi - 1))).substring(1); + } + + /** + * Returns a hash code for this UUID. + * + * @return a hash code value for this UUID. + */ + @Override + public int hashCode() { + if (hashCode == -1) { + hashCode = (int) ((mostSigBits >> 32) ^ mostSigBits + ^ (leastSigBits >> 32) ^ leastSigBits); + } + return hashCode; + } + + /** + * Compares this object to the specified object. The result is true + * if and only if the argument is not null, is a UUID + * object, has the same variant, and contains the same value, bit for bit, + * as this UUID. + * + * @param obj + * the object to compare with. + * @return true if the objects are the same; + * false otherwise. + */ + @Override + public boolean equals(Object obj) { + // 보안 취약점 점검 지적사항 반영 시작 + if (obj == null) + return false; + // 보안 취약점 점검 지적사항 반영 시작 끝 + if (!(obj instanceof EgovFormBasedUUID)) + return false; + if (((EgovFormBasedUUID) obj).variant() != this.variant()) + return false; + EgovFormBasedUUID id = (EgovFormBasedUUID) obj; + return (mostSigBits == id.mostSigBits && leastSigBits == id.leastSigBits); + } + + // Comparison Operations + + /** + * Compares this UUID with the specified UUID. + * + *

    + * The first of two UUIDs follows the second if the most significant field + * in which the UUIDs differ is greater for the first UUID. + * + * @param val + * UUID to which this UUID is to be + * compared. + * @return -1, 0 or 1 as this UUID is less than, equal to, or + * greater than val. + */ + public int compareTo(EgovFormBasedUUID val) { + // The ordering is intentionally set up so that the UUIDs + // can simply be numerically compared as two numbers + return (this.mostSigBits < val.mostSigBits ? -1 + : (this.mostSigBits > val.mostSigBits ? 1 + : (this.leastSigBits < val.leastSigBits ? -1 + : (this.leastSigBits > val.leastSigBits ? 1 : 0)))); + } + + /** + * Reconstitute the UUID instance from a stream (that is, + * deserialize it). This is necessary to set the transient fields to their + * correct uninitialized value so they will be recomputed on demand. + */ + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + + in.defaultReadObject(); + + // Set "cached computation" fields to their initial values + version = -1; + variant = -1; + timestamp = -1; + sequence = -1; + node = -1; + hashCode = -1; + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/utl/fcc/service/EgovFormatCheckUtil.java b/src/main/java/egovframework/com/utl/fcc/service/EgovFormatCheckUtil.java new file mode 100644 index 0000000..87d999e --- /dev/null +++ b/src/main/java/egovframework/com/utl/fcc/service/EgovFormatCheckUtil.java @@ -0,0 +1,207 @@ +package egovframework.com.utl.fcc.service; + +/** + * + * 포맷유효성체크 에 대한 Util 클래스 + * @author 공통컴포넌트 개발팀 윤성록 + * @since 2009.06.23 + * @version 1.0 + * @see + * + *

    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.06.23  윤성록          최초 생성
    + *
    + * 
    + */ +public class EgovFormatCheckUtil { + + /** + * + * + * + * @param 전화번호 문자열( 3개 ) + * @return 유효한 전화번호 형식인지 여부 (True/False) + */ + public static boolean checkFormatTell(String tell1, String tell2, String tell3) { + + String[] check = {"02", "031", "032", "033", "041", "042", "043", "051", "052", "053", "054", "055", "061", + "062", "063", "070", "080", "0505"}; //존재하는 국번 데이터 + String temp = tell1 + tell2 + tell3; + + for(int i=0; i < temp.length(); i++){ + if (temp.charAt(i) < '0' || temp.charAt(i) > '9') + return false; + } //숫자가 아닌 값이 들어왔는지를 확인 + + for(int i = 0; i < check.length; i++){ + if(tell1.equals(check[i])) break; + if(i == check.length - 1) return false; + } //국번입력이 제대로 되었는지를 확인 + + if(tell2.charAt(0) == '0') return false; + + if(tell1.equals("02")){ + if(tell2.length() != 3 && tell2.length() !=4) return false; + if(tell3.length() != 4) return false; //서울지역(02)국번 입력때의 전화 번호 형식유효성 체크 + }else{ + if(tell2.length() != 3) return false; + if(tell3.length() != 4) return false; + } //서울을 제외한 지역(국번 입력때의 전화 번호 형식유효성 체크 + + return true; + } + + /** + *

    xxx - xxx- xxxx 형식의 전화번호 하나를 입력 받아 유요한 전화번호형식인지 검사.

    + * + * + * @param 전화번호 문자열 (1개) + * @return 유효한 전화번호 형식인지 여부 (True/False) + */ + public static boolean checkFormatTell(String tellNumber) { + + String temp1; + String temp2; + String temp3; + String tell = tellNumber; + + tell = tell.replace("-", ""); + + if(tell.length() < 9 || tell.length() > 11 || tell.charAt(0) != '0') return false; //전화번호 길이에 대한 체크 + + if(tell.charAt(1) =='2'){ //서울지역 (02)국번의 경우일때 + temp1 = tell.substring(0,2); + if(tell.length() == 9){ + temp2 = tell.substring(2,5); + temp3 = tell.substring(5,9); + }else if(tell.length() == 10){ + temp2 = tell.substring(2,6); + temp3 = tell.substring(6,10); + }else + return false; + } else if(tell.substring(0,4).equals("0505")){ //평생번호(0505)국번의 경우일때 + if(tell.length() != 11) return false; + temp1 = tell.substring(0,4); + temp2 = tell.substring(4,7); + temp3 = tell.substring(7,11); + } else { // 서울지역 및 "0505" 를 제외한 일반적인 경우일때 + if(tell.length() != 10) return false; + temp1 = tell.substring(0,3); + temp2 = tell.substring(3,6); + temp3 = tell.substring(6,10); + } + + return checkFormatTell(temp1, temp2, temp3); + } + + /** + *

    xxx - xxx- xxxx 형식의 휴대폰번호 앞, 중간, 뒤 문자열 3개 입력 받아 유요한 휴대폰번호형식인지 검사.

    + * + * + * @param 휴대폰번호 문자열,(3개) + * @return 유효한 휴대폰번호 형식인지 여부 (True/False) + */ + public static boolean checkFormatCell(String cell1, String cell2, String cell3) { + String[] check = {"010", "011", "016", "017", "018", "019"}; //유효한 휴대폰 첫자리 번호 데이터 + String temp = cell1 + cell2 + cell3; + + for(int i=0; i < temp.length(); i++){ + if (temp.charAt(i) < '0' || temp.charAt(i) > '9') + return false; + } //숫자가 아닌 값이 들어왔는지를 확인 + + for(int i = 0; i < check.length; i++){ + if(cell1.equals(check[i])) break; + if(i == check.length - 1) return false; + } // 휴대폰 첫자리 번호입력의 유효성 체크 + + if(cell2.charAt(0) == '0') return false; + + if(cell2.length() != 3 && cell2.length() !=4) return false; + if(cell3.length() != 4) return false; + + return true; + } + + /** + *

    XXXXXXXXXX 형식의 휴대폰번호 문자열 3개 입력 받아 유요한 휴대폰번호형식인지 검사.

    + * + * + * @param 휴대폰번호 문자열(1개) + * @return 유효한 휴대폰번호 형식인지 여부 (True/False) + */ + public static boolean checkFormatCell(String cellNumber) { + + String temp1; + String temp2; + String temp3; + + String cell = cellNumber; + cell = cell.replace("-", ""); + + if(cell.length() < 10 || cell.length() > 11 || cell.charAt(0) != '0') return false; + + if(cell.length() == 10){ //전체 10자리 휴대폰 번호일 경우 + temp1 = cell.substring(0,3); + temp2 = cell.substring(3,6); + temp3 = cell.substring(6,10); + }else{ //전체 11자리 휴대폰 번호일 경우 + temp1 = cell.substring(0,3); + temp2 = cell.substring(3,7); + temp3 = cell.substring(7,11); + } + + return checkFormatCell(temp1, temp2, temp3); + } + + /** + *

    이메일의 앞, 뒤 문자열 2개 입력 받아 유요한 이메일형식인지 검사.

    + * + * + * @param 이메일 문자열 (2개) + * @return 유효한 이메일 형식인지 여부 (True/False) + */ + public static boolean checkFormatMail(String mail1, String mail2) { + + int count = 0; + + for(int i = 0; i < mail1.length(); i++){ + if(mail1.charAt(i) <= 'z' && mail1.charAt(i) >= 'a') continue; + else if(mail1.charAt(i) <= 'Z' && mail1.charAt(i) >= 'A') continue; + else if(mail1.charAt(i) <= '9' && mail1.charAt(i) >= '0') continue; + else if(mail1.charAt(i) == '-' && mail1.charAt(i) == '_') continue; + else return false; + } // 유효한 문자, 숫자인지 체크 + + for(int i = 0; i < mail2.length(); i++){ + if(mail2.charAt(i) <= 'z' && mail2.charAt(i) >= 'a') continue; + else if(mail2.charAt(i) == '.'){ count++; continue;} + else return false; + } // 메일 주소의 형식 체크(xxx.xxx 형태) + + if(count == 1) return true; + else return false; + + } + + /** + *

    이메일의 전체문자열 1개 입력 받아 유요한 이메일형식인지 검사.

    + * + * + * @param 이메일 문자열 (1개) + * @return 유효한 이메일 형식인지 여부 (True/False) + */ + public static boolean checkFormatMail(String mail) { + + String[] temp = mail.split("@"); // '@' 를 기점으로 앞, 뒤 문자열 구분 + + if(temp.length == 2) return checkFormatMail(temp[0], temp[1]); + else return false; + } + +} + diff --git a/src/main/java/egovframework/com/utl/fcc/service/EgovNumberCheckUtil.java b/src/main/java/egovframework/com/utl/fcc/service/EgovNumberCheckUtil.java new file mode 100644 index 0000000..485f3c0 --- /dev/null +++ b/src/main/java/egovframework/com/utl/fcc/service/EgovNumberCheckUtil.java @@ -0,0 +1,246 @@ +package egovframework.com.utl.fcc.service; + +/** + * + * 번호유효성체크 에 대한 Util 클래스 + * @author 공통컴포넌트 개발팀 윤성록 + * @since 2009.06.10 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.06.10  윤성록          최초 생성
    + *   2012.02.27  이기하          법인번호 체크로직 수정
    + *
    + * 
    + */ +public class EgovNumberCheckUtil { + + /** + *

    XXXXXX - XXXXXXX 형식의 주민번호 앞, 뒤 문자열 2개 입력 받아 유효한 주민번호인지 검사.

    + * + * + * @param 6자리 주민앞번호 문자열 , 7자리 주민뒷번호 문자열 + * @return 유효한 주민번호인지 여부 (True/False) + */ + @SuppressWarnings("static-access") + public static boolean checkJuminNumber(String jumin1, String jumin2) { + + EgovDateUtil egovDateUtil = new EgovDateUtil(); + String juminNumber = jumin1 + jumin2; + String IDAdd = "234567892345"; // 주민등록번호에 가산할 값 + + int count_num = 0; + int add_num = 0; + int total_id = 0; //검증을 위한 변수선언 + + if (juminNumber.length() != 13) return false; // 주민등록번호 자리수가 맞는가를 확인 + + for (int i = 0; i <12 ; i++){ + if(juminNumber.charAt(i)< '0' || juminNumber.charAt(i) > '9') return false; //숫자가 아닌 값이 들어왔는지를 확인 + count_num = Character.getNumericValue(juminNumber.charAt(i)); + add_num = Character.getNumericValue(IDAdd.charAt(i)); + total_id += count_num * add_num; //유효자리 검증식을 적용 + } + + if(Character.getNumericValue(juminNumber.charAt(0)) == 0 || Character.getNumericValue(juminNumber.charAt(0)) == 1){ + if(Character.getNumericValue(juminNumber.charAt(6)) > 4) return false; + String temp = "20" + juminNumber.substring(0,6); + if(!egovDateUtil.checkDate(temp)) return false; + }else{ + if(Character.getNumericValue(juminNumber.charAt(6)) > 2) return false; + String temp = "19" + juminNumber.substring(0,6); + if(!egovDateUtil.checkDate(temp)) return false; + } //주민번호 앞자리 날짜유효성체크 & 성별구분 숫자 체크 + + if(Character.getNumericValue(juminNumber.charAt(12)) == (11 - (total_id % 11)) % 10) //마지막 유효숫자와 검증식을 통한 값의 비교 + return true; + else + return false; + } + + /** + *

    XXXXXXXXXXXXX 형식의 13자리 주민번호 1개를 입력 받아 유효한 주민번호인지 검사.

    + * + * + * @param 13자리 주민번호 문자열 + * @return 유효한 주민번호인지 여부 (True/False) + */ + public static boolean checkJuminNumber(String jumin) { + + if(jumin.length() != 13) return false; + + return checkJuminNumber(jumin.substring(0,6), jumin.substring(6,13)); //주민번호 + } + + /** + *

    XXXXXX - XXXXXXX 형식의 법인번호 앞, 뒤 문자열 2개 입력 받아 유효한 법인번호인지 검사.

    + * + * + * @param 6자리 법인앞번호 문자열 , 7자리 법인뒷번호 문자열 + * @return 유효한 법인번호인지 여부 (True/False) + */ + public static boolean checkBubinNumber(String bubin1, String bubin2) { + + String bubinNumber = bubin1 + bubin2; + + int hap = 0; + int temp = 1; //유효검증식에 사용하기 위한 변수 + + if(bubinNumber.length() != 13) return false; //법인번호의 자리수가 맞는 지를 확인 + + for(int i=0; i < 13; i++){ + if (bubinNumber.charAt(i) < '0' || bubinNumber.charAt(i) > '9') //숫자가 아닌 값이 들어왔는지를 확인 + return false; + } + + + // 2012.02.27 법인번호 체크로직 수정( i<13 -> i<12 ) + // 맨끝 자리 수는 전산시스템으로 오류를 검증하기 위해 부여되는 검증번호임 + for ( int i=0; i<12; i++){ + if(temp ==3) temp = 1; + hap = hap + (Character.getNumericValue(bubinNumber.charAt(i)) * temp); + temp++; + } //검증을 위한 식의 계산 + + if ((10 - (hap%10))%10 == Character.getNumericValue(bubinNumber.charAt(12))) //마지막 유효숫자와 검증식을 통한 값의 비교 + return true; + else + return false; + } + + /** + *

    XXXXXXXXXXXXX 형식의 13자리 법인번호 1개를 입력 받아 유효한 법인번호인지 검사.

    + * + * + * @param 13자리 법인번호 문자열 + * @return 유효한 법인번호인지 여부 (True/False) + */ + public static boolean checkBubinNumber(String bubin) { + + if(bubin.length() != 13) return false; + + return checkBubinNumber(bubin.substring(0,6), bubin.substring(6,13)); + } + + + /** + *

    xxx - xx - xxxx 형식의 사업자번호 앞,중간, 뒤 문자열 3개 입력 받아 유효한 사업자번호인지 검사.

    + * + * + * @param 3자리 사업자앞번호 문자열 , 2자리 사업자중간번호 문자열, 5자리 사업자뒷번호 문자열 + * @return 유효한 사업자번호인지 여부 (True/False) + */ + public static boolean checkCompNumber(String comp1, String comp2, String comp3) { + + String compNumber = comp1 + comp2 + comp3; + + int hap = 0; + int temp = 0; + int check[] = {1,3,7,1,3,7,1,3,5}; //사업자번호 유효성 체크 필요한 수 + + if(compNumber.length() != 10) //사업자번호의 길이가 맞는지를 확인한다. + return false; + + for(int i=0; i < 9; i++){ + if(compNumber.charAt(i) < '0' || compNumber.charAt(i) > '9') //숫자가 아닌 값이 들어왔는지를 확인한다. + return false; + + hap = hap + (Character.getNumericValue(compNumber.charAt(i)) * check[temp]); //검증식 적용 + temp++; + } + + hap += (Character.getNumericValue(compNumber.charAt(8))*5)/10; + + if ((10 - (hap%10))%10 == Character.getNumericValue(compNumber.charAt(9))) //마지막 유효숫자와 검증식을 통한 값의 비교 + return true; + else + return false; + } + + /** + *

    XXXXXXXXXX 형식의 10자리 사업자번호 3개를 입력 받아 유효한 사업자번호인지 검사.

    + * + * + * @param 10자리 사업자번호 문자열 + * @return 유효한 사업자번호인지 여부 (True/False) + */ + public static boolean checkCompNumber(String comp) { + + if(comp.length() != 10) return false; + return checkCompNumber(comp.substring(0,3), comp.substring(3,5), comp.substring(5,10)); + } + + /** + *

    XXXXXX - XXXXXXX 형식의 외국인등록번호 앞, 뒤 문자열 2개 입력 받아 유효한 외국인등록번호인지 검사.

    + * + * + * @param 6자리 외국인등록앞번호 문자열 , 7자리 외국인등록뒷번호 문자열 + * @return 유효한 외국인등록번호인지 여부 (True/False) + */ + @SuppressWarnings("static-access") + public static boolean checkforeignNumber( String foreign1, String foreign2 ) { + + EgovDateUtil egovDateUtil = new EgovDateUtil(); + String foreignNumber = foreign1 + foreign2; + int check = 0; + + if( foreignNumber.length() != 13 ) //외국인등록번호의 길이가 맞는지 확인한다. + return false; + + for(int i=0; i < 13; i++){ + if (foreignNumber.charAt(i) < '0' || foreignNumber.charAt(i) > '9') //숫자가 아닌 값이 들어왔는지를 확인한다. + return false; + } + + if(Character.getNumericValue(foreignNumber.charAt(0)) == 0 || Character.getNumericValue(foreignNumber.charAt(0)) == 1){ + if(Character.getNumericValue(foreignNumber.charAt(6)) == 5 && Character.getNumericValue(foreignNumber.charAt(6)) == 6) return false; + String temp = "20" + foreignNumber.substring(0,6); + if(!egovDateUtil.checkDate(temp)) return false; + }else{ + if(Character.getNumericValue(foreignNumber.charAt(6)) == 5 && Character.getNumericValue(foreignNumber.charAt(6)) == 6) return false; + String temp = "19" + foreignNumber.substring(0,6); + if(!egovDateUtil.checkDate(temp)) return false; + } //외국인등록번호 앞자리 날짜유효성체크 & 성별구분 숫자 체크 + + for( int i = 0 ; i < 12 ; i++ ) { + check += ( ( 9 - i % 8 ) * Character.getNumericValue( foreignNumber.charAt( i ) ) ); + } + + if ( check % 11 == 0 ){ + check = 1; + }else if ( check % 11==10 ){ + check = 0; + }else + check = check % 11; + + if ( check + 2 > 9 ){ + check = check + 2- 10; + }else check = check+2; //검증식을 통합 값의 도출 + + if( check == Character.getNumericValue( foreignNumber.charAt( 12 ) ) ) //마지막 유효숫자와 검증식을 통한 값의 비교 + return true; + else + return false; + } + + + /** + *

    XXXXXXXXXXXXX 형식의 13자리 외국인등록번호 1개를 입력 받아 유효한 외국인등록번호인지 검사.

    + * + * + * @param 13자리 외국인등록번호 문자열 + * @return 유효한 외국인등록번호인지 여부 (True/False) + */ + public static boolean checkforeignNumber( String foreign ) { + + if(foreign.length() != 13) return false; + return checkforeignNumber(foreign.substring(0,6), foreign.substring(6,13)); + } +} + + diff --git a/src/main/java/egovframework/com/utl/fcc/service/EgovNumberFormat.java b/src/main/java/egovframework/com/utl/fcc/service/EgovNumberFormat.java new file mode 100644 index 0000000..701eda4 --- /dev/null +++ b/src/main/java/egovframework/com/utl/fcc/service/EgovNumberFormat.java @@ -0,0 +1,258 @@ +package egovframework.com.utl.fcc.service; + +import java.text.NumberFormat; +import java.util.Locale; + +/** + * 숫자, 통화, 퍼센트에 대한 형식 변환을 수행하는 클래스 + */ +public class EgovNumberFormat { + + private static final int MAX_FRACTION_DIGIT = 3; + private static final boolean GROUPING_USED = true; + + /** + * 기본 Locale에 해당하는 형식으로 숫자를 변환한다. + * + * @param number 숫자 + * @return 숫자 문자열 + */ + public static String formatNumber(Number number) { + return formatNumber(number, GROUPING_USED, MAX_FRACTION_DIGIT); + } + + /** + * Locale에 해당하는 형식으로 숫자를 변환한다. + * + * @param locale 로케일 + * @param number 숫자 + * @return 숫자 문자열 + */ + public static String formatNumber(Locale locale, Number number) { + return formatNumber(locale, number, GROUPING_USED, MAX_FRACTION_DIGIT); + } + + /** + * 기본 Locale에 해당하는 형식으로 숫자를 변환한다. + * + * @param number 숫자 + * @param groupingUsed 그룹 분리기호 포함 여부 + * @return 숫자 문자열 + */ + public static String formatNumber(Number number, boolean groupingUsed) { + return formatNumber(number, groupingUsed, MAX_FRACTION_DIGIT); + } + + /** + * Locale에 해당하는 형식으로 숫자를 변환한다. + * + * @param locale 로케일 + * @param number 숫자 + * @param groupingUsed 그룹 분리기호 포함 여부 + * @return 숫자 문자열 + */ + public static String formatNumber(Locale locale, Number number, boolean groupingUsed) { + return formatNumber(locale, number, groupingUsed, MAX_FRACTION_DIGIT); + } + + /** + * 기본 Locale에 해당하는 형식으로 숫자를 변환한다. + * + * @param number 숫자 + * @param maxFactionDigits 변환된 문자열에서 출력할 소수점 이하 최대 자리수 + * @return 숫자 문자열 + */ + public static String formatNumber(Number number, int maxFactionDigits) { + return formatNumber(number, GROUPING_USED, maxFactionDigits); + } + + /** + * Locale에 해당하는 형식으로 숫자를 변환한다. + * + * @param locale 로케일 + * @param number 숫자 + * @param maxFactionDigits 변환된 문자열에서 출력할 소수점 이하 최대 자리수 + * @return 숫자 문자열 + */ + public static String formatNumber(Locale locale, Number number, int maxFactionDigits) { + return formatNumber(locale, number, GROUPING_USED, maxFactionDigits); + } + + /** + * 기본 Locale에 해당하는 형식으로 숫자를 변환한다. + * + * @param number 숫자 + * @param groupingUsed 그룹 분리기호 포함 여부 + * @param maxFactionDigits 변환된 문자열에서 출력할 소수점 이하 최대 자리수 + * @return 숫자 문자열 + */ + public static String formatNumber(Number number, boolean groupingUsed, int maxFactionDigits) { + NumberFormat numberberFormat = NumberFormat.getNumberInstance(); + numberberFormat.setGroupingUsed(groupingUsed); + numberberFormat.setMaximumFractionDigits(maxFactionDigits); + return numberberFormat.format(number); + } + + /** + * Locale에 해당하는 형식으로 숫자를 변환한다. + * + * @param locale 로케일 + * @param number 숫자 + * @param groupingUsed 그룹 분리기호 포함 여부 + * @param maxFactionDigits 변환된 문자열에서 출력할 소수점 이하 최대 자리수 + * @return 숫자 문자열 + */ + public static String formatNumber(Locale locale, Number number, boolean groupingUsed, int maxFactionDigits) { + NumberFormat numberberFormat = NumberFormat.getNumberInstance(locale); + numberberFormat.setGroupingUsed(groupingUsed); + numberberFormat.setMaximumFractionDigits(maxFactionDigits); + return numberberFormat.format(number); + } + + /** + * 기본 Locale에 해당하는 형식으로 통화를 변환한다. + * + * @param number 숫자 + * @return 통화 문자열 + */ + public static String formatCurrency(Number number) { + return formatCurrency(number, GROUPING_USED); + } + + /** + * Locale에 해당하는 형식으로 통화를 변환한다. + * + * @param locale 로케일 + * @param number 숫자 + * @return 통화 문자열 + */ + public static String formatCurrency(Locale locale, Number number) { + return formatCurrency(locale, number, GROUPING_USED); + } + + /** + * 기본 Locale에 해당하는 형식으로 통화를 변환한다. + * + * @param number 숫자 + * @param groupingUsed 그룹 분리기호 포함 여부 + * @return 통화 문자열 + */ + public static String formatCurrency(Number number, boolean groupingUsed) { + NumberFormat numberberFormat = NumberFormat.getCurrencyInstance(); + numberberFormat.setGroupingUsed(groupingUsed); + return numberberFormat.format(number); + } + + /** + * Locale에 해당하는 형식으로 통화를 변환한다. + * + * @param locale 로케일 + * @param number 숫자 + * @param groupingUsed 그룹 분리기호 포함 여부 + * @return 통화 문자열 + */ + public static String formatCurrency(Locale locale, Number number, boolean groupingUsed) { + NumberFormat numberberFormat = NumberFormat.getCurrencyInstance(locale); + numberberFormat.setGroupingUsed(groupingUsed); + return numberberFormat.format(number); + } + + /** + * 기본 Locale에 해당하는 형식으로 퍼센트를 변환한다. + * + * @param number 숫자 + * @return 퍼센트 문자열 + */ + public static String formatPercent(Number number) { + return formatPercent(number, GROUPING_USED, MAX_FRACTION_DIGIT); + } + + /** + * Locale에 해당하는 형식으로 퍼센트를 변환한다. + * + * @param locale 로케일 + * @param number 숫자 + * @return 퍼센트 문자열 + */ + public static String formatPercent(Locale locale, Number number) { + return formatPercent(locale, number, GROUPING_USED, MAX_FRACTION_DIGIT); + } + + /** + * 기본 Locale에 해당하는 형식으로 퍼센트를 변환한다. + * + * @param number 숫자 + * @param groupingUsed 그룹 분리기호 포함 여부 + * @return 퍼센트 문자열 + */ + public static String formatPercent(Number number, boolean groupingUsed) { + return formatPercent(number, groupingUsed, MAX_FRACTION_DIGIT); + } + + /** + * Locale에 해당하는 형식으로 퍼센트를 변환한다. + * + * @param locale 로케일 + * @param number 숫자 + * @param groupingUsed 그룹 분리기호 포함 여부 + * @return 퍼센트 문자열 + */ + public static String formatPercent(Locale locale, Number number, boolean groupingUsed) { + return formatPercent(locale, number, groupingUsed, MAX_FRACTION_DIGIT); + } + + /** + * 기본 Locale에 해당하는 형식으로 퍼센트를 변환한다. + * + * @param number 숫자 + * @param maxFactionDigits 변환된 문자열에서 출력할 소수점 이하 최대 자리수 + * @return 퍼센트 문자열 + */ + public static String formatPercent(Number number, int maxFactionDigits) { + return formatPercent(number, GROUPING_USED, maxFactionDigits); + } + + /** + * Locale에 해당하는 형식으로 퍼센트를 변환한다. + * + * @param locale 로케일 + * @param number 숫자 + * @param maxFactionDigits 변환된 문자열에서 출력할 소수점 이하 최대 자리수 + * @return 퍼센트 문자열 + */ + public static String formatPercent(Locale locale, Number number, int maxFactionDigits) { + return formatPercent(locale, number, GROUPING_USED, maxFactionDigits); + } + + /** + * 기본 Locale에 해당하는 형식으로 퍼센트를 변환한다. + * + * @param number 숫자 + * @param groupingUsed 그룹 분리기호 포함 여부 + * @param maxFactionDigits 변환된 문자열에서 출력할 소수점 이하 최대 자리수 + * @return 퍼센트 문자열 + */ + public static String formatPercent(Number number, boolean groupingUsed, int maxFactionDigits) { + NumberFormat numberberFormat = NumberFormat.getPercentInstance(); + numberberFormat.setGroupingUsed(groupingUsed); + numberberFormat.setMaximumFractionDigits(maxFactionDigits); + return numberberFormat.format(number); + } + + /** + * Locale에 해당하는 형식으로 퍼센트를 변환한다. + * + * @param locale 로케일 + * @param number 숫자 + * @param groupingUsed 그룹 분리기호 포함 여부 + * @param maxFactionDigits 변환된 문자열에서 출력할 소수점 이하 최대 자리수 + * @return 퍼센트 문자열 + */ + public static String formatPercent(Locale locale, Number number, boolean groupingUsed, int maxFactionDigits) { + NumberFormat numberberFormat = NumberFormat.getPercentInstance(locale); + numberberFormat.setGroupingUsed(groupingUsed); + numberberFormat.setMaximumFractionDigits(maxFactionDigits); + return numberberFormat.format(number); + } + +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/utl/fcc/service/EgovNumberUtil.java b/src/main/java/egovframework/com/utl/fcc/service/EgovNumberUtil.java new file mode 100644 index 0000000..2735e8b --- /dev/null +++ b/src/main/java/egovframework/com/utl/fcc/service/EgovNumberUtil.java @@ -0,0 +1,216 @@ +/** + * @Class Name : EgovNumberUtil.java + * @Description : 숫자 데이터 처리 관련 유틸리티 + * @Modification Information + * + * 수정일 수정자 수정내용 + * ------- -------- --------------------------- + * 2009.02.13 이삼섭 최초 생성 + * + * @author 공통 서비스 개발팀 이삼섭 + * @since 2009. 02. 13 + * @version 1.0 + * @see + * + */ + +package egovframework.com.utl.fcc.service; + +import java.security.SecureRandom; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Locale; + +public class EgovNumberUtil { + + /** + * 특정숫자 집합에서 랜덤 숫자를 구하는 기능 시작숫자와 종료숫자 사이에서 구한 랜덤 숫자를 반환한다 + * + * @param startNum - 시작숫자 + * @param endNum - 종료숫자 + * @return 랜덤숫자 + * @see + */ + public static int getRandomNum(int startNum, int endNum) { + int randomNum = 0; + + // 랜덤 객체 생성 + SecureRandom rnd = new SecureRandom(); + + do { + // 종료숫자내에서 랜덤 숫자를 발생시킨다. + randomNum = rnd.nextInt(endNum + 1); + } while (randomNum < startNum); // 랜덤 숫자가 시작숫자보다 작을경우 다시 랜덤숫자를 발생시킨다. + + return randomNum; + } + + /** + * 특정 숫자 집합에서 특정 숫자가 있는지 체크하는 기능 12345678에서 7이 있는지 없는지 체크하는 기능을 제공함 + * + * @param sourceInt - 특정숫자집합 + * @param searchInt - 검색숫자 + * @return 존재여부 + * @see + */ + public static Boolean getNumSearchCheck(int sourceInt, int searchInt) { + String sourceStr = String.valueOf(sourceInt); + String searchStr = String.valueOf(searchInt); + + // 특정숫자가 존재하는지 하여 위치값을 리턴한다. 없을 시 -1 + if (sourceStr.indexOf(searchStr) == -1) { + return false; + } else { + return true; + } + } + + /** + * 숫자타입을 문자열로 변환하는 기능 숫자 20081212를 문자열 '20081212'로 변환하는 기능 + * + * @param srcNumber - 숫자 + * @return 문자열 + * @see + */ + public static String getNumToStrCnvr(int srcNumber) { + String rtnStr = null; + + rtnStr = String.valueOf(srcNumber); + + return rtnStr; + } + + /** + * 숫자타입을 데이트 타입으로 변환하는 기능 + * 숫자 20081212를 데이트타입 '2008-12-12'로 변환하는 기능 + * @param srcNumber - 숫자 + * @return String + * @see + */ + public static String getNumToDateCnvr(int srcNumber) { + + String pattern = null; + String cnvrStr = null; + + String srcStr = String.valueOf(srcNumber); + + // Date 형태인 8자리 및 14자리만 정상처리 + if (srcStr.length() != 8 && srcStr.length() != 14) { + throw new IllegalArgumentException("Invalid Number: " + srcStr + " Length=" + srcStr.trim().length()); + } + + if (srcStr.length() == 8) { + pattern = "yyyyMMdd"; + } else if (srcStr.length() == 14) { + pattern = "yyyyMMddhhmmss"; + } + + SimpleDateFormat dateFormatter = new SimpleDateFormat(pattern, Locale.KOREA); + + Date cnvrDate = null; + + try { + cnvrDate = dateFormatter.parse(srcStr); + } catch (ParseException e) { + throw new RuntimeException(e); + } + + cnvrStr = String.format("%1$tY-%1$tm-%1$td", cnvrDate); + + return cnvrStr; + + } + + /** + * 체크할 숫자 중에서 숫자인지 아닌지 체크하는 기능 + * 숫자이면 True, 아니면 False를 반환한다 + * @param checkStr - 체크문자열 + * @return 숫자여부 + * @see + */ + public static Boolean getNumberValidCheck(String checkStr) { + + int i; + //String sourceStr = String.valueOf(sourceInt); + + int checkStrLt = checkStr.length(); + + for (i = 0; i < checkStrLt; i++) { + + // 아스키코드값( '0'-> 48, '9' -> 57) + if (checkStr.charAt(i) > 47 && checkStr.charAt(i) < 58) { + continue; + } else { + return false; + } + } + + return true; + } + + /** + * 특정숫자를 다른 숫자로 치환하는 기능 숫자 12345678에서 123를 999로 변환하는 기능을 제공(99945678) + * + * @param srcNumber - 숫자집합 + * @param cnvrSrcNumber - 원래숫자 + * @param cnvrTrgtNumber - 치환숫자 + * @return 치환숫자 + * @see + */ + public static int getNumberCnvr(int srcNumber, int cnvrSrcNumber, int cnvrTrgtNumber) { + + // 입력받은 숫자를 문자열로 변환 + String source = String.valueOf(srcNumber); + String subject = String.valueOf(cnvrSrcNumber); + String object = String.valueOf(cnvrTrgtNumber); + + StringBuffer rtnStr = new StringBuffer(); + String preStr = ""; + String nextStr = source; + + // 원본숫자에서 변환대상숫자의 위치를 찾는다. + while (source.indexOf(subject) >= 0) { + preStr = source.substring(0, source.indexOf(subject)); // 변환대상숫자 위치까지 숫자를 잘라낸다 + nextStr = source.substring(source.indexOf(subject) + subject.length(), source.length()); + source = nextStr; + rtnStr.append(preStr).append(object); // 변환대상위치 숫자에 변환할 숫자를 붙여준다. + } + rtnStr.append(nextStr); // 변환대상 숫자 이후 숫자를 붙여준다. + + return Integer.parseInt(rtnStr.toString()); + } + + /** + * 특정숫자가 실수인지, 정수인지, 음수인지 체크하는 기능 123이 실수인지, 정수인지, 음수인지 체크하는 기능을 제공함 + * + * @param srcNumber - 숫자집합 + * @return -1(음수), 0(정수), 1(실수) + * @see + */ + public static int checkRlnoInteger(double srcNumber) { + + // byte 1바이트 ▶소수점이 없는 숫자로, 범위 -2^7 ~ 2^7 -1 + // short 2바이트 ▶소수점이 없는 숫자로, 범위 -2^15 ~ 2^15 -1 + // int 4바이트 ▶소수점이 없는 숫자로, 범위 -2^31 ~ 2^31 - 1 + // long 8바이트 ▶소수점이 없는 숫자로, 범위 -2^63 ~ 2^63-1 + + // float 4바이트 ▶소수점이 있는 숫자로, 끝에 F 또는 f 가 붙는 숫자 (예:3.14f) + // double 8바이트 ▶소수점이 있는 숫자로, 끝에 아무것도 붙지 않는 숫자 (예:3.14) + // ▶소수점이 있는 숫자로, 끝에 D 또는 d 가 붙는 숫자(예:3.14d) + + String cnvrString = null; + + if (srcNumber < 0) { + return -1; + } else { + cnvrString = String.valueOf(srcNumber); + + if (cnvrString.indexOf(".") == -1) { + return 0; + } else { + return 1; + } + } + } +} diff --git a/src/main/java/egovframework/com/utl/fcc/service/EgovStringUtil.java b/src/main/java/egovframework/com/utl/fcc/service/EgovStringUtil.java new file mode 100644 index 0000000..fa1725c --- /dev/null +++ b/src/main/java/egovframework/com/utl/fcc/service/EgovStringUtil.java @@ -0,0 +1,920 @@ +/** + * @Class Name : EgovStringUtil.java + * @Description : 문자열 데이터 처리 관련 유틸리티 + * @Modification Information + * + * 수정일 수정자 수정내용 + * ------- -------- --------------------------- + * 2009.01.13 박정규 최초 생성 + * 2009.02.13 이삼섭 내용 추가 + * + * @author 공통 서비스 개발팀 박정규 + * @since 2009. 01. 13 + * @version 1.0 + * @see + * + */ + +package egovframework.com.utl.fcc.service; + +/* + * Copyright 2001-2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the ";License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS"; BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.io.UnsupportedEncodingException; +import java.math.BigDecimal; +import java.security.SecureRandom; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.Locale; + +public class EgovStringUtil { + /** + * 빈 문자열 "". + */ + public static final String EMPTY = ""; + + /** + *

    Padding을 할 수 있는 최대 수치

    + */ + // private static final int PAD_LIMIT = 8192; + + /** + *

    An array of Strings used for padding.

    + *

    Used for efficient space padding. The length of each String expands as needed.

    + */ + /* + private static final String[] PADDING = new String[Character.MAX_VALUE]; + + static { + // space padding is most common, start with 64 chars + PADDING[32] = " "; + } + */ + + /** + * 문자열이 지정한 길이를 초과했을때 지정한길이에다가 해당 문자열을 붙여주는 메서드. + * @param source 원본 문자열 배열 + * @param output 더할문자열 + * @param slength 지정길이 + * @return 지정길이로 잘라서 더할분자열 합친 문자열 + */ + public static String cutString(String source, String output, int slength) { + String returnVal = null; + if (source != null) { + if (source.length() > slength) { + returnVal = source.substring(0, slength) + output; + } else { + returnVal = source; + } + } + return returnVal; + } + + /** + * 문자열이 지정한 길이를 초과했을때 해당 문자열을 삭제하는 메서드 + * @param source 원본 문자열 배열 + * @param slength 지정길이 + * @return 지정길이로 잘라서 더할분자열 합친 문자열 + */ + public static String cutString(String source, int slength) { + String result = null; + if (source != null) { + if (source.length() > slength) { + result = source.substring(0, slength); + } else { + result = source; + } + } + return result; + } + + /** + *

    + * String이 비었거나("") 혹은 null 인지 검증한다. + *

    + * + *
    +	 *  StringUtil.isEmpty(null)      = true
    +	 *  StringUtil.isEmpty("")        = true
    +	 *  StringUtil.isEmpty(" ")       = false
    +	 *  StringUtil.isEmpty("bob")     = false
    +	 *  StringUtil.isEmpty("  bob  ") = false
    +	 * 
    + * + * @param str - 체크 대상 스트링오브젝트이며 null을 허용함 + * @return true - 입력받은 String 이 빈 문자열 또는 null인 경우 + */ + public static boolean isEmpty(String str) { + return str == null || str.length() == 0; + } + + /** + *

    기준 문자열에 포함된 모든 대상 문자(char)를 제거한다.

    + * + *
    +	 * StringUtil.remove(null, *)       = null
    +	 * StringUtil.remove("", *)         = ""
    +	 * StringUtil.remove("queued", 'u') = "qeed"
    +	 * StringUtil.remove("queued", 'z') = "queued"
    +	 * 
    + * + * @param str 입력받는 기준 문자열 + * @param remove 입력받는 문자열에서 제거할 대상 문자열 + * @return 제거대상 문자열이 제거된 입력문자열. 입력문자열이 null인 경우 출력문자열은 null + */ + public static String remove(String str, char remove) { + if (isEmpty(str) || str.indexOf(remove) == -1) { + return str; + } + char[] chars = str.toCharArray(); + int pos = 0; + for (int i = 0; i < chars.length; i++) { + if (chars[i] != remove) { + chars[pos++] = chars[i]; + } + } + return new String(chars, 0, pos); + } + + /** + *

    문자열 내부의 콤마 character(,)를 모두 제거한다.

    + * + *
    +	 * StringUtil.removeCommaChar(null)       = null
    +	 * StringUtil.removeCommaChar("")         = ""
    +	 * StringUtil.removeCommaChar("asdfg,qweqe") = "asdfgqweqe"
    +	 * 
    + * + * @param str 입력받는 기준 문자열 + * @return " , "가 제거된 입력문자열 + * 입력문자열이 null인 경우 출력문자열은 null + */ + public static String removeCommaChar(String str) { + return remove(str, ','); + } + + /** + *

    문자열 내부의 마이너스 character(-)를 모두 제거한다.

    + * + *
    +	 * StringUtil.removeMinusChar(null)       = null
    +	 * StringUtil.removeMinusChar("")         = ""
    +	 * StringUtil.removeMinusChar("a-sdfg-qweqe") = "asdfgqweqe"
    +	 * 
    + * + * @param str 입력받는 기준 문자열 + * @return " - "가 제거된 입력문자열 + * 입력문자열이 null인 경우 출력문자열은 null + */ + public static String removeMinusChar(String str) { + return remove(str, '-'); + } + + /** + * 원본 문자열의 포함된 특정 문자열을 새로운 문자열로 변환하는 메서드 + * @param source 원본 문자열 + * @param subject 원본 문자열에 포함된 특정 문자열 + * @param object 변환할 문자열 + * @return sb.toString() 새로운 문자열로 변환된 문자열 + */ + public static String replace(String source, String subject, String object) { + StringBuffer rtnStr = new StringBuffer(); + String preStr = ""; + String nextStr = source; + String srcStr = source; + + while (srcStr.indexOf(subject) >= 0) { + preStr = srcStr.substring(0, srcStr.indexOf(subject)); + nextStr = srcStr.substring(srcStr.indexOf(subject) + subject.length(), srcStr.length()); + srcStr = nextStr; + rtnStr.append(preStr).append(object); + } + rtnStr.append(nextStr); + + return rtnStr.toString(); + } + + /** + * 원본 문자열의 포함된 특정 문자열 첫번째 한개만 새로운 문자열로 변환하는 메서드 + * @param source 원본 문자열 + * @param subject 원본 문자열에 포함된 특정 문자열 + * @param object 변환할 문자열 + * @return sb.toString() 새로운 문자열로 변환된 문자열 / source 특정문자열이 없는 경우 원본 문자열 + */ + public static String replaceOnce(String source, String subject, String object) { + StringBuffer rtnStr = new StringBuffer(); + String preStr = ""; + String nextStr = source; + if (source.indexOf(subject) >= 0) { + preStr = source.substring(0, source.indexOf(subject)); + nextStr = source.substring(source.indexOf(subject) + subject.length(), source.length()); + rtnStr.append(preStr).append(object).append(nextStr); + + return rtnStr.toString(); + } else { + return source; + } + } + + /** + * subject에 포함된 각각의 문자를 object로 변환한다. + * + * @param source 원본 문자열 + * @param subject 원본 문자열에 포함된 특정 문자열 + * @param object 변환할 문자열 + * @return sb.toString() 새로운 문자열로 변환된 문자열 + */ + public static String replaceChar(String source, String subject, String object) { + StringBuffer rtnStr = new StringBuffer(); + String preStr = ""; + String nextStr = source; + String srcStr = source; + + char chA; + + for (int i = 0; i < subject.length(); i++) { + chA = subject.charAt(i); + + if (srcStr.indexOf(chA) >= 0) { + preStr = srcStr.substring(0, srcStr.indexOf(chA)); + nextStr = srcStr.substring(srcStr.indexOf(chA) + 1, srcStr.length()); + srcStr = rtnStr.append(preStr).append(object).append(nextStr).toString(); + } + } + + return srcStr; + } + + /** + *

    strsearchStr의 시작(index) 위치를 반환.

    + * + *

    입력값 중 null이 있을 경우 -1을 반환.

    + * + *
    +	 * StringUtil.indexOf(null, *)          = -1
    +	 * StringUtil.indexOf(*, null)          = -1
    +	 * StringUtil.indexOf("", "")           = 0
    +	 * StringUtil.indexOf("aabaabaa", "a")  = 0
    +	 * StringUtil.indexOf("aabaabaa", "b")  = 2
    +	 * StringUtil.indexOf("aabaabaa", "ab") = 1
    +	 * StringUtil.indexOf("aabaabaa", "")   = 0
    +	 * 
    + * + * @param str 검색 문자열 + * @param searchStr 검색 대상문자열 + * @return 검색 문자열 중 검색 대상문자열이 있는 시작 위치 검색대상 문자열이 없거나 null인 경우 -1 + */ + public static int indexOf(String str, String searchStr) { + if (str == null || searchStr == null) { + return -1; + } + + return str.indexOf(searchStr); + } + + /** + *

    오라클의 decode 함수와 동일한 기능을 가진 메서드이다. + * sourStrcompareStr의 값이 같으면 + * returStr을 반환하며, 다르면 defaultStr을 반환한다. + *

    + * + *
    +	 * StringUtil.decode(null, null, "foo", "bar")= "foo"
    +	 * StringUtil.decode("", null, "foo", "bar") = "bar"
    +	 * StringUtil.decode(null, "", "foo", "bar") = "bar"
    +	 * StringUtil.decode("하이", "하이", null, "bar") = null
    +	 * StringUtil.decode("하이", "하이  ", "foo", null) = null
    +	 * StringUtil.decode("하이", "하이", "foo", "bar") = "foo"
    +	 * StringUtil.decode("하이", "하이  ", "foo", "bar") = "bar"
    +	 * 
    + * + * @param sourceStr 비교할 문자열 + * @param compareStr 비교 대상 문자열 + * @param returnStr sourceStr와 compareStr의 값이 같을 때 반환할 문자열 + * @param defaultStr sourceStr와 compareStr의 값이 다를 때 반환할 문자열 + * @return sourceStr과 compareStr의 값이 동일(equal)할 때 returnStr을 반환하며, + *
    다르면 defaultStr을 반환한다. + */ + public static String decode(String sourceStr, String compareStr, String returnStr, String defaultStr) { + // if (sourceStr == null && compareStr == null) { + // return returnStr; + // } + // + // if (sourceStr == null && compareStr != null) { + // return defaultStr; + // } + // + // if (sourceStr.trim().equals(compareStr)) { + // return returnStr; + // } + + if (sourceStr == null) { //2022.01. Possible null pointer dereference + if (compareStr == null) { + return returnStr; + } else { + return defaultStr; + } + } else { + if (sourceStr.trim().equals(compareStr)) { + return returnStr; + } + } + + return defaultStr; + } + + /** + *

    오라클의 decode 함수와 동일한 기능을 가진 메서드이다. + * sourStrcompareStr의 값이 같으면 + * returStr을 반환하며, 다르면 sourceStr을 반환한다. + *

    + * + *
    +	 * StringUtil.decode(null, null, "foo") = "foo"
    +	 * StringUtil.decode("", null, "foo") = ""
    +	 * StringUtil.decode(null, "", "foo") = null
    +	 * StringUtil.decode("하이", "하이", "foo") = "foo"
    +	 * StringUtil.decode("하이", "하이 ", "foo") = "하이"
    +	 * StringUtil.decode("하이", "바이", "foo") = "하이"
    +	 * 
    + * + * @param sourceStr 비교할 문자열 + * @param compareStr 비교 대상 문자열 + * @param returnStr sourceStr와 compareStr의 값이 같을 때 반환할 문자열 + * @return sourceStr과 compareStr의 값이 동일(equal)할 때 returnStr을 반환하며, + *
    다르면 sourceStr을 반환한다. + */ + public static String decode(String sourceStr, String compareStr, String returnStr) { + return decode(sourceStr, compareStr, returnStr, sourceStr); + } + + /** + * 객체가 null인지 확인하고 null인 경우 "" 로 바꾸는 메서드 + * @param object 원본 객체 + * @return resultVal 문자열 + */ + public static String isNullToString(Object object) { + String string = ""; + + if (object != null) { + string = object.toString().trim(); + } + + return string; + } + + /** + *
    +	 * 인자로 받은 String이 null일 경우 ""로 리턴한다.
    +	 * @param src null값일 가능성이 있는 String 값.
    +	 * @return 만약 String이 null 값일 경우 ""로 바꾼 String 값.
    +	 *
    + */ + public static String nullConvert(Object src) { + //if (src != null && src.getClass().getName().equals("java.math.BigDecimal")) { + if (src != null && src instanceof java.math.BigDecimal) { + return ((BigDecimal)src).toString(); + } + + if (src == null || src.equals("null")) { + return ""; + } else { + return ((String)src).trim(); + } + } + + /** + *
    +	 * 인자로 받은 String이 null일 경우 ""로 리턴한다.
    +	 * @param src null값일 가능성이 있는 String 값.
    +	 * @return 만약 String이 null 값일 경우 ""로 바꾼 String 값.
    +	 *
    + */ + public static String nullConvertInt(Object src) { + //if (src != null && src.getClass().getName().equals("java.math.BigDecimal")) { + if (src != null && src instanceof java.math.BigDecimal) { + return ((BigDecimal)src).toString(); + } + + if (src == null || src.equals("null")) { + return "0"; + } else { + return ((String)src).trim(); + } + } + + /** + *
    +	 * 인자로 받은 String이 null일 경우 ""로 리턴한다.
    +	 * @param src null값일 가능성이 있는 String 값.
    +	 * @return 만약 String이 null 값일 경우 ""로 바꾼 String 값.
    +	 *
    + */ + public static String nullConvert(String src) { + + if (src == null || src.equals("null") || "".equals(src) || " ".equals(src)) { + return ""; + } else { + return src.trim(); + } + } + + /** + *
    +	 * 인자로 받은 String이 null일 경우 "0"로 리턴한다.
    +	 * @param src null값일 가능성이 있는 String 값.
    +	 * @return 만약 String이 null 값일 경우 "0"로 바꾼 String 값.
    +	 *
    + */ + public static int zeroConvert(Object src) { + + if (src == null || src.equals("null")) { + return 0; + } else { + return Integer.parseInt(((String)src).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()); + } + } + + /** + *

    문자열에서 {@link Character#isWhitespace(char)}에 정의된 + * 모든 공백문자를 제거한다.

    + * + *
    +	 * StringUtil.removeWhitespace(null)         = null
    +	 * StringUtil.removeWhitespace("")           = ""
    +	 * StringUtil.removeWhitespace("abc")        = "abc"
    +	 * StringUtil.removeWhitespace("   ab  c  ") = "abc"
    +	 * 
    + * + * @param str 공백문자가 제거도어야 할 문자열 + * @return the 공백문자가 제거된 문자열, null이 입력되면 null이 리턴 + */ + public static String removeWhitespace(String str) { + if (isEmpty(str)) { + return str; + } + int sz = str.length(); + char[] chs = new char[sz]; + int count = 0; + for (int i = 0; i < sz; i++) { + if (!Character.isWhitespace(str.charAt(i))) { + chs[count++] = str.charAt(i); + } + } + if (count == sz) { + return str; + } + + return new String(chs, 0, count); + } + + /** + * Html 코드가 들어간 문서를 표시할때 태그에 손상없이 보이기 위한 메서드 + * + * @param strString + * @return HTML 태그를 치환한 문자열 + */ + public static String checkHtmlView(String strString) { + String strNew = ""; + + StringBuffer strTxt = new StringBuffer(""); + + char chrBuff; + int len = strString.length(); + + for (int i = 0; i < len; i++) { + chrBuff = strString.charAt(i); + + switch (chrBuff) { + case '<': + strTxt.append("<"); + break; + case '>': + strTxt.append(">"); + break; + case '"': + strTxt.append("""); + break; + case 10: + strTxt.append("
    "); + break; + case ' ': + strTxt.append(" "); + break; + //case '&' : + //strTxt.append("&"); + //break; + default: + strTxt.append(chrBuff); + } + } + + strNew = strTxt.toString(); + + return strNew; + } + + /** + * 문자열을 지정한 분리자에 의해 배열로 리턴하는 메서드. + * @param source 원본 문자열 + * @param separator 분리자 + * @return result 분리자로 나뉘어진 문자열 배열 + */ + public static String[] split(String source, String separator) throws NullPointerException { + String[] returnVal = null; + int cnt = 1; + + int index = source.indexOf(separator); + int index0 = 0; + while (index >= 0) { + cnt++; + index = source.indexOf(separator, index + 1); + } + returnVal = new String[cnt]; + cnt = 0; + index = source.indexOf(separator); + while (index >= 0) { + returnVal[cnt] = source.substring(index0, index); + index0 = index + 1; + index = source.indexOf(separator, index + 1); + cnt++; + } + returnVal[cnt] = source.substring(index0); + + return returnVal; + } + + /** + *

    {@link String#toLowerCase()}를 이용하여 소문자로 변환한다.

    + * + *
    +	 * StringUtil.lowerCase(null)  = null
    +	 * StringUtil.lowerCase("")    = ""
    +	 * StringUtil.lowerCase("aBc") = "abc"
    +	 * 
    + * + * @param str 소문자로 변환되어야 할 문자열 + * @return 소문자로 변환된 문자열, null이 입력되면 null 리턴 + */ + public static String lowerCase(String str) { + if (str == null) { + return null; + } + + return str.toLowerCase(); + } + + /** + *

    {@link String#toUpperCase()}를 이용하여 대문자로 변환한다.

    + * + *
    +	 * StringUtil.upperCase(null)  = null
    +	 * StringUtil.upperCase("")    = ""
    +	 * StringUtil.upperCase("aBc") = "ABC"
    +	 * 
    + * + * @param str 대문자로 변환되어야 할 문자열 + * @return 대문자로 변환된 문자열, null이 입력되면 null 리턴 + */ + public static String upperCase(String str) { + if (str == null) { + return null; + } + + return str.toUpperCase(); + } + + /** + *

    입력된 String의 앞쪽에서 두번째 인자로 전달된 문자(stripChars)를 모두 제거한다.

    + * + *
    +	 * StringUtil.stripStart(null, *)          = null
    +	 * StringUtil.stripStart("", *)            = ""
    +	 * StringUtil.stripStart("abc", "")        = "abc"
    +	 * StringUtil.stripStart("abc", null)      = "abc"
    +	 * StringUtil.stripStart("  abc", null)    = "abc"
    +	 * StringUtil.stripStart("abc  ", null)    = "abc  "
    +	 * StringUtil.stripStart(" abc ", null)    = "abc "
    +	 * StringUtil.stripStart("yxabc  ", "xyz") = "abc  "
    +	 * 
    + * + * @param str 지정된 문자가 제거되어야 할 문자열 + * @param stripChars 제거대상 문자열 + * @return 지정된 문자가 제거된 문자열, null이 입력되면 null 리턴 + */ + public static String stripStart(String str, String stripChars) { + int strLen; + if (str == null || (strLen = str.length()) == 0) { + return str; + } + int start = 0; + if (stripChars == null) { + while ((start != strLen) && Character.isWhitespace(str.charAt(start))) { + start++; + } + } else if (stripChars.length() == 0) { + return str; + } else { + while ((start != strLen) && (stripChars.indexOf(str.charAt(start)) != -1)) { + start++; + } + } + + return str.substring(start); + } + + /** + *

    입력된 String의 뒤쪽에서 두번째 인자로 전달된 문자(stripChars)를 모두 제거한다.

    + * + *
    +	 * StringUtil.stripEnd(null, *)          = null
    +	 * StringUtil.stripEnd("", *)            = ""
    +	 * StringUtil.stripEnd("abc", "")        = "abc"
    +	 * StringUtil.stripEnd("abc", null)      = "abc"
    +	 * StringUtil.stripEnd("  abc", null)    = "  abc"
    +	 * StringUtil.stripEnd("abc  ", null)    = "abc"
    +	 * StringUtil.stripEnd(" abc ", null)    = " abc"
    +	 * StringUtil.stripEnd("  abcyx", "xyz") = "  abc"
    +	 * 
    + * + * @param str 지정된 문자가 제거되어야 할 문자열 + * @param stripChars 제거대상 문자열 + * @return 지정된 문자가 제거된 문자열, null이 입력되면 null 리턴 + */ + public static String stripEnd(String str, String stripChars) { + int end; + if (str == null || (end = str.length()) == 0) { + return str; + } + + if (stripChars == null) { + while ((end != 0) && Character.isWhitespace(str.charAt(end - 1))) { + end--; + } + } else if (stripChars.length() == 0) { + return str; + } else { + while ((end != 0) && (stripChars.indexOf(str.charAt(end - 1)) != -1)) { + end--; + } + } + + return str.substring(0, end); + } + + /** + *

    입력된 String의 앞, 뒤에서 두번째 인자로 전달된 문자(stripChars)를 모두 제거한다.

    + * + *
    +	 * StringUtil.strip(null, *)          = null
    +	 * StringUtil.strip("", *)            = ""
    +	 * StringUtil.strip("abc", null)      = "abc"
    +	 * StringUtil.strip("  abc", null)    = "abc"
    +	 * StringUtil.strip("abc  ", null)    = "abc"
    +	 * StringUtil.strip(" abc ", null)    = "abc"
    +	 * StringUtil.strip("  abcyx", "xyz") = "  abc"
    +	 * 
    + * + * @param str 지정된 문자가 제거되어야 할 문자열 + * @param stripChars 제거대상 문자열 + * @return 지정된 문자가 제거된 문자열, null이 입력되면 null 리턴 + */ + public static String strip(String str, String stripChars) { + if (isEmpty(str)) { + return str; + } + + String srcStr = str; + srcStr = stripStart(srcStr, stripChars); + + return stripEnd(srcStr, stripChars); + } + + /** + * 문자열을 지정한 분리자에 의해 지정된 길이의 배열로 리턴하는 메서드. + * @param source 원본 문자열 + * @param separator 분리자 + * @param arraylength 배열 길이 + * @return 분리자로 나뉘어진 문자열 배열 + */ + public static String[] split(String source, String separator, int arraylength) throws NullPointerException { + String[] returnVal = new String[arraylength]; + int cnt = 0; + int index0 = 0; + int index = source.indexOf(separator); + while (index >= 0 && cnt < (arraylength - 1)) { + returnVal[cnt] = source.substring(index0, index); + index0 = index + 1; + index = source.indexOf(separator, index + 1); + cnt++; + } + returnVal[cnt] = source.substring(index0); + if (cnt < (arraylength - 1)) { + for (int i = cnt + 1; i < arraylength; i++) { + returnVal[i] = ""; + } + } + + return returnVal; + } + + /** + * 문자열 A에서 Z사이의 랜덤 문자열을 구하는 기능을 제공 시작문자열과 종료문자열 사이의 랜덤 문자열을 구하는 기능 + * + * @param startChr - 첫 문자 + * @param endChr - 마지막문자 + * @return 랜덤문자 + * @exception MyException + * @see + */ + public static String getRandomStr(char startChr, char endChr) { + + int randomInt; + String randomStr = null; + + // 시작문자 및 종료문자를 아스키숫자로 변환한다. + int startInt = Integer.valueOf(startChr); + int endInt = Integer.valueOf(endChr); + + // 시작문자열이 종료문자열보가 클경우 + if (startInt > endInt) { + throw new IllegalArgumentException("Start String: " + startChr + " End String: " + endChr); + } + + // 랜덤 객체 생성 + SecureRandom rnd = new SecureRandom(); + + do { + // 시작문자 및 종료문자 중에서 랜덤 숫자를 발생시킨다. + randomInt = rnd.nextInt(endInt + 1); + } while (randomInt < startInt); // 입력받은 문자 'A'(65)보다 작으면 다시 랜덤 숫자 발생. + + // 랜덤 숫자를 문자로 변환 후 스트링으로 다시 변환 + randomStr = (char)randomInt + ""; + + // 랜덤문자열를 리턴 + return randomStr; + } + + /** + * 문자열을 다양한 문자셋(EUC-KR[KSC5601],UTF-8..)을 사용하여 인코딩하는 기능 역으로 디코딩하여 원래의 문자열을 + * 복원하는 기능을 제공함 String temp = new String(문자열.getBytes("바꾸기전 인코딩"),"바꿀 인코딩"); + * String temp = new String(문자열.getBytes("8859_1"),"KSC5601"); => UTF-8 에서 + * EUC-KR + * + * @param srcString - 문자열 + * @param srcCharsetNm - 원래 CharsetNm + * @param charsetNm - CharsetNm + * @return 인(디)코딩 문자열 + * @exception MyException + * @see + */ + public static String getEncdDcd(String srcString, String srcCharsetNm, String cnvrCharsetNm) { + + String rtnStr = null; + + if (srcString == null) { + return null; + } + + try { + rtnStr = new String(srcString.getBytes(srcCharsetNm), cnvrCharsetNm); + } catch (UnsupportedEncodingException e) { + rtnStr = null; + } + + return rtnStr; + } + + /** + * 특수문자를 웹 브라우저에서 정상적으로 보이기 위해 특수문자를 처리('<' -> & lT)하는 기능이다 + * @param srcString - '<' + * @return 변환문자열('<' -> "<" + * @exception MyException + * @see + */ + public static String getSpclStrCnvr(String srcString) { + + String rtnStr = null; + + StringBuffer strTxt = new StringBuffer(""); + + char chrBuff; + int len = srcString.length(); + + for (int i = 0; i < len; i++) { + chrBuff = srcString.charAt(i); + + switch (chrBuff) { + case '<': + strTxt.append("<"); + break; + case '>': + strTxt.append(">"); + break; + case '&': + strTxt.append("&"); + break; + default: + strTxt.append(chrBuff); + } + } + + rtnStr = strTxt.toString(); + + return rtnStr; + } + + /** + * 응용어플리케이션에서 고유값을 사용하기 위해 시스템에서17자리의TIMESTAMP값을 구하는 기능 + * + * @param + * @return Timestamp 값 + * @exception MyException + * @see + */ + public static String getTimeStamp() { + + String rtnStr = null; + + // 문자열로 변환하기 위한 패턴 설정(년도-월-일 시:분:초:초(자정이후 초)) + String pattern = "yyyyMMddhhmmssSSS"; + + SimpleDateFormat sdfCurrent = new SimpleDateFormat(pattern, Locale.KOREA); + Timestamp ts = new Timestamp(System.currentTimeMillis()); + + rtnStr = sdfCurrent.format(ts.getTime()); + + return rtnStr; + } + + /** + * html의 특수문자를 표현하기 위해 + * + * @param srcString + * @return String + * @exception Exception + * @see + */ + public static String getHtmlStrCnvr(String srcString) { + + String tmpString = srcString; + + tmpString = tmpString.replaceAll("<", "<"); + tmpString = tmpString.replaceAll(">", ">"); + tmpString = tmpString.replaceAll("&", "&"); + tmpString = tmpString.replaceAll(" ", " "); + tmpString = tmpString.replaceAll("'", "\'"); + tmpString = tmpString.replaceAll(""", "\""); + + return tmpString; + + } + + /** + *

    날짜 형식의 문자열 내부에 마이너스 character(-)를 추가한다.

    + * + *
    +	 *   StringUtil.addMinusChar("20100901") = "2010-09-01"
    +	 * 
    + * + * @param date 입력받는 문자열 + * @return " - "가 추가된 입력문자열 + */ + public static String addMinusChar(String date) { + if (date.length() == 8) { + return date.substring(0, 4).concat("-").concat(date.substring(4, 6)).concat("-") + .concat(date.substring(6, 8)); + } else { + return ""; + } + } +} diff --git a/src/main/java/egovframework/com/utl/sec/filter/CertProcessFilter.java b/src/main/java/egovframework/com/utl/sec/filter/CertProcessFilter.java new file mode 100644 index 0000000..80e6794 --- /dev/null +++ b/src/main/java/egovframework/com/utl/sec/filter/CertProcessFilter.java @@ -0,0 +1,54 @@ +package egovframework.com.utl.sec.filter; + +import java.io.IOException; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; + +/** + * GPKISecureWeb 인증서 로그인 서비스 filter + * @author 공통컴포넌트개발팀 한성곤 + * @since 2009.08.13 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.08.13  한성곤          최초 생성
    + *
    + * 
    + */ +public class CertProcessFilter implements Filter { + @SuppressWarnings("unused") + private FilterConfig config; + + /** + * Filter init 메소드를 대치한다. + */ + public void init(FilterConfig config) throws ServletException { + this.config = config; + } + + /** + * Filter doFilter 메소드를 대치한다. + * RequestWrapper를 통해 HTML Tag 변환을 처리한다. + */ + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { + chain.doFilter(new CertProcessRequestWrapper((HttpServletRequest)request), response); + } + + /** + * Filter destroy 메소드를 대치한다. + */ + public void destroy() { + // Empty Method + } +} diff --git a/src/main/java/egovframework/com/utl/sec/filter/CertProcessRequestWrapper.java b/src/main/java/egovframework/com/utl/sec/filter/CertProcessRequestWrapper.java new file mode 100644 index 0000000..dd2467c --- /dev/null +++ b/src/main/java/egovframework/com/utl/sec/filter/CertProcessRequestWrapper.java @@ -0,0 +1,84 @@ +package egovframework.com.utl.sec.filter; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletRequestWrapper; + +/** + * GPKISecureWeb 인증서 로그인 서비스 HttpServletRequestWrapper + * @author 공통컴포넌트개발팀 한성곤 + * @since 2009.08.13 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.08.13  한성곤          최초 생성
    + *
    + * 
    + */ +public class CertProcessRequestWrapper extends HttpServletRequestWrapper { + + /** + * 생성자를 호출한다. + * + * @param request + */ + public CertProcessRequestWrapper(HttpServletRequest request) { + super(request); + } + + /** + * 변환된 HTML 태그들을 다시 변환한다. + * + * @param src + * @return + */ + protected String replaceString(String src) { + String srcString = src; + + srcString = srcString.replaceAll("<", "<"); + srcString = srcString.replaceAll(">", ">"); + srcString = srcString.replaceAll(""", "\""); + srcString = srcString.replaceAll("'", "'"); + srcString = srcString.replaceAll("&", "&"); + + return srcString; + } + + /** + * getParameterValues 메소드를 대치한다. + */ + public String[] getParameterValues(String parameter) { + String values[] = super.getParameterValues(parameter); + + if (values == null) { + return null; + } + + for(int i = 0; i < values.length; i++) { + if (values[i] != null) { + values[i] = replaceString(values[i]); + } + } + + return values; + } + + /** + * getParameter 메소드를 대치한다. + */ + public String getParameter(String parameter) { + String value = super.getParameter(parameter); + + if (value == null) { + return null; + } + + value = replaceString(value); + + return value; + } +} diff --git a/src/main/java/egovframework/com/utl/sec/service/CertInfoVO.java b/src/main/java/egovframework/com/utl/sec/service/CertInfoVO.java new file mode 100644 index 0000000..3fb096b --- /dev/null +++ b/src/main/java/egovframework/com/utl/sec/service/CertInfoVO.java @@ -0,0 +1,57 @@ +package egovframework.com.utl.sec.service; + +import java.io.Serializable; + +/** + * 인증서 정보 Value Object + * @author 공통컴포넌트개발팀 한성곤 + * @since 2009.08.06 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.08.06  한성곤          최초 생성
    + *
    + * 
    + */ +@SuppressWarnings("serial") +public class CertInfoVO implements Serializable { + /** 인증서 DN */ + private String subjectDn = null; + /** 발급자 DN */ + private String issuerDn = null; + + /** + * subjectDn attribute를 리턴한다. + * @return the subjectDn + */ + public String getSubjectDn() { + return subjectDn; + } + /** + * subjectDn attribute 값을 설정한다. + * @param subjectDn the subjectDn to set + */ + public void setSubjectDn(String subjectDn) { + this.subjectDn = subjectDn; + } + /** + * issuerDn attribute를 리턴한다. + * @return the issuerDn + */ + public String getIssuerDn() { + return issuerDn; + } + /** + * issuerDn attribute 값을 설정한다. + * @param issuerDn the issuerDn to set + */ + public void setIssuerDn(String issuerDn) { + this.issuerDn = issuerDn; + } + +} diff --git a/src/main/java/egovframework/com/utl/sec/service/EgovCertInfoUtil.java b/src/main/java/egovframework/com/utl/sec/service/EgovCertInfoUtil.java new file mode 100644 index 0000000..6e7fae9 --- /dev/null +++ b/src/main/java/egovframework/com/utl/sec/service/EgovCertInfoUtil.java @@ -0,0 +1,83 @@ +package egovframework.com.utl.sec.service; + +import javax.servlet.http.HttpServletRequest; + +import com.dsjdf.jdf.Config; +import com.dsjdf.jdf.Configuration; +import com.dsjdf.jdf.ConfigurationException; +import com.gpki.gpkiapi.cert.X509Certificate; +import com.gpki.gpkiapi.exception.GpkiApiException; +import com.gpki.gpkiapi.storage.Disk; +import com.gpki.gpkiapi.util.Base64; +import com.gpki.servlet.GPKIHttpServletRequest; + +/** + * GPKISecureWeb 인증서 로그인 서비스 유틸 + * @author 공통컴포넌트개발팀 한성곤 + * @since 2009.08.06 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.08.06  한성곤          최초 생성
    + *
    + * 
    + */ +public class EgovCertInfoUtil { + /** + * 서버인증서에 대한 Base64 정보를 얻는다. + * + * @return + * @throws ConfigurationException + * @throws GpkiApiException + */ + public static String getBase64ServerCert() throws ConfigurationException, GpkiApiException { + /* + * Configuration를 사용하기 위해서는 다음과 같은 시스템 변수 지정이 필요함 + * + * -Dcom.dsjdf.config.file="/product/jeus/egovProps/gpkisecureweb/conf/dsjdf.properties" + */ + Config dsjdf = new Configuration(); + + String certPath = dsjdf.get("GPKISecureWeb.CertFilePathName"); + + X509Certificate x509Cert = null; + byte[] cert = null; + String base64cert = null; + + x509Cert = Disk.readCert(certPath); + cert = x509Cert.getCert(); + Base64 base64 = new Base64(); + base64cert = base64.encode(cert); + + return base64cert; + } + + /** + * 인증서에 대한 정보를 제공한다. + * + * @param request + * @return + * @throws Exception + */ + public static CertInfoVO getCertInfo(HttpServletRequest request) throws Exception { + CertInfoVO certInfo = new CertInfoVO(); + + GPKIHttpServletRequest gpkirequest = null; + + //System.out.println(request.getParameter("encryptedData")); + + gpkirequest = new GPKIHttpServletRequest(request); + + X509Certificate cert = gpkirequest.getSignerCert(); + + certInfo.setSubjectDn(cert.getSubjectDN()); + certInfo.setIssuerDn(cert.getIssuerDN()); + + return certInfo; + } +} diff --git a/src/main/java/egovframework/com/utl/sec/web/EgovCertLoginController.java b/src/main/java/egovframework/com/utl/sec/web/EgovCertLoginController.java new file mode 100644 index 0000000..a965b8c --- /dev/null +++ b/src/main/java/egovframework/com/utl/sec/web/EgovCertLoginController.java @@ -0,0 +1,176 @@ +package egovframework.com.utl.sec.web; + +import egovframework.com.utl.sec.service.EgovCertInfoUtil; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; + +/** + * GPKISecureWeb 인증서 로그인 Controller + * @author 공통컴포넌트개발팀 한성곤 + * @since 2009.08.06 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일      수정자           수정내용
    + *  -------    --------    ---------------------------
    + *   2009.08.06  한성곤          최초 생성
    + *
    + * 
    + */ +@Controller +public class EgovCertLoginController { + /** + * 인증서 로그인에 관련된 환경변수를 설정한다. + * + * @param type + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/utl/sec/certVar.do") + public String var(@RequestParam(value="type", required=false) String type, Model model) throws Exception { + String typeInfo = type; + + //------------------------------------------------------------ + // 서버 인증서 정보 처리 + //------------------------------------------------------------ + String serverCert = EgovCertInfoUtil.getBase64ServerCert(); + + model.addAttribute("serverCert", serverCert); + + //------------------------------------------------------------ + // install 후 이동될 페이지 지정 (프로젝트에 맞게 수정 필요) + //----------------------------------------------------------- + if (typeInfo == null) { + typeInfo = ""; + } + + String startPage = null; + + if (typeInfo.equalsIgnoreCase("login")) { + startPage = "/utl/sec/certLogin.do"; + } else if (typeInfo.equalsIgnoreCase("regist")) { + startPage = "/utl/sec/certInfoPopup.do"; + } else { + startPage = "/utl/sec/certLogin.do"; + } + + model.addAttribute("startPage", startPage); + + return "egovframework/com/utl/sec/EgovCertVar"; + } + + /** + * 인증서 관련 설치 페이지를 표시한다. + * + * @param type + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/utl/sec/certInstall.do") + public String certInstall(@RequestParam(value="type", required=false) String type, Model model) throws Exception { + String typeInfo = type; + + //------------------------------------------------------------ + // install 후 이동될 페이지 지정 (프로젝트에 맞게 수정 필요) + //----------------------------------------------------------- + if (typeInfo == null || typeInfo.equals("")) { + typeInfo = "login"; + } + + model.addAttribute("type", typeInfo); + + return "egovframework/com/utl/sec/EgovCertInstall"; + } + + /** + * 인증서 로그인 관련 설치 정보를 제공하는 설정 페이지를 표시한다. + * + * @return + * @throws Exception + */ + @RequestMapping("/utl/sec/certSetup.do") + public String certSetup() throws Exception { + return "egovframework/com/utl/sec/EgovCertSetup"; + } + + /** + * 인증서 로그인 관련 오류메시지 페이지를 표시한다. + * + * @param errMsg + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/utl/sec/certGPKIError.do") + public String certGPKIError(@RequestParam("errmsg") String errMsg, Model model) throws Exception { + + model.addAttribute("errmsg", errMsg); + + return "egovframework/com/utl/sec/EgovCertGPKIError"; + } + + /** + * 인증서 DN 등록을 위한 팝업 페이지를 표시한다. + * + * @param model + * @return + * @throws Exception + */ + @RequestMapping(value="/utl/sec/certInfoPopup.do") + public String certInfoPopup(Model model) throws Exception { + + return "egovframework/com/utl/sec/EgovCertInfoPopup"; + } + + /** + * 인증서 로그인 페이지(테스트)를 표시한다. + * + * @return + * @throws Exception + */ + @RequestMapping(value="/utl/sec/certLogin.do", method=RequestMethod.GET) + public String certLogin() throws Exception { + + return "egovframework/com/utl/sec/EgovCertLogin"; + } + + /** + * 인증서 로그인 확인 페이지(테스트)를 표시한다. + * + * @param request + * @param model + * @return + * @throws Exception + */ + @RequestMapping(value="/utl/sec/certLogin.do", method=RequestMethod.POST) + public String certLoginConfirm(HttpServletRequest request, Model model) throws Exception { + + // 인증서 정보 + model.addAttribute("certInfo", EgovCertInfoUtil.getCertInfo(request)); + + return "egovframework/com/utl/sec/EgovCertLoginConfirm"; + } + + /** + * 인증서 등록을 위한 팝업 페이지(테스트)를 표시한다. + * + * @return + * @throws Exception + */ + @RequestMapping("/utl/sec/certLoginInfo.do") + public String certLoginPopup() throws Exception { + + return "egovframework/com/utl/sec/EgovCertLoginInfo"; + } +} diff --git a/src/main/java/egovframework/com/utl/sim/service/EgovClntInfo.java b/src/main/java/egovframework/com/utl/sim/service/EgovClntInfo.java new file mode 100644 index 0000000..36a8079 --- /dev/null +++ b/src/main/java/egovframework/com/utl/sim/service/EgovClntInfo.java @@ -0,0 +1,122 @@ +/** + * Class Name : EgovClntInfo.java + * Description : 클라이언트(Client)의 IP주소, OS정보, 웹브라우저정보를 조회하는 Business Interface class + * Modification Information + * + * 수정일 수정자 수정내용 + * ------- -------- --------------------------- + * 2009.01.19 박지욱 최초 생성 + * + * @author 공통 서비스 개발팀 박지욱 + * @since 2009. 01. 19 + * @version 1.0 + * @see + * + * Copyright (C) 2009 by MOPAS All right reserved. + */ +package egovframework.com.utl.sim.service; + +import egovframework.com.cmm.service.EgovProperties; +import egovframework.com.cmm.service.Globals; + +import javax.servlet.http.HttpServletRequest; + +public class EgovClntInfo { + + /** + * 클라이언트(Client)의 IP주소를 조회하는 기능 + * @param HttpServletRequest request Request객체 + * @return String ipAddr IP주소 + * @exception Exception + */ + public static String getClntIP(HttpServletRequest request) throws Exception { + + // IP주소 + String ipAddr = request.getRemoteAddr(); + return ipAddr; + } + + /** + * 클라이언트(Client)의 OS 정보를 조회하는 기능 + * @param HttpServletRequest request Request객체 + * @return String osInfo OS 정보 + * @exception Exception + */ + public static String getClntOsInfo(HttpServletRequest request) throws Exception { + + String user_agent = request.getHeader("user-agent"); + String os_info = user_agent.toUpperCase().split(";")[2].split("\\)")[0]; + String os_conf = EgovProperties.getProperty(Globals.CLIENT_CONF_PATH, os_info.replaceAll(" ", "")); + String osInfo = ""; + if (os_conf != null && !"".equals(os_conf)) { + osInfo = os_conf; + } else { + osInfo = os_info; + } + return osInfo; + } + + /** + * 클라이언트(Client)의 웹브라우저 종류를 조회하는 기능 + * @param HttpServletRequest request Request객체 + * @return String webKind 웹브라우저 종류 + * @exception Exception + */ + public static String getClntWebKind(HttpServletRequest request) throws Exception { + + String user_agent = request.getHeader("user-agent"); + + // 웹브라우저 종류 조회 + String webKind = ""; + if (user_agent.toUpperCase().indexOf("GECKO") != -1) { + if (user_agent.toUpperCase().indexOf("NESCAPE") != -1) { + webKind = "Netscape (Gecko/Netscape)"; + } else if (user_agent.toUpperCase().indexOf("FIREFOX") != -1) { + webKind = "Mozilla Firefox (Gecko/Firefox)"; + } else { + webKind = "Mozilla (Gecko/Mozilla)"; + } + } else if (user_agent.toUpperCase().indexOf("MSIE") != -1) { + if (user_agent.toUpperCase().indexOf("OPERA") != -1) { + webKind = "Opera (MSIE/Opera/Compatible)"; + } else { + webKind = "Internet Explorer (MSIE/Compatible)"; + } + } else if (user_agent.toUpperCase().indexOf("SAFARI") != -1) { + if (user_agent.toUpperCase().indexOf("CHROME") != -1) { + webKind = "Google Chrome"; + } else { + webKind = "Safari"; + } + } else if (user_agent.toUpperCase().indexOf("THUNDERBIRD") != -1) { + webKind = "Thunderbird"; + } else { + webKind = "Other Web Browsers"; + } + return webKind; + } + + /** + * 클라이언트(Client)의 웹브라우저 버전을 조회하는 기능 + * @param HttpServletRequest request Request객체 + * @return String webVer 웹브라우저 버전 + * @exception Exception + */ + public static String getClntWebVer(HttpServletRequest request) throws Exception { + + String user_agent = request.getHeader("user-agent"); + + // 웹브라우저 버전 조회 + String webVer = ""; + String [] arr = {"MSIE", "OPERA", "NETSCAPE", "FIREFOX", "SAFARI"}; + for (int i = 0; i < arr.length; i++) { + int s_loc = user_agent.toUpperCase().indexOf(arr[i]); + if (s_loc != -1) { + int f_loc = s_loc + arr[i].length(); + webVer = user_agent.toUpperCase().substring(f_loc, f_loc+5); + webVer = webVer.replaceAll("/", "").replaceAll(";", "").replaceAll("^", "").replaceAll(",", "").replaceAll("//.", ""); + } + } + return webVer; + } +} diff --git a/src/main/java/egovframework/com/utl/sim/service/EgovFileCmprs.java b/src/main/java/egovframework/com/utl/sim/service/EgovFileCmprs.java new file mode 100644 index 0000000..babef5f --- /dev/null +++ b/src/main/java/egovframework/com/utl/sim/service/EgovFileCmprs.java @@ -0,0 +1,222 @@ +/** + * Class Name : EgovFileCmprs.java + * Description : 파일(디렉토리)의 압축 및 압축해제 하는 Business Interface class + * Modification Information + * + * 수정일 수정자 수정내용 + * ---------- -------- --------------------------- + * 2009.02.04 박지욱 최초 생성 + * 2017.03.03 조성원 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + * 2017.03.03 조성원 시큐어코딩(ES)-Null Pointer 역참조[CWE-476] + * 2018.03.19 신용호 createDirectories() 호출및 예외처리 수정 + * 2020.08.28 신용호 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + * 2020.10.29 신용호 KISA 보안약점 조치 (경로 조작 및 자원 삽입) + * + * @author 공통 서비스 개발팀 박지욱 + * @since 2009. 02. 04 + * @version 1.0 + * @see + * + * Copyright (C) 2009 by MOPAS All right reserved. + */ +package egovframework.com.utl.sim.service; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; +import java.util.zip.ZipOutputStream; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import egovframework.com.cmm.EgovWebUtil; +import egovframework.com.cmm.util.EgovResourceCloseHelper; + +public class EgovFileCmprs { + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovFileCmprs.class); + + final static int COMPRESSION_LEVEL = 8; + final static int BUFFER_SIZE = 64 * 1024; + final static char FILE_SEPARATOR = File.separatorChar; + + /** + * 파일(디렉토리)을 압축하는 기능 + * @param String source 원본파일명(디렉토리명) + * @param String target 압축파일명 + * @return boolean result 압축성공여부 True / False + * @exception Exception + */ + public static boolean cmprsFile(String source, String target) throws Exception { + + // 압축성공여부 + boolean result = false; + int cnt = 0; + // 읽어들일 byte 버퍼 + byte[] buffer = new byte[BUFFER_SIZE]; + + FileInputStream finput = null; + FileOutputStream foutput = null; + ZipOutputStream zoutput = null; + + String source1 = source.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + String target1 = target.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File srcFile = new File(source1); + + if (srcFile.exists()) { + + // 1. 파일인 경우 + if (srcFile.isFile()) { + + String target2 = EgovFileTool.createNewFile(target1); + File tarFile = new File(target2); + + foutput = null; + zoutput = null; + ZipEntry zentry = null; + + try { + foutput = new FileOutputStream(tarFile); + zoutput = new ZipOutputStream(foutput); + finput = new FileInputStream(srcFile); + zentry = new ZipEntry(srcFile.getName()); + zoutput.putNextEntry(zentry); + zoutput.setLevel(COMPRESSION_LEVEL); + cnt = 0; + while ((cnt = finput.read(buffer)) != -1) { + zoutput.write(buffer, 0, cnt); + } + zoutput.closeEntry(); + result = true; + + } catch (IOException e) { + //2017.03.03 조성원 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + if (tarFile.delete()) { + LOGGER.debug("[file.delete] tarFile : File Deletion Success"); + } else { + LOGGER.error("[file.delete] tarFile : File Deletion Fail"); + } + throw e; + } finally { + EgovResourceCloseHelper.close(finput, zoutput, foutput); + } + + // 2. 디렉토리인 경우 + } else if (srcFile.isDirectory()) { + + String target2 = EgovFileTool.createNewFile(target1); + File tarFile = new File(target2); + + ZipEntry zentry = null; + + try { + foutput = new FileOutputStream(tarFile); + zoutput = new ZipOutputStream(foutput); + File[] fileArr = srcFile.listFiles(); + + //2017.03.03 조성원 시큐어코딩(ES)-Null Pointer 역참조[CWE-476] + if (fileArr == null) { + fileArr = new File[0]; + } + + List list = EgovFileTool.getSubFilesByAll(fileArr); + + for (int i = 0; i < list.size(); i++) { + File sfile = new File(list.get(i)); + finput = new FileInputStream(sfile); + zentry = new ZipEntry(sfile.getAbsolutePath().replace('\\', '/') + .replaceAll(srcFile.getAbsolutePath().replace('\\', '/'), "")); + zoutput.putNextEntry(zentry); + zoutput.setLevel(COMPRESSION_LEVEL); + cnt = 0; + while ((cnt = finput.read(buffer)) != -1) { + zoutput.write(buffer, 0, cnt); + } + finput.close(); + result = true; + } + zoutput.closeEntry(); + } catch (IOException e) { + + //2020.08.28 신용호 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + if (tarFile.delete()) { + LOGGER.debug("[file.delete] tarFile : File Deletion Success"); + } else { + LOGGER.error("[file.delete] tarFile : File Deletion Fail"); + } + throw e; + } finally { + EgovResourceCloseHelper.close(finput, zoutput, foutput); + } + } + } + return result; + } + + /** + * 파일(디렉토리)을 압축해제하는 기능 + * @param String source 압축파일명 + * @param String target 압출이 풀릴 디렉토리 + * @return boolean result 압축해제성공여부 True / False + * @exception Exception + */ + public static boolean decmprsFile(String source, String target) throws Exception { + + // 압축해제성공여부 + boolean result = false; + int cnt = 0; + // 읽어들일 byte 버퍼 + byte[] buffer = new byte[BUFFER_SIZE]; + + FileInputStream finput = null; + FileOutputStream foutput = null; + ZipInputStream zinput = null; + + String source1 = source.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + String target1 = target.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File srcFile = new File(source1); + + if (srcFile.exists() && srcFile.isFile()) { + + String target2 = EgovFileTool.createNewDirectory(target1); + File tarFile = new File(target2); + finput = new FileInputStream(srcFile); + zinput = new ZipInputStream(finput); + + ZipEntry entry; + + try { + + File efile; + while ((entry = zinput.getNextEntry()) != null) { + + String filename = entry.getName(); + String entryFilePath = tarFile.getAbsolutePath() + FILE_SEPARATOR + filename; + entryFilePath = EgovWebUtil.filePathBlackList(entryFilePath); + efile = new File(entryFilePath); + if (entry.isDirectory()) { + EgovFileTool.createDirectories(efile.getAbsolutePath()); + } else { + foutput = new FileOutputStream(efile); + while ((cnt = zinput.read(buffer)) != -1) { + if (foutput != null) { + foutput.write(buffer, 0, cnt); + } + } + } + + } + + result = true; + + } finally { + EgovResourceCloseHelper.close(finput, zinput, foutput); + } + } + return result; + } +} diff --git a/src/main/java/egovframework/com/utl/sim/service/EgovFileMntrg.java b/src/main/java/egovframework/com/utl/sim/service/EgovFileMntrg.java new file mode 100644 index 0000000..c1106e5 --- /dev/null +++ b/src/main/java/egovframework/com/utl/sim/service/EgovFileMntrg.java @@ -0,0 +1,335 @@ +/** + * Class Name : EgovFileMntrg.java + * Description : 시스템 네트워크 정보를 확인하여 제공하는 Business class + * Modification Information + * + * 수정일 수정자 수정내용 + * ------- -------- --------------------------- + * 2009.01.13 조재영 최초 생성 + * 2017.03.06 조성원 시큐어코딩(ES)-Null Pointer 역참조[CWE-476] + * + * @author 공통 서비스 개발팀 조재영 + * @since 2009. 01. 13 + * @version 1.0 + * @see + * + * Copyright (C) 2009 by EGOV All right reserved. + */ +package egovframework.com.utl.sim.service; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.StringReader; +import java.util.ArrayList; +import java.util.List; + +import egovframework.com.cmm.util.EgovBasicLogger; +import egovframework.com.cmm.util.EgovResourceCloseHelper; + +public class EgovFileMntrg extends Thread { + + /** + *

    + * 해당 파일의 변경 유무를 체크하기 위한 Default 초의 stati final 변수, 기본 적용은 값은 60초 + *

    + */ + //static final public long DEFAULT_DELAY = 60000; // 60초 + static final public long DEFAULT_DELAY = 30000; // 30초 + + /** + * 최대 문자길이 + **/ + static final int MAX_STR_LEN = 1024; + + /** + *

    + * 파일의 변경 유무를 체크하기 위한 해당파일명 변수 + *

    + */ + protected String filename; + + /** + *

    + * 해당 파일의 변경 유무를 체크하기 위한 Default 초의 stati final 변수, 기본 적용은 값은 60초{@link + * #DEFAULT_DELAY}. + *

    + */ + protected long delay = DEFAULT_DELAY; + + File file; // 타겟(감시대상) 디렉토리 + File logFile; // 감시정보보관용 로그파일 + long lastModif = 0; + boolean warnedAlready = false; + boolean interrupted = false; + List realOriginalList = new ArrayList(); // 최초의 원본리스트 + List originalList = new ArrayList(); // 직전리스트는 주기적으로 직전목록정보로 갱신된다. + List currentList = new ArrayList(); // 직전리스트와 비교할 현시점 리스트 + List changedList = new ArrayList(); // 직전리스트와 비교한 시점에 발생된 변경리스트 + List totalChangedList = new ArrayList(); // 최초리스트와 비교한 변경 리스트 + // totalChangedList는 필요시 checkAndConfigure함수 내에서 주석해제후 사용(부하량을 고려하여 사용) + int cnt = 0; + + /** + *

    + * 감시 하고자 하는 파일명을 파라메타로 받는 기본 컨스트럭터(Constructor). + *

    + * + * @param filename + */ + protected EgovFileMntrg(String filename, File logFile) { + //log.debug("EgovFileMntrg start"); + this.logFile = logFile; + this.filename = filename; + file = new File(filename); + // 1. 최초생성시 현재 디렉토리의 하위정보를 ArrayList에 보관한다. 보관정보 ==> 절대경로 + "," + 최종수정일시 + "," + 사이즈 + File[] fList = file.listFiles(); + //2017.03.06 조성원 시큐어코딩(ES)-Null Pointer 역참조[CWE-476] + if(fList == null){ + fList = new File[0]; + } + for (int i = 0; i < fList.length; i++) { + realOriginalList.add(fList[i].getAbsolutePath() + "$" + getLastModifiedTime(fList[i]) + "$" + ((fList[i].length() / 1024) > 0 ? (fList[i].length() / 1024) : 1) + "KB"); + writeLog("ORI_" + fList[i].getAbsolutePath() + "$" + getLastModifiedTime(fList[i]) + "$" + ((fList[i].length() / 1024) > 0 ? (fList[i].length() / 1024) : 1) + "KB"); + } + + originalList = new ArrayList(realOriginalList); + writeLog("START"); + setDaemon(true); + checkAndConfigure(); + //log.debug("EgovFileMntrg end"); + } + + /** + *

    + * 감시 하고자 하는 파일의 변경 유무를 체크 하고자 하는 delay 초를 set. + *

    + * + * @param delay 감시 주기 초 + */ + public void setDelay(long delay) { + this.delay = delay; + } + + /** + *

    + * 해당 파일의 변경시 작업 할 내용을 기술 할 추상(abstract) 메소드 + *

    + */ + //abstract protected void doOnChange(); + protected void doOnChange(List changedList) { + //log.debug("doOnChange() start"); + for (int i = 0; i < changedList.size(); i++) { + writeLog((String) changedList.get(i)); + } + changedList.clear(); //직전리스트와 비교해서 변경된 내역은 로그처리한 후 초기화한다. + originalList = new ArrayList(currentList); //현재리스트가 직전리스트가 된다.(새로 생성해야 함!) + cnt++; + + //log.debug("doOnChange() end"); + } + + /** + *

    + * 파일의 변경 유무를 체크하는 메소드 + *

    + */ + protected void checkAndConfigure() { + //log.debug("checkAndConfigure start"); + try { + currentList.clear(); + file = new File(filename); + // 현재정보를 ArrayList에 담는다. + File[] fList = file.listFiles(); + //2017.03.06 조성원 시큐어코딩(ES)-Null Pointer 역참조[CWE-476] + if(fList == null){ + fList = new File[0]; + } + + for (int i = 0; i < fList.length; i++) { + currentList.add(fList[i].getAbsolutePath() + "$" + getLastModifiedTime(fList[i]) + "$" + ((fList[i].length() / 1024) > 0 ? (fList[i].length() / 1024) : 1) + "KB"); + } + /* + for(int i = 0; i 0) { + //log.debug("change occur , changed file check count:"+cnt+ " , changed file count:"+changedList.size()); + doOnChange(changedList); + } + + if (isEnd()) { + //log.debug("Thread Process END !!! (CNT :"+cnt+")"); + interrupted = true; + } + //log.debug("checkAndConfigure end"+changedList.size()); + } + + /** + *

    + * 파일의 변경 유무의 체크를 주기적 초 단위로 실행 시키는 메소드 + *

    + */ + public void run() { + while (!interrupted) { + try { + Thread.sleep(delay); + } catch (InterruptedException e) { + EgovBasicLogger.ignore("Interrupted Exception", e); + } + checkAndConfigure(); + } + if (interrupted) { + this.interrupt(); + } + } + + /** + *
    +	 * Comment : 디렉토리(파일)의 최종 수정시간를 확인한다.(기본로케일 java.util.Locale.KOREA 기준)
    +	 * 
    + * @param File f 수정일자를 확인할 대상파일 + * @return String result 최종수정일자를 문자열로 리턴한다. + */ + public static String getLastModifiedTime(File f) { + long date = f.lastModified(); + java.text.SimpleDateFormat dateFormat = new java.text.SimpleDateFormat("yyyyMMdd:HH:mm:ss", java.util.Locale.KOREA); + return dateFormat.format(new java.util.Date(date)); + } + + /** + *
    +	 * Comment : 디렉토리(파일)의  로그정보를 기록한다.
    +	 * 
    + * @param String logStr 추가할 로그정보(라인단위) + * @return boolean result 로그추가 성공여부 + */ + public boolean writeLog(String logStr) { + boolean result = false; + + FileWriter fWriter = null; + BufferedWriter bWriter = null; + BufferedReader br = null; + try { + fWriter = new FileWriter(logFile, true); + bWriter = new BufferedWriter(fWriter); + br = new BufferedReader(new StringReader(logStr)); + String line = ""; + while ((line = br.readLine()) != null) { + if (line.length() <= MAX_STR_LEN) { + bWriter.write(line + "\n", 0, line.length() + 1); + } + } + result = true; + } catch (IOException e) { + throw new RuntimeException("File IO exception", e); + } finally { + EgovResourceCloseHelper.close(br, bWriter, fWriter); + } + + return result; + } + + /** + *
    +	 * Comment : 디렉토리감시 종료여부를 확인한다. 해당 디렉토리에 대한 로그파일이 삭제된 경우는 감시를 종료한다.
    +	 * 
    + * @return boolean isEnd 감시종료여부 중단하려면 true 리턴, 계속하려면 false 리턴 + */ + public boolean isEnd() { + //log.debug("isEnd start"); + boolean isEnd = false; + String lastStr = ""; + BufferedReader br = null; + FileReader fr = null; + + try { + if (logFile.exists()) { + //로그파일을 읽어서 마지막 끝에 END가 있으면 종료된것임 + + fr = new FileReader(logFile); + br = new BufferedReader(fr); + //int ch = 0; + String line = ""; + while ((line = br.readLine()) != null) { + if (line.length() <= MAX_STR_LEN) { + lastStr = line; + } + } + if (lastStr.equals("END")) { + isEnd = true; + } + } else { + //로그파일이 없는 경우(삭제된 경우)도 종료한다. + isEnd = true; + } + } catch (IOException e) { + throw new RuntimeException("File IO exception", e); + } finally { + EgovResourceCloseHelper.close(br, fr); + } + return isEnd; + } +} diff --git a/src/main/java/egovframework/com/utl/sim/service/EgovFileScrty.java b/src/main/java/egovframework/com/utl/sim/service/EgovFileScrty.java new file mode 100644 index 0000000..4ca8e6c --- /dev/null +++ b/src/main/java/egovframework/com/utl/sim/service/EgovFileScrty.java @@ -0,0 +1,274 @@ +/** + * Class Name : EgovFileScrty.java + * Description : Base64인코딩/디코딩 방식을 이용한 데이터를 암호화/복호화하는 Business Interface class + * Modification Information + * + * 수정일 수정자 수정내용 + * ------- -------- --------------------------- + * 2009.02.04 박지욱 최초 생성 + * + * @author 공통 서비스 개발팀 박지욱 + * @since 2009. 02. 04 + * @version 1.0 + * @see + * + * Copyright (C) 2009 by MOPAS All right reserved. + */ +package egovframework.com.utl.sim.service; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InputStreamReader; +import java.security.MessageDigest; + +import egovframework.com.cmm.util.EgovResourceCloseHelper; + +import org.apache.commons.codec.binary.Base64; + +/** + * @Class Name : EgovFileScrty.java + * @Description : 파일 및 텍스트 문자열 암호화 처리하는 구현 클래스 + * @Modification Information + * + * 수정일 수정자 수정내용 + * ---------- ------- ------------------- + * 2019.11.29 신용호 encryptPassword(String data) 삭제 : KISA 보안약점 조치 (비밀번호 해시함수 적용 시 솔트를 사용하여야 함) + * + * @author 공통컴포넌트개발팀 한성곤 + * @since 2009.08.26 + * @version 1.0 + */ +public class EgovFileScrty { + + // 파일구분자 + static final char FILE_SEPARATOR = File.separatorChar; + + static final int BUFFER_SIZE = 1024; + + /** + * 파일을 암호화하는 기능 + * + * @param String source 암호화할 파일 + * @param String target 암호화된 파일 + * @return boolean result 암호화여부 True/False + * @exception Exception + */ + public static boolean encryptFile(String source, String target) throws Exception { + + // 암호화 여부 + boolean result = false; + + String sourceFile = source.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + String targetFile = target.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File srcFile = new File(sourceFile); + + BufferedInputStream input = null; + BufferedOutputStream output = null; + + byte[] buffer = new byte[BUFFER_SIZE]; + + try { + if (srcFile.exists() && srcFile.isFile()) { + + input = new BufferedInputStream(new FileInputStream(srcFile)); + output = new BufferedOutputStream(new FileOutputStream(targetFile)); + + int length = 0; + while ((length = input.read(buffer)) >= 0) { + byte[] data = new byte[length]; + System.arraycopy(buffer, 0, data, 0, length); + output.write(encodeBinary(data).getBytes()); + output.write(System.getProperty("line.separator").getBytes()); + } + result = true; + } + } finally { + EgovResourceCloseHelper.close(input, output); + } + + return result; + } + + /** + * 파일을 복호화하는 기능 + * + * @param String source 복호화할 파일 + * @param String target 복호화된 파일 + * @return boolean result 복호화여부 True/False + * @exception Exception + */ + public static boolean decryptFile(String source, String target) throws Exception { + + // 복호화 여부 + boolean result = false; + + String sourceFile = source.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + String targetFile = target.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File srcFile = new File(sourceFile); + + BufferedReader input = null; + BufferedOutputStream output = null; + + //byte[] buffer = new byte[BUFFER_SIZE]; + String line = null; + + try { + if (srcFile.exists() && srcFile.isFile()) { + + input = new BufferedReader(new InputStreamReader(new FileInputStream(srcFile))); + output = new BufferedOutputStream(new FileOutputStream(targetFile)); + + while ((line = input.readLine()) != null) { + byte[] data = line.getBytes(); + output.write(decodeBinary(new String(data))); + } + + result = true; + } + } finally { + EgovResourceCloseHelper.close(input, output); + } + + return result; + } + + /** + * 데이터를 암호화하는 기능 + * + * @param byte[] data 암호화할 데이터 + * @return String result 암호화된 데이터 + * @exception Exception + */ + public static String encodeBinary(byte[] data) throws Exception { + if (data == null) { + return ""; + } + + return new String(Base64.encodeBase64(data)); + } + + /** + * 데이터를 암호화하는 기능 + * + * @param String data 암호화할 데이터 + * @return String result 암호화된 데이터 + * @exception Exception + */ + @Deprecated + public static String encode(String data) throws Exception { + return encodeBinary(data.getBytes()); + } + + /** + * 데이터를 복호화하는 기능 + * + * @param String data 복호화할 데이터 + * @return String result 복호화된 데이터 + * @exception Exception + */ + public static byte[] decodeBinary(String data) throws Exception { + return Base64.decodeBase64(data.getBytes()); + } + + /** + * 데이터를 복호화하는 기능 + * + * @param String data 복호화할 데이터 + * @return String result 복호화된 데이터 + * @exception Exception + */ + @Deprecated + public static String decode(String data) throws Exception { + return new String(decodeBinary(data)); + } + + /** + * 비밀번호를 암호화하는 기능(복호화가 되면 안되므로 SHA-256 인코딩 방식 적용) + * + * @param password 암호화될 패스워드 + * @param id salt로 사용될 사용자 ID 지정 + * @return + * @throws Exception + */ + public static String encryptPassword(String password, String id) throws Exception { + + if (password == null) return ""; + if (id == null) return ""; // KISA 보안약점 조치 (2018-12-11, 신용호) + + byte[] hashValue = null; // 해쉬값 + + MessageDigest md = MessageDigest.getInstance("SHA-256"); + + md.reset(); + md.update(id.getBytes()); + + hashValue = md.digest(password.getBytes()); + + return new String(Base64.encodeBase64(hashValue)); + } + + /** + * 비밀번호를 암호화하는 기능(복호화가 되면 안되므로 SHA-256 인코딩 방식 적용) + * @param data 암호화할 비밀번호 + * @param salt Salt + * @return 암호화된 비밀번호 + * @throws Exception + */ + public static String encryptPassword(String data, byte[] salt) throws Exception { + + if (data == null) { + return ""; + } + + byte[] hashValue = null; // 해쉬값 + + MessageDigest md = MessageDigest.getInstance("SHA-256"); + + md.reset(); + md.update(salt); + + hashValue = md.digest(data.getBytes()); + + return new String(Base64.encodeBase64(hashValue)); + } + + /** + * 비밀번호를 암호화된 패스워드 검증(salt가 사용된 경우만 적용). + * + * @param data 원 패스워드 + * @param encoded 해쉬처리된 패스워드(Base64 인코딩) + * @return + * @throws Exception + */ + public static boolean checkPassword(String data, String encoded, byte[] salt) throws Exception { + byte[] hashValue = null; // 해쉬값 + + MessageDigest md = MessageDigest.getInstance("SHA-256"); + + md.reset(); + md.update(salt); + hashValue = md.digest(data.getBytes()); + + return MessageDigest.isEqual(hashValue, Base64.decodeBase64(encoded.getBytes())); + } + + /* + public static void main(String[] args) { + try { + String password = "abc"; + String salt = "def"; + + String first = encryptPassword(password, salt.getBytes()); + String second = encryptPassword(password, salt.getBytes()); + System.out.println(password + " => " + first + " : " + checkPassword(password, first, salt.getBytes())); + System.out.println(password + " => " + second + " : " + checkPassword(password, second, salt.getBytes())); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + */ +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/utl/sim/service/EgovFileTool.java b/src/main/java/egovframework/com/utl/sim/service/EgovFileTool.java new file mode 100644 index 0000000..890cc34 --- /dev/null +++ b/src/main/java/egovframework/com/utl/sim/service/EgovFileTool.java @@ -0,0 +1,2999 @@ +/** + * Class Name : EgovFileTool.java + * Description : 시스템 디렉토리 정보를 확인하여 제공하는 Business class + * Modification Information + * + * 수정일 수정자 수정내용 + * ------- -------- --------------------------- + * 2009.01.13 조재영 최초 생성 + * 2017.03.03 조성원 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + * 2017.03.03 조성원 시큐어코딩(ES)-Null Pointer 역참조[CWE-476] + * 2018.03.19 신용호 createDirectories() 추가 : 여러 레벨의 디렉토리를 한번에 생성 + * + * + * @author 공통 서비스 개발팀 조재영,박지욱 + * @since 2009. 01. 13 + * @version 1.0 + * @see + * + * Copyright (C) 2009 by MOPAS All right reserved. + */ +package egovframework.com.utl.sim.service; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.StringReader; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.List; +import java.util.Vector; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import egovframework.com.cmm.EgovWebUtil; +import egovframework.com.cmm.service.EgovProperties; +import egovframework.com.cmm.service.Globals; +import egovframework.com.cmm.util.EgovResourceCloseHelper; +import egovframework.com.utl.fcc.service.EgovStringUtil; + +/** + * EgovFileTool 클래스를 정의한다. + * + * @author 김진만 + * @see + *
    + * == 개정이력(Modification Information) ==
    + *
    + *  수정일                수정자           수정내용
    + *  ----------   --------   ---------------------------
    + *  2020.12.07   신용호            KISA 보안약점 조치
    + *
    + * 
    + */ + +public class EgovFileTool { + + // 파일사이즈 1K + static final long BUFFER_SIZE = 1024L; + // 파일구분자 + static final char FILE_SEPARATOR = File.separatorChar; + // 윈도우시스템 파일 접근권한 + static final char ACCESS_READ = 'R'; // 읽기전용 + static final char ACCESS_SYS = 'S'; // 시스템 + static final char ACCESS_HIDE = 'H'; // 숨김 + // 최대 문자길이 + static final int MAX_STR_LEN = 1024; + + // LOGGER + private static final Logger LOGGER = LoggerFactory.getLogger(EgovFileTool.class); + + /** + *
    +	 * Comment : 디렉토리 존재여부를 확인한다. (단일디렉토리 확인용)
    +	 * 
    + * + * @param String targetDirPath 존재여부를 확인할 디렉토리의 절대경로 + * @return String result 존재하는 디렉토리 경로를 리턴한다. + */ + public static boolean getExistDirectory(String targetDirPath) throws Exception { + + // 인자값 유효하지 않은 경우 공백 리턴 + if (targetDirPath == null || targetDirPath.equals("")) { + return false; + } + + boolean result = false; + File f = new File(EgovWebUtil.filePathBlackList(targetDirPath)); + if (f.exists() && f.isDirectory()) { + result = true; + } + + return result; + } + + /** + *
    +	 * Comment : 디렉토리 존재여부를 확인한다. (하위디렉토리 확인용)
    +	 * 
    + * + * @param String baseDirPath 존재여부를 확인할 디렉토리명의 기준경로 + * @param String targetDirPath 확인할 대상 디렉토리. baseDirPath 하위에서 존재여부를 확인한다. + * @param int cnt 확인할 디렉토리 갯수 (0보다 큰값이 입력되어야 한다. -1 입력시 21474846까지 찾도록 지원함 ) + * @return String result 존재하는 디렉토리 경로를 리턴한다. + */ + public static List getExistDirectory(String baseDirPath, String targetDirPath, int cnt) throws Exception { + + // 인자값 유효하지 않은 경우 빈 ArrayList 리턴 + if (baseDirPath == null || baseDirPath.equals("") || targetDirPath == null || targetDirPath.equals("") + || cnt == 0) { + return new ArrayList(); + } + int dirCnt = 0; + if (cnt < 0) { + dirCnt = 21474846; + } else { + dirCnt = cnt; + } + + // 찾은 결과를 전달할 ArrayList + List result = new ArrayList(); + // 하위의 결과를 임시 보관할 ArrayList + List subResult = new ArrayList(); + // 현재경로(baseDirPath)에서 발견된 targetDirPath 갯수 + int dirFindCnt = 0; + boolean isExist = false; + String[] dirList = null; + String subDirPath = ""; + File f = null; + + f = new File(EgovWebUtil.filePathBlackList(baseDirPath)); + isExist = f.exists(); + + if (isExist) { + dirList = f.list(); + } + + for (int i = 0; dirList != null && i < dirList.length; i++) { + //log.debug("dirList["+i+"]:"+dirList[i] +"--->"+baseDirPath+"/"+dirList[i]); + subDirPath = baseDirPath + "/" + dirList[i]; + //log.debug("_"+targetDirPath+"_"); + //log.debug("_"+dirList[i]+"_"); + + f = new File(EgovWebUtil.filePathBlackList(subDirPath)); + + //현재경로(baseDirPath)에서 검색 + if (targetDirPath.equals(dirList[i])) { + // 중간에 발견하면 반복체크는 종료한다.(결과요청 갯수에 도달한 경우에 한해) - 이곳에서 종료되면 이후 하위에서 체크할 필요가 없다. + if (new File(EgovWebUtil.filePathBlackList(baseDirPath) + "/" + dirList[i]).isDirectory()) { + dirFindCnt++; + result.add(baseDirPath + "/" + dirList[i]); + if (dirFindCnt == dirCnt) { + break; + } + } + } + + //현재경로(baseDirPath)에서 발견된 하위 경로에서 반복하여 재귀적으로 검색 + int subCnt = dirCnt - dirFindCnt; + if (f.isDirectory()) { + //log.debug("f.isDirectory():"+f.isDirectory()); + subResult = getExistDirectory(subDirPath, targetDirPath, subCnt); + // 하위에서 발견된 디렉토리 갯수를 현재까지 찾은 디렉토리갯수에 추가한다. + dirFindCnt = dirFindCnt + subResult.size(); + // 하위에서 모두 발견된 경우 반복 체크는 종료한다. + if (dirCnt <= dirFindCnt) { + for (int j = 0; j < subResult.size(); j++) { + result.add(subResult.get(j)); + } + + break; + } else { + for (int j = 0; j < subResult.size(); j++) { + result.add(subResult.get(j)); + } + } + } + } + + return result; + } + + /** + *
    +	 * Comment : 디렉토리 존재여부를 확인한다. (생성일자를 조건으로 조건구간내 포함되는지 확인)
    +	 * 
    + * + * @param String targetDirPath 존재여부를 확인할 디렉토리의 절대경로 + * @param String fromDate 생성일자 조건에 해당하는 시작일자(YYYYMMDD 형태로 입력) + * @param String toDate 생성일자 조건에 해당하는 종료일자(YYYYMMDD 형태로 입력) + * @return String result 존재하는 디렉토리 경로를 리턴한다. + */ + public static boolean getExistDirectory(String targetDirPath, String fromDate, String toDate) throws Exception { + + // 인자값 유효하지 않은 경우 공백 리턴 + if (targetDirPath == null || targetDirPath.equals("") || fromDate == null || fromDate.equals("") + || toDate == null || toDate.equals("")) { + return false; + } + + boolean result = false; + String lastModifyedDate = ""; + File f = null; + + f = new File(EgovWebUtil.filePathBlackList(targetDirPath)); + lastModifyedDate = getLastModifiedDateFromFile(f); + //log.debug("getLastModifiedDateFromFile(f):"+lastModifyedDate); + if (Integer.parseInt(lastModifyedDate) >= Integer.parseInt(fromDate) + && Integer.parseInt(lastModifyedDate) <= Integer.parseInt(toDate)) { + result = true; + } + + return result; + } + + /** + *
    +	 * Comment : 디렉토리 존재여부를 확인한다. (생성자를 조건으로 일치하는지 확인)
    +	 * 
    + * + * @param String targetDirPath 존재여부를 확인할 디렉토리의 절대경로 + * @param String ownerName 생성자명(계정정보) + * @return String result 존재하는 디렉토리 경로를 리턴한다. + */ + public static boolean getExistDirectory(String targetDirPath, String ownerName) throws Exception { + + // 인자값 유효하지 않은 경우 공백 리턴 + if (targetDirPath == null || targetDirPath.equals("") || ownerName == null || ownerName.equals("")) { + return false; + } + + boolean result = false; + //String tmp = ""; + + // 실행할 명령을 프로퍼티 파일에서 확인한다. + //Process p = null; + + String realOwner = getOwner(targetDirPath); + if (ownerName.equals(realOwner)) { + result = true; + } else { + result = false; + } + + return result; + } + + /** + *
    +	 * Comment : 디렉토리(파일)의 최종 수정일자를 확인한다. (기본로케일 java.util.Locale.KOREA 기준)
    +	 * 
    + * + * @param File f 수정일자를 확인할 대상파일 + * @return String result 최종수정일자를 문자열로 리턴한다. + */ + public static String getLastModifiedDateFromFile(File f) { + + String result = ""; + + if (f.exists()) { + long date = f.lastModified(); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd", java.util.Locale.KOREA); + result = dateFormat.format(new java.util.Date(date)); + } else { + result = ""; + } + + return result; + } + + /** + *
    +	 * Comment : 디렉토리(파일)의 최종 수정일자를 확인한다. (기본로케일 java.util.Locale.KOREA 기준)
    +	 * 
    + * + * @param String filePath 수정일자를 확인할 대상파일경로 + * @return String result 최종수정일자를 문자열로 리턴한다. + */ + public static String getLastModifiedDateFromFile(String filePath) { + + File f = null; + String result = ""; + f = new File(EgovWebUtil.filePathBlackList(filePath)); + result = getLastModifiedDateFromFile(f); + + return result; + } + + /** + *
    +	 * Comment : 조건구간내에 생성된 디렉토리 목록을 조회한다.
    +	 * 
    + * + * @param String filePath 하위디렉토리를 확인할 경로 + * @param String fromDate 조건시작일 + * @param String toDate 조건 종료일 + * @return ArrayList result 조건구간내에 생성된 디렉토리 목록을 리턴한다. + */ + public static List getLastDirectoryForModifiedDate(String baseDirPath, String fromDate, String toDate) { + + // 인자값 유효하지 않은 경우 빈 ArrayList 리턴 + if (baseDirPath == null || baseDirPath.equals("") || fromDate == null || fromDate.equals("") || toDate == null + || toDate.equals("")) { + return new ArrayList(); + } + + File f = null; + File childFile = null; + String[] subDirList; + String subDirPath = ""; + List childResult = null; + List result = new ArrayList(); + + f = new File(EgovWebUtil.filePathBlackList(baseDirPath)); + subDirList = f.list(); + //KISA 보안약점 조치 (2018-10-29, 윤창원) + if (subDirList != null) { + for (int i = 0; i < subDirList.length; i++) { + + subDirPath = baseDirPath + "/" + subDirList[i]; + childFile = new File(EgovWebUtil.filePathBlackList(subDirPath)); + if (childFile.isDirectory()) { + //childResult = getLastDirectoryForModifiedDate(subDirPath , fromDate, toDate); + String lastModifyedDate = getLastModifiedDateFromFile(childFile); + if (Integer.parseInt(lastModifyedDate) >= Integer.parseInt(fromDate) + && Integer.parseInt(lastModifyedDate) <= Integer.parseInt(toDate)) { + result.add(baseDirPath + "/" + subDirList[i]); + } + childResult = getLastDirectoryForModifiedDate(baseDirPath + "/" + subDirList[i], fromDate, toDate); + // 하위디렉토리의 결과를 추가한다. + for (int j = 0; j < childResult.size(); j++) { + result.add(childResult.get(j)); + } + } + } + } + + return result; + } + + /** + *
    +	 * Comment : 디렉토리(파일)의 읽기권한을 확인한다.
    +	 * 
    + * + * @param String filePath 읽기권한을 확인할 대상파일경로 + * @return boolean result 읽기가능하면 true를 리턴한다. 권한이 없어가 파일이 없는 경우는 false를 리턴한다. + */ + public static boolean canRead(String filePath) { + + // 인자값 유효하지 않은 경우 빈 false 리턴 + if (filePath == null || filePath.equals("")) { + return false; + } + + File f = null; + boolean result = false; + f = new File(EgovWebUtil.filePathBlackList(filePath)); + if (f.exists()) { + result = f.canRead(); + } + + return result; + } + + /** + *
    +	 * Comment : 디렉토리(파일)의 쓰기권한을 확인한다.(대상경로가 파일인 경우만 정보가 유효함)
    +	 * 
    + * + * @param String filePath 쓰기권한을 확인할 대상파일경로 + * @return boolean result 쓰기가능하면 true를 리턴한다. 권한이 없어가 파일이 없는 경우는 false를 리턴한다. + */ + public static boolean canWrite(String filePath) { + + // 인자값 유효하지 않은 경우 빈 false 리턴 + if (filePath == null || filePath.equals("")) { + return false; + } + + File f = null; + boolean result = false; + f = new File(EgovWebUtil.filePathBlackList(filePath)); + if (f.exists()) { + result = f.canWrite(); + } + + return result; + } + + /** + *
    +	 * Comment : 디렉토리(파일)의 이름을  확인한다.
    +	 * 
    + * + * @param String filePath 이름을 확인할 대상경로 + * @return String result 이름을 리턴한다. 존재하지 않는 경우는 블랭크를 리턴한다. + */ + public static String getName(String filePath) { + + // 인자값 유효하지 않은 경우 빈 false 리턴 + if (filePath == null || filePath.equals("")) { + return ""; + } + + File f = null; + String result = ""; + + f = new File(EgovWebUtil.filePathBlackList(filePath)); + if (f.exists()) { + result = f.getName(); + } + + return result; + } + + /** + *
    +	 * Comment : 디렉토리(파일)를 삭제한다. (파일,디렉토리 구분없이 존재하는 경우 무조건 삭제한다)
    +	 * 
    + * + * @param filePathToBeDeleted 삭제하고자 하는 파일의 절대경로 + 파일명 + * @return 성공하면 삭제된 절대경로, 아니면블랭크 + */ + + public static String deletePath(String filePath) { + File file = new File(EgovWebUtil.filePathBlackList(filePath)); + String result = ""; + + if (file.exists()) { + result = file.getAbsolutePath(); + if (!file.delete()) { + result = ""; + } + } + + return result; + } + + /** + *
    +	 * Comment : 디렉토리를 생성한다.
    +	 * 
    + * + * @param dirPath 생성하고자 하는 절대경로 + * @return 성공하면 생성된 절대경로, 아니면 블랭크 + */ + + public static String createDirectory(String dirPath) { + File file = new File(EgovWebUtil.filePathBlackList(dirPath)); + String result = ""; + try { + if (!file.exists()) { + //2017.02.08 이정은 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + if (file.createNewFile()) { + LOGGER.debug("[file.createNewFile] file : Path Creation Success"); + } else { + LOGGER.error("[file.createNewFile] file : Path Creation Fail"); + } + file.getAbsolutePath(); + } + + } catch (IOException e) { + throw new RuntimeException(e); + } + + return result; + } + + /** + *
    +	 * Comment : 디렉토리를 생성한다. (여러 레벨의 경로를 동시에 생성)
    +	 * 
    + * + * @param dirPath 생성하고자 하는 절대경로 + * @return 성공하면 생성된 절대경로, 아니면 블랭크 + */ + public static String createDirectories(String dirPath) { + File file = new File(EgovWebUtil.filePathBlackList(dirPath)); + String result = ""; + + if (!file.exists()) { + if (file.mkdirs()) { + LOGGER.debug("[file.mkdirs] file : Path Creation Success"); + } else { + LOGGER.error("[file.mkdirs] file : Path Creation Fail"); + } + file.getAbsolutePath(); + } + + return result; + } + + /** + * 디렉토리에 파일이 존재하는지 체크하는 기능 + * + * @param String dir 디렉토리 + * @param String file 파일 + * @return boolean result 존재여부 True / False + * @exception Exception + */ + public static boolean checkFileExstByName(String dir, String file) throws Exception { + + // 파일 존재 여부 + boolean result = false; + + // 디렉토리 오픈 + String drctry = dir.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File srcDrctry = new File(EgovWebUtil.filePathBlackList(drctry)); + + // 디렉토리이면서, 존재하면 + if (srcDrctry.exists() && srcDrctry.isDirectory()) { + + // 디렉토리 안 목록을 조회한다. (파일명) + File[] fileArray = srcDrctry.listFiles(); + //KISA 보안약점 조치 (2018-10-29, 윤창원) + if (fileArray != null) { + List list = getSubFilesByName(fileArray, file); + if (list != null && list.size() > 0) { + result = true; + } + } + } + + return result; + } + + /** + * 확장자별로 디렉토리에 파일이 존재하는지 체크하는 기능 + * + * @param String dir 디렉토리 + * @param String eventn 확장자명(.txt 형태 입력) + * @return boolean result 존재여부 True / False + * @exception Exception + */ + public static boolean checkFileExstByExtnt(String dir, String eventn) throws Exception { + + // 파일 존재 여부 + boolean result = false; + + // 디렉토리 오픈 + String drctry = dir.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File srcDrctry = new File(EgovWebUtil.filePathBlackList(drctry)); + + // 디렉토리이면서, 존재하면 + if (srcDrctry.exists() && srcDrctry.isDirectory()) { + + // 디렉토리 안 목록을 조회한다. (확장자별) + File[] fileArray = srcDrctry.listFiles(); + //KISA 보안약점 조치 (2018-10-29, 윤창원) + if (fileArray != null) { + List list = getSubFilesByExtnt(fileArray, eventn); + if (list != null && list.size() > 0) { + result = true; + } + } + } + + return result; + } + + /** + * 디렉토리에 생성자별 파일이 존재하는지 체크하는 기능 + * + * @param String dir 디렉토리 + * @param String owner 생성자 + * @return boolean result 존재여부 True / False + * @exception Exception + */ + public static boolean checkFileExstByOwner(String dir, String owner) throws Exception { + + // 파일 존재 여부 + boolean result = false; + + // 디렉토리 오픈 + String drctry = dir.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File srcDrctry = new File(EgovWebUtil.filePathBlackList(drctry)); + + // 디렉토리이면서, 존재하면 + if (srcDrctry.exists() && srcDrctry.isDirectory()) { + + // 디렉토리 안 목록을 조회한다. (생성자) + File[] fileArray = srcDrctry.listFiles(); + //KISA 보안약점 조치 (2018-10-29, 윤창원) + if (fileArray != null) { + List list = getSubFilesByOwner(fileArray, owner); + if (list != null && list.size() > 0) { + result = true; + } + } + } + + return result; + } + + /** + * 수정기간별로 디렉토리에 파일이 존재하는지 체크하는 기능 + * + * @param String dir 디렉토리 + * @param String updtFrom 수정일자From(YYYYMMDD 형태로 입력) + * @param String updtTo 수정일자To(YYYYMMDD 형태로 입력) + * @return boolean result 존재여부 True / False + * @exception Exception + */ + public static boolean checkFileExstByUpdtPd(String dir, String updtFrom, String updtTo) throws Exception { + + // 파일 존재 여부 + boolean result = false; + + // 디렉토리 오픈 + String drctry = dir.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File srcDrctry = new File(EgovWebUtil.filePathBlackList(drctry)); + + // 디렉토리이면서, 존재하면 + if (srcDrctry.exists() && srcDrctry.isDirectory()) { + + // 디렉토리 안 목록을 조회한다. (수정기간별) + File[] fileArray = srcDrctry.listFiles(); + //KISA 보안약점 조치 (2018-10-29, 윤창원) + if (fileArray != null) { + List list = getSubFilesByUpdtPd(fileArray, updtFrom, updtTo); + if (list != null && list.size() > 0) { + result = true; + } + } + } + + return result; + } + + /** + * 사이즈별로 디렉토리에 파일이 존재하는지 체크하는 기능 + * + * @param String dir 디렉토리 + * @param long sizeFrom 사이즈From (KB) + * @param long sizeTo 사이즈To (KB) + * @return boolean result 존재여부 True / False + * @exception Exception + */ + public static boolean checkFileExstBySize(String dir, long sizeFrom, long sizeTo) throws Exception { + + // 파일 존재 여부 + boolean result = false; + + // 디렉토리 오픈 + String drctry = dir.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File srcDrctry = new File(EgovWebUtil.filePathBlackList(drctry)); + + // 디렉토리이면서, 존재하면 + if (srcDrctry.exists() && srcDrctry.isDirectory()) { + + // 디렉토리 안 목록을 조회한다. (사이즈별) + File[] fileArray = srcDrctry.listFiles(); + //KISA 보안약점 조치 (2018-10-29, 윤창원) + if (fileArray != null) { + List list = getSubFilesBySize(fileArray, sizeFrom, sizeTo); + if (list != null && list.size() > 0) { + result = true; + } + } + } + + return result; + } + + /** + * 디렉토리 내부 하위목록들 중에서 파일을 찾는 기능(모든 목록 조회) + * + * @param File[] fileArray 파일목록 + * @return ArrayList list 파일목록(절대경로) + * @exception Exception + */ + public static List getSubFilesByAll(File[] fileArray) throws Exception { + + ArrayList list = new ArrayList(); + + for (int i = 0; i < fileArray.length; i++) { + // 디렉토리 안에 디렉토리면 그 안의 파일목록에서 찾도록 재귀호출한다. + if (fileArray[i].isDirectory()) { + File[] tmpArray = fileArray[i].listFiles(); + list.addAll(getSubFilesByAll(tmpArray)); + // 파일이면 담는다. + } else { + list.add(fileArray[i].getAbsolutePath()); + } + } + + return list; + } + + /** + * 디렉토리 내부 하위목록들 중에서 파일을 찾는 기능(파일명) + * + * @param File[] fileArray 파일목록 + * @param String file 파일명 + * @return ArrayList list 파일목록(절대경로) + * @exception Exception + */ + public static List getSubFilesByName(File[] fileArray, String file) throws Exception { + + List list = new ArrayList(); + + for (int i = 0; i < fileArray.length; i++) { + // 디렉토리 안에 디렉토리면 그 안의 파일목록에서 찾도록 재귀호출한다. + if (fileArray[i].isDirectory()) { + File[] tmpArray = fileArray[i].listFiles(); + list.addAll(getSubFilesByName(tmpArray, file)); + // 파일이면 파일명이 같은지 비교한다. + } else { + if (fileArray[i].getName().equals(file)) { + list.add(fileArray[i].getAbsolutePath()); + } + } + } + + return list; + } + + /** + * 디렉토리 내부 하위목록들 중에서 파일을 찾는 기능(확장자별) + * + * @param File[] fileArray 파일목록 + * @param String extnt 확장자 + * @return ArrayList list 파일목록(절대경로) + * @exception Exception + */ + public static List getSubFilesByExtnt(File[] fileArray, String extnt) throws Exception { + + List list = new ArrayList(); + + for (int i = 0; i < fileArray.length; i++) { + // 디렉토리 안에 디렉토리면 그 안의 파일목록에서 찾도록 재귀호출한다. + if (fileArray[i].isDirectory()) { + File[] tmpArray = fileArray[i].listFiles(); + list.addAll(getSubFilesByExtnt(tmpArray, extnt)); + // 파일이면 확장자명이 들어있는지 비교한다. + } else { + if (fileArray[i].getName().indexOf(extnt) != -1) { + list.add(fileArray[i].getAbsolutePath()); + } + } + } + + return list; + } + + /** + * 디렉토리 내부 하위목록들 중에서 파일을 찾는 기능(최종수정기간별) + * + * @param File[] fileArray 파일목록 + * @param String updtFrom 수정일자From(YYYYMMDD 형태로 입력) + * @param String updtTo 수정일자To(YYYYMMDD 형태로 입력) + * @return ArrayList list 파일목록(절대경로) + * @exception Exception + */ + public static List getSubFilesByUpdtPd(File[] fileArray, String updtFrom, String updtTo) throws Exception { + + List list = new ArrayList(); + + for (int i = 0; i < fileArray.length; i++) { + // 디렉토리 안에 디렉토리면 그 안의 파일목록에서 찾도록 재귀호출한다. + if (fileArray[i].isDirectory()) { + File[] tmpArray = fileArray[i].listFiles(); + list.addAll(getSubFilesByUpdtPd(tmpArray, updtFrom, updtTo)); + // 파일이면 수정기간내에 존재하는지 비교한다. + } else { + // 파일의 최종수정일자 조회 + long date = fileArray[i].lastModified(); + java.text.SimpleDateFormat dateFormat = new java.text.SimpleDateFormat("yyyyMMdd", + java.util.Locale.KOREA); + String lastUpdtDate = dateFormat.format(new java.util.Date(date)); + // 수정기간 내에 존재하는지 확인 + if (Integer.parseInt(lastUpdtDate) >= Integer.parseInt(updtFrom) + && Integer.parseInt(lastUpdtDate) <= Integer.parseInt(updtTo)) { + list.add(fileArray[i].getAbsolutePath()); + } + } + } + + return list; + } + + /** + * 디렉토리 내부 하위목록들 중에서 파일을 찾는 기능(사이즈별) + * + * @param File[] fileArray 파일목록 + * @param long sizeFrom 사이즈From(KB) + * @param long sizeTo 사이즈To(KB) + * @return ArrayList list 파일목록(절대경로) + * @exception Exception + */ + public static List getSubFilesBySize(File[] fileArray, long sizeFrom, long sizeTo) throws Exception { + + List list = new ArrayList(); + + for (int i = 0; i < fileArray.length; i++) { + // 디렉토리 안에 디렉토리면 그 안의 파일목록에서 찾도록 재귀호출한다. + if (fileArray[i].isDirectory()) { + File[] tmpArray = fileArray[i].listFiles(); + list.addAll(getSubFilesBySize(tmpArray, sizeFrom, sizeTo)); + // 파일이면, 사이즈내에 존재하는지 비교한다. + } else { + // 파일의 사이즈 조회 + long size = fileArray[i].length(); + // 사이즈 내에 존재하는지 확인 + if (size >= (sizeFrom * BUFFER_SIZE) && size <= (sizeTo * BUFFER_SIZE)) { + list.add(fileArray[i].getAbsolutePath()); + } + } + } + + return list; + } + + /** + * 디렉토리 내부 하위목록들 중에서 파일을 찾는 기능(생성자별) + * + * @param File[] fileArray 파일목록 + * @param String creator 생성자 + * @return ArrayList list 파일목록(절대경로) + * @exception Exception + */ + public static List getSubFilesByOwner(File[] fileArray, String owner) throws Exception { + + List list = new ArrayList(); + + for (int i = 0; i < fileArray.length; i++) { + // 디렉토리 안에 디렉토리면 그 안의 파일목록에서 찾도록 재귀호출한다. + if (fileArray[i].isDirectory()) { + File[] tmpArray = fileArray[i].listFiles(); + List list1 = getSubFilesByOwner(tmpArray, owner); + if (list1 != null) { + list.addAll(list1); + } + + // 파일이면, 생성자가 같은지 비교한다. + } else { + // 파일 생성자 조회 + String fullpath = EgovWebUtil.filePathBlackList(fileArray[i].getAbsolutePath()); + Process p = null; + if (Globals.OS_TYPE.equals("UNIX")) { + String[] command = { + EgovProperties.getProperty(Globals.SHELL_FILE_PATH, + "SHELL." + Globals.OS_TYPE + ".getDrctryByOwner"), + fullpath.substring(0, fullpath.lastIndexOf("/")), + fullpath.substring(fullpath.lastIndexOf("/"), fullpath.length()), owner}; + p = Runtime.getRuntime().exec(command); + p.waitFor(); + } else if (Globals.OS_TYPE.equals("WINDOWS")) { + String command = EgovProperties.getProperty(Globals.SHELL_FILE_PATH, + "SHELL." + Globals.OS_TYPE + ".getDrctryByOwner"); + p = Runtime.getRuntime().exec(command); + p.waitFor(); + } + //프로세스 에러시 종료 + if (p != null && p.exitValue() != 0) { + BufferedReader b_err = new BufferedReader(new InputStreamReader(p.getErrorStream())); + try { + while (b_err.ready()) { + //String line = b_err.readLine(); + //if (line.length() <= MAX_STR_LEN) log.debug("ERR\n" + line); + } + } finally { + EgovResourceCloseHelper.close(b_err); + } + } + //프로세스 실행 성공시 결과 확인 + else { + BufferedReader b_out = null; + try { + //2017.03.03 조성원 시큐어코딩(ES)-Null Pointer 역참조[CWE-476] + if (p != null) { + b_out = new BufferedReader(new InputStreamReader(p.getInputStream())); + while (b_out.ready()) { + // 결과문자가 있으면 생성자가 일치하는 파일이 존재한다는 의미 + String tmpStr = b_out.readLine(); + if (tmpStr != null && "".equals(tmpStr) && tmpStr.length() <= MAX_STR_LEN) { + list.add(fileArray[i].getAbsolutePath()); + } + } + } + } finally { + EgovResourceCloseHelper.close(b_out); + } + } + } + } + + return list; + } + + /** + *
    +	 * Comment : 디렉토리를 생성한다.
    +	 * 
    + * + * @param dirPath 생성하고자 하는 절대경로 + * @return 성공하면 새성된 절대경로, 아니면 블랭크 + */ + + public static String createNewDirectory(String dirPath) { + + // 인자값 유효하지 않은 경우 블랭크 리턴 + if (dirPath == null || dirPath.equals("")) { + return ""; + } + + File file = new File(EgovWebUtil.filePathBlackList(dirPath)); + String result = ""; + // 없으면 생성 + if (file.exists()) { + // 혹시 존재해도 파일이면 생성 - 생성되지 않는다.(아래는 실질적으로는 진행되지 않음) + if (file.isFile()) { + //new File(file.getParent()).mkdirs(); + if (file.mkdirs()) { + result = file.getAbsolutePath(); + } + } else { + result = file.getAbsolutePath(); + } + } else { + // 존해하지 않으면 생성 + if (file.mkdirs()) { + result = file.getAbsolutePath(); + } + } + + return result; + } + + /** + *
    +	 * Comment : 파일을 생성한다.
    +	 * 
    + * + * @param String fileName 파일의 절대경로 +파일명 + * @param String content 저장할 문자열입니다. c:/test/test1/test44.txt + * + */ + public static String createNewFile(String filePath) { + + // 인자값 유효하지 않은 경우 블랭크 리턴 + if (filePath == null || filePath.equals("")) { + return ""; + } + + File file = new File(EgovWebUtil.filePathBlackList(filePath)); + String result = ""; + try { + if (file.exists()) { + result = filePath; + } else { + // 존재하지 않으면 생성함 + //2017.02.08 이정은 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + if (new File(file.getParent()).mkdirs()) { + LOGGER.debug("[file.mkdirs] file : File Creation Success"); + } else { + LOGGER.error("[file.mkdirs] file : File Creation Fail"); + } + + if (file.createNewFile()) { + result = file.getAbsolutePath(); + } + } + } catch (IOException e) { + throw new RuntimeException(e); + } + + return result; + } + + /** + *
    +	 * Comment : 디렉토리를 삭제한다.
    +	 * 
    + * + * @param dirDeletePath 삭제하고자 하는디렉토리의 절대경로(파일의 경로가 들어오는 경우 삭제하지 않음) + * @return 성공하면 삭제된 절대경로, 아니면블랭크 + */ + + public static String deleteDirectory(String dirDeletePath) { + + // 인자값 유효하지 않은 경우 블랭크 리턴 + if (dirDeletePath == null || dirDeletePath.equals("")) { + return ""; + } + String result = ""; + File file = new File(EgovWebUtil.filePathBlackList(dirDeletePath)); + if (file.isDirectory()) { + String[] fileList = file.list(); + //소속된 파일을 모두 삭제 + //KISA 보안약점 조치 (2018-10-29, 윤창원) + if (fileList != null) { + for (int i = 0; i < fileList.length; i++) { + + //log.debug("fileList["+i+"] : "+ dirDeletePath +"/"+fileList[i]); + File f = new File(EgovWebUtil.filePathBlackList(dirDeletePath) + "/" + fileList[i]); + if (f.isFile()) { + //디렉토리에 속한 파일들을 모두 삭제한다. + //2017.02.08 이정은 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + if (f.delete()) { + LOGGER.debug("[file.delete] f : File Deletion Success"); + } else { + LOGGER.error("[file.delete] f : File Deletion Fail"); + } + } else { + //디렉토리에 속한 하위 디렉토리들에 대한 삭제 명령을 재귀적으로 호출시킨다. + deleteDirectory(dirDeletePath + "/" + fileList[i]); + } + } + } + // 디렉토리에 속한 파일들과 하위 디렉토리가 삭제되었으면 디렉토리 자신을 삭제한다. + result = deletePath(dirDeletePath); + } else { + result = ""; + } + + return result; + } + + /** + *
    +	 * Comment : 파일을 삭제한다.
    +	 * 
    + * + * @param fileDeletePath 삭제하고자 하는파일의 절대경로 + * @return 성공하면 삭제된 파일의 절대경로, 아니면블랭크 + */ + + public static String deleteFile(String fileDeletePath) { + + // 인자값 유효하지 않은 경우 블랭크 리턴 + if (fileDeletePath == null || fileDeletePath.equals("")) { + return ""; + } + String result = ""; + File file = new File(EgovWebUtil.filePathBlackList(fileDeletePath)); + if (file.isFile()) { + result = deletePath(fileDeletePath); + } else { + result = ""; + } + + return result; + } + + /** + * 파일의 읽기권한을 체크한다. + * + * @param String file 파일 + * @return boolean result 읽기권한 True / False + * @exception Exception + */ + public static boolean checkReadAuth(String file) throws Exception { + + // 읽기가능여부 + boolean result = false; + + // 전달받은 경로를 통해 파일 인스턴스를 생성한다. + String file1 = file.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File srcFile = new File(EgovWebUtil.filePathBlackList(file1)); + + // 존재하는지 확인한다. + if (srcFile.exists()) { + // 읽기 가능한지 체크한다. + result = srcFile.canRead(); + } + + return result; + } + + /** + * 파일의 쓰기권한을 체크한다. + * + * @param String file 파일 + * @return boolean result 쓰기권한 True / False + * @exception Exception + */ + public static boolean checkWriteAuth(String file) throws Exception { + + // 쓰기가능여부 + boolean result = false; + + // 전달받은 경로를 통해 파일 인스턴스를 생성한다. + String file1 = file.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File srcFile = new File(EgovWebUtil.filePathBlackList(file1)); + + // 존재하는지 확인한다. + if (srcFile.exists()) { + // 쓰기 가능한지 체크한다. + result = srcFile.canWrite(); + } + + return result; + } + + /** + * 파일의 최종수정일자별 파일목록 조회하는 기능 + * + * @param String drctry 디렉토리 + * @param String updtDate 최종수정일자(YYYYMMDD 형태로 입력) + * @return ArrayList list 파일목록 + * @exception Exception + */ + public static List getFileListByDate(String drctry, String updtDate) throws Exception { + + // 결과 목록 + List list = null; + + // 디렉토리 오픈 + String drctry1 = drctry.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File file = new File(EgovWebUtil.filePathBlackList(drctry1)); + + // 디렉토리이며, 존재하면 최종수정일자가 같은 파일목록 조회 시작 + if (file.exists() && file.isDirectory()) { + File[] fileArray = file.listFiles(); + //KISA 보안약점 조치 (2018-10-29, 윤창원) + if (fileArray != null) { + list = getSubFilesByDate(fileArray, updtDate); + } + } + + return list; + } + + /** + * 파일의 최종수정기간내 파일목록 조회하는 기능 + * + * @param String drctry 디렉토리 + * @param String updtFrom 최종수정일자From(YYYYMMDD 형태로 입력) + * @param String updtTo 최종수정일자To(YYYYMMDD 형태로 입력) + * @return ArrayList list 파일목록 + * @exception Exception + */ + public static List getFileListByUpdtPd(String drctry, String updtFrom, String updtTo) throws Exception { + + // 결과 목록 + List list = null; + + // 디렉토리 오픈 + String drctry1 = drctry.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File file = new File(EgovWebUtil.filePathBlackList(drctry1)); + + // 디렉토리이며, 최종수정기간내 존재하는 파일목록 조회 시작 + if (file.exists() && file.isDirectory()) { + File[] fileArray = file.listFiles(); + //KISA 보안약점 조치 (2018-10-29, 윤창원) + if (fileArray != null) { + list = getSubFilesByUpdtPd(fileArray, updtFrom, updtTo); + } + } + + return list; + } + + /** + * 하위디렉토리 포함 최종수정일자가 같은 파일목록을 찾는 기능 + * + * @param File fileArray 파일목록 + * @param String updtDate 최종수정일자(YYYYMMDD 형태로 입력) + * @return ArrayList list 파일목록 + * @exception Exception + */ + public static List getSubFilesByDate(File[] fileArray, String updtDate) throws Exception { + + List list = new ArrayList(); + + for (int i = 0; i < fileArray.length; i++) { + // 디렉토리 안에 디렉토리면 그 안의 파일목록에서 찾도록 재귀호출한다. + if (fileArray[i].isDirectory()) { + File[] tmpArray = fileArray[i].listFiles(); + list.addAll(getSubFilesByDate(tmpArray, updtDate)); + // 파일이면 파일명이 같은지 비교한다. + } else { + // 파일의 최종수정일자 조회 + long date = fileArray[i].lastModified(); + java.text.SimpleDateFormat dateFormat = new java.text.SimpleDateFormat("yyyyMMdd", + java.util.Locale.KOREA); + String lastUpdtDate = dateFormat.format(new java.util.Date(date)); + if (Integer.parseInt(lastUpdtDate) == Integer.parseInt(updtDate)) { + list.add(fileArray[i].getAbsolutePath()); + } + } + } + + return list; + } + + /** + * 파일을 특정 구분자(',', '|', 'TAB')로 파싱하는 기능 + * + * @param String parFile 파일 + * @param String parChar 구분자(',', '|', 'TAB') + * @param int parField 필드수 + * @return Vector parResult 파싱결과 구조체 + * @exception Exception + */ + public static Vector> parsFileByChar(String parFile, String parChar, int parField) throws Exception { + + // 파싱결과 구조체 + Vector> parResult = new Vector>(); + + // 파일 오픈 + String parFile1 = parFile.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File file = new File(EgovWebUtil.filePathBlackList(parFile1)); + BufferedReader br = null; + try { + // 파일이며, 존재하면 파싱 시작 + if (file.exists() && file.isFile()) { + + // 1. 파일 텍스트 내용을 읽어서 StringBuffer에 쌓는다. + br = new BufferedReader(new InputStreamReader(new FileInputStream(file))); + StringBuffer strBuff = new StringBuffer(); + String line = ""; + while ((line = br.readLine()) != null) { + if (line.length() < MAX_STR_LEN) { + strBuff.append(line); + } + } + + // 2. 쌓은 내용을 특정 구분자로 파싱하여 String 배열로 얻는다. + String[] strArr = EgovStringUtil.split(strBuff.toString(), parChar); + + // 3. 필드 수 만큼 돌아가며 Vector 형태로 만든다. + int filedCnt = 1; + List arr = new ArrayList(); + for (int i = 0; i < strArr.length; i++) { + + if (parField != 1) { + if ((filedCnt % parField) == 1) { + if (strArr[i] != null) { + arr.add(strArr[i]); + } + if (i == (strArr.length - 1)) { + parResult.add(arr); + } + } else if ((filedCnt % parField) == 0) { + if (strArr[i] != null) { + arr.add(strArr[i]); + parResult.add(arr); + } + } else { + if (strArr[i] != null) { + arr.add(strArr[i]); + if (i == (strArr.length - 1)) { + parResult.add(arr); + } + } + } + } else { + arr = new ArrayList(); + if (strArr[i] != null) { + arr.add(strArr[i]); + } + parResult.add(arr); + } + + filedCnt++; + } + } + } finally { + EgovResourceCloseHelper.close(br); + } + + return parResult; + } + + /** + * 파일을 일정 길이로 파싱하는 기능 + * + * @param String parFile 파일 + * @param int[] parLen 각 필드의 길이 + * @param int parLine 읽어낼 라인수 + * @return Vector parResult 파싱결과 구조체 + * @exception Exception + */ + public static Vector> parsFileBySize(String parFile, int[] parLen, int parLine) throws Exception { + + // 파싱결과 구조체 + Vector> parResult = new Vector>(); + + // 파일 오픈 + String parFile1 = parFile.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File file = new File(EgovWebUtil.filePathBlackList(parFile1)); + BufferedReader br = null; + try { + // 파일이며, 존재하면 파싱 시작 + if (file.exists() && file.isFile()) { + + // 1. 입력된 라인수만큼 파일 텍스트 내용을 읽어서 String[]에 쌓는다. + br = new BufferedReader(new InputStreamReader(new FileInputStream(file))); + if (parLine < 0) { + parLine = 0; + } + String[] strArr = new String[parLine]; + String line = ""; + int readCnt = 0; + while ((line = br.readLine()) != null && readCnt < parLine) { + if (line.length() <= MAX_STR_LEN) { + strArr[readCnt++] = line; + } + } + + // 2. Vector 형태로 만든다. + for (int i = 0; i < strArr.length; i++) { + String text = strArr[i]; + List arr = new ArrayList(); + int idx = 0; + boolean result = false; + for (int j = 0; j < parLen.length; j++) { + if (!result) { //if(result != true){ + String split = ""; + if (text.length() < (idx + parLen[j])) { + split = text.substring(idx, text.length()); + result = true; + } else { + split = text.substring(idx, idx + parLen[j]); + } + arr.add(split); + idx = idx + parLen[j]; + } + } + parResult.add(arr); + } + } + } finally { + EgovResourceCloseHelper.close(br); + } + + return parResult; + } + + /** + * 두 파일의 사이즈를 비교하는 기능 (KB 단위 비교) + * + * @param String cmprFile1 파일1 + * @param String cmprFile2 파일2 + * @return boolean result 동일여부 True / False + * @exception Exception + */ + public static boolean cmprFilesBySize(String cmprFile1, String cmprFile2) throws Exception { + + // 파일 동일 여부 + boolean result = false; + + // 파일 오픈 + String cmprFile11 = cmprFile1.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + String cmprFile22 = cmprFile2.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File file1 = new File(EgovWebUtil.filePathBlackList(cmprFile11)); + File file2 = new File(EgovWebUtil.filePathBlackList(cmprFile22)); + + // 파일이며, 존재하면 파일 사이즈 비교 + if (file1.exists() && file2.exists() && file1.isFile() && file2.isFile()) { + + // 파일1 사이즈 + long size1 = file1.length(); + + // 파일2 사이즈 + long size2 = file2.length(); + + // 사이즈 비교 + if (size1 == size2) { + result = true; + } + + } + + return result; + } + + /** + * 두 파일의 수정일자를 비교하는 기능 + * + * @param String cmprFile1 파일1 + * @param String cmprFile2 파일2 + * @return boolean result 동일여부 True / False + * @exception Exception + */ + public static boolean cmprFilesByUpdtPd(String cmprFile1, String cmprFile2) throws Exception { + + // 파일 동일 여부 + boolean result = false; + + // 파일 오픈 + String cmprFile11 = cmprFile1.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + String cmprFile22 = cmprFile2.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File file1 = new File(EgovWebUtil.filePathBlackList(cmprFile11)); + File file2 = new File(EgovWebUtil.filePathBlackList(cmprFile22)); + + // 파일이며, 존재하면 파일 수정일자 비교 + if (file1.exists() && file2.exists() && file1.isFile() && file2.isFile()) { + + // 파일1 수정일자 + long date1 = file1.lastModified(); + java.text.SimpleDateFormat dateFormat1 = new java.text.SimpleDateFormat("yyyyMMdd", java.util.Locale.KOREA); + String lastUpdtDate1 = dateFormat1.format(new java.util.Date(date1)); + + // 파일2 수정일자 + long date2 = file2.lastModified(); + java.text.SimpleDateFormat dateFormat2 = new java.text.SimpleDateFormat("yyyyMMdd", java.util.Locale.KOREA); + String lastUpdtDate2 = dateFormat2.format(new java.util.Date(date2)); + + // 수정일자 비교 + if (lastUpdtDate1.equals(lastUpdtDate2)) { + result = true; + } + } + + return result; + } + + /** + * 두 파일의 내용을 비교하는 기능 (TEXT파일만 가능) + * + * @param String cmprFile1 파일1 + * @param String cmprFile2 파일2 + * @return boolean result 동일여부 True / False + * @exception Exception + */ + public static boolean cmprFilesByContent(String cmprFile1, String cmprFile2) throws Exception { + + // 파일 동일 여부 + boolean result = false; + + // 파일 오픈 + String cmprFile11 = cmprFile1.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + String cmprFile22 = cmprFile2.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File file1 = new File(EgovWebUtil.filePathBlackList(cmprFile11)); + File file2 = new File(EgovWebUtil.filePathBlackList(cmprFile22)); + + BufferedReader br1 = null; + BufferedReader br2 = null; + + try { + // 파일이며, 존재하면 파일 내용 비교 + if (file1.exists() && file2.exists() && file1.isFile() && file2.isFile()) { + + List cmprText1 = new ArrayList(); + List cmprText2 = new ArrayList(); + + // 파일1 텍스트 내용 + br1 = new BufferedReader(new InputStreamReader(new FileInputStream(file1))); + String line1 = ""; + while ((line1 = br1.readLine()) != null) { + if (line1.length() < MAX_STR_LEN) { + cmprText1.add(line1); + } + } + + // 파일2 텍스트 내용 + br2 = new BufferedReader(new InputStreamReader(new FileInputStream(file2))); + String line2 = ""; + while ((line2 = br2.readLine()) != null) { + if (line2.length() <= MAX_STR_LEN) { + cmprText2.add(line2); + } + } + + // 내용 비교 + boolean isWrong = false; + for (int i = 0; i < cmprText1.size(); i++) { + if (!isWrong) { // if(isWrong != true){ + String text1 = cmprText1.get(i); + String text2 = cmprText2.get(i); + + if (!text1.equals(text2)) { + isWrong = true; + } + } + } + + if (!isWrong) { + result = true; + } + } + } finally { + EgovResourceCloseHelper.close(br1, br2); + } + + return result; + } + + /** + * 두 파일의 생성자를 비교하는 기능 + * + * @param String cmprFile1 파일1 + * @param String cmprFile2 파일2 + * @return boolean result 동일여부 True / False + * @exception Exception + */ + public static boolean cmprFilesByOwner(String cmprFile1, String cmprFile2) throws Exception { + + // 파일 동일 여부 + boolean result = false; + + // 파일1 생성자 + String owner1 = getOwner(cmprFile1); + + // 파일2 생성자 + String owner2 = getOwner(cmprFile2); + + if (owner1 != null && owner2 != null && !"".equals(owner1) && !"".equals(owner2) && owner1.equals(owner2)) { + result = true; + } + + return result; + } + + /** + * 단일 파일을 다른 파일에 복사(Copy)한다. + * + * @param String source 원본파일 + * @param String target 타겟파일 + * @return boolean result 복사여부 True / False + * @exception Exception + */ + public static boolean copyFile(String source, String target) throws Exception { + + // 복사여부 + boolean result = false; + + // 원본 파일 + String src = source.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File srcFile = new File(EgovWebUtil.filePathBlackList(src)); + + // 타켓 파일 + String tar = target.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + + // 원본 파일이 존재하는지 확인한다. + if (srcFile.exists()) { + + // 복사될 target 파일 생성 + tar = createNewFile(tar); + //log.debug("tar:"+tar); + File tarFile = new File(EgovWebUtil.filePathBlackList(tar)); + //log.debug("tarFile:"+tarFile.getAbsolutePath()); + // 복사 + result = execCopyFile(srcFile, tarFile); + } + + return result; + } + + /** + * 여러 파일을 다른 디렉토리에 복사(Copy)한다. + * + * @param String source 원본파일들 + * @param String target 타겟디렉토리 + * @return boolean result 복사여부 True / False + * @exception Exception + */ + public static boolean copyFiles(String[] source, String target) throws Exception { + + // 복사여부 + boolean result = true; + + // 복사 이전에 복사할 파일들의 경로가 올바른지 확인한다. + for (int i = 0; i < source.length; i++) { + String src = source[i].replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File chkFile = new File(EgovWebUtil.filePathBlackList(src)); + if (!chkFile.exists()) { + //log.debug("+++ 원본 파일이 존재하지 않습니다."); + return result; + } + } + + String tar = target.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + + // 복사를 시작한다. + for (int j = 0; j < source.length; j++) { + + if (result) { //result != false + + // 타겟파일이름 명명 + File chkFile = new File(EgovWebUtil.filePathBlackList(source[j])); + String tarTemp = tar + FILE_SEPARATOR + chkFile.getName(); + + // 복사될 target 파일 생성 + tarTemp = createNewFile(tarTemp); + File tarFile = new File(EgovWebUtil.filePathBlackList(tarTemp)); + + // 복사 + result = execCopyFile(chkFile, tarFile); + } + } // end for + + return result; + } + + /** + * 확장자별 파일들을 다른 디렉토리에 복사(Copy)한다. + * + * @param String source 원본디렉토리 + * @param String extnt 확장자(.txt 형태 입력) + * @param String target 타겟디렉토리 + * @return boolean result 복사여부 True / False + * @exception Exception + */ + public static boolean copyFilesByExtnt(String source, String extnt, String target) throws Exception { + + // 복사여부 + boolean result = true; + + // 원본 파일 + String src = source.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File srcFile = new File(EgovWebUtil.filePathBlackList(src)); + + // 원본 디렉토리가 존재하는지 확인한다. + if (srcFile.exists() && srcFile.isDirectory()) { + + String tar = target.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + + // 원본 디렉토리 안에서 확장자가 일치하는 파일목록을 가져온다. + File[] fileArray = srcFile.listFiles(); + //KISA 보안약점 조치 (2018-10-29, 윤창원) + if (fileArray != null) { + List list = getSubFilesByExtnt(fileArray, extnt); + + // 복사를 시작한다. + for (int i = 0; i < list.size(); i++) { + if (result) { //f(result != false){ + // 원본파일 절대경로 + String abspath = list.get(i); + + // 타겟파일이름 명명 + File chkFile = new File(EgovWebUtil.filePathBlackList(abspath)); + String tarTemp = tar + FILE_SEPARATOR + chkFile.getName(); + + // 복사될 target 파일 생성 + tarTemp = createNewFile(tarTemp); + File tarFile = new File(EgovWebUtil.filePathBlackList(tarTemp)); + + // 복사 + result = execCopyFile(chkFile, tarFile); + } + } // end for + } else { + result = false; + } + + } + + return result; + } + + /** + * 수정기간내 파일들을 다른 디렉토리에 복사(Copy)한다. + * + * @param String source 원본디렉토리 + * @param String updtFrom 수정시작일자(YYYYMMDD 형태로 입력) + * @param String updtTo 수정종료일자(YYYYMMDD 형태로 입력) + * @param String target 타겟디렉토리 + * @return boolean result 복사여부 True / False + * @exception Exception + */ + public static boolean copyFilesByUpdtPd(String source, String updtFrom, String updtTo, String target) + throws Exception { + + // 복사여부 + boolean result = true; + + // 원본 파일 + String src = source.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File srcFile = new File(EgovWebUtil.filePathBlackList(src)); + + // 원본 디렉토리가 존재하는지 확인한다. + if (srcFile.exists() && srcFile.isDirectory()) { + + String tar = target.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + + // 원본 디렉토리 안에서 수정기간내 존재하는 파일목록을 가져온다. + File[] fileArray = srcFile.listFiles(); + //KISA 보안약점 조치 (2018-10-29, 윤창원) + if (fileArray != null) { + List list = getSubFilesByUpdtPd(fileArray, updtFrom, updtTo); + + // 복사를 시작한다. + for (int i = 0; i < list.size(); i++) { + + if (result) { //f(result != false){ + + // 원본파일 절대경로 + String abspath = list.get(i); + + // 타겟파일이름 명명 + File chkFile = new File(EgovWebUtil.filePathBlackList(abspath)); + String tarTemp = tar + FILE_SEPARATOR + chkFile.getName(); + + // 복사될 target 파일 생성 + tarTemp = createNewFile(tarTemp); + File tarFile = new File(tarTemp); + + // 복사 + result = execCopyFile(chkFile, tarFile); + } + } // end for + } + } + + return result; + } + + /** + * 사이즈내 파일들을 다른 디렉토리에 복사(Copy)한다. + * + * @param String source 원본디렉토리 + * @param Long sizeFrom 최소사이즈(KB) + * @param Long sizeTo 최대사이즈(KB) + * @param String target 타겟디렉토리 + * @return boolean result 복사여부 True / False + * @exception Exception + */ + public static boolean copyFilesBySize(String source, long sizeFrom, long sizeTo, String target) throws Exception { + + // 복사여부 + boolean result = true; + + // 원본 파일 + String src = source.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File srcFile = new File(EgovWebUtil.filePathBlackList(src)); + + // 원본 디렉토리가 존재하는지 확인한다. + if (srcFile.exists() && srcFile.isDirectory()) { + + String tar = target.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + + // 원본 디렉토리 안에서 사이즈내 존재하는 파일목록을 가져온다. + File[] fileArray = srcFile.listFiles(); + //KISA 보안약점 조치 (2018-10-29, 윤창원) + if (fileArray != null) { + List list = getSubFilesBySize(fileArray, sizeFrom, sizeTo); + + // 복사를 시작한다. + for (int i = 0; i < list.size(); i++) { + + if (result) { //result != false + // 원본파일 절대경로 + String abspath = list.get(i); + + // 타겟파일이름 명명 + File chkFile = new File(EgovWebUtil.filePathBlackList(abspath)); + String tarTemp = tar + FILE_SEPARATOR + chkFile.getName(); + + // 복사될 target 파일 생성 + tarTemp = createNewFile(tarTemp); + File tarFile = new File(EgovWebUtil.filePathBlackList(tarTemp)); + + // 복사 + result = execCopyFile(chkFile, tarFile); + if (result) { + break; + } + } + } // end for + } + + } + + return result; + } + + /** + * 생성자별 파일들을 다른 디렉토리에 복사(Copy)한다. + * + * @param String source 원본디렉토리 + * @param String owner 생성자 + * @param String target 타겟디렉토리 + * @return boolean result 복사여부 True / False + * @exception Exception + */ + public static boolean copyFilesByOwner(String source, String owner, String target) throws Exception { + + // 복사여부 + boolean result = true; + + // 원본 파일 + String src = source.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File srcFile = new File(EgovWebUtil.filePathBlackList(src)); + + // 원본 디렉토리가 존재하는지 확인한다. + if (srcFile.exists() && srcFile.isDirectory()) { + + String tar = target.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + + // 원본 디렉토리 안에서 생성자별 일치하는 파일목록을 가져온다. + File[] fileArray = srcFile.listFiles(); + //KISA 보안약점 조치 (2018-10-29, 윤창원) + if (fileArray != null) { + List list = getSubFilesByOwner(fileArray, owner); + + // 복사를 시작한다. + for (int i = 0; i < list.size(); i++) { + + if (result) { //result != false + + // 원본파일 절대경로 + String abspath = list.get(i); + + // 타겟파일이름 명명 + File chkFile = new File(EgovWebUtil.filePathBlackList(abspath)); + String tarTemp = tar + FILE_SEPARATOR + chkFile.getName(); + + // 복사될 target 파일 생성 + tarTemp = createNewFile(tarTemp); + File tarFile = new File(EgovWebUtil.filePathBlackList(tarTemp)); + + // 복사 + result = execCopyFile(chkFile, tarFile); + + if (!result) { + break; + } + } + } // end for + } + + } + + return result; + } + + /** + * 복사를 수행하는 기능 + * + * @param File srcFile 원본파일 + * @param File tarFile 타겟파일 + * @return boolean result 복사여부 True / False + * @exception Exception + */ + public static boolean execCopyFile(File srcFile, File tarFile) throws Exception { + + // 결과 + boolean result = false; + FileInputStream fis = null; + FileOutputStream fos = null; + try { + // 복사 + fis = new FileInputStream(srcFile); + + //예외상황에 따른 처리 추가함. -> 만약 tarFile 이 디렉토리명인 경우 디렉토리 밑으로 새로 파일을 생성해서 복사한다.. like DOS + File tarFile1 = tarFile; + if (tarFile1.isDirectory()) { + tarFile1 = new File( + EgovWebUtil.filePathBlackList(tarFile1.getAbsolutePath()) + "/" + srcFile.getName()); + } + fos = new FileOutputStream(tarFile1); + byte[] buffer = new byte[(int)BUFFER_SIZE]; + int i = 0; + if (fis != null && fos != null) { + while ((i = fis.read(buffer)) != -1) { + fos.write(buffer, 0, i); + } + } + + result = true; + } finally { + EgovResourceCloseHelper.close(fis, fos); + } + + return result; + } + + /** + *
    +	 * Comment : 디렉토리를 삭제한다. (소유자 정보를 통해 삭제)
    +	 * 
    + * + * @param dirDeletePath 삭제하고자 하는디렉토리의 절대경로(파일의 경로가 들어오는 경우 삭제하지 않음) + * @param owner 디렉토리의 삭제조건 생성자 + * @return 성공하면 삭제된 절대경로, 아니면블랭크 + */ + + public static String deleteDirectory(String dirDeletePath, String dirOwner) { + + // 인자값 유효하지 않은 경우 블랭크 리턴 + if (dirDeletePath == null || dirDeletePath.equals("") || dirOwner == null || dirOwner.equals("")) { + return ""; + } + + // 찾은 결과를 전달할 ArrayList + String result = ""; + + try { + File file = new File(EgovWebUtil.filePathBlackList(dirDeletePath));//KISA 보안약점 조치 (2018-10-29, 윤창원) + + // 추가된 삭제조건 옵션에 합당한지 확인 + boolean isInCondition = false; + String realOwner = getOwner(dirDeletePath); + //log.debug("realOwner:"+realOwner); + if (dirOwner.equals(realOwner)) { + isInCondition = true; + } + // 삭제조건에 부합되면 디렉토리 삭제조치함 + if (file.isDirectory() && isInCondition) { + result = deleteDirectory(dirDeletePath); + } else { + result = realOwner; + } + } catch (NullPointerException e) {//KISA 보안약점 조치 (2018-10-29, 윤창원) + throw new RuntimeException(e); + } catch (Exception e) { + throw new RuntimeException(e); + } + + return result; + } + + /** + *
    +	 * Comment : 디렉토리를 삭제한다. (생성일자 조건으로 삭제)
    +	 * 
    + * + * @param dirDeletePath 삭제하고자 하는디렉토리의 절대경로(파일의 경로가 들어오는 경우 삭제하지 않음) + * @param fromDate 디렉토리의 삭제조건 시작일자 + * @param toDate 디렉토리의 삭제조건 종료일자 + * @return 성공하면 삭제된 절대경로, 아니면블랭크 + */ + public static String deleteDirectory(String dirDeletePath, String fromDate, String toDate) { + + // 인자값 유효하지 않은 경우 블랭크 리턴 + if (dirDeletePath == null || dirDeletePath.equals("") || fromDate == null || fromDate.equals("") + || toDate == null || toDate.equals("")) { + return ""; + } + + // 찾은 결과를 전달할 ArrayList + String result = ""; + File file = new File(EgovWebUtil.filePathBlackList(dirDeletePath)); + + // 추가된 삭제조건 옵션에 합당한지 확인 + boolean isInCondition = false; + String lastModifyedDate = getLastModifiedDateFromFile(file); + //log.debug("lastModifyedDate:"+lastModifyedDate); + + if (Integer.parseInt(lastModifyedDate) >= Integer.parseInt(fromDate) + && Integer.parseInt(lastModifyedDate) <= Integer.parseInt(toDate)) { + isInCondition = true; + } + + // 삭제조건에 부합되면 디렉토리 삭제조치함 + if (file.isDirectory() && isInCondition) { + result = deleteDirectory(dirDeletePath); + } + + return result; + } + + /** + * 파일(디렉토리)가 존재하는 파일시스템(마운트된 위치)을 조회하는 기능 + * + * @param String file 파일(디렉토리) + * @return String mountLc 마운트위치 + * @exception Exception + */ + public static String getMountLc(String file) throws Exception { + + // 디스크명 + String diskName = ""; + + //String drctryName = ""; + String src = file.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + + File srcFile = new File(EgovWebUtil.filePathBlackList(src)); + if (srcFile.exists()) { + + // 유닉스 파일시스템명 조회 (df -k $1 | grep $2 | awk -F" " '{print $7}') + if (Globals.OS_TYPE.equals("UNIX")) { + Process p = null; + String[] command = { + EgovProperties.getProperty(Globals.SHELL_FILE_PATH, "SHELL." + Globals.OS_TYPE + ".getMountLc"), + src, "/"}; + p = Runtime.getRuntime().exec(command); + //p.waitFor(); + + //boolean result = false; + BufferedReader b_out = new BufferedReader(new InputStreamReader(p.getInputStream())); + try { + while (true) { + String str = b_out.readLine(); + if (str == null || "".equals(str)) { + break; + } + if (str.length() <= MAX_STR_LEN) { + diskName = str; + } else { + diskName = str.substring(0, MAX_STR_LEN); + } + } + } finally { + EgovResourceCloseHelper.close(b_out); + } + + if (p != null) { + p.destroy(); + } + + // 윈도우 파일시스템명 조회 + } else if (Globals.OS_TYPE.equals("WINDOWS")) { + + diskName = src == null || src.length() < 1 ? "" : src.substring(0, 1).toUpperCase(); + //log.debug(diskName); + } + } + + return diskName; + } + + /** + * 파일(디렉토리)가 존재하는 디렉토리(Parent)를 조회하는 기능 + * + * @param String file 파일(디렉토리) + * @return String drctryName 디렉토리 + * @exception Exception + */ + public static String getDrctryName(String file) throws Exception { + + String drctryName = ""; + String src = file.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + + File srcFile = new File(EgovWebUtil.filePathBlackList(src)); + if (srcFile.exists()) { + drctryName = srcFile.getParent(); + } + + return drctryName; + } + + /** + * 파일(디렉토리)가 존재하는 파일명을 조회하는 기능 + * + * @param String file 파일(디렉토리) + * @return String fileName 파일명 + * @exception Exception + */ + public static String getFileName(String file) throws Exception { + + String fileName = ""; + String src = file.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + + File srcFile = new File(EgovWebUtil.filePathBlackList(src)); + if (srcFile.exists()) { + fileName = srcFile.getName(); + } + + return fileName; + } + + /** + * 파일(디렉토리)의 최종수정일자를 조회하는 기능 + * + * @param String file 파일(디렉토리) + * @return String updtDate 최종수정일자(YYYYMMDD 형태) + * @exception Exception + */ + public static String getUpdtDate(String file) throws Exception { + + String updtDate = ""; + String src = file.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + + File srcFile = new File(EgovWebUtil.filePathBlackList(src)); + if (srcFile.exists()) { + long date = srcFile.lastModified(); + java.text.SimpleDateFormat dateFormat = new java.text.SimpleDateFormat("yyyyMMdd", java.util.Locale.KOREA); + updtDate = dateFormat.format(new java.util.Date(date)); + } + + return updtDate; + } + + /** + * 파일(디렉토리)의 생성자를 조회하는 기능 + * + * @param String file 파일(디렉토리) + * @return String owner 생성자 + * @exception Exception + */ + public static String getOwner(String file) throws Exception { + + String owner = ""; + String src = file.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + BufferedReader b_err = null; + BufferedReader b_out = null; + try { + File srcFile = new File(EgovWebUtil.filePathBlackList(src)); + if (srcFile.exists()) { + + // 파일 생성자 조회 + String parentPath = EgovStringUtil.isNullToString(srcFile.getParent()); + String fname = EgovStringUtil.isNullToString(srcFile.getName()); + + Process p = null; + String cmdStr = EgovStringUtil.isNullToString(EgovProperties.getProperty(Globals.SHELL_FILE_PATH, + "SHELL." + Globals.OS_TYPE + ".getDrctryOwner")); + String[] command = {cmdStr.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR), + parentPath.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR), + fname}; + p = Runtime.getRuntime().exec(command); + p.waitFor(); + //프로세스 에러시 종료 + if (p != null && p.exitValue() != 0) { + b_err = new BufferedReader(new InputStreamReader(p.getErrorStream())); + while (b_err.ready()) { + //String line = b_err.readLine(); + //if (line.length() <= MAX_STR_LEN) log.debug("ERR\n" + line); + } + } else if (p != null) { //프로세스 실행 성공시 결과 확인 + boolean result = false; + b_out = new BufferedReader(new InputStreamReader(p.getInputStream())); + while (b_out.ready()) { + if (!result) { // result != true + // 결과문자가 있으면 생성자가 있다는 의미 + owner = b_out.readLine(); + //KISA 보안약점 조치 (2018-10-29, 윤창원) + if (owner != null) { + if (owner.length() <= MAX_STR_LEN) { + if (!"".equals(owner)) { + result = true; + break; + } + } + } + } + } + } + + } + } finally { + EgovResourceCloseHelper.close(b_err, b_out); + } + + return owner; + } + + /** + * 파일(디렉토리)의 접근권한을 조회하는 기능 + * + * @param String file 파일(디렉토리) + * @return String access 접근권한(유닉스=777, 666, 윈도우=Read, Write, Read Only) + * @exception Exception + */ + public static String getAccess(String file) throws Exception { + + String access = ""; + String src = file.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + // 2020-12-07 KISA 보안코드 검증 조치 + src = EgovWebUtil.filePathBlackList(src); + + BufferedReader b_err = null; + BufferedReader b_out = null; + try { + File srcFile = new File(src); + if (srcFile.exists()) { + + // 접근권한 조회 + String parentPath = srcFile.getParent(); + String fname = srcFile.getName(); + + Process p = null; + if (Globals.OS_TYPE.equals("UNIX")) { + String[] command = {EgovProperties.getProperty(Globals.SHELL_FILE_PATH, + "SHELL." + Globals.OS_TYPE + ".getDrctryAccess"), parentPath, fname}; + p = Runtime.getRuntime().exec(command); + p.waitFor(); + //프로세스 에러시 종료 + if (p != null && p.exitValue() != 0) { + b_err = new BufferedReader(new InputStreamReader(p.getErrorStream())); + while (b_err.ready()) { + //String line = b_err.readLine(); + //if (line.length() <= MAX_STR_LEN) log.debug("ERR\n" + line); + } + b_err.close(); + } + //프로세스 실행 성공시 결과 확인 + else if (p != null) { + boolean result = false; + b_out = new BufferedReader(new InputStreamReader(p.getInputStream())); + while (b_out.ready()) { + if (!result) { //result != true + access = b_out.readLine(); + if (access != null && !"".equals(access) && access.length() <= MAX_STR_LEN) { + result = true; + break; + } + } + } + b_out.close(); + } + } else if (Globals.OS_TYPE.equals("WINDOWS")) { + String[] command = {"cmd", "/c", "attrib", src}; + p = Runtime.getRuntime().exec(command); + p.waitFor(); + //프로세스 에러시 종료 + if (p != null && p.exitValue() != 0) { + b_err = new BufferedReader(new InputStreamReader(p.getErrorStream())); + while (b_err.ready()) { + //String line = b_err.readLine(); + //if (line.length() <= MAX_STR_LEN) log.debug("ERR\n" + line); + } + } else { //프로세스 실행 성공시 결과 확인 + boolean result = false; + b_out = new BufferedReader(new InputStreamReader(p.getInputStream())); + while (b_out.ready()) { + if (!result) { //result != true + access = b_out.readLine(); + if (access != null && !"".equals(access) && access.length() <= MAX_STR_LEN) { + access = access.toUpperCase().replace(src.toUpperCase(), ""); + access = access.replace(" ", ""); + result = true; + if (result) { + break; + } + } + } + } + + if (result) { + String acs = ""; + boolean read = false; + boolean write = true; + boolean system = false; + boolean hidden = false; + + for (int i = 0; i < access.length(); i++) { + char chr = access.charAt(i); + switch (chr) { + case ACCESS_READ: + read = true; + write = false; + break; + case ACCESS_SYS: + system = true; + break; + case ACCESS_HIDE: + hidden = true; + break; + default: + break; + } + } + + if (read) { + acs += "READ-ONLY|"; + } else { + acs += "READ|"; + } + if (write) { + acs += "WRITE|"; + } + if (system) { + acs += "SYSTEM|"; + } + if (hidden) { + acs += "HIDDEN|"; + } + access = acs; + } + } + } + + } + } finally { + EgovResourceCloseHelper.close(b_err, b_out); + } + + return access; + } + + /** + * 파일(디렉토리)의 사이즈를 조회하는 기능 + * + * @param String file 파일(디렉토리) + * @return Long size 사이즈(Byte) + * @exception Exception + */ + public static long getSize(String file) throws Exception { + + long size = 0L; + String src = file.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + + File srcFile = new File(EgovWebUtil.filePathBlackList(src)); + if (srcFile.exists()) { + size = srcFile.length(); + } + + return size; + } + + /** + * 파일(디렉토리)의 포맷을 조회하는 기능 + * + * @param String file 파일(디렉토리) + * @return String format 포맷 + * @exception Exception + */ + public static String getFormat(String file) throws Exception { + + // 포맷, 타입 + String format = ""; + String type = ""; + + String src = file.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + + File srcFile = new File(EgovWebUtil.filePathBlackList(src)); + if (srcFile.exists()) { + + String[] strArr = (EgovStringUtil.isNullToString(src)).split("\\."); + if (strArr.length >= 2) { + format = strArr[strArr.length - 1].toLowerCase(); + type = EgovProperties.getProperty(Globals.FILE_FORMAT_PATH, format); + } + } + + return type; + } + + /** + *
    +	 * Comment : 디렉토리를 복사한다.
    +	 * 
    + * + * @param String originalDirPath 원본 디렉토리 의 절대경로 + * @param String targetDirPath 타겟 디렉토리 의 절대경로 + * @return boolean result 복사가 성공하면 true, 실패하면 false를 리턴한다. + */ + public static boolean copyDirectory(String originalDirPath, String targetDirPath) throws Exception { + + // 인자값 유효하지 않은 경우 공백 리턴 + if (originalDirPath == null || originalDirPath.equals("") || targetDirPath == null + || targetDirPath.equals("")) { + return false; + } + boolean result = false; + File f = null; + + f = new File(EgovWebUtil.filePathBlackList(originalDirPath)); + // 원본이 유효해야 진행한다. + if (f.exists() && f.isDirectory()) { + + //타겟으로 설정한 경로가 유효한지 확인(중간경로에 파일명 이 포함되어있으면 유효하지 못하므로 진행안함. + String targetDirPath1 = createNewDirectory(targetDirPath); + if (targetDirPath1.equals("")) { + result = false; + } else { + File targetDir = new File(EgovWebUtil.filePathBlackList(targetDirPath1)); + //2017.02.08 이정은 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + if (targetDir.mkdirs()) { + LOGGER.debug("[file.mkdirs] targetDir : Directory Creation Success"); + } else { + LOGGER.error("[file.mkdirs] targetDir : Directory Creation Fail"); + } + + // 디렉토리에 속한 파일들을 복사한다. + String[] originalFileList = f.list(); + //KISA 보안약점 조치 (2018-10-29, 윤창원) + if (originalFileList != null) { + if (originalFileList.length > 0) { + for (int i = 0; i < originalFileList.length; i++) { + File subF = new File( + EgovWebUtil.filePathBlackList(originalDirPath) + FILE_SEPARATOR + originalFileList[i]); + if (subF.isFile()) { + //하위목록이 파일이면 파일복사실행 -> 실패 발생하는 경우 복사를 중단한다. + result = copyFile(originalDirPath + FILE_SEPARATOR + originalFileList[i], + targetDir.getAbsolutePath() + FILE_SEPARATOR + originalFileList[i]); + } else { + //하위목록이 디렉토리이면 복사를 재귀적으로 호출한다. + result = copyDirectory(originalDirPath + "/" + originalFileList[i], + targetDirPath1 + "/" + originalFileList[i]); + } + } + } else { + result = true; + } + } + } + } else { + // 원본자체가 유효하지 않은 경우는 false 리턴하고 종료 + result = false; + } + + return result; + } + + /** + *
    +	 * Comment : 디렉토리를 복사한다. (생성일자 조건으로  복사)
    +	 * 
    + * + * @param String originalDirPath 원본 디렉토리 의 절대경로 + * @param String targetDirPath 타겟 디렉토리 의 절대경로 + * @param fromDate 디렉토리의 복사조건 시작일자 + * @param toDate 디렉토리의 복사조건 종료일자 + * @return boolean result 복사가 성공함변 true, 실패하면 false를 리턴한다. + */ + public static boolean copyDirectory(String originalDirPath, String targetDirPath, String fromDate, String toDate) + throws Exception { + + // 인자값 유효하지 않은 경우 공백 리턴 + if (originalDirPath == null || originalDirPath.equals("") || targetDirPath == null || targetDirPath.equals("") + || fromDate == null || fromDate.equals("") || toDate == null + || toDate.equals("")) { + return false; + } + boolean result = false; + File f = null; + + f = new File(EgovWebUtil.filePathBlackList(originalDirPath)); + boolean isInCondition = false; + String lastModifyedDate = getLastModifiedDateFromFile(f); + if (Integer.parseInt(lastModifyedDate) >= Integer.parseInt(fromDate) + && Integer.parseInt(lastModifyedDate) <= Integer.parseInt(toDate)) { + isInCondition = true; + } + + // 원본이 유효하고 조건에 부합되야 진행한다. + if (f.exists() && f.isDirectory() && isInCondition) { + + //타겟으로 설정한 경로가 유효한지 확인(중간경로에 파일명 이 포함되어있으면 유효하지 못하므로 진행안함. + String targetDirPath1 = createNewDirectory(targetDirPath); + if (targetDirPath1.equals("")) { + result = false; + } else { + File targetDir = new File(EgovWebUtil.filePathBlackList(targetDirPath1)); + //2017.02.08 이정은 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + if (targetDir.mkdirs()) { + LOGGER.debug("[file.mkdirs] targetDir : Directory Creation Success"); + } else { + LOGGER.error("[file.mkdirs] targetDir : Directory Creation Fail"); + } + + // 디렉토리에 속한 파일들을 복사한다. + String[] originalFileList = f.list(); + //KISA 보안약점 조치 (2018-10-29, 윤창원) + if (originalFileList != null) { + if (originalFileList.length > 0) { + for (int i = 0; i < originalFileList.length; i++) { + File subF = new File( + EgovWebUtil.filePathBlackList(originalDirPath) + FILE_SEPARATOR + originalFileList[i]); + if (subF.isFile()) { + //하위목록이 파일이면 파일복사실행 -> 실패 발생하는 경우 복사를 중단한다. + result = copyFile(originalDirPath + FILE_SEPARATOR + originalFileList[i], + targetDir.getAbsolutePath() + FILE_SEPARATOR + originalFileList[i]); + } else { + //하위목록이 디렉토리이면 복사를 재귀적으로 호출한다. + //하위목록에 해당하는 폴더에 대해서는 생성일자 검사를 하지 않는다.(현재 폴더가 복사대상이면 현재폴더의 하위는 제외없이 복사함) + result = copyDirectory(originalDirPath + "/" + originalFileList[i], + targetDirPath1 + "/" + originalFileList[i]); + } + } + } else { + result = true; + } + } + } + + } else { + // 원본자체가 유효하지 않은 경우는 false 리턴하고 종료 + result = false; + } + + return result; + } + + /** + *
    +	 * Comment : 디렉토리를 복사한다. (생성자 조건으로복사)
    +	 * 
    + * + * @param String originalDirPath 원본 디렉토리 의 절대경로 + * @param String targetDirPath 타겟 디렉토리 의 절대경로 + * @param String owner 디렉토리의 복사조건생성자 + * @return boolean result 복사가 성공함변 true, 실패하면 false를 리턴한다. + */ + public static boolean copyDirectory(String originalDirPath, String targetDirPath, String owner) throws Exception { + + // 인자값 유효하지 않은 경우 공백 리턴 + if (originalDirPath == null || originalDirPath.equals("") || targetDirPath == null || targetDirPath.equals("") + || owner == null || owner.equals("")) { + return false; + } + boolean result = false; + File f = null; + + f = new File(EgovWebUtil.filePathBlackList(originalDirPath)); + boolean isInCondition = false; + String realOwner = getOwner(originalDirPath); + if (realOwner != null && realOwner.equals(owner)) {//2022.01 Null pointers should not be dereferenced + isInCondition = true; + } + + // 원본이 유효하고 조건에 부합되야 진행한다. + if (f.exists() && f.isDirectory() && isInCondition) { + + String targetDirPath1 = createNewDirectory(targetDirPath); + if (targetDirPath1.equals("")) { + //타겟으로 설정한 경로가 유효한지 확인(중간경로에 파일명 이 포함되어있으면 유효하지 못하므로 진행안함. + result = false; + } else { + File targetDir = new File(EgovWebUtil.filePathBlackList(targetDirPath1)); + + //2017.02.08 이정은 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + if (targetDir.mkdirs()) { + LOGGER.debug("[file.mkdirs] targetDir : Directory Creation Success"); + } else { + LOGGER.error("[file.mkdirs] targetDir : Directory Creation Fail"); + } + + // 디렉토리에 속한 파일들을 복사한다. + String[] originalFileList = f.list(); + //KISA 보안약점 조치 (2018-10-29, 윤창원) + if (originalFileList != null) { + if (originalFileList.length > 0) { + for (int i = 0; i < originalFileList.length; i++) { + File subF = new File( + EgovWebUtil.filePathBlackList(originalDirPath) + FILE_SEPARATOR + originalFileList[i]); + if (subF.isFile()) { + //하위목록이 파일이면 파일복사실행 -> 실패 발생하는 경우 복사를 중단한다. + result = copyFile(originalDirPath + FILE_SEPARATOR + originalFileList[i], + targetDir.getAbsolutePath() + FILE_SEPARATOR + originalFileList[i]); + } else { + //하위목록이 디렉토리이면 복사를 재귀적으로 호출한다. + //하위목록에 해당하는 폴더에 대해서는 생성일자 검사를 하지 않는다.(현재 폴더가 복사대상이면 현재폴더의 하위는 제외없이 복사함) + result = copyDirectory(originalDirPath + "/" + originalFileList[i], + targetDirPath1 + "/" + originalFileList[i]); + } + } + } else { + result = false; + } + } + } + + } else { + // 원본자체가 유효하지 않은 경우는 false 리턴하고 종료 + result = false; + } + + return result; + } + + /** + * 디렉토리의 사이즈를 조회한다. + * + * @param String targetDirPath 디렉토리 + * @return long size 디렉토리사이즈 + * @exception Exception + */ + public static long getDirectorySize(String targetDirPath) throws Exception { + + File f = new File(EgovWebUtil.filePathBlackList(targetDirPath)); + if (!f.exists()) { + return 0; + } + if (f.isFile()) { + return f.length(); + } + + File[] list = f.listFiles(); + long size = 0; + long fileSize = 0; + + //KISA 보안약점 조치 (2018-10-29, 윤창원) + if (list != null) { + for (int i = 0; i < list.length; i++) { + + if (list[i].isDirectory()) { + // 디렉토리 안에 디렉토리면 그 안의 파일목록에서 찾도록 재귀호출한다. + fileSize = getDirectorySize(list[i].getAbsolutePath()); + } else { + // 파일의 사이즈 조회 + fileSize = list[i].length(); + } + size = size + fileSize; + } + } + return size; + } + + /** + *
    +	 * Comment : 디렉토리를 이동한다.
    +	 * 
    + * + * @param String originalDirPath 원본 디렉토리 의 절대경로 + * @param String targetDirPath 타겟 디렉토리 의 절대경로 + * @return boolean result 이동이 성공하면 true, 실패하면 false를 리턴한다. + */ + public static boolean moveFile(String originalDirPath, String targetDirPath) throws Exception { + + // 인자값 유효하지 않은 경우 공백 리턴 + if (originalDirPath == null || originalDirPath.equals("") || targetDirPath == null + || targetDirPath.equals("")) { + return false; + } + boolean result = false; + File f = null; + BufferedReader b_err = null; + BufferedReader b_out = null; + try { + f = new File(EgovWebUtil.filePathBlackList(originalDirPath)); + // 원본은 유효하고 대상이 신규로 생성가능한 상태인경우만 진행한다. + //if(f.exists() && f.isDirectory() ){ // 디렉토리만 이동할수 있도록 제한하는 경우 + if (f.exists()) { + // 타겟으로 설정한 경로가 유효한지 확인(중간경로에 파일명 이 포함되어있으면 유효하지 못하므로 진행안함. + File targetDir = new File(EgovWebUtil.filePathBlackList(targetDirPath)); + if (targetDir.exists()) { + // 타겟경로가 이미 있는 경우는 종료 + result = false; + } else { + // 새로 생성되는 경우만 진행한다. (이동쉘을 실행시킨다.) + //KISA 보안약점 조치 (2018-10-29, 윤창원) + String cmdStr = EgovStringUtil.isNullToString(EgovProperties.getProperty(Globals.SHELL_FILE_PATH, + "SHELL." + Globals.OS_TYPE + ".moveDrctry")); + String[] command = {cmdStr.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR), + EgovWebUtil.filePathBlackList( + originalDirPath.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR)), + EgovWebUtil.filePathBlackList( + targetDirPath.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR))}; + Process p = Runtime.getRuntime().exec(command); + //String access = ""; + p.waitFor(); + //프로세스 에러시 종료 + if (p != null && p.exitValue() != 0) { + b_err = new BufferedReader(new InputStreamReader(p.getErrorStream())); + while (b_err.ready()) { + //String line = b_err.readLine(); + //if (line.length() <= MAX_STR_LEN) log.debug("ERR\n" + line); + } + b_err.close(); + } + //프로세스 실행 성공시 결과 확인 + else { + result = true; + } + } + + } else { + // 원본자체가 유효하지 않은 경우는 false 리턴하고 종료 + result = false; + } + } finally { + EgovResourceCloseHelper.close(b_err, b_out); + } + + return result; + } + + /** + *
    +	 * Comment : 디렉토리를 이동한다. (생성일자 조건으로 이동)
    +	 * 
    + * + * @param String originalDirPath 원본 디렉토리 의 절대경로 + * @param String targetDirPath 타겟 디렉토리 의 절대경로 + * @param fromDate 디렉토리의이동조건 시작일자 + * @param toDate 디렉토리의 이동조건 종료일자 + * @return boolean result 이동이 성공하면 true, 실패하면 false를 리턴한다. + */ + public static boolean moveFile(String originalDirPath, String targetDirPath, String fromDate, String toDate) + throws Exception { + + // 인자값 유효하지 않은 경우 공백 리턴 + if (originalDirPath == null || originalDirPath.equals("") || targetDirPath == null || targetDirPath.equals("") + || fromDate == null || fromDate.equals("") || toDate == null + || toDate.equals("")) { + return false; + } + boolean result = false; + File f = null; + BufferedReader b_err = null; + BufferedReader b_out = null; + try { + f = new File(originalDirPath); + // 원본은 유효하고 대상이 신규로 생성가능한 상태인경우만 진행한다. + //if(f.exists() && f.isDirectory() ){ // 디렉토리만 이동할수 있도록 제한하는 경우 + if (f.exists()) { + // 타겟으로 설정한 경로가 유효한지 확인(중간경로에 파일명 이 포함되어있으면 유효하지 못하므로 진행안함. + File targetDir = new File(EgovWebUtil.filePathBlackList(targetDirPath)); + if (targetDir.exists()) { + // 타겟경로가 이미 있는 경우는 종료 + result = false; + } else { + // 새로 생성되는 경우만 진행한다. (이동쉘을 실행시킨다.) + boolean isInCondition = false; + String lastModifyedDate = getLastModifiedDateFromFile(f); + if (Integer.parseInt(lastModifyedDate) >= Integer.parseInt(fromDate) + && Integer.parseInt(lastModifyedDate) <= Integer.parseInt(toDate)) { + isInCondition = true; + } + + if (isInCondition) { + //KISA 보안약점 조치 (2018-10-29, 윤창원) + String cmdStr = EgovStringUtil.isNullToString(EgovProperties + .getProperty(Globals.SHELL_FILE_PATH, "SHELL." + Globals.OS_TYPE + ".moveDrctry")); + String[] command = {cmdStr.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR), + EgovWebUtil.filePathBlackList( + originalDirPath.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR)), + EgovWebUtil.filePathBlackList( + targetDirPath.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR))}; + Process p = Runtime.getRuntime().exec(command); + String access = ""; + p.waitFor(); + //프로세스 에러시 종료 + if (p != null && p.exitValue() != 0) { + b_err = new BufferedReader(new InputStreamReader(p.getErrorStream())); + while (b_err.ready()) { + //String line = b_err.readLine(); + //if (line.length() <= MAX_STR_LEN) log.debug("ERR\n" + line); + } + } + //프로세스 실행 성공시 결과 확인 + else { + result = false; + b_out = new BufferedReader(new InputStreamReader(p.getInputStream())); + while (b_out.ready()) { + if (!result) { // result != true + access = b_out.readLine(); + if (access != null && !"".equals(access) && access.length() <= MAX_STR_LEN) { + result = true; + break; + } + } + } + } + } + } + + } else { + // 원본자체가 유효하지 않은 경우는 false 리턴하고 종료 + result = false; + } + } finally { + EgovResourceCloseHelper.close(b_err, b_out); + ; + } + + return result; + } + + /** + *
    +	 * Comment : 디렉토리를 이동한다. (생성자 조건으로 이동)
    +	 * 
    + * + * @param String originalDirPath 원본 디렉토리 의 절대경로 + * @param String targetDirPath 타겟 디렉토리 의 절대경로 + * @param String owner 디렉토리의 이동조건생성자 + * @return boolean result 이동이 성공하면 true, 실패하면 false를 리턴한다. + */ + public static boolean moveFile(String originalDirPath, String targetDirPath, String owner) throws Exception { + + // 인자값 유효하지 않은 경우 공백 리턴 + if (originalDirPath == null || originalDirPath.equals("") || targetDirPath == null || targetDirPath.equals("") + || owner == null || owner.equals("")) { + return false; + } + //log.debug("originalDirPath:"+originalDirPath); + //log.debug("targetDirPath:"+targetDirPath); + boolean result = false; + File f = null; + BufferedReader b_err = null; + BufferedReader b_out = null; + try { + f = new File(originalDirPath); + // 원본은 유효하고 대상이 신규로 생성가능한 상태인경우만 진행한다. + //if(f.exists() && f.isDirectory() ){ // 디렉토리만 이동할수 있도록 제한하는 경우 + if (f.exists()) { + // 타겟으로 설정한 경로가 유효한지 확인(중간경로에 파일명 이 포함되어있으면 유효하지 못하므로 진행안함. + File targetDir = new File(EgovWebUtil.filePathBlackList(targetDirPath)); + if (targetDir.exists()) { + // 타겟경로가 이미 있는 경우는 종료 + result = false; + } else { + // 새로 생성되는 경우만 진행한다. (이동쉘을 실행시킨다.) + boolean isInCondition = false; + String realOwner = getOwner(originalDirPath); + if (realOwner != null && realOwner.equals(owner)) {//2022.01 Null pointers should not be dereferenced + isInCondition = true; + } + + if (isInCondition) { + //KISA 보안약점 조치 (2018-10-29, 윤창원) + String cmdStr = EgovStringUtil.isNullToString(EgovProperties + .getProperty(Globals.SHELL_FILE_PATH, "SHELL." + Globals.OS_TYPE + ".moveDrctry")); + String[] command = {cmdStr.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR), + EgovWebUtil.filePathBlackList( + originalDirPath.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR)), + EgovWebUtil.filePathBlackList( + targetDirPath.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR))}; + Process p = Runtime.getRuntime().exec(command); + String access = ""; + p.waitFor(); + //프로세스 에러시 종료 + if (p != null && p.exitValue() != 0) { + b_err = new BufferedReader(new InputStreamReader(p.getErrorStream())); + while (b_err.ready()) { + //String line = b_err.readLine(); + //if (line.length() <= MAX_STR_LEN) log.debug("ERR\n" + line); + } + } + //프로세스 실행 성공시 결과 확인 + else if (p != null) { + result = false; + b_out = new BufferedReader(new InputStreamReader(p.getInputStream())); + while (b_out.ready()) { + + if (!result) { //result != true + access = b_out.readLine(); + if (access != null && !"".equals(access) && access.length() <= MAX_STR_LEN) { + result = true; + if (result) { + break; + } + } + } + } + } + } + } + } else { + // 원본자체가 유효하지 않은 경우는 false 리턴하고 종료 + result = false; + } + } finally { + EgovResourceCloseHelper.close(b_err, b_out); + } + + return result; + } + + /** + *
    +	 * Comment : 디렉토리감시를 시작한다. 모니터링 시작시 해당 디렉토리의 이름으로 생성된 로그파일에 START기입하고 종료시END기입한다.
    +	 *           (로그파일이 이미 존재하는 경우는 모니터링이 현재 진행중인 상태이므로 새로 감시기능을 시작하지 않는다.)
    +	 * 
    + * + * @param String targetDirPath 타겟 디렉토리 의 절대경로 + * @param String logFile 모니터링정보를 보관할 로그파일경로 + * @param String eventPrg 이벤트 발생시 동작할 프로그램 + * @return boolean result 모니터링 시작 여부를 리턴한다. (모니터링 시작했으면 true, 모니터링이 시작되지 않았으면 false) + */ + public static boolean startDirectoryMonitering(String targetDirPath) throws Exception { + + // 인자값 유효하지 않은 경우 false 리턴 + if (targetDirPath == null || targetDirPath.equals("")) { + return false; + } + + boolean result = false; + FileReader fr = null; + BufferedReader br = null; + try { + // 로그파일을 생성한다. 만약 로그파일이 존재하면 이미 감시 프로세스가 동작중이므로 새로 시작하지 않는다. + + File targetF = new File(EgovWebUtil.filePathBlackList(targetDirPath)); + File logF = new File(EgovWebUtil.filePathBlackList(Globals.CONF_PATH) + "/" + targetF.getName() + ".log"); + + if (targetF.exists() && targetF.isDirectory()) { + + if (logF.exists()) { + // 이미 감시 프로세스 동작중임 + result = true; + //로그파일에서 중단여부 확인하여 중단된 상태이면 재실행함 + String lastStr = ""; + fr = new FileReader(logF); + br = new BufferedReader(fr); + //int ch = 0; + String line = ""; + while ((line = br.readLine()) != null) { + if (line.length() < MAX_STR_LEN) { + lastStr = line; + } + } + //log.debug("lastStr:"+lastStr); + if (lastStr.equals("END")) { + EgovFileMntrg t = new EgovFileMntrg(EgovWebUtil.filePathBlackList(targetDirPath), logF); + t.start(); + } + } else { + result = logF.createNewFile(); + EgovFileMntrg t = new EgovFileMntrg(targetDirPath, logF); + t.start(); + } + } + } finally { + EgovResourceCloseHelper.close(fr, br); + } + + return result; + } + + /** + *
    +	 * Comment : 디렉토리감시를 종료한다. 모니터링 시작시 해당 디렉토리의 이름으로 생성된 로그파일에 START기입하고 종료시END기입한다.
    +	 *           (로그파일이 존재하지 않는 경우는  모니터링이 아직 시작되지 않은 상태이므로별도로   종료하지 않는다.)
    +	 * 
    + * + * @param String targetDirPath 타겟 디렉토리 의 절대경로 + * @param String logFile 모니터링정보를 보관할 로그파일경로(감시프로세스 확인의 키값으로 사용된다) + * @return boolean result 모니터링 시작 여부를 리턴한다. (모니터링 시작했으면 true, 모니터링이 시작되지 않았으면 false) + */ + public static boolean stopDirectoryMonitering(String targetDirPath) throws Exception { + + // 인자값 유효하지 않은 경우 false 리턴 + if (targetDirPath == null || targetDirPath.equals("")) { + return false; + } + + boolean result = false; + FileReader fr = null; + BufferedReader br = null; + FileWriter fWriter = null; + BufferedWriter bWriter = null; + try { + File targetF = new File(EgovWebUtil.filePathBlackList(targetDirPath)); + File logF = new File(EgovWebUtil.filePathBlackList(Globals.CONF_PATH) + "/" + targetF.getName() + ".log"); + if (logF.exists()) { + + //로그파일 최종라인 확인 : END 여부 확인 + String lastStr = ""; + fr = new FileReader(logF); + br = new BufferedReader(fr); + //int ch = 0; + String line = ""; + while ((line = br.readLine()) != null) { + if (line.length() < MAX_STR_LEN) { + lastStr = line; + } + } + br.close(); + + // if(lastStr.equals("END")){ + // // 로그파일이 존재하고 이미 종료요청이 된 상태이므로 작업없음 + // //log.debug("Already Ending Requested Status"); + // }else{ + if (!lastStr.equals("END")) { + fWriter = new FileWriter(logF, true); + bWriter = new BufferedWriter(fWriter); + br = new BufferedReader(new StringReader("END")); + while ((line = br.readLine()) != null && !lastStr.equals("END")) { + if (line.length() < MAX_STR_LEN) { + bWriter.write(line + "\n", 0, line.length() + 1); + } + } + } + result = true; + } else { + result = false; + } + + } finally { + EgovResourceCloseHelper.close(fr, br, fWriter, bWriter); + } + + return result; + } + + /** + *
    +	 * Comment : 디렉토리감시정보를 로그파일로부터 읽어온다.
    +	 * 
    + * + * @param String targetDirPath 타겟 디렉토리 의 절대경로 + * @param String logFile 모니터링정보를 보관하는 로그파일경로 + * @return ArrayList result 로그파일의 정보를 라인단위로 담아서 리턴한다. + */ + public static StringBuffer getDirectoryMoniteringInfo(String targetDirPath) throws Exception { + + // 인자값 유효하지 않은 경우 빈 ArrayList 리턴 + if (targetDirPath == null || targetDirPath.equals("")) { + return new StringBuffer(); + } + + StringBuffer result = new StringBuffer(); + FileReader fr = null; + try { + File targetF = new File(EgovWebUtil.filePathBlackList(targetDirPath)); + File logF = new File(EgovWebUtil.filePathBlackList(Globals.CONF_PATH) + "/" + targetF.getName() + ".log"); + if (!logF.exists()) { + result = new StringBuffer(); + } + fr = new FileReader(logF); + int ch = 0; + while ((ch = fr.read()) != -1) { + result.append((char)ch); + } + } finally { + EgovResourceCloseHelper.close(fr); + } + + return result; + } + +} diff --git a/src/main/java/egovframework/com/utl/sim/service/EgovMenuGov.java b/src/main/java/egovframework/com/utl/sim/service/EgovMenuGov.java new file mode 100644 index 0000000..5307eac --- /dev/null +++ b/src/main/java/egovframework/com/utl/sim/service/EgovMenuGov.java @@ -0,0 +1,92 @@ +/** + * Class Name : EgovMenuGov.java + * Description : 메뉴관리 Business Interface class + * Modification Information + * + * 수정일 수정자 수정내용 + * ------- -------- --------------------------- + * 2009.02.02 이 용 최초 생성 + * + * @author 공통 서비스 개발팀 이 용 + * @since 2009. 02. 02 + * @version 1.0 + * @see + * + * Copyright (C) 2009 by EGOV All right reserved. + */ +package egovframework.com.utl.sim.service; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.util.List; +import java.util.Vector; + +import egovframework.com.cmm.util.EgovResourceCloseHelper; + +public class EgovMenuGov { + + // 파일구분자 + static final char FILE_SEPARATOR = File.separatorChar; + + /** + *
    +	 * Comment : DAT 파일을 파싱하여 메뉴관리화면에 리턴.
    +	 * 
    + * @param String parFile DAT파일명 + * @param String parChar 구분자 + * @param Int parField 필드수 + * @return Vector list + * @version 1.0 (2009.02.04.) + * @see + */ + public static Vector> parsFileByMenuChar(String parFile, String parChar, int parField) throws Exception { + Vector> list = null; + String FileName = null; + + FileName = parFile.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File file = new File(FileName); + + // 파일이며, 존재하면 파싱 시작 + if (file.exists() && file.isFile()) { + list = EgovFileTool.parsFileByChar(parFile, parChar, parField); + } else { + list = new Vector>(); + } + + return list; + } + + /** + *
    +	 * Comment : 메뉴관리 화면의 데이타를 DAT 파일로 생성.
    +	 * 
    + * @param String[] menuIDArray ID Array + * @param String[] menuNameArray Name Array + * @param String[] menuLevelArray Lefel Array + * @param String[] menuURLArray URL Array + * @return boolean true/false + * @version 1.0 (2009.02.04.) + * @see + */ + + public static boolean setDataByDATFile(String parFile, String[] menuIDArray, String[] menuNameArray, String[] menuLevelArray, String[] menuURLArray) throws Exception { + boolean success = false; + String FileName = null; + + FileName = parFile.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File file = new File(FileName); + BufferedWriter out = new BufferedWriter(new FileWriter(file)); + try { + + for (int i = 0; i < menuIDArray.length; i++) { //nodeId | parentNodeId | nodeName | nodeUrl + out.write(menuIDArray[i] + "|" + menuLevelArray[i] + "|" + menuNameArray[i] + "|" + menuURLArray[i] + "|"); + out.newLine(); + } + success = true; + } finally { + EgovResourceCloseHelper.close(out); + } + return success; + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/utl/sim/service/EgovNetInfo.java b/src/main/java/egovframework/com/utl/sim/service/EgovNetInfo.java new file mode 100644 index 0000000..f9e1f1e --- /dev/null +++ b/src/main/java/egovframework/com/utl/sim/service/EgovNetInfo.java @@ -0,0 +1,82 @@ +/** + * Class Name : ComUtlSimNetInfo.java + * Description : 시스템 네트워크 정보를 확인하여 제공하는 Business class + * Modification Information + * + * 수정일 수정자 수정내용 + * ------- -------- --------------------------- + * 2009.01.13 조재영 최초 생성 + * 2017.03.03 조성원 시큐어코딩(ES)-Null Pointer 역참조[CWE-476] + * + * @author 공통 서비스 개발팀 조재영 + * @since 2009. 01. 13 + * @version 1.0 + * @see + * + * Copyright (C) 2009 by EGOV All right reserved. + */ +package egovframework.com.utl.sim.service; + +import java.io.BufferedReader; +import java.io.InputStreamReader; + +import egovframework.com.cmm.service.EgovProperties; +import egovframework.com.cmm.service.Globals; +import egovframework.com.cmm.util.EgovResourceCloseHelper; + +public class EgovNetInfo { + // 최대 문자길이 + static final int MAX_STR_LEN = 1024; + + /** + *
    +	 * Comment : 호스트 정보를 확인한다.
    +	 * 
    + * @return String hostStr 호스트명을 리턴한다.(테스트용 함수) + * @version 1.0 (2009.01.12.) + * @see + */ + public static String getHostName() throws Exception { + // 실행할 명령을 프로퍼티 파일에서 확인한다. + String command = EgovProperties.getPathProperty(Globals.SHELL_FILE_PATH, + "SHELL." + Globals.OS_TYPE + ".getHostName"); + + // 출력할 결과 (파싱대상) + String hostStr = ""; + String tmp = ""; + BufferedReader b_err = null; + BufferedReader b_out = null; + try { + Process p = Runtime.getRuntime().exec(command); + //프로세스가 처리될때까지 대기 + p.waitFor(); + + //프로세스 에러시 종료 + if (p.exitValue() != 0) { + b_err = new BufferedReader(new InputStreamReader(p.getErrorStream())); + } + //프로세스 실행 성공시 결과 확인 + else { + b_out = new BufferedReader(new InputStreamReader(p.getInputStream())); + int i = 0; + while (b_out.ready()) { + //도스명령어 실행시 결과는 3번째 라인부터 출력됨.. + tmp = b_out.readLine(); + //2017.03.03 조성원 시큐어코딩(ES)-Null Pointer 역참조[CWE-476] + if (tmp != null) { + if (tmp.length() <= MAX_STR_LEN) { + if (i > 1) { + hostStr += tmp + "\n"; + } + i++; + } + } + } + // 시스템 로그 출력 + } + } finally { + EgovResourceCloseHelper.close(b_err, b_out); + } + return hostStr; + } +} diff --git a/src/main/java/egovframework/com/utl/sim/service/EgovNetworkState.java b/src/main/java/egovframework/com/utl/sim/service/EgovNetworkState.java new file mode 100644 index 0000000..6a7aa7c --- /dev/null +++ b/src/main/java/egovframework/com/utl/sim/service/EgovNetworkState.java @@ -0,0 +1,294 @@ +/** + * Class Name : EgovNetworkState.java + * Description : 네트워크(Network)상태 체크 Business Interface class + * Modification Information + * + * 수정일 수정자 수정내용 + * ------- -------- --------------------------- + * 2009.02.02 이 용 최초 생성 + * + * @author 공통 서비스 개발팀 이 용 + * @since 2009. 02. 02 + * @version 1.0 + * @see + * The type com.sun.star.lang.XeventListener cannot be resolved. It is indirectly referenced from required .class files + * Copyright (C) 2009 by EGOV All right reserved. + */ + +package egovframework.com.utl.sim.service; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.InetAddress; +import java.util.ArrayList; +import java.util.List; + +import egovframework.com.cmm.EgovWebUtil; +import egovframework.com.cmm.service.EgovProperties; +import egovframework.com.cmm.service.Globals; +import egovframework.com.cmm.util.EgovResourceCloseHelper; + +/** + * EgovNetworkState 클래스를 정의한다. + * + * @author 김진만 + * @see + *
    + * == 개정이력(Modification Information) ==
    + *
    + *  수정일                수정자           수정내용
    + *  ----------   --------   ---------------------------
    + *  2020.12.07   신용호            KISA 보안약점 조치
    + *  
    + * 
    + */ + +public class EgovNetworkState { + public static String addrIP = ""; + static final char FILE_SEPARATOR = File.separatorChar; + // 최대 문자길이 + static final int MAX_STR_LEN = 1024; + + public static final int BUFF_SIZE = 2048; + // Log + // protected static final Log log = LogFactory.getLog(EgovNetworkState.class); + + /** + *
    +	 * Comment : Local MAC Address를 확인한다.
    +	 * 
    + * @param String localIP 로컬 IP주소 + * @return String mac MAC Address를 리턴한다. + * @version 1.0 (2009.02.03.) + * @see + */ + public static String getMyMACAddress(String localIP) { + //log.debug("getMyMACAddress Start!! : "); + String mac = null; + try { + if ("WINDOWS".equals(Globals.OS_TYPE)) { + // 2020-12-07 KISA 보안코드 검증 조치 + if (!EgovWebUtil.isIPAddress(localIP)) + throw new SecurityException("IP Address is Not Valid~~~!"); + + Process p = null; + Runtime rt = Runtime.getRuntime(); + String[] execStr = { "nbtstat", "-A", localIP }; + p = rt.exec(execStr); // 여기다 아이피 주소 넣주세여 + + InputStream in = p.getInputStream(); + String out = null; + int c; + while ((c = in.read()) != -1) { + out = out + new String(new Character((char) c).toString()); + } + in.close(); + if (out == null || out.indexOf("MAC Address = ") == -1) { + throw new IllegalArgumentException("String Split Error!"); + } + mac = out.substring(out.indexOf("MAC Address = ") + 14, out.indexOf("MAC Address = ") + 31); + + } else if ("UNIX".equals(Globals.OS_TYPE)) { + //log.debug("getMyMACAddress IP : " + localIP); + mac = getNetWorkInfo("MAC"); + } + } catch (IOException e) { + throw new RuntimeException(e); + } + return mac; + } + + /** + *
    +	 * Comment : Local Port를 확인한다.
    +	 * 
    + + * @return String port port를 리턴한다. + * @version 1.0 (2009.02.03.) + * @see + */ + public static List getMyPortScan() { + + List processes = new ArrayList(); + BufferedReader input = null; + + try { + + Process p = null; + Runtime rt = Runtime.getRuntime(); + if ("WINDOWS".equals(Globals.OS_TYPE)) { + String[] execStr = { "netstat", "-an" }; + p = rt.exec(execStr); + input = new BufferedReader(new InputStreamReader(p.getInputStream())); + + while (true) { + String str = input.readLine(); + if (str == null) + break; + if (str.length() >= MAX_STR_LEN) { + throw new RuntimeException("input too long"); + } + if (!str.trim().equals("")) { + processes.add(str); + } + } + } else if ("UNIX".equals(Globals.OS_TYPE)) { + String cmdStr = EgovProperties.getPathProperty(Globals.SERVER_CONF_PATH, "SHELL." + Globals.OS_TYPE + ".getNetWorkInfo"); + String[] command = { cmdStr.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR), "SCAN" }; + p = Runtime.getRuntime().exec(command); + p = rt.exec(command); + + input = new BufferedReader(new InputStreamReader(p.getInputStream())); + while (true) { + String str = input.readLine(); + if (str == null) + break; + if (str.length() >= MAX_STR_LEN) { + throw new RuntimeException("input too long"); + } + if (!str.trim().equals("")) { + processes.add(str); + } + } + //log.debug("getMyPortScan 6"); + } + } catch (IOException e) { + throw new RuntimeException("IO Exception", e); + } finally { + EgovResourceCloseHelper.close(input); + } + + return processes; + } + + /** + *
    +	 * Comment : Local IPAddress를 확인한다.
    +	 * 
    + * @return String mac Local IPAddress를 리턴한다. + * @version 1.0 (2009.02.03.) + * @see + */ + public static String getMyIPaddress() { + try { + + if (!EgovWebUtil.isIPAddress(InetAddress.getLocalHost().getHostAddress())) { + throw new RuntimeException("IP is needed. (" + InetAddress.getLocalHost().getHostAddress() + ")"); + } + + InetAddress InetA = InetAddress.getLocalHost(); + addrIP = InetA.getHostAddress(); + + } catch (IOException ex) { + throw new RuntimeException(ex); + } + + return addrIP; + } + + /** + *
    +	 * Comment : 네트워크 상태체크를 확인한다.
    +	 * 
    + * @param String localIP localhost, gateway, host 주소 + * @return boolean status true/false 를 리턴한다. + * @version 1.0 (2009.02.03.) + * @see + */ + public static boolean getPingTest(String requestIP) throws Exception { + + boolean status = false; + + if (!EgovWebUtil.isIPAddress(requestIP)) { + throw new RuntimeException("IP is needed. (" + requestIP + ")"); + } + + status = InetAddress.getByName(requestIP).isReachable(3000); + + return status; + } + + /** + *
    +	 * Comment : 네트워크(MAC,IP,S/M,G/W,DNS) 정보를 확인한다.
    +	 * 
    + * @param String stringOne 확인할 네트웍 정보 표기 ( ex:"MAC","IP","S/M","G/W","DNS") + * @return String (MAC,IP,S/M,G/W,DNS) 정보를 리턴한다. + * @version 1.0 (2009.02.07.) + * @see + */ + public static String getNetWorkInfo(String stringOne) throws IOException { + // 실행할 명령을 프로퍼티 파일에서 확인한다. + Process p = null; + + BufferedReader b_out = null; + + String tmp = ""; + String outValue = ""; + try { + String cmdStr = EgovProperties.getPathProperty(Globals.SERVER_CONF_PATH, "SHELL." + Globals.OS_TYPE + ".getNetWorkInfo"); + String[] command = { cmdStr.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR), stringOne }; + p = Runtime.getRuntime().exec(command); + b_out = new BufferedReader(new InputStreamReader(p.getInputStream())); + while (true) { + tmp = b_out.readLine(); + if (tmp == null) + break; + if (tmp.length() >= MAX_STR_LEN) { + throw new IllegalArgumentException("input too long"); + } + // netstat -v ent0 | grep "하드웨어 주소" -MAC + // prtconf | grep "IP 주소" -IP + // prtconf | grep "서브넷 마스크" -SM + // prtconf | grep "게이트웨이" -GW + if ("MAC".equals(stringOne)) { + outValue = getCharFilter(tmp); + } else if ("IP".equals(stringOne)) { + outValue = getCharFilter(tmp); + } else if ("SM".equals(stringOne)) { + outValue = getCharFilter(tmp); + } else if ("GW".equals(stringOne)) { + outValue = getCharFilter(tmp); + } else if ("DNS".equals(stringOne)) { + //tmp = "was은(는) 192.168.200.21입니다"; + outValue = getCharFilter(tmp); + } else { + outValue = "데이타가 존재하지 않습니다."; + } + } + } finally { + EgovResourceCloseHelper.close(b_out); + + if (p != null) { + p.destroy(); + } + } + return outValue; + } + + /** + *
    +	 * Comment : String 타입의 str값 중 숫자 정보만 필터링, 담아서 리턴.
    +	 * 
    + * @param String str 필터링 대상 정보 + * @return String outValue 숫자 정보를 필터링 리턴한다. + * @version 1.0 (2009.02.07.) + * @see + */ + private static String getCharFilter(String str) { + String outValue = ""; + + for (int i = 0; i < str.length(); i++) { + char c = str.charAt(i); + + if (c > 45 && c < 59) { + Character cr = new Character(c); + outValue += cr.toString(); + } + } + return outValue; + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/utl/sim/service/EgovPdfCnvr.java b/src/main/java/egovframework/com/utl/sim/service/EgovPdfCnvr.java new file mode 100644 index 0000000..c322f94 --- /dev/null +++ b/src/main/java/egovframework/com/utl/sim/service/EgovPdfCnvr.java @@ -0,0 +1,170 @@ +/** + * Class Name : EgovPdfCnvr.java + * Description : xls,doc,ppt를 Pdf로 변환하는 화면 Business Interface class + * Modification Information + * + * 수정일 수정자 수정내용 + * ------- -------- --------------------------- + * 2009.02.02 이 용 최초 생성 + * 2017.03.03 조성원 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + * + * @author 공통 서비스 개발팀 이 용 + * @since 2009. 02. 02 + * @version 1.0 + * @see + * The type com.sun.star.lang.XeventListener cannot be resolved. It is indirectly referenced from required .class files + * Copyright (C) 2009 by EGOV All right reserved. + */ + +package egovframework.com.utl.sim.service; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Iterator; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.util.WebUtils; + +import com.artofsolving.jodconverter.DocumentConverter; +import com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection; +import com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter; + +import egovframework.com.cmm.EgovWebUtil; +import egovframework.com.cmm.service.EgovProperties; +import egovframework.com.cmm.util.EgovBasicLogger; +import egovframework.com.cmm.util.EgovResourceCloseHelper; +import egovframework.com.utl.fcc.service.EgovStringUtil; + +public class EgovPdfCnvr { + public static String addrIP = ""; + static final char FILE_SEPARATOR = File.separatorChar; + // 최대 문자길이 + static final int MAX_STR_LEN = 1024; + + public static final int BUFF_SIZE = 2048; + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovPdfCnvr.class); + + /** + *
    +	 * Comment : doc, xls 파일등을 PDF변환 변환한다. .
    +	 * 
    + * @param String pdfFileSrc doc, xls 파일 전체경로 + * @param String targetPdf 변환파일명(확장자 제외) + * @return boolean status true/false 를 리턴한다. + * @version 1.0 (2009.02.10) + * @see + */ + public static boolean getPDF(String targetPdf, HttpServletRequest request, HttpServletResponse response) throws Exception { + boolean status = false; + + try { + //MultipartHttpServletRequest mptRequest = (MultipartHttpServletRequest) request; + MultipartHttpServletRequest mptRequest = WebUtils.getNativeRequest(request,MultipartHttpServletRequest.class); + if(mptRequest!= null) { //2022.01 Possible null pointer dereference due to return value of called method 조치 + Iterator file_iter = mptRequest.getFileNames(); + + while (file_iter.hasNext()) { + MultipartFile mFile = mptRequest.getFile(file_iter.next()); + + if (mFile.getSize() > 0) { + + //Write File 이후 Move File???? + String newName = ""; + String stordFilePath = EgovProperties.getProperty("Globals.fileStorePath"); + + //String orginFileName = mFile.getOriginalFilename(); + //int index = orginFileName.lastIndexOf("."); + //String fileExt = orginFileName.substring(index + 1); + + //newName 은 Naming Convention에 의해서 생성 + newName = EgovStringUtil.getTimeStamp(); + writeFile(mFile, newName, stordFilePath); + + String pdfFileSrcValue = stordFilePath.replace('\\', FILE_SEPARATOR).replace('/', + FILE_SEPARATOR); + File inputFile = new File(EgovWebUtil.filePathBlackList(pdfFileSrcValue + newName)); + + if (inputFile.exists()) { + // connect to an OpenOffice.org instance running on port 8100 + SocketOpenOfficeConnection connection = new SocketOpenOfficeConnection(8100); + connection.connect(); + //원본 디렉토리에 targetPdf 명칭지정 + String valueFile = null; + //KISA 보안약점 조치 (2018-10-29, 윤창원) + valueFile = EgovStringUtil.isNullToString(inputFile.getParent()) + .replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File outputFile = new File(valueFile + "/" + targetPdf + ".pdf"); + // convert + DocumentConverter converter = new OpenOfficeDocumentConverter(connection); + converter.convert(inputFile, outputFile); + // close the connection + connection.disconnect(); + + if (inputFile.exists()) { + //3. 삭제해줍니다. + status = inputFile.delete(); + } + status = true; + } else { + status = false; + } + } + } + + } + } catch (IOException ex) { + EgovBasicLogger.debug("PDF converting error", ex); + + status = false; + } + // 메소드 종료 Log + return status; + } + + /** + * 파일을 실제 물리적인 경로에 생성한다. + * @param file + * @param newName + * @param stordFilePath + * @throws Exception + */ + protected static void writeFile(MultipartFile file, String newName, String stordFilePath) throws IOException { + InputStream stream = null; + OutputStream bos = null; + + try { + stream = file.getInputStream(); + File cFile = new File(EgovWebUtil.filePathBlackList(stordFilePath)); + + if (!cFile.isDirectory()) { + //2017.03.03 조성원 시큐어코딩(ES)-부적절한 예외 처리[CWE-253, CWE-440, CWE-754] + if(cFile.mkdirs()){ + LOGGER.debug("[file.mkdirs] targetDir : Directory Creation Success"); + }else{ + LOGGER.error("[file.mkdirs] targetDir : Directory Creation Fail"); + } + } + bos = new FileOutputStream(EgovWebUtil.filePathBlackList(stordFilePath + File.separator + newName)); + + int bytesRead = 0; + byte[] buffer = new byte[BUFF_SIZE]; + + while ((bytesRead = stream.read(buffer, 0, BUFF_SIZE)) != -1) { + bos.write(buffer, 0, bytesRead); + } + + } finally { + EgovResourceCloseHelper.close(bos, stream); + } + } +} \ No newline at end of file diff --git a/src/main/java/egovframework/com/utl/sim/service/EgovXMLDoc.java b/src/main/java/egovframework/com/utl/sim/service/EgovXMLDoc.java new file mode 100644 index 0000000..61685b5 --- /dev/null +++ b/src/main/java/egovframework/com/utl/sim/service/EgovXMLDoc.java @@ -0,0 +1,337 @@ +/** + * Class Name : EgovXMLDoc.java + * Description : XML파일을 파싱하여 구조체 형태로 반환 또는 구조체 형태의 데이터를 XML파일로 저장하는 Business Interface class + * Modification Information + * + * 수정일 수정자 수정내용 + * ------- -------- --------------------------- + * 2009.02.03 박지욱 최초 생성 + * + * @author 공통 서비스 개발팀 박지욱 + * @since 2009. 02. 03 + * @version 1.0 + * @see + * + * Copyright (C) 2009 by MOPAS All right reserved. + */ +package egovframework.com.utl.sim.service; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InputStreamReader; + +import egovframework.com.cmm.EgovWebUtil; +import egovframework.com.cmm.service.EgovProperties; +import egovframework.com.cmm.service.Globals; +import egovframework.com.cmm.util.EgovResourceCloseHelper; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import noNamespace.SndngMailDocument; + +import org.apache.xmlbeans.XmlOptions; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.Text; + +public class EgovXMLDoc { + + // 파일구분자 + static final char FILE_SEPARATOR = File.separatorChar; + + // 최대 문자길이 + static final int MAX_STR_LEN = 1024; + + // Log + //protected static final Log log = LogFactory.getLog(EgovXMLDoc.class); + /** + * XML스키마를 자바클래스(임의)로 생성 + * @param String xml XML스키마 + * @param String ja 생성될JAR파일의 위치 + * @return boolean result 생성여부 True/False + * @exception Exception + */ + public static boolean creatSchemaToClass(String xml, String ja) throws Exception { + + boolean result = false; + + // 1. 스키마가 없으면 에러 + String file = xml.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File xmlFile = new File(file); + if (!xmlFile.exists() || !xmlFile.isFile()) { + //log.debug("+++ 지정된 위치에 스키마 파일이 없습니다."); + return false; + } + + // 2. 동일한 jar파일이 이미 존재하면 에러 + String jar = ja.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File jarFile = new File(jar); + if (jarFile.exists()) { + //log.debug("+++ 동일한 JAR 파일이 존재합니다."); + return false; + } + + // 3. scomp -src [소스생성위치] [xsd파일] : 입력받은 스키마를 컴파일하여 JAVA 소스파일로 생성 + Process p = null; + BufferedReader b_err = null; + String cmdStr = EgovProperties.getPathProperty(Globals.SHELL_FILE_PATH, "SHELL." + Globals.OS_TYPE + ".compileSchema"); + String[] command = { cmdStr.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR), jar, file }; + + try { + p = Runtime.getRuntime().exec(command); + //프로세스가 처리될때까지 대기 + p.waitFor(); + + //프로세스 에러시 종료 + if (p.exitValue() != 0) { + b_err = new BufferedReader(new InputStreamReader(p.getErrorStream())); + while (b_err.ready()) { + //String line = b_err.readLine(); + //if (line.length() <= MAX_STR_LEN) log.debug("ERR\n" + line); + } + b_err.close(); + } + //프로세스 실행 성공시 결과 확인 + else { + result = true; + } + } finally { + EgovResourceCloseHelper.close(b_err); + + if (p != null) { + p.destroy(); + } + } + return result; + } + + /** + * XML파일을 파싱하여 메일발송 클래스(임의)에 내용을 담아 반환 + * @param String file XML파일 + * @return SndngMailDocument mailDoc 메일발송 클래스(XML스키마를 통해 생성된 자바클래스) + * @exception Exception + */ + public static SndngMailDocument getXMLToClass(String file) throws Exception { + + File xmlFile = null; + FileInputStream fis = null; + SndngMailDocument mailDoc = null; + try { + String file1 = file.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + xmlFile = new File(EgovWebUtil.filePathBlackList(file1)); + if (xmlFile.exists() && xmlFile.isFile()) { + fis = new FileInputStream(xmlFile); + mailDoc = SndngMailDocument.Factory.parse(xmlFile); + + } + } finally { + EgovResourceCloseHelper.close(fis); + } + + return mailDoc; + } + + /** + * XML데이터를 XML파일로 저장 + * @param UserinfoDocument userDoc 사용자 임의 클래스(XML스키마를 통해 생성된 자바클래스) + * @param String fiile 저장될 파일 + * @return boolean 저장여부 True / False + * @exception Exception + */ + public static boolean getClassToXML(SndngMailDocument mailDoc, String file) throws Exception { + + boolean result = false; + + FileOutputStream fos = null; + + try { + + String file1 = file.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + file1 = EgovFileTool.createNewFile(file1); + File xmlFile = new File(EgovWebUtil.filePathBlackList(file1)); + fos = new FileOutputStream(xmlFile); + + XmlOptions xmlOptions = new XmlOptions(); + xmlOptions.setSavePrettyPrint(); + xmlOptions.setSavePrettyPrintIndent(4); + xmlOptions.setCharacterEncoding("UTF-8"); + String xmlStr = mailDoc.xmlText(xmlOptions); + + fos.write(xmlStr.getBytes("UTF-8")); + result = true; + + } finally { + EgovResourceCloseHelper.close(fos); + } + + return result; + } + + /** + * XML 파일을 파싱하여 데이터를 조작할 수 있는 Document 객체를 반환 + * @param String file XML파일 + * @return Document document 문서객체 + * @exception Exception + */ + public static Document getXMLDocument(String xml) throws Exception { + + Document xmlDoc = null; + + String file = xml.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File srcFile = new File(file); + FileInputStream fis = null; + try { + if (srcFile.exists() && srcFile.isFile()) { + + fis = new FileInputStream(srcFile); + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder builder = null; + factory.setValidating(true); + builder = factory.newDocumentBuilder(); + xmlDoc = builder.parse(fis); + } + } finally { + EgovResourceCloseHelper.close(fis); + } + + return xmlDoc; + } + + /** + * Document의 최상의 Element로 이동 + * @param Document document XML데이터 + * @return Element root 루트 + * @exception Exception + */ + public static Element getRootElement(Document document) throws Exception { + + Element root = document.getDocumentElement(); + return root; + } + + /** + * 하위에 새로운 Elemenet를 생성 + * @param Document document XML데이터 + * @prarm Element rt 추가될위치 + * @param id 생성될 Element의 ID + * @return Element element 추가된 Element + * @exception Exception + */ + public static Element insertElement(Document document, Element rt, String id) throws Exception { + + Element child = null; + Element root = null; + + if (rt == null) { + root = getRootElement(document); + } else { + root = rt; + } + child = document.createElement(id); + root.appendChild(child); + + return child; + } + + /** + * 하위에 문자열을 가지는 새로운 Elemenet를 생성 + * @param Document document XML데이터 + * @prarm Element rt 추가 위치 + * @param id 생성될 Element의 ID + * @param text Element 하위에 들어갈 문자열 + * @return Element element 추가된 Element + * @exception Exception + */ + public static Element insertElement(Document document, Element rt, String id, String text) throws Exception { + + Element echild = null; + Text tchild = null; + Element root = null; + + if (rt == null) { + root = getRootElement(document); + } else { + root = rt; + } + echild = document.createElement(id); + root.appendChild(echild); + tchild = document.createTextNode(text); + echild.appendChild(tchild); + + return echild; + } + + /** + * 하위에 문자열을 추가 + * @param Document document XML데이터 + * @prarm Element rt 추가 위치 + * @param id 생성될 Element의 ID + * @param text Element 하위에 들어갈 문자열 + * @return Element element 추가된 Element + * @exception Exception + */ + public static Text insertText(Document document, Element rt, String text) throws Exception { + + Text tchild = null; + Element root = null; + + if (rt == null) { + root = getRootElement(document); + } else { + root = rt; + } + tchild = document.createTextNode(text); + root.appendChild(tchild); + + return tchild; + } + + /** + * 마지막으로 입력되었거나 참조된 XML Node의 상위 Element를 리턴 + * @prarm Element current 현재노드 + * @return Element parent 상위노드 + * @exception Exception + */ + public static Element getParentNode(Element current) throws Exception { + + Node parent = current.getParentNode(); + return (Element) parent; + } + + /** + * Document 객체를 XML파일로 저장 + * @param Document document 문서객체 + * @param String fiile 저장될 파일 + * @return boolean 저장여부 True / False + * @exception Exception + */ + public static boolean getXMLFile(Document document, String file) throws Exception { + + boolean retVal = false; + + String file1 = file.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File srcFile = new File(file1); + if (srcFile.exists() && srcFile.isFile()) { + + Source source = new DOMSource(document); + Result result = new StreamResult(srcFile); + Transformer transformer = TransformerFactory.newInstance().newTransformer(); + transformer.setOutputProperty(OutputKeys.METHOD, "xml"); + transformer.setOutputProperty(OutputKeys.INDENT, "yes"); + transformer.transform(source, result); + } + + return retVal; + } +} diff --git a/src/main/java/egovframework/com/utl/wed/filter/CkFilter.java b/src/main/java/egovframework/com/utl/wed/filter/CkFilter.java new file mode 100644 index 0000000..feb7d94 --- /dev/null +++ b/src/main/java/egovframework/com/utl/wed/filter/CkFilter.java @@ -0,0 +1,113 @@ +/* + * CKEditor image upload module for Java. + * Copyright guavatak (https://github.com/guavatak/ckeditor-upload-filter-java) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @author guavatak (https://github.com/guavatak/ckeditor-upload-filter-java) + */ +package egovframework.com.utl.wed.filter; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Filter class + * @author guavatak + * @since 2014.12.04 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *  수정일              수정자              수정내용
    + *  ----------  --------    ---------------------------
    + *  2014.12.04	표준프레임워크	최초 적용 (패키지 변경 및 소스 정리)
    + *  2018.12.28	신용호             CkImageSaver 수정
    + * 
    + */ +public class CkFilter implements Filter { + private static final Log log = LogFactory.getLog(CkFilter.class); + + private static final String IMAGE_BASE_DIR_KEY = "ck.image.dir"; + private static final String IMAGE_BASE_URL_KEY = "ck.image.url"; + private static final String IMAGE_ALLOW_TYPE_KEY = "ck.image.type.allow"; + private static final String IMAGE_SAVE_CLASS_KEY = "ck.image.save.class"; + + private CkImageSaver ckImageSaver; + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + String properties = filterConfig.getInitParameter("properties"); + InputStream inStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(properties); + Properties props = new Properties(); + try { + props.load(inStream); + } catch (IOException e) { + log.error(e); + } finally { //KISA 보안약점 조치 (2018-10-29, 윤창원) + try { + inStream.close(); + } catch (IOException e) { + log.error(e); + } + } + + String imageBaseDir = (String)props.get(IMAGE_BASE_DIR_KEY); + String imageDomain = (String)props.get(IMAGE_BASE_URL_KEY); + String saveManagerClass = (String)props.get(IMAGE_SAVE_CLASS_KEY); + String allowFileType = (String)props.get(IMAGE_ALLOW_TYPE_KEY); + + ckImageSaver = new CkImageSaver( + imageBaseDir, + imageDomain, + StringUtils.isNotBlank(allowFileType) ? StringUtils.split(allowFileType, ",") : new String[] {""}, + saveManagerClass);//2022.01. Method call passes null for non-null parameter 처리 + + } + + @Override + public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) + throws IOException, ServletException { + HttpServletRequest request = (HttpServletRequest)req; + HttpServletResponse response = (HttpServletResponse)res; + + if (request.getContentType() == null || request.getContentType().indexOf("multipart") == -1) { + // contentType 이 multipart 가 아니라면 스킵한다. + chain.doFilter(request, response); + } else { + ckImageSaver.saveAndReturnUrlToClient(request, response); + + } + } + + @Override + public void destroy() { + // no-op + } +} diff --git a/src/main/java/egovframework/com/utl/wed/filter/CkImageSaver.java b/src/main/java/egovframework/com/utl/wed/filter/CkImageSaver.java new file mode 100644 index 0000000..310ebc2 --- /dev/null +++ b/src/main/java/egovframework/com/utl/wed/filter/CkImageSaver.java @@ -0,0 +1,211 @@ +/* + * CKEditor image upload module for Java. + * Copyright guavatak (https://github.com/guavatak/ckeditor-upload-filter-java) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @author guavatak (https://github.com/guavatak/ckeditor-upload-filter-java) + */ +package egovframework.com.utl.wed.filter; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.fileupload.FileItem; +import org.apache.commons.fileupload.FileItemFactory; +import org.apache.commons.fileupload.FileUploadException; +import org.apache.commons.fileupload.disk.DiskFileItemFactory; +import org.apache.commons.fileupload.servlet.ServletFileUpload; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.context.support.WebApplicationContextUtils; + +import egovframework.com.cmm.EgovWebUtil; +import egovframework.com.cmm.service.EgovProperties; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.fdl.cryptography.EgovEnvCryptoService; + +/** + * Created by guava on 1/20/14. + * 이미지 저장 처리 클래스 + * @author guavatak + * @since 2014.12.04 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *  수정일               수정자                  수정내용
    + *  ----------   -----------   ---------------------------
    + *  2014.12.04   표준프레임워크       최초 적용 (패키지 변경 및 소스 정리)
    + *  2016.04.21   장동한                 공통컴포넌트 V3.6 수정
    + *  2018.12.11   신용호                 KISA 보안취약점 등 수정
    + *  2018.12.28   신용호                 업로드 이미지 URL 생성 부분 수정
    + *  2020-08-28   신용호                 보안약점 조치 (Private 배열에 Public 데이터 할당[CWE-496])
    + *  
    + * 
    + */ +public class CkImageSaver { + private static final Log log = LogFactory.getLog(CkFilter.class); + + private static final String FUNC_NO = "CKEditorFuncNum"; + + private String imageBaseDir; + private String imageDomain; + private String[] allowFileTypeArr; + + private String fileStorePath = EgovProperties.getProperty("Globals.fileStorePath"); + + private FileSaveManager fileSaveManager; + + public CkImageSaver(String imageBaseDir, String imageDomain, String[] allowFileTypeArr, String saveManagerClass) { + this.imageBaseDir = EgovWebUtil.filePathBlackList(imageBaseDir); + + if ((EgovStringUtil.isNullToString(imageBaseDir)).endsWith("/")) { + StringUtils.removeEnd(imageBaseDir, "/"); + } + if ((EgovStringUtil.isNullToString(imageBaseDir)).endsWith("\\")) { + StringUtils.removeEnd(imageBaseDir, "\\"); + } + + this.imageDomain = EgovWebUtil.filePathBlackList(imageDomain); + if ((EgovStringUtil.isNullToString(imageDomain)).endsWith("/")) { + StringUtils.removeEnd(imageDomain, "/"); + } + + this.allowFileTypeArr = allowFileTypeArr.clone(); + + if (StringUtils.isBlank(saveManagerClass)) { + fileSaveManager = new DefaultFileSaveManager(); + } else { + try { + Class klass = Class.forName(saveManagerClass); + fileSaveManager = (FileSaveManager) klass.newInstance(); + } catch (ClassNotFoundException e) { + log.error(e); + throw new RuntimeException(e); + } catch (InstantiationException e) { + log.error(e); + throw new RuntimeException(e); + } catch (IllegalAccessException e) { + log.error(e); + throw new RuntimeException(e); + } + } + } + + public void saveAndReturnUrlToClient(HttpServletRequest request, HttpServletResponse response) throws IOException { + // Parse the request + try { + FileItemFactory factory = new DiskFileItemFactory(); + + // Create a new file upload handler + ServletFileUpload upload = new ServletFileUpload(factory); + + List /* FileItem */items = upload.parseRequest(request); + // We upload just one file at the same time + FileItem uplFile = items.get(0); + + String errorMessage = null; + String relUrl = null; + + if (isAllowFileType(FilenameUtils.getName(uplFile.getName()))) { + String uploadFilePath = fileSaveManager.saveFile(uplFile, fileStorePath+imageBaseDir); + //System.out.println("===>>> uploadFilePath = "+uploadFilePath); + + String fileName = uploadFilePath.substring(uploadFilePath.lastIndexOf('/') + 1); + String filePath = imageBaseDir+uploadFilePath.substring(0,uploadFilePath.lastIndexOf('/')); + + relUrl = request.getContextPath() + + "/utl/web/imageSrc.do?" + + "path=" + this.encrypt(filePath,request) + + "&physical=" + this.encrypt(fileName,request) + + "&contentType=" + this.encrypt(uplFile.getContentType(),request); + + //System.out.println("===>>> relUrl = "+relUrl); + } else { + errorMessage = "Restricted Image Format"; + } + + StringBuffer sb = new StringBuffer(); + sb.append(""); + + response.setContentType("text/html"); + response.setHeader("Cache-Control", "no-cache"); + PrintWriter out = response.getWriter(); + + out.print(sb.toString()); + out.flush(); + out.close(); + + } catch (FileUploadException e) { + log.error(e); + } + } + + protected boolean isAllowFileType(String fileName) { + boolean isAllow = false; + if (allowFileTypeArr != null && allowFileTypeArr.length > 0) { + for (String allowFileType : allowFileTypeArr) { + if (StringUtils.equalsIgnoreCase(allowFileType, StringUtils.substringAfterLast(fileName, "."))) { + isAllow = true; + break; + } + } + } else { + isAllow = true; + } + + return isAllow; + } + + /** + * 암호화 + * + * @param encrypt + */ + private String encrypt(String encrypt,HttpServletRequest request) { + + WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(request.getServletContext()); + EgovEnvCryptoService cryptoService = (EgovEnvCryptoService)wac.getBean("egovEnvCryptoService"); + + try { + return cryptoService.encrypt(encrypt); + } catch(IllegalArgumentException e) { + log.error("[IllegalArgumentException] Try/Catch...usingParameters Runing : "+ e.getMessage()); + } catch (Exception e) { + log.error("[" + e.getClass() +"] :" + e.getMessage()); + } + return encrypt; + } + +} diff --git a/src/main/java/egovframework/com/utl/wed/filter/DefaultFileSaveManager.java b/src/main/java/egovframework/com/utl/wed/filter/DefaultFileSaveManager.java new file mode 100644 index 0000000..fa4a022 --- /dev/null +++ b/src/main/java/egovframework/com/utl/wed/filter/DefaultFileSaveManager.java @@ -0,0 +1,78 @@ +/* + * CKEditor image upload module for Java. + * Copyright guavatak (https://github.com/guavatak/ckeditor-upload-filter-java) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @author guavatak (https://github.com/guavatak/ckeditor-upload-filter-java) + */ +package egovframework.com.utl.wed.filter; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.fileupload.FileItem; +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.lang3.RandomStringUtils; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import egovframework.com.cmm.service.EgovProperties; + +/** + * Created by guava on 1/20/14. + * 이미지 저장 처리 클래스 + * @author guavatak + * @since 2014.12.04 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *  수정일              수정자             수정내용
    + *  ----------  --------    ---------------------------
    + *  2014.12.04	표준프레임워크	최초 적용 (패키지 변경 및 소스 정리)
    + *  2018.12.28	신용호             saveFile() 파라미터 수정
    + * 
    + */ +public class DefaultFileSaveManager implements FileSaveManager { + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovProperties.class); + + @Override + public String saveFile(FileItem fileItem, String imageBaseDir) { + String originalFileName = FilenameUtils.getName(fileItem.getName()); + String relUrl; + // filename + String subDir = File.separator + DirectoryPathManager.getDirectoryPathByDateType(DirectoryPathManager.DIR_DATE_TYPE.DATE_POLICY_YYYY_MM); + String fileName = RandomStringUtils.randomAlphanumeric(20) + "." + StringUtils.lowerCase(StringUtils.substringAfterLast(originalFileName, ".")); + + File newFile = new File(imageBaseDir + subDir + fileName); + File fileToSave = DirectoryPathManager.getUniqueFile(newFile.getAbsoluteFile()); + + try { + FileUtils.writeByteArrayToFile(fileToSave, fileItem.get()); + } catch (IOException e) { + //KISA 보안약점 조치 (2018-10-29, 윤창원) + LOGGER.debug("File IO exception" + e.getMessage()); + } + + String savedFileName = FilenameUtils.getName(fileToSave.getAbsolutePath()); + relUrl = StringUtils.replace(subDir, "\\", "/") + savedFileName; + + return relUrl; + } +} diff --git a/src/main/java/egovframework/com/utl/wed/filter/DirectoryPathManager.java b/src/main/java/egovframework/com/utl/wed/filter/DirectoryPathManager.java new file mode 100644 index 0000000..3d9d1ad --- /dev/null +++ b/src/main/java/egovframework/com/utl/wed/filter/DirectoryPathManager.java @@ -0,0 +1,86 @@ +/* + * CKEditor image upload module for Java. + * Copyright guavatak (https://github.com/guavatak/ckeditor-upload-filter-java) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @author guavatak (https://github.com/guavatak/ckeditor-upload-filter-java) + */ +package egovframework.com.utl.wed.filter; + +import java.io.File; +import java.util.Calendar; + +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.lang3.StringUtils; + +import com.sun.star.auth.InvalidArgumentException; + +/** + * 이미지 저장 처리 클래스 + * @author guavatak + * @since 2014.12.04 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *  수정일              수정자             수정내용
    + *  ----------  --------    ---------------------------
    + *  2014.12.04  표준프레임워크   최초 적용 (패키지 변경 및 소스 정리)
    + *  2018.12.28  신용호             getDirectoryPathByDateType() Month의 범위를 1~12가 되도록 수정
    + * 
    + */ +public class DirectoryPathManager { + public enum DIR_DATE_TYPE { + DATE_POLICY_YYYY_MM_DD, DATE_POLICY_YYYY_MM, DATE_POLICY_YYYY + }; + + /** + * 2012/12/22/ + * @param dateType + * @return + * @throws InvalidArgumentException + */ + public static String getDirectoryPathByDateType(DIR_DATE_TYPE policy) { + + Calendar calendar = Calendar.getInstance(); + StringBuffer sb = new StringBuffer(); + sb.append(calendar.get(Calendar.YEAR)).append(File.separator); + if (policy.ordinal() <= DIR_DATE_TYPE.DATE_POLICY_YYYY_MM.ordinal()) { + sb.append(StringUtils.leftPad(String.valueOf(calendar.get(Calendar.MONTH)+1), 2, '0')).append(File.separator); + } + if (policy.ordinal() <= DIR_DATE_TYPE.DATE_POLICY_YYYY_MM_DD.ordinal()) { + sb.append(StringUtils.leftPad(String.valueOf(calendar.get(Calendar.DATE)), 2, '0')).append(File.separator); + } + + return sb.toString(); + } + + public static File getUniqueFile(final File file) { + if (!file.exists()) + return file; + + File tmpFile = new File(file.getAbsolutePath()); + File parentDir = tmpFile.getParentFile(); + int count = 1; + String extension = FilenameUtils.getExtension(tmpFile.getName()); + String baseName = FilenameUtils.getBaseName(tmpFile.getName()); + do { + tmpFile = new File(parentDir, baseName + "_" + count++ + "_." + extension); + } while (tmpFile.exists()); + return tmpFile; + } + +} diff --git a/src/main/java/egovframework/com/utl/wed/filter/FileSaveManager.java b/src/main/java/egovframework/com/utl/wed/filter/FileSaveManager.java new file mode 100644 index 0000000..55f8965 --- /dev/null +++ b/src/main/java/egovframework/com/utl/wed/filter/FileSaveManager.java @@ -0,0 +1,49 @@ +/* + * CKEditor image upload module for Java. + * Copyright guavatak (https://github.com/guavatak/ckeditor-upload-filter-java) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @author guavatak (https://github.com/guavatak/ckeditor-upload-filter-java) + */ +package egovframework.com.utl.wed.filter; + +import org.apache.commons.fileupload.FileItem; + +/** + * Created by guava on 1/20/14. + * 이미지 저장 처리 클래스 + * @author guavatak + * @since 2014.12.04 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *   
    + *  수정일              수정자             수정내용
    + *  ----------  --------    ---------------------------
    + *  2014.12.04	표준프레임워크	최초 적용 (패키지 변경 및 소스 정리)
    + *  2018.12.28	신용호             saveFile() 파라미터 수정
    + * 
    + */ +public interface FileSaveManager { + /** + * + * @param fileItem + * @param imageBaseDir 기본 이미지 저장 디렉토리. 이 디렉토리 아래로 모든 파일을 넣어도 되고, 폴더를 구분하여 넣어도 된다. 이 파라미터에는 마지막 디렉토리 구분자는 포함되지 않는다. + * @return 이미지 파일을 액세스 할 수 있는 URL 을 반환한다. 반환된 URL 은 ckeditor 에게 전달되어 즉시 사용자 브라우져에 이미지가 나타나게 된다. + */ + String saveFile(FileItem fileItem, String imageBaseDir); +} + diff --git a/src/main/java/egovframework/com/utl/wed/web/EgovWebEditorImageController.java b/src/main/java/egovframework/com/utl/wed/web/EgovWebEditorImageController.java new file mode 100644 index 0000000..e73c92b --- /dev/null +++ b/src/main/java/egovframework/com/utl/wed/web/EgovWebEditorImageController.java @@ -0,0 +1,217 @@ +package egovframework.com.utl.wed.web; + +import java.io.FileNotFoundException; +import java.net.URLEncoder; +import java.util.List; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.multipart.MultipartHttpServletRequest; + +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.service.EgovProperties; +import egovframework.com.utl.fcc.service.EgovFileUploadUtil; +import egovframework.com.utl.fcc.service.EgovFormBasedFileUtil; +import egovframework.com.utl.fcc.service.EgovFormBasedFileVo; +import egovframework.com.utl.fcc.service.EgovStringUtil; +import org.egovframe.rte.fdl.cryptography.EgovEnvCryptoService; +import org.egovframe.rte.fdl.cryptography.EgovPasswordEncoder; + +/** + * 웹에디터 이미지 upload 처리 Controller + * @author 공통컴포넌트개발팀 한성곤 + * @since 2009.08.26 + * @version 1.0 + * @see + * + *
    + * << 개정이력(Modification Information) >>
    + *
    + *   수정일                수정자          수정내용
    + *  -----------   --------  ---------------------------
    + *   2009.08.26   한성곤          최초 생성
    + *   2017.08.31   장동한          path, physical 파라미터 노출 암호화 처리
    + *   2017.12.12   장동한          출력 모듈 경로 변경 취약점 조치
    + *   2018.03.07   신용호          URLEncode 처리
    + *   2018.08.17   신용호          URL 암호화 보안 추가 조치
    + *   2020.08.05   신용호          imageUploadCk Parameter 수정
    + *   
    + * 
    + */ +@Controller +public class EgovWebEditorImageController { + + /** 로그설정 */ + private static final Logger LOGGER = LoggerFactory.getLogger(EgovWebEditorImageController.class); + + /** 첨부파일 위치 지정 => globals.properties */ + private final String uploadDir = EgovProperties.getProperty("Globals.fileStorePath"); + /** 허용할 확장자를 .확장자 형태로 연달아 기술한다. ex) .gif.jpg.jpeg.png => globals.properties */ + private final String extWhiteList = EgovProperties.getProperty("Globals.fileDownload.Extensions"); + + /** 첨부 최대 파일 크기 지정 */ + private final long maxFileSize = 1024 * 1024 * 100; //업로드 최대 사이즈 설정 (100M) + + /** 암호화서비스 */ + @Resource(name = "egovEnvCryptoService") + EgovEnvCryptoService cryptoService; + + @Resource(name = "egovEnvPasswordEncoderService") + EgovPasswordEncoder egovPasswordEncoder; + + /** EgovMessageSource */ + @Resource(name="egovMessageSource") + EgovMessageSource egovMessageSource; + + /** + * 이미지 Upload 화면으로 이동한다. + * + * @return + * @throws Exception + */ + @RequestMapping(value="/utl/wed/insertImage.do", method=RequestMethod.GET) + public String goInsertImage(Model model) throws Exception { + + return "egovframework/com/utl/wed/EgovInsertImage"; + } + + + /** + * 이미지 Upload를 처리한다. + * + * @param request + * @param model + * @return + * @throws Exception + */ + @RequestMapping(value="/utl/wed/insertImage.do", method=RequestMethod.POST) + public String imageUpload(MultipartHttpServletRequest request, Model model) throws Exception { + + uploadImageFiles(request, model); + return "egovframework/com/utl/wed/EgovInsertImage"; + } + + /** + * 이미지 Upload(CK에디터)를 처리한다. + * + * @param request + * @param model + * @return + * @throws Exception + */ + @RequestMapping(value="/utl/wed/insertImageCk.do", method=RequestMethod.POST) + public String imageUploadCk(@RequestParam(value="CKEditorFuncNum", required=false) String ckEditorFuncNum, MultipartHttpServletRequest mRequest, HttpServletResponse response, Model model) throws Exception { + // Spring multipartResolver 미사용 시 (commons-fileupload 활용) + //List list = EgovFormBasedFileUtil.uploadFiles(request, uploadDir, maxFileSize); + model.addAttribute("ckEditorFuncNum", ckEditorFuncNum); + uploadImageFiles(mRequest, model); + return "egovframework/com/utl/wed/EgovUploadImageComplete"; + } + + /** + * @param request + * @param model + * @throws Exception + */ + private void uploadImageFiles(MultipartHttpServletRequest mRequest, Model model) throws Exception { + + try { + List list = EgovFileUploadUtil.uploadFilesExt(mRequest, uploadDir, maxFileSize, extWhiteList); + if (list.size() > 0) { + EgovFormBasedFileVo vo = list.get(0); // 첫번째 이미지 + + String url = mRequest.getContextPath() + + "/utl/web/imageSrc.do?" + + "path=" + this.encrypt(vo.getServerSubPath()) + + "&physical=" + this.encrypt(vo.getPhysicalName()) + + "&contentType=" + this.encrypt(vo.getContentType()); + + model.addAttribute("url", url); + model.addAttribute("msg",egovMessageSource.getMessage("success.file.transfer")); + } + } catch (SecurityException e) { + model.addAttribute("url", ""); + model.addAttribute("msg",egovMessageSource.getMessage("errors.file.extension")); + } catch (Exception e) { + LOGGER.error(e.getMessage()); + model.addAttribute("url", ""); + model.addAttribute("msg",egovMessageSource.getMessage("errors.file.transfer")); + } + } + + /** + * 이미지 view를 제공한다. + * + * @param request + * @param response + * @throws Exception + */ + @RequestMapping(value="/utl/web/imageSrc.do",method=RequestMethod.GET) + public void download(HttpServletRequest request, HttpServletResponse response) throws Exception { + //2017.12.12 - 출력 모듈 경로 변경 취약점 조치 + //KISA 보안약점 조치 (2018-10-29, 윤창원) + String subPath = this.decrypt(EgovStringUtil.isNullToString(request.getParameter("path"))); + String physical = this.decrypt(EgovStringUtil.isNullToString(request.getParameter("physical"))); + String mimeType = this.decrypt(EgovStringUtil.isNullToString(request.getParameter("contentType"))); + + if (subPath.indexOf("..") >= 0 ) throw new Exception("Security Exception - illegal url called."); + if (physical.indexOf("..") >= 0 ) throw new Exception("Security Exception - illegal url called."); + + String ext = ""; + if ( physical.lastIndexOf(".") > 0 ) + ext = physical.substring(physical.lastIndexOf(".") + 1,physical.length()).toLowerCase(); + if ( ext == null ) throw new FileNotFoundException(); + + if ( extWhiteList.indexOf(ext) >= 0 ) + EgovFormBasedFileUtil.viewFile(response, uploadDir, subPath, physical, mimeType); + else + throw new FileNotFoundException(); + } + + /** + * 암호화 + * + * @param encrypt + */ + private String encrypt(String encrypt) { + + try { + return cryptoService.encrypt(encrypt); // Handles URLEncoding. + //return cryptoService.encryptNone(encrypt); // Does not handle URLEncoding. + } catch(IllegalArgumentException e) { + LOGGER.error("[IllegalArgumentException] Try/Catch...usingParameters Runing : "+ e.getMessage()); + } catch (Exception e) { + LOGGER.error("[" + e.getClass() +"] :" + e.getMessage()); + } + return encrypt; + } + + /** + * 복호화 + * + * @param decrypt + */ + private String decrypt(String decrypt){ + + try { + //return cryptoService.decrypt(decrypt); // Handles URLDecoding. + return cryptoService.decryptNone(decrypt); // Does not handle URLDecoding. + } catch(IllegalArgumentException e) { + LOGGER.error("[IllegalArgumentException] Try/Catch...usingParameters Runing : "+ e.getMessage()); + } catch (Exception e) { + LOGGER.error("[" + e.getClass() +"] :" + e.getMessage()); + } + return decrypt; + } + + +} diff --git a/src/main/java/kccf/act/dao/ActDAO.java b/src/main/java/kccf/act/dao/ActDAO.java new file mode 100644 index 0000000..4e1bce4 --- /dev/null +++ b/src/main/java/kccf/act/dao/ActDAO.java @@ -0,0 +1,61 @@ +package kccf.act.dao; + +import java.util.List; + +import org.springframework.stereotype.Repository; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import kccf.act.vo.ActVO; + +@Repository("actDAO") +public class ActDAO extends EgovComAbstractDAO { + + public List selectBsnsIdAndBsnsNmAllList(){ + return selectList("actDAO.selectBsnsIdAndBsnsNmAllList"); + } + + public ActVO selectYearMinMax() { + return selectOne("actDAO.selectYearMinMax"); + } + + public List selectActList(ActVO vo){ + return selectList("actDAO.selectActList", vo); + } + + public String getActIdSeq() { + return selectOne("actDAO.getActIdSeq"); + } + + public int insertAct(ActVO vo) { + return insert("actDAO.insertAct", vo); + } + + public ActVO selectActDetail(ActVO vo) { + return selectOne("actDAO.selectActDetail", vo); + } + + public int updateAct(ActVO vo) { + return update("actDAO.updateAct", vo); + } + + public int deleteAct(ActVO vo) { + return update("actDAO.deleteAct", vo); + } + + public List selectCalendarData(ActVO vo){ + return selectList("actDAO.selectCalendarData", vo); + } + + public List selectActCalendarList(ActVO vo){ + return selectList("actDAO.selectActCalendarList", vo); + } + + public List selectCulrtActSpprtList(ActVO vo){ + return selectList("actDAO.selectCulrtActSpprtList", vo); + } + + public List selectTopActList() { + return selectList("actDAO.selectTopActList"); + } + +} diff --git a/src/main/java/kccf/act/service/ActService.java b/src/main/java/kccf/act/service/ActService.java new file mode 100644 index 0000000..97ed92b --- /dev/null +++ b/src/main/java/kccf/act/service/ActService.java @@ -0,0 +1,35 @@ +package kccf.act.service; + +import java.util.List; + +import kccf.act.vo.ActVO; +import kccf.act.vo.CalendarVO; +import kccf.bbs.vo.AttachmentVO; + +public interface ActService { + + public List selectBsnsIdAndBsnsNmAllList(); + + public List selectYear(); + + public List selectActList(ActVO vo); + + public int insertAct(ActVO vo) throws Exception; + + public ActVO selectActDetail(ActVO vo); + + public int updateAct(ActVO actVO, AttachmentVO attachmentVO) throws Exception; + + public void deleteImg(AttachmentVO attachmentVO) throws Exception; + + public int deleteAct(ActVO vo); + + public List selectCalendarData(ActVO searchVO); + + public List selectActCalendarList(ActVO vo); + + public List selectCulrtActSpprtList(ActVO vo); + + public List selectTopActList(); + +} diff --git a/src/main/java/kccf/act/service/impl/ActServiceImpl.java b/src/main/java/kccf/act/service/impl/ActServiceImpl.java new file mode 100644 index 0000000..1bfb783 --- /dev/null +++ b/src/main/java/kccf/act/service/impl/ActServiceImpl.java @@ -0,0 +1,233 @@ +package kccf.act.service.impl; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import egovframework.com.cmm.service.EgovFileMngService; +import kccf.act.dao.ActDAO; +import kccf.act.service.ActService; +import kccf.act.vo.ActVO; +import kccf.act.vo.CalendarVO; +import kccf.bbs.vo.AttachmentVO; +import kccf.cmm.util.CmmFileUtil; +import kccf.login.service.KccfLoginService; +import kccf.login.vo.CmmnCodeDetailVO; + +@Service("actService") +public class ActServiceImpl implements ActService { + + @Resource(name = "actDAO") + private ActDAO actDAO; + + @Autowired + CmmFileUtil fileUtil; + + @Resource(name = "EgovFileMngService") + private EgovFileMngService fileMngService; + + @Resource(name = "kccfLoginService") + private KccfLoginService kccfLoginService; + + @Override + public List selectBsnsIdAndBsnsNmAllList(){ + return actDAO.selectBsnsIdAndBsnsNmAllList(); + } + + @Override + public List selectYear(){ + List yearList = new ArrayList(); + + ActVO actVO = actDAO.selectYearMinMax(); + + for(int i = actVO.getMinYear(); i <= actVO.getMaxYear(); i++) { + yearList.add(i); + } + + return yearList; + } + + @Override + public List selectActList(ActVO vo){ + return actDAO.selectActList(vo); + } + + @Override + public int insertAct(ActVO actVO) throws Exception{ + + List attachment = actVO.getAttachment(); + + String actId = ""; + List result = null; + + String actIdSeq = actDAO.getActIdSeq(); + + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM"); + Date toDay = new Date(); + String nowDate = sdf.format(toDay); + + actId = actVO.getBsnsId() + nowDate + actIdSeq; + + actVO.setActId(actId); + + // 첨부파일 저장 + if(attachment != null && !attachment.isEmpty()) { + result = fileUtil.parseAtchFileInf(attachment, "Y", 0, actVO.getBsnsId(), actId, "KF_BSNS_ACT_INFO"); + String atchFileId = fileMngService.insertFileInfs(result); + + actVO.setGuidanceImageFlpth(atchFileId); + } + + return actDAO.insertAct(actVO); + } + + @Override + public ActVO selectActDetail(ActVO vo) { + return actDAO.selectActDetail(vo); + } + + @Override + public int updateAct(ActVO actVO, AttachmentVO attachmentVO) throws Exception{ + + List attachment = actVO.getAttachment(); + List result = null; + + //첨부파일 저장 + if(attachment != null && !attachment.isEmpty()) { + result = fileUtil.parseAtchFileInf(attachment, "Y", 0, actVO.getBsnsId(), actVO.getActId(), "KF_BSNS_ACT_INFO"); + String atchFileId = fileMngService.insertFileInfs(result); + + actVO.setGuidanceImageFlpth(atchFileId); + } + + + return actDAO.updateAct(actVO); + } + + @Override + public void deleteImg(AttachmentVO attachmentVO) throws Exception{ + + List fileList = new ArrayList(); + fileList.add(attachmentVO); + + fileMngService.deleteFileInfsByKF(fileList); + } + + @Override + public int deleteAct(ActVO vo) { + return actDAO.deleteAct(vo); + } + + @Override + public List selectCalendarData(ActVO searchVO){ + + List resultList = new ArrayList(); + + List actList = actDAO.selectCalendarData(searchVO); + + for(int i = 0; i < actList.size(); i++) { + CalendarVO calendarVO = new CalendarVO(); + calendarVO.setTitle(actList.get(i).getLclttNm()); + calendarVO.setStart(actList.get(i).getActOperBgnde()); + calendarVO.setEnd(actList.get(i).getActOperBgnde()); + + resultList.add(calendarVO); + } + return resultList; + } + + @Override + public List selectActCalendarList(ActVO vo){ + + CmmnCodeDetailVO cmmCodeDetailVO = new CmmnCodeDetailVO(); + + cmmCodeDetailVO.setCode("TRGTER_SE_CODE"); + List codeVO = kccfLoginService.selectCodeListAjax(cmmCodeDetailVO); + + List actList = actDAO.selectActCalendarList(vo); + + for(int i = 0; i < actList.size(); i++) { + if(actList.get(i).getTrgterSeCodeListValue() != null) { + String str = ""; + String [] trgterSeCodeList = actList.get(i).getTrgterSeCodeListValue().split(","); + for(int y = 0; y < trgterSeCodeList.length; y++) { + for(int z = 0; z < codeVO.size(); z++) { + if(trgterSeCodeList[y].equals(codeVO.get(z).getDetailCode())) { + str += (y < trgterSeCodeList.length-1) ? codeVO.get(z).getDetailCodeNm()+ ", " : codeVO.get(z).getDetailCodeNm(); + } + } + actList.get(i).setTrgterSeCodeListValue(str); + } + } + } + + return actList; + } + + @Override + public List selectCulrtActSpprtList(ActVO vo){ + + CmmnCodeDetailVO cmmCodeDetailVO = new CmmnCodeDetailVO(); + + cmmCodeDetailVO.setCode("TRGTER_SE_CODE"); + List codeVO = kccfLoginService.selectCodeListAjax(cmmCodeDetailVO); + + List actList = actDAO.selectCulrtActSpprtList(vo); + + for(int i = 0; i < actList.size(); i++) { + if(actList.get(i).getTrgterSeCodeListValue() != null) { + String str = ""; + String [] trgterSeCodeList = actList.get(i).getTrgterSeCodeListValue().split(","); + for(int y = 0; y < trgterSeCodeList.length; y++) { + for(int z = 0; z < codeVO.size(); z++) { + if(trgterSeCodeList[y].equals(codeVO.get(z).getDetailCode())) { + str += (y < trgterSeCodeList.length-1) ? codeVO.get(z).getDetailCodeNm()+ ", " : codeVO.get(z).getDetailCodeNm(); + } + } + actList.get(i).setTrgterSeCodeListValue(str); + } + } + } + + return actList; + } + + @Override + public List selectTopActList() { + + CmmnCodeDetailVO cmmCodeDetailVO = new CmmnCodeDetailVO(); + + cmmCodeDetailVO.setCode("TRGTER_SE_CODE"); + List codeVO = kccfLoginService.selectCodeListAjax(cmmCodeDetailVO); + + List actList = actDAO.selectTopActList(); + + for(int i = 0; i < actList.size(); i++) { + if(actList.get(i).getTrgterSeCodeListValue() != null) { + String str = ""; + String [] trgterSeCodeList = actList.get(i).getTrgterSeCodeListValue().split(","); + for(int y = 0; y < trgterSeCodeList.length; y++) { + for(int z = 0; z < codeVO.size(); z++) { + if(trgterSeCodeList[y].equals(codeVO.get(z).getDetailCode())) { + str += (y < trgterSeCodeList.length-1) ? codeVO.get(z).getDetailCodeNm()+ ", " : codeVO.get(z).getDetailCodeNm(); + } + } + actList.get(i).setTrgterSeCodeListValue(str); + } + } + + System.out.println("여기"); + System.out.println(actList.get(i).getGuidanceImageFlpth()); + } + + return actList; + } + +} diff --git a/src/main/java/kccf/act/vo/ActVO.java b/src/main/java/kccf/act/vo/ActVO.java new file mode 100644 index 0000000..15515fa --- /dev/null +++ b/src/main/java/kccf/act/vo/ActVO.java @@ -0,0 +1,131 @@ +package kccf.act.vo; + +import java.util.List; + +import org.springframework.web.multipart.MultipartFile; + +import kccf.cmm.vo.CmmBaseVO; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Setter +@Getter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class ActVO extends CmmBaseVO { + + /* 활동 아이디 */ + private String actId; + /* 활동명 */ + private String actNm; + /* 사업 아이디 */ + private String bsnsId; + /* 사업명 */ + private String bsnsNm; + /* 시도지역코드 */ + private String areaCode; + /* 시도지역코드명 */ + private String areaCodeNm; + /* 지방문화원 아이디 */ + private String lclttId; + /* 지방문화원명 */ + private String lclttNm; + /* 활동운영시작일자 */ + private String actOperBgnde; + /* 활동운영종료일자 */ + private String actOperEndde; + /* 모집접수시작일자 */ + private String rcritRceptBgnde; + /* 모집접수종료일자 */ + private String rcritRceptEndde; + /* 모집공개구분코드 */ + private String rcritOpnSeCode; + /* 모집공개구분코드명 */ + private String rcritOpnSeCodeNm; + /* 모집방식구분코드 */ + private String rcritMthdSeCode; + /* 모집방식구분코드명 */ + private String rcritMthdSeCodeNm; + /* 대상자구분코드목록값 */ + private String trgterSeCodeListValue; + /* 대상자인원수 */ + private String trgterNmpr; + /* 안내이미지파일명 */ + private String guidanceImageFlpth; + /* 개요 */ + private String sumryCn; + /* 안내내용 */ + private String guidanceCn; + /* 활동상태코드 */ + private String actSttusCode; + /* 활동상태코드명 */ + private String actSttusCodeNm; + /* 공개여부 */ + private String openYn; + /* 문의처담당자 아이디 */ + private String refrncUserId; + /* 문의처담당자 아이디 */ + private String refrncUserNm; + /* 문의처전화번호 */ + private String refrncTelno; + /* 문의처팩스번호 */ + private String refrncFxnum; + /* 문의처이메일 */ + private String refrncEmail; + /* 문의처주소 */ + private String refrncAdres; + /* 삭제여부 */ + private String deleteAt; + /* 등록자 아이디 */ + private String regUserId; + /* 등록자 아이디 */ + private String regUserNm; + /* 등록일시 */ + private String regDttm; + /* 수정자 아이디 */ + private String updUserId; + /* 수정일시 */ + private String udpDttm; + /* 이미지첨부파일 */ + private List attachment; + /* 사업유형명 */ + private String bsnsTypeCodeNm; + + /* 검색 - 사업 아이디 */ + private String searchBsnsId; + /* 검색 - 연도 */ + private String searchYear; + /* 검색 - 월 */ + private String searchMonth; + /* 검색 - 일자 */ + private String searchDate; + /* 검색 - 달력조회용 시작년월일 */ + private String searchStartDate; + /* 검색 - 달력조회용 종료년월일 */ + private String searchEndDate; + /* 검색 - 지역 코드 */ + private String searchAreaCode; + /* 검색 - 문화원 아이디 */ + private String searchLclttId; + /* 검색 - 활동명 */ + private String searchActNm; + /* 검색 - 활동상태코드 */ + private String searchActSttusCode; + /* 검색 - 사업유형코드 */ + private String searchBsnsTypeCode; + + /* 검색 - 최소연도 */ + private int minYear; + /* 검색 - 최대연도 */ + private int maxYear; + + /* 권한 관련 */ + private boolean canReadOther; + private boolean canWrite; + private boolean canUpdate; + +} diff --git a/src/main/java/kccf/act/vo/CalendarVO.java b/src/main/java/kccf/act/vo/CalendarVO.java new file mode 100644 index 0000000..3e333ac --- /dev/null +++ b/src/main/java/kccf/act/vo/CalendarVO.java @@ -0,0 +1,24 @@ +package kccf.act.vo; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Setter +@Getter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class CalendarVO { + + private String title; + + private String start; + + private String end; + + private Boolean allday = false; + +} diff --git a/src/main/java/kccf/act/web/ActController.java b/src/main/java/kccf/act/web/ActController.java new file mode 100644 index 0000000..d2a666f --- /dev/null +++ b/src/main/java/kccf/act/web/ActController.java @@ -0,0 +1,295 @@ +package kccf.act.web; + +import java.lang.invoke.MethodHandles; +import java.util.List; + +import javax.annotation.Resource; +import javax.servlet.http.HttpSession; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; + +import egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.service.EgovFileMngService; +import kccf.act.service.ActService; +import kccf.act.vo.ActVO; +import kccf.auth.web.AuthUtil; +import kccf.bbs.vo.AttachmentVO; +import kccf.cmm.web.CmmBaseController; +import kccf.login.service.KccfLoginService; +import kccf.login.vo.CmmnCodeDetailVO; +import kccf.login.vo.UserVO; +import kccf.user.service.KccfUserService; +import lombok.RequiredArgsConstructor; + +@Controller +@RequiredArgsConstructor +@RequestMapping(value = "/sec") +public class ActController extends CmmBaseController { + + private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + private final KccfLoginService kccfLoginService; + + private final KccfUserService kccfUserService; + + private final ActService actService; + + private final EgovMessageSource egovMessage; + + @Resource(name = "EgovFileMngService") + private EgovFileMngService fileService; + + @RequestMapping(value = "/act/actListPage.do") + public String actListPage(ActVO searchVO, ModelMap model, HttpSession session) { + + UserVO userVO = (UserVO)session.getAttribute("user"); + + if(userVO == null || StringUtils.isAllBlank(userVO.getUserId())) { + return "redirect:/login.do"; + } + + CmmnCodeDetailVO cmmCodeDetailVO = new CmmnCodeDetailVO(); + + cmmCodeDetailVO.setCode("AREA_CODE"); + model.addAttribute("areaCodeList", kccfLoginService.selectCodeListAjax(cmmCodeDetailVO)); + + cmmCodeDetailVO.setCode("ACT_STTUS_CODE"); + model.addAttribute("actSttusCodeList", kccfLoginService.selectCodeListAjax(cmmCodeDetailVO)); + + searchVO.setCanWrite(AuthUtil.canWrite(getUserId(), getSiteSeCode(), getSelMenuId(), "")); + + model.addAttribute("lclttList", kccfUserService.selectLclttIdCode()); + + model.addAttribute("bsnsList", actService.selectBsnsIdAndBsnsNmAllList()); + + model.addAttribute("yearList", actService.selectYear()); + + model.addAttribute("searchVO", searchVO); + + return model.getAttribute("hostId") + "/act/listAct"; + } + + @RequestMapping(value = "/act/selectActListAjax.do") + public String selectActListAjax(ActVO searchVO, ModelMap model) { + + List actList = actService.selectActList(searchVO); + + if(actList != null && actList.size() > 0) { + searchVO.setTotCnt(actList.get(0).getTotCnt()); + } + + model.addAttribute("data", actList); + model.addAttribute("searchVO", searchVO); + + return "jsonView"; + } + + @RequestMapping(value = "/act/actDetailPage.do") + public String actDetailPage(ModelMap model, ActVO searchVO, HttpSession session) throws Exception{ + + UserVO userVO = (UserVO)session.getAttribute("user"); + + if(userVO == null || StringUtils.isAllBlank(userVO.getUserId())) { + return "redirect:/login.do"; + } + + CmmnCodeDetailVO cmmCodeDetailVO = new CmmnCodeDetailVO(); + + cmmCodeDetailVO.setCode("RCRIT_OPN_SE_CODE"); + model.addAttribute("rcritOpnSeCode", kccfLoginService.selectCodeListAjax(cmmCodeDetailVO)); + + cmmCodeDetailVO.setCode("RCRIT_MTHD_SE_CODE"); + model.addAttribute("rcritMthdSeCode", kccfLoginService.selectCodeListAjax(cmmCodeDetailVO)); + + cmmCodeDetailVO.setCode("TRGTER_SE_CODE"); + model.addAttribute("trgterSeCode", kccfLoginService.selectCodeListAjax(cmmCodeDetailVO)); + + cmmCodeDetailVO.setCode("ACT_STTUS_CODE"); + model.addAttribute("actSttusCode", kccfLoginService.selectCodeListAjax(cmmCodeDetailVO)); + + searchVO.setCanWrite(AuthUtil.canWrite(getUserId(), getSiteSeCode(), getSelMenuId(), "")); + + model.addAttribute("searchVO", searchVO); + + if(!searchVO.getActId().isEmpty()) { + + ActVO resultVO = actService.selectActDetail(searchVO); + + AttachmentVO attachmentVO = new AttachmentVO(); + + attachmentVO.setCntntsId(resultVO.getActId()); + attachmentVO.setFileTyCode("P"); + + List fileList = fileService.selectFileListByCntntsId(attachmentVO); + + model.addAttribute("actVO", resultVO); + model.addAttribute("fileList", fileList); + + } + + + return model.getAttribute("hostId") + "/act/actRegist"; + } + + @RequestMapping(value = "/act/selectBsnsPopup.do") + public String selectBsnsPopup(ModelMap model) { + + CmmnCodeDetailVO cmmCodeDetailVO = new CmmnCodeDetailVO(); + + cmmCodeDetailVO.setCode("BSNS_TYPE_CODE"); + model.addAttribute("bsnsTypeCodeList", kccfLoginService.selectCodeListAjax(cmmCodeDetailVO)); + + cmmCodeDetailVO.setCode("BSNS_STTUS_CODE"); + model.addAttribute("bsnsSttusCodeList", kccfLoginService.selectCodeListAjax(cmmCodeDetailVO)); + + return model.getAttribute("hostId") + "/act/selectBsnsPopup"; + } + + @RequestMapping(value = "/act/insertActAjax.do") + public ResponseEntity insertActAjax(ActVO actVO, ModelMap model, AttachmentVO attachmentVO) throws Exception { + + List attachment = actVO.getAttachment(); + + if(attachment != null && attachment.size() > 1){ + return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("첨부파일 갯수는 1개를 초과할 수 없습니다."); + } else if (attachment != null) { + + for(MultipartFile file : attachment){ + if(file.getSize() > 50 * 1024 * 1024){ + return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("50MB를 초과하는 파일은 등록할 수 없습니다."); + } + } + } + + actVO.setRegUserId(getUserId()); + actVO.setUpdUserId(getUserId()); + + if(!actVO.getActId().isEmpty()) { + actService.updateAct(actVO, attachmentVO); + }else { + actService.insertAct(actVO); + } + + + + return ResponseEntity.ok(egovMessage.getMessage("success.common.insert")); + } + + @RequestMapping(value = "/act/deleteActImg.do") + public String deleteActImg(AttachmentVO attachmentVO, ModelMap model) throws Exception{ + + int resultInt = 0; + + if(attachmentVO != null && attachmentVO.getCntntsId() != "") { + actService.deleteImg(attachmentVO); + + resultInt++; + } + + if(resultInt > 0) { + model.addAttribute("success", "삭제에 성공하였습니다."); + }else { + model.addAttribute("faile", "삭제에 실패하였습니다."); + } + + return "jsonView"; + } + + @RequestMapping(value = "/act/deleteAct.do") + public String deleteAct(ActVO searchVO, RedirectAttributes redirect) { + + actService.deleteAct(searchVO); + + redirect.addAttribute("searchBsnsId", searchVO.getSearchBsnsId()); + redirect.addAttribute("searchYear", searchVO.getSearchYear()); + redirect.addAttribute("searchAreaCode", searchVO.getSearchAreaCode()); + redirect.addAttribute("searchLclttId", searchVO.getSearchLclttId()); + redirect.addAttribute("searchActNm", searchVO.getSearchActNm()); + redirect.addAttribute("searchActSttusCode", searchVO.getSearchActSttusCode()); + redirect.addAttribute("pageNo", searchVO.getPageNo()); + redirect.addAttribute("selMenuId", searchVO.getSelMenuId()); + + return "redirect:/sec/act/actListPage.do"; + } + + @RequestMapping(value = "/act/schdl/actSchdlListPage.do") + public String actSchdlListPage(ActVO searchVO, ModelMap model, HttpSession session) { + + UserVO userVO = (UserVO)session.getAttribute("user"); + + if(userVO == null || StringUtils.isAllBlank(userVO.getUserId())) { + return "redirect:/login.do"; + } + + CmmnCodeDetailVO cmmCodeDetailVO = new CmmnCodeDetailVO(); + + model.addAttribute("bsnsList", actService.selectBsnsIdAndBsnsNmAllList()); + + model.addAttribute("yearList", actService.selectYear()); + + cmmCodeDetailVO.setCode("ACT_STTUS_CODE"); + model.addAttribute("actSttusCode", kccfLoginService.selectCodeListAjax(cmmCodeDetailVO)); + + searchVO.setCanWrite(AuthUtil.canWrite(getUserId(), getSiteSeCode(), getSelMenuId(), "")); + + model.addAttribute("searchVO", searchVO); + + return model.get("hostId") + "/act/schdl/listActSchdl"; + } + + @RequestMapping(value = "/act/schdl/calendarDataAjax.do") + public String calendarDateAjax(ActVO searchVO, ModelMap model) { + + model.addAttribute("data", actService.selectCalendarData(searchVO)); + + return "jsonView"; + } + + @RequestMapping(value = "/act/schdl/selectActCalendarListAjax.do") + public String selectActCalendarListAjax(ActVO searchVO, ModelMap model) { + + List resultList = actService.selectActCalendarList(searchVO); + + if(resultList != null && resultList.size() > 0) { + searchVO.setTotCnt(resultList.get(0).getTotCnt()); + } + + model.addAttribute("searchVO", searchVO); + model.addAttribute("data", resultList); + + return "jsonView"; + } + + @RequestMapping(value = "/act/selectActListPopup.do") + public String selectActListPopup(ActVO searchVO, ModelMap model) { + + CmmnCodeDetailVO cmmCodeDetailVO = new CmmnCodeDetailVO(); + + cmmCodeDetailVO.setCode("AREA_CODE"); + model.addAttribute("areaCodeList", kccfLoginService.selectCodeListAjax(cmmCodeDetailVO)); + + cmmCodeDetailVO.setCode("ACT_STTUS_CODE"); + model.addAttribute("actSttusCodeList", kccfLoginService.selectCodeListAjax(cmmCodeDetailVO)); + + model.addAttribute("lclttList", kccfUserService.selectLclttIdCode()); + + model.addAttribute("bsnsList", actService.selectBsnsIdAndBsnsNmAllList()); + + model.addAttribute("yearList", actService.selectYear()); + + model.addAttribute("searchVO", searchVO); + + return model.getAttribute("hostId") + "/act/selectActListPopup"; + } + + +} diff --git a/src/main/java/kccf/act/web/SeniorActController.java b/src/main/java/kccf/act/web/SeniorActController.java new file mode 100644 index 0000000..46d4682 --- /dev/null +++ b/src/main/java/kccf/act/web/SeniorActController.java @@ -0,0 +1,129 @@ +package kccf.act.web; + +import java.lang.invoke.MethodHandles; +import java.util.List; + +import javax.annotation.Resource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import egovframework.com.cmm.service.EgovCmmUseService; +import egovframework.com.cmm.service.EgovFileMngService; +import kccf.act.service.ActService; +import kccf.act.vo.ActVO; +import kccf.bbs.vo.AttachmentVO; +import kccf.cmm.vo.CmmCodeVO; +import kccf.cmm.web.CmmBaseController; +import kccf.lcltt.service.LclttService; +import kccf.lcltt.vo.LclttVO; +import kccf.log.service.KccfLogService; +import kccf.login.service.KccfLoginService; +import kccf.login.vo.CmmnCodeDetailVO; +import lombok.RequiredArgsConstructor; + +@Controller +@RequiredArgsConstructor +public class SeniorActController extends CmmBaseController { + + private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + private final ActService actService; + + private final EgovCmmUseService cmmUseService; + + private final LclttService lclttService; + + private final KccfLoginService kccfLoginService; + + @Resource(name = "EgovFileMngService") + private EgovFileMngService fileService; + + @RequestMapping(value = "/act/cultrActSpprtPage.do") + public String cultrActSpprtPage(ModelMap model, ActVO searchVO) throws Exception { + + //공통코드 + CmmCodeVO CmmCode = new CmmCodeVO(); + CmmCode.setCode("AREA_CODE"); + List areaCode = cmmUseService.selectCmmCode(CmmCode); + + CmmCode.setCode("BSNS_TYPE_CODE"); + List bsnsTypeCode = cmmUseService.selectCmmCode(CmmCode); + + List topList = actService.selectTopActList(); + + model.addAttribute("areaCode", areaCode); + model.addAttribute("bsnsTypeCode", bsnsTypeCode); + model.addAttribute("searchVO", searchVO); + model.addAttribute("topList", topList); + + return model.getAttribute("hostId") + "/act/listCultrActSpprt"; + } + + @RequestMapping(value = "/act/cultrActSpprtListAjax.do") + public String selectCulrtActSpprtList(ModelMap model, ActVO searchVO) { + + List resultList = actService.selectCulrtActSpprtList(searchVO); + + if(resultList != null && resultList.size() > 0) { + searchVO.setTotCnt(resultList.get(0).getTotCnt()); + } + + model.addAttribute("searchVO", searchVO); + model.addAttribute("data", resultList); + + + return "jsonView"; + } + + @RequestMapping(value = "/act/selectLclttDetailPopup.do") + public String selectLclttDetailPopup(LclttVO lclttVO, ModelMap model) { + + model.addAttribute("lclttVO", lclttService.selectLclttDetail(lclttVO)); + + return model.getAttribute("hostId") + "/act/lclttDetailPopup"; + } + + @RequestMapping(value = "/act/cultrActSpprtDetailPage.do") + public String cultrActSpprtDetailPage(ModelMap model, ActVO actVO) throws Exception { + + ActVO resultVO = actService.selectActDetail(actVO); + + CmmnCodeDetailVO cmmCodeDetailVO = new CmmnCodeDetailVO(); + + cmmCodeDetailVO.setCode("TRGTER_SE_CODE"); + List codeVO = kccfLoginService.selectCodeListAjax(cmmCodeDetailVO); + + if(resultVO.getTrgterSeCodeListValue() != null) { + String str = ""; + String [] trgterSeCodeList = resultVO.getTrgterSeCodeListValue().split(","); + for(int y = 0; y < trgterSeCodeList.length; y++) { + for(int z = 0; z < codeVO.size(); z++) { + if(trgterSeCodeList[y].equals(codeVO.get(z).getDetailCode())) { + str += (y < trgterSeCodeList.length-1) ? codeVO.get(z).getDetailCodeNm()+ ", " : codeVO.get(z).getDetailCodeNm(); + } + } + resultVO.setTrgterSeCodeListValue(str); + } + } + + model.addAttribute("actVO", resultVO); + model.addAttribute("searchVO", actVO); + + AttachmentVO attachmentVO = new AttachmentVO(); + + attachmentVO.setCntntsId(resultVO.getActId()); + attachmentVO.setFileTyCode("P"); + + List fileList = fileService.selectFileListByCntntsId(attachmentVO); + + model.addAttribute("fileList", fileList); + + return model.getAttribute("hostId") + "/act/detailCultrActSpprt"; + } + + +} diff --git a/src/main/java/kccf/auth/dao/AuthDAO.java b/src/main/java/kccf/auth/dao/AuthDAO.java new file mode 100644 index 0000000..431df87 --- /dev/null +++ b/src/main/java/kccf/auth/dao/AuthDAO.java @@ -0,0 +1,40 @@ +package kccf.auth.dao; + +import org.springframework.stereotype.Repository; + +import kccf.auth.vo.AuthInfoVO; +import kccf.cmm.dao.CmmBaseDAO; + + +/** + * @class : AuthDAO.java + * @description : 권한관리 DAO + * + * @author 한국문화원연합회 / (주)디지탈쉽 + * @since 2023-12-28 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-12-28   KNKIM      최초 생성
    + *  
    + * 
    + */ +@Repository +public class AuthDAO extends CmmBaseDAO { + + public String selectOpenBbsIds() throws Exception { + return selectOne("authDAO.selectOpenBbsIds"); + } + + public AuthInfoVO selectBbsAuthInfo(AuthInfoVO authInfoVO) throws Exception { + return selectOne("authDAO.selectBbsAuthInfo", authInfoVO); + } + + public AuthInfoVO selectMenuUserAuthInfo(AuthInfoVO authInfoVO) throws Exception { + return selectOne("authDAO.selectMenuUserAuthInfo", authInfoVO); + } + +} diff --git a/src/main/java/kccf/auth/service/AuthService.java b/src/main/java/kccf/auth/service/AuthService.java new file mode 100644 index 0000000..08003ec --- /dev/null +++ b/src/main/java/kccf/auth/service/AuthService.java @@ -0,0 +1,30 @@ +package kccf.auth.service; + +import kccf.auth.vo.AuthInfoVO; + +/** + * AuthService.java + * Description : 메뉴관리 서비스 인터페이스 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-12-28 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-12-28   KNKIM      최초 생성
    + *  
    + * 
    + */ +public interface AuthService { + + public boolean canReadAuth(AuthInfoVO authInfoVO) throws Exception; + + public boolean canReadOthersAuth(AuthInfoVO authInfoVO) throws Exception; + + public boolean canWriteAuth(AuthInfoVO authInfoVO) throws Exception; + + public boolean canUpdateAuth(AuthInfoVO authInfoVO) throws Exception; +} diff --git a/src/main/java/kccf/auth/service/impl/AuthServiceImpl.java b/src/main/java/kccf/auth/service/impl/AuthServiceImpl.java new file mode 100644 index 0000000..418e102 --- /dev/null +++ b/src/main/java/kccf/auth/service/impl/AuthServiceImpl.java @@ -0,0 +1,178 @@ +package kccf.auth.service.impl; + +import java.lang.invoke.MethodHandles; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import kccf.auth.dao.AuthDAO; +import kccf.auth.service.AuthService; +import kccf.auth.vo.AuthInfoVO; +import kccf.auth.web.AuthUtil; +import kccf.util.StrUtil; +import lombok.RequiredArgsConstructor; + +/** + * AuthServiceImpl.java + * Description : 권한관리 서비스 구현 클래스 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-12-28 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-12-28   KNKIM      최초 생성
    + *  
    + * 
    + */ + +@Service +@RequiredArgsConstructor +public class AuthServiceImpl implements AuthService { + + private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + private final AuthDAO authDAO; + + private static String OPEN_BBS_IDS = null; // 공개된 게시판 목록 (각 ID ":"로 구분) + + + private void initOpenBbsIds() throws Exception { + OPEN_BBS_IDS = authDAO.selectOpenBbsIds(); + LOGGER.info("OPEN_BBS_IDS=" + OPEN_BBS_IDS); + } + + private boolean hasAuth(AuthInfoVO authInfoVO) throws Exception { + + if(authInfoVO == null) { + LOGGER.error("권한 체크할 정보가 입력되지 않았습니다."); + return false; + } + if(StringUtils.isAllBlank(authInfoVO.getAuthSeCode())) { + authInfoVO.setAuthSeCode("R"); + } + + AuthInfoVO bbsAuthInfo = null; + + // 게시판인 경우 + if(!StringUtils.isAllBlank(authInfoVO.getBbsId()) + || !StringUtils.isAllBlank(authInfoVO.getNttId())) { + + // 게시판 및 게시물 권한정보 조회 + bbsAuthInfo = authDAO.selectBbsAuthInfo(authInfoVO); + if(bbsAuthInfo == null) return false; + + // 게시물ID만 존재시 게시판ID 설정 + if(StringUtils.isAllBlank(authInfoVO.getBbsId()) + && !StringUtils.isAllBlank(authInfoVO.getNttId())) { + authInfoVO.setBbsId(bbsAuthInfo.getBbsId()); + } + + // 공개 게시판 목록 확인 + if(OPEN_BBS_IDS == null) initOpenBbsIds(); + + + // 공개 게시판인 경우 조회권한에 대하여 true + if((authInfoVO.getAuthSeCode().charAt(0) == 'R' || authInfoVO.getAuthSeCode().charAt(0) == 'O') + && OPEN_BBS_IDS != null && OPEN_BBS_IDS.contains(":" + authInfoVO.getBbsId() + ":")) { + return true; + } + + if("Y".equals(bbsAuthInfo.getSecretSntncUseYn())) { // 비밀글사용 + + // 본인글 허용 + if((authInfoVO.getAuthSeCode().charAt(0) == 'R' || authInfoVO.getAuthSeCode().charAt(0) == 'U') + && StrUtil.ifEmpty(bbsAuthInfo.getRegUserId(),"").equals(authInfoVO.getUserId())) { + return true; + } + // 원글이 본인글인 경우 허용 + if(authInfoVO.getAuthSeCode().charAt(0) == 'R' + && StrUtil.ifEmpty(bbsAuthInfo.getRefrnRegUserId(),"").equals(authInfoVO.getUserId())) { + return true; + } + // 게시글 관리자 그룹인 경우 허용 + if("Y".equals(bbsAuthInfo.getSecretSntncAuthCodeYn())) { + return true; + } + + } + else if(authInfoVO.getAuthSeCode().charAt(0) == 'R' && !"M".equals(bbsAuthInfo.getSiteSeCode())) { + // 비밀글 사용하지 않으면서 관리자용 게시판이 아닌 경우 허용 + return true; + } + + } + + // 기본 메뉴 기반 권한 확인 + AuthInfoVO retAuthMenu = authDAO.selectMenuUserAuthInfo(authInfoVO); + if(retAuthMenu == null) return false; + + // 게시판 조회권한은 있으나 전문가컨설팅 게시판과 같이 특정 권한그룹이 해당 게시물 관리자로 지정된 경우에는 해당 그룹인 자만 타인글 조회 가능 + if(bbsAuthInfo != null + && authInfoVO.getAuthSeCode().charAt(0) == 'O' + && !StringUtils.isAllBlank(bbsAuthInfo.getSecretSntncAuthCode()) + && !"Y".equals(bbsAuthInfo.getSecretSntncAuthCodeYn())) { + return false; + } + + // 메뉴에 대한 조회권한 보유시 + if((authInfoVO.getAuthSeCode().charAt(0) == 'R' || authInfoVO.getAuthSeCode().charAt(0) == 'O') + && "Y".equals(retAuthMenu.getInqireAuthorYn())) { + return true; + } + + // 조회권한 확인 시, 메뉴에 대한 변경권한 보유시 + if((authInfoVO.getAuthSeCode().charAt(0) == 'R' || authInfoVO.getAuthSeCode().charAt(0) == 'O') + && "Y".equals(retAuthMenu.getChangeAuthorYn())) { + return true; + } + + // 변경권한 확인 시, 메뉴에 대한 변경권한 보유하면서 해당 메뉴의 게시판 정보도 동일하여야 함 (변경권한없이 메뉴ID만 변경하여 요청되는 경우 방지) + if((authInfoVO.getAuthSeCode().charAt(0) == 'W' || authInfoVO.getAuthSeCode().charAt(0) == 'U') + && "Y".equals(retAuthMenu.getIncMenuIdYn()) && "Y".equals(retAuthMenu.getChangeAuthorYn())) { + return true; + } + + return false; + } + + @Override + public boolean canReadAuth(AuthInfoVO authInfoVO) throws Exception { + + if(authInfoVO == null) return false; + + authInfoVO.setAuthSeCode("R"); + return hasAuth(authInfoVO); + } + + @Override + public boolean canReadOthersAuth(AuthInfoVO authInfoVO) throws Exception { + if(authInfoVO == null) return false; + + authInfoVO.setAuthSeCode("O"); + return hasAuth(authInfoVO); + } + + @Override + public boolean canWriteAuth(AuthInfoVO authInfoVO) throws Exception { + if(authInfoVO == null) return false; + + authInfoVO.setAuthSeCode("W"); + return hasAuth(authInfoVO); + } + + @Override + public boolean canUpdateAuth(AuthInfoVO authInfoVO) throws Exception { + if(authInfoVO == null) return false; + + authInfoVO.setAuthSeCode("U"); + return hasAuth(authInfoVO); + } + +} diff --git a/src/main/java/kccf/auth/vo/AuthInfoVO.java b/src/main/java/kccf/auth/vo/AuthInfoVO.java new file mode 100644 index 0000000..7baaf85 --- /dev/null +++ b/src/main/java/kccf/auth/vo/AuthInfoVO.java @@ -0,0 +1,59 @@ +package kccf.auth.vo; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang3.StringUtils; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import kccf.cmm.vo.CmmBaseVO; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +/** + * AuthInfoVO.java + * Description : 권한 정보를 담는 VO + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-12-28 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-12-28   KNKIM      최초 생성
    + *  
    + * 
    + */ + +@Getter +@Setter +@ToString +@NoArgsConstructor + +public class AuthInfoVO extends CmmBaseVO implements Cloneable { + + String menuId; /* 메뉴ID */ + String bbsId; /* 게시판ID */ + String nttId; /* 게시물ID */ + String siteSeCode; /* 사이트구분코드 */ + String userId; /* 사용자ID */ + String regUserId; /* 등록사용자ID */ + String refrnRegUserId; /* 원글 등록사용자ID */ + + String secretSntncUseYn; /* 게시판 비밀글선택사용여부 */ + String secretSntncAuthCode; /* 게시판 비밀글관리자권한코드 */ + String secretSntncYn; /* 게시글 비밀글여부 */ + + String secretSntncAuthCodeYn; /* 게시판 비밀글관리자권한코드 보유 여부 */ + String inqireAuthorYn; /* 조회권한 */ + String changeAuthorYn; /* 변경권한 */ + String incMenuIdYn; /* 게시판정보가 메뉴에 포함되었는지 여부 */ + + String authSeCode; /* 권한구분코드 */ + +} diff --git a/src/main/java/kccf/auth/web/AuthUtil.java b/src/main/java/kccf/auth/web/AuthUtil.java new file mode 100644 index 0000000..e47ba44 --- /dev/null +++ b/src/main/java/kccf/auth/web/AuthUtil.java @@ -0,0 +1,138 @@ +package kccf.auth.web; + +import java.lang.invoke.MethodHandles; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Controller; + +import kccf.auth.service.AuthService; +import kccf.auth.vo.AuthInfoVO; +import kccf.util.StrUtil; +import lombok.RequiredArgsConstructor; + +/** + * @class : AuthUtil.java + * @description : 화면 기능 권한을 관리하는 유틸리티 클래스 + * 메뉴별, 게시판별, 게시물(글)별 권한 체크를 수행한다. + * + * @author 한국문화원연합회 / (주)디지탈쉽 + * @since 2023-12-27 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-12-27   KNKIM      최초 생성
    + *  
    + * 
    + */ + +@Component +@Controller +@RequiredArgsConstructor +public class AuthUtil { + + private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + private static final String NO_LOGIN_USERID = "UXXGUEST"; + + private static AuthService authService; + + @Autowired + public AuthUtil(AuthService authService) { + AuthUtil.authService = authService; + } + + /** + * Description : 주어진 게시물에 대한 읽기(상세조회) 권한이 있는지 여부 리턴 + * @param userId + * @param menuId + * @param nttId + * @return true, false + */ + public static boolean canRead(String userId, String siteSeCode, String menuId, String bbsId, String nttId) { + try { + // 해당 메뉴/글에 대한 읽기 권한 조회 + AuthInfoVO authParam = new AuthInfoVO(); + authParam.setUserId(StrUtil.ifEmpty(userId, NO_LOGIN_USERID)); + authParam.setSiteSeCode(siteSeCode); + authParam.setMenuId(menuId); + authParam.setBbsId(bbsId); + authParam.setNttId(nttId); + return authService.canReadAuth(authParam); + } catch(Exception e) { + LOGGER.error("권한확인 중 오류 발생 (canRead) : " + e.toString()); + return false; + } + } + + /** + * Description : 주어진 게시판에 대한 다른 사람의 게시글 목록 조회 권한이 있는지 여부 리턴 + * @param userId + * @param menuId + * @param bbsId + * @return true, false + */ + public static boolean canReadOthers(String userId, String siteSeCode, String menuId, String bbsId) { + try { + AuthInfoVO authParam = new AuthInfoVO(); + authParam.setUserId(StrUtil.ifEmpty(userId, NO_LOGIN_USERID)); + authParam.setSiteSeCode(siteSeCode); + authParam.setMenuId(menuId); + authParam.setBbsId(bbsId); + return authService.canReadOthersAuth(authParam); + } catch(Exception e) { + LOGGER.error("권한확인 중 오류 발생 (canReadOthers) : " + e.toString()); + return false; + } + + } + + /** + * Description : 주어진 게시판에 대한 작성 권한이 있는지 여부 리턴 + * @param userId + * @param menuId + * @param bbsId + * @return true, false + */ + public static boolean canWrite(String userId, String siteSeCode, String menuId, String bbsId) { + try { + AuthInfoVO authParam = new AuthInfoVO(); + authParam.setUserId(StrUtil.ifEmpty(userId, NO_LOGIN_USERID)); + authParam.setSiteSeCode(siteSeCode); + authParam.setMenuId(menuId); + authParam.setBbsId(bbsId); + return authService.canWriteAuth(authParam); + } catch(Exception e) { + LOGGER.error("권한확인 중 오류 발생 (canWrite) : " + e.toString()); + return false; + } + } + + /** + * Description : 주어진 게시물에 대한 수정/삭제 권한이 있는지 여부 리턴 + * @param userId + * @param menuId + * @param bbsId + * @return true, false + */ + public static boolean canUpdate(String userId, String siteSeCode, String menuId, String bbsId, String nttId) { + try { + AuthInfoVO authParam = new AuthInfoVO(); + authParam.setUserId(StrUtil.ifEmpty(userId, NO_LOGIN_USERID)); + authParam.setSiteSeCode(siteSeCode); + authParam.setMenuId(menuId); + authParam.setBbsId(bbsId); + authParam.setNttId(nttId); + return authService.canUpdateAuth(authParam); + } catch(Exception e) { + LOGGER.error("권한확인 중 오류 발생 (canUpdate) : " + e.toString()); + return false; + } + } + +} diff --git a/src/main/java/kccf/batch/QuartzSchedule.java b/src/main/java/kccf/batch/QuartzSchedule.java new file mode 100644 index 0000000..91b7a97 --- /dev/null +++ b/src/main/java/kccf/batch/QuartzSchedule.java @@ -0,0 +1,88 @@ +package kccf.batch; + +import static org.quartz.JobBuilder.newJob; +import static org.quartz.TriggerBuilder.newTrigger; + +import javax.servlet.http.HttpServlet; + +import org.quartz.CronScheduleBuilder; +import org.quartz.CronTrigger; +import org.quartz.JobDetail; +import org.quartz.JobKey; +import org.quartz.Scheduler; +import org.quartz.SchedulerException; +import org.quartz.SchedulerFactory; +import org.quartz.impl.StdSchedulerFactory; +import org.quartz.impl.matchers.GroupMatcher; + +import kccf.bbs.web.JobExtractionBatch; +import kccf.env.web.EnvUtil; +import kccf.main.web.JobCurationBatch; + + +/** + * @Class : QuartzSchedule.java + * @Description : Quartz 배치 스케쥴 + * + * @Modification + * + * 수정일 수정자 수정내용 + * ---------- ------- --------------------------- + * 2023-12-12 KNKIM 최초 생성 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-12-12 + * + */ +public class QuartzSchedule extends HttpServlet { + + private static final long serialVersionUID = 1L; + + private SchedulerFactory schedulerFactory; + private Scheduler scheduler; + + public QuartzSchedule() { + try { + schedulerFactory = new StdSchedulerFactory(); + scheduler = schedulerFactory.getScheduler(); + } + catch (SchedulerException e) { + e.printStackTrace(); + } + } + + @Override + public void init() { + try { + JobDetail job = newJob(JobCurationBatch.class) + .withIdentity("job-curation", "kccf-batch") + .build(); + job.getJobDataMap().put("url", EnvUtil.getSysEnv("K", "curation.service.url")); + + CronTrigger trigger = newTrigger() + .withIdentity("curation-trigger", "kccf-batch") + .withSchedule(CronScheduleBuilder.cronSchedule("0 0 8 * * ?")) // 오전 8시 + //.withSchedule(CronScheduleBuilder.cronSchedule("0 0/2 * * * ?")) // 매 3분마다 + .build(); + + //텍스트 추출 job + JobDetail job2 = newJob(JobExtractionBatch.class) + .withIdentity("job-extraction", "cmm-batch") + .build(); + job2.getJobDataMap().put("url", EnvUtil.getSysEnv("C", "extraction.service.url")); + + CronTrigger trigger2 = newTrigger() + .withIdentity("extraction-trigger", "cmm-batch") + .withSchedule(CronScheduleBuilder.cronSchedule("0 0/3 * * * ?")) // 매 3분마다 + .build(); + + scheduler.scheduleJob(job, trigger); + scheduler.scheduleJob(job2, trigger2); + scheduler.start(); + + } + catch (SchedulerException e) { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/kccf/bbs/dao/BbsDAO.java b/src/main/java/kccf/bbs/dao/BbsDAO.java new file mode 100644 index 0000000..7bfe790 --- /dev/null +++ b/src/main/java/kccf/bbs/dao/BbsDAO.java @@ -0,0 +1,55 @@ +package kccf.bbs.dao; + +import java.util.List; + +import org.springframework.stereotype.Repository; + +import kccf.bbs.vo.BbsItemVO; +import kccf.cmm.dao.CmmBaseDAO; + +/** + * @class : BbsDAO.java + * @description : 게시판관리 DAO + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-09-26 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-09-26   JAJEONG      최초 생성
    + *  
    + * 
    + */ + +@Repository("bbsDAO") +public class BbsDAO extends CmmBaseDAO { + + public List selectBbsList(BbsItemVO bbsItem) throws Exception { + return selectList("bbsDAO.selectBbsList", bbsItem); + } + + public int insertBbsDetail(BbsItemVO bbsItem) throws Exception { + return insert("bbsDAO.insertBbsDetail", bbsItem); + } + + public BbsItemVO selectBbsDetail(BbsItemVO bbsItem) throws Exception { + return selectOne("bbsDAO.selectBbsDetail", bbsItem); + } + + public int deleteBbsDetail(BbsItemVO bbsItem) throws Exception { + return update("bbsDAO.deleteBbsDetail", bbsItem); + } + + public int updateBbsDetail(BbsItemVO bbsItem) throws Exception { + return update("bbsDAO.updateBbsDetail", bbsItem); + } + + public String selectSysEnvrnInfo(String atrbCode) throws Exception { + return selectOne("bbsDAO.selectSysEnvrnInfo", atrbCode); + } + + +} diff --git a/src/main/java/kccf/bbs/dao/BbsNttDAO.java b/src/main/java/kccf/bbs/dao/BbsNttDAO.java new file mode 100644 index 0000000..0057480 --- /dev/null +++ b/src/main/java/kccf/bbs/dao/BbsNttDAO.java @@ -0,0 +1,256 @@ +package kccf.bbs.dao; + +import java.util.List; + +import org.springframework.stereotype.Repository; + +import kccf.bbs.vo.AreaInfoVO; +import kccf.bbs.vo.AttachmentVO; +import kccf.bbs.vo.BbsNttItemVO; +import kccf.bbs.vo.CtgryInfoVO; +import kccf.bbs.vo.FAQItemVO; +import kccf.bbs.vo.LclttInfoVO; +import kccf.bbs.vo.LectureItemVO; +import kccf.bbs.vo.SilverVO; +import kccf.cmm.dao.CmmBaseDAO; +import kccf.env.web.EnvUtil; + +/** + * @class : BbsNttDAO.java + * @description : 게시물 관리 DAO + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-09-27 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-09-27   JAJEONG      최초 생성
    + *  
    + * 
    + */ + +@Repository("bbsNttDAO") +public class BbsNttDAO extends CmmBaseDAO { + + public String getNttId() throws Exception { + return selectOne("bbsNttDAO.getNttId"); + } + + public String getAtchFileId() throws Exception { + return selectOne("bbsNttDAO.getAtchFileId"); + } + + public String getThumbFileId() throws Exception { + return selectOne("bbsNttDAO.getThumbFileId"); + } + + public String getEditorFileId() throws Exception { + return selectOne("bbsNttDAO.getEditorFileId"); + } + + public List selectBbsNttList(BbsNttItemVO bbsNttItem) throws Exception { + return selectList("bbsNttDAO.selectBbsNttList", bbsNttItem); + } + + public List selectBbsNttLclttList(BbsNttItemVO bbsNttItem) throws Exception{ + return selectList("bbsNttDAO.selectBbsNttLclttList", bbsNttItem); + } + + public List selectReplyList(BbsNttItemVO searchVO) throws Exception { + return selectList("bbsNttDAO.selectReplyList", searchVO); + } + + public int insertBbsNtt(BbsNttItemVO bbsNttItem) throws Exception { + return insert("bbsNttDAO.insertBbsNtt", bbsNttItem); + } + + public List selectLclttInfo() throws Exception { + return selectList("bbsNttDAO.selectLclttInfo"); + } + + public List getCtgryInfo() throws Exception { + return selectList("bbsNttDAO.getCtgryInfo"); + } + + public BbsNttItemVO selectBbsNttDetail(String nttId) throws Exception { + return selectOne("bbsNttDAO.selectBbsNttDetail", nttId); + } + + public BbsNttItemVO selectBbsNttLclttDetail(BbsNttItemVO searchVO) throws Exception{ + return selectOne("bbsNttDAO.selectBbsNttLclttDetail", searchVO); + } + + public int deleteBbsNtt(String nttId) throws Exception { + return update("bbsNttDAO.deleteBbsNtt", nttId); + } + + public int deleteFileInfs(BbsNttItemVO bbsNttItem) throws Exception { + + String[] atchmnflIds = bbsNttItem.getAtchmnflId().split(","); + String imgViewUrl = EnvUtil.getSysEnvIf("C", "cmmn.bbs.image.view.url", ""); + + for(String atchmnflId : atchmnflIds) { + + AttachmentVO attaVO = new AttachmentVO(); + attaVO.setAtchmnflId(atchmnflId); + + String thumbUrl = imgViewUrl + atchmnflId; + attaVO.setThumbUrl(thumbUrl); + + update("bbsNttDAO.deleteFileInfs", attaVO); + } + + return 1; + } + + public int updateBbsNtt(BbsNttItemVO bbsNttItem) throws Exception { + return update("bbsNttDAO.updateBbsNtt", bbsNttItem); + } + + public List getFilePhysiclNm(String nttId) throws Exception { + return selectList("bbsNttDAO.getFilePhysiclNm", nttId); + } + + public int MaxFileSn(String nttId) throws Exception { + return selectOne("bbsNttDAO.MaxFileSn", nttId); + } + + public void updateViewCount(String nttId) throws Exception { + update("bbsNttDAO.updateViewCount", nttId); + } + + public void insertBbsNttSearchInfo(BbsNttItemVO bbsNttItem) throws Exception { + insert("bbsNttDAO.insertBbsNttSearchInfo", bbsNttItem); + } + + public void updateBbsNttSearchInfo(BbsNttItemVO bbsNttItem) throws Exception { + update("bbsNttDAO.updateBbsNttSearchInfo", bbsNttItem); + } + + public String selectImgBycontent(BbsNttItemVO searchVO) throws Exception { + return selectOne("bbsNttDAO.selectImgBycontent", searchVO); + } + + public List selectEduList(BbsNttItemVO bbsNttItem) throws Exception{ + return selectList("bbsNttDAO.selectEduList", bbsNttItem); + } + + public BbsNttItemVO selectBbsNttMenuInfo(BbsNttItemVO bbsNttItem) throws Exception{ + return selectOne("bbsNttDAO.selectBbsNttMenuInfo", bbsNttItem); + } + + public List selectShinList(SilverVO searchVO) throws Exception{ + return selectList("bbsNttDAO.selectShinList", searchVO); + } + + public List selectCultureList(SilverVO searchVO) throws Exception{ + return selectList("bbsNttDAO.selectCultureList", searchVO); + } + + public int insertAreaInfo(AreaInfoVO searchVO) throws Exception{ + return insert("bbsNttDAO.insertAreaInfo", searchVO); + } + + public int updateAreaInfo(AreaInfoVO searchVO) throws Exception{ + return update("bbsNttDAO.updateAreaInfo", searchVO); + } + + public List selectAreaInfo(BbsNttItemVO searchVO) throws Exception{ + return selectList("bbsNttDAO.selectAreaInfo", searchVO); + } + + public int deleteAreaInfo(AreaInfoVO searchAreaVO) throws Exception{ + return delete("bbsNttDAO.deleteAreaInfo", searchAreaVO); + } + + public List selectCmCodeList() throws Exception{ + return selectList("bbsNttDAO.selectCmCodeList"); + } + + public List selectCourseList(SilverVO searchVO) throws Exception{ + return selectList("bbsNttDAO.selectCourseList", searchVO); + } + + public List selectFestivalList(SilverVO searchVO) throws Exception{ + return selectList("bbsNttDAO.selectFestivalList", searchVO); + } + + public List selectBbsIdList(String input){ + return selectList("bbsNttDAO.selectBbsIdList", input); + } + + public List selectBbsNttForExtract(BbsNttItemVO searchVO) { + return selectList("bbsNttDAO.selectBbsNttForExtract", searchVO); + } + + public List selectHistoryMvpList(SilverVO silverVO) { + return selectList("bbsNttDAO.selectHistoryMvpList", silverVO); + } + + public List selectOnlineCourseList(LectureItemVO searchVO) { + return selectList("bbsNttDAO.selectOnlineCourseList", searchVO); + } + + public List selectOnlineLectureList(LectureItemVO searchVO) { + return selectList("bbsNttDAO.selectOnlineLectureList", searchVO); + } + + public List selectSilverFestival() throws Exception { + return selectList("bbsNttDAO.selectSilverFestival"); + } + + public List selectLectureForPopup(BbsNttItemVO searchVO) { + return selectList("bbsNttDAO.selectLectureForPopup", searchVO); + } + + public List selectFestivalPhotoList(SilverVO silverVO) { + return selectList("bbsNttDAO.selectFestivalPhotoList", silverVO); + } + + public String selectThumbUrl(String nttId) { + return selectOne("bbsNttDAO.selectThumbUrl", nttId); + } + + public String selectFestivalLastYear() { + return selectOne("bbsNttDAO.selectFestivalLastYear"); + } + + public List selectGalleryForPopup(SilverVO searchVO) { + return selectList("bbsNttDAO.selectGalleryForPopup", searchVO); + } + + public List selectCourseListForSec(BbsNttItemVO searchVO) { + return selectList("bbsNttDAO.selectCourseListForSec", searchVO); + } + + public int extractTextByNttId(BbsNttItemVO searchVO) { + return update("extractTextByNttId", searchVO); + } + + public SilverVO selectFestivalLastYearForPhoto(SilverVO silverVO) { + return selectOne("bbsNttDAO.selectFestivalLastYearForPhoto", silverVO); + } + + public SilverVO selectFestivalLastYearForStar(SilverVO silverVO) { + return selectOne("bbsNttDAO.selectFestivalLastYearForStar", silverVO); + } + + public List selectFAQList(FAQItemVO searchVO) { + return selectList("bbsNttDAO.selectFAQList", searchVO); + } + + public int insertFAQInfo(FAQItemVO searchVO) { + return insert("bbsNttDAO.insertFAQInfo", searchVO); + } + + public int updateFAQInfo(FAQItemVO searchVO) { + return update("bbsNttDAO.updateFAQInfo", searchVO); + } + + public int deleteFAQInfo(FAQItemVO searchVO) { + return update("bbsNttDAO.deleteFAQInfo", searchVO); + } +} diff --git a/src/main/java/kccf/bbs/service/BbsNttService.java b/src/main/java/kccf/bbs/service/BbsNttService.java new file mode 100644 index 0000000..53f22f1 --- /dev/null +++ b/src/main/java/kccf/bbs/service/BbsNttService.java @@ -0,0 +1,122 @@ +package kccf.bbs.service; + +import java.util.List; +import java.util.Map; + +import kccf.bbs.vo.AreaInfoVO; +import kccf.bbs.vo.AttachmentVO; +import kccf.bbs.vo.BbsNttItemVO; +import kccf.bbs.vo.CtgryInfoVO; +import kccf.bbs.vo.FAQItemVO; +import kccf.bbs.vo.LclttInfoVO; +import kccf.bbs.vo.LectureItemVO; +import kccf.bbs.vo.SilverVO; +import kccf.cmm.vo.CmmBaseVO; + +/** + * BbsNttService.java + * Description : 게시물 서비스 인터페이스 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-09-27 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-09-27   JAJEONG      최초 생성
    + *  
    + * 
    + */ + +public interface BbsNttService { + + public CmmBaseVO insertBbsNtt(BbsNttItemVO bbsNttItem) throws Exception; + + public CmmBaseVO updateBbsNtt(BbsNttItemVO bbsNttItem) throws Exception; + + public CmmBaseVO deleteBbsNtt(String nttId) throws Exception; + + public String getThumbFileId() throws Exception; + + public String getAtchFileId() throws Exception; + + public String getNttId() throws Exception; + + public String getEditorFileId() throws Exception; + + public List selectLclttInfo() throws Exception; + + public List getCtgryInfo() throws Exception; + + public List selectBbsNttList(BbsNttItemVO bbsNttItem) throws Exception; + + public BbsNttItemVO selectBbsNttDetail(String nttId) throws Exception; + + public BbsNttItemVO selectBbsNttLclttDetail(BbsNttItemVO searchVO) throws Exception; + + public List getFilePhysiclNm(String nttId) throws Exception; + + public List selectReplyList(BbsNttItemVO searchVO) throws Exception; + + public List selectEduList(BbsNttItemVO bbsNttItem) throws Exception; + + public BbsNttItemVO selectBbsNttMenuInfo(BbsNttItemVO searchVO) throws Exception; + + public List selectShinList(SilverVO searchVO) throws Exception; + + public List selectCultureList(SilverVO searchVO) throws Exception; + + public AreaInfoVO insertAreaInfo(AreaInfoVO searchVO) throws Exception; + + public AreaInfoVO updateAreaInfo(AreaInfoVO searchVO) throws Exception; + + public List selectAreaInfo(BbsNttItemVO searchVO) throws Exception; + + public int deleteAreaInfo(AreaInfoVO searchAreaVO) throws Exception; + + public List selectCmCodeList() throws Exception; + + public List selectCourseList(SilverVO searchVO) throws Exception; + + public List selectFestivalList(SilverVO searchVO) throws Exception; + + public List selectBbsIdList(String input) throws Exception; + + public BbsNttItemVO extractBbsNttText(BbsNttItemVO searchVO) throws Exception; + + public List selectHistoryMvpList(SilverVO silverVO); + + public Map selectOnlineCourseList(LectureItemVO searchVO) throws Exception; + + public List selectOnlineLectureList(LectureItemVO searchVO) throws Exception; + + public List selectSilverFestival() throws Exception; + + List selectLectureForPopup(BbsNttItemVO searchVO); + + public List selectFestivalPhotoList(SilverVO silverVO) throws Exception; + + public String selectThumbUrl(String nttId) throws Exception; + + public String selectFestivalLastYear() throws Exception; + + public List selectGalleryForPopup(SilverVO searchVO); + + public List selectCourseListForSec(BbsNttItemVO searchVO); + + public BbsNttItemVO extractTextByNttId(BbsNttItemVO searchVO) throws Exception; + + public SilverVO selectFestivalLastYearForPhoto(SilverVO silverVO); + + public SilverVO selectFestivalLastYearForStar(SilverVO silverVO); + + public List selectFAQList(FAQItemVO searchVO); + + public CmmBaseVO insertFAQInfo(FAQItemVO searchVO); + + public CmmBaseVO updateFAQInfo(FAQItemVO searchVO); + + public CmmBaseVO deleteFAQInfo(FAQItemVO searchVO); +} diff --git a/src/main/java/kccf/bbs/service/BbsService.java b/src/main/java/kccf/bbs/service/BbsService.java new file mode 100644 index 0000000..fb90730 --- /dev/null +++ b/src/main/java/kccf/bbs/service/BbsService.java @@ -0,0 +1,43 @@ +package kccf.bbs.service; + +import java.util.List; + +import kccf.bbs.vo.BbsItemVO; +import kccf.bbs.vo.BbsNttItemVO; +import kccf.cmm.vo.CmmBaseVO; + +/** + * BbsService.java + * Description : 게시판관리 서비스 인터페이스 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-09-26 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-09-26   JAJEONG      최초 생성
    + *  
    + * 
    + */ + +public interface BbsService { + + public List selectBbsList(BbsItemVO bbsItem) throws Exception; + + public CmmBaseVO insertBbsDetail(BbsItemVO bbsItem) throws Exception; + + public BbsItemVO selectBbsDetail(String bbsId) throws Exception; + + public BbsItemVO selectBbsDetail(BbsItemVO bbsItem) throws Exception; + + public CmmBaseVO deleteBbsDetail(BbsItemVO bbsItem) throws Exception; + + public CmmBaseVO updateBbsDetail(BbsItemVO bbsItem) throws Exception; + + public String selectSysEnvrnInfo(String atrbCode) throws Exception; + + +} diff --git a/src/main/java/kccf/bbs/service/impl/BbsNttServiceImpl.java b/src/main/java/kccf/bbs/service/impl/BbsNttServiceImpl.java new file mode 100644 index 0000000..b2e91ae --- /dev/null +++ b/src/main/java/kccf/bbs/service/impl/BbsNttServiceImpl.java @@ -0,0 +1,686 @@ +package kccf.bbs.service.impl; + +import java.lang.invoke.MethodHandles; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.apache.commons.lang3.StringUtils; +import org.jsoup.Jsoup; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import egovframework.com.cmm.service.EgovFileMngService; +import kccf.bbs.dao.BbsNttDAO; +import kccf.bbs.service.BbsNttService; +import kccf.bbs.service.BbsService; +import kccf.bbs.vo.AreaInfoVO; +import kccf.bbs.vo.AttachmentVO; +import kccf.bbs.vo.BbsItemVO; +import kccf.bbs.vo.BbsNttItemVO; +import kccf.bbs.vo.CtgryInfoVO; +import kccf.bbs.vo.FAQItemVO; +import kccf.bbs.vo.LclttInfoVO; +import kccf.bbs.vo.LectureItemVO; +import kccf.bbs.vo.SilverVO; +import kccf.cmm.util.CmmFileUtil; +import kccf.cmm.util.CmmImageSaver; +import kccf.cmm.vo.CmmBaseVO; +import kccf.env.web.EnvUtil; +import lombok.RequiredArgsConstructor; + +/** + * BbsNttServiceImpl.java + * Description : 게시물 서비스 구현 클래스 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-09-27 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-09-27   JAJEONG      최초 생성
    + *  
    + * 
    + */ + +@Service("bbsNttService") +@RequiredArgsConstructor +public class BbsNttServiceImpl implements BbsNttService { + + private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + private final BbsNttDAO bbsNttDAO; + + @Resource + BbsNttService bbsNttService; + + @Resource + BbsService bbsService; + + @Resource + EgovFileMngService fileMngService; + + @Resource + CmmFileUtil fileUtil; + + @Resource + CmmImageSaver imageSever; + + + @Override + public String getThumbFileId() throws Exception { + return bbsNttDAO.getThumbFileId(); + } + + @Override + public String getAtchFileId() throws Exception { + return bbsNttDAO.getAtchFileId(); + } + + @Override + public String getNttId() throws Exception { + return bbsNttDAO.getNttId(); + } + + @Override + public List selectLclttInfo() throws Exception { + return bbsNttDAO.selectLclttInfo(); + } + + @Override + public List getCtgryInfo() throws Exception { + return bbsNttDAO.getCtgryInfo(); + } + + @Override + public String getEditorFileId() throws Exception { + return bbsNttDAO.getEditorFileId(); + } + + @Override + public CmmBaseVO insertBbsNtt(BbsNttItemVO bbsNttItem) throws Exception{ + + String bbsId = bbsNttItem.getBbsId(); + BbsItemVO bbsItem = bbsService.selectBbsDetail(bbsId); + String nttId = bbsNttService.getNttId(); + bbsNttItem.setNttId(nttId); + + List result = null; + MultipartFile thumbnail = bbsNttItem.getThumbnail(); + List attachment = bbsNttItem.getAttachment(); + String cntntsCn = bbsNttItem.getCntntsCn(); + + // 썸네일 저장 + if(thumbnail != null && !thumbnail.isEmpty()) { + + int widthSize = bbsItem.getThumbWidthSize(); + int heigthSize = bbsItem.getThumbHgSize(); + + if(widthSize == 0) { + widthSize = Integer.parseInt(EnvUtil.getSysEnvIf("C", "cmmn.thumbnail.size.width", "")); + } + if(heigthSize == 0) { + heigthSize = Integer.parseInt(EnvUtil.getSysEnvIf("C", "cmmn.thumbnail.size.height", "")); + } + + result = fileUtil.parseThumbFileInf(thumbnail, 0, widthSize, heigthSize, bbsId, nttId); + bbsNttItem.setThumbUrl(result.get(0).getThumbUrl()); + fileMngService.insertFileInfs(result); + } + + // 첨부파일 저장 + if(attachment != null && !attachment.isEmpty()) { + + String resizeYn = bbsItem.getImageReszYn(); + result = fileUtil.parseAtchFileInf(attachment, resizeYn, 0, bbsId, nttId, "KF_BBS_NTT"); + fileMngService.insertFileInfs(result); + + // 썸네일 없을 시 첨부파일 첫번째 이미지 첨부파일 등록 + if((bbsItem.getBbsTyCode().equals("P") || bbsItem.getThumbRegistYn().equals("Y")) && thumbnail == null) { + bbsNttItem.setThumbUrl(result.get(0).getThumbUrl()); + } + } + + // 내용 저장 + if(cntntsCn != null && !cntntsCn.isEmpty()) { + + String content = cntntsCn.replace("'", "'"); + String HTMLData = content.replace(""", "\""); + bbsNttItem.setCntntsCn(HTMLData); + + // 에디터 이미지 복사 저장 + String imageUrls = bbsNttItem.getImageNames(); + + if(imageUrls != null && !imageUrls.isEmpty()) { + + String[] newImageUrls = imageUrls.split(","); + String filePath = imageSever.saveImageFromUrl(bbsId, nttId, newImageUrls); + String fileReplacePath = filePath.replace("\\", "/"); + + // 이미지 경로 replace + String originalURL = "getImageForContents.do?file="; + String newURL = "getImageFile.do?file=" + fileReplacePath + "/"; + + HTMLData = HTMLData.replace(originalURL, newURL); + bbsNttItem.setCntntsCn(HTMLData); + } + } + + BbsNttItemVO searchInfoVO = new BbsNttItemVO(); + searchInfoVO.setNttId(nttId); + searchInfoVO.setRegUserId(bbsNttItem.getRegUserId()); + if(!StringUtils.isAllBlank(bbsNttItem.getCnText())) { + searchInfoVO.setCnText(Jsoup.parse(bbsNttItem.getCnText()).text()); + } + searchInfoVO.setSearchInfoCn(Jsoup.parse(bbsNttItem.getSj()).text()); + + CmmBaseVO cmmVO = new CmmBaseVO(); + + try { + bbsNttDAO.insertBbsNttSearchInfo(searchInfoVO); + int ntt = bbsNttDAO.insertBbsNtt(bbsNttItem); + + if(ntt > 0) { + cmmVO.setResult("S", "정상적으로 등록되었습니다."); + } else { + cmmVO.setResult("F", "등록에 실패하였습니다."); + } + + } catch (Exception e) { + cmmVO.setResult("F", "등록에 실패하였습니다. 게시물을 재확인 바랍니다."); + } + + return cmmVO; + } + + @Override + public List selectBbsNttList(BbsNttItemVO bbsNttItem) throws Exception { + + if(bbsNttItem.getBbsId().length() <= 22) { + bbsNttItem.setBbsMergeYn("N"); + } else { + bbsNttItem.setBbsMergeYn("Y"); + } + + List resultList; + + if(bbsNttItem.getBbsId().equals("N000000000000000000020") || bbsNttItem.getBbsId().equals("N000000000000000000021")) { + resultList = bbsNttDAO.selectBbsNttLclttList(bbsNttItem); + + }else { + resultList = bbsNttDAO.selectBbsNttList(bbsNttItem); + } + return resultList; + } + + @Override + public List selectReplyList(BbsNttItemVO searchVO) throws Exception { + return bbsNttDAO.selectReplyList(searchVO); + } + + @Override + public BbsNttItemVO selectBbsNttDetail(String nttId) throws Exception { + bbsNttDAO.updateViewCount(nttId); + return bbsNttDAO.selectBbsNttDetail(nttId); + } + + @Override + public BbsNttItemVO selectBbsNttLclttDetail(BbsNttItemVO searchVO) throws Exception { + bbsNttDAO.updateViewCount(searchVO.getNttId()); + return bbsNttDAO.selectBbsNttLclttDetail(searchVO); + } + + @Override + public CmmBaseVO deleteBbsNtt(String nttId) throws Exception { + + CmmBaseVO cmmVO = new CmmBaseVO(); + + try { + int del = bbsNttDAO.deleteBbsNtt(nttId); + + if(del > 0) { + cmmVO.setResult("S", "정상적으로 삭제되었습니다."); + } else { + cmmVO.setResult("F", "삭제에 실패하였습니다."); + } + + } catch (Exception e) { + cmmVO.setResult("F", "삭제에 실패하였습니다. 게시물을 재확인 바랍니다."); + } + + return cmmVO; + } + + @Override + public CmmBaseVO updateBbsNtt(BbsNttItemVO bbsNttItem) throws Exception { + + String bbsId = bbsNttItem.getBbsId(); + String nttId = bbsNttItem.getNttId(); + BbsItemVO bbsItem = bbsService.selectBbsDetail(bbsId); + + List result = null; + MultipartFile thumbnail = bbsNttItem.getThumbnail(); + List attachment = bbsNttItem.getAttachment(); + String cntntsCn = bbsNttItem.getCntntsCn(); + + // 썸네일 첨부파일 삭제 + if(!StringUtils.isAllBlank(bbsNttItem.getAtchmnflId())) { + int del = bbsNttDAO.deleteFileInfs(bbsNttItem); + } + + // 썸네일 저장 + if(thumbnail != null && !thumbnail.isEmpty()) { + int widthSize = bbsItem.getThumbWidthSize(); + int heigthSize = bbsItem.getThumbHgSize(); + + result = fileUtil.parseThumbFileInf(thumbnail, 0, widthSize, heigthSize, bbsId, nttId); + + fileMngService.insertFileInfs(result); + bbsNttItem.setThumbUrl(result.get(0).getThumbUrl()); + } + + // 첨부파일 이미지 저장 + if(attachment != null && !attachment.isEmpty()) { + int MaxFileSn = bbsNttDAO.MaxFileSn(nttId); + + String resizeYn = bbsItem.getImageReszYn(); + result = fileUtil.parseAtchFileInf(attachment, resizeYn, MaxFileSn+1 , bbsId, nttId, "KF_BBS_NTT"); + fileMngService.insertFileInfs(result); + } + + // 썸네일 없으면 첨부파일 첫번째 이미지 thumbUrl 저장 + if((bbsItem.getBbsTyCode().equals("P") || bbsItem.getThumbRegistYn().equals("Y")) && StringUtils.isAllBlank(bbsNttItem.getThumbUrl()) && attachment != null && !attachment.isEmpty() ) { + + String thumbUrl = bbsNttService.selectThumbUrl(nttId); + String imgViewUrl = EnvUtil.getSysEnvIf("C", "cmmn.bbs.image.view.url", ""); + + if(StringUtils.isAllBlank(thumbUrl) || thumbUrl.startsWith(imgViewUrl)) { + + AttachmentVO attachmentVO = new AttachmentVO(); + attachmentVO.setCntntsId(nttId); + List attachmentList = fileMngService.selectFileListByCntntsId(attachmentVO); + String atchmnflId = attachmentList.get(0).getAtchmnflId(); + + bbsNttItem.setThumbUrl(imgViewUrl + atchmnflId); + + } else { + bbsNttItem.setThumbUrl(thumbUrl); + } + + } + + // 내용 저장 + if(!StringUtils.isAllBlank(cntntsCn)) { + + String content = cntntsCn.replace("'", "'"); + String HTMLData = content.replace(""", "\""); + bbsNttItem.setCntntsCn(HTMLData); + + // 기존 저장된 이미지 중복저장 방지 코드 + String imageUrls = bbsNttItem.getImageNames(); + + if(imageUrls != null && !imageUrls.isEmpty()) { + + String[] imageUrlArray = imageUrls.split(","); + String[] newImageUrls = new String[imageUrlArray.length]; + int newIndex = 0; + + for (String imageUrl : imageUrlArray) { + String existContent = bbsNttItem.getExistContent(); + + if (!existContent.contains(imageUrl)) { + newImageUrls[newIndex] = imageUrl; + newIndex++; + } + } + + // 에디터 이미지 저장 + if(newImageUrls != null && newImageUrls.length > 0) { + String filePath = imageSever.saveImageFromUrl(bbsId, nttId, newImageUrls); + String fileReplacePath = filePath.replace("\\", "/"); + + //이미지 경로 replace + String originalURL = "getImageForContents.do?file="; + String newURL = "getImageFile.do?file=" + fileReplacePath + "/"; + + HTMLData = HTMLData.replace(originalURL, newURL); + bbsNttItem.setCntntsCn(HTMLData); + } + } + } + + BbsNttItemVO searchInfoVO = new BbsNttItemVO(); + searchInfoVO.setNttId(bbsNttItem.getNttId()); + if(!StringUtils.isAllBlank(bbsNttItem.getCnText())) { + searchInfoVO.setCnText(Jsoup.parse(bbsNttItem.getCnText()).text()); + } + searchInfoVO.setSearchInfoCn(Jsoup.parse(bbsNttItem.getSj()).text()); + + CmmBaseVO cmmVO = new CmmBaseVO(); + + try { + bbsNttDAO.updateBbsNttSearchInfo(searchInfoVO); + int ntt = bbsNttDAO.updateBbsNtt(bbsNttItem); + + if(ntt > 0) { + cmmVO.setResult("S", "정상적으로 수정되었습니다."); + } else { + cmmVO.setResult("F", "수정에 실패하였습니다."); + } + + } catch (Exception e) { + cmmVO.setResult("F", "수정에 실패하였습니다. 게시물을 재확인 바랍니다."); + } + + return cmmVO; + } + + @Override + public List getFilePhysiclNm(String nttId) throws Exception { + return bbsNttDAO.getFilePhysiclNm(nttId); + } + + @Override + public List selectEduList(BbsNttItemVO bbsNttItem) throws Exception{ + return bbsNttDAO.selectEduList(bbsNttItem); + } + + @Override + public BbsNttItemVO selectBbsNttMenuInfo(BbsNttItemVO bbsNttItem) throws Exception { + return bbsNttDAO.selectBbsNttMenuInfo(bbsNttItem); + } + + @Override + public List selectShinList(SilverVO searchVO) throws Exception { + return bbsNttDAO.selectShinList(searchVO); + } + + @Override + public List selectCultureList(SilverVO searchVO) throws Exception { + return bbsNttDAO.selectCultureList(searchVO); + } + + @Override + public AreaInfoVO insertAreaInfo(AreaInfoVO searchVO) throws Exception { + + if(searchVO == null) { + AreaInfoVO areaVO = new AreaInfoVO(); + areaVO.setResult("F", "등록할 정보가 존재하지 않습니다."); + return areaVO; + } + + try { + int ret = bbsNttDAO.insertAreaInfo(searchVO); + if(ret > 0) { + searchVO.setResult("S", "정상적으로 등록되었습니다."); + } else { + searchVO.setResult("F", "등록에 실패하였습니다."); + } + + } catch(Exception e) { + searchVO.setResult("F", "등록에 실패하였습니다. 재확인 바랍니다.)"); + } + + return searchVO; + } + + @Override + public AreaInfoVO updateAreaInfo(AreaInfoVO searchVO) throws Exception { + + if(searchVO == null) { + AreaInfoVO areaVO = new AreaInfoVO(); + areaVO.setResult("F", "변경할 정보가 존재하지 않습니다."); + return areaVO; + } + + int ret = bbsNttDAO.updateAreaInfo(searchVO); + if(ret > 0) { + searchVO.setResult("S", "정상적으로 변경되었습니다."); + } else { + searchVO.setResult("F", "변경할 정보를 확인할 수 없습니다."); + } + + return searchVO; + + } + + @Override + public List selectAreaInfo(BbsNttItemVO searchVO) throws Exception { + return bbsNttDAO.selectAreaInfo(searchVO); + } + + @Override + public int deleteAreaInfo(AreaInfoVO searchAreaVO) throws Exception { + return bbsNttDAO.deleteAreaInfo(searchAreaVO); + } + + @Override + public List selectCmCodeList() throws Exception { + return bbsNttDAO.selectCmCodeList(); + } + + @Override + public List selectCourseList(SilverVO searchVO) throws Exception { + return bbsNttDAO.selectCourseList(searchVO); + } + + @Override + public List selectFestivalList(SilverVO searchVO) throws Exception { + return bbsNttDAO.selectFestivalList(searchVO); + } + + @Override + public List selectBbsIdList(String input) throws Exception { + return bbsNttDAO.selectBbsIdList(input); + } + + @Override + public BbsNttItemVO extractBbsNttText(BbsNttItemVO searchVO) throws Exception { + + List nttList = bbsNttDAO.selectBbsNttForExtract(searchVO); + + if(nttList.isEmpty()) { + BbsNttItemVO nttVO = new BbsNttItemVO(); + nttVO.setResult("F", "해당 게시판에 새로 등록할 게시물이 존재하지 않습니다."); + return nttVO; + } + else { + for(BbsNttItemVO ntt:nttList) { + BbsNttItemVO insertVO = new BbsNttItemVO(); + insertVO.setNttId(ntt.getNttId()); + String htmlStrCn = ntt.getCntntsCn()==null?"":ntt.getCntntsCn(); + insertVO.setCnText(Jsoup.parse(htmlStrCn).text()); + String htmlStrSj = ntt.getSj()==null?"":ntt.getSj(); + insertVO.setSearchInfoCn(Jsoup.parse(htmlStrSj).text()); + insertVO.setRegUserId(searchVO.getAditInputIemValue1()); + try { + bbsNttDAO.insertBbsNttSearchInfo(insertVO); + }catch(Exception e) { + e.printStackTrace(); + searchVO.setResult("F", "등록에 실패하였습니다."); + return searchVO; + } + } + searchVO.setResult("S", "등록되었습니다."); + return searchVO; + } + } + + @Override + public List selectHistoryMvpList(SilverVO silverVO) { + return bbsNttDAO.selectHistoryMvpList(silverVO); + } + + @Override + public Map selectOnlineCourseList(LectureItemVO searchVO) throws Exception { + int cntPerPage = searchVO.getPageSize(); + + int pageNo = searchVO.getPageNo(); + List courseList = bbsNttDAO.selectOnlineCourseList(searchVO); + int totalCourseCnt = courseList.size(); + + int startIdx = (pageNo - 1)*cntPerPage; + int endIdx = Math.min(startIdx + cntPerPage, totalCourseCnt); + int totalPages =(int) Math.ceil((double)totalCourseCnt/cntPerPage); + double pageGroup = Math.ceil(pageNo/10.0); + double startPage = ((pageGroup-1)*10)+1; + double endPage = pageGroup*10>totalPages?totalPages:pageGroup*10; + + Map response = new HashMap<>(); + response.put("courseList", courseList.subList(startIdx, endIdx)); + response.put("totalPages", totalPages); + response.put("startPage", startPage); + response.put("endPage", endPage); + return response; + } + + @Override + public List selectOnlineLectureList(LectureItemVO searchVO) throws Exception { + return bbsNttDAO.selectOnlineLectureList(searchVO); + } + + @Override + public List selectSilverFestival() throws Exception { + return bbsNttDAO.selectSilverFestival(); + } + + @Override + public List selectLectureForPopup(BbsNttItemVO searchVO) { + return bbsNttDAO.selectLectureForPopup(searchVO); + } + + @Override + public List selectFestivalPhotoList(SilverVO silverVO) throws Exception { + return bbsNttDAO.selectFestivalPhotoList(silverVO); + } + + @Override + public String selectThumbUrl(String nttId) throws Exception { + return bbsNttDAO.selectThumbUrl(nttId); + } + + @Override + public String selectFestivalLastYear() throws Exception { + return bbsNttDAO.selectFestivalLastYear(); + } + + @Override + public SilverVO selectFestivalLastYearForStar(SilverVO silverVO) { + return bbsNttDAO.selectFestivalLastYearForStar(silverVO); + } + + @Override + public List selectGalleryForPopup(SilverVO searchVO) { + return bbsNttDAO.selectGalleryForPopup(searchVO); + } + + @Override + public List selectCourseListForSec(BbsNttItemVO searchVO) { + return bbsNttDAO.selectCourseListForSec(searchVO); + } + + @Override + public BbsNttItemVO extractTextByNttId(BbsNttItemVO searchVO) throws Exception{ + BbsNttItemVO resultVO = searchVO; + + BbsNttItemVO itemVO = bbsNttDAO.selectBbsNttDetail(searchVO.getNttId()); + if(itemVO == null) { + resultVO.setResult("F", "게시물이 존재하지 않습니다."); + return resultVO; + }else { + int result = bbsNttDAO.extractTextByNttId(itemVO); + if(result < 0) { + resultVO.setResult("F", "등록에 실패했습니다."); + }else { + resultVO.setResult("S", "성공적으로 등록되었습니다."); + } + } + + return resultVO; + } + + @Override + public SilverVO selectFestivalLastYearForPhoto(SilverVO silverVO) { + return bbsNttDAO.selectFestivalLastYearForPhoto(silverVO); + } + + @Override + public List selectFAQList(FAQItemVO searchVO) { + return bbsNttDAO.selectFAQList(searchVO); + } + + @Override + public CmmBaseVO insertFAQInfo(FAQItemVO searchVO) { + + FAQItemVO resultVO = new FAQItemVO(); + + try { + String nttId = bbsNttService.getNttId(); + searchVO.setNttId(nttId); + + int ntt = bbsNttDAO.insertFAQInfo(searchVO); + + if(ntt > 0) { + resultVO.setNttId(nttId); + resultVO.setResult("S", "정상적으로 등록되었습니다."); + } else { + resultVO.setResult("F", "등록에 실패하였습니다."); + } + + } catch (Exception e) { + resultVO.setResult("F", "등록에 실패하였습니다. 게시물을 재확인 바랍니다."); + } + + return resultVO; + } + + @Override + public CmmBaseVO updateFAQInfo(FAQItemVO searchVO) { + + CmmBaseVO cmmVO = new CmmBaseVO(); + + try { + int ntt = bbsNttDAO.updateFAQInfo(searchVO); + + if(ntt > 0) { + cmmVO.setResult("S", "정상적으로 수정되었습니다."); + } else { + cmmVO.setResult("F", "수정에 실패하였습니다."); + } + + } catch (Exception e) { + cmmVO.setResult("F", "수정에 실패하였습니다. 게시물을 재확인 바랍니다."); + } + + return cmmVO; + } + + @Override + public CmmBaseVO deleteFAQInfo(FAQItemVO searchVO) { + + CmmBaseVO cmmVO = new CmmBaseVO(); + + try { + int ntt = bbsNttDAO.deleteFAQInfo(searchVO); + + if(ntt > 0) { + cmmVO.setResult("S", "정상적으로 삭제되었습니다."); + } else { + cmmVO.setResult("F", "삭제에 실패하였습니다."); + } + + } catch (Exception e) { + cmmVO.setResult("F", "삭제에 실패하였습니다. 게시물을 재확인 바랍니다."); + } + + return cmmVO; + } +} diff --git a/src/main/java/kccf/bbs/service/impl/BbsServiceImpl.java b/src/main/java/kccf/bbs/service/impl/BbsServiceImpl.java new file mode 100644 index 0000000..13fd58b --- /dev/null +++ b/src/main/java/kccf/bbs/service/impl/BbsServiceImpl.java @@ -0,0 +1,128 @@ +package kccf.bbs.service.impl; + +import java.lang.invoke.MethodHandles; +import java.util.List; + +import javax.annotation.Resource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import kccf.bbs.dao.BbsDAO; +import kccf.bbs.dao.BbsNttDAO; +import kccf.bbs.service.BbsService; +import kccf.bbs.vo.BbsItemVO; +import kccf.cmm.vo.CmmBaseVO; +import lombok.RequiredArgsConstructor; + +/** + * BbsServiceImpl.java + * Description : 게시판 정보 관리 서비스 구현 클래스 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-09-26 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-09-26   JAJEONG      최초 생성
    + *  
    + * 
    + */ + +@Service("bbsService") +@RequiredArgsConstructor +public class BbsServiceImpl implements BbsService { + + private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + private final BbsDAO bbsDAO; + + public List selectBbsList(BbsItemVO bbsItem) throws Exception { + return bbsDAO.selectBbsList(bbsItem); + } + + @Override + public CmmBaseVO insertBbsDetail(BbsItemVO bbsItem) throws Exception { + + CmmBaseVO cmmVO = new CmmBaseVO(); + + try { + int status = bbsDAO.insertBbsDetail(bbsItem); + + if(status > 0) { + cmmVO.setResult("S", "정상적으로 등록되었습니다."); + } else { + cmmVO.setResult("F", "등록에 실패하였습니다."); + } + + } catch (Exception e) { + cmmVO.setResult("F", "등록에 실패하였습니다. 게시물을 재확인 바랍니다."); + } + + return cmmVO; + } + + @Override + public BbsItemVO selectBbsDetail(String bbsId) throws Exception { + BbsItemVO bbsItem = new BbsItemVO(); + bbsItem.setBbsId(bbsId); + return selectBbsDetail(bbsItem); + } + + @Override + public BbsItemVO selectBbsDetail(BbsItemVO bbsItem) throws Exception { + return bbsDAO.selectBbsDetail(bbsItem); + } + + @Override + public CmmBaseVO deleteBbsDetail(BbsItemVO bbsItem) throws Exception { + + CmmBaseVO cmmVO = new CmmBaseVO(); + + try { + int status = bbsDAO.deleteBbsDetail(bbsItem); + + if(status > 0) { + cmmVO.setResult("S", "정상적으로 삭제되었습니다."); + } else { + cmmVO.setResult("F", "삭제에 실패하였습니다."); + } + + } catch (Exception e) { + cmmVO.setResult("F", "삭제에 실패하였습니다. 게시물을 재확인 바랍니다."); + } + + return cmmVO; + } + + @Override + public CmmBaseVO updateBbsDetail(BbsItemVO bbsItem) throws Exception { + + CmmBaseVO cmmVO = new CmmBaseVO(); + + try { + int status = bbsDAO.updateBbsDetail(bbsItem); + + if(status > 0) { + cmmVO.setResult("S", "정상적으로 수정되었습니다."); + } else { + cmmVO.setResult("F", "수정에 실패하였습니다."); + } + + } catch (Exception e) { + cmmVO.setResult("F", "수정에 실패하였습니다. 게시물을 재확인 바랍니다."); + } + + return cmmVO; + } + + @Override + public String selectSysEnvrnInfo(String atrbCode) throws Exception { + return bbsDAO.selectSysEnvrnInfo(atrbCode); + } + +} diff --git a/src/main/java/kccf/bbs/vo/AreaInfoVO.java b/src/main/java/kccf/bbs/vo/AreaInfoVO.java new file mode 100644 index 0000000..972769f --- /dev/null +++ b/src/main/java/kccf/bbs/vo/AreaInfoVO.java @@ -0,0 +1,52 @@ +package kccf.bbs.vo; + +import kccf.cmm.vo.CmmBaseVO; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +/** + * LclttInfoVO.java + * Description : 지역별 정보를 담는 VO + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-11-30 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-11-30   JAJEONG      최초 생성
    + *  
    + * 
    + */ + +@Setter +@Getter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class AreaInfoVO extends CmmBaseVO{ + + private String cntntsSeCode; /* 컨텐츠구분코드 */ + private String cntntsGroupId; /* 컨텐츠그룹ID */ + private String cntntsId; /* 컨텐츠ID */ + private String areaCode; /* 시도지역코드 */ + private String pdBgnde; /* 기간시작일자 */ + private String pdEndde; /* 기간종료일자 */ + private String beginHm; /* 시작시분 */ + private String endHm; /* 종료시분 */ + private String adres; /* 주소 */ + private String buldPlaceNm; /* 건물장소명 */ + private String sj; /* 제목 */ + private String cntntsCn; /* 내용 */ + private String tag; /* 태그 */ + + /* OTHER */ + private String areaNm; /* 시도지역코드명 */ + private String optionCode; /* 등록 수정 확인코드 */ + +} diff --git a/src/main/java/kccf/bbs/vo/AttachmentVO.java b/src/main/java/kccf/bbs/vo/AttachmentVO.java new file mode 100644 index 0000000..dd3abe8 --- /dev/null +++ b/src/main/java/kccf/bbs/vo/AttachmentVO.java @@ -0,0 +1,74 @@ +package kccf.bbs.vo; + +import java.text.DecimalFormat; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +/** + * AttachmentVO.java + * Description : 첨부파일 정보를 담는 VO + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-09-27 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-09-27   JAJEONG      최초 생성
    + *  
    + * 
    + */ + +@Setter +@Getter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class AttachmentVO { + + private String atchmnflId; /* 첨부파일ID */ + private String cntntsSeCode; /* 컨텐츠구분코드 */ + private String cntntsGroupId; /* 컨텐츠그룹ID */ + private String cntntsId; /* 컨텐츠ID */ + private int sortSn; /* 정렬순번 */ + private long fileSize; /* 파일크기 */ + private String fileTyCode; /* 파일유형코드 */ + private String extsn; /* 확장자 */ + private String filePhysiclNm; /* 파일물리명 */ + private String fileLogicNm; /* 파일논리명 */ + private String flpth; /* 파일경로 */ + private String regUserId; /* 등록자ID */ + private String regDttm; /* 등록일시 */ + + private String dataSeCode; /* 데이터구분코드 */ + private String preUrl; /* 데이터경로 */ + + private String thumbUrl; /* 썸네일경로 */ + + public void setFileSize (int fileSize) { + this.fileSize = fileSize; + } + + public String getFileSizeFormatted() { + + String formedFileSize = ""; + Double size = (double)this.fileSize; + String[] s = {"bytes", "KB", "MB", "GB"}; + + if(size != 0) { + int idx = (int)Math.floor(Math.log(size)/Math.log(1024)); + DecimalFormat df = new DecimalFormat("#,###.##"); + double ret = (size/Math.pow(1024, Math.floor(idx))); + formedFileSize = df.format(ret)+" "+s[idx]; + } else { + formedFileSize = "0 " + s[0]; + } + return formedFileSize; + } +} diff --git a/src/main/java/kccf/bbs/vo/BbsItemVO.java b/src/main/java/kccf/bbs/vo/BbsItemVO.java new file mode 100644 index 0000000..7b388b6 --- /dev/null +++ b/src/main/java/kccf/bbs/vo/BbsItemVO.java @@ -0,0 +1,91 @@ +package kccf.bbs.vo; + +import java.util.List; + +import kccf.cmm.vo.CmmBaseVO; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +/** + * BbsItemVO.java + * Description : 게시판 정보를 담는 VO + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-09-26 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-09-26   JAJEONG      최초 생성
    + *  
    + * 
    + */ + +@Setter +@Getter +@ToString +@NoArgsConstructor +@AllArgsConstructor + +public class BbsItemVO extends CmmBaseVO { + + private String bbsId; /* 게시판 ID */ + private String bbsNm; /* 게시판명 */ + private String siteSeCode; /* 사이트구분코드 */ + private String bbsTyCode; /* 게시판유형코드 */ + private String dcCn; /* 설명내용 */ + private String cnEditrTyCode; /* 내용에디터유형코드 */ + private String pdInfoUseYn; /* 기간정보사용여부 */ + private String pdInfoNm; /* 기간정보명 */ + private String deInfoUseYn1; /* 일자정보사용여부1 */ + private String deInfoNm1; /* 일자정보명1 */ + private String deInfoUseYn2; /* 일자정보사용여부2 */ + private String deInfoNm2; /* 일자정보명2 */ + private String deInfoUseYn3; /* 일자정보사용여부3 */ + private String deInfoNm3; /* 일자정보명3 */ + private String ctgryUseYn; /* 카테고리사용여부 */ + private String ctgryIemNm; /* 카테고리항목명 */ + private String ctgryCode; /* 카테고리코드 */ + private String areaCodeUseYn; /* 지역코드선택사용여부 */ + private String lclttUseYn; /* 지방문화원선택사용여부 */ + private String bsnsChoiseUseYn; /* 사업선택사용여부 */ + private String bsnsActChoiseUseYn; /* 사업활동선택사용여부 */ + private String upendNoticeUseYn; /* 상단공지사용여부 */ + private String tagUseAt; /* 태그사용여부 */ + private String codeChoiseUseYn; /* 코드선택사용여부 */ + private String cmmnCode; /* 공통코드 */ + private String codeNm; /* 코드명 */ + private String atchmnflUseYn; /* 첨부파일사용여부 */ + private String sortInputYn; /* 정렬입력여부 */ + private String thumbRegistYn; /* 썸네일등록여부 */ + private int thumbWidthSize; /* 썸네일가로크기 */ + private int thumbHgSize; /* 썸네일높이크기 */ + private String inputIem1UseYn; /* 입력항목사용여부1 */ + private String inputIemNm1; /* 입력항목명1 */ + private String inputIem2UseYn; /* 입력항목사용여부2 */ + private String inputIemNm2; /* 입력항목명2 */ + private String inputIem3UseYn; /* 입력항목사용여부3 */ + private String inputIemNm3; /* 입력항목명3 */ + private String imageReszYn; /* 이미지크기조정여부 */ + private String sortMthdCode; /* 정렬방식코드 */ + private String useYn; /* 사용여부 */ + private String secretSntncUseYn; /* 비밀글선택사용여부 */ + private String secretSntncAuthCode; /* 비밀글관리자권한코드 */ + + private String menuId; /* 메뉴 ID */ + private int cmmnThumbWidthSize; /* 공통썸네일가로크기 */ + private int cmmnThumbHgSize; /* 공통썸네일높이크기 */ + private String bbsSeCode; /* 게시판 구분코드 활동 */ + private List nttList; /* 관련게시물리스트 */ + + private String dispTyCode; /* 화면표시유형코드: 활동갤러리 A 문화원갤러리 L 실버문화페스티벌사진전 S */ + private String nttId; /* 게시판디테일 조회시 사용 */ + private String searchBbsId; /* 검색 게시판ID */ + + +} diff --git a/src/main/java/kccf/bbs/vo/BbsNttItemVO.java b/src/main/java/kccf/bbs/vo/BbsNttItemVO.java new file mode 100644 index 0000000..4db7f57 --- /dev/null +++ b/src/main/java/kccf/bbs/vo/BbsNttItemVO.java @@ -0,0 +1,198 @@ +package kccf.bbs.vo; + +import java.util.List; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.multipart.MultipartFile; + +import com.mchange.v2.cfg.PropertiesConfigSource.Parse; + +import kccf.cmm.vo.CmmBaseVO; +import kccf.util.StrUtil; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +/** + * BbsNttItemVO.java + * Description : 게시물 정보를 담는 VO + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-09-27 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-09-27   JAJEONG      최초 생성
    + *  
    + * 
    + */ + +@Setter +@Getter +@ToString +@NoArgsConstructor +@AllArgsConstructor + +public class BbsNttItemVO extends CmmBaseVO { + + /* KF_BBS_NTT */ + private String nttId; /* 게시물 ID */ + private String bbsId; /* 게시판 ID */ + private String bbsNm; /* 게시판명 */ + private String sj; /* 제목 */ + private String cntntsCn; /* 내용 */ + private String tag; /* 태그 */ + private String upendNoticeYn; /* 상단공지여부 */ + private String upendNoticeBgnde; /* 상단공지시작일자 */ + private String upendNoticeEndde; /* 상단공지종료일자 */ + private String pdBgnde; /* 기간시작일자 */ + private String pdEndde; /* 기간종료일자 */ + private String aditIemDe1; /* 추가항목일자1 */ + private String aditIemDe2; /* 추가항목일자2 */ + private String aditIemDe3; /* 추가항목일자3 */ + private String areaCode; /* 시도지역코드 */ + private String lclttId; /* 지방문화원 ID */ + private String bsnsId; /* 사업 ID */ + private String actId; /* 활동 ID */ + private String ctgryCode; /* 카테고리코드 */ + private String thumbUrl; /* 썸네일 URL */ + private String mvpUrl; /* 첨부파일 URL */ + private String refrnNttId; /* 참조게시물 ID */ + private String aditCodeIemValue; /* 추가코드항목값 */ + private String aditInputIemValue1; /* 추가입력항목값1 */ + private String aditInputIemValue2; /* 추가입력항목값2 */ + private String aditInputIemValue3; /* 추가입력항목값3 */ + private String aditSortValue; /* 추가정렬값 */ + private String secretSntncYn; /* 비밀글여부 */ + private int rdcnt; /* 조회수 */ + + /* KF_BBS_NTT_NTC_VIEW, KF_BBS_NTT_EVT_VIEW */ + private String dataSeCode; /* 데이터코드 : A(개편DB), B(지방문화원DB) */ + private String preUrl; /* 연결서버URL */ + private String kccfAddr; /* 연결서버 */ + + /* KF_BBS_NTT_SEARCH_INFO */ + private String cnText; /* 내용텍스트 */ + private String searchInfoCn; /* 검색정보내용 */ + + /* KF_AREA_INFO */ + private String cntntsSeCode; /* 컨텐츠구분코드 */ + private String cntntsGroupId; /* 컨텐츠그룹ID */ + private String cntntsId; /* 컨텐츠ID */ + private String beginHm; /* 시작시분 */ + private String endHm; /* 종료시분 */ + private String adres; /* 주소 */ + private String buldPlaceNm; /* 건물장소명 */ + + /* OTHER */ + private String areaCodeNm; /* 시도지역명 */ + private String lclttNm; /* 지방문화원명 */ + private String lclttCode; /* 문화원 코드 (==lclttId) */ + private String ctgryNm; /* 카테고리코드 */ + private String filePhysiclNm; /* 파일물리명 */ + private String atchmnflId; /* 파일ID */ + private String bsnsNm; /* 사업명 */ + private String actNm; /* 활동명 */ + private String imageNames; /* 에디터 저장 이미지 물리명 */ + private MultipartFile thumbnail; /* 썸네일 파일 */ + private List attachment; /* 첨부파일 */ + private String menuId; /* 메뉴 ID */ + private String existContent; /* 기존 에디터 내용 */ + private String progressStatus; /* 진행상태(이벤트게시판) 진행중 Y 마감 N */ + private String bbsTyCode; /* G일반 P사진 T썸네일 M동영상 E이벤트 A문화원행사 R답글 */ + + private String bbsMergeYn; /* 2개 이상의 게시판 합병여부 */ + private String mvpType; /* 동영상 타입(동영상타입게시판) 비메오 V 유튜브 Y 일반 L */ + private String crseNm; /* 과정명(강의게시판) */ + private String fstvlNm; /* 축제명 */ + private String bbsSeCode; /* 게시판구분코드: 샤이니스타를찾아라 S 온라인배움터 강의 L 문화나눔한마당 강의 A 문화나눔한마당 과정 C 페스티벌사진전 P 동영상갤러리 M */ + private String dispTyCode; /* 화면표시유형코드: 활동갤러리 A 문화원갤러리 L 실버문화페스티벌사진전 S 설문조사 V */ + + private String fstiv; /* 실버문화페스티벌 NTT_ID */ + private List nttList; /* 관련게시물리스트 */ + + private String intgrBbsId; /* 통합 BBS_ID (활동갤러리, 문화원갤러리) */ + private String siteSeCode; /* 사이트구분코드 */ + private String yearCode; /* 활동연도 구분코드 */ + private String childNttId; /* 자식게시물 ID */ + + private String newYn; /* 신규게시물여부 */ + private int atchmnflCnt; /* 첨부파일개수 */ + + private String sortMthdCode; /* 정렬방식코드 */ + + private List authCodeList; /* 사용자권한코드리스트 */ + private boolean canReadOther; + private boolean canWrite; + private boolean canUpdate; + + public String getAditIemDe1Formatted() { + return StrUtil.formatDateStr(aditIemDe1); + } + + public String getAditIemDe2Formatted() { + return StrUtil.formatDateStr(aditIemDe2); + } + + public String getAditIemDe3Formatted() { + return StrUtil.formatDateStr(aditIemDe3); + } + + public String getUpendBgndeFormatted() { + return StrUtil.formatDateStr(upendNoticeBgnde); + } + + public String getUpendEnddeFormatted() { + return StrUtil.formatDateStr(upendNoticeEndde); + } + + public String getPdBgndeFormatted() { + return StrUtil.formatDateStr(pdBgnde); + } + + public String getPdEnddeFormatted() { + return StrUtil.formatDateStr(pdEndde); + } + + public String getPdBgndeFormatted1() { + return StrUtil.formatDateStr1(pdBgnde); + } + + public String getPdEnddeFormatted1() { + return StrUtil.formatDateStr1(pdEndde); + } + + public String getAditInput1Formatted() { + return StrUtil.formatDateStr1(aditInputIemValue1); + } + + public String getProgressFormatted() { + String status; + String crtDate = StrUtil.getTodayYyyymmdd(); + + if(StringUtils.isAllBlank(pdBgnde) || StringUtils.isAllBlank(pdEndde)) return "N"; + + try { + + if((Integer.parseInt(pdBgnde) <= Integer.parseInt(crtDate)) && + (Integer.parseInt(crtDate) <= Integer.parseInt(pdEndde))) { + status = "Y"; + } else { + status = "N"; + } + return status; + + } catch (Exception e) { + return "N"; + } + + } + + +} diff --git a/src/main/java/kccf/bbs/vo/BsnsActInfoVO.java b/src/main/java/kccf/bbs/vo/BsnsActInfoVO.java new file mode 100644 index 0000000..c5f37d9 --- /dev/null +++ b/src/main/java/kccf/bbs/vo/BsnsActInfoVO.java @@ -0,0 +1,44 @@ +package kccf.bbs.vo; + +import kccf.cmm.vo.CmmBaseVO; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +/** + * BbsNttItemVO.java + * Description : 사업별 활동 정보를 담는 VO + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-10-26 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-09-27   JAJEONG      최초 생성
    + *  
    + * 
    + */ + +@Setter +@Getter +@ToString +@NoArgsConstructor +@AllArgsConstructor + +public class BsnsActInfoVO extends CmmBaseVO{ + + private String actId; /* 활동 ID */ + private String actNm; /* 활동명 */ + private String bsnsId; /* 사업 ID */ + private String areaCode; /* 시도지역코드 */ + private String lclttId; /* 지방문화원 ID */ + private String actOperBgnde; /* 활동운영시작일자 */ + private String actOperEndde; /* 활동운영종료일자 */ + + +} diff --git a/src/main/java/kccf/bbs/vo/BsnsInfoVO.java b/src/main/java/kccf/bbs/vo/BsnsInfoVO.java new file mode 100644 index 0000000..dfa288a --- /dev/null +++ b/src/main/java/kccf/bbs/vo/BsnsInfoVO.java @@ -0,0 +1,41 @@ +package kccf.bbs.vo; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +/** + * BbsNttItemVO.java + * Description : 사업 정보를 담는 VO + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-10-26 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-09-27   JAJEONG      최초 생성
    + *  
    + * 
    + */ + +@Setter +@Getter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class BsnsInfoVO { + + private String bsnsId; /* 사업ID */ + private String bsnsNm; /* 사업명 */ + private String bsnsTypeCode; /* 사업유형코드 */ + private String bsnsSttusCode; /* 사업상태코드 */ + private String bsnsBgnde; /* 사업시작일자 */ + private String bsnsEndde; /* 사업종료일자 */ + + +} diff --git a/src/main/java/kccf/bbs/vo/CtgryInfoVO.java b/src/main/java/kccf/bbs/vo/CtgryInfoVO.java new file mode 100644 index 0000000..6715767 --- /dev/null +++ b/src/main/java/kccf/bbs/vo/CtgryInfoVO.java @@ -0,0 +1,44 @@ +package kccf.bbs.vo; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +/** + * CtgryInfoVO.java + * Description : 카테고리 코드 정보를 담는 VO + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-09-27 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-09-27   JAJEONG      최초 생성
    + *  
    + * 
    + */ + +@Setter +@Getter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class CtgryInfoVO { + + private String ctgryCode; /* 카테고리코드 */ + private String ctgryNm; /* 카테고리명 */ + private String upperCtgryCode; /* 상위카테고리코드 */ + private int sortSn; /* 정렬순번 */ + private String dcCn; /* 설명내용 */ + private String useYn; /* 사용여부 */ + private String regUserId; /* 등록자ID */ + private String regDttm; /* 등록일시 */ + private String updUserId; /* 수정자ID */ + private String updDttm; /* 수정일시 */ + +} diff --git a/src/main/java/kccf/bbs/vo/FAQItemVO.java b/src/main/java/kccf/bbs/vo/FAQItemVO.java new file mode 100644 index 0000000..aa4e304 --- /dev/null +++ b/src/main/java/kccf/bbs/vo/FAQItemVO.java @@ -0,0 +1,25 @@ +package kccf.bbs.vo; + +import kccf.cmm.vo.CmmBaseVO; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Setter +@Getter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class FAQItemVO extends CmmBaseVO{ + + private String nttId; + private String qestnCn; + private String answerCn; + private int sortSn; + private String deleteAt; + private String indictYn; + + private String hostId; +} diff --git a/src/main/java/kccf/bbs/vo/LclttInfoVO.java b/src/main/java/kccf/bbs/vo/LclttInfoVO.java new file mode 100644 index 0000000..0317976 --- /dev/null +++ b/src/main/java/kccf/bbs/vo/LclttInfoVO.java @@ -0,0 +1,52 @@ +package kccf.bbs.vo; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +/** + * LclttInfoVO.java + * Description : 지방문화원 정보를 담는 VO + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-09-27 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-09-27   JAJEONG      최초 생성
    + *  
    + * 
    + */ + +@Setter +@Getter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class LclttInfoVO { + + private String lclttId; /* 지방문화원ID */ + private String lclttNm; /* 지방문화원명 */ + private String areaCode; /* 시도지역코드 */ + private String telNo; /* 전화번호 */ + private String fxnum; /* 팩스번호 */ + private String email; /* 이메일 */ + private String zip; /* 우편번호 */ + private String hmpgUrl; /* 홈페이지URL */ + private String adres1; /* 주소1 */ + private String adres2; /* 주소2 */ + private String fondDe; /* 설립일자 */ + private String ledgrNm; /* 원장성명 */ + private String cntntsCn; /* 내용 */ + private String useYn; /* 사용여부 */ + private String regUserId; /* 등록자ID */ + private String regDttm; /* 등록일시 */ + private String updUserId; /* 수정자ID */ + private String updDttm; /* 수정일시 */ + +} diff --git a/src/main/java/kccf/bbs/vo/LectureItemVO.java b/src/main/java/kccf/bbs/vo/LectureItemVO.java new file mode 100644 index 0000000..9dbc612 --- /dev/null +++ b/src/main/java/kccf/bbs/vo/LectureItemVO.java @@ -0,0 +1,61 @@ +package kccf.bbs.vo; + +import java.util.List; + +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.multipart.MultipartFile; + +import kccf.cmm.vo.CmmBaseVO; +import kccf.util.StrUtil; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +/** + * LectureItemVO.java + * Description : 강의 과정/강의 정보를 담는 VO + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-12-02 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-12-02   KNKIM      최초 생성
    + *  
    + * 
    + */ + +@Setter +@Getter +@ToString +@NoArgsConstructor +@AllArgsConstructor + +public class LectureItemVO extends BbsNttItemVO { + + /* 강의과정 정보 */ + private String onlineLectNttId; /* 과정 게시물 ID */ + private String onlineLectBbsId; /* 과정 게시판 ID */ + private String onlineLectBbsNm; /* 과정 게시판명 */ + private String onlineLectSj; /* 과정 제목 */ + private String onlineLectCntntsCn; /* 과정 소개내용 */ + private String onlineLectSeCode; /* 과정 온라인배움터강좌분류코드 */ + private String onlineLectSeName; /* 과정 온라인배움터강좌분류명 */ + private String onlineLectThumbUrl; /* 과정 썸네일 URL */ + private String onlineLectMvpUrl; /* 과정 동영상 URL */ + private String onlineLecturer; /* 과정 강사명 */ + private String onlineLectCtgryCode; /* 과정 카테고리 코드(영문) */ + private String onlineLectCtgryNum; /* 과정 카테고리 코드(숫자) */ + private String onlineLectParentCode; /* 과정 부모게시물 ID */ + private int onlineLectCnt; /* 과정 강의수 */ + private int onlineCourCnt; /* 과정 수 */ + + private String selMenuId; /**/ + private int startNo; /**/ + +} diff --git a/src/main/java/kccf/bbs/vo/SilverVO.java b/src/main/java/kccf/bbs/vo/SilverVO.java new file mode 100644 index 0000000..51b66c0 --- /dev/null +++ b/src/main/java/kccf/bbs/vo/SilverVO.java @@ -0,0 +1,58 @@ +package kccf.bbs.vo; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +/** + * LclttInfoVO.java + * Description : 어르신 실버문화페스티벌 정보를 담는 VO + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-11-28 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-11-28   JAJEONG      최초 생성
    + *  
    + * 
    + */ + +@Setter +@Getter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class SilverVO extends BbsNttItemVO { + + /* 샤이니스타를 찾아라 */ + private String fsj; /* 실버문화페스티벌 제목 */ + private String awardNm; /* 수상내역명 */ + private String teamNm; /* 팀명 */ + private String teamId; /* 팀ID */ + private int sortSn; /* 정렬순서 */ + private int subOrder; /* 팀별정렬순서 */ + + /* 문화나눔 한마당 */ + private String lectCnt; /* 한가지 과정에 포함된 강의수 */ + private String courSj; /* 과정명 */ + private String courCntn; /* 과정내용 */ + private String codeNm; /* 공통코드명 */ + + /* 축제의 현장사진전 */ + private String areaNm; /* 지역명 */ + private String ctgryNm; /* 카테고리명 */ + private int arn; /* 지역별 순서 */ + private int crn; /* 카테고리 순서 */ + private String dispTyCode; + + /* 역대실버문화 페스티벌 */ + private String silverYear; /* 연도(=aditInputIemValue1) */ + + +} \ No newline at end of file diff --git a/src/main/java/kccf/bbs/web/.idea/modules.xml b/src/main/java/kccf/bbs/web/.idea/modules.xml new file mode 100644 index 0000000..f589ca3 --- /dev/null +++ b/src/main/java/kccf/bbs/web/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/main/java/kccf/bbs/web/.idea/web.iml b/src/main/java/kccf/bbs/web/.idea/web.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/src/main/java/kccf/bbs/web/.idea/web.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/kccf/bbs/web/.idea/workspace.xml b/src/main/java/kccf/bbs/web/.idea/workspace.xml new file mode 100644 index 0000000..24b879f --- /dev/null +++ b/src/main/java/kccf/bbs/web/.idea/workspace.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + 1700814399555 + + + + \ No newline at end of file diff --git a/src/main/java/kccf/bbs/web/BbsController.java b/src/main/java/kccf/bbs/web/BbsController.java new file mode 100644 index 0000000..b6a817f --- /dev/null +++ b/src/main/java/kccf/bbs/web/BbsController.java @@ -0,0 +1,228 @@ +package kccf.bbs.web; + +import java.lang.invoke.MethodHandles; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; + +import egovframework.com.cmm.EgovMessageSource; +import kccf.auth.web.AuthUtil; +import kccf.bbs.service.BbsService; +import kccf.bbs.vo.BbsItemVO; +import kccf.cmm.vo.CmmBaseVO; +import kccf.cmm.web.CmmBaseController; +import kccf.env.web.EnvUtil; +import lombok.RequiredArgsConstructor; + +/** + * BbsController.java + * Description : 게시판관리 컨트롤러 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-09-26 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-09-26   JAJEONG      최초 생성
    + *  
    + * 
    + */ + +@Controller +@RequiredArgsConstructor +public class BbsController extends CmmBaseController{ + + private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + private final BbsService bbsService; + + private final EgovMessageSource egovMessage; + + private static int maxId = 0; + + /** + * Description : 게시판 정보 관리 화면을 표출한다. + * @param request + * @param model + * @param param1 + * @return + * @throws Exception + */ + @RequestMapping("/sec/bbs/viewBbsList.do") + public String viewBbsList(HttpServletRequest request, ModelMap model, String param1, BbsItemVO searchVO) throws Exception { + + model.addAttribute("searchVO", searchVO); + + return model.getAttribute("hostId") + "/bbs/bbsMasterList"; + } + + /** + * Description : 게시판 정보 관리 화면을 조회한다. + * @param searchVO + * @param model + * @return + */ + @PostMapping("/sec/bbs/getBbsListAjax.do") + public String getBbsListAjax(@RequestBody BbsItemVO searchVO, ModelMap model) throws Exception { + + List bbsList = bbsService.selectBbsList(searchVO); + + int totCnt = 0; + if(bbsList != null && bbsList.size() > 0) { + totCnt = bbsList.get(0).getTotCnt(); + } + searchVO.setTotCnt(totCnt); + + model.addAttribute("data", bbsList); + model.addAttribute("searchVO", searchVO); + + return "jsonView"; + } + + /** + * Description : 게시판 정보 관리 등록 화면을 표출한다. + * @param request + * @param model + * @return + * @throws Exception + */ + @GetMapping("/sec/bbs/viewBbsRgst.do") + public String viewBbsRgst(HttpServletRequest request, ModelMap model, BbsItemVO searchVO) throws Exception { + + model.addAttribute("searchVO", searchVO); + + BbsItemVO bbsItem = new BbsItemVO(); + + String widthSize = EnvUtil.getSysEnv("C", "cmmn.thumbnail.size.width"); + String heigthSize = EnvUtil.getSysEnv("C", "cmmn.thumbnail.size.height"); + bbsItem.setThumbWidthSize(Integer.parseInt(widthSize)); + bbsItem.setThumbHgSize(Integer.parseInt(heigthSize)); + + bbsItem.setRegUserNm(getUserNm()); + + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS"); + Date now = new Date(); + String formattedDate = dateFormat.format(now); + + maxId++; + String sequenceId = String.format("%04d", maxId); + + String bbsId = "N" + formattedDate + sequenceId; + bbsItem.setBbsId(bbsId); + + model.addAttribute("bbsItem", bbsItem); + + return model.getAttribute("hostId") + "/bbs/bbsMasterRgst"; + } + + /** + * Description : 게시판 정보 관리를 등록한다. + * @param bbsItem + * @return + */ + @PostMapping("/sec/bbs/getBbsRgstAjax.do") + public ResponseEntity getBbsRgstAjax(@RequestBody BbsItemVO bbsItem) throws Exception { + + CmmBaseVO cmmVO = null; + + if(bbsItem == null) { + cmmVO = new CmmBaseVO(); + cmmVO.setResult("F", "저장할 게시물 정보가 존재하지 않습니다."); + } else { + bbsItem.setRegUserId(getUserId()); + bbsItem.setUpdUserId(getUserId()); + cmmVO = bbsService.insertBbsDetail(bbsItem); + } + + return ResponseEntity.ok(cmmVO); + } + + /** + * Description : 게시판 정보 관리 상세 및 수정 화면을 표출한다. + * @param request + * @param model + * @param bbsId + * @return + * @throws Exception + */ + @GetMapping("/sec/bbs/viewBbsDetail.do") + public String viewBbsDetail(HttpServletRequest request, ModelMap model, BbsItemVO searchVO) throws Exception{ + + BbsItemVO bbsDetail = bbsService.selectBbsDetail(searchVO.getBbsId()); + + String menuId = (String) model.getAttribute("selMenuId"); + bbsDetail.setMenuId(menuId); + + if(bbsDetail.getThumbRegistYn().equals("N")) { + String widthSize = bbsService.selectSysEnvrnInfo("cmmn.thumbnail.size.width"); + String heigthSize = bbsService.selectSysEnvrnInfo("cmmn.thumbnail.size.height"); + bbsDetail.setCmmnThumbWidthSize(Integer.parseInt(widthSize)); + bbsDetail.setCmmnThumbHgSize(Integer.parseInt(heigthSize)); + } + + model.addAttribute("searchVO", searchVO); + model.addAttribute("bbsDetail", bbsDetail); + + return model.getAttribute("hostId") + "/bbs/bbsMasterUpdt"; + } + + /** + * Description : 게시판 정보 관리를 수정한다. + * @param bbsItem + * @return + */ + @PostMapping("/sec/bbs/updateBbsDetail.do") + public ResponseEntity updateBbsDetail(@RequestBody BbsItemVO bbsItem) throws Exception { + + CmmBaseVO cmmVO = null; + + if(bbsItem == null) { + cmmVO = new CmmBaseVO(); + cmmVO.setResult("F", "저장할 게시물 정보가 존재하지 않습니다."); + } else { + bbsItem.setUpdUserId(getUserId()); + cmmVO = bbsService.updateBbsDetail(bbsItem); + } + + return ResponseEntity.ok(cmmVO); + } + + /** + * Description : 게시판 정보 관리를 삭제한다. + * @param bbsId + * @return + */ + @PostMapping("/sec/bbs/deleteBbsMaster.do") + public ResponseEntity deleteBbsMaster(@RequestBody BbsItemVO bbsItem) throws Exception { + + CmmBaseVO cmmVO = null; + + if(bbsItem == null) { + cmmVO = new CmmBaseVO(); + cmmVO.setResult("F", "삭제할 게시판 정보가 존재하지 않습니다."); + } else { + cmmVO = bbsService.deleteBbsDetail(bbsItem); + } + + return ResponseEntity.ok(cmmVO); + } + + + + +} diff --git a/src/main/java/kccf/bbs/web/BbsNttController.java b/src/main/java/kccf/bbs/web/BbsNttController.java new file mode 100644 index 0000000..917ca1e --- /dev/null +++ b/src/main/java/kccf/bbs/web/BbsNttController.java @@ -0,0 +1,1084 @@ +package kccf.bbs.web; + +import java.lang.invoke.MethodHandles; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.ResponseEntity; +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 egovframework.com.cmm.EgovMessageSource; +import egovframework.com.cmm.service.EgovCmmUseService; +import egovframework.com.cmm.service.EgovFileMngService; +import kccf.auth.web.AuthUtil; +import kccf.bbs.service.BbsNttService; +import kccf.bbs.service.BbsService; +import kccf.bbs.vo.AreaInfoVO; +import kccf.bbs.vo.AttachmentVO; +import kccf.bbs.vo.BbsItemVO; +import kccf.bbs.vo.BbsNttItemVO; +import kccf.bbs.vo.FAQItemVO; +import kccf.bbs.vo.LectureItemVO; +import kccf.bbs.vo.SilverVO; +import kccf.cmm.vo.CmmBaseVO; +import kccf.cmm.vo.CmmCodeVO; +import kccf.cmm.web.CmmBaseController; +import kccf.code.service.CmmDetailCodeService; +import kccf.code.service.CtgryCodeService; +import kccf.code.vo.CmmDetailCodeVO; +import kccf.code.vo.CtgryCodeVO; +import kccf.env.web.EnvUtil; +import lombok.RequiredArgsConstructor; +/** + * BbsNttController.java + * Description : 게시물 컨트롤러 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-09-26 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-09-26   JAJEONG      최초 생성
    + *  
    + * 
    + */ + +@Controller +@RequiredArgsConstructor +public class BbsNttController extends CmmBaseController{ + + private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + private final BbsNttService bbsNttService; + + private final BbsService bbsService; + + private final CtgryCodeService ctgryCodeService; + + private final CmmDetailCodeService cmmDetailCodeService; + + private final EgovCmmUseService cmmUseService; + + private final EgovMessageSource egovMessageSource; + + @Resource(name = "EgovFileMngService") + private EgovFileMngService fileService; + + /** + * Description : 게시물 목록 화면을 표출한다. + * @param request + * @param model + * @param param1 + * @return + * @throws Exception + */ + @RequestMapping({"/sec/bbs/list.do","/bbs/list.do"}) + public String viewBbsNttList(HttpServletRequest request, ModelMap model, BbsItemVO searchBbsItem, BbsNttItemVO searchVO) throws Exception { + + // 게시판번호 통합일 때 동영상 타입으로 조회화면 구성(활동갤러리, 문화원갤러리) + if(!StringUtils.isAllBlank(searchVO.getIntgrBbsId())) { + searchBbsItem.setBbsId(searchVO.getIntgrBbsId().substring(searchVO.getIntgrBbsId().lastIndexOf(",")+1)); + } + + // 신규등록 가능 권한 + searchVO.setCanWrite(AuthUtil.canWrite(getUserId(), getSiteSeCode(), getSelMenuId(), searchVO.getBbsId())); + + BbsItemVO bbsItem = bbsService.selectBbsDetail(searchBbsItem); + BbsItemVO retBbsItem = getRelBbsInfo(bbsItem); + + // 공통 코드 + List aditCodeItem = null; + + if(!StringUtils.isAllBlank(bbsItem.getCmmnCode())) { + CmmDetailCodeVO cmmDetailCodeVO = new CmmDetailCodeVO(); + cmmDetailCodeVO.setCode(bbsItem.getCmmnCode()); + cmmDetailCodeVO.setIndictYn("Y"); + aditCodeItem = cmmDetailCodeService.selectListCmmDetailCode(cmmDetailCodeVO); + } + + String bbsId[] = null; + if(bbsItem.getBbsTyCode().equals("M")) { + bbsId = searchVO.getBbsId().split(","); + model.addAttribute("pTyBbsId", bbsId[0]); + } + // 실버문화페스티벌 홍보안내 + if(!StringUtils.isAllBlank(searchVO.getDispTyCode()) && searchVO.getDispTyCode().equals("I")) { + List silverList = bbsNttService.selectBbsNttList(searchVO); + model.addAttribute("silverNtt", silverList); + } + + String searchAreaCode = request.getParameter("areaCode"); + String searchLclttId = request.getParameter("lclttId"); + model.addAttribute("searchVO", searchVO); + model.addAttribute("bbsMenu", bbsItem); + model.addAttribute("aditCodeItem", aditCodeItem); + model.addAttribute("nttList", retBbsItem.getNttList()); + model.addAttribute("searchAreaCode", searchAreaCode); + model.addAttribute("searchLclttId", searchLclttId); + model.addAttribute("selMenuId", getSelMenuId()); + + if(searchVO.getBbsId().equals(EnvUtil.getSysEnv("C", "bbs.popup.id"))){ + return getHostId() + "/bbs/o/uList"; + } else if(searchVO.getBbsId().equals("N000000000000000000020") || searchVO.getBbsId().equals("N000000000000000000021")) { + return getHostId() + "/bbs/a/aList"; + } else { + String bbsTyCode = bbsItem.getBbsTyCode().toLowerCase(); + return getHostId() + "/bbs/" + bbsTyCode + "/" + bbsTyCode + "List"; + } + } + + /** + * Description : 게시물 목록을 조회한다. + * @param bbsNttItem + * @return + */ + @PostMapping({"/sec/bbs/getBbsNttListAjax.do","/bbs/getBbsNttListAjax.do"}) + public String getBbsNttListAjax(@RequestBody BbsNttItemVO searchVO, ModelMap model) throws Exception { + + if(!StringUtils.isAllBlank(searchVO.getIntgrBbsId())) { + searchVO.setBbsId(searchVO.getIntgrBbsId()); + } + List bbsNttList = bbsNttService.selectBbsNttList(searchVO); + + int topTotCnt = 0; + int listTotCnt = 0; + // totle Count 조회 + if(bbsNttList != null && bbsNttList.size() > 0) { + + topTotCnt = bbsNttList.get(0).getTotCnt(); + listTotCnt = bbsNttList.size(); + String upendYn = bbsNttList.get(0).getUpendNoticeYn(); + + searchVO.setTotCnt(topTotCnt); + + if(upendYn.equals("Y") && listTotCnt != topTotCnt) { + int exceptTop = bbsNttList.get(topTotCnt).getTotCnt(); + searchVO.setTotCnt(exceptTop); + } + } + model.addAttribute("data", bbsNttList); + model.addAttribute("searchVO", searchVO); + + return "jsonView"; + } + + /** + * Description : (관리자) 댓글 게시물 목록을 조회한다. + * @param bbsNttItem + * @return + */ + @PostMapping({"/sec/bbs/getReplyListAjax.do","/bbs/getReplyListAjax.do"}) + public String getReplyListAjax(@RequestBody BbsNttItemVO searchVO, ModelMap model) throws Exception { + + // 전문가 컨설팅 + if(searchVO.getMenuId().equals("MM0115") ) { + boolean readOther = AuthUtil.canReadOthers(getUserId(), getSiteSeCode(), searchVO.getMenuId(), searchVO.getBbsId()); + searchVO.setCanReadOther(readOther); + searchVO.setRegUserId(getUserId()); + } + + List bbsNttList = bbsNttService.selectReplyList(searchVO); + + int totCnt = 0; + if(bbsNttList != null && bbsNttList.size() > 0) { + totCnt = bbsNttList.get(0).getTotCnt(); + searchVO.setTotCnt(totCnt); + String upendYn = bbsNttList.get(0).getUpendNoticeYn(); + + if(upendYn.equals("Y")) { + + int exceptTop; + if(totCnt == 1) { + exceptTop = bbsNttList.get(totCnt-1).getTotCnt(); + } else { + exceptTop = bbsNttList.get(totCnt).getTotCnt(); + } + searchVO.setTotCnt(exceptTop); + } + } + model.addAttribute("data", bbsNttList); + model.addAttribute("searchVO", searchVO); + + return "jsonView"; + } + + + /** + * Description : (어르신) 실버문화 페스티벌이란? 화면을 표출한다. + * @param bbsNttItem + * @return + */ + @RequestMapping("/bbs/silver.do") + public String viewSilverCultureFestival(ModelMap model) throws Exception { + + List silverFestiv = bbsNttService.selectSilverFestival(); + model.addAttribute("silverFestiv", silverFestiv); + + return getHostId() + "/bbs/o/vList"; + } + + /** + * Description : (어르신) 샤이니스타를찾아라 화면을 표출한다. + * @param bbsNttItem + * @return + */ + @RequestMapping("/bbs/star.do") + public String viewSilverShinStar(SilverVO silverVO, ModelMap model) throws Exception { + + silverVO.setAditInputIemValue2("Y"); + // 샤이니스타를 찾아라 게시물들의 최신 연도 + String year = ""; + if(StringUtils.isAllBlank(silverVO.getSilverYear())) { + SilverVO silver = bbsNttService.selectFestivalLastYearForStar(silverVO); + if(silver != null) { + silverVO.setSilverYear(silver.getSilverYear()); + year = silver.getSilverYear(); + } + } + List shinList = bbsNttService.selectShinList(silverVO); + + List preList = new ArrayList(); + List teamList = new ArrayList(); + if(shinList != null) { + for(int i=0, len=shinList.size(); i cmCodeList = bbsNttService.selectCmCodeList(); + List courseList = bbsNttService.selectCourseList(silverVO); + List cultureList = bbsNttService.selectCultureList(silverVO); + + model.addAttribute("cmCodeList", cmCodeList); + model.addAttribute("courseList", courseList); + model.addAttribute("cultureList", cultureList); + + + return getHostId() + "/bbs/o/cList"; + } + + /** + * Description : (어르신) 축제의 현장사진전 화면을 표출한다. + * @param bbsNttItem + * @return + * @throws Exception + */ + @RequestMapping({"/sec/bbs/festival.do", "/bbs/festival.do"}) + public String viewSilverFestival(HttpServletRequest request, SilverVO silverVO, ModelMap model, CtgryCodeVO ctgryVO) throws Exception { + + if (request.getRequestURI().equals("/bbs/festival.do")) { + List ctgryInfo = ctgryCodeService.selectListCtgry(ctgryVO); + + // 페스티벌 사진전 게시물들의 최신 연도 + if(StringUtils.isAllBlank(silverVO.getSilverYear())) { + SilverVO silver = bbsNttService.selectFestivalLastYearForPhoto(silverVO); + if(silver != null) { + silverVO.setSilverYear(silver.getSilverYear()); + } + } + List festivalList = bbsNttService.selectFestivalList(silverVO); + + + model.addAttribute("ctgryInfo", ctgryInfo); + model.addAttribute("ctgryList", festivalList); + model.addAttribute("areaList", festivalList); + model.addAttribute("festivalList", festivalList); + } + + model.addAttribute("searchVO", silverVO); + + return getHostId() + "/bbs/o/fList"; + } + + /** + * Description : (관리자) 축제의 현장사진전 화면을 표출한다. + * @param bbsNttItem + * @return + * @throws Exception + */ + @RequestMapping("/sec/bbs/festivalAjax.do") + public String silverFestivalAjax(@RequestBody SilverVO searchVO, ModelMap model) throws Exception { + + List festivalList = bbsNttService.selectFestivalPhotoList(searchVO); + + int totCnt = 0; + // totle Count 조회 + if(festivalList != null && festivalList.size() > 0) { + totCnt= festivalList.get(0).getTotCnt(); + searchVO.setTotCnt(totCnt); + } + + model.addAttribute("data", festivalList); + model.addAttribute("searchVO", searchVO); + + return "jsonView"; + } + + /** + * Description : (어르신) 지역별 실버문화 페스티벌 화면을 표출한다. + * @param bbsNttItem + * @return + * @throws Exception + */ + @RequestMapping("/bbs/area.do") + public String viewSilverArea(SilverVO silverVO, ModelMap model) throws Exception { + + CmmCodeVO CmmCode = new CmmCodeVO(); + CmmCode.setCode("AREA_CODE"); + List areaCode = cmmUseService.selectCmmCode(CmmCode); + + String lastFestivalYear = bbsNttService.selectFestivalLastYear(); + if(lastFestivalYear != null) { + silverVO.setSilverYear(lastFestivalYear); + } + + model.addAttribute("areaCode", areaCode); + model.addAttribute("searchVO", silverVO); + + return getHostId() + "/bbs/o/aList"; + } + + /** + * Description : (어르신) 지역별 실버문화 페스티벌 화면을 표출한다. + * @param bbsNttItem + * @return + * @throws Exception + */ + @PostMapping("/bbs/getAreaSilverAjax.do") + public String getAreaSilverAjax(@RequestBody SilverVO silverVO, ModelMap model) throws Exception { + + silverVO.setAditInputIemValue2("Y"); + + String lastFestivalYear = bbsNttService.selectFestivalLastYear(); + if(lastFestivalYear != null) { + silverVO.setSilverYear(lastFestivalYear); + } + + //샤이니스타 + String star = EnvUtil.getSysEnvIf("C", "bbs.shin.star.id", ""); + silverVO.setBbsId(star); + List shinList = bbsNttService.selectShinList(silverVO); + + //실버문화페스티벌 홍보안내 지역정보(일자, 시간, 장소) + if(shinList != null && shinList.size() > 0) { + BbsNttItemVO bbsNttVO = new BbsNttItemVO(); + bbsNttVO.setNttId(shinList.get(0).getRefrnNttId()); + bbsNttVO.setAreaCode(silverVO.getAreaCode()); + List areaInfo = bbsNttService.selectAreaInfo(bbsNttVO); + if(!areaInfo.isEmpty()) { + model.addAttribute("areaInfo", areaInfo.get(0)); + } + } + + //문화나눔 한마당 + silverVO.setBbsId("N000000000000000000014"); + List cultureList = bbsNttService.selectCultureList(silverVO); + + //축제의 현장사진전 + silverVO.setBbsId("N000000000000000000032"); + List festivalList = bbsNttService.selectFestivalList(silverVO); + + model.addAttribute("shinList", shinList); + model.addAttribute("cultureList", cultureList); + model.addAttribute("festivalList", festivalList); + + return "jsonView"; + } + + /** + * Description : (어르신) 역대 실버문화 페스티벌 화면을 표출한다. + * @param bbsNttItem + * @return + * @throws Exception + */ + @RequestMapping("/bbs/history.do") + public String viewSilverHistory(SilverVO silverVO, ModelMap model, @ModelAttribute("searchVO") BbsNttItemVO searchVO) throws Exception { + + //실버문화페스티벌 안내 + searchVO.setAditInputIemValue2("Y"); + String festiv = EnvUtil.getSysEnvIf("C", "bbs.festival.id", ""); + searchVO.setBbsId(festiv); + List silverList = bbsNttService.selectBbsNttList(searchVO); + if(StringUtils.isAllBlank(searchVO.getNttId())) { + searchVO.setNttId(silverList.get(0).getNttId()); + silverVO.setNttId(silverList.get(0).getNttId()); + } + BbsNttItemVO silverDetail = bbsNttService.selectBbsNttDetail(searchVO.getNttId()); + + //실버관련 카테고리 동영상 최신 게시물 2개 + List mvpList = bbsNttService.selectHistoryMvpList(silverVO); + + //샤이니스타 + String star = EnvUtil.getSysEnvIf("C", "bbs.shin.star.id", ""); + silverVO.setBbsId(star); + List shinList = bbsNttService.selectShinList(silverVO); + + List preList = new ArrayList(); + List teamList = new ArrayList(); + if(shinList != null) { + for(int i=0, len=shinList.size(); i cmCodeList = bbsNttService.selectCmCodeList(); + List courseList = bbsNttService.selectCourseList(silverVO); + List cultureList = bbsNttService.selectCultureList(silverVO); + + model.addAttribute("preList", preList); // 샤이니 예선 + model.addAttribute("teamList", teamList); // 샤이니 본선수상 + model.addAttribute("mvpList", mvpList); + model.addAttribute("cmCodeList", cmCodeList); + model.addAttribute("courseList", courseList); + model.addAttribute("cultureList", cultureList); + model.addAttribute("silverDetail", silverDetail); + model.addAttribute("silverList", silverList); + + return getHostId() + "/bbs/o/hList"; + } + + /** + * Description : 게시물 등록 화면을 표출한다. + * @param model + * @return + * @throws Exception + */ + @GetMapping("/sec/bbs/cmmRgst.do") + public String viewBbsNttRgst(HttpServletRequest request, ModelMap model, BbsNttItemVO searchVO) throws Exception { + + BbsItemVO bbsItem = bbsService.selectBbsDetail(searchVO.getBbsId()); + + // 신규등록 가능 권한 + searchVO.setCanWrite(AuthUtil.canWrite(getUserId(), getSiteSeCode(), getSelMenuId(), searchVO.getBbsId())); + + // 공통 코드 + List aditCodeItem = null; + + if(!StringUtils.isAllBlank(bbsItem.getCmmnCode())) { + CmmDetailCodeVO cmmDetailCodeVO = new CmmDetailCodeVO(); + cmmDetailCodeVO.setCode(bbsItem.getCmmnCode()); + cmmDetailCodeVO.setIndictYn("Y"); + aditCodeItem = cmmDetailCodeService.selectListCmmDetailCode(cmmDetailCodeVO); + } + + BbsItemVO retBbsItem = getRelBbsInfo(bbsItem); + + CmmDetailCodeVO cmmSearchVO = new CmmDetailCodeVO(); + cmmSearchVO.setCode("SITE_SE_CODE"); + List siteList = cmmDetailCodeService.selectListCmmDetailCode(cmmSearchVO); + + model.addAttribute("selMenudId", getSelMenuId()); + model.addAttribute("bbsMenu", bbsItem); + model.addAttribute("searchVO", searchVO); + model.addAttribute("nttList", retBbsItem.getNttList()); + model.addAttribute("aditCodeItem", aditCodeItem); + model.addAttribute("siteList", siteList); + + if(searchVO.getBbsId().equals(EnvUtil.getSysEnv("C", "bbs.popup.id"))){ + return getHostId() + "/bbs/o/uRgst"; + } else { + return model.getAttribute("hostId") + "/bbs/cmmRgst"; + } + } + + /** + * Description : 강의 과정을 조회한다. + * @param bbsNttItem + * @param request + * @param model + * @return + * @throws Exception + */ + @PostMapping({"/sec/bbs/getCoursesAjax.do", "/bbs/getCoursesAjax.do"}) + public String getCoursesAjax(@RequestBody BbsNttItemVO searchVO, HttpServletRequest request, ModelMap model) throws Exception { + + String eduId = EnvUtil.getSysEnv("C", "bbs.edu.id"); + String lectureId = EnvUtil.getSysEnv("C", "bbs.edu.lecture.id"); + String cultureId = EnvUtil.getSysEnv("C", "bbs.culture.id"); + String articleId = EnvUtil.getSysEnv("C", "bbs.culture.article.id"); + + String bbsId = searchVO.getBbsId(); + List result = null; + + if(lectureId.equals(bbsId)) { + searchVO.setBbsId(eduId); + result = bbsNttService.selectCourseListForSec(searchVO); + } + if(articleId.equals(bbsId)) { + if(!StringUtils.isAllBlank(searchVO.getRefrnNttId()) && !StringUtils.isAllBlank(searchVO.getAditCodeIemValue())){ + searchVO.setBbsId(cultureId); + result = bbsNttService.selectCourseListForSec(searchVO); + } + } + + model.addAttribute("courses", result); + return "jsonView"; + } + + /** + * Description : 게시물 상세 화면을 표출한다. + * @param nttId + * @param model + * @return + * @throws Exception + */ + @GetMapping({"/sec/bbs/detail.do","/bbs/detail.do"}) + public String viewBbsNttDetail(HttpServletRequest request, ModelMap model, BbsItemVO searchBbsVO, BbsNttItemVO searchVO) throws Exception { + + if(kccf.auth.web.AuthUtil.canRead(getUserId(), getSiteSeCode(), getSelMenuId(), searchVO.getBbsId(), searchVO.getNttId())) { //상세보기 권한자 + + BbsItemVO bbsItem = bbsService.selectBbsDetail(searchBbsVO); + BbsNttItemVO bbsNttDetail; + if(searchVO.getBbsId().equals("N000000000000000000020") || searchVO.getBbsId().equals("N000000000000000000021")) { + bbsNttDetail = bbsNttService.selectBbsNttLclttDetail(searchVO); + bbsNttDetail.setBbsId(searchVO.getBbsId()); + }else { + bbsNttDetail = bbsNttService.selectBbsNttDetail(searchVO.getNttId()); + } + List attachFileNm = bbsNttService.getFilePhysiclNm(searchVO.getNttId()); + + BbsItemVO retBbsItem = getRelBbsInfo(bbsItem); + + // 비밀글 답변 쓰기 권한 + if(bbsItem.getSecretSntncUseYn().equals("Y")) { + searchVO.setCanWrite(AuthUtil.canWrite(getUserId(), getSiteSeCode(), getSelMenuId(), bbsNttDetail.getBbsId())); + } + // 수정 삭제 가능 권한 + searchVO.setCanUpdate(AuthUtil.canUpdate(getUserId(), getSiteSeCode(), getSelMenuId(), bbsNttDetail.getBbsId(), searchVO.getNttId())); + + // 실버문화페스티벌 홍보안내 + if(!StringUtils.isAllBlank(searchVO.getDispTyCode()) && searchVO.getDispTyCode().equals("I")) { + List areaDetail = bbsNttService.selectAreaInfo(searchVO); + model.addAttribute("areaDetail", areaDetail); + } + + model.addAttribute("paramVO", searchVO); + model.addAttribute("bbsMenu", bbsItem); + model.addAttribute("noticeDetail", bbsNttDetail); + model.addAttribute("fileNm", attachFileNm); + model.addAttribute("nttList", retBbsItem.getNttList()); + + String bbsTyCode = bbsItem.getBbsTyCode().toLowerCase(); + + if(searchVO.getBbsId().equals("N000000000000000000020") || searchVO.getBbsId().equals("N000000000000000000021")) { + return model.getAttribute("hostId") + "/bbs/a/aDetail"; + }else { + return model.getAttribute("hostId") + "/bbs/" + bbsTyCode + "/" + bbsTyCode + "Detail"; + } + + } else { + return model.getAttribute("hostId") + "/code404"; + } + } + + /** + * Description : 컨텐츠 게시물 상세 화면을 표출한다. + * @param nttId + * @param model + * @return + * @throws Exception + */ + @GetMapping({"/cntn/detail.do", "/sec/cntn/detail.do"}) + public String viewContentDetail(HttpServletRequest request, ModelMap model, BbsNttItemVO searchVO) throws Exception { + + BbsItemVO bbsItem = bbsService.selectBbsDetail(searchVO.getBbsId()); + BbsNttItemVO bbsNttDetail = bbsNttService.selectBbsNttDetail(searchVO.getNttId()); + List attachFileNm = bbsNttService.getFilePhysiclNm(searchVO.getNttId()); + + model.addAttribute("fileNm", attachFileNm); + model.addAttribute("bbsMenu", bbsItem); + model.addAttribute("noticeDetail", bbsNttDetail); + + return model.getAttribute("hostId") + "/bbs/cntn/detail"; + } + + /** + * Description : 컨텐츠 게시물 상세 화면을 표출한다. + * @param nttId + * @param model + * @return + * @throws Exception + */ + @RequestMapping({"/cntn/preview.do", "/sec/cntn/preview.do"}) + public String viewContentPreview(HttpServletRequest request, ModelMap model, BbsNttItemVO searchVO) throws Exception { + + BbsItemVO bbsItem = bbsService.selectBbsDetail(searchVO.getBbsId()); + + model.addAttribute("bbsMenu", bbsItem); + model.addAttribute("data", searchVO); + + return searchVO.getSiteSeCode() + "/bbs/cntn/preview"; + } + + /** + * Description : 게시물 수정 화면을 표출한다. + * @param request + * @param nttId + * @param model + * @return + * @throws Exception + */ + @GetMapping({"sec/bbs/cmmUpdt.do"}) + public String viewBbsNttUpdt(HttpServletRequest request, ModelMap model, BbsNttItemVO searchVO) throws Exception { + + BbsItemVO bbsItem = bbsService.selectBbsDetail(searchVO.getBbsId()); + BbsNttItemVO nttDetail = bbsNttService.selectBbsNttDetail(searchVO.getNttId()); + + // 저장 가능 권한 + searchVO.setCanUpdate(AuthUtil.canUpdate(getUserId(), getSiteSeCode(), getSelMenuId(), searchVO.getBbsId(), searchVO.getNttId())); + + // 공통 코드 + List aditCodeItem = null; + + if(!StringUtils.isAllBlank(bbsItem.getCmmnCode())) { + CmmDetailCodeVO cmmDetailCodeVO = new CmmDetailCodeVO(); + cmmDetailCodeVO.setCode(bbsItem.getCmmnCode()); + cmmDetailCodeVO.setIndictYn("Y"); + aditCodeItem = cmmDetailCodeService.selectListCmmDetailCode(cmmDetailCodeVO); + } + + CmmDetailCodeVO cmmSearchVO = new CmmDetailCodeVO(); + cmmSearchVO.setCode("SITE_SE_CODE"); + List siteList = cmmDetailCodeService.selectListCmmDetailCode(cmmSearchVO); + + // 강의 디테일 동영상 타입 구분 + if(!StringUtils.isAllBlank(bbsItem.getBbsTyCode()) && bbsItem.getBbsTyCode().equals("M")) { + String mvpUrl = nttDetail.getMvpUrl(); + String vimeo = EnvUtil.getSysEnv("C", "cmmn.vimeo.url"); + String youtube = EnvUtil.getSysEnv("C", "cmmn.youtube.url"); + + if(mvpUrl.contains(vimeo)) { + nttDetail.setMvpType("V"); + nttDetail.setMvpUrl(mvpUrl.replace(vimeo, "")); + } else if(mvpUrl.contains(youtube)) { + nttDetail.setMvpType("Y"); + nttDetail.setMvpUrl(mvpUrl.replace(youtube, "")); + } else { + nttDetail.setMvpType("L"); + } + } + + if(!StringUtils.isAllBlank(searchVO.getDispTyCode()) && searchVO.getDispTyCode().equals("I")) { + List areaDetail = bbsNttService.selectAreaInfo(searchVO); + model.addAttribute("areaDetail", areaDetail); + } + + BbsItemVO retBbsItem = getRelBbsInfo(bbsItem); + + model.addAttribute("paramVO", searchVO); + model.addAttribute("nttList", retBbsItem.getNttList()); + model.addAttribute("bbsMenu", bbsItem); + model.addAttribute("noticeDetail", nttDetail); + model.addAttribute("aditCodeItem", aditCodeItem); + model.addAttribute("siteList", siteList); + + if(searchVO.getBbsId().equals(EnvUtil.getSysEnv("C", "bbs.popup.id"))){ + return getHostId() + "/bbs/o/uUpdt"; + } else { + String jspName = "cmmUpdt"; + if("E".equals(bbsItem.getBbsTyCode()) || "R".equals(bbsItem.getBbsTyCode())) jspName = "cmmUpdtReply"; + + return model.getAttribute("hostId") + "/bbs/" + jspName; + } + } + + /** + * Description : 게시물을 등록한다. + * @param bbsNttItem + * @return + * @throws Exception + */ + @PostMapping("/sec/bbs/insertBbsNttAjax.do") + public ResponseEntity insertBbsNttAjax(@ModelAttribute BbsNttItemVO searchVO, ModelMap model) throws Exception { + + CmmBaseVO cmmVO = null; + + if(searchVO == null) { + cmmVO = new CmmBaseVO(); + cmmVO.setResult("F", "저장할 게시물 정보가 존재하지 않습니다."); + } else if(AuthUtil.canWrite(getUserId(), getSiteSeCode(), searchVO.getSelMenuId(), searchVO.getBbsId())) { + searchVO.setRegUserId(getUserId()); + searchVO.setUpdUserId(getUserId()); + cmmVO = bbsNttService.insertBbsNtt(searchVO); + } else { + cmmVO = new CmmBaseVO(); + cmmVO.setResult("F", "등록 권한이 없습니다. 사용자 권한을 확인해 주세요."); + } + + return ResponseEntity.ok(cmmVO); + } + + /** + * Description : 게시물을 수정한다. + * @param bbsNttItem + * @return + * @throws Exception + */ + @PostMapping("/sec/bbs/updateBbsNttAjax.do") + public ResponseEntity updateBbsNttAjax(@ModelAttribute BbsNttItemVO searchVO, ModelMap model) throws Exception { + + CmmBaseVO cmmVO = null; + + if(searchVO == null) { + cmmVO = new CmmBaseVO(); + cmmVO.setResult("F", "저장할 게시물 정보가 존재하지 않습니다."); + } else if(AuthUtil.canUpdate(getUserId(), getSiteSeCode(), searchVO.getSelMenuId(), searchVO.getBbsId(), searchVO.getNttId())) { + searchVO.setUpdUserId(getUserId()); + cmmVO = bbsNttService.updateBbsNtt(searchVO); + } else { + cmmVO = new CmmBaseVO(); + cmmVO.setResult("F", "수정 권한이 없습니다. 사용자 권한을 확인해 주세요."); + } + + return ResponseEntity.ok(cmmVO); + } + + /** + * Description : 게시물을 삭제한다. + * @param nttId + * @return + */ + @PostMapping("/sec/bbs/deleteBbsNttAjax.do") + public ResponseEntity deleteBbsNttAjax(String nttId) throws Exception { + + CmmBaseVO cmmVO = null; + + if(nttId == null) { + cmmVO = new CmmBaseVO(); + cmmVO.setResult("F", "삭제할 게시물 정보가 존재하지 않습니다."); + } else if(AuthUtil.canUpdate(getUserId(), getSiteSeCode(), getSelMenuId(), null, nttId)) { + cmmVO = bbsNttService.deleteBbsNtt(nttId); + } else { + cmmVO = new CmmBaseVO(); + cmmVO.setResult("F", "삭제 권한이 없습니다. 사용자 권한을 확인해 주세요."); + } + + return ResponseEntity.ok(cmmVO); + } + + /** + * Description : 실버문화페스티벌 지역정보 게시물을 등록한다. + * @param nttId + * @return + */ + @PostMapping("/sec/bbs/insertAreaInfoAjax.do") + public String insertAreaInfoAjax(@RequestBody AreaInfoVO searchAreaVO, ModelMap model) throws Exception { + + AreaInfoVO areaVO = null; + + if(searchAreaVO == null) { + areaVO = new AreaInfoVO(); + areaVO.setResult("F", "저장할 게시물 정보가 존재하지 않습니다."); + } else if(searchAreaVO.getOptionCode().equals("R")) { + searchAreaVO.setRegUserId(getUserId()); + searchAreaVO.setUpdUserId(getUserId()); + areaVO = bbsNttService.insertAreaInfo(searchAreaVO); + } else { + searchAreaVO.setUpdUserId(getUserId()); + areaVO = bbsNttService.updateAreaInfo(searchAreaVO); + } + + model.addAttribute("areaVO", areaVO); + + return "jsonView"; + } + + /** + * Description : 실버문화페스티벌 지역정보 게시물을 삭제한다. + * @param nttId + * @return + */ + @PostMapping("/sec/bbs/deleteAreaInfoAjax.do") + public ResponseEntity deleteAreaInfoAjax(@RequestBody AreaInfoVO searchAreaVO) throws Exception { + + bbsNttService.deleteAreaInfo(searchAreaVO); + + return ResponseEntity.ok(egovMessageSource.getMessage("success.common.delete")); + } + + /** + * Description : 게시물의 MENU_ID, SITE_SE_CODE, SITE_URL을 불러온다. + * @param bbsNttItem + * @return + * @throws Exception + */ + @ResponseBody + @PostMapping("/sec/bbs/selectBbsNttMenuInfoAjax.do") + public BbsNttItemVO selectBbsNttMenuInfoAjax(BbsNttItemVO searchVO) throws Exception { + return bbsNttService.selectBbsNttMenuInfo(searchVO); + } + + + @RequestMapping("/sec/bbs/registerAreaInfo.do") + public String registerAreaInfo(ModelMap model, SilverVO searchVO) throws Exception { + + //공통코드 + CmmCodeVO CmmCode = new CmmCodeVO(); + CmmCode.setCode("AREA_CODE"); + List areaCode = cmmUseService.selectCmmCode(CmmCode); + + model.addAttribute("areaCode", areaCode); + + return getHostId() + "/bbs/registerAreaInfoPopup"; + } + + /** + * Description : 자동완성할 게시판ID 리스트를 추출한다. + * @param String + * @return + * @throws Exception + */ + @RequestMapping("/sec/bbs/autocompleteBbsIdAjax.do") + public String selectBbsIdListAjax(HttpServletRequest request, ModelMap model) throws Exception{ + String input = request.getParameter("input"); + List bbsIdList = bbsNttService.selectBbsIdList(input); + model.addAttribute("locations", bbsIdList); + return "jsonView"; + } + + /** + * Description : 게시판 내 게시물들의 텍스트를 추출하여 저장한다. + * @param BbsNttItemVO + * @return + * @throws Exception + */ + @ResponseBody + @RequestMapping({"/sec/bbs/extractBbsNttTextAjax.do","/bbs/extractBbsNttTextAjax.do"}) + public String extractBbsNttTextAjax(BbsNttItemVO searchVO, ModelMap model) throws Exception{ + String userId = getUserId(); + if(StringUtils.isAllBlank(userId)) { + userId = "BATCH"; + } + searchVO.setAditInputIemValue1(userId); + BbsNttItemVO nttVO = bbsNttService.extractBbsNttText(searchVO); + model.addAttribute("nttVO", nttVO); + return "jsonView"; + } + + /** + * Description : 온라인배움터 화면을 표출한다. + * @param bbsNttItem + * @return + */ + @RequestMapping("/bbs/onlineEdu.do") + public String viewOnlineLecture(LectureItemVO searchVO, ModelMap model) throws Exception { + String selMenuId = searchVO.getSelMenuId(); + switch(selMenuId) { + case "MS0008": + searchVO.setOnlineLectCtgryNum("01"); + break; + case "MS0026": + searchVO.setOnlineLectCtgryNum("02"); + break; + case "MS0010": + searchVO.setOnlineLectCtgryNum("03"); + break; + default: + break; + } + searchVO.setPageSize(5); + + Map courses = bbsNttService.selectOnlineCourseList(searchVO); + List courseList = (List) courses.get("courseList"); + List lectureList = bbsNttService.selectOnlineLectureList(searchVO); + + model.addAttribute("totalPages", courses.get("totalPages")); + model.addAttribute("startPage",courses.get("startPage")); + model.addAttribute("endPage",courses.get("endPage")); + model.addAttribute("courseList", courseList); + model.addAttribute("lectureList", lectureList); + model.addAttribute("pageNo", searchVO.getPageNo()); + + return getHostId() + "/bbs/l/lList"; + } + + @PostMapping("/bbs/getLectureAjax.do") + public ResponseEntity getLectureAjax(@RequestBody BbsNttItemVO searchVO){ + + List lectureList = bbsNttService.selectLectureForPopup(searchVO); + + return ResponseEntity.ok(lectureList); + } + + @PostMapping("/bbs/getGalleryAjax.do") + public ResponseEntity getGalleryAjax(@RequestBody SilverVO searchVO){ + + //축제의 현장사진전 + String gallery = EnvUtil.getSysEnvIf("C", "bbs.photo.gallery.id", ""); + searchVO.setBbsId(gallery); + List galleryList = bbsNttService.selectGalleryForPopup(searchVO); + + return ResponseEntity.ok(galleryList); + } + + /** + * Description : 자주묻는질문 화면을 표출한다. + * @param FAQItemVO + * @return + */ + @RequestMapping({"/sec/bbs/viewFAQList.do","/bbs/viewFAQList.do"}) + public String viewFAQList(FAQItemVO searchVO, ModelMap model) throws Exception{ + + searchVO.setHostId(getHostId()); + List faqList = bbsNttService.selectFAQList(searchVO); + model.addAttribute("faqList", faqList); + + return getHostId() + "/bbs/cntn/faq"; + } + + + /** + * Description : 자주묻는질문 정보를 등록한다. + * @param FAQItemVO + * @return + */ + @RequestMapping("/sec/bbs/insertFAQAjax.do") + public ResponseEntity insertFAQ(FAQItemVO searchVO) throws Exception{ + + searchVO.setRegUserId(getUserId()); + searchVO.setUpdUserId(getUserId()); + CmmBaseVO cmmVO = bbsNttService.insertFAQInfo(searchVO); + + return ResponseEntity.ok(cmmVO); + } + /** + * Description : 자주묻는질문 정보를 수정한다. + * @param FAQItemVO + * @return + */ + @RequestMapping("/sec/bbs/updateFAQAjax.do") + public ResponseEntity updateFAQ(FAQItemVO searchVO) throws Exception{ + + searchVO.setUpdUserId(getUserId()); + CmmBaseVO cmmVO = bbsNttService.updateFAQInfo(searchVO); + + return ResponseEntity.ok(cmmVO); + } + /** + * Description : 자주묻는질문 정보를 삭제한다. + * @param FAQItemVO + * @return + */ + @RequestMapping("/sec/bbs/deleteFAQAjax.do") + public ResponseEntity deleteFAQ(FAQItemVO searchVO) throws Exception{ + + CmmBaseVO cmmVO = bbsNttService.deleteFAQInfo(searchVO); + + return ResponseEntity.ok(cmmVO); + } + + /** + * Description : 문화로청춘 소개 페이지를 표출한다. + * @param BbsNttItemVO + * @return + */ + @RequestMapping("/cntn/intrcn.do") + public String viewIntroduction(BbsNttItemVO searchVO, ModelMap model) throws Exception{ + + List nttList = bbsNttService.selectBbsNttList(searchVO); + List result = new ArrayList<>(); + AttachmentVO attachmentVO = new AttachmentVO(); + for(BbsNttItemVO ntt : nttList) { + attachmentVO.setCntntsId(ntt.getNttId()); + List fileList = fileService.selectFileListByCntntsId(attachmentVO); + for(AttachmentVO file : fileList) { + result.add(file); + } + } + model.addAttribute("fileList", result); + + return getHostId()+"/bbs/cntn/introduce"; + } + + + // 게시판 구분코드를 주기 위한 함수 + BbsItemVO getRelBbsInfo (BbsItemVO paramBbsItem) throws Exception { + BbsItemVO retItemVO = paramBbsItem; + + if(retItemVO == null || StringUtils.isAllBlank(paramBbsItem.getBbsId())) return paramBbsItem; + + String edu = EnvUtil.getSysEnvIf("C", "bbs.edu.id", ""); + String lecture = EnvUtil.getSysEnvIf("C", "bbs.edu.lecture.id", ""); + String star = EnvUtil.getSysEnvIf("C", "bbs.shin.star.id", ""); + String festiv = EnvUtil.getSysEnvIf("C", "bbs.festival.id", ""); + String culture = EnvUtil.getSysEnvIf("C", "bbs.culture.id", ""); + String article = EnvUtil.getSysEnvIf("C", "bbs.culture.article.id", ""); + String photo = EnvUtil.getSysEnvIf("C", "bbs.photo.gallery.id", ""); + String movie = EnvUtil.getSysEnvIf("C", "bbs.movie.gallery.id", ""); + + // 게시판 구분코드 && 과정(edu) 및 축제(festiv) 리스트 조회 + if(star.equals(retItemVO.getBbsId())) { // 샤이니스타를찾아라 S + retItemVO.setBbsSeCode("S"); + BbsNttItemVO paramBbsNttItem = new BbsNttItemVO(); + paramBbsNttItem.setBbsId(festiv); + retItemVO.setNttList(bbsNttService.selectBbsNttList(paramBbsNttItem)); + } else if (lecture.equals(retItemVO.getBbsId())) { // 온라인배움터 강의 L + retItemVO.setBbsSeCode("L"); + BbsNttItemVO paramBbsNttItem = new BbsNttItemVO(); + paramBbsNttItem.setBbsId(edu); + retItemVO.setNttList(bbsNttService.selectBbsNttList(paramBbsNttItem)); + } else if (article.equals(retItemVO.getBbsId())) { // 문화나눔한마당 강의 A + retItemVO.setBbsSeCode("A"); + BbsNttItemVO paramBbsNttItem = new BbsNttItemVO(); + paramBbsNttItem.setBbsId(festiv); + retItemVO.setNttList(bbsNttService.selectBbsNttList(paramBbsNttItem)); + } else if (culture.equals(retItemVO.getBbsId())) { // 문화나눔한마당 과정 C + retItemVO.setBbsSeCode("C"); + BbsNttItemVO paramBbsNttItem = new BbsNttItemVO(); + paramBbsNttItem.setBbsId(festiv); + retItemVO.setNttList(bbsNttService.selectBbsNttList(paramBbsNttItem)); + } else if (photo.contains(retItemVO.getBbsId())) { // 페스티벌사진전 P + retItemVO.setBbsSeCode("P"); + BbsNttItemVO paramBbsNttItem = new BbsNttItemVO(); + paramBbsNttItem.setBbsId(festiv); + retItemVO.setNttList(bbsNttService.selectBbsNttList(paramBbsNttItem)); + } else if (retItemVO.getBbsId().contains(movie)) { // 문화원갤러리, 활동갤러리 M + retItemVO.setBbsSeCode("M"); + } + + return retItemVO; + } + +} diff --git a/src/main/java/kccf/bbs/web/CorsMapper.java b/src/main/java/kccf/bbs/web/CorsMapper.java new file mode 100644 index 0000000..17423be --- /dev/null +++ b/src/main/java/kccf/bbs/web/CorsMapper.java @@ -0,0 +1,21 @@ +package kccf.bbs.web; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.client.RestTemplate; + +@Controller +public class CorsMapper { + + @RequestMapping(value="/proxyForVimeo.do") + @ResponseBody + public String proxy(String vid) throws Exception{ + + String url = "http://vimeo.com/api/v2/video/"+vid+".json"; + RestTemplate restTemplate = new RestTemplate(); + + return restTemplate.getForObject(url, String.class); + } + +} diff --git a/src/main/java/kccf/bbs/web/JobExtractionBatch.java b/src/main/java/kccf/bbs/web/JobExtractionBatch.java new file mode 100644 index 0000000..3e5852c --- /dev/null +++ b/src/main/java/kccf/bbs/web/JobExtractionBatch.java @@ -0,0 +1,61 @@ +package kccf.bbs.web; + +import java.lang.invoke.MethodHandles; +import java.net.HttpURLConnection; +import java.net.URL; + +import org.apache.commons.lang3.StringUtils; +import org.quartz.Job; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @Class : JobExtractionBatch.java + * @Description : 컨텐츠 텍스트 추출 서비스 호출 JOB + * + * @Modification + * + * 수정일 수정자 수정내용 + * ---------- ------- --------------------------- + * 2023-12-13 SHKIM 최초 생성 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-12-13 + * + */ + +public class JobExtractionBatch implements Job{ + + private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + private static final String conSiteUrl = ""; + + @Override + public void execute(JobExecutionContext context) throws JobExecutionException { + + LOGGER.info("================================================"); + LOGGER.info("Extract Batch"); + LOGGER.info("================================================"); + + String genUrl = context.getMergedJobDataMap().getString("url"); + LOGGER.info("genUrl : " + genUrl); + + if(StringUtils.isAllBlank(genUrl)) { + LOGGER.error("Failed. Text Extraction's url is required"); + return; + } + + try { + URL url = new URL(genUrl); + HttpURLConnection con = (HttpURLConnection) url.openConnection(); + con.setRequestMethod("GET"); + int respCode = con.getResponseCode(); + LOGGER.info("RESPONSE CODE : " + respCode); + } catch(Exception e) { + LOGGER.error("Failed : " + e.toString()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/kccf/bsns/dao/BsnsDAO.java b/src/main/java/kccf/bsns/dao/BsnsDAO.java new file mode 100644 index 0000000..378c8f4 --- /dev/null +++ b/src/main/java/kccf/bsns/dao/BsnsDAO.java @@ -0,0 +1,37 @@ +package kccf.bsns.dao; + +import java.util.List; + +import org.springframework.stereotype.Repository; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import kccf.bsns.vo.BsnsVO; + +@Repository("bsnsDAO") +public class BsnsDAO extends EgovComAbstractDAO{ + + public List selectBsnsListAjax(BsnsVO vo){ + return selectList("bsnsDAO.selectBsnsListAjax", vo); + } + + public BsnsVO selectBsnsByBsnsId(BsnsVO vo) { + return selectOne("bsnsDAO.selectBsnsByBsnsId", vo); + } + + public String getBsnsIdSeq() { + return selectOne("bsnsDAO.getBsnsIdSeq"); + } + + public int insertBsns(BsnsVO vo) { + return insert("bsnsDAO.insertBsns", vo); + } + + public int updataeBsns(BsnsVO vo) { + return update("bsnsDAO.updataeBsns", vo); + } + + public int deleteBsns(BsnsVO vo) { + return update("bsnsDAO.deleteBsns", vo); + } + +} diff --git a/src/main/java/kccf/bsns/service/BsnsService.java b/src/main/java/kccf/bsns/service/BsnsService.java new file mode 100644 index 0000000..40c9086 --- /dev/null +++ b/src/main/java/kccf/bsns/service/BsnsService.java @@ -0,0 +1,21 @@ +package kccf.bsns.service; + +import java.util.List; + +import kccf.bsns.vo.BsnsVO; + +public interface BsnsService { + + public List selectBsnsListAjax(BsnsVO vo); + + public BsnsVO selectBsnsByBsnsId(BsnsVO vo); + + public String getBsnsIdSeq(); + + public int insertBsns(BsnsVO vo); + + public int updataeBsns(BsnsVO vo); + + public int deleteBsns(BsnsVO vo); + +} diff --git a/src/main/java/kccf/bsns/service/impl/BsnsServiceImpl.java b/src/main/java/kccf/bsns/service/impl/BsnsServiceImpl.java new file mode 100644 index 0000000..af4b9fa --- /dev/null +++ b/src/main/java/kccf/bsns/service/impl/BsnsServiceImpl.java @@ -0,0 +1,49 @@ +package kccf.bsns.service.impl; + +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import kccf.bsns.dao.BsnsDAO; +import kccf.bsns.service.BsnsService; +import kccf.bsns.vo.BsnsVO; + +@Service("bsnsService") +public class BsnsServiceImpl implements BsnsService { + + @Resource(name="bsnsDAO") + private BsnsDAO bsnsDAO; + + @Override + public List selectBsnsListAjax(BsnsVO vo){ + return bsnsDAO.selectBsnsListAjax(vo); + } + + @Override + public BsnsVO selectBsnsByBsnsId(BsnsVO vo) { + return bsnsDAO.selectBsnsByBsnsId(vo); + } + + @Override + public String getBsnsIdSeq() { + return bsnsDAO.getBsnsIdSeq(); + } + + @Override + public int insertBsns(BsnsVO vo) { + return bsnsDAO.insertBsns(vo); + } + + @Override + public int updataeBsns(BsnsVO vo) { + return bsnsDAO.updataeBsns(vo); + } + + @Override + public int deleteBsns(BsnsVO vo) { + return bsnsDAO.deleteBsns(vo); + } + +} diff --git a/src/main/java/kccf/bsns/vo/BsnsVO.java b/src/main/java/kccf/bsns/vo/BsnsVO.java new file mode 100644 index 0000000..52b3ea0 --- /dev/null +++ b/src/main/java/kccf/bsns/vo/BsnsVO.java @@ -0,0 +1,64 @@ +package kccf.bsns.vo; + +import kccf.cmm.vo.CmmBaseVO; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Setter +@Getter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class BsnsVO extends CmmBaseVO { + + /* 사업 아이디 */ + private String bsnsId; + /* 사업명 */ + private String bsnsNm; + /* 사업유형코드 */ + private String bsnsTypeCode; + /* 사업유형명 */ + private String bsnsTypeCodeNm; + /* 사업상태코드 */ + private String bsnsSttusCode; + /* 사업상태코드명 */ + private String bsnsSttusCodeNm; + /* 사업시작일자 */ + private String bsnsBgnde; + /* 사업종료일자 */ + private String bsnsEndde; + /* 사업설명내용 */ + private String bsnsDcCn; + /* 공개여부 */ + private String openYn; + /* 삭제여부 */ + private String deleteAt; + /* 등록자 아이디 */ + private String regUserId; + /* 등록자 아이디 */ + private String regUserNm; + /* 등록일시 */ + private String regDttm; + /* 수정자 아이디 */ + private String updUserId; + /* 수정일시 */ + private String updDttm; + /* 활동건수 */ + private String actCnt; + + /* 검색 - 사업유형 */ + private String searchBsnsTypeCode; + /* 검색 - 사업상태 */ + private String searchBsnsSttusCode; + /* 검색 - 사업명 */ + private String searchBsnsNm; + + /* 권한 관련 */ + private boolean canReadOther; + private boolean canWrite; + private boolean canUpdate; + +} diff --git a/src/main/java/kccf/bsns/web/BsnsController.java b/src/main/java/kccf/bsns/web/BsnsController.java new file mode 100644 index 0000000..6f0f8ee --- /dev/null +++ b/src/main/java/kccf/bsns/web/BsnsController.java @@ -0,0 +1,144 @@ +package kccf.bsns.web; + +import java.lang.invoke.MethodHandles; +import java.util.List; + +import javax.servlet.http.HttpSession; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; + +import kccf.act.vo.ActVO; +import kccf.auth.web.AuthUtil; +import kccf.bsns.service.BsnsService; +import kccf.bsns.vo.BsnsVO; +import kccf.cmm.web.CmmBaseController; +import kccf.login.service.KccfLoginService; +import kccf.login.vo.CmmnCodeDetailVO; +import kccf.login.vo.UserVO; +import lombok.RequiredArgsConstructor; + +@Controller +@RequiredArgsConstructor +@RequestMapping(value = "/sec") +public class BsnsController extends CmmBaseController { + + private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + private final BsnsService bsnsService; + + private final KccfLoginService kccfLoginService; + + @RequestMapping(value = "/bsns/bsnsListPage.do") + public String bsnsListPage(BsnsVO searchVO, ModelMap model, HttpSession session) { + + UserVO userVO = (UserVO)session.getAttribute("user"); + + if(userVO == null || StringUtils.isAllBlank(userVO.getUserId())) { + return "redirect:/login.do"; + } + + CmmnCodeDetailVO cmmCodeDetailVO = new CmmnCodeDetailVO(); + + cmmCodeDetailVO.setCode("BSNS_TYPE_CODE"); + model.addAttribute("bsnsTypeCodeList", kccfLoginService.selectCodeListAjax(cmmCodeDetailVO)); + + cmmCodeDetailVO.setCode("BSNS_STTUS_CODE"); + model.addAttribute("bsnsSttusCodeList", kccfLoginService.selectCodeListAjax(cmmCodeDetailVO)); + + searchVO.setCanWrite(AuthUtil.canWrite(getUserId(), getSiteSeCode(), getSelMenuId(), "")); + + model.addAttribute("searchVO", searchVO); + + return model.getAttribute("hostId") + "/bsns/listBsns"; + } + + @RequestMapping(value = "/bsns/selectBsnsListAjax.do") + public String selectBsnsListAjax(BsnsVO searchVO, ModelMap model) { + + List bsnsList = bsnsService.selectBsnsListAjax(searchVO); + + if(bsnsList != null && bsnsList.size() > 0) { + searchVO.setTotCnt(bsnsList.get(0).getTotCnt()); + } + + model.addAttribute("data", bsnsList); + model.addAttribute("searchVO", searchVO); + + return "jsonView"; + } + + @RequestMapping(value = "/bsns/bsnsDetailPage.do") + public String bsnsDetailPage(BsnsVO searchVO, ModelMap model, ActVO searchVO2, HttpSession session) { + + UserVO userVO = (UserVO)session.getAttribute("user"); + + if(userVO == null || StringUtils.isAllBlank(userVO.getUserId())) { + return "redirect:/login.do"; + } + + CmmnCodeDetailVO cmmCodeDetailVO = new CmmnCodeDetailVO(); + + cmmCodeDetailVO.setCode("BSNS_TYPE_CODE"); + model.addAttribute("bsnsTypeCodeList", kccfLoginService.selectCodeListAjax(cmmCodeDetailVO)); + + cmmCodeDetailVO.setCode("BSNS_STTUS_CODE"); + model.addAttribute("bsnsSttusCodeList", kccfLoginService.selectCodeListAjax(cmmCodeDetailVO)); + + searchVO.setCanWrite(AuthUtil.canWrite(getUserId(), getSiteSeCode(), getSelMenuId(), "")); + + model.addAttribute("searchVO", searchVO); + model.addAttribute("searchVO2", searchVO2); + model.addAttribute("bsnsVO", bsnsService.selectBsnsByBsnsId(searchVO)); + + return model.getAttribute("hostId") + "/bsns/bsnsRegist"; + } + + @RequestMapping(value = "/bsns/insertBsns.do") + public String insertBsns(BsnsVO searchVO, ModelMap model, RedirectAttributes redirect) { + + searchVO.setRegUserId(getUserId()); + searchVO.setUpdUserId(getUserId()); + + if(searchVO.getBsnsId() != null && !searchVO.getBsnsId().equals("")) { + //update + bsnsService.updataeBsns(searchVO); + }else { + //insert + String seq = bsnsService.getBsnsIdSeq(); + + searchVO.setBsnsId(seq); + + bsnsService.insertBsns(searchVO); + + } + + redirect.addAttribute("searchBsnsTypeCode", searchVO.getSearchBsnsTypeCode()); + redirect.addAttribute("searchBsnsSttusCode", searchVO.getSearchBsnsSttusCode()); + redirect.addAttribute("searchBsnsNm", searchVO.getSearchBsnsNm()); + redirect.addAttribute("pageNo", searchVO.getPageNo()); + redirect.addAttribute("selMenuId", searchVO.getSelMenuId()); + + return "redirect:/sec/bsns/bsnsListPage.do"; + } + + @RequestMapping(value = "/bsns/deleteBsns.do") + public String deleteBsns (BsnsVO searchVO, ModelMap model, RedirectAttributes redirect) { + + bsnsService.deleteBsns(searchVO); + + redirect.addAttribute("searchBsnsTypeCode", searchVO.getSearchBsnsTypeCode()); + redirect.addAttribute("searchBsnsSttusCode", searchVO.getSearchBsnsSttusCode()); + redirect.addAttribute("searchBsnsNm", searchVO.getSearchBsnsNm()); + redirect.addAttribute("pageNo", searchVO.getPageNo()); + redirect.addAttribute("selMenuId", searchVO.getSelMenuId()); + + return "redirect:/sec/bsns/bsnsListPage.do"; + } + +} diff --git a/src/main/java/kccf/cmm/dao/CmmBaseDAO.java b/src/main/java/kccf/cmm/dao/CmmBaseDAO.java new file mode 100644 index 0000000..418b64e --- /dev/null +++ b/src/main/java/kccf/cmm/dao/CmmBaseDAO.java @@ -0,0 +1,7 @@ +package kccf.cmm.dao; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; + +public class CmmBaseDAO extends EgovComAbstractDAO { + +} diff --git a/src/main/java/kccf/cmm/filter/LoggingFilter.java b/src/main/java/kccf/cmm/filter/LoggingFilter.java new file mode 100644 index 0000000..113dfb4 --- /dev/null +++ b/src/main/java/kccf/cmm/filter/LoggingFilter.java @@ -0,0 +1,64 @@ +package kccf.cmm.filter; + +import java.io.IOException; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.web.context.support.WebApplicationContextUtils; + +import kccf.log.service.KccfLogService; +import kccf.log.vo.LogUserSvcAccesVO; +import kccf.login.vo.UserVO; +import kccf.util.StrUtil; +import kccf.util.WebUtil; + +public class LoggingFilter implements Filter { + + @Autowired + private KccfLogService kccfLogService; + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) + throws IOException, ServletException { + + HttpServletRequest httpReq = (HttpServletRequest)request; + HttpSession session = httpReq.getSession(false); + + UserVO user = (session == null ? null : (UserVO)session.getAttribute("user")); + + LogUserSvcAccesVO logSvc = new LogUserSvcAccesVO(); + logSvc.setLogUserSvcAccesId("S" + StrUtil.getTodaYyyyMMddHHmmssSSS() + StrUtil.getRandomStr(4).toUpperCase()); + logSvc.setUserId(user == null ? null : user.getUserId()); + logSvc.setSiteSeCode(WebUtil.getSiteSeCodeFromHostName(request.getServerName())); + logSvc.setMenuId(request.getParameter("selMenuId")); + logSvc.setAditInfo(((HttpServletRequest)request).getRequestURI()); + logSvc.setUserIp(request.getRemoteAddr()); + + kccfLogService.insertLogUserSvcAcces(logSvc); + + chain.doFilter(request, response); + + } + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + ApplicationContext ctx = WebApplicationContextUtils + .getRequiredWebApplicationContext(filterConfig.getServletContext()); + this.kccfLogService = ctx.getBean(KccfLogService.class); + } + + @Override + public void destroy() { + // TODO Auto-generated method stub + } +} diff --git a/src/main/java/kccf/cmm/util/CmmFileResizeUtil.java b/src/main/java/kccf/cmm/util/CmmFileResizeUtil.java new file mode 100644 index 0000000..8782996 --- /dev/null +++ b/src/main/java/kccf/cmm/util/CmmFileResizeUtil.java @@ -0,0 +1,39 @@ +package kccf.cmm.util; + +import java.awt.image.BufferedImage; + +import org.imgscalr.Scalr; + +/** + * @class : CmmFileResizeUtil.java + * @description : 이미지 파일 리사이징 관련 유틸리티 + * + * @author 한국문화원연합회 / (주)디지탈쉽 + * @since 2023-09-27 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-09-27   JAJEONG      최초 생성
    + *  
    + * 
    + */ + + +public class CmmFileResizeUtil { + + public static BufferedImage resizeImage(BufferedImage bufferedImage, int targetWidth, int targetHeight) throws Exception { + return Scalr.resize(bufferedImage, Scalr.Method.ULTRA_QUALITY, Scalr.Mode.FIT_EXACT, targetWidth, targetHeight, Scalr.OP_ANTIALIAS); + } + + public static BufferedImage resizeWidthImage(BufferedImage bufferedImage, int targetWidth) throws Exception { + return Scalr.resize(bufferedImage, Scalr.Method.ULTRA_QUALITY, Scalr.Mode.FIT_TO_WIDTH, targetWidth); + } + + public static BufferedImage resizeHeightImage(BufferedImage bufferedImage, int targetHeight) throws Exception { + return Scalr.resize(bufferedImage, Scalr.Method.ULTRA_QUALITY, Scalr.Mode.FIT_TO_HEIGHT, targetHeight); + } + +} diff --git a/src/main/java/kccf/cmm/util/CmmFileUtil.java b/src/main/java/kccf/cmm/util/CmmFileUtil.java new file mode 100644 index 0000000..f60fcd3 --- /dev/null +++ b/src/main/java/kccf/cmm/util/CmmFileUtil.java @@ -0,0 +1,274 @@ +package kccf.cmm.util; + +import org.springframework.stereotype.Component; +import java.awt.image.BufferedImage; +import java.io.File; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.List; + +import javax.annotation.Resource; +import javax.imageio.ImageIO; + +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.multipart.MultipartFile; + +import egovframework.com.cmm.EgovWebUtil; +import egovframework.com.cmm.service.EgovFileMngUtil; +import egovframework.com.cmm.service.EgovProperties; +import kccf.bbs.service.BbsNttService; +import kccf.bbs.vo.AttachmentVO; +import kccf.cmm.web.CmmBaseController; +import kccf.env.web.EnvUtil; +import kccf.util.StrUtil; +import lombok.RequiredArgsConstructor; + +/** + * @class : CmmFileUtil.java + * @description : 파일저장 및 정보 취득 관련 유틸리티 + * + * @author 한국문화원연합회 / (주)디지탈쉽 + * @since 2023-09-27 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-09-27   JAJEONG      최초 생성
    + *  
    + * 
    + */ + +@Component +//@RequiredArgsConstructor +public class CmmFileUtil extends CmmBaseController { + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovFileMngUtil.class); + + @Resource(name = "bbsNttService") + private BbsNttService bbsNttService; + + public static final String RESIZE_BY_WIDTH = "width"; + public static final String RESIZE_BY_HEIGHT = "height"; + public static final String RESIZE_BOTH = "both"; + public static final String FILE_TYPE_PHOTO = "P"; + public static final String FILE_TYPE_DOCUMENT = "D"; + public static final String FILE_TYPE_THUMB = "T"; + + // 첨부파일 등록 + public List parseAtchFileInf(List files, String resizeYn, int fileKeyParam, String bbsId, String nttId) throws Exception { + return parseAtchFileInf(files, resizeYn, fileKeyParam, bbsId, nttId, null); + } + + public List parseAtchFileInf(List files, String resizeYn, int fileKeyParam, String bbsId, String nttId, String cntntsSeCode) throws Exception { + + int fileKey = fileKeyParam; + + String storePathString = EnvUtil.getSysEnvIf("C", "attach.dir.path." + getSysId() , ""); + + Date now = new Date(); + SimpleDateFormat yearFormat = new SimpleDateFormat("yyyy"); + SimpleDateFormat monthFormat = new SimpleDateFormat("MM"); + + String year = yearFormat.format(now); + String month = monthFormat.format(now); + + String finalDirectoryPath = storePathString + bbsId + File.separator + year + File.separator + month + File.separator + nttId; + + File saveFolder = new File(EgovWebUtil.filePathBlackList(finalDirectoryPath)); + + if (!saveFolder.exists() || saveFolder.isFile()) { + if (saveFolder.mkdirs()) { + LOGGER.debug("[file.mkdirs] saveFolder : Creation Success "); + } else { + LOGGER.error("[file.mkdirs] saveFolder : Creation Fail "); + } + } + + String filePath = ""; + List result = new ArrayList<>(); + File outputFile = null; + long fileSize=0; + + for (MultipartFile file : files ) { + + String orginFileName = file.getOriginalFilename(); + + int index = orginFileName.lastIndexOf("."); + String fileExt = orginFileName.substring(index + 1); + + String atchFileId = bbsNttService.getAtchFileId(); + String atchmnflId = "F" + atchFileId; + String filePhysiclNm = "A" + atchFileId + "." + fileExt; + + String fileType; + String[] ext = {"png", "jpg", "gif", "jpeg", "tiff", "bmp"}; + + if (Arrays.asList(ext).contains(fileExt)) { + fileType = FILE_TYPE_PHOTO; + } else { + fileType = FILE_TYPE_DOCUMENT; + } + + if(fileType.equals("P")) { + + BufferedImage bufferedImage = ImageIO.read(file.getInputStream()); + + // 이미지 리사이징 처리 + if(bufferedImage != null && resizeYn.equals("Y")) { + + if (fileExt.equals("png") || fileExt.equals("jpg") || fileExt.equals("jpeg")) { + String widthSize = EnvUtil.getSysEnv("C", "cmmn.image.resize.width"); + if(Integer.valueOf(widthSize) < bufferedImage.getWidth()) { + bufferedImage = CmmFileResizeUtil.resizeWidthImage(bufferedImage, Integer.valueOf(widthSize)); + } + } + } + + // 파일 생성 + if (!"".equals(orginFileName)) { + filePath = finalDirectoryPath + File.separator + filePhysiclNm; + outputFile = new File(filePath); + ImageIO.write(bufferedImage, fileExt, outputFile); + fileSize = outputFile.length(); + } + } + + if(fileType.equals("D")) { + + // 파일 생성 + if (!"".equals(orginFileName)) { + filePath = finalDirectoryPath + File.separator + filePhysiclNm; + fileSize = file.getSize(); + file.transferTo(new File(EgovWebUtil.filePathBlackList(filePath))); + } + } + + String convertedPath = finalDirectoryPath.replace("\\", "/"); + AttachmentVO fvo = new AttachmentVO(); + + fvo.setAtchmnflId(atchmnflId); + fvo.setCntntsSeCode(StrUtil.ifEmpty(cntntsSeCode, "KF_BBS_NTT")); + fvo.setCntntsGroupId(bbsId); + fvo.setCntntsId(nttId); + fvo.setSortSn(fileKey); + fvo.setFileSize((int)fileSize); + fvo.setFileTyCode(fileType); + fvo.setExtsn(fileExt); + fvo.setFilePhysiclNm(filePhysiclNm); + fvo.setFileLogicNm(orginFileName); + fvo.setFlpth(convertedPath); + fvo.setThumbUrl("/cmm/fms/getImage.do?atchmnflId=" + atchmnflId); + + result.add(fvo); + + fileKey++; + + } + + return result; + } + + // 썸네일 등록 + public List parseThumbFileInf(MultipartFile file, int fileKeyParam, Integer widthSize, Integer heightSize, String bbsId, String nttId) throws Exception { + + int fileKey =fileKeyParam; + + String storePathString = EnvUtil.getSysEnvIf("C", "attach.dir.path." + getSysId() , ""); + + Date now = new Date(); + SimpleDateFormat yearFormat = new SimpleDateFormat("yyyy"); + SimpleDateFormat monthFormat = new SimpleDateFormat("MM"); + + String year = yearFormat.format(now); + String month = monthFormat.format(now); + + String finalDirectoryPath = storePathString + bbsId + File.separator + year + File.separator + month + File.separator + nttId; + + File saveFolder = new File(EgovWebUtil.filePathBlackList(finalDirectoryPath)); + + if (!saveFolder.exists() || saveFolder.isFile()) { + if (saveFolder.mkdirs()) { + LOGGER.debug("[file.mkdirs] saveFolder : Creation Success "); + } else { + LOGGER.error("[file.mkdirs] saveFolder : Creation Fail "); + } + } + + String filePath = ""; + List result = new ArrayList<>(); + AttachmentVO fvo; + + String orginFileName = file.getOriginalFilename(); + + BufferedImage bufferedImage = ImageIO.read(file.getInputStream()); + + + if (bufferedImage != null) { + + // 이미지 리사이징 처리 + if ((widthSize != null && widthSize != 0) && (heightSize == null || heightSize == 0)) { + bufferedImage = CmmFileResizeUtil.resizeWidthImage(bufferedImage, widthSize); + } + else if ((heightSize != null && heightSize != 0) && (widthSize == null || widthSize == 0)) { + bufferedImage = CmmFileResizeUtil.resizeHeightImage(bufferedImage, heightSize); + } + else if ((widthSize != null && widthSize != 0) && (heightSize != null && heightSize != 0)) { + bufferedImage = CmmFileResizeUtil.resizeImage(bufferedImage, widthSize, heightSize); + } + + } + + if ("".equals(orginFileName)) { + // 원 파일명이 없는 경우 처리 + } + + + int index = orginFileName.lastIndexOf("."); + String fileExt = orginFileName.substring(index + 1); + + String thumbFileId = bbsNttService.getThumbFileId(); + + String atchmnflId = "F" + thumbFileId; + String filePhysiclNm = "T" + thumbFileId + "." + fileExt; + + File outputFile = null; + + if (!"".equals(orginFileName)) { + filePath = finalDirectoryPath + File.separator + filePhysiclNm; + outputFile = new File(filePath); + ImageIO.write(bufferedImage, fileExt, outputFile); + } + + String convertedPath = finalDirectoryPath.replace("\\", "/"); + + long fileSizeBytes = outputFile.length(); + + fvo = new AttachmentVO(); + + fvo.setAtchmnflId(atchmnflId); + fvo.setCntntsSeCode("KF_BBS_NTT"); + fvo.setCntntsGroupId(bbsId); + fvo.setCntntsId(nttId); + fvo.setSortSn(fileKey); + fvo.setFileSize((int)fileSizeBytes); + fvo.setFileTyCode(FILE_TYPE_THUMB); + fvo.setExtsn(fileExt); + fvo.setFilePhysiclNm(filePhysiclNm); + fvo.setFileLogicNm(orginFileName); + fvo.setFlpth(convertedPath); + fvo.setThumbUrl("/cmm/fms/getImage.do?atchmnflId=" + atchmnflId); + + result.add(fvo); + + return result; + } + + + +} diff --git a/src/main/java/kccf/cmm/util/CmmImageSaver.java b/src/main/java/kccf/cmm/util/CmmImageSaver.java new file mode 100644 index 0000000..cfc111d --- /dev/null +++ b/src/main/java/kccf/cmm/util/CmmImageSaver.java @@ -0,0 +1,76 @@ +package kccf.cmm.util; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.StandardCopyOption; +import java.text.SimpleDateFormat; +import java.util.Date; + +import org.springframework.stereotype.Component; + +import kccf.cmm.web.CmmBaseController; +import kccf.env.web.EnvUtil; + +/** + * CmmImageSaver.java + * Description : 공통 게시판에 등록되는 CKEDITOR 이미지 파일 옮기는 Util + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-10-11 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-10-11   JAJEONG      최초 생성
    + *  
    + * 
    + */ + +@Component +public class CmmImageSaver extends CmmBaseController{ + + public String saveImageFromUrl(String bbsId, String nttId, String[] imageUrls) throws IOException { + + // 파일 저장 위치 + String baseDirectory = EnvUtil.getSysEnvIf("C", "attach.dir.path." + getSysId() , ""); + + // 현재 날짜를 생성 + Date now = new Date(); + SimpleDateFormat yearFormat = new SimpleDateFormat("yyyy"); + SimpleDateFormat monthFormat = new SimpleDateFormat("MM"); + + String year = yearFormat.format(now); + String month = monthFormat.format(now); + + String finalDirectoryPath = baseDirectory + bbsId + File.separator + year + File.separator + month + File.separator + nttId; + String parameterFilePath = bbsId + File.separator + year + File.separator + month + File.separator + nttId; + String originDirectory = baseDirectory + "temp/"; + + // 원본 디렉터리와 목적지 디렉터리를 File 객체로 생성 + File sourceDirectory = new File(originDirectory); + File destinationDirectory = new File(finalDirectoryPath); + + + if (!destinationDirectory.exists()) { + destinationDirectory.mkdirs(); + } + + Path sourceFilePath, destinationFilePath; + + for (String fileName : imageUrls) { + if (fileName != null) { + sourceFilePath = new File(sourceDirectory, fileName).toPath(); + destinationFilePath = new File(destinationDirectory, fileName).toPath(); + + Files.move(sourceFilePath, destinationFilePath, StandardCopyOption.REPLACE_EXISTING); + } + } + + return parameterFilePath; + } + +} diff --git a/src/main/java/kccf/cmm/vo/CmmBaseVO.java b/src/main/java/kccf/cmm/vo/CmmBaseVO.java new file mode 100644 index 0000000..103717c --- /dev/null +++ b/src/main/java/kccf/cmm/vo/CmmBaseVO.java @@ -0,0 +1,83 @@ +package kccf.cmm.vo; + +import java.text.DecimalFormat; + +import kccf.util.StrUtil; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Getter +@Setter +@ToString +@NoArgsConstructor +public class CmmBaseVO { + + String selMenuId; /* 요청 메뉴ID */ + String selMenuNm; /* 요청 메뉴명 */ + + String curUserIp; /* 접속IP */ + String curUserId; /* 접속자 사용자ID */ + + String regUserId; /* 등록자ID */ + String regUserNm; /* 등록자명 */ + String regDttm; /* 등록일시 */ + + String updUserId; /* 수정자ID */ + String updUserNm; /* 수정자명 */ + String updDttm; /* 수정일시 */ + + int rn; /* 행번호 */ + int totCnt; /* 총건수 */ + int pageSize; /* 페이지크기 */ + int pageNo; /* 페이지번호 */ + + String empty; /* DataTable 빈컬럼 생성용 */ + + String etcData; /* 기타자료 */ + + String resultCode; /* 처리결과코드 : S, F, W */ + String resultMessage; /* 처리결과메시지 */ + + public int getPageSize() { + if(pageSize < 1) return 10; + return pageSize; + } + + public int getPageNo() { + if(pageNo < 1) return 1; + return pageNo; + } + + public String getRegDttmFormatted() { + return StrUtil.formatDateStr(regDttm); + } + + public String getUpdDttmFormatted() { + return StrUtil.formatDateStr(updDttm); + } + + public String getRegUserNmIfEmpty() { + return StrUtil.ifEmpty(regUserNm, "-"); + } + + public String getUpdUserNmIfEmpty() { + return StrUtil.ifEmpty(updUserNm, "-"); + } + + public void setResult(String resultCode, String resultMessage) { + this.resultCode = resultCode; + this.resultMessage = resultMessage; + } + + public void incTotCnt() { + this.totCnt++; + } + + public String getTotCntFormatted() { + int totCnt = this.totCnt; + DecimalFormat decFormat = new DecimalFormat("###,###"); + return decFormat.format(totCnt); + } +} diff --git a/src/main/java/kccf/cmm/vo/CmmCodeVO.java b/src/main/java/kccf/cmm/vo/CmmCodeVO.java new file mode 100644 index 0000000..ccfe782 --- /dev/null +++ b/src/main/java/kccf/cmm/vo/CmmCodeVO.java @@ -0,0 +1,28 @@ +package kccf.cmm.vo; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Setter +@Getter +@ToString +@NoArgsConstructor +@AllArgsConstructor + +public class CmmCodeVO extends CmmBaseVO { + + private String code; /* 코드 */ + private String detailCode; /* 상세코드 */ + private String detailCodeNm; /* 상세코드명 */ + private String aditAtrbInfoValue1; /* 추가속성정보값1 */ + private String aditAtrbInfoValue2; /* 추가속성정보값2 */ + private String aditAtrbInfoValue3; /* 추가속성정보값3 */ + private String dcCn; /* 설명내용 */ + private String sortSn; /* 정렬순번 */ + private String indictYn; /* 표시여부 */ + private String useYn; /* 사용여부 */ + +} diff --git a/src/main/java/kccf/cmm/vo/CmmMediaVO.java b/src/main/java/kccf/cmm/vo/CmmMediaVO.java new file mode 100644 index 0000000..bf4ac6f --- /dev/null +++ b/src/main/java/kccf/cmm/vo/CmmMediaVO.java @@ -0,0 +1,39 @@ +package kccf.cmm.vo; + +import java.util.List; + +import kccf.code.vo.CmmDetailCodeVO; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +/** + * CmmCodeVO.java + * Description : 미디어(사진, 동영상) 정보를 담는 VO + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-11-09 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-11-09   KNKIM      최초 생성
    + *  
    + * 
    + */ + +@Getter +@Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class CmmMediaVO extends CmmBaseVO { + + String title; /* 제목 */ + String url; /* URL */ + String descText; /* 설명내용 */ +} diff --git a/src/main/java/kccf/cmm/vo/DataTablesResponseVO.java b/src/main/java/kccf/cmm/vo/DataTablesResponseVO.java new file mode 100644 index 0000000..d562970 --- /dev/null +++ b/src/main/java/kccf/cmm/vo/DataTablesResponseVO.java @@ -0,0 +1,20 @@ +package kccf.cmm.vo; + +import java.util.List; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class DataTablesResponseVO { + + private List data; + private int recordsTotal; + private int recordsFiltered; + +} diff --git a/src/main/java/kccf/cmm/vo/TreeNodeVO.java b/src/main/java/kccf/cmm/vo/TreeNodeVO.java new file mode 100644 index 0000000..a71566e --- /dev/null +++ b/src/main/java/kccf/cmm/vo/TreeNodeVO.java @@ -0,0 +1,48 @@ +package kccf.cmm.vo; + +import java.util.List; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +/** + * TreeItemVO.java + * Description : Tree 정보를 담는 VO + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-09-26 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-09-26   KNKIM      최초 생성
    + *  
    + * 
    + */ + +@Getter +@Setter +@ToString +@NoArgsConstructor +public class TreeNodeVO { + + String id; /* ID */ + String nm; /* 노느명 */ + String text; /* 노느표출명 */ + String seCode; /* 구분코드 */ + List children; /* 자식노드 */ + + String resultCode; /* 처리결과코드 */ + String resultMessage; /* 처리결과메시지 */ + + public TreeNodeVO(String id, String nm, String text, String seCode) { + this.id = id; + this.nm = nm; + this.text = text; + this.seCode = seCode; + } +} diff --git a/src/main/java/kccf/cmm/web/CmmBaseController.java b/src/main/java/kccf/cmm/web/CmmBaseController.java new file mode 100644 index 0000000..893fcc0 --- /dev/null +++ b/src/main/java/kccf/cmm/web/CmmBaseController.java @@ -0,0 +1,257 @@ +package kccf.cmm.web; + +import java.nio.file.Path; +import java.nio.file.Paths; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import kccf.login.vo.UserVO; +import kccf.menu.service.MenuService; +import kccf.util.WebUtil; +import lombok.RequiredArgsConstructor; + +/** + * @class : CmmBaseController.java + * @description : 상위 컨트롤러 + * + * @author 한국문화원연합회 / (주)디지탈쉽 + * @since 2023-09-14 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-09-14   KNKIM      최초 생성
    + *  
    + * 
    + */ + +@Controller +public class CmmBaseController { + + String hostId = null; + String siteSeCode = null; + String selMenuId = null; + + @Autowired + private MenuService menuService; + + /** + * @Description : 사이트별 메뉴구성 HTML 가져오기 + * @param request + * @return + */ + @ModelAttribute("menuHtml") + public String menuHtml(HttpServletRequest request) throws Exception { + + String url = request.getRequestURI(); + if(url.toLowerCase().contains("json.do") + || url.toLowerCase().contains("ajax.do") + || url.toLowerCase().contains("popup.do")) { + return null; + } + + String siteSeCode = WebUtil.getSiteSeCodeFromHostName(request.getServerName()); + + if("M".equals(siteSeCode)) { + return null; + } + + return menuService.getMenuHtml(siteSeCode, false); + + //return "****************** menuHtml"; + } + + /** + * @Description : 사이트별 모바일 메뉴구성 HTML 가져오기 + * @param request + * @return + */ + @ModelAttribute("menuMobHtml") + public String menuMobHtml(HttpServletRequest request) throws Exception { + + String url = request.getRequestURI(); + if(url.toLowerCase().contains("json.do") + || url.toLowerCase().contains("ajax.do") + || url.toLowerCase().contains("popup.do")) { + return null; + } + + String siteSeCode = WebUtil.getSiteSeCodeFromHostName(request.getServerName()); + + if("M".equals(siteSeCode)) { + return null; + } + + return menuService.getMenuHtml(siteSeCode, true); + } + + /** + * @Description : 호스트구분ID 공통모델속성 정의 + * @param request + * @return + */ + @ModelAttribute("hostId") + public String hostId(HttpServletRequest request) { + + String siteSeCode = WebUtil.getSiteSeCodeFromHostName(request.getServerName()); + + if(siteSeCode.charAt(0) == 'M') hostId = "mng"; + else if(siteSeCode.charAt(0) == 'S') hostId = "senior"; + else hostId = "kccf"; + + return hostId; + } + + /** + * @Description : 호스트구분ID를 가져온다. + * @param request + * @return + */ + public String getHostId() { + + if(StringUtils.isAllEmpty(hostId)) { + ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes(); + if(attributes == null) return null; + HttpServletRequest request = attributes.getRequest(); + if(request == null) return null; + return hostId(request); + } + + return hostId; + } + + /** + * @Description : 사이트구분코드 공통모델속성 정의 + * @param request + * @return + */ + @ModelAttribute("siteSeCode") + public String siteSeCode(HttpServletRequest request) { + + siteSeCode = WebUtil.getSiteSeCodeFromHostName(request.getServerName()); + return siteSeCode; + } + + /** + * @Description : 선택된(요청된) 메뉴 ID 공통모델속성 정의 + * @param request + * @return + */ + @ModelAttribute("selMenuId") + public String selMenuId(HttpServletRequest request) { + + selMenuId = request.getParameter("selMenuId"); + + return selMenuId; + } + + /** + * @Description : 메뉴 ID 값을 가져온다. + * @param request + * @return + */ + public String getSelMenuId() { + return selMenuId; + } + + /** + * @Description : 사이트구분코드값을 가져온다. + * @param request + * @return + */ + public String getSiteSeCode() { + return siteSeCode; + } + + /** + * @Description : 사용자 세션 객체를 가져온다. + * @param + * @return + */ + public HttpSession getSession() { + + ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes(); + if(attributes == null) return null; + HttpServletRequest request = attributes.getRequest(); + + if(request == null) return null; + return request.getSession(true); + + } + + /** + * @Description : 세션 사용자 정보를 가져온다. + * @param + * @return UserVO + */ + public UserVO getSessionUser() { + + HttpSession session = getSession(); + if(session == null) return null; + + return (UserVO)session.getAttribute("user"); + } + + /** + * @Description : 사용자ID를 가져온다. + * @param + * @return String + */ + public String getUserId() { + UserVO user = getSessionUser(); + if(user == null) return null; + + return user.getUserId(); + } + + /** + * @Description : 사용자 로그인 ID를 가져온다. + * @param request + * @return + */ + public String getEmailLoginId() { + UserVO user = getSessionUser(); + if(user == null) return null; + + return user.getEmailLoginId(); + } + + /** + * @Description : 사용자이름을 가져온다. + * @param request + * @return + */ + public String getUserNm() { + UserVO user = getSessionUser(); + if(user == null) return null; + + return user.getUserNm(); + } + + /** + * @Description : 시스템ID를 가져온다. (로컬 : local, 서버 : server) + * @param request + * @return + */ + public String getSysId() { + + Path currentRelativePath = Paths.get(""); + String pathStr = currentRelativePath.toAbsolutePath().toString(); + + // D:\kccf-dev\bin\eclipse + if(pathStr.startsWith("D:")) return "local"; + + return "server"; + } + +} diff --git a/src/main/java/kccf/cmm/web/CmmCKEditorFileController.java b/src/main/java/kccf/cmm/web/CmmCKEditorFileController.java new file mode 100644 index 0000000..c7f9320 --- /dev/null +++ b/src/main/java/kccf/cmm/web/CmmCKEditorFileController.java @@ -0,0 +1,173 @@ +package kccf.cmm.web; + +import java.io.BufferedInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.codehaus.jettison.json.JSONObject; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PostMapping; +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.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; + +import egovframework.com.cmm.EgovWebUtil; +import egovframework.com.cmm.SessionVO; +import egovframework.com.cmm.util.EgovResourceCloseHelper; +import kccf.bbs.service.BbsNttService; +import kccf.env.web.EnvUtil; +import lombok.RequiredArgsConstructor; + +/** + * CmmCKEditorFileController.java + * Description : 공통 CKEDITOR 이미지 파일 생성을 위한 컨드롤러 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-10-11 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-10-11   JAJEONG      최초 생성
    + *  
    + * 
    + */ + +@Controller +@RequiredArgsConstructor +public class CmmCKEditorFileController extends CmmBaseController{ + + private final BbsNttService bbsNttService; + + /** + * @Description : 임시 디렉토리 생성 후 이미지 파일을 저장한다. + * @param multiRequest + * @param request + * @param response + * @return + */ + @ResponseBody + @PostMapping("/bbs/saveCKEditorImage.do") + public void fileUpload(MultipartHttpServletRequest multiRequest, HttpServletRequest request, HttpServletResponse response) { + try { + + final String real_save_path = EnvUtil.getSysEnvIf("C", "attach.dir.path." + getSysId() , "") + "temp/"; + + File tmpDir = new File(real_save_path); + if (!tmpDir.exists()) { + tmpDir.mkdirs(); + } + + // 업로드된 파일들을 가져옴 + final Map files = multiRequest.getFileMap(); + MultipartFile fileload = (MultipartFile) files.get("file"); + + // 원래 파일명 취득 + String fileName = fileload.getOriginalFilename(); + + int index = fileName.lastIndexOf("."); + String ext = fileName.substring(index + 1); + + fileName = bbsNttService.getEditorFileId() + "." + ext; + + // 실제 저장될 파일 경로 설정 + String newfilename = real_save_path + File.separator + fileName; + + // 파일을 지정된 경로로 저장 + fileload.transferTo(new File(EgovWebUtil.filePathBlackList(newfilename))); + + + JSONObject outData = new JSONObject(); + outData.put("uploaded", true); + + outData.put("url", "/bbs/getImageForContents.do?file=" + fileName); + + response.setContentType("application/json"); + response.setCharacterEncoding("UTF-8"); + + response.getWriter().print(outData.toString()); + } catch (Exception e) { + System.out.println("오류발생"); + } + } + + + /** + * + * Description : 저장된 이미지 파일을 보여준다. + * @param session + * @param fileNm + * @param request + * @param response + * @throws Exception + */ + @ResponseBody + @RequestMapping({"/bbs/getImageForContents.do", "/bbs/getImageFile.do"}) + public void getImageForContents(SessionVO session, @RequestParam String file, HttpServletRequest request, + HttpServletResponse response) throws Exception { + + String fileStr =""; + + if(request.getRequestURI().endsWith("/bbs/getImageForContents.do")) { + fileStr = EnvUtil.getSysEnvIf("C", "attach.dir.path." + getSysId() , "") + "temp/"; + } else if(request.getRequestURI().endsWith("/bbs/getImageFile.do")) { + fileStr = EnvUtil.getSysEnvIf("C", "attach.dir.path." + getSysId() , "") + file; + } + + FileInputStream fis = null; + BufferedInputStream in = null; + ByteArrayOutputStream bStream = null; + + try { + // 이미지 파일을 읽어와서 버퍼에 저장 + if(request.getRequestURI().endsWith("/bbs/getImageForContents.do")) { + fis = new FileInputStream(new File(fileStr, file)); + } + else if(request.getRequestURI().endsWith("/bbs/getImageFile.do")) { + fis = new FileInputStream(new File(fileStr)); + } + + in = new BufferedInputStream(fis); + bStream = new ByteArrayOutputStream(); + + int imgByte; + while ((imgByte = in.read()) != -1) { + bStream.write(imgByte); + } + + // 파일 확장자를 기반으로 MIME 타입 설정 + String type = ""; + String ext = file.substring(file.lastIndexOf(".") + 1).toLowerCase(); + if ("jpg".equals(ext)) { + type = "image/jpeg"; + } else { + type = "image/" + ext; + } + + // HTTP 응답 헤더 설정 + response.setHeader("Content-Type", type); + response.setContentLength(bStream.size()); + + // ByteArrayOutputStream의 데이터를 HTTP 응답 스트림에 쓰기 + bStream.writeTo(response.getOutputStream()); + + response.getOutputStream().flush(); + response.getOutputStream().close(); + + } finally { + // 스트림들 닫기 + EgovResourceCloseHelper.close(bStream, in, fis); + } + } + + +} diff --git a/src/main/java/kccf/cmm/web/CmmFileController.java b/src/main/java/kccf/cmm/web/CmmFileController.java new file mode 100644 index 0000000..75d69a9 --- /dev/null +++ b/src/main/java/kccf/cmm/web/CmmFileController.java @@ -0,0 +1,30 @@ +package kccf.cmm.web; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.web.bind.annotation.ModelAttribute; + +public class CmmFileController { + + /** + * @Description : 호스트구분ID 공통모델속성 정의 + * + * @author 한국문화원연합회 / 디지탈쉽 KNKIM + * @since 2023-09-14 + * + * @param request + * @return String + * + */ + @ModelAttribute("hostId") + public String serverHostName(HttpServletRequest request) { + + String hostName = request.getServerName(); + String hostId = "kccf"; + + if(hostName.startsWith("mng.")) hostId = "mng"; + else if(hostName.startsWith("senior.")) hostId = "senior"; + + return hostId; + } +} diff --git a/src/main/java/kccf/cmm/web/CmmMediaController.java b/src/main/java/kccf/cmm/web/CmmMediaController.java new file mode 100644 index 0000000..9f15aca --- /dev/null +++ b/src/main/java/kccf/cmm/web/CmmMediaController.java @@ -0,0 +1,48 @@ +package kccf.cmm.web; + +import java.lang.invoke.MethodHandles; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import kccf.cmm.vo.CmmMediaVO; +import lombok.RequiredArgsConstructor; + +/** + * CmmMediaController.java + * Description : 공통 사진/동영상 뷰어를 관리하는 컨트롤러 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-11-09 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-11-09   KNKIM      최초 생성
    + *  
    + * 
    + */ + +@Controller +@RequiredArgsConstructor +public class CmmMediaController extends CmmBaseController { + + private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + @RequestMapping("/cmm/viewImagePopup.do") + public String viewImagePopup(ModelMap model, CmmMediaVO cmmMediaVO) throws Exception { + model.addAttribute("searchVO", cmmMediaVO); + return getHostId() + "/cmm/viewImagePopup"; + } + + @RequestMapping("/cmm/viewMediaPopup.do") + public String viewMediaPopup(ModelMap model, CmmMediaVO cmmMediaVO) throws Exception { + model.addAttribute("searchVO", cmmMediaVO); + return getHostId() + "/cmm/viewMediaPopup"; + } +} diff --git a/src/main/java/kccf/cmm/web/DevController.java b/src/main/java/kccf/cmm/web/DevController.java new file mode 100644 index 0000000..b7921f4 --- /dev/null +++ b/src/main/java/kccf/cmm/web/DevController.java @@ -0,0 +1,52 @@ +package kccf.cmm.web; + +import java.lang.invoke.MethodHandles; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import kccf.cmm.vo.TreeNodeVO; +import kccf.cmm.web.CmmBaseController; +import kccf.menu.service.MenuService; +import kccf.menu.vo.MenuItemVO; +import lombok.RequiredArgsConstructor; + +/** + * DevController.java + * Description : 개발자관련 화면 컨트롤러 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-10-10 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-10-10   KNKIM      최초 생성
    + *  
    + * 
    + */ + +@Controller +@RequiredArgsConstructor +public class DevController extends CmmBaseController { + + private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + /** + * @Description : 팝업 목록 + * @return + * @throws Exception + */ + @RequestMapping("/dev/viewPopupList.do") + public String viewPopupList(ModelMap model) throws Exception { + + return getHostId() + "/dev/viewPopupList"; + } + +} diff --git a/src/main/java/kccf/code/dao/CmmCodeDAO.java b/src/main/java/kccf/code/dao/CmmCodeDAO.java new file mode 100644 index 0000000..f344f1a --- /dev/null +++ b/src/main/java/kccf/code/dao/CmmCodeDAO.java @@ -0,0 +1,54 @@ +package kccf.code.dao; + +import java.util.List; + +import org.springframework.stereotype.Repository; + +import kccf.cmm.dao.CmmBaseDAO; +import kccf.code.vo.CmmCodeVO; + +/** + * @class : CmmCodeDAO.java + * @description : 공통코드관리 DAO + * + * @author 한국문화원연합회 / (주)디지탈쉽 + * @since 2023-10-05 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-10-05   KNKIM      최초 생성
    + *  
    + * 
    + */ +@Repository +public class CmmCodeDAO extends CmmBaseDAO { + + + public int insertCmmCode(CmmCodeVO cmmCodeVO) throws Exception { + return insert("cmmCodeDAO.insertCmmCode", cmmCodeVO); + } + + public int updateCmmCode(CmmCodeVO cmmCodeVO) throws Exception { + return update("cmmCodeDAO.updateCmmCode", cmmCodeVO); + } + + public int deleteCmmCode(CmmCodeVO cmmCodeVO) throws Exception { + return delete("cmmCodeDAO.deleteCmmCode", cmmCodeVO); + } + + public List selectListCmmCode(CmmCodeVO cmmCodeVO) throws Exception { + return selectList("cmmCodeDAO.selectListCmmCode", cmmCodeVO); + } + + public CmmCodeVO selectCmmCodeInfo(String code) throws Exception { + return selectOne("cmmCodeDAO.selectCmmCodeInfo", code); + } + + public int countDetailCode(String code) throws Exception { + return selectOne("cmmCodeDAO.countDetailCode", code); + } + +} diff --git a/src/main/java/kccf/code/dao/CmmDetailCodeDAO.java b/src/main/java/kccf/code/dao/CmmDetailCodeDAO.java new file mode 100644 index 0000000..f3aad37 --- /dev/null +++ b/src/main/java/kccf/code/dao/CmmDetailCodeDAO.java @@ -0,0 +1,53 @@ +package kccf.code.dao; + +import java.util.List; + +import org.springframework.stereotype.Repository; + +import kccf.cmm.dao.CmmBaseDAO; +import kccf.code.vo.CmmDetailCodeVO; + +/** + * @class : CmmDetailCodeDAO.java + * @description : 공통상세코드관리 DAO + * + * @author 한국문화원연합회 / (주)디지탈쉽 + * @since 2023-10-11 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-10-11   KNKIM      최초 생성
    + *  
    + * 
    + */ +@Repository +public class CmmDetailCodeDAO extends CmmBaseDAO { + + public List selectListCmmDetailCode(CmmDetailCodeVO cmmDetailCodeVO) throws Exception { + return selectList("cmmDetailCodeDAO.selectListCmmDetailCode", cmmDetailCodeVO); + } + + public List selectListCmmLclttCode(CmmDetailCodeVO cmmDetailCodeVO) throws Exception { + return selectList("cmmDetailCodeDAO.selectListCmmLclttCode", cmmDetailCodeVO); + } + + public CmmDetailCodeVO selectCmmDetailCodeInfo(CmmDetailCodeVO cmmDetailCodeVO) throws Exception { + return selectOne("cmmDetailCodeDAO.selectCmmDetailCodeInfo", cmmDetailCodeVO); + } + + public int insertCmmDetailCode(CmmDetailCodeVO cmmDetailCodeVO) throws Exception { + return insert("cmmDetailCodeDAO.insertCmmDetailCode", cmmDetailCodeVO); + } + + public int updateCmmDetailCode(CmmDetailCodeVO cmmDetailCodeVO) throws Exception { + return update("cmmDetailCodeDAO.updateCmmDetailCode", cmmDetailCodeVO); + } + + public int deleteCmmDetailCode(CmmDetailCodeVO cmmDetailCodeVO) throws Exception { + return delete("cmmDetailCodeDAO.deleteCmmDetailCode", cmmDetailCodeVO); + } + +} diff --git a/src/main/java/kccf/code/dao/CtgryCodeDAO.java b/src/main/java/kccf/code/dao/CtgryCodeDAO.java new file mode 100644 index 0000000..fd36e3c --- /dev/null +++ b/src/main/java/kccf/code/dao/CtgryCodeDAO.java @@ -0,0 +1,53 @@ +package kccf.code.dao; + +import java.util.List; + +import org.springframework.stereotype.Repository; + +import kccf.cmm.dao.CmmBaseDAO; +import kccf.code.vo.CtgryCodeVO; + +/** + * @class : CtgryCodeDAO.java + * @description : 카테고리코드관리 DAO + * + * @author 한국문화원연합회 / (주)디지탈쉽 + * @since 2023-10-11 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-10-11   KNKIM      최초 생성
    + *  
    + * 
    + */ +@Repository +public class CtgryCodeDAO extends CmmBaseDAO { + + public List selectListCtgry(CtgryCodeVO ctgryCodeVO) throws Exception { + return selectList("ctgryCodeDAO.selectListCtgry", ctgryCodeVO); + } + + public CtgryCodeVO selectCtgryInfo(String code) throws Exception { + return selectOne("ctgryCodeDAO.selectCtgryInfo", code); + } + + public int countSubCategory(String upperCtgryCode) throws Exception { + return selectOne("ctgryCodeDAO.countSubCategory", upperCtgryCode); + } + + public int insertCtgry(CtgryCodeVO ctgryCodeVO) throws Exception { + return insert("ctgryCodeDAO.insertCtgry", ctgryCodeVO); + } + + public int updateCtgry(CtgryCodeVO ctgryCodeVO) throws Exception { + return update("ctgryCodeDAO.updateCtgry", ctgryCodeVO); + } + + public int deleteCtgry(CtgryCodeVO ctgryCodeVO) throws Exception { + return delete("ctgryCodeDAO.deleteCtgry", ctgryCodeVO); + } + +} diff --git a/src/main/java/kccf/code/service/CmmCodeService.java b/src/main/java/kccf/code/service/CmmCodeService.java new file mode 100644 index 0000000..9bc09a0 --- /dev/null +++ b/src/main/java/kccf/code/service/CmmCodeService.java @@ -0,0 +1,36 @@ +package kccf.code.service; + +import java.util.List; + +import kccf.code.vo.CmmCodeVO; + +/** + * CmmCodeService.java + * Description : 공통코드관리 서비스 인터페이스 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-10-05 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-10-05   KNKIM      최초 생성
    + *  
    + * 
    + */ +public interface CmmCodeService { + + public List selectListCmmCodeInfo(CmmCodeVO cmmCodeVO) throws Exception; + + public CmmCodeVO selectCmmCodeInfo(String code) throws Exception; + + public CmmCodeVO insertCmmCode(CmmCodeVO cmmCodeVO) throws Exception; + + public CmmCodeVO updateCmmCode(CmmCodeVO cmmCodeVO) throws Exception; + + public CmmCodeVO deleteCmmCode(CmmCodeVO cmmCodeVO) throws Exception; + + +} diff --git a/src/main/java/kccf/code/service/CmmDetailCodeService.java b/src/main/java/kccf/code/service/CmmDetailCodeService.java new file mode 100644 index 0000000..cefe194 --- /dev/null +++ b/src/main/java/kccf/code/service/CmmDetailCodeService.java @@ -0,0 +1,41 @@ +package kccf.code.service; + +import java.util.List; + +import kccf.code.vo.CmmDetailCodeVO; +import kccf.code.vo.CmmCodeVO; + +/** + * CmmCodeService.java + * Description : 공통상세코드관리 서비스 인터페이스 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-10-11 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-10-11   KNKIM      최초 생성
    + *  
    + * 
    + */ +public interface CmmDetailCodeService { + + public List selectListCmmDetailCode(CmmDetailCodeVO cmmDetailCodeVO) throws Exception; + + public List selectListCmmLclttCode(CmmDetailCodeVO cmmDetailCodeVO) throws Exception; + + public CmmDetailCodeVO selectCmmDetailCodeInfo(CmmDetailCodeVO cmmDetailCodeVO) throws Exception; + + + + public CmmDetailCodeVO insertCmmDetailCode(CmmDetailCodeVO cmmDetailCodeVO) throws Exception; + + public CmmDetailCodeVO updateCmmDetailCode(CmmDetailCodeVO cmmDetailCodeVO) throws Exception; + + public CmmDetailCodeVO deleteCmmDetailCode(CmmDetailCodeVO cmmDetailCodeVO) throws Exception; + + +} diff --git a/src/main/java/kccf/code/service/CtgryCodeService.java b/src/main/java/kccf/code/service/CtgryCodeService.java new file mode 100644 index 0000000..c4e22e1 --- /dev/null +++ b/src/main/java/kccf/code/service/CtgryCodeService.java @@ -0,0 +1,40 @@ +package kccf.code.service; + +import java.util.List; + +import kccf.code.vo.CtgryCodeVO; + +/** + * CmmCodeService.java + * Description : 카테고리코드관리 서비스 인터페이스 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-10-11 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-10-11   KNKIM      최초 생성
    + *  
    + * 
    + */ +public interface CtgryCodeService { + + public final String ROOT_CTGRY_CODE = "C00000"; + + public List selectListCtgry(CtgryCodeVO ctgryCodeVO) throws Exception; + + public CtgryCodeVO selectCtgryTree(CtgryCodeVO ctgryCodeVO) throws Exception; + + public CtgryCodeVO selectCtgryInfo(String ctgryCode) throws Exception; + + public CtgryCodeVO insertCtgry(CtgryCodeVO ctgryCodeVO) throws Exception; + + public CtgryCodeVO updateCtgry(CtgryCodeVO ctgryCodeVO) throws Exception; + + public CtgryCodeVO deleteCtgry(CtgryCodeVO ctgryCodeVO) throws Exception; + + +} diff --git a/src/main/java/kccf/code/service/impl/CmmCodeServiceImpl.java b/src/main/java/kccf/code/service/impl/CmmCodeServiceImpl.java new file mode 100644 index 0000000..c85513e --- /dev/null +++ b/src/main/java/kccf/code/service/impl/CmmCodeServiceImpl.java @@ -0,0 +1,128 @@ +package kccf.code.service.impl; + +import java.lang.invoke.MethodHandles; +import java.util.List; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import kccf.code.dao.CmmCodeDAO; +import kccf.code.service.CmmCodeService; +import kccf.code.vo.CmmCodeVO; +import lombok.RequiredArgsConstructor; + +/** + * CmmCodeServiceImpl.java + * Description : 공통코드관리 서비스 구현 클래스 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-10-05 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-10-05   KNKIM      최초 생성
    + *  
    + * 
    + */ + +@Service +@RequiredArgsConstructor +public class CmmCodeServiceImpl implements CmmCodeService { + + private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + private final CmmCodeDAO cmmCodeDAO; + + @Override + public CmmCodeVO insertCmmCode(CmmCodeVO cmmCode) throws Exception { + if(cmmCode == null) { + CmmCodeVO retItem = new CmmCodeVO(); + retItem.setResult("F", "등록할 공통코드 정보가 존재하지 않습니다."); + return retItem; + } + + try { + int ret = cmmCodeDAO.insertCmmCode(cmmCode); + if(ret > 0) { + cmmCode.setResult("S", "정상적으로 등록되었습니다."); + } else { + cmmCode.setResult("F", "공통코드 등록에 실패하였습니다."); + } + + } catch(Exception e) { + cmmCode.setResult("F", "공통코드 등록에 실패하였습니다. 중복코드인지 재확인 바랍니다.)"); + } + + return cmmCode; + + } + + @Override + public CmmCodeVO updateCmmCode(CmmCodeVO menuItem) throws Exception { + if(menuItem == null) { + CmmCodeVO retItem = new CmmCodeVO(); + retItem.setResult("F", "변경할 공통코드 정보가 존재하지 않습니다."); + return retItem; + } + + int ret = cmmCodeDAO.updateCmmCode(menuItem); + if(ret > 0) { + menuItem.setResult("S", "정상적으로 변경되었습니다."); + } else { + menuItem.setResult("F", "변경할 공통코드 정보를 확인할 수 없습니다."); + } + + return menuItem; + + } + + @Override + public CmmCodeVO deleteCmmCode(CmmCodeVO cmmCodeVO) throws Exception { + if(cmmCodeVO == null) { + CmmCodeVO resVO = new CmmCodeVO(); + resVO.setResult("F", "삭제할 공통코드 정보가 존재하지 않습니다."); + return resVO; + } + if(StringUtils.isAllEmpty(cmmCodeVO.getCode())) { + CmmCodeVO resVO = new CmmCodeVO(); + resVO.setResult("F", "삭제할 공통코드 정보가 입력되지 않았습니다."); + return resVO; + } + int detailCodeCnt = cmmCodeDAO.countDetailCode(cmmCodeVO.getCode()); + if(detailCodeCnt > 0) { + CmmCodeVO resVO = new CmmCodeVO(); + resVO.setResult("F", "해당 공통코드 하위의 상세코드가 존재하는 경우 삭제할 수 없습니다."); + return resVO; + } + + int ret = cmmCodeDAO.deleteCmmCode(cmmCodeVO); + if(ret > 0) { + cmmCodeVO.setResult("S", "정상적으로 삭제되었습니다."); + } else { + cmmCodeVO.setResult("F", "삭제 가능한 공통코드 정보를 확인할 수 없습니다."); + } + + return cmmCodeVO; + } + + public List selectListCmmCodeInfo(CmmCodeVO cmmCodeVO) throws Exception { + return cmmCodeDAO.selectListCmmCode(cmmCodeVO); + } + + public CmmCodeVO selectCmmCodeInfo(String code) throws Exception { + + if(StringUtils.isAllEmpty(code)) { + CmmCodeVO retItem = new CmmCodeVO(); + retItem.setResult("F", "조회할 공통코드 정보가 존재하지 않습니다."); + return retItem; + } + + return cmmCodeDAO.selectCmmCodeInfo(code); + } + +} diff --git a/src/main/java/kccf/code/service/impl/CmmDetailCodeServiceImpl.java b/src/main/java/kccf/code/service/impl/CmmDetailCodeServiceImpl.java new file mode 100644 index 0000000..b82e09c --- /dev/null +++ b/src/main/java/kccf/code/service/impl/CmmDetailCodeServiceImpl.java @@ -0,0 +1,141 @@ +package kccf.code.service.impl; + +import java.lang.invoke.MethodHandles; +import java.util.List; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import kccf.code.dao.CmmDetailCodeDAO; +import kccf.code.service.CmmDetailCodeService; +import kccf.code.vo.CmmDetailCodeVO; +import lombok.RequiredArgsConstructor; + +/** + * CmmCodeServiceImpl.java + * Description : 공통상세코드관리 서비스 구현 클래스 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-10-11 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-10-11   KNKIM      최초 생성
    + *  
    + * 
    + */ + +@Service +@RequiredArgsConstructor +public class CmmDetailCodeServiceImpl implements CmmDetailCodeService { + + private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + private final CmmDetailCodeDAO cmmDetailCodeDAO; + + @Override + public CmmDetailCodeVO insertCmmDetailCode(CmmDetailCodeVO cmmDetailCodeVO) throws Exception { + if(cmmDetailCodeVO == null) { + CmmDetailCodeVO retItem = new CmmDetailCodeVO(); + retItem.setResult("F", "등록할 공통상세코드 정보가 존재하지 않습니다."); + return retItem; + } + + try { + int ret = cmmDetailCodeDAO.insertCmmDetailCode(cmmDetailCodeVO); + if(ret > 0) { + cmmDetailCodeVO.setResult("S", "정상적으로 등록되었습니다."); + } else { + cmmDetailCodeVO.setResult("F", "공통상세코드 등록에 실패하였습니다."); + } + + } catch(Exception e) { + e.printStackTrace(); + cmmDetailCodeVO.setResult("F", "공통상세코드 등록에 실패하였습니다. 중복코드인지 재확인 바랍니다.)"); + } + + return cmmDetailCodeVO; + + } + + @Override + public CmmDetailCodeVO updateCmmDetailCode(CmmDetailCodeVO cmmDetailCodeVO) throws Exception { + if(cmmDetailCodeVO == null) { + CmmDetailCodeVO retItem = new CmmDetailCodeVO(); + retItem.setResult("F", "변경할 공통상세코드 정보가 존재하지 않습니다."); + return retItem; + } + + int ret = cmmDetailCodeDAO.updateCmmDetailCode(cmmDetailCodeVO); + if(ret > 0) { + cmmDetailCodeVO.setResult("S", "정상적으로 변경되었습니다."); + } else { + cmmDetailCodeVO.setResult("F", "변경할 공통상세코드 정보를 확인할 수 없습니다."); + } + + return cmmDetailCodeVO; + + } + + @Override + public CmmDetailCodeVO deleteCmmDetailCode(CmmDetailCodeVO cmmDetailCodeVO) throws Exception { + if(cmmDetailCodeVO == null) { + CmmDetailCodeVO retVO = new CmmDetailCodeVO(); + retVO.setResult("F", "삭제할 공통상세코드 정보가 존재하지 않습니다."); + return retVO; + } + if(StringUtils.isAllEmpty(cmmDetailCodeVO.getCode())) { + CmmDetailCodeVO retVO = new CmmDetailCodeVO(); + retVO.setResult("F", "삭제할 공통상세코드의 부모공통코드 정보가 입력되지 않았습니다."); + return retVO; + } + if(StringUtils.isAllEmpty(cmmDetailCodeVO.getDetailCode())) { + CmmDetailCodeVO retVO = new CmmDetailCodeVO(); + retVO.setResult("F", "삭제할 공통상세코드 정보가 입력되지 않았습니다."); + return retVO; + } + + int ret = cmmDetailCodeDAO.deleteCmmDetailCode(cmmDetailCodeVO); + if(ret > 0) { + cmmDetailCodeVO.setResult("S", "정상적으로 삭제되었습니다."); + } else { + cmmDetailCodeVO.setResult("F", "삭제 가능한 공통상세코드 정보를 확인할 수 없습니다."); + } + + return cmmDetailCodeVO; + } + + @Override + public List selectListCmmDetailCode(CmmDetailCodeVO cmmCodeDetailVO) throws Exception { + return cmmDetailCodeDAO.selectListCmmDetailCode(cmmCodeDetailVO); + } + + @Override + public List selectListCmmLclttCode(CmmDetailCodeVO cmmDetailCodeVO) throws Exception { + return cmmDetailCodeDAO.selectListCmmLclttCode(cmmDetailCodeVO); + } + + @Override + public CmmDetailCodeVO selectCmmDetailCodeInfo(CmmDetailCodeVO cmmCodeDetailVO) throws Exception { + + if(cmmCodeDetailVO == null) { + CmmDetailCodeVO retVO = new CmmDetailCodeVO(); + retVO.setResult("F", "조회할 공통상세코드 정보가 존재하지 않습니다."); + return retVO; + } + + if(StringUtils.isAllEmpty(cmmCodeDetailVO.getCode()) || StringUtils.isAllEmpty(cmmCodeDetailVO.getDetailCode())) { + CmmDetailCodeVO retItem = new CmmDetailCodeVO(); + retItem.setResult("F", "조회할 공통코드 정보가 누락되었습니다."); + return retItem; + } + + return cmmDetailCodeDAO.selectCmmDetailCodeInfo(cmmCodeDetailVO); + } + +} diff --git a/src/main/java/kccf/code/service/impl/CtgryCodeServiceImpl.java b/src/main/java/kccf/code/service/impl/CtgryCodeServiceImpl.java new file mode 100644 index 0000000..37e1595 --- /dev/null +++ b/src/main/java/kccf/code/service/impl/CtgryCodeServiceImpl.java @@ -0,0 +1,215 @@ +package kccf.code.service.impl; + +import java.lang.invoke.MethodHandles; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import kccf.code.dao.CtgryCodeDAO; +import kccf.code.service.CtgryCodeService; +import kccf.code.vo.CtgryCodeVO; +import lombok.RequiredArgsConstructor; + +/** + * CtgryCodeServiceImpl.java + * Description : 카테고리코드 서비스 구현 클래스 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-10-11 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-10-11   KNKIM      최초 생성
    + *  
    + * 
    + */ + +@Service +@RequiredArgsConstructor +public class CtgryCodeServiceImpl implements CtgryCodeService { + + private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + private final CtgryCodeDAO ctgryCodeDAO; + + public List selectListCtgry(CtgryCodeVO ctgryCodeVO) throws Exception { + return ctgryCodeDAO.selectListCtgry(ctgryCodeVO); + } + + private int makeTree(List ctgryList, int curIdx) { + + if(ctgryList == null) return -1; + if(curIdx < 0) return -1; + + int len = ctgryList.size(); + if(curIdx >= len) return -1; + if(curIdx == 0) return makeTree(ctgryList, (curIdx+1)); + + // 부모 카테고리 찾기 + CtgryCodeVO parent = null; + CtgryCodeVO curVO = ctgryList.get(curIdx); + int parentIdx = -1; + for(int i=(curIdx-1); i>=0; i--) { + CtgryCodeVO tmpParent = ctgryList.get(i); + if(!StringUtils.isAllBlank(tmpParent.getCtgryCode()) && tmpParent.getCtgryCode().equals(curVO.getUpperCtgryCode())) { + parentIdx = i; + parent = tmpParent; + break; + } + } + + if(parent == null) return makeTree(ctgryList, (curIdx+1)); + + + CtgryCodeVO preChild = null; + for(int i=curIdx; i ctgryList = ctgryCodeDAO.selectListCtgry(ctgryCodeVO); + if(ctgryList == null || ctgryList.isEmpty()) { + retVO = new CtgryCodeVO(); + retVO.setResultCode("F"); + retVO.setResultMessage("해당하는 카테고리 정보가 없습니다."); + return retVO; + } + + retVO = ctgryList.get(0); + + if(retVO.getCtgryLvl() != 0) { + retVO.setResultCode("F"); + retVO.setResultMessage("최상단 카테고리 정보가 없습니다."); + return retVO; + } + + if(ctgryList.size() > 1) { + makeTree(ctgryList, 1); + } + + retVO.setResultCode("S"); + retVO.setResultMessage("정상적으로 조회되었습니다."); + + return retVO; + } + + public CtgryCodeVO selectCtgryInfo(String ctgryCode) throws Exception { + + if(StringUtils.isAllEmpty(ctgryCode)) { + CtgryCodeVO retItem = new CtgryCodeVO(); + retItem.setResult("F", "조회할 카테고리코드 정보가 존재하지 않습니다."); + return retItem; + } + + return ctgryCodeDAO.selectCtgryInfo(ctgryCode); + } + + @Override + public CtgryCodeVO insertCtgry(CtgryCodeVO ctgryCodeVO) throws Exception { + if(ctgryCodeVO == null) { + CtgryCodeVO retItem = new CtgryCodeVO(); + retItem.setResult("F", "등록할 카테고리코드 정보가 존재하지 않습니다."); + return retItem; + } + + try { + int ret = ctgryCodeDAO.insertCtgry(ctgryCodeVO); + if(ret > 0) { + ctgryCodeVO.setResult("S", "정상적으로 등록되었습니다."); + } else { + ctgryCodeVO.setResult("F", "카테고리코드 등록에 실패하였습니다."); + } + + } catch(Exception e) { + ctgryCodeVO.setResult("F", "카테고리코드 등록에 실패하였습니다. 중복코드인지 재확인 바랍니다.)"); + } + + return ctgryCodeVO; + + } + + @Override + public CtgryCodeVO updateCtgry(CtgryCodeVO ctgryCodeVO) throws Exception { + if(ctgryCodeVO == null) { + CtgryCodeVO retItem = new CtgryCodeVO(); + retItem.setResult("F", "변경할 카테고리코드 정보가 존재하지 않습니다."); + return retItem; + } + + int ret = ctgryCodeDAO.updateCtgry(ctgryCodeVO); + if(ret > 0) { + ctgryCodeVO.setResult("S", "정상적으로 변경되었습니다."); + } else { + ctgryCodeVO.setResult("F", "변경할 카테고리코드 정보를 확인할 수 없습니다."); + } + + return ctgryCodeVO; + + } + + @Override + public CtgryCodeVO deleteCtgry(CtgryCodeVO ctgryCodeVO) throws Exception { + if(ctgryCodeVO == null) { + CtgryCodeVO retVO = new CtgryCodeVO(); + retVO.setResult("F", "삭제할 카테고리코드 정보가 존재하지 않습니다."); + return retVO; + } + if(StringUtils.isAllEmpty(ctgryCodeVO.getCtgryCode())) { + CtgryCodeVO retVO = new CtgryCodeVO(); + retVO.setResult("F", "삭제할 카테고리코드 정보가 입력되지 않았습니다."); + return retVO; + } + int detailCodeCnt = ctgryCodeDAO.countSubCategory(ctgryCodeVO.getCtgryCode()); + if(detailCodeCnt > 0) { + CtgryCodeVO retVO = new CtgryCodeVO(); + retVO.setResult("F", "하위 카테고리코드가 존재하는 경우 삭제할 수 없습니다."); + return retVO; + } + + int ret = ctgryCodeDAO.deleteCtgry(ctgryCodeVO); + if(ret > 0) { + ctgryCodeVO.setResult("S", "정상적으로 삭제되었습니다."); + } else { + ctgryCodeVO.setResult("F", "삭제 가능한 카테고리코드 정보를 확인할 수 없습니다."); + } + + return ctgryCodeVO; + } + +} diff --git a/src/main/java/kccf/code/vo/CmmCodeVO.java b/src/main/java/kccf/code/vo/CmmCodeVO.java new file mode 100644 index 0000000..843f3da --- /dev/null +++ b/src/main/java/kccf/code/vo/CmmCodeVO.java @@ -0,0 +1,54 @@ +package kccf.code.vo; + +import java.util.List; + + +import kccf.cmm.vo.CmmBaseVO; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +/** + * CmmCodeVO.java + * Description : 공통코드 정보를 담는 VO + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-10-05 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-10-05   KNKIM      최초 생성
    + *  
    + * 
    + */ + +@Getter +@Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class CmmCodeVO extends CmmBaseVO implements Cloneable { + + String searchCode; /* 검색 코드 */ + String searchCodeNm; /* 검색 코드명 */ + String searchDetailCode; /* 검색 코드 */ + String searchDetailCodeNm; /* 검색 코드명 */ + String searchUseYn; /* 검색 사용여부 */ + + String code; /* 코드 */ + String codeNm; /* 코드명 */ + String aditAtrbInfoNm1; /* 추가속성정보명1 */ + String aditAtrbInfoNm2; /* 추가속성정보명2 */ + String aditAtrbInfoNm3; /* 추가속성정보명3 */ + String dcCn; /* 설명내용 */ + String useYn; /* 사용여부 */ + + String opType; /* 처리유형 : C 신규, U 수정, D 삭제 */ + + List detailCodeList; /* 상세코드목록 */ +} diff --git a/src/main/java/kccf/code/vo/CmmDetailCodeVO.java b/src/main/java/kccf/code/vo/CmmDetailCodeVO.java new file mode 100644 index 0000000..d704cbe --- /dev/null +++ b/src/main/java/kccf/code/vo/CmmDetailCodeVO.java @@ -0,0 +1,55 @@ +package kccf.code.vo; + +import kccf.cmm.vo.CmmBaseVO; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +/** + * CmmCodeDetailVO.java + * Description : 공통 상세 코드 정보를 담는 VO + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-10-11 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-10-11   KNKIM      최초 생성
    + *  
    + * 
    + */ + +@Getter +@Setter +@ToString +@NoArgsConstructor + +public class CmmDetailCodeVO extends CmmBaseVO implements Cloneable { + + String searchCode; /* 검색 코드 */ + String searchCodeNm; /* 검색 코드명 */ + String searchDetailCode; /* 검색 코드 */ + String searchDetailCodeNm; /* 검색 코드명 */ + String searchUseYn; /* 검색 사용여부 */ + + String code; /* 코드 */ + String codeNm; /* 코드명 */ + String detailCode; /* 상세코드 */ + String detailCodeNm; /* 상세코드명 */ + String aditAtrbInfoValue1; /* 추가속성정보값1 */ + String aditAtrbInfoValue2; /* 추가속성정보값2 */ + String aditAtrbInfoValue3; /* 추가속성정보값3 */ + String dcCn; /* 설명내용 */ + String sortSn; /* 정렬순번 */ + String indictYn; /* 표시여부 */ + + String ascYn; /* 코드표시정렬순차여부 (Y:순차, N:역순) */ + + String useYn; /* 사용여부 */ + + String opType; /* 처리유형 : C 신규, U 수정, D 삭제 */ +} diff --git a/src/main/java/kccf/code/vo/CtgryCodeVO.java b/src/main/java/kccf/code/vo/CtgryCodeVO.java new file mode 100644 index 0000000..633f52c --- /dev/null +++ b/src/main/java/kccf/code/vo/CtgryCodeVO.java @@ -0,0 +1,63 @@ +package kccf.code.vo; + +import java.util.ArrayList; +import java.util.List; + +import kccf.cmm.vo.CmmBaseVO; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +/** + * CtgryCodeVO.java + * Description : 카테고리코드 정보를 담는 VO + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-10-11 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-10-11   KNKIM      최초 생성
    + *  
    + * 
    + */ + +@Getter +@Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class CtgryCodeVO extends CmmBaseVO implements Cloneable { + + String searchUpperCtgryCode; /* 검색 상위카테고리코드 */ + String searchCtgryCode; /* 검색 코드 */ + String searchCtgryNm; /* 검색 코드명 */ + String searchUseYn; /* 검색 사용여부 */ + int searchCtgryLvl; /* 검색 표출 카테고리단계 (0: 제한없음, 기본값) */ + + String ctgryCode; /* 카테고리코드 */ + String ctgryNm; /* 카테고리명 */ + int ctgryLvl; /* 카테고리단계 */ + String upperCtgryCode; /* 상위카테고리코드 */ + String upperCtgryNm; /* 상위카테고리명 */ + String sortSn; /* 정렬순번 */ + String dcCn; /* 설명내용 */ + String useYn; /* 사용여부 */ + + String ctgryCodePath; /* 카테고리코드계층코드 */ + String opType; /* 처리유형 : C 신규, U 수정, D 삭제 */ + + List children; /* 하위카테고리목록 */ + + public void addChild(CtgryCodeVO ctgryCodeVO) { + if(ctgryCodeVO == null) return; + if(children == null) children = new ArrayList(); + children.add(ctgryCodeVO); + } + +} diff --git a/src/main/java/kccf/code/web/CmmCodeController.java b/src/main/java/kccf/code/web/CmmCodeController.java new file mode 100644 index 0000000..ebf1b45 --- /dev/null +++ b/src/main/java/kccf/code/web/CmmCodeController.java @@ -0,0 +1,218 @@ +package kccf.code.web; + +import java.lang.invoke.MethodHandles; +import java.util.List; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import kccf.auth.web.AuthUtil; +import kccf.cmm.web.CmmBaseController; +import kccf.code.service.CmmCodeService; +import kccf.code.vo.CmmCodeVO; +import kccf.menu.vo.MenuItemVO; +import lombok.RequiredArgsConstructor; + +/** + * CmmMediaController.java + * Description : 공통코드관리 컨트롤러 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-10-05 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-10-05   KNKIM      최초 생성
    + *  
    + * 
    + */ + +@Controller +@RequiredArgsConstructor +public class CmmCodeController extends CmmBaseController { + + private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + private final CmmCodeService cmmCodeService; + + /** + * @Description : 공통코드관리 목록 화면을 구성한다. + * @param model + * @param cmmCodeItem + * @return + * @throws Exception + */ + @RequestMapping("/sec/code/listCmmCode.do") + public String listCmmCode(ModelMap model, CmmCodeVO searchVO) throws Exception { + model.addAttribute("searchVO", searchVO); + return getHostId() + "/code/listCmmCode"; + } + + /** + * @Description : 공통코드관리 목록을 조회한다. + * @param model + * @param menuItem + * @return + * @throws Exception + */ + @RequestMapping("/sec/code/listCmmCodeJson.do") + public String listCmmCodeJson(ModelMap model, CmmCodeVO searchVO) throws Exception { + + List cmmCodeList = cmmCodeService.selectListCmmCodeInfo(searchVO); + + int totCnt = 0; + if(cmmCodeList != null && cmmCodeList.size() > 0) { + totCnt = cmmCodeList.get(0).getTotCnt(); + } + searchVO.setTotCnt(totCnt); + + model.addAttribute("data" , cmmCodeList); + model.addAttribute("searchVO", searchVO); + + return "jsonView"; + } + + /** + * @Description : 공통코드관리 목록 화면을 구성한다. + * @param model + * @param cmmCodeItem + * @return + * @throws Exception + */ + @RequestMapping("/sec/code/formCmmCodeInfo.do") + public String formCmmCodeInfo(ModelMap model, CmmCodeVO cmmCodeVO) throws Exception { + + CmmCodeVO retVO = null; + + if(cmmCodeVO == null) { + retVO = new CmmCodeVO(); + retVO.setOpType("C"); + } else if(!StringUtils.isAllEmpty(cmmCodeVO.getCode())) { + retVO = cmmCodeService.selectCmmCodeInfo(cmmCodeVO.getCode()); + retVO.setOpType("U"); + } + + model.addAttribute("paramVO" , cmmCodeVO); + model.addAttribute("cmmCodeVO", retVO); + + return getHostId() + "/code/formCmmCodeInfo"; + } + + /** + * @Description : 공통코드 상세 정보를 조회한다. + * @param model + * @param cmmCodeVO + * @return + * @throws Exception + */ + @RequestMapping("/sec/code/getCmmCodeInfoJson.do") + public String getCmmCodeInfoJson(ModelMap model, CmmCodeVO cmmCodeVO) throws Exception { + + CmmCodeVO resItem = null; + + if(cmmCodeVO == null) { + resItem = new CmmCodeVO(); + resItem.setResult("F", "조회할 공통코드 정보가 존재하지 않습니다."); + } else if(StringUtils.isAllBlank(cmmCodeVO.getCode())) { + resItem = new CmmCodeVO(); + resItem.setResult("F", "조회할 공통코드는 필수입력 항목입니다."); + } else { + resItem = cmmCodeService.selectCmmCodeInfo(cmmCodeVO.getCode()); + if(resItem == null) { + resItem = new CmmCodeVO(); + resItem.setResult("W", "해당 공통코드는 존재하지 않습니다."); + } else if(!StringUtils.isAllEmpty(resItem.getCode())) { + resItem.setResult("S", "정상적으로 조회되었습니다."); + } + } + + model.addAttribute("cmmCodeVO", resItem); + + return "jsonView"; + } + + /** + * @Description : 공통코드 정보 등록/수정을 처리한다. + * @param model + * @param menuItem + * @return + * @throws Exception + */ + @RequestMapping("/sec/code/saveCmmCodeInfoJson.do") + public String saveCmmCodeInfoJson(ModelMap model, CmmCodeVO cmmCodeVO) throws Exception { + + CmmCodeVO resVO = null; + + if(!AuthUtil.canWrite(getUserId(), getSiteSeCode(), getSelMenuId(), null)) { + resVO = new CmmCodeVO(); + resVO.setResult("F", "변경 권한이 존재하지 않습니다."); + model.addAttribute("resVO", resVO); + return "jsonView"; + } + + if(cmmCodeVO == null) { + resVO = new CmmCodeVO(); + resVO.setResult("F", "저장할 공통코드 정보가 존재하지 않습니다."); + } else if("C".equals(cmmCodeVO.getOpType())) { + cmmCodeVO.setRegUserId(getUserId()); + cmmCodeVO.setUpdUserId(getUserId()); + resVO = cmmCodeService.insertCmmCode(cmmCodeVO); + } else { + cmmCodeVO.setUpdUserId(getUserId()); + resVO = cmmCodeService.updateCmmCode(cmmCodeVO); + } + + model.addAttribute("resVO", resVO); + + return "jsonView"; + } + + /** + * @Description : 공통코드 정보 삭제를 처리한다. + * @param model + * @param menuItem + * @return + * @throws Exception + */ + @RequestMapping("/sec/code/deleteCmmCodeInfoJson.do") + public String deleteCmmCodeInfoJson(ModelMap model, CmmCodeVO cmmCodeVO) throws Exception { + + CmmCodeVO resVO = null; + + if(!AuthUtil.canWrite(getUserId(), getSiteSeCode(), getSelMenuId(), null)) { + resVO = new CmmCodeVO(); + resVO.setResult("F", "변경 권한이 존재하지 않습니다."); + model.addAttribute("resVO", resVO); + return "jsonView"; + } + + if(cmmCodeVO == null) { + resVO = new CmmCodeVO(); + resVO.setResult("F", "메뉴 정보가 존재하지 않습니다."); + } else if(StringUtils.isAllBlank(cmmCodeVO.getCode())) { + resVO = new CmmCodeVO(); + resVO.setResult("F", "메뉴ID를 확인할 수 없습니다."); + } else { + resVO = cmmCodeService.deleteCmmCode(cmmCodeVO); + } + + model.addAttribute("resVO", resVO); + + return "jsonView"; + } + + @RequestMapping("/sec/code/selectCmmCodePopup.do") + public String selectCmmCodePopup(ModelMap model, CmmCodeVO cmmCodeVO) throws Exception { + + return getHostId() + "/code/selectCmmCodePopup"; + } + + +} diff --git a/src/main/java/kccf/code/web/CmmDetailCodeController.java b/src/main/java/kccf/code/web/CmmDetailCodeController.java new file mode 100644 index 0000000..603a741 --- /dev/null +++ b/src/main/java/kccf/code/web/CmmDetailCodeController.java @@ -0,0 +1,250 @@ +package kccf.code.web; + +import java.lang.invoke.MethodHandles; +import java.util.List; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import kccf.auth.web.AuthUtil; +import kccf.cmm.web.CmmBaseController; +import kccf.code.service.CmmDetailCodeService; +import kccf.code.vo.CmmCodeVO; +import kccf.code.vo.CmmDetailCodeVO; +import lombok.RequiredArgsConstructor; + +/** + * CmmDetailCodeController.java + * Description : 공통상세코드관리 컨트롤러 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-10-11 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-10-11   KNKIM      최초 생성
    + *  
    + * 
    + */ + +@Controller +@RequiredArgsConstructor +public class CmmDetailCodeController extends CmmBaseController { + + private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + private final CmmDetailCodeService cmmCodeDetailService; + + /** + * @Description : 공통상세코드관리 목록 화면을 구성한다. + * @param model + * @param searchVO + * @return + * @throws Exception + */ + @RequestMapping("/sec/code/listCmmDetailCode.do") + public String listCmmDetailCode(ModelMap model, CmmDetailCodeVO searchVO) throws Exception { + model.addAttribute("searchVO", searchVO); + return getHostId() + "/code/listCmmDetailCode"; + } + + /** + * @Description : 공통상세코드관리 목록을 조회한다. + * @param model + * @param menuItem + * @return + * @throws Exception + */ + @RequestMapping("/sec/code/listCmmDetailCodeJson.do") + public String listCmmDetailCodeJson(ModelMap model, CmmDetailCodeVO searchVO) throws Exception { + + List cmmDetailCodeList = cmmCodeDetailService.selectListCmmDetailCode(searchVO); + + int totCnt = 0; + if(cmmDetailCodeList != null && cmmDetailCodeList.size() > 0) { + totCnt = cmmDetailCodeList.get(0).getTotCnt(); + } + searchVO.setTotCnt(totCnt); + + model.addAttribute("data", cmmDetailCodeList); + model.addAttribute("searchVO", searchVO); + + return "jsonView"; + } + + /** + * @Description : 공통상세코드관리 목록을 조회한다. + * @param model + * @param menuItem + * @return + * @throws Exception + */ + @RequestMapping({"/code/listCmmLclttCodeJson.do", "/sec/code/listCmmLclttCodeJson.do"}) + public String listCmmLclttCodeJson(ModelMap model, CmmDetailCodeVO searchVO) throws Exception { + + List cmmDetailCodeList = cmmCodeDetailService.selectListCmmLclttCode(searchVO); + + int totCnt = 0; + if(cmmDetailCodeList != null && cmmDetailCodeList.size() > 0) { + totCnt = cmmDetailCodeList.get(0).getTotCnt(); + } + searchVO.setTotCnt(totCnt); + + model.addAttribute("data", cmmDetailCodeList); + model.addAttribute("searchVO", searchVO); + + return "jsonView"; + } + + /** + * @Description : 공통상세코드관리 목록 화면을 구성한다. + * @param model + * @param cmmDetailCodeVO + * @return + * @throws Exception + */ + @RequestMapping("/sec/code/formCmmDetailCodePopup.do") + public String formCmmDetailCodePopup(ModelMap model, CmmDetailCodeVO cmmDetailCodeVO) throws Exception { + + CmmDetailCodeVO retVO = null; + + if(cmmDetailCodeVO == null) { + retVO = new CmmDetailCodeVO(); + retVO.setResult("F", "공통코드 정보를 확인할 수 없습니다."); + } else if(!StringUtils.isAllEmpty(cmmDetailCodeVO.getCode()) && !StringUtils.isAllEmpty(cmmDetailCodeVO.getDetailCode())) { + retVO = cmmCodeDetailService.selectCmmDetailCodeInfo(cmmDetailCodeVO); + retVO.setOpType("U"); + } else if(!StringUtils.isAllEmpty(cmmDetailCodeVO.getCode()) && StringUtils.isAllEmpty(cmmDetailCodeVO.getDetailCode())) { + retVO = new CmmDetailCodeVO(); + retVO.setOpType("C"); + } else { + retVO = new CmmDetailCodeVO(); + retVO.setResult("F", "관련 공통코드 정보를 확인할 수 없습니다."); + } + + model.addAttribute("retVO", retVO); + + return getHostId() + "/code/formCmmDetailCodePopup"; + } + + /** + * @Description : 공통세부코드 상세 정보를 조회한다. + * @param model + * @param cmmDetailCodeVO + * @return + * @throws Exception + */ + @RequestMapping("/sec/code/getCmmDetailCodeInfoJson.do") + public String getCmmDetailCodeInfoJson(ModelMap model, CmmDetailCodeVO cmmDetailCodeVO) throws Exception { + + CmmDetailCodeVO retItem = null; + + if(cmmDetailCodeVO == null) { + retItem = new CmmDetailCodeVO(); + retItem.setResult("F", "조회할 공통세부코드 정보가 존재하지 않습니다."); + } else if(StringUtils.isAllBlank(cmmDetailCodeVO.getCode())) { + retItem = new CmmDetailCodeVO(); + retItem.setResult("F", "조회할 공통상세코드의 부모코드는 필수입력 항목입니다."); + } else if(StringUtils.isAllBlank(cmmDetailCodeVO.getDetailCode())) { + retItem = new CmmDetailCodeVO(); + retItem.setResult("F", "조회할 공통상세코드는 필수입력 항목입니다."); + } else { + retItem = cmmCodeDetailService.selectCmmDetailCodeInfo(cmmDetailCodeVO); + if(retItem == null) { + retItem = new CmmDetailCodeVO(); + retItem.setResult("W", "해당 공통상세코드는 존재하지 않습니다."); + } else if(!StringUtils.isAllEmpty(retItem.getDetailCode())) { + retItem.setResult("S", "정상적으로 조회되었습니다."); + } else { + retItem.setResult("W", "해당 공통상세코드는 존재하지 않습니다."); + } + } + + model.addAttribute("cmmDetailCodeVO", retItem); + + return "jsonView"; + } + + /** + * @Description : 공통세부코드 정보 등록/수정을 처리한다. + * @param model + * @param cmmDetailCodeVO + * @return + * @throws Exception + */ + @RequestMapping("/sec/code/saveCmmDetailCodeInfoJson.do") + public String saveCmmDetailCodeInfoJson(ModelMap model, CmmDetailCodeVO cmmDetailCodeVO) throws Exception { + + CmmDetailCodeVO resVO = null; + + if(!AuthUtil.canWrite(getUserId(), getSiteSeCode(), getSelMenuId(), null)) { + resVO = new CmmDetailCodeVO(); + resVO.setResult("F", "변경 권한이 존재하지 않습니다."); + model.addAttribute("resVO", resVO); + return "jsonView"; + } + + if(cmmDetailCodeVO == null) { + resVO = new CmmDetailCodeVO(); + resVO.setResult("F", "저장할 공통세부코드 정보가 존재하지 않습니다."); + } else if("C".equals(cmmDetailCodeVO.getOpType())) { + cmmDetailCodeVO.setRegUserId(getUserId()); + cmmDetailCodeVO.setUpdUserId(getUserId()); + resVO = cmmCodeDetailService.insertCmmDetailCode(cmmDetailCodeVO); + } else { + cmmDetailCodeVO.setUpdUserId(getUserId()); + resVO = cmmCodeDetailService.updateCmmDetailCode(cmmDetailCodeVO); + } + + model.addAttribute("resVO", resVO); + + return "jsonView"; + } + + /** + * @Description : 공통세부코드 정보 삭제를 처리한다. + * @param model + * @param cmmDetailCodeVO + * @return + * @throws Exception + */ + @RequestMapping("/sec/code/deleteCmmDetailCodeInfoJson.do") + public String deleteCmmDetailCodeInfoJson(ModelMap model, CmmDetailCodeVO cmmDetailCodeVO) throws Exception { + + CmmDetailCodeVO resVO = null; + + if(!AuthUtil.canWrite(getUserId(), getSiteSeCode(), getSelMenuId(), null)) { + resVO = new CmmDetailCodeVO(); + resVO.setResult("F", "변경 권한이 존재하지 않습니다."); + model.addAttribute("resVO", resVO); + return "jsonView"; + } + + if(cmmDetailCodeVO == null) { + resVO = new CmmDetailCodeVO(); + resVO.setResult("F", "메뉴 정보가 존재하지 않습니다."); + } else if(StringUtils.isAllBlank(cmmDetailCodeVO.getCode())) { + resVO = new CmmDetailCodeVO(); + resVO.setResult("F", "메뉴ID를 확인할 수 없습니다."); + } else { + resVO = cmmCodeDetailService.deleteCmmDetailCode(cmmDetailCodeVO); + } + + model.addAttribute("resVO", resVO); + + return "jsonView"; + } + + @RequestMapping("/sec/code/selectCmmDetailCodePopup.do") + public String selectCmmDetailCodePopup(ModelMap model, CmmCodeVO cmmCodeVO) throws Exception { + + return getHostId() + "/code/selectCmmDetailCodePopup"; + } +} diff --git a/src/main/java/kccf/code/web/CodeTagHandler.java b/src/main/java/kccf/code/web/CodeTagHandler.java new file mode 100644 index 0000000..89fbc52 --- /dev/null +++ b/src/main/java/kccf/code/web/CodeTagHandler.java @@ -0,0 +1,150 @@ +package kccf.code.web; + +import java.lang.invoke.MethodHandles; +import java.util.List; + +import javax.servlet.jsp.JspWriter; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.AutowireCapableBeanFactory; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.servlet.tags.RequestContextAwareTag; + +import kccf.code.service.CmmDetailCodeService; +import kccf.code.vo.CmmDetailCodeVO; +import lombok.Setter; + +@Setter +public class CodeTagHandler extends RequestContextAwareTag { + + private static final long serialVersionUID = 1L; + + private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + String inputName; /* form input 명 */ + String code; /* 코드 */ + String codeNameCol; /* 코드명으로 출력할 컬럼 */ + String defaultDetailCode; /* 기본선택 상세코드 */ + String inputType; /* form input 유형 : select | radio (기본) */ + String nullItemTitle; /* 첫항목 표시명 */ + String dispCodeYn; /* 코드표시여부 */ + String ascYn; /* 코드표시정렬순차여부 (Y:순차, N:역순) */ + + String indictYn; /* 표시여부 */ + String aditAtrbInfoValue1; /* 추가속성정보값1 */ + String aditAtrbInfoValue2; /* 추가속성정보값2 */ + String aditAtrbInfoValue3; /* 추가속성정보값3 */ + + @Autowired + private CmmDetailCodeService cmmDetailCodeService; + + @Override + protected int doStartTagInternal() throws Exception { + JspWriter out = pageContext.getOut(); + + if(StringUtils.isAllBlank(defaultDetailCode)) { + String attrDefaultDetailCode = (String)pageContext.getAttribute("defaultDetailCode"); + if(!StringUtils.isAllBlank(attrDefaultDetailCode)) { + defaultDetailCode = attrDefaultDetailCode; + } + } + + try{ + CmmDetailCodeVO searchVO = new CmmDetailCodeVO(); + + searchVO.setCode(code); + searchVO.setIndictYn(indictYn); + searchVO.setAditAtrbInfoValue1(aditAtrbInfoValue1); + searchVO.setAditAtrbInfoValue2(aditAtrbInfoValue2); + searchVO.setAditAtrbInfoValue3(aditAtrbInfoValue3); + searchVO.setAscYn(ascYn); + + if (cmmDetailCodeService == null) { + WebApplicationContext webApplicationContext = getRequestContext().getWebApplicationContext(); + AutowireCapableBeanFactory autowireCapableBeanFactory = webApplicationContext.getAutowireCapableBeanFactory(); + autowireCapableBeanFactory.autowireBean(this); + } + + List cmmDetailCodeList = cmmDetailCodeService.selectListCmmDetailCode(searchVO); + + boolean isSelectType = false; + String openTagStr = null; + String endTagStr = null; + if(StringUtils.isAllBlank(inputType) || "radio".equalsIgnoreCase(inputType)) { + openTagStr = "
    "; + endTagStr = "
    "; + } else { + openTagStr = ""; + isSelectType = true; + } + + out.print(openTagStr); + + if(cmmDetailCodeList != null) { + int cnt = cmmDetailCodeList.size(); + + if(!StringUtils.isAllBlank(nullItemTitle)) { + if(isSelectType) { + out.print(""); + } else { + out.print("
    \n" + + " \n" + + " \n" + "
    "); + } + } + + for(int i=0; i"); + if("Y".equalsIgnoreCase(dispCodeYn)) { + out.print("[" + item.getDetailCode() + "] "); + } + out.print(item.getDetailCodeNm() + ""); + } else { + out.print("
    \n" + + " \n" + + " \n" + "
    "); + } + } + } + + out.print(endTagStr); + + } catch(Exception e) { + e.printStackTrace(); + } + + return SKIP_BODY; + } + +} diff --git a/src/main/java/kccf/code/web/CtgryCodeController.java b/src/main/java/kccf/code/web/CtgryCodeController.java new file mode 100644 index 0000000..dd4c206 --- /dev/null +++ b/src/main/java/kccf/code/web/CtgryCodeController.java @@ -0,0 +1,222 @@ +package kccf.code.web; + +import java.lang.invoke.MethodHandles; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import kccf.auth.web.AuthUtil; +import kccf.cmm.web.CmmBaseController; +import kccf.code.service.CtgryCodeService; +import kccf.code.vo.CmmCodeVO; +import kccf.code.vo.CmmDetailCodeVO; +import kccf.code.vo.CtgryCodeVO; +import lombok.RequiredArgsConstructor; + +/** + * CtgryCodeController.java + * Description : 카테고리코드관리 컨트롤러 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-10-11 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-10-11   KNKIM      최초 생성
    + *  
    + * 
    + */ + +@Controller +@RequiredArgsConstructor +public class CtgryCodeController extends CmmBaseController { + + private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + private final CtgryCodeService ctgryCodeService; + + /** + * @Description : 카테고리코드관리 목록 화면을 구성한다. + * @param model + * @param searchVO + * @return + * @throws Exception + */ + @RequestMapping("/sec/code/listCtgry.do") + public String listCtgry(ModelMap model, CtgryCodeVO searchVO) throws Exception { + model.addAttribute("searchVO", searchVO); + return getHostId() + "/code/listCtgry"; + } + + /** + * @Description : 카테고리코드관리 목록을 조회한다. + * @param model + * @param searchVO + * @return + * @throws Exception + */ + @RequestMapping("/sec/code/listCtgryJson.do") + public String listCtgryJson(ModelMap model, CtgryCodeVO searchVO) throws Exception { + + CtgryCodeVO retVO = ctgryCodeService.selectCtgryTree(searchVO); + + List list = new ArrayList(); + list.add(retVO); + + model.addAttribute("data", list); + model.addAttribute("searchVO", searchVO); + + return "jsonView"; + } + + /** + * @Description : 카테고리코드관리 목록 화면을 구성한다. + * @param model + * @param cmmCategoryVO + * @return + * @throws Exception + */ + @RequestMapping("/sec/code/formCtgryInfo.do") + public String formCtgryInfo(ModelMap model, CtgryCodeVO cmmCategoryVO) throws Exception { + + CtgryCodeVO retVO = null; + + if(cmmCategoryVO == null) { + retVO = new CtgryCodeVO(); + retVO.setOpType("C"); + } else if(!StringUtils.isAllEmpty(cmmCategoryVO.getCtgryCode())) { + retVO = ctgryCodeService.selectCtgryInfo(cmmCategoryVO.getCtgryCode()); + if(retVO != null) { + retVO.setOpType("U"); + retVO.setResult("S", null); + } else { + retVO = new CtgryCodeVO(); + retVO.setResult("F", "해당 정보를 확인할 수 없습니다."); + } + } + + model.addAttribute("paramVO" , cmmCategoryVO); + model.addAttribute("cmmCategoryVO", retVO); + + return getHostId() + "/code/formCtgryInfo"; + } + + /** + * @Description : 카테고리코드 상세 정보를 조회한다. + * @param model + * @param cmmCategoryVO + * @return + * @throws Exception + */ + @RequestMapping("/sec/code/getCtgryInfoJson.do") + public String getCtgryInfoJson(ModelMap model, CtgryCodeVO cmmCategoryVO) throws Exception { + + CtgryCodeVO retVO = null; + + if(cmmCategoryVO == null) { + retVO = new CtgryCodeVO(); + retVO.setResult("F", "조회할 카테고리코드 정보가 존재하지 않습니다."); + } else if(StringUtils.isAllBlank(cmmCategoryVO.getCtgryCode())) { + retVO = new CtgryCodeVO(); + retVO.setResult("F", "조회할 카테고리코드는 필수입력 항목입니다."); + } else { + retVO = ctgryCodeService.selectCtgryInfo(cmmCategoryVO.getCtgryCode()); + if(retVO == null) { + retVO = new CtgryCodeVO(); + retVO.setResult("W", "해당 카테고리코드는 존재하지 않습니다."); + } else if(!StringUtils.isAllEmpty(retVO.getCtgryCode())) { + retVO.setResult("S", "정상적으로 조회되었습니다."); + } + } + + model.addAttribute("cmmCategoryVO", retVO); + + return "jsonView"; + } + + /** + * @Description : 카테고리코드 정보 등록/수정을 처리한다. + * @param model + * @param cmmCategoryVO + * @return + * @throws Exception + */ + @RequestMapping("/sec/code/saveCtgryInfoJson.do") + public String saveCtgryInfoJson(ModelMap model, CtgryCodeVO cmmCategoryVO) throws Exception { + + CtgryCodeVO resVO = null; + + if(!AuthUtil.canWrite(getUserId(), getSiteSeCode(), getSelMenuId(), null)) { + resVO = new CtgryCodeVO(); + resVO.setResult("F", "변경 권한이 존재하지 않습니다."); + model.addAttribute("resVO", resVO); + return "jsonView"; + } + + if(cmmCategoryVO == null) { + resVO = new CtgryCodeVO(); + resVO.setResult("F", "저장할 카테고리코드 정보가 존재하지 않습니다."); + } else if("C".equals(cmmCategoryVO.getOpType())) { + cmmCategoryVO.setRegUserId(getUserId()); + cmmCategoryVO.setUpdUserId(getUserId()); + resVO = ctgryCodeService.insertCtgry(cmmCategoryVO); + } else { + cmmCategoryVO.setUpdUserId(getUserId()); + resVO = ctgryCodeService.updateCtgry(cmmCategoryVO); + } + + model.addAttribute("resVO", resVO); + + return "jsonView"; + } + + /** + * @Description : 카테고리코드 정보 삭제를 처리한다. + * @param model + * @param cmmCategoryVO + * @return + * @throws Exception + */ + @RequestMapping("/sec/code/deleteCtgryInfoJson.do") + public String deleteCtgryInfoJson(ModelMap model, CtgryCodeVO cmmCategoryVO) throws Exception { + + CtgryCodeVO retVO = null; + + if(!AuthUtil.canWrite(getUserId(), getSiteSeCode(), getSelMenuId(), null)) { + retVO = new CtgryCodeVO(); + retVO.setResult("F", "변경 권한이 존재하지 않습니다."); + model.addAttribute("cmmCategoryVO", retVO); + return "jsonView"; + } + + if(cmmCategoryVO == null) { + retVO = new CtgryCodeVO(); + retVO.setResult("F", "카테고리 정보가 존재하지 않습니다."); + } else if(StringUtils.isAllBlank(cmmCategoryVO.getCtgryCode())) { + retVO = new CtgryCodeVO(); + retVO.setResult("F", "카테고리ID를 확인할 수 없습니다."); + } else { + retVO = ctgryCodeService.deleteCtgry(cmmCategoryVO); + } + + model.addAttribute("cmmCategoryVO", retVO); + + return "jsonView"; + } + + @RequestMapping("/sec/code/selectCtgryPopup.do") + public String selectCtgryPopup(ModelMap model, CmmCodeVO cmmCodeVO) throws Exception { + + return getHostId() + "/code/selectCtgryPopup"; + } + +} diff --git a/src/main/java/kccf/env/dao/EnvDAO.java b/src/main/java/kccf/env/dao/EnvDAO.java new file mode 100644 index 0000000..d20ad59 --- /dev/null +++ b/src/main/java/kccf/env/dao/EnvDAO.java @@ -0,0 +1,49 @@ +package kccf.env.dao; + +import java.util.List; + +import org.springframework.stereotype.Repository; + +import kccf.cmm.dao.CmmBaseDAO; +import kccf.env.vo.EnvVO; + +/** + * @class : EnvDAO.java + * @description : 시스템환경설정관리 DAO + * + * @author 한국문화원연합회 / (주)디지탈쉽 + * @since 2023-10-19 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-10-19   KNKIM      최초 생성
    + *  
    + * 
    + */ +@Repository +public class EnvDAO extends CmmBaseDAO { + + public int insertEnv(EnvVO envVO) throws Exception { + return insert("envDAO.insertEnv", envVO); + } + + public int updateEnv(EnvVO envVO) throws Exception { + return update("envDAO.updateEnv", envVO); + } + + public int deleteEnv(EnvVO envVO) throws Exception { + return delete("envDAO.deleteEnv", envVO); + } + + public List selectListEnv(EnvVO envVO) throws Exception { + return selectList("envDAO.selectListEnv", envVO); + } + + public EnvVO selectEnvInfo(EnvVO envVO) throws Exception { + return selectOne("envDAO.selectEnvInfo", envVO); + } + +} diff --git a/src/main/java/kccf/env/service/EnvService.java b/src/main/java/kccf/env/service/EnvService.java new file mode 100644 index 0000000..3269fcc --- /dev/null +++ b/src/main/java/kccf/env/service/EnvService.java @@ -0,0 +1,35 @@ +package kccf.env.service; + +import java.util.List; + +import kccf.env.vo.EnvVO; + +/** + * EnvService.java + * Description : 공통코드관리 서비스 인터페이스 + * + * @author 한국문화원연합회 / (주)디지탈쉽 + * @since 2023-10-19 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-10-19   KNKIM      최초 생성
    + *  
    + * 
    + */ +public interface EnvService { + + public List selectListEnvInfo(EnvVO evnVO) throws Exception; + public List selectListEnvInfo(String siteSeCode) throws Exception; + + public EnvVO selectEnvInfo(EnvVO envVO) throws Exception; + + public EnvVO insertEnv(EnvVO evnVO) throws Exception; + + public EnvVO updateEnv(EnvVO evnVO) throws Exception; + + public EnvVO deleteEnv(EnvVO evnVO) throws Exception; +} diff --git a/src/main/java/kccf/env/service/impl/EnvServiceImpl.java b/src/main/java/kccf/env/service/impl/EnvServiceImpl.java new file mode 100644 index 0000000..e4e9894 --- /dev/null +++ b/src/main/java/kccf/env/service/impl/EnvServiceImpl.java @@ -0,0 +1,148 @@ +package kccf.env.service.impl; + +import java.lang.invoke.MethodHandles; +import java.util.HashMap; +import java.util.List; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import kccf.env.dao.EnvDAO; +import kccf.env.service.EnvService; +import kccf.env.vo.EnvVO; +import lombok.RequiredArgsConstructor; + +/** + * EnvServiceImpl.java + * Description : 시스템환경설정관리 서비스 구현 클래스 + * + * @author 한국문화원연합회 / (주)디지탈쉽 + * @since 2023-10-19 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-10-19   KNKIM      최초 생성
    + *  
    + * 
    + */ + +@Service +@RequiredArgsConstructor +public class EnvServiceImpl implements EnvService { + + private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + private final EnvDAO envDAO; + + @Override + public List selectListEnvInfo(EnvVO envVO) throws Exception { + return envDAO.selectListEnv(envVO); + } + + @Override + public List selectListEnvInfo(String siteSeCode) throws Exception { + if(StringUtils.isAllBlank(siteSeCode)) return null; + EnvVO envVO = new EnvVO(); + envVO.setSiteSeCode(siteSeCode); + return selectListEnvInfo(envVO); + } + + @Override + public EnvVO selectEnvInfo(EnvVO envVO) throws Exception { + + if(envVO == null) { + EnvVO retItem = new EnvVO(); + retItem.setResult("F", "조회할 시스템환경설정 정보가 존재하지 않습니다."); + return retItem; + } + + if(StringUtils.isAllEmpty(envVO.getSiteSeCode())) { + EnvVO retItem = new EnvVO(); + retItem.setResult("F", "사이트구분 정보가 존재하지 않습니다."); + return retItem; + } + + if(StringUtils.isAllEmpty(envVO.getAtrbCode())) { + EnvVO retItem = new EnvVO(); + retItem.setResult("F", "조회할 시스템환경설정 정보가 존재하지 않습니다."); + return retItem; + } + + return envDAO.selectEnvInfo(envVO); + } + + @Override + public EnvVO insertEnv(EnvVO envVO) throws Exception { + if(envVO == null) { + EnvVO retItem = new EnvVO(); + retItem.setResult("F", "등록할 시스템환경설정 정보가 존재하지 않습니다."); + return retItem; + } + + try { + int ret = envDAO.insertEnv(envVO); + if(ret > 0) { + envVO.setResult("S", "정상적으로 등록되었습니다."); + } else { + envVO.setResult("F", "시스템환경설정 등록에 실패하였습니다."); + } + + } catch(Exception e) { + envVO.setResult("F", "시스템환경설정 등록에 실패하였습니다. 중복 속성인지 재확인 바랍니다.)"); + } + + return envVO; + + } + + @Override + public EnvVO updateEnv(EnvVO envVO) throws Exception { + if(envVO == null) { + EnvVO retItem = new EnvVO(); + retItem.setResult("F", "변경할 시스템환경설정 정보가 존재하지 않습니다."); + return retItem; + } + + int ret = envDAO.updateEnv(envVO); + if(ret > 0) { + envVO.setResult("S", "정상적으로 변경되었습니다."); + } else { + envVO.setResult("F", "변경할 시스템환경설정 정보를 확인할 수 없습니다."); + } + + return envVO; + + } + + @Override + public EnvVO deleteEnv(EnvVO envVO) throws Exception { + if(envVO == null) { + EnvVO retVO = new EnvVO(); + retVO.setResult("F", "삭제할 시스템환경설정 정보가 존재하지 않습니다."); + return retVO; + } + if(StringUtils.isAllEmpty(envVO.getSiteSeCode())) { + envVO.setResult("F", "사이트구분 정보가 입력되지 않았습니다."); + return envVO; + } + if(StringUtils.isAllEmpty(envVO.getAtrbCode())) { + envVO.setResult("F", "삭제할 시스템환경설정 정보가 입력되지 않았습니다."); + return envVO; + } + + int ret = envDAO.deleteEnv(envVO); + if(ret > 0) { + envVO.setResult("S", "정상적으로 삭제되었습니다."); + } else { + envVO.setResult("F", "삭제 가능한 시스템환경설정 정보를 확인할 수 없습니다."); + } + + return envVO; + } + +} diff --git a/src/main/java/kccf/env/vo/EnvVO.java b/src/main/java/kccf/env/vo/EnvVO.java new file mode 100644 index 0000000..7ed2949 --- /dev/null +++ b/src/main/java/kccf/env/vo/EnvVO.java @@ -0,0 +1,48 @@ +package kccf.env.vo; + +import kccf.cmm.vo.CmmBaseVO; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +/** + * EnvVO.java + * Description : 공통코드 정보를 담는 VO + * + * @author 한국문화원연합회 / (주)디지탈쉽 + * @since 2023-10-19 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-10-19   KNKIM      최초 생성
    + *  
    + * 
    + */ + +@Getter +@Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class EnvVO extends CmmBaseVO implements Cloneable { + + String searchSiteSeCode; /* 검색 사이트구분코드 */ + String searchAtrbCode; /* 검색 속성코드 */ + String searchEnvrnEstbsAtrbNm; /* 검색 환경설정속성명 */ + String searchAtrbValue; /* 검색 속성값 */ + + String siteSeCode; /* 사이트구분코드 */ + String siteSeNm; /* 사이트구분명 */ + String atrbCode; /* 속성코드 */ + String envrnEstbsAtrbNm; /* 환경설정속성명 */ + String atrbValue; /* 속성값 */ + String dcCn; /* 설명내용 */ + + String opType; /* 처리유형 : C 신규, U 수정, D 삭제 */ + String incCmmYn; /* 사이트구분코드의 공통(C) 포함 여부 */ +} diff --git a/src/main/java/kccf/env/web/EnvController.java b/src/main/java/kccf/env/web/EnvController.java new file mode 100644 index 0000000..fd4fe8d --- /dev/null +++ b/src/main/java/kccf/env/web/EnvController.java @@ -0,0 +1,240 @@ +package kccf.env.web; + +import java.lang.invoke.MethodHandles; +import java.util.HashMap; +import java.util.List; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import kccf.auth.web.AuthUtil; +import kccf.cmm.vo.CmmBaseVO; +import kccf.cmm.web.CmmBaseController; +import kccf.code.vo.CtgryCodeVO; +import kccf.env.service.EnvService; +import kccf.env.vo.EnvVO; +import lombok.RequiredArgsConstructor; + +/** + * EnvController.java + * Description : 시스템환경설정관리 컨트롤러 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-10-19 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-10-19   KNKIM      최초 생성
    + *  
    + * 
    + */ + +@Controller +@RequiredArgsConstructor +public class EnvController extends CmmBaseController { + + private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + private final EnvService envService; + + private final EnvUtil envUtil; + + /** + * @Description : 시스템환경설정관리 목록 화면을 구성한다. + * @param model + * @param cmmCodeItem + * @return + * @throws Exception + */ + @RequestMapping("/sec/env/listEnv.do") + public String listEnv(ModelMap model, EnvVO searchVO) throws Exception { + model.addAttribute("searchVO", searchVO); + return getHostId() + "/env/listEnv"; + } + + /** + * @Description : 시스템환경설정관리 목록을 조회한다. + * @param model + * @param envVO + * @return + * @throws Exception + */ + @RequestMapping("/sec/env/listEnvJson.do") + public String listEnvJson(ModelMap model, EnvVO searchVO) throws Exception { + + List list = envService.selectListEnvInfo(searchVO); + + int totCnt = 0; + if(list != null && list.size() > 0) { + totCnt = list.get(0).getTotCnt(); + } + searchVO.setTotCnt(totCnt); + + model.addAttribute("data" , list); + model.addAttribute("searchVO", searchVO); + + return "jsonView"; + } + + /** + * @Description : 시스템환경설정관리 목록 화면을 구성한다. + * @param model + * @param cmmCodeItem + * @return + * @throws Exception + */ + @RequestMapping("/sec/env/formEnvInfo.do") + public String formEnvInfo(ModelMap model, EnvVO searchVO) throws Exception { + + EnvVO retVO = null; + + if(searchVO == null) { + retVO = new EnvVO(); + retVO.setOpType("C"); + retVO.setResultCode("S"); + } else if(!StringUtils.isAllEmpty(searchVO.getSiteSeCode()) && !StringUtils.isAllEmpty(searchVO.getAtrbCode())) { + retVO = envService.selectEnvInfo(searchVO); + retVO.setOpType("U"); + retVO.setResultCode("S"); + } else { + retVO = new EnvVO(); + retVO.setOpType("C"); + retVO.setResultCode("S"); + } + + model.addAttribute("searchVO", searchVO); + model.addAttribute("envVO" , retVO); + + return getHostId() + "/env/formEnvInfo"; + } + + /** + * @Description : 시스템환경설정 상세 정보를 조회한다. + * @param model + * @param envVO + * @return + * @throws Exception + */ + @RequestMapping("/sec/env/getEnvInfoJson.do") + public String getEnvInfoJson(ModelMap model, EnvVO envVO) throws Exception { + + EnvVO retVO = null; + + if(envVO == null) { + retVO = new EnvVO(); + retVO.setResult("F", "조회할 시스템환경설정 정보가 존재하지 않습니다."); + } else if(StringUtils.isAllBlank(envVO.getSiteSeCode())) { + retVO = new EnvVO(); + retVO.setResult("F", "조회할 사이트구분코드는 필수입력 항목입니다."); + } else if(StringUtils.isAllBlank(envVO.getAtrbCode())) { + retVO = new EnvVO(); + retVO.setResult("F", "조회할 시스템환경설정코드는 필수입력 항목입니다."); + } else { + retVO = envService.selectEnvInfo(envVO); + if(retVO == null) { + retVO = new EnvVO(); + retVO.setResult("W", "해당 시스템환경설정 정보는 존재하지 않습니다."); + } else if(!StringUtils.isAllEmpty(retVO.getAtrbCode())) { + retVO.setResult("S", "정상적으로 조회되었습니다."); + } + } + + model.addAttribute("envVO", retVO); + + return "jsonView"; + } + + /** + * @Description : 시스템환경설정 정보 등록/수정을 처리한다. + * @param model + * @param envVO + * @return + * @throws Exception + */ + @RequestMapping("/sec/env/saveEnvInfoJson.do") + public String saveEnvInfoJson(ModelMap model, EnvVO envVO) throws Exception { + + EnvVO resVO = null; + + if(!AuthUtil.canWrite(getUserId(), getSiteSeCode(), getSelMenuId(), null)) { + resVO = new EnvVO(); + resVO.setResult("F", "변경 권한이 존재하지 않습니다."); + model.addAttribute("resVO", resVO); + return "jsonView"; + } + + if(envVO == null) { + resVO = new EnvVO(); + resVO.setResult("F", "저장할 시스템환경설정 정보가 존재하지 않습니다."); + } else if("C".equals(envVO.getOpType())) { + envVO.setRegUserId(getUserId()); + envVO.setUpdUserId(getUserId()); + resVO = envService.insertEnv(envVO); + } else { + envVO.setUpdUserId(getUserId()); + resVO = envService.updateEnv(envVO); + } + + model.addAttribute("resVO", resVO); + + return "jsonView"; + } + + /** + * @Description : 시스템환경설정 정보 삭제를 처리한다. + * @param model + * @param envVO + * @return + * @throws Exception + */ + @RequestMapping("/sec/env/deleteEnvInfoJson.do") + public String deleteEnvInfoJson(ModelMap model, EnvVO envVO) throws Exception { + + EnvVO resVO = null; + + if(!AuthUtil.canWrite(getUserId(), getSiteSeCode(), getSelMenuId(), null)) { + resVO = new EnvVO(); + resVO.setResult("F", "변경 권한이 존재하지 않습니다."); + model.addAttribute("resVO", resVO); + return "jsonView"; + } + + if(envVO == null) { + resVO = new EnvVO(); + resVO.setResult("F", "메뉴 정보가 존재하지 않습니다."); + } else { + resVO = envService.deleteEnv(envVO); + } + + model.addAttribute("resVO", resVO); + + return "jsonView"; + } + + + /** + * @Description : 시스템환경설정값을 메모리에 리로딩한다. + * @param model + * @param envVO + * @return + * @throws Exception + */ + @RequestMapping("/sec/env/reloadEnvJson.do") + public String reloadEnvJson(ModelMap model, EnvVO envVO) throws Exception { + + EnvVO retVO = envUtil.reloadEnv(envVO); + + model.addAttribute("retVO", retVO); + + return "jsonView"; + } + + +} diff --git a/src/main/java/kccf/env/web/EnvUtil.java b/src/main/java/kccf/env/web/EnvUtil.java new file mode 100644 index 0000000..e59dc64 --- /dev/null +++ b/src/main/java/kccf/env/web/EnvUtil.java @@ -0,0 +1,197 @@ +package kccf.env.web; + +import java.lang.invoke.MethodHandles; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.event.ContextRefreshedEvent; +import org.springframework.context.event.EventListener; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +import kccf.cmm.vo.CmmBaseVO; +import kccf.env.service.EnvService; +import kccf.env.vo.EnvVO; +import lombok.RequiredArgsConstructor; + +/** + * EnvUtil.java + * Description : 환경설정 값제공 컨트롤러 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-10-19 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-10-19   KNKIM      최초 생성
    + *  
    + * 
    + */ + +/** + * @class : EnvUtil.java + * @description : + * + * @author 한국문화원연합회 / (주)디지탈쉽 + * @since 2023-10-19 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-10-19   KNKIM      최초 생성
    + *  
    + * 
    + */ +@Component +@Controller +@RequiredArgsConstructor +public class EnvUtil { + + private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + private final EnvService envService; + + private static Map> envProps = new HashMap>(); + private static int initEnvLoaded = 0; + private static String CMM_SITE_SE_CODE = "C"; + + /** + * Description : 환경설정 속성값을 문자열 형태로 리턴한다. + * @param siteSeCode + * @param atrbCode + * @return + */ + public static String getSysEnv(String siteSeCode, String atrbCode) { + Map siteProps = getSiteProps(siteSeCode); + if(siteProps == null) { + siteProps = getSiteProps(CMM_SITE_SE_CODE); + if(siteProps == null) return null; + } + + return siteProps.get(atrbCode); + } + + /** + * Description : 환경설정 속성값을 문자열 형태로 리턴하며, 값이 Null이거나 빈값인 경우 대체문자열 rep를 리턴한다. + * @param siteSeCode + * @param atrbCode + * @param rep + * @return + */ + public static String getSysEnvIf(String siteSeCode, String atrbCode, String rep) { + String retStr = getSysEnv(siteSeCode, atrbCode); + if(StringUtils.isAllBlank(retStr)) return rep; + + return retStr; + } + + /** + * Description : 환경설정 속성값을 정수 형태로 리턴한다. 값이 존재하지 않을 경우, 0리턴 + * @param atrbCode + * @return + */ + public static int getSysEnvInt(String siteSeCode, String atrbCode) { + String retValStr = getSysEnv(siteSeCode, atrbCode); + if(StringUtils.isAllBlank(retValStr)) return 0; + + try { + return Integer.parseInt(retValStr); + } catch(Exception e) { + Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + LOGGER.error("getSysEnvInt() for [" + atrbCode + "] throws Exception : " + e.getMessage()); + return 0; + } + } + + static Map getSiteProps(String siteSeCode) { + Map siteProps = envProps.get(siteSeCode); + if(siteProps == null) { + return null; + } + + return siteProps; + } + + /** + * @Description : 시스템환경설정값을 메모리에 리로딩한다. + * @param envVO + * @return + * @throws Exception + */ + public EnvVO reloadEnv(EnvVO envVO) throws Exception { + + EnvVO retVO = envVO; + if(retVO == null) retVO = new EnvVO(); + + LOGGER.info("================================================"); + LOGGER.info("SYSTEM ENV RE-LOADING ..."); + LOGGER.info("================================================"); + + String[] siteSeCodes = null; + + if(StringUtils.isAllEmpty(retVO.getSiteSeCode())) { + siteSeCodes = new String[4]; + siteSeCodes[0] = "K"; + siteSeCodes[1] = "M"; + siteSeCodes[2] = "S"; + siteSeCodes[3] = CMM_SITE_SE_CODE; + } else { + siteSeCodes = new String[1]; + siteSeCodes[0] = envVO.getSiteSeCode(); + } + + if(siteSeCodes != null || siteSeCodes.length > 1) { + + for(int s=0; s list = envService.selectListEnvInfo(siteSeCodes[s]); + HashMap siteProps = envProps.get(siteSeCodes[s]); + if(list != null && !list.isEmpty()) { + int len = list.size(); + if(siteProps == null) siteProps = new HashMap(); + + for(int i=0; i>> 환경설정속성값 : " + siteSeCodes[s] + " : " + item.getAtrbCode() + "=" + item.getAtrbValue()); + } + } + envProps.put(siteSeCodes[s], siteProps); + } + + } + + retVO.setResult("S", "성공적으로 재로딩하였습니다."); + + return retVO; + } + + @EventListener + public void onApplicationEvent(ContextRefreshedEvent event) throws Exception { + + EnvVO envVO = null; + if(initEnvLoaded++ < 1) { + envVO = reloadEnv(null); + + if(envVO != null && "S".equals(envVO.getResultCode())) { + LOGGER.info("----------------------------------------------------"); + LOGGER.info("-- 시스템환경설정 RELOAD : " + envVO.getResultCode() + ", " + envVO.getResultMessage()); + LOGGER.info("----------------------------------------------------"); + } + } else { + LOGGER.info("시스템환경설정 : 이미 로딩 완료됨"); + } + } +} diff --git a/src/main/java/kccf/lcltt/dao/LclttDAO.java b/src/main/java/kccf/lcltt/dao/LclttDAO.java new file mode 100644 index 0000000..fa18e7f --- /dev/null +++ b/src/main/java/kccf/lcltt/dao/LclttDAO.java @@ -0,0 +1,63 @@ +package kccf.lcltt.dao; + +import java.util.List; + +import org.springframework.stereotype.Repository; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import kccf.bbs.vo.BbsNttItemVO; +import kccf.code.vo.CmmDetailCodeVO; +import kccf.lcltt.vo.LclttVO; + +@Repository("lclttDAO") +public class LclttDAO extends EgovComAbstractDAO { + + public List selectLclttList(LclttVO vo){ + return selectList("lclttDAO.selectLclttList", vo); + } + + public String getLclttIdSeq() { + return selectOne("lclttDAO.getLclttIdSeq"); + } + + public int insertLcltt(LclttVO vo) { + return insert("lclttDAO.insertLcltt", vo); + } + + public LclttVO selectLclttDetail(LclttVO vo) { + return selectOne("lclttDAO.selectLclttDetail", vo); + } + + public int updateLcltt(LclttVO vo) { + return update("lclttDAO.updateLcltt", vo); + } + + public int deleteLcltt(LclttVO vo) { + return update("lclttDAO.deleteLcltt", vo); + } + + public List selectAreaSubCodeListAjax(CmmDetailCodeVO vo){ + return selectList("lclttDAO.selectAreaSubCodeListAjax", vo); + } + + public List selectLclttFindList(LclttVO vo) { + return selectList("lclttDAO.selectLclttFindList", vo); + } + + public List searchContentsByLclttList(LclttVO vo){ + return selectList("lclttDAO.searchContentsByLclttList", vo); + } + + public List selectContentsByLclttIdList(LclttVO vo){ + return selectList("lclttDAO.selectContentsByLclttIdList", vo); + } + + public List selectLclttMList(LclttVO vo){ + return selectList("lclttDAO.selectLclttMList", vo); + } + + public List selectLclttPList(LclttVO vo){ + return selectList("lclttDAO.selectLclttPList", vo); + } + +} diff --git a/src/main/java/kccf/lcltt/service/LclttService.java b/src/main/java/kccf/lcltt/service/LclttService.java new file mode 100644 index 0000000..50f99e0 --- /dev/null +++ b/src/main/java/kccf/lcltt/service/LclttService.java @@ -0,0 +1,35 @@ +package kccf.lcltt.service; + +import java.util.List; + +import kccf.bbs.vo.BbsNttItemVO; +import kccf.code.vo.CmmDetailCodeVO; +import kccf.lcltt.vo.LclttVO; + +public interface LclttService { + + public List selectLclttList(LclttVO vo); + + public String getLclttIdSeq(); + + public int insertLcltt(LclttVO vo); + + public LclttVO selectLclttDetail(LclttVO vo); + + public int updateLcltt(LclttVO vo); + + public int deleteLcltt(LclttVO vo); + + public List selectAreaSubCodeListAjax(CmmDetailCodeVO vo); + + public List selectLclttFindList(LclttVO vo); + + public List searchContentsByLclttList(LclttVO vo); + + public List selectContentsByLclttIdList(LclttVO vo); + + public List selectLclttMList(LclttVO vo); + + public List selectLclttPList(LclttVO vo); + +} diff --git a/src/main/java/kccf/lcltt/service/impl/LclttServiceImpl.java b/src/main/java/kccf/lcltt/service/impl/LclttServiceImpl.java new file mode 100644 index 0000000..6f55817 --- /dev/null +++ b/src/main/java/kccf/lcltt/service/impl/LclttServiceImpl.java @@ -0,0 +1,106 @@ +package kccf.lcltt.service.impl; + +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import kccf.bbs.vo.BbsNttItemVO; +import kccf.code.vo.CmmDetailCodeVO; +import kccf.lcltt.dao.LclttDAO; +import kccf.lcltt.service.LclttService; +import kccf.lcltt.vo.LclttVO; + +@Service("lclttService") +public class LclttServiceImpl implements LclttService{ + + @Resource(name = "lclttDAO") + private LclttDAO lclttDAO; + + @Override + public List selectLclttList(LclttVO vo){ + return lclttDAO.selectLclttList(vo); + } + + @Override + public String getLclttIdSeq() { + return lclttDAO.getLclttIdSeq(); + } + + @Override + public int insertLcltt(LclttVO vo) { + String[] adresArray = vo.getAdres1().split("\\s"); + + CmmDetailCodeVO cmmDetailCodeVO = new CmmDetailCodeVO(); + cmmDetailCodeVO.setAditAtrbInfoValue1(vo.getAreaCode()); + List codeList = lclttDAO.selectAreaSubCodeListAjax(cmmDetailCodeVO); + + for(int i = 0; i < codeList.size(); i++) { + if(codeList.get(i).getDetailCodeNm().equals(adresArray[1])) { + vo.setAreaSubCode(codeList.get(i).getDetailCode()); + } + } + + return lclttDAO.insertLcltt(vo); + } + + @Override + public LclttVO selectLclttDetail(LclttVO vo) { + return lclttDAO.selectLclttDetail(vo); + } + + @Override + public int updateLcltt(LclttVO vo) { + + String[] adresArray = vo.getAdres1().split("\\s"); + + CmmDetailCodeVO cmmDetailCodeVO = new CmmDetailCodeVO(); + cmmDetailCodeVO.setAditAtrbInfoValue1(vo.getAreaCode()); + List codeList = lclttDAO.selectAreaSubCodeListAjax(cmmDetailCodeVO); + + for(int i = 0; i < codeList.size(); i++) { + if(codeList.get(i).getDetailCodeNm().equals(adresArray[1])) { + vo.setAreaSubCode(codeList.get(i).getDetailCode()); + } + } + + return lclttDAO.updateLcltt(vo); + } + + @Override + public int deleteLcltt(LclttVO vo) { + return lclttDAO.deleteLcltt(vo); + } + + @Override + public List selectAreaSubCodeListAjax(CmmDetailCodeVO vo){ + return lclttDAO.selectAreaSubCodeListAjax(vo); + } + + @Override + public List selectLclttFindList(LclttVO vo){ + return lclttDAO.selectLclttFindList(vo); + } + + @Override + public List searchContentsByLclttList(LclttVO vo){ + return lclttDAO.searchContentsByLclttList(vo); + } + + @Override + public List selectContentsByLclttIdList(LclttVO vo){ + return lclttDAO.selectContentsByLclttIdList(vo); + } + + @Override + public List selectLclttMList(LclttVO vo){ + return lclttDAO.selectLclttMList(vo); + } + + @Override + public List selectLclttPList(LclttVO vo){ + return lclttDAO.selectLclttPList(vo); + } + +} diff --git a/src/main/java/kccf/lcltt/vo/LclttVO.java b/src/main/java/kccf/lcltt/vo/LclttVO.java new file mode 100644 index 0000000..8e8747d --- /dev/null +++ b/src/main/java/kccf/lcltt/vo/LclttVO.java @@ -0,0 +1,111 @@ +package kccf.lcltt.vo; + +import java.util.List; + +import org.springframework.web.multipart.MultipartFile; + +import kccf.cmm.vo.CmmBaseVO; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Getter +@Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class LclttVO extends CmmBaseVO { + + /* 지방문화원 아이디 */ + private String lclttId; + /* 지방문화원명 */ + private String lclttNm; + /* 시도지역코드 */ + private String areaCode; + /* 시도지역코드명 */ + private String areaCodeNm; + /* 구군코드 */ + private String areaSubCode; + /* 전화번호 */ + private String telno; + /* 팩스번호 */ + private String fxnum; + /* 이메일 */ + private String email; + /* 우편번호 */ + private String zip; + /* 홈페이지 URL */ + private String hmpgUrl; + /* 주소1 + 주소2 */ + private String adres; + /* 주소1 */ + private String adres1; + /* 주소2 */ + private String adres2; + /* 설립일자 */ + private String fondDe; + /* 원장성명 */ + private String ledgrNm; + /* 내용 */ + private String cntntsCn; + /* 사용여부 */ + private String useYn; + /* 삭제여부 */ + private String deleteAt; + /* 등록자 아이디 */ + private String regUserId; + /* 등록자 이름 */ + private String regUserNm; + /* 등록일시 */ + private String regDttm; + /* 수정자 아이디 */ + private String updUserId; + /* 수정일시 */ + private String updDttm; + /* 문화원 행사 카운트 */ + private String lclttCnt; + + /* 문화원별 게시물 카운트 */ + private int aCnt; + /*문화원별 동영상 카운트*/ + private int mCnt; + /* 문화원별 사진 카운트 */ + private int pCnt; + /* 문화원별 총 카운트 */ + private int tCnt; + + /* 게시물 조회 수 */ + private String rdcnt; + /* 게시물 제목 */ + private String sj; + /* 게시판명 */ + private String bbsNm; + /* 게시물 번호 */ + private String nttId; + /* 게시판 번호 */ + private String bbsId; + /* 메뉴 아이디 */ + private String menuId; + /* 링크 URL */ + private String linkUrl; + + /* 검색 - 시도지역코드 */ + private String searchAreaCode; + /* 검색 - 구군지역코드 */ + private String searchAreaSubCode; + /* 검색 - 지방문화원명 */ + private String searchLclttNm; + /* 검색 - 게시물 제목 */ + private String searchSj; + /* 검색 - 게시물 내용 */ + private String searchCntntsCn; + /* 검색 - 기간 시작일 */ + private String searchStartDt; + /* 검색 - 기간 종료일 */ + private String searchEndDt; + /* 검색 - 문화원 */ + private String searchLclttId; + +} diff --git a/src/main/java/kccf/lcltt/web/LclttController.java b/src/main/java/kccf/lcltt/web/LclttController.java new file mode 100644 index 0000000..5772e52 --- /dev/null +++ b/src/main/java/kccf/lcltt/web/LclttController.java @@ -0,0 +1,252 @@ +package kccf.lcltt.web; + +import java.util.List; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; + +import kccf.bbs.vo.BbsNttItemVO; +import kccf.cmm.web.CmmBaseController; +import kccf.code.vo.CmmDetailCodeVO; +import kccf.lcltt.service.LclttService; +import kccf.lcltt.vo.LclttVO; +import kccf.login.service.KccfLoginService; +import kccf.login.vo.CmmnCodeDetailVO; +import kccf.login.vo.UserVO; +import lombok.RequiredArgsConstructor; + +@Controller +@RequiredArgsConstructor +public class LclttController extends CmmBaseController { + + private final LclttService lclttService; + + private final KccfLoginService kccfLoginService; + + @RequestMapping(value = "/sec/lcltt/lclttListPage.do") + public String lclttListPage(ModelMap model, HttpSession session) { + + UserVO userVO = (UserVO)session.getAttribute("user"); + + if(userVO == null || StringUtils.isAllBlank(userVO.getUserId())) { + return "redirect:/login.do"; + } + + CmmnCodeDetailVO cmmCodeDetailVO = new CmmnCodeDetailVO(); + + cmmCodeDetailVO.setCode("AREA_CODE"); + model.addAttribute("areaCodeList", kccfLoginService.selectCodeListAjax(cmmCodeDetailVO)); + + return model.getAttribute("hostId") + "/lcltt/listLcltt"; + } + + @RequestMapping(value = "/sec/lcltt/selectLclttListAjax.do") + public String selectLclttListAjax(LclttVO searchVO, ModelMap model) { + + List lclttList = lclttService.selectLclttList(searchVO); + + if(lclttList != null & lclttList.size() > 0) { + searchVO.setTotCnt(lclttList.get(0).getTotCnt()); + } + + model.addAttribute("searchVO", searchVO); + model.addAttribute("data", lclttList); + + return "jsonView"; + } + + @RequestMapping(value = "/sec/lcltt/lclttDetailPage.do") + public String lclttDetailPage(ModelMap model, LclttVO searchVO, HttpSession session) { + + UserVO userVO = (UserVO)session.getAttribute("user"); + + if(userVO == null || StringUtils.isAllBlank(userVO.getUserId())) { + return "redirect:/login.do"; + } + + CmmnCodeDetailVO cmmCodeDetailVO = new CmmnCodeDetailVO(); + + cmmCodeDetailVO.setCode("AREA_CODE"); + model.addAttribute("areaCodeList", kccfLoginService.selectCodeListAjax(cmmCodeDetailVO)); + + if(!searchVO.getLclttId().isEmpty()) { + model.addAttribute("lclttVO", lclttService.selectLclttDetail(searchVO)); + } + + model.addAttribute("searchVO", searchVO); + + return model.getAttribute("hostId") + "/lcltt/lclttRegist"; + } + + @RequestMapping(value = "/sec/lcltt/insertLcltt.do") + public String insertLcltt(LclttVO searchVO, ModelMap model, RedirectAttributes redirect) { + + searchVO.setRegUserId(getUserId()); + searchVO.setUpdUserId(getUserId()); + + //seq가 없으면 insert, 있으면 update + if(searchVO.getLclttId().isEmpty()) { + searchVO.setLclttId(lclttService.getLclttIdSeq()); + lclttService.insertLcltt(searchVO); + }else { + lclttService.updateLcltt(searchVO); + } + + redirect.addAttribute("searchAreaCode", searchVO.getSearchAreaCode()); + redirect.addAttribute("searchLclttNm", searchVO.getSearchLclttNm()); + redirect.addAttribute("pageNo", searchVO.getPageNo()); + redirect.addAttribute("selMenuId", searchVO.getSelMenuId()); + + return "redirect:/sec/lcltt/lclttListPage.do"; + } + + @RequestMapping(value = "/sec/lcltt/deleteLcltt.do") + public String deleteLcltt(LclttVO searchVO, ModelMap model, RedirectAttributes redirect) { + + lclttService.deleteLcltt(searchVO); + + redirect.addAttribute("searchAreaCode", searchVO.getSearchAreaCode()); + redirect.addAttribute("searchLclttNm", searchVO.getSearchLclttNm()); + redirect.addAttribute("pageNo", searchVO.getPageNo()); + redirect.addAttribute("selMenuId", searchVO.getSelMenuId()); + + return "redirect:/sec/lcltt/lclttListPage.do"; + } + + @RequestMapping(value = "/sec/lcltt/selectLclttDetailPopup.do") + public String selectLclttDetailPopup(LclttVO lclttVO, ModelMap model) { + + model.addAttribute("lclttVO", lclttService.selectLclttDetail(lclttVO)); + + return model.getAttribute("hostId") + "/lcltt/lclttDetailPopup"; + } + + @RequestMapping(value = "/juso/jusoPopup.do") + public String jusoPopup(ModelMap model) { + return model.getAttribute("hostId") + "/lcltt/popup/jusoPopup"; + } + + @RequestMapping(value = "/lcltt/lclttFindPage.do") + public String lclttFindPage(ModelMap model, LclttVO searchVO) { + + CmmnCodeDetailVO cmmCodeDetailVO = new CmmnCodeDetailVO(); + + cmmCodeDetailVO.setCode("AREA_CODE"); + model.addAttribute("areaCodeList", kccfLoginService.selectCodeListAjax(cmmCodeDetailVO)); + + List lclttList = lclttService.selectLclttFindList(searchVO); + + if(lclttList != null & lclttList.size() > 0) { + searchVO.setTotCnt(lclttList.get(0).getTotCnt()); + }else { + searchVO.setTotCnt(0); + } + + model.addAttribute("lclttList", lclttList); + model.addAttribute("searchVO", searchVO); + + return model.getAttribute("hostId") + "/lcltt/listLclttFind"; + } + + @RequestMapping(value = "/lcltt/selectAreaSubCodeListAjax.do") + public String selectAreaSubCodeListAjax(CmmDetailCodeVO vo, ModelMap model) { + + model.addAttribute("areaSubCodeList", lclttService.selectAreaSubCodeListAjax(vo)); + + return "jsonView"; + + } + + @RequestMapping(value = "/lcltt/popup/mapPopup.do") + public String mapPopup(ModelMap model, HttpServletRequest request) { + return model.getAttribute("hostId") + "/lcltt/popup/mapPopup"; + } + + @RequestMapping(value = "/sec/lcltt/contens/searchContentsByLclttPage.do") + public String searchContentsByLclttPage(ModelMap model, HttpSession session) { + + UserVO userVO = (UserVO)session.getAttribute("user"); + + if(userVO == null || StringUtils.isAllBlank(userVO.getUserId())) { + return "redirect:/login.do"; + } + + return model.getAttribute("hostId") + "/lcltt/contents/listSearchContentsByLcltt"; + } + + @RequestMapping(value = "/sec/lcltt/contents/searchContentsByLclttListAjax.do") + public String searchContentsByLclttList(LclttVO searchVO, ModelMap model) { + + List resultVO = lclttService.searchContentsByLclttList(searchVO); + + if(resultVO != null & resultVO.size() > 0) { + searchVO.setTotCnt(resultVO.get(0).getTotCnt()); + } + + model.addAttribute("searchVO", searchVO); + model.addAttribute("data", resultVO); + + return "jsonView"; + } + + @RequestMapping(value = "/sec/lcltt/contents/selectContentsByLclttIdListAjax.do") + public String selectContentsByLclttIdList(LclttVO searchVO, ModelMap model) { + + List lclttList = lclttService.selectContentsByLclttIdList(searchVO); + + if(lclttList != null && lclttList.size() > 0) { + searchVO.setTotCnt(lclttList.get(0).getTotCnt()); + } + + model.addAttribute("searchVO2", searchVO); + model.addAttribute("data", lclttList); + + return "jsonView"; + } + + @RequestMapping(value = "/sec/lcltt/contents/selectLclttMListAjax.do") + public String selectLclttMListAjax(LclttVO searchVO, ModelMap model) { + searchVO.setPageSize(8); + List bbsNttItemList = lclttService.selectLclttMList(searchVO); + + if(bbsNttItemList != null && bbsNttItemList.size() > 0) { + searchVO.setTotCnt(bbsNttItemList.get(0).getTotCnt()); + } + + model.addAttribute("searchVO3", searchVO); + model.addAttribute("bbsNttItemList", bbsNttItemList); + + return "jsonView"; + } + + @RequestMapping(value = "/sec/lcltt/contents/selectLclttPListAjax.do") + public String selectLclttPListAjax(LclttVO searchVO, ModelMap model) { + searchVO.setPageSize(8); + List bbsNttItemList = lclttService.selectLclttPList(searchVO); + + if(bbsNttItemList != null && bbsNttItemList.size() > 0) { + searchVO.setTotCnt(bbsNttItemList.get(0).getTotCnt()); + } + + model.addAttribute("searchVO4", searchVO); + model.addAttribute("bbsNttItemList", bbsNttItemList); + + return "jsonView"; + } + + @RequestMapping(value = "/lcltt/selectLclttDetailAjax.do") + public String selectLclttDetailAjax(LclttVO searchVO, ModelMap model) { + LclttVO result = lclttService.selectLclttDetail(searchVO); + + model.addAttribute("data", result); + + return "jsonView"; + } + +} diff --git a/src/main/java/kccf/log/dao/KccfLogDAO.java b/src/main/java/kccf/log/dao/KccfLogDAO.java new file mode 100644 index 0000000..33b08c1 --- /dev/null +++ b/src/main/java/kccf/log/dao/KccfLogDAO.java @@ -0,0 +1,38 @@ +package kccf.log.dao; + +import java.util.List; + +import org.springframework.stereotype.Repository; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import kccf.log.vo.LogLoginHistVO; +import kccf.log.vo.LogPasswdInitHistVO; +import kccf.log.vo.LogUserSvcAccesVO; + +@Repository("kccfLogDAO") +public class KccfLogDAO extends EgovComAbstractDAO { + + public void insertLogLoginHist(LogLoginHistVO vo) { + insert("kccfLogDAO.insertLogLoginHist", vo); + } + + public void insertLogPasswdInitHist(LogPasswdInitHistVO vo) { + insert("kccfLogDAO.insertLogPasswdInitHist", vo); + } + + public List selectAccessUserListAjax(LogUserSvcAccesVO vo){ + return selectList("kccfLogDAO.selectAccessUserListAjax", vo); + } + + public List selectAccessByServiceListAjax(LogUserSvcAccesVO vo){ + return selectList("kccfLogDAO.selectAccessByServiceListAjax", vo); + } + + public List selectAccessByTimeAjax(LogUserSvcAccesVO vo){ + return selectList("kccfLogDAO.selectAccessByTimeAjax", vo); + } + + public int insertLogUserSvcAcces(LogUserSvcAccesVO vo) { + return insert("kccfLogDAO.insertLogUserSvcAcces", vo); + } +} diff --git a/src/main/java/kccf/log/service/KccfLogService.java b/src/main/java/kccf/log/service/KccfLogService.java new file mode 100644 index 0000000..11b54a5 --- /dev/null +++ b/src/main/java/kccf/log/service/KccfLogService.java @@ -0,0 +1,23 @@ +package kccf.log.service; + +import java.util.List; + +import kccf.log.vo.LogLoginHistVO; +import kccf.log.vo.LogPasswdInitHistVO; +import kccf.log.vo.LogUserSvcAccesVO; + +public interface KccfLogService { + + public void insertLogPasswdInitHist(LogPasswdInitHistVO vo); + + public void insertLogLoginHist(LogLoginHistVO vo); + + public List selectAccessUserListAjax(LogUserSvcAccesVO vo); + + public List selectAccessByServiceListAjax(LogUserSvcAccesVO vo); + + public List selectAccessByTimeAjax(LogUserSvcAccesVO vo); + + public int insertLogUserSvcAcces(LogUserSvcAccesVO vo); + +} diff --git a/src/main/java/kccf/log/service/impl/KccfLogServiceImpl.java b/src/main/java/kccf/log/service/impl/KccfLogServiceImpl.java new file mode 100644 index 0000000..e3b0780 --- /dev/null +++ b/src/main/java/kccf/log/service/impl/KccfLogServiceImpl.java @@ -0,0 +1,83 @@ +package kccf.log.service.impl; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.concurrent.ThreadLocalRandom; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import kccf.log.dao.KccfLogDAO; +import kccf.log.service.KccfLogService; +import kccf.log.vo.LogLoginHistVO; +import kccf.log.vo.LogPasswdInitHistVO; +import kccf.log.vo.LogUserSvcAccesVO; + +@Service("kccfLogService") +public class KccfLogServiceImpl implements KccfLogService { + + @Resource(name = "kccfLogDAO") + private KccfLogDAO kccfLogDAO; + + @Override + public void insertLogLoginHist(LogLoginHistVO vo) { + + String seq = makeSeq("L"); + + System.err.println("로그인 로그 시퀀스 = " + seq); + + vo.setLogLoginHistId(seq); + + kccfLogDAO.insertLogLoginHist(vo); + } + + @Override + public void insertLogPasswdInitHist(LogPasswdInitHistVO vo) { + + String seq = makeSeq("P"); + + System.out.println("비밀번호 초기화 로그 시퀀스 = " + seq); + + vo.setLogPasswdInitHistId(seq); + + kccfLogDAO.insertLogPasswdInitHist(vo); + } + + public String makeSeq(String logType) { + + String seq = ""; + + LocalDateTime now = LocalDateTime.now(); + String formatedNow = now.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmSSS")); + System.out.println("현재 날짜 시간 = " + formatedNow); + + //4자리 난수 + int randomNumber = ThreadLocalRandom.current().nextInt(1000, 10000); // 1000 이상 9999 이하의 난수 생성 + + seq = logType + formatedNow + Integer.toString(randomNumber); + + return seq; + } + + @Override + public List selectAccessUserListAjax(LogUserSvcAccesVO vo){ + return kccfLogDAO.selectAccessUserListAjax(vo); + } + + @Override + public List selectAccessByServiceListAjax(LogUserSvcAccesVO vo){ + return kccfLogDAO.selectAccessByServiceListAjax(vo); + } + + @Override + public List selectAccessByTimeAjax(LogUserSvcAccesVO vo){ + return kccfLogDAO.selectAccessByTimeAjax(vo); + } + + @Override + public int insertLogUserSvcAcces(LogUserSvcAccesVO vo) { + return kccfLogDAO.insertLogUserSvcAcces(vo); + } +} diff --git a/src/main/java/kccf/log/vo/LogLoginHistVO.java b/src/main/java/kccf/log/vo/LogLoginHistVO.java new file mode 100644 index 0000000..d5476eb --- /dev/null +++ b/src/main/java/kccf/log/vo/LogLoginHistVO.java @@ -0,0 +1,38 @@ +package kccf.log.vo; + +import kccf.cmm.vo.CmmBaseVO; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Getter +@Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class LogLoginHistVO extends CmmBaseVO { + + /* 로그인이력 아이디 */ + private String logLoginHistId; + /* 사용자 아이디 */ + private String userId; + /* 로그인아웃구분코드 */ + private String loginoutSeCode; + /* 로그인아웃구분코드명 */ + private String loginoutSeCodeNm; + /* 오류내용 */ + private String errorCn; + /* 사용자 아이피 */ + private String userIp; + /* 로그인아웃일시 */ + private String loginoutDttm; + /* 등록자 아이디 */ + private String regUserId; + /* 등록자 이름 */ + private String regUserNm; + /* 등록일시 */ + private String regDttm; + +} diff --git a/src/main/java/kccf/log/vo/LogPasswdInitHistVO.java b/src/main/java/kccf/log/vo/LogPasswdInitHistVO.java new file mode 100644 index 0000000..06513e9 --- /dev/null +++ b/src/main/java/kccf/log/vo/LogPasswdInitHistVO.java @@ -0,0 +1,32 @@ +package kccf.log.vo; + +import kccf.cmm.vo.CmmBaseVO; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Getter +@Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class LogPasswdInitHistVO extends CmmBaseVO{ + + /* 비밀번호초기화이력 아이디 */ + private String logPasswdInitHistId; + /* 사용자 아이디 */ + private String userId; + /* 발송이메일 */ + private String sndngEmail; + /* 초기화요청일시 */ + private String initRequstDttm; + /* 오류내용 */ + private String errorCn; + /* 등록자 아이디 */ + private String regUserId; + /* 등록일시 */ + private String regDttm; + +} diff --git a/src/main/java/kccf/log/vo/LogUserSvcAccesVO.java b/src/main/java/kccf/log/vo/LogUserSvcAccesVO.java new file mode 100644 index 0000000..135e064 --- /dev/null +++ b/src/main/java/kccf/log/vo/LogUserSvcAccesVO.java @@ -0,0 +1,57 @@ +package kccf.log.vo; + +import kccf.cmm.vo.CmmBaseVO; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Getter +@Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class LogUserSvcAccesVO extends CmmBaseVO { + + /* 사용자서비스접근로그 아이디 */ + private String logUserSvcAccesId; + /* 사용자 아이디 */ + private String userId; + /* 사이트구분코드 */ + private String siteSeCode; + /* 사이트구분코드명 */ + private String siteSeCodeNm; + /* 메뉴 아이디 */ + private String menuId; + /* 메뉴명 */ + private String menuNm; + /* 부모메뉴명 */ + private String upperMenuNm; + /* 추가정보 */ + private String aditInfo; + /* 사용자 아이피 */ + private String userIp; + /* 이용일시 */ + private String useDttm; + /* 요청건수 */ + private String accessCnt; + /* 요청건수 총 합 */ + private String baseTotCnt; + /* 시작시간 */ + private String startTime; + /* 종료시간 */ + private String endTime; + + /* 검색-사이트구분코드 */ + private String searchSiteSeCode; + /* 검색-메뉴아이디 */ + private String searchMenuId; + /* 검색-메뉴명 */ + private String searchMenuNm; + /* 검색-접속기간 시작 */ + private String searchStartDt; + /* 검색-접속기간 종료 */ + private String searchEndDt; + +} diff --git a/src/main/java/kccf/log/web/KccfLogController.java b/src/main/java/kccf/log/web/KccfLogController.java new file mode 100644 index 0000000..711ec2a --- /dev/null +++ b/src/main/java/kccf/log/web/KccfLogController.java @@ -0,0 +1,102 @@ +package kccf.log.web; + +import java.util.List; + +import javax.servlet.http.HttpSession; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import kccf.cmm.web.CmmBaseController; +import kccf.log.service.KccfLogService; +import kccf.log.vo.LogUserSvcAccesVO; +import kccf.login.vo.UserVO; +import lombok.RequiredArgsConstructor; + +@Controller +@RequiredArgsConstructor +@RequestMapping(value = "/sec") +public class KccfLogController extends CmmBaseController{ + + private final KccfLogService kccfLogService; + + @RequestMapping(value = "/log/stat/accessUserListPage.do") + public String accessUserListPage(LogUserSvcAccesVO searchVO, ModelMap model, HttpSession session) { + + UserVO userVO = (UserVO)session.getAttribute("user"); + + if(userVO == null || StringUtils.isAllBlank(userVO.getUserId())) { + return "redirect:/login.do"; + } + + return model.getAttribute("hostId") + "/log/stat/listAccessUser"; + } + + @RequestMapping(value = "/log/stat/selectAccessUserListAjax.do") + public String selectAccessUserListAjax(LogUserSvcAccesVO searchVO, ModelMap model) { + List logUserSvcAccesVO = kccfLogService.selectAccessUserListAjax(searchVO); + + if(logUserSvcAccesVO != null && logUserSvcAccesVO.size() > 0) { + searchVO.setTotCnt(logUserSvcAccesVO.get(0).getTotCnt()); + } + + model.addAttribute("data", logUserSvcAccesVO); + model.addAttribute("searchVO", searchVO); + + return "jsonView"; + } + + @RequestMapping(value = "/log/stat/accessByServiceListPage.do") + public String accessByServiceListPage(LogUserSvcAccesVO searchVO, ModelMap model, HttpSession session) { + + UserVO userVO = (UserVO)session.getAttribute("user"); + + if(userVO == null || StringUtils.isAllBlank(userVO.getUserId())) { + return "redirect:/login.do"; + } + + return model.getAttribute("hostId") + "/log/stat/listAccessByService"; + } + + @RequestMapping(value = "/log/stat/selectAccessByServiceListAjax.do") + public String selectAccessByServiceListAjax(LogUserSvcAccesVO searchVO, ModelMap model) { + List logUserSvcAccesVO = kccfLogService.selectAccessByServiceListAjax(searchVO); + + if(logUserSvcAccesVO != null && logUserSvcAccesVO.size() > 0) { + searchVO.setTotCnt(logUserSvcAccesVO.get(0).getTotCnt()); + } + + model.addAttribute("data", logUserSvcAccesVO); + model.addAttribute("searchVO", searchVO); + + return "jsonView"; + } + + @RequestMapping(value = "/log/stat/AccessByTimeListPage.do") + public String AccessByTimeListPage(LogUserSvcAccesVO searchVO, ModelMap model, HttpSession session) { + + UserVO userVO = (UserVO)session.getAttribute("user"); + + if(userVO == null || StringUtils.isAllBlank(userVO.getUserId())) { + return "redirect:/login.do"; + } + + return model.getAttribute("hostId") + "/log/stat/listAccessByTime"; + } + + @RequestMapping(value = "/log/stat/selectAccessByTimeAjax.do") + public String selectAccessByTimeAjax(LogUserSvcAccesVO searchVO, ModelMap model) { + List logUserSvcAccesVO = kccfLogService.selectAccessByTimeAjax(searchVO); + + if(logUserSvcAccesVO != null && logUserSvcAccesVO.size() > 0) { + searchVO.setTotCnt(logUserSvcAccesVO.get(0).getTotCnt()); + } + + model.addAttribute("data", logUserSvcAccesVO); + model.addAttribute("searchVO", searchVO); + + return "jsonView"; + } +} diff --git a/src/main/java/kccf/login/dao/KccfLoginDAO.java b/src/main/java/kccf/login/dao/KccfLoginDAO.java new file mode 100644 index 0000000..292a951 --- /dev/null +++ b/src/main/java/kccf/login/dao/KccfLoginDAO.java @@ -0,0 +1,119 @@ +package kccf.login.dao; + +import java.util.List; + +import org.springframework.stereotype.Repository; + +import egovframework.com.cmm.service.impl.EgovComAbstractDAO; +import kccf.login.vo.BsnsActInfoVO; +import kccf.login.vo.CmmnCodeDetailVO; +import kccf.login.vo.LclttInfoVO; +import kccf.login.vo.LoginVO; +import kccf.login.vo.UserAuthVO; +import kccf.login.vo.UserVO; +import lombok.RequiredArgsConstructor; + +@Repository("kccfLoginDAO") +public class KccfLoginDAO extends EgovComAbstractDAO{ + + public LoginVO getUserById(String emailLoginId) { + return selectOne("getUserById", emailLoginId); + } + + public void failCntUpdate(String userId) { + update("failCntUpdate", userId); + } + + public void failCntDefaultUpdate(String userId) { + update("failCntDefaultUpdate", userId); + } + + public void lockUpdate(String userId) { + update("lockUpdate", userId); + } + + public List getAuthCodeList(String userId){ + return selectList("getAuthCodeList", userId); + } + + public List selectCodeListAjax(CmmnCodeDetailVO vo){ + return selectList("selectCodeListAjax", vo); + } + + public UserVO selectUserInfo(String emailLoginId) { + return selectOne("selectUserInfo", emailLoginId); + } + + public List getActIdList(String userId){ + return selectList("getActIdList", userId); + } + + public String getLastSvcDttm(String userId) { + return selectOne("getLastSvcDttm", userId); + } + + public int idDoubleCheck(String emailLoginId) { + return selectOne("idDoubleCheck", emailLoginId); + } + + public String selectUserIdSeq() { + return selectOne("selectUserIdSeq"); + } + + public int insertSign(UserVO vo) { + return insert("insertSign", vo); + } + + public int insertAuthCode(UserAuthVO vo) { + return insert("insertAuthCode", vo); + } + + public int insertChrgAct(BsnsActInfoVO vo) { + return insert("insertChrgAct", vo); + } + + public String managerSearchId(UserVO vo) { + return selectOne("managerSearchId", vo); + } + + public int passwordReset(UserVO vo) { + return update("passwordReset", vo); + } + + public String getPassword(UserVO vo) { + return selectOne("getPassword", vo); + } + + public String getAuthDetailCodeNm(Object authCode) { + return selectOne("getAuthDetailCodeNm", authCode); + } + + public List getLclttNmByAreaCode(LclttInfoVO vo){ + return selectList("getLclttNmByAreaCode", vo); + } + + public List getBsnsIdAndActIdByLclttId(BsnsActInfoVO vo){ + return selectList("getBsnsIdAndActIdByLclttId", vo); + } + + public LclttInfoVO getLclttInfoByLclttId(LclttInfoVO vo) { + return selectOne("getLclttInfoByLclttId", vo); + } + + public List getActListByuserId(String userId){ + return selectList("getActListByuserId", userId); + } + + public int updateUserInfo(UserVO vo) { + return update("updateUserInfo", vo); + } + + public int deleteUserChrgAct(BsnsActInfoVO vo) { + return update("deleteUserChrgAct", vo); + } + + public int signupConfirm(UserVO vo) { + return update("signupConfirm", vo); + } + +} diff --git a/src/main/java/kccf/login/service/GenerateAuthenticationKey.java b/src/main/java/kccf/login/service/GenerateAuthenticationKey.java new file mode 100644 index 0000000..c5a119f --- /dev/null +++ b/src/main/java/kccf/login/service/GenerateAuthenticationKey.java @@ -0,0 +1,24 @@ +package kccf.login.service; + +import java.util.Random; + +import org.springframework.stereotype.Component; + +@Component +public class GenerateAuthenticationKey { + + public String getKey(int keyLength) { + + Random random = new Random(); + + StringBuffer buf=new StringBuffer(); + + for(int i = 1; i <= keyLength; i++) { + if(random.nextBoolean()) + buf.append((char)(random.nextInt(26)+65)); // 0~25(26개) + 65 + else + buf.append(random.nextInt(10)); + } + return buf.toString(); + } +} diff --git a/src/main/java/kccf/login/service/KccfLoginService.java b/src/main/java/kccf/login/service/KccfLoginService.java new file mode 100644 index 0000000..c2382ea --- /dev/null +++ b/src/main/java/kccf/login/service/KccfLoginService.java @@ -0,0 +1,58 @@ +package kccf.login.service; + +import java.io.IOException; +import java.net.URISyntaxException; +import java.util.List; + +import kccf.login.vo.BsnsActInfoVO; +import kccf.login.vo.CmmnCodeDetailVO; +import kccf.login.vo.LclttInfoVO; +import kccf.login.vo.UserAuthVO; +import kccf.login.vo.UserVO; + +public interface KccfLoginService { + + public void failCntUpdate(String userId); + + public void failCntDefaultUpdate(String userId); + + public List getAuthList(String userId); + + public List selectCodeListAjax(CmmnCodeDetailVO vo); + + public UserVO selectUserInfo(String emailLoginId); + + public int insertSign(UserVO vo); + + public String selectUserIdSeq(); + + public int idDoubleCheck(String emailLoginId); + + public int insertAuthCode(UserAuthVO vo); + + public String managerSearchId(UserVO vo); + + public int passwordReset(UserVO vo); + + public String getPassword(UserVO vo); + + public String getAuthDetailCodeNm(Object authCode); + + public List getLclttNmByAreaCode(LclttInfoVO vo); + + public List getBsnsIdAndActIdByLclttId(BsnsActInfoVO vo); + + public int insertChrgAct(BsnsActInfoVO vo); + + public LclttInfoVO getLclttInfoByLclttId(LclttInfoVO vo); + + public List getActListByuserId(String userId); + + public int updateUserInfo(UserVO vo); + + public int deleteUserChrgAct(BsnsActInfoVO vo); + + public void sendMail(String emailLoginId, String password, String userNm, String regDttm) throws Exception; + + public int signupConfirm(UserVO vo); +} diff --git a/src/main/java/kccf/login/service/MailUtils.java b/src/main/java/kccf/login/service/MailUtils.java new file mode 100644 index 0000000..04b9a17 --- /dev/null +++ b/src/main/java/kccf/login/service/MailUtils.java @@ -0,0 +1,47 @@ +package kccf.login.service; + +import java.io.UnsupportedEncodingException; + +import javax.activation.DataSource; +import javax.mail.MessagingException; +import javax.mail.internet.MimeMessage; + +import org.springframework.core.io.Resource; +import org.springframework.mail.javamail.JavaMailSender; +import org.springframework.mail.javamail.MimeMessageHelper; + +public class MailUtils { + private JavaMailSender mailSender; + private MimeMessage message; + private MimeMessageHelper messageHelper; + + public MailUtils(JavaMailSender mailSender) throws MessagingException { + this.mailSender = mailSender; + message = this.mailSender.createMimeMessage(); + messageHelper = new MimeMessageHelper(message, true, "UTF-8"); + } + + public void setSubject(String subject) throws MessagingException { + messageHelper.setSubject(subject); + } + + public void setText(String htmlContent, boolean check) throws MessagingException { + messageHelper.setText(htmlContent, check); + } + + public void setFrom(String email, String name) throws UnsupportedEncodingException, MessagingException { + messageHelper.setFrom(email, name); + } + + public void setTo(String email) throws MessagingException { + messageHelper.setTo(email); + } + + public void addInline(String contentId, Resource resource, String contentType) throws MessagingException { + messageHelper.addInline(contentId, resource, contentType); + } + + public void send() { + mailSender.send(message); + } +} diff --git a/src/main/java/kccf/login/service/impl/KccfLoginServiceImpl.java b/src/main/java/kccf/login/service/impl/KccfLoginServiceImpl.java new file mode 100644 index 0000000..726c9b3 --- /dev/null +++ b/src/main/java/kccf/login/service/impl/KccfLoginServiceImpl.java @@ -0,0 +1,303 @@ +package kccf.login.service.impl; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.lang.invoke.MethodHandles; +import java.net.URI; +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.mail.MessagingException; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.ClassPathResource; +import org.springframework.mail.javamail.JavaMailSenderImpl; +import org.springframework.stereotype.Service; + +import kccf.login.dao.KccfLoginDAO; +import kccf.login.service.KccfLoginService; +import kccf.login.service.MailUtils; +import kccf.login.vo.BsnsActInfoVO; +import kccf.login.vo.CmmnCodeDetailVO; +import kccf.login.vo.LclttInfoVO; +import kccf.login.vo.LoginVO; +import kccf.login.vo.UserAuthVO; +import kccf.login.vo.UserVO; +import lombok.RequiredArgsConstructor; + + +@Service("kccfLoginService") +public class KccfLoginServiceImpl implements KccfLoginService +{ + private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + @Resource(name="kccfLoginDAO") + private KccfLoginDAO kccfLoginDAO; + + @Autowired + private JavaMailSenderImpl mailSender; + + @Override + public void failCntUpdate(String emailLoginId) { + LoginVO loginVO = kccfLoginDAO.getUserById(emailLoginId); + + int failCnt = Integer.parseInt(loginVO.getPasswordErrorRtrvl()); + + //비밀번호 오류 숫자가 5를 넘어가면 체크 + if(failCnt >= 5) { + //계정 잠금 + kccfLoginDAO.lockUpdate(loginVO.getUserId()); + }else { + //오류 숫자 +1 + kccfLoginDAO.failCntUpdate(loginVO.getUserId()); + } + } + + @Override + public void failCntDefaultUpdate(String userId) { + //로그인 성공 시 오류 숫자 0으로 초기화 + kccfLoginDAO.failCntDefaultUpdate(userId); + } + + @Override + public List getAuthList(String userId) { + return kccfLoginDAO.getAuthCodeList(userId); + } + + @Override + public List selectCodeListAjax(CmmnCodeDetailVO vo){ + return kccfLoginDAO.selectCodeListAjax(vo); + } + + @Override + public UserVO selectUserInfo(String emailLoginId) { + + UserVO userVO = kccfLoginDAO.selectUserInfo(emailLoginId); + + //사용자 권한 코드 리스트 + userVO.setAuthCodeList(kccfLoginDAO.getAuthCodeList(userVO.getUserId())); + + //시스템권한 코드 전체 리스트 + CmmnCodeDetailVO cmmnCodeDetailVO = new CmmnCodeDetailVO(); + cmmnCodeDetailVO.setCode("AUTH_CODE"); + + List authCodeList = new ArrayList(); + List cmmCodeDetailList = kccfLoginDAO.selectCodeListAjax(cmmnCodeDetailVO); + for(int i = 0; i < cmmCodeDetailList.size(); i++) { + authCodeList.add(cmmCodeDetailList.get(i).getDetailCode()); + } + + userVO.setSysAuthCode(authCodeList); + + //사용자 활동 아이디 리스트 + userVO.setActIdList(kccfLoginDAO.getActIdList(userVO.getUserId())); + + //최종서비스 이용일시 + userVO.setLastSvcDttm(kccfLoginDAO.getLastSvcDttm(userVO.getUserId())); + + return userVO; + } + + @Override + public int idDoubleCheck(String emailLoginId) { + return kccfLoginDAO.idDoubleCheck(emailLoginId); + } + + @Override + public String selectUserIdSeq() { + return kccfLoginDAO.selectUserIdSeq(); + } + + @Override + public int insertSign(UserVO vo) { + return kccfLoginDAO.insertSign(vo); + } + + @Override + public int insertAuthCode(UserAuthVO vo) { + return kccfLoginDAO.insertAuthCode(vo); + } + + @Override + public int insertChrgAct(BsnsActInfoVO vo) { + return kccfLoginDAO.insertChrgAct(vo); + } + + @Override + public String managerSearchId(UserVO vo) { + return kccfLoginDAO.managerSearchId(vo); + } + + @Override + public int passwordReset(UserVO vo) { + return kccfLoginDAO.passwordReset(vo); + } + + @Override + public String getPassword(UserVO vo) { + return kccfLoginDAO.getPassword(vo); + } + + @Override + public String getAuthDetailCodeNm(Object authCode) { + return kccfLoginDAO.getAuthDetailCodeNm(authCode); + } + + @Override + public List getLclttNmByAreaCode(LclttInfoVO vo){ + return kccfLoginDAO.getLclttNmByAreaCode(vo); + } + + @Override + public List getBsnsIdAndActIdByLclttId(BsnsActInfoVO vo){ + return kccfLoginDAO.getBsnsIdAndActIdByLclttId(vo); + } + + @Override + public LclttInfoVO getLclttInfoByLclttId(LclttInfoVO vo) { + return kccfLoginDAO.getLclttInfoByLclttId(vo); + } + + @Override + public List getActListByuserId(String userId){ + return kccfLoginDAO.getActListByuserId(userId); + } + + @Override + public int updateUserInfo(UserVO vo) { + return kccfLoginDAO.updateUserInfo(vo); + } + + @Override + public int deleteUserChrgAct(BsnsActInfoVO vo) { + return kccfLoginDAO.deleteUserChrgAct(vo); + } + + @Override + public int signupConfirm(UserVO vo) { + return kccfLoginDAO.signupConfirm(vo); + } + + @Override + public void sendMail(String emailLoginId, String password, String userNm, String regDttm) throws Exception + { + LOGGER.debug(" >>>>>>>>>> sendMail <<<<<<<<<< "); + + try + { + MailUtils sendMail = new MailUtils(mailSender); + + String htmlTemplate = ""; + String populatedHTML = ""; + ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); + URL resource = null; + URI uri = null; + Path path = null; + + if(password.equals("")) { + + // HTML 템플릿 파일 경로 설정 + resource = classLoader.getResource("/templates/emailAuthenticationTemplate.html"); + uri = resource.toURI(); + path = Paths.get(uri); + + // HTML 템플릿을 문자열로 읽어오기 + htmlTemplate = readFileAsString(path); + + // 템플릿 변수 맵 생성 + Map templateVariables = new HashMap<>(); + templateVariables.put("emailLoginId", emailLoginId); + templateVariables.put("userNm", userNm); + templateVariables.put("regDttm", regDttm); + + // HTML 템플릿 변수를 실제 값으로 치환 + populatedHTML = populateTemplate(htmlTemplate, templateVariables); + + sendMail.setSubject("[문화원연합회]회원가입 이메일 인증"); + sendMail.setText(populatedHTML, true); + + // HTML 템플릿에 이미지 삽입하기 + ClassPathResource img_one = imageResource("static/images/logo.png"); + sendMail.addInline("logo", img_one, "image/png"); + + ClassPathResource img_two = imageResource("static/images/btn-email-authentication.png"); + sendMail.addInline("button", img_two, "image/png"); + }else { + // HTML 템플릿 파일 경로 설정 + resource = classLoader.getResource("/templates/passwordResetTemplate.html"); + uri = resource.toURI(); + path = Paths.get(uri); + + // HTML 템플릿을 문자열로 읽어오기 + htmlTemplate = readFileAsString(path); + + // 템플릿 변수 맵 생성 + Map templateVariables = new HashMap<>(); + templateVariables.put("emailLoginId", emailLoginId); + templateVariables.put("pw", password); + + // HTML 템플릿 변수를 실제 값으로 치환 + populatedHTML = populateTemplate(htmlTemplate, templateVariables); + + sendMail.setSubject("[문화원연합회]비밀번호 초기화_임시 비밀번호 발송"); + sendMail.setText(populatedHTML, true); + + // HTML 템플릿에 이미지 삽입하기 + ClassPathResource img_one = imageResource("static/images/logo.png"); + sendMail.addInline("logo", img_one, "image/png"); + } + + sendMail.setFrom("kccfsend@kccf.or.kr", "문화원연합회 관리자"); + sendMail.setTo(emailLoginId); + sendMail.send(); + } + catch (MessagingException e) + { + LOGGER.error(" MessagingException "); + e.printStackTrace(); + + } + catch (UnsupportedEncodingException e) + { + LOGGER.error(" UnsupportedEncodingException "); + e.printStackTrace(); + } + catch (Exception e) + { + LOGGER.error(" Exception "); + e.printStackTrace(); + + throw e; + } + + LOGGER.debug(" <<<<<<<<<< sendMail >>>>>>>>>> "); + + } + + public String readFileAsString(Path path) throws IOException { + + return new String(Files.readAllBytes(path)); + } + + public String populateTemplate(String template, Map variables) { + for (Map.Entry entry : variables.entrySet()) { + String variable = "${" + entry.getKey() + "}"; + template = template.replace(variable, entry.getValue()); + } + return template; + } + + public ClassPathResource imageResource(String path) { + return new ClassPathResource(path); + } + +} \ No newline at end of file diff --git a/src/main/java/kccf/login/vo/BsnsActInfoVO.java b/src/main/java/kccf/login/vo/BsnsActInfoVO.java new file mode 100644 index 0000000..55a7488 --- /dev/null +++ b/src/main/java/kccf/login/vo/BsnsActInfoVO.java @@ -0,0 +1,35 @@ +package kccf.login.vo; + +import java.util.List; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Setter +@Getter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class BsnsActInfoVO { + + /* 사용자 아이디 */ + private String userId; + /* 사업 아이디 */ + private String bsnsId; + /* 사업명*/ + private String bsnsNm; + /* 활동 아이디 */ + private String actId; + /* 활동명 */ + private String actNm; + /* 지방문화원 아이디 */ + private String lclttId; + + private String regUserId; + + private List actIdArr; + +} diff --git a/src/main/java/kccf/login/vo/CmmnCodeDetailVO.java b/src/main/java/kccf/login/vo/CmmnCodeDetailVO.java new file mode 100644 index 0000000..cad4f59 --- /dev/null +++ b/src/main/java/kccf/login/vo/CmmnCodeDetailVO.java @@ -0,0 +1,31 @@ +package kccf.login.vo; + +import java.util.List; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Setter +@Getter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class CmmnCodeDetailVO { + + /* 코드 */ + private String code; + /* 상세코드 */ + private String detailCode; + /* 상세코드명 */ + private String detailCodeNm; + /* 추가속성정보값1 */ + private String aditAtrbInfoValue1; + /* 추가속성정보값2 */ + private String aditAtrbInfoValue2; + /* 추가속성정보값3 */ + private String aditAtrbInfoValue3; + +} diff --git a/src/main/java/kccf/login/vo/LclttInfoVO.java b/src/main/java/kccf/login/vo/LclttInfoVO.java new file mode 100644 index 0000000..31f57fb --- /dev/null +++ b/src/main/java/kccf/login/vo/LclttInfoVO.java @@ -0,0 +1,27 @@ +package kccf.login.vo; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Setter +@Getter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class LclttInfoVO { + + /* 문화원 아이디 */ + private String lclttId; + /* 문화원 이름 */ + private String lclttNm; + /* 지역 코드 */ + private String areaCode; + /* 지역 이름 */ + private String codeNm; + + + +} diff --git a/src/main/java/kccf/login/vo/LoginVO.java b/src/main/java/kccf/login/vo/LoginVO.java new file mode 100644 index 0000000..120aa6b --- /dev/null +++ b/src/main/java/kccf/login/vo/LoginVO.java @@ -0,0 +1,225 @@ +package kccf.login.vo; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.List; + +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.SpringSecurityCoreVersion; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.userdetails.UserDetails; + +public class LoginVO implements UserDetails { + +private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID; + + /* 사용자 아이디 */ + private String userId; + /* 로그인 아이디 */ + private String emailLoginId; + /* 비밀번호 */ + private String password; + /* 비밀번호오류회수 */ + private String passwordErrorRtrvl; + /* 이메일주소인증일시 */ + private String emailCrtfcDttm; + /* 승인반려일시 */ + private String confmDttm; + /* 반려내용 */ + private String returnCn; + /* 사용시작일자 */ + private String useBgnde; + /* 사용종료일자 */ + private String useEndde; + /* 사용여부 */ + private String useYn; + /* 권한코드 리스트*/ + private List authorities; + + private String ip; + + public void setAuthorities(List authList) { + + List authorities = new ArrayList(); + + for (int i = 0; i < authList.size(); i++) { + authorities.add(new SimpleGrantedAuthority("ROLE_"+authList.get(i))); + } + + this.authorities = authorities; + } + + //사용자에게 부여된 권한을 반환합니다. null을 반환할 수 없습니다. + @Override + public Collection getAuthorities() { + return authorities; + } + + @Override + public String getUsername() { + return emailLoginId; + } + + @Override + public String getPassword() { + // TODO Auto-generated method stub + return password; + } + + // 계정이 만료 되지 않았는가? + @Override + public boolean isAccountNonExpired() { + return true; + } + + // 계정이 잠기지 않았는가? + @Override + public boolean isAccountNonLocked() { + int failCnt = Integer.parseInt(this.passwordErrorRtrvl); + boolean result = true; + + if(failCnt >= 5) { + if("N".equals(this.useYn)) { + result = false; + }else { + result = true; + } + } + + return result; + } + + // 패스워드가 만료되지 않았는가? + @Override + public boolean isCredentialsNonExpired() { + boolean result = false; + try { + + SimpleDateFormat fmd = new SimpleDateFormat("yyyyMMddHHmmss"); + Date nowDate = new Date(); + + Date bgnde = fmd.parse(this.useBgnde); + Date endde = fmd.parse(this.useEndde); + + if(nowDate.after(bgnde) && nowDate.before(endde)) { + result = true; + } + + } catch (ParseException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return result; + } + + // 계정이 활성화 되었는가? + @Override + public boolean isEnabled() { + int failCnt = Integer.parseInt(this.passwordErrorRtrvl); + boolean result = true; + + if(failCnt < 5) { + if("Y".equals(this.useYn)) { + result = true; + }else { + result = false; + } + } + + return result; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getEmailLoginId() { + return emailLoginId; + } + + public void setEmailLoginId(String emailLoginId) { + this.emailLoginId = emailLoginId; + } + + public String getPasswordErrorRtrvl() { + return passwordErrorRtrvl; + } + + public void setPasswordErrorRtrvl(String passwordErrorRtrvl) { + this.passwordErrorRtrvl = passwordErrorRtrvl; + } + + public String getUseBgnde() { + return useBgnde; + } + + public void setUseBgnde(String useBgnde) { + this.useBgnde = useBgnde; + } + + public String getUseEndde() { + return useEndde; + } + + public void setUseEndde(String useEndde) { + this.useEndde = useEndde; + } + + public String getUseYn() { + return useYn; + } + + public void setUseYn(String useYn) { + this.useYn = useYn; + } + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public static long getSerialversionuid() { + return serialVersionUID; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getEmailCrtfcDttm() { + return emailCrtfcDttm; + } + + public void setEmailCrtfcDttm(String emailCrtfcDttm) { + this.emailCrtfcDttm = emailCrtfcDttm; + } + + public String getReturnCn() { + return returnCn; + } + + public void setReturnCn(String returnCn) { + this.returnCn = returnCn; + } + + public String getConfmDttm() { + return confmDttm; + } + + public void setConfmDttm(String confmDttm) { + this.confmDttm = confmDttm; + } + + +} diff --git a/src/main/java/kccf/login/vo/UserAuthVO.java b/src/main/java/kccf/login/vo/UserAuthVO.java new file mode 100644 index 0000000..9dad7e3 --- /dev/null +++ b/src/main/java/kccf/login/vo/UserAuthVO.java @@ -0,0 +1,29 @@ +package kccf.login.vo; + +import java.util.List; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Setter +@Getter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class UserAuthVO { + + private String userId; + + private String authCode; + + private String regUserId; + + private String regDttm; + + private List authCodeArr; + + +} diff --git a/src/main/java/kccf/login/vo/UserVO.java b/src/main/java/kccf/login/vo/UserVO.java new file mode 100644 index 0000000..a6ef903 --- /dev/null +++ b/src/main/java/kccf/login/vo/UserVO.java @@ -0,0 +1,63 @@ +package kccf.login.vo; + +import java.util.List; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Setter +@Getter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class UserVO { + + /* 사용자 아이디 */ + private String userId; + /* 로그인 아이디 */ + private String emailLoginId; + /* 성명 */ + private String userNm; + /* 휴대전화번호 */ + private String moblphonNo; + /* 소속명 */ + private String psitnNm; + /* 직급명 */ + private String clsfNm; + /* 소속 지방문화원 아이디 */ + private String psitnLclttId; + /* 사용시작일자 */ + private String useBgnde; + /* 사용종료일자 */ + private String useEndde; + /* 시스템권한코드 */ + private List sysAuthCode; + /* 권한코드목록 */ + private List authCodeList; + /* 활동 아이디 목록 */ + private List actIdList; + /* 로그인일시 */ + private String loginDttm; + /* 최종서비스이용일시 */ + private String lastSvcDttm; + /* 최종지방문화원 아이디 */ + private String lastLclttId; + /* 최종사업 아이디 */ + private String lastBsnsId; + /* 최종활동 아이디 */ + private String lastActId; + /* 접속 아이피 */ + private String curUserIp; + /* 비밀번호 회원가입 시 필요 */ + private String password; + /* 작성자 아이디 회원가입 시 필요 */ + private String regUserId; + /* 작성일시 회원가입 시 필요 */ + private String regDttm; + /* 수정자 아이디 회원가입 시 필요 */ + private String updUserId; + +} diff --git a/src/main/java/kccf/login/web/KccfLoginController.java b/src/main/java/kccf/login/web/KccfLoginController.java new file mode 100644 index 0000000..a238fd5 --- /dev/null +++ b/src/main/java/kccf/login/web/KccfLoginController.java @@ -0,0 +1,507 @@ +package kccf.login.web; + +import java.lang.invoke.MethodHandles; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.List; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.factory.PasswordEncoderFactories; +import org.springframework.security.crypto.password.PasswordEncoder; +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.servlet.View; + +import kccf.cmm.web.CmmBaseController; +import kccf.log.service.KccfLogService; +import kccf.log.vo.LogPasswdInitHistVO; +import kccf.login.service.GenerateAuthenticationKey; +import kccf.login.service.KccfLoginService; +import kccf.login.vo.BsnsActInfoVO; +import kccf.login.vo.CmmnCodeDetailVO; +import kccf.login.vo.LclttInfoVO; +import kccf.login.vo.UserAuthVO; +import kccf.login.vo.UserVO; +import lombok.RequiredArgsConstructor; + +@Controller +@RequiredArgsConstructor +public class KccfLoginController extends CmmBaseController { + + private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + private final KccfLoginService kccfLoginService; + + @Autowired + private PasswordEncoder passwordEncoder; + + /** jsonView */ + @Resource(name = "jsonView") + private View jsonView; + + @Autowired + private GenerateAuthenticationKey generateAuthenticationKey; + + @Resource(name = "kccfLogService") + private KccfLogService kccfLogService; + + /** + * @Description : 회원가입 화면 + * + * @author 한국문화원연합회 / 디지탈쉽 JWKIM + * @since 2023-10-10 + * + * @param request + * @param model + * @return String + * @throws Exception + * + */ + @RequestMapping(value = "/login/signup.do") + public String joinUserPage(HttpServletRequest request, ModelMap model, HttpSession session) { + + UserVO sessionVO = (UserVO)session.getAttribute("user"); + + if(sessionVO != null) { + return "redirect:/mngMain.do"; + } + + return model.getAttribute("hostId") + "/login/signup"; + } + + /** + * @Description : 회원가입 화면 + * + * @author 한국문화원연합회 / 디지탈쉽 JWKIM + * @since 2023-10-10 + * + * @param UserVO + * @param UserAuthVO + * @param BsnsActInfoVO + * @param model + * @return String + * @throws Exception + * + */ + @RequestMapping(value = "/login/insertSignup.do") + public String insertSign (UserVO userVO, UserAuthVO userAuthVO, BsnsActInfoVO bsnsActInfoVO, ModelMap model) throws Exception{ + + int resultInt = 0; + + //시퀀스 조회 + String userId = kccfLoginService.selectUserIdSeq(); + userVO.setUserId(userId); + userVO.setRegUserId(userId); + userAuthVO.setUserId(userId); + userAuthVO.setRegUserId(userId); + + //비밀번호 암호화 + //String encodePw = EgovFileScrty.encryptPassword(userVO.getPassword(), userVO.getEmailLoginId()); + passwordEncoder = PasswordEncoderFactories.createDelegatingPasswordEncoder(); + + String encodePw = passwordEncoder.encode(userVO.getPassword()); + userVO.setPassword(encodePw); + + //회원정보(필수), 지방문화원/연합회 insert + kccfLoginService.insertSign(userVO); + + //회원 권한 코드 insert + kccfLoginService.insertAuthCode(userAuthVO); + + + //담당 프로그램 insert + if(bsnsActInfoVO.getActIdArr() != null) { + for(int i = 0; i < bsnsActInfoVO.getActIdArr().size(); i++) { + bsnsActInfoVO.setUserId(userId); + bsnsActInfoVO.setRegUserId(userId); + bsnsActInfoVO.setActId(bsnsActInfoVO.getActIdArr().get(i)); + kccfLoginService.insertChrgAct(bsnsActInfoVO); + } + } + + LocalDateTime now = LocalDateTime.now(); + String formatedNow = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")); + + kccfLoginService.sendMail(userVO.getEmailLoginId(), "", userVO.getUserNm(), formatedNow); + + return "redirect:/login.do"; + } + + /** + * @Description : 코드 조회 ajax + * + * @author 한국문화원연합회 / 디지탈쉽 JWKIM + * @since 2023-10-10 + * + * @param CmmnCodeDetailVO + * @param model + * @return jsonView + * @throws Exception + * + */ + @RequestMapping(value = "/login/selectCodeListAjax.do") + public View selectCodeListAjax(@ModelAttribute("CmmnCodeDetailVO")CmmnCodeDetailVO vo, ModelMap model) { + + model.addAttribute("codeList", kccfLoginService.selectCodeListAjax(vo)); + + return jsonView; + } + + /** + * @Description : 지역 코드 조회 ajax + * + * @author 한국문화원연합회 / 디지탈쉽 JWKIM + * @since 2023-10-10 + * + * @param LclttInfoVO + * @param model + * @return jsonView + * @throws Exception + * + */ + @RequestMapping(value = "/login/getLclttIdByAreaCodeAjax.do") + public View getLclttIdByAreaCode(LclttInfoVO lclttInfoVO, ModelMap model) { + + model.addAttribute("lclttInfoList", kccfLoginService.getLclttNmByAreaCode(lclttInfoVO)); + + return jsonView; + } + + + /** + * @Description : 지역코드로 문화원 ID 조회 ajax + * + * @author 한국문화원연합회 / 디지탈쉽 JWKIM + * @since 2023-10-10 + * + * @param BsnsActInfoVO + * @param model + * @return String + * @throws Exception + * + */ + @RequestMapping(value = "/login/getBsnsIdAndActIdByLclttIdAjax.do") + public View getBsnsIdAndActIdByLclttId(BsnsActInfoVO bsnsActInfoVO, ModelMap model) { + + model.addAttribute("bsnsActInfoList", kccfLoginService.getBsnsIdAndActIdByLclttId(bsnsActInfoVO)); + + return jsonView; + } + + /** + * @Description : 아이디 더블 체크 ajax + * + * @author 한국문화원연합회 / 디지탈쉽 JWKIM + * @since 2023-10-10 + * + * @param String emailLoginId + * @param model + * @return jsonView + * @throws Exception + * + */ + @RequestMapping(value = "/login/idDoubleCheckAjax.do") + public View pwDoubleCheck(String emailLoginId, ModelMap model, HttpSession session) { + + model.addAttribute("checkCnt", kccfLoginService.idDoubleCheck(emailLoginId)); + + return jsonView; + } + + /** + * @Description : id찾기 화면 + * + * @author 한국문화원연합회 / 디지탈쉽 JWKIM + * @since 2023-10-10 + * + * @param request + * @param model + * @return String + * @throws Exception + * + */ + @RequestMapping(value = "/login/findManagerIdPage.do") + public String findManagerIdPage(HttpServletRequest request, ModelMap model, HttpSession session) { + + UserVO sessionVO = (UserVO)session.getAttribute("user"); + + if(sessionVO != null) { + return "redirect:/mngMain.do"; + } + + return model.getAttribute("hostId") + "/login/findManagerId"; + } + + /** + * @Description : 이름, 휴대전화번호로 아이디 찾기 ajax + * + * @author 한국문화원연합회 / 디지탈쉽 JWKIM + * @since 2023-10-10 + * + * @param UserVO + * @param model + * @return jsonView + * @throws Exception + * + */ + @RequestMapping(value = "/login/managerSearchIdAjax.do") + public String managerSearchId(UserVO vo, ModelMap model) { + + model.addAttribute("emailLoginId", kccfLoginService.managerSearchId(vo)); + + return "jsonView"; + } + + /** + * @Description : 비밀번호 초기화 ajax + * + * @author 한국문화원연합회 / 디지탈쉽 JWKIM + * @since 2023-10-10 + * + * @param UserVO + * @param model + * @return jsonView + * @throws Exception + * + * 2025.06.09 나혁제 View 형태로 리턴 + */ + @RequestMapping(value = "/login/passwordResetAjax.do") + // public String passwordReset(UserVO vo, ModelMap model) throws Exception + public View passwordReset(UserVO vo, ModelMap model) throws Exception + { + LOGGER.info(" >>>>>>>>>> passwordReset <<<<<<<<<<"); + int resultInt = 0; + + //10자리 숫자 영어 조합된 비밀번호 생성 + String gaKey = generateAuthenticationKey.getKey(10); + System.out.println("10자리 랜덤 비밀번호 생성 : " + gaKey); + + //비밀번호 암호화하여 db에 저장 + passwordEncoder = PasswordEncoderFactories.createDelegatingPasswordEncoder(); + + String enGaKey = passwordEncoder.encode(gaKey); + + System.out.println("10자리 랜덤 비밀번호 암호화 : " + enGaKey); + + vo.setPassword(enGaKey); + resultInt = kccfLoginService.passwordReset(vo); + + LogPasswdInitHistVO logPasswdInitHistVO = new LogPasswdInitHistVO(); + UserVO userVO = kccfLoginService.selectUserInfo(vo.getEmailLoginId()); + + logPasswdInitHistVO.setUserId(userVO.getUserId()); + logPasswdInitHistVO.setSndngEmail(userVO.getEmailLoginId()); + logPasswdInitHistVO.setRegUserId(userVO.getUserId()); + + if(resultInt > 0) { + kccfLogService.insertLogPasswdInitHist(logPasswdInitHistVO); + model.addAttribute("returnVal", "successe"); + }else { + logPasswdInitHistVO.setErrorCn("비밀번호 초기화 실패"); + kccfLogService.insertLogPasswdInitHist(logPasswdInitHistVO); + model.addAttribute("returnVal", "fail"); + } + + //이메일로 비밀번호 전송1 + kccfLoginService.sendMail(vo.getEmailLoginId(), gaKey, vo.getUserNm(), ""); + + // return "jsonView"; + + LOGGER.info(" <<<<<<<<<< passwordReset >>>>>>>>>> "); + + return jsonView; + } + + /** + * @Description : 비밀번호 초기화 화면 화면 + * + * @author 한국문화원연합회 / 디지탈쉽 JWKIM + * @since 2023-10-10 + * + * @param request + * @param model + * @return String + * @throws Exception + * + */ + @RequestMapping(value = "/login/passwordResetPage.do") + public String passwordResetPage(HttpServletRequest request, ModelMap model, HttpSession session) { + + UserVO sessionVO = (UserVO)session.getAttribute("user"); + + if(sessionVO != null) { + return "redirect:/mngMain.do"; + } + + return model.getAttribute("hostId") + "/login/passwordReset"; + } + + /** + * @Description : 내정보변경 화면 + * + * @author 한국문화원연합회 / 디지탈쉽 JWKIM + * @since 2023-10-10 + * + * @param UserVO + * @param model + * @return String + * @throws Exception + * + */ + @RequestMapping(value = "/login/updateUserPage.do") + public String updateUserPage(UserVO vo, HttpSession session, ModelMap model) throws Exception{ + + Boolean pwCheck = false; + + + if(vo.getPassword() == null || vo.getPassword() == "") { + return model.getAttribute("hostId") + "/user/checkPassword"; + } + + String searchPw = kccfLoginService.getPassword(vo); + String [] pw = searchPw.split("}"); + + BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(); + pwCheck = encoder.matches(vo.getPassword(), pw[1]); + + if(!pwCheck) { + return model.getAttribute("hostId") + "/user/checkPassword"; + }else { + + UserVO sessionVO = (UserVO)session.getAttribute("user"); + + List authCodeList = sessionVO.getAuthCodeList(); + String authDetailCodeNm = ""; + + for(int i = 0; i 0) { + UserVO sessionVO = (UserVO)session.getAttribute("user"); + sessionVO.setUserNm(userVO.getUserNm()); + sessionVO.setMoblphonNo(userVO.getMoblphonNo()); + sessionVO.setPsitnNm(userVO.getPsitnNm()); + sessionVO.setClsfNm(userVO.getClsfNm()); + sessionVO.setPsitnLclttId(userVO.getPsitnLclttId()); + } + + if(bsnsActInfoVO.getActIdArr() != null) { + kccfLoginService.deleteUserChrgAct(bsnsActInfoVO); + + for(int i = 0; i < bsnsActInfoVO.getActIdArr().size(); i++) { + + bsnsActInfoVO.setActId(bsnsActInfoVO.getActIdArr().get(i)); + bsnsActInfoVO.setRegUserId(getUserId()); + kccfLoginService.insertChrgAct(bsnsActInfoVO); + } + }else { + kccfLoginService.deleteUserChrgAct(bsnsActInfoVO); + } + + return "redirect:/login/updateUserPage.do?selMenuId=MM0015"; + } + + /** + * @Description : 사용자 메일 인증 + * + * @author 한국문화원연합회 / 디지탈쉽 JWKIM + * @since 2023-10-11 + * + * @param UserVO + * @param model + * @return String + * @throws Exception + * + */ + @RequestMapping(value = "/login/signupConfirm.do") + public String signupConfirm(UserVO vo) { + kccfLoginService.signupConfirm(vo); + + return "redirect:/login.do"; + } + + @RequestMapping("/login.do") + public String index(HttpServletRequest request, ModelMap model, HttpSession session) { + + UserVO sessionVO = (UserVO)session.getAttribute("user"); + if(sessionVO != null) { + // TODO : 기존 세션 존재시, 로그아웃 처리 + } + + // 로그인 페이지 접속 + return model.getAttribute("hostId") + "/login/login"; + } + + @RequestMapping("/login/waitingForAuthentication.do") + public String waitingForAuthentication(HttpServletRequest request, ModelMap model, HttpSession session) { + + return model.getAttribute("hostId") + "/login/waitingForAuthentication"; + } +} diff --git a/src/main/java/kccf/main/dao/MainKccfDAO.java b/src/main/java/kccf/main/dao/MainKccfDAO.java new file mode 100644 index 0000000..1598c44 --- /dev/null +++ b/src/main/java/kccf/main/dao/MainKccfDAO.java @@ -0,0 +1,50 @@ +package kccf.main.dao; + +import java.util.List; + +import org.springframework.stereotype.Repository; + +import kccf.bbs.vo.BbsNttItemVO; +import kccf.cmm.dao.CmmBaseDAO; +import kccf.main.vo.CurationInfoVO; + +@Repository +public class MainKccfDAO extends CmmBaseDAO { + + public List selectListRecentWoorimunhwa() throws Exception { + return selectList("mainKccfDAO.selectListRecentWoorimunhwa"); + } + + public List selectListRecentBbs(BbsNttItemVO bbsNttItemVO) throws Exception { + return selectList("mainKccfDAO.selectListRecentBbs", bbsNttItemVO); + } + + public List selectListRecentBbs() throws Exception { + return selectList("mainKccfDAO.selectListRecentBbs"); + } + + public List selectListBanner() throws Exception { + return selectList("mainKccfDAO.selectListBanner"); + } + + public List selectListRecentNotice() throws Exception { + return selectList("mainKccfDAO.selectListRecentNotice"); + } + + public List selectListRecentBbsLocalNews() throws Exception { + return selectList("mainKccfDAO.selectListRecentBbsLocalNews"); + } + + public List selectListRecentBbsEvent() throws Exception { + return selectList("mainKccfDAO.selectListRecentBbsEvent"); + } + + public List selectListRecentBbsBiz() throws Exception { + return selectList("mainKccfDAO.selectListRecentBbsBiz"); + } + + public int updateCuration(CurationInfoVO curationInfoVO) throws Exception { + return update("mainKccfDAO.updateCuration", curationInfoVO); + } + +} diff --git a/src/main/java/kccf/main/dao/MainMngDAO.java b/src/main/java/kccf/main/dao/MainMngDAO.java new file mode 100644 index 0000000..f4d7a44 --- /dev/null +++ b/src/main/java/kccf/main/dao/MainMngDAO.java @@ -0,0 +1,24 @@ +package kccf.main.dao; + +import java.util.List; + +import org.springframework.stereotype.Repository; + +import kccf.bbs.vo.BbsNttItemVO; +import kccf.cmm.dao.CmmBaseDAO; + +@Repository +public class MainMngDAO extends CmmBaseDAO { + + public List selectListMyBbsAnswer(BbsNttItemVO bbsNttItemVO) throws Exception { + return selectList("mainMngDAO.selectListMyBbsAnswer", bbsNttItemVO); + } + + public List selectListRecentBbs(BbsNttItemVO bbsNttItemVO) throws Exception { + return selectList("mainMngDAO.selectListRecentBbs", bbsNttItemVO); + } + + public List selectMainPopupList(BbsNttItemVO searchVO) { + return selectList("mainMngDAO.selectMainPopupList", searchVO); + } +} diff --git a/src/main/java/kccf/main/dao/MainSeniorDAO.java b/src/main/java/kccf/main/dao/MainSeniorDAO.java new file mode 100644 index 0000000..8b0c01d --- /dev/null +++ b/src/main/java/kccf/main/dao/MainSeniorDAO.java @@ -0,0 +1,71 @@ +package kccf.main.dao; + +import java.util.List; + +import org.springframework.stereotype.Repository; + +import kccf.act.vo.ActVO; +import kccf.bbs.vo.BbsNttItemVO; +import kccf.bbs.vo.LectureItemVO; +import kccf.cmm.dao.CmmBaseDAO; + +@Repository +public class MainSeniorDAO extends CmmBaseDAO { + + public List selectListRecentWoorimunhwa() throws Exception { + return selectList("mainSeniorDAO.selectListRecentWoorimunhwa"); + } + + public List selectLastFestivalIntro() throws Exception { + return selectList("mainSeniorDAO.selectLastFestivalIntro"); + } + + public List selectListActsByDate(String searchDate) throws Exception { + return selectList("mainSeniorDAO.selectListActsByDate", searchDate); + } + + public List selectListRecentNotice() throws Exception { + return selectList("mainSeniorDAO.selectListRecentNotice"); + } + + public List selectListRecentFestivalInfos() throws Exception { + return selectList("mainSeniorDAO.selectListRecentFestivalInfos"); + } + + public List selectListOnlineLectures() throws Exception { + return selectList("mainSeniorDAO.selectListOnlineLectures"); + } + + + + + + + public List selectListRecentBbs(BbsNttItemVO bbsNttItemVO) throws Exception { + return selectList("mainSeniorDAO.selectListRecentBbs", bbsNttItemVO); + } + + public List selectListActInfo() throws Exception { + return selectList("mainSeniorDAO.selectListActInfo"); + } + + public List selectListRecentBbs() throws Exception { + return selectList("mainSeniorDAO.selectListRecentBbs"); + } + + public List selectListBanner() throws Exception { + return selectList("mainSeniorDAO.selectListBanner"); + } + + public List selectListRecentBbsLocalNews() throws Exception { + return selectList("mainSeniorDAO.selectListRecentBbsLocalNews"); + } + + public List selectListRecentBbsEvent() throws Exception { + return selectList("mainSeniorDAO.selectListRecentBbsEvent"); + } + + public List selectListRecentBbsBiz() throws Exception { + return selectList("mainSeniorDAO.selectListRecentBbsBiz"); + } +} diff --git a/src/main/java/kccf/main/service/MainKccfService.java b/src/main/java/kccf/main/service/MainKccfService.java new file mode 100644 index 0000000..ff3b579 --- /dev/null +++ b/src/main/java/kccf/main/service/MainKccfService.java @@ -0,0 +1,92 @@ +package kccf.main.service; + +import java.util.List; + +import kccf.bbs.vo.BbsNttItemVO; +import kccf.code.vo.CmmCodeVO; +import kccf.main.vo.CurationInfoVO; + +/** + * @Class : MainKccfService.java + * @Description : 누리집 메인홈 서비스 + * + * @Modification + * + * 수정일 수정자 수정내용 + * ---------- ------- --------------------------- + * 2023-11-15 KNKIM 최초 생성 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-11-15 + * + */ +public interface MainKccfService { + + + /** + * @Description : 월간우리문화 최근 글 5건 목록 조회 + * @return + * @throws Exception + */ + public List selectListRecentWoorimunhwa() throws Exception; + + /** + * @Description : 이달의 큐레이션 내용 조회 + * @return + * @throws Exception + */ + public String selectCuration() throws Exception; + + /** + * Description : 최근게시물 조회 (관리자 메뉴 경로 포함) + * @param bbsNttItemVO + * @return + * @throws Exception + */ + public List selectListRecentBbs(BbsNttItemVO bbsNttItemVO) throws Exception; + + /** + * @Description : 메인 상단 베너 목록을 조회한다. + * @return + * @throws Exception + */ + public List selectListBanner() throws Exception; + + /** + * @Description : 최근 공지사항 목록을 조회한다. + * @return + * @throws Exception + */ + public List selectListRecentNotice() throws Exception; + + /** + * @Description : 최근 문화원소식 썸네일 게시물 목록을 조회한다. + * @return + * @throws Exception + */ + public List selectListRecentBbsLocalNews() throws Exception; + + /** + * @Description : 최근 행사,보도자료 게시물 목록을 조회한다. + * @return + * @throws Exception + */ + public List selectListRecentBbsEvent() throws Exception; + + + /** + * @Description : 최근 공고, 입찰, 채용 목록을 조회한다. + * @return + * @throws Exception + */ + public List selectListRecentBbsBiz() throws Exception; + + /** + * @Description : 이달의 큐레이션 연동 API를 통해 조회한다. + * @return + */ + public CurationInfoVO makeCurationContent(); + + public boolean makeCurationHtml(CurationInfoVO curationInfoVO) throws Exception; + +} diff --git a/src/main/java/kccf/main/service/MainMngService.java b/src/main/java/kccf/main/service/MainMngService.java new file mode 100644 index 0000000..902ff3d --- /dev/null +++ b/src/main/java/kccf/main/service/MainMngService.java @@ -0,0 +1,48 @@ +package kccf.main.service; + +import java.util.List; + +import kccf.bbs.vo.BbsNttItemVO; +import kccf.code.vo.CmmCodeVO; + +/** + * @Class : MainMngService.java + * @Description : 관리자 메인홈 서비스 + * + * @Modification + * + * 수정일 수정자 수정내용 + * ---------- ------- --------------------------- + * 2023-11-11 KNKIM 최초 생성 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-11-11 + * + */ +public interface MainMngService { + + + /** + * @Description : 소통의장(N000000000000000000028) 답변 목록 조회 + * @param userId + * @return + * @throws Exception + */ + public List selectListMyBbsAnswer(String userId) throws Exception; + + + /** + * Description : 최근게시물 조회 (관리자 메뉴 경로 포함) + * @param bbsNttItemVO + * @return + * @throws Exception + */ + public List selectListRecentBbs(BbsNttItemVO bbsNttItemVO) throws Exception; + + /** + * Description : 팝업 관리에 등록한 공통 및 사이트별 팝업을 조회한다. + * @param BbsNttItemVO + * @return + */ + public List selectMainPopupList(BbsNttItemVO searchVO); +} diff --git a/src/main/java/kccf/main/service/MainSeniorService.java b/src/main/java/kccf/main/service/MainSeniorService.java new file mode 100644 index 0000000..ae980c8 --- /dev/null +++ b/src/main/java/kccf/main/service/MainSeniorService.java @@ -0,0 +1,76 @@ +package kccf.main.service; + +import java.util.List; + +import kccf.act.vo.ActVO; +import kccf.bbs.vo.BbsNttItemVO; +import kccf.bbs.vo.LectureItemVO; + +/** + * @Class : MainSeniorService.java + * @Description : 어르신 메인홈 서비스 + * + * @Modification + * + * 수정일 수정자 수정내용 + * ---------- ------- --------------------------- + * 2023-11-20 KNKIM 최초 생성 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-11-20 + * + */ +public interface MainSeniorService { + + + /** + * @Description : 메인 상단 베너 목록을 조회한다. + * @return + * @throws Exception + */ + public List selectListBanner() throws Exception; + + /** + * @Description : 최종 실버문화페스티벌 안내 정보 + * @return + * @throws Exception + */ + public List selectLastFestivalIntro() throws Exception; + + + /** + * @Description : 일자에 대한 행사, 프로그램 목록 조회 + * @param searchDate null 인 경우, 오늘 이후 중 일정이 있는 오늘과 가까운 일자의 행사 목록 조회 + * @return + * @throws Exception + */ + public List selectListActsByDate(String searchDate) throws Exception; + + /** + * @Description : 최근 공지사항 목록을 조회한다. + * @return + * @throws Exception + */ + public List selectListRecentNotice() throws Exception; + + /** + * @Description : 최근 5건(5년)의 실버문화페스티벌 목록을 조회한다. + * @return + * @throws Exception + */ + public List selectListRecentFestivalInfos() throws Exception; + + + /** + * @Description : 온라인 강좌 목록을 조회한다. + * @return + * @throws Exception + */ + public List selectListOnlineLectures() throws Exception; + + + + public List selectListActInfo() throws Exception; + + +} diff --git a/src/main/java/kccf/main/service/impl/MainKccfServiceImpl.java b/src/main/java/kccf/main/service/impl/MainKccfServiceImpl.java new file mode 100644 index 0000000..bfc4575 --- /dev/null +++ b/src/main/java/kccf/main/service/impl/MainKccfServiceImpl.java @@ -0,0 +1,477 @@ +package kccf.main.service.impl; + +import java.lang.invoke.MethodHandles; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import kccf.bbs.service.BbsNttService; +import kccf.bbs.vo.BbsNttItemVO; +import kccf.env.web.EnvUtil; +import kccf.main.dao.MainKccfDAO; +import kccf.main.service.MainKccfService; +import kccf.main.vo.CurationInfoVO; +import kccf.main.vo.CurationPitemVO; +import kccf.main.vo.CurationGitemVO; +import kccf.util.StrUtil; +import lombok.RequiredArgsConstructor; + +@Service +@RequiredArgsConstructor +public class MainKccfServiceImpl implements MainKccfService { + + private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + private final MainKccfDAO mainKccfDAO; + + private final BbsNttService bbsNttService; + + public List selectListRecentWoorimunhwa() throws Exception { + return mainKccfDAO.selectListRecentWoorimunhwa(); + } + + public String selectCuration() throws Exception { + + String nttId = EnvUtil.getSysEnv("C", "openapi.curation.nttid"); + System.out.println(nttId + " : nttId"); + BbsNttItemVO nttCuration = bbsNttService.selectBbsNttDetail(nttId); + if(nttCuration == null) return null; + + return nttCuration.getCntntsCn(); + } + + public List selectListRecentBbs(BbsNttItemVO bbsNttItemVO) throws Exception { + return mainKccfDAO.selectListRecentBbs(bbsNttItemVO); + } + + public List selectListBanner() throws Exception { + return mainKccfDAO.selectListBanner(); + } + + public List selectListRecentNotice() throws Exception { + return mainKccfDAO.selectListRecentNotice(); + } + + public List selectListRecentBbsLocalNews() throws Exception { + return mainKccfDAO.selectListRecentBbsLocalNews(); + } + + public List selectListRecentBbsEvent() throws Exception { + return mainKccfDAO.selectListRecentBbsEvent(); + } + + public List selectListRecentBbsBiz() throws Exception { + return mainKccfDAO.selectListRecentBbsBiz(); + } + + public CurationInfoVO makeCurationContent() { + + CurationInfoVO curation = null; + + try { + + // 전체에 대한 조회 + curation = getCurationRestApi(null); + if(curation == null) { + curation = new CurationInfoVO(); + curation.setResult("F", "이달의 큐레이션 처리에 실패하였습니다. (결과없음)"); + return curation; + } + + if(!"S".equals(curation.getResultCode())) { + return curation; + } + + curation.setTotCnt(0); + curation.setSucCnt(0); + curation.setErrCnt(0); + + // 분류별 조회 + List gitems = curation.getGitems(); + + int typeListSize = (gitems == null ? 0 : gitems.size()); + if(typeListSize > 0) { + for(int i=0; i 0) { + item.setResult("S", null); + item.setPitems(itemRet.getGitems().get(0).getPitems()); + curation.incSucCnt(); + } else { + item.setResult("W", null); + item.setPitems(null); + curation.incErrCnt(); + } + } else { + item.setResult("F", itemRet.getResultMessage()); + curation.incErrCnt(); + } + } else if("S".equals(item.getResultCode())) { + curation.incSucCnt(); + } else { + curation.incErrCnt(); + } + } + } + } catch(Exception e) { + if(curation == null) curation = new CurationInfoVO(); + curation.setResult("F", "이달의 큐레이션 처리중 오류가 발생하였습니다 : " + e.toString()); + } + + if(curation.getErrCnt() > 0) { + curation.setResultCode("F"); + if(StringUtils.isAllBlank(curation.getResultMessage())) { + curation.setResultMessage("총 " + curation.getTotCnt() + "건 중 " + curation.getErrCnt() + "건에 대한 오류가 존재합니다."); + } + } + + return curation; + } + + private CurationInfoVO getCurationRestApi(String pContentType) throws Exception { + + CurationInfoVO retVO = new CurationInfoVO(); + + // 요청일자 : 현재 + retVO.setPostDay(StrUtil.getTodayYyyymmdd()); + + String contentType = (StringUtils.isAllBlank(pContentType) ? "" : pContentType); + //curation.incTotCnt(); + + // 접속정보 확인 + String url = EnvUtil.getSysEnvIf("C", "openapi.curation.url", ""); + if(StringUtils.isAllBlank(url)) { + retVO.setResult("F", "이달의 큐레이션 연동 API URL 정보를 확인할 수 없습니다."); + LOGGER.error(retVO.getResultMessage()); + return retVO; + } + + String serviceKey = EnvUtil.getSysEnvIf("C", "openapi.curation.serviceKey", ""); + if(StringUtils.isAllBlank(serviceKey)) { + retVO.setResult("F", "이달의 큐레이션 연동 API 서비스키 정보를 확인할 수 없습니다."); + LOGGER.error(retVO.getResultMessage()); + return retVO; + } + + String urlWithParam = url; + if(url.contains("?")) urlWithParam += "&"; + else urlWithParam += "?"; + + urlWithParam += "serviceKey=" + serviceKey; + urlWithParam += "&contentType=" + contentType; + + String responseXml = null; + + //----------------- + // URL 요청 + URL oUrl = new URL(urlWithParam); + HttpURLConnection connection = (HttpURLConnection) oUrl.openConnection(); + int responseCode = connection.getResponseCode(); + + if (responseCode == HttpURLConnection.HTTP_OK) { + // Read the response + StringBuilder response = new StringBuilder(); + try (java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(connection.getInputStream()))) { + String inputLine; + while ((inputLine = in.readLine()) != null) { + response.append(inputLine); + } + } + responseXml = response.toString(); + } else { + retVO.setResult("F", "이달의 큐레이션 조회에 실패하였습니다. : 응답코드 " + responseCode); + return retVO; + } + + //----------------- + // 결과 파싱 + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder builder = factory.newDocumentBuilder(); + Document document = builder.parse(new org.xml.sax.InputSource(new java.io.StringReader(responseXml))); + + //----------------- + // 결과 분석 + + // ROOT : response + Element rootEl = document.getDocumentElement(); + + // 분류코드 목록 생성 + NodeList parts = rootEl.getChildNodes(); + + for(int i=0; i header > resultCode, resultMsg + if(node.getNodeType() == Node.ELEMENT_NODE + && "header".equals(node.getNodeName())) { + + NodeList results = node.getChildNodes(); + for(int r=0; r body > gitems, pitems + else if(node.getNodeType() == Node.ELEMENT_NODE + && "body".equals(node.getNodeName())) { + + NodeList items = node.getChildNodes(); + for(int r=0; r gitemsList = new ArrayList(); + + // 전체 분류 항목 추가 + CurationGitemVO gitemAll = new CurationGitemVO(); + gitemAll.setContentType(""); + gitemAll.setContentCnt(0); + gitemAll.setCodeNm("전체"); + gitemsList.add(gitemAll); + + NodeList list = rNode.getChildNodes(); + for(int s=0; s pitemsList = new ArrayList(); + + NodeList list = rNode.getChildNodes(); + for(int s=0; s gitemsList = retVO.getGitems(); + if(gitemsList == null) { + gitemsList = new ArrayList(); + retVO.setGitems(gitemsList); + } + + if(gitemsList.isEmpty()) { + CurationGitemVO gitem = new CurationGitemVO(); + gitem.setContentType(contentType); + gitemsList.add(gitem); + } + + retVO.getGitems().get(0).setResultCode("S"); + retVO.getGitems().get(0).setPitems(pitemsList); + } + } + } + } + + if("S".equals(retVO.getResultCode())) retVO.setResultMessage("정상적으로 조회되었습니다."); + + return retVO; + } + + public boolean makeCurationHtml(CurationInfoVO curationInfoVO) throws Exception { + + final String serverUrl = EnvUtil.getSysEnvIf("C", "openapi.curation.link.serverUrl", ""); + final String detailUrl = EnvUtil.getSysEnvIf("C", "openapi.curation.link.detailUrl", ""); + final String moreUrl = EnvUtil.getSysEnvIf("C", "openapi.curation.link.listUrl", ""); + + if(StringUtils.isAllBlank(serverUrl)) { + LOGGER.error("이달의큐레이션 HTML 생성 실패 : 링크되는 서버 URL 정보를 확인할 수 없습니다. (openapi.curation.link.serverUrl)"); + return false; + } + if(StringUtils.isAllBlank(detailUrl)) { + LOGGER.error("이달의큐레이션 HTML 생성 실패 : 링크되는 상세페이지 URL 정보를 확인할 수 없습니다. (openapi.curation.link.detailUrl)"); + return false; + } + if(StringUtils.isAllBlank(moreUrl)) { + LOGGER.error("이달의큐레이션 HTML 생성 실패 : 링크되는 더보기 URL 정보를 확인할 수 없습니다. (openapi.curation.link.listUrl)"); + return false; + } + + if(curationInfoVO == null || !"S".equals(curationInfoVO.getResultCode())) return false; + StringBuffer navHtml = new StringBuffer(); + StringBuffer cntHtml = new StringBuffer(); + StringBuffer cntHtmlInit = new StringBuffer(); + StringBuffer html = new StringBuffer(); + + List gitemList = curationInfoVO.getGitems(); + if(gitemList == null || gitemList.isEmpty()) return false; + + int gitemCnt = gitemList.size(); + int dispGitemCnt = 0; + + navHtml.append( + " \n" + + "
    \n" + + "

    이달의 큐레이션

    \n" + + "
    \n"); + + for(int i=0; i pitemList = gitem.getPitems(); + if(pitemList == null || pitemList.isEmpty()) continue; + + dispGitemCnt++; + + // 그룹정보 + navHtml.append("\n"); + + // 그룹별 컨텐츠 내용 + int pitemCnt = pitemList.size(); + for(int j=0; j\n" + + "
      \n" + + "
    • \n" + + " \""\n" + + "
    • \n" + + "
    • \n" + + "
      \n" + + "

      " + pitem.getTitle() + "

      \n" + + "

      \n" + + " " + pitem.getContentCnt() + " 건\n" + + "

      \n" + + "
      \n" + + "
        해당 컨텐츠가 궁금하다면?
      \n" + + "
    • \n" + + "
    \n" + + "
    \n"); + } else { + cntHtml.append( + "
    \n" + + "
      \n" + + "
    • \n" + + " \""\n" + + "
    • \n" + + "
    • \n" + + "
      \n" + + "

      " + pitem.getTitle() + "

      \n" + + "

      \n" + + " " + pitem.getContentCnt() + " 건\n" + + "

      \n" + + "
      \n" + + "
        해당 컨텐츠가 궁금하다면?
      \n" + + "
    • \n" + + "
    \n" + + "
    \n"); + } + } + } + + navHtml.append( + "
    \n" + + " \n" + + " \n"); + + if(dispGitemCnt < 1) return false; + + // HTML 생성 처리 + html.append( + "
    \n" + + "
    \n" + + navHtml.toString() + + " \n" + + "
    \n" + + cntHtmlInit.toString() + + "
    \n" + + " \n" + + "
    \n" + + "
    \n" + + " \n" + + "
    \n" + + "
    \n" + + " \n" + + " \n" + + " \n" + + "
    \n" + + "
    \n" + + " \n" + + "
    \n" + + cntHtml.toString() + + "
    \n" + + "
    \n" + + "
    \n" + + ""); + + // DB 저장 처리 + curationInfoVO.setHtml(html.toString()); + curationInfoVO.setBbsId(EnvUtil.getSysEnv("C", "openapi.curation.bbsid")); + curationInfoVO.setNttId(EnvUtil.getSysEnv("C", "openapi.curation.nttid")); + + int updRet = mainKccfDAO.updateCuration(curationInfoVO); + if(updRet < 1) return false; + + return true; + } + +} diff --git a/src/main/java/kccf/main/service/impl/MainMngServiceImpl.java b/src/main/java/kccf/main/service/impl/MainMngServiceImpl.java new file mode 100644 index 0000000..783970c --- /dev/null +++ b/src/main/java/kccf/main/service/impl/MainMngServiceImpl.java @@ -0,0 +1,47 @@ +package kccf.main.service.impl; + +import java.lang.invoke.MethodHandles; +import java.util.List; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import kccf.bbs.vo.BbsNttItemVO; +import kccf.main.dao.MainMngDAO; +import kccf.main.service.MainMngService; +import lombok.RequiredArgsConstructor; + +@Service +@RequiredArgsConstructor +public class MainMngServiceImpl implements MainMngService { + + + private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + private final MainMngDAO mainMngDAO; + + public List selectListMyBbsAnswer(String userId) throws Exception { + + if(StringUtils.isAllEmpty(userId)) { + LOGGER.error("사용자ID정보가 누락되었습니다."); + return null; + } + + BbsNttItemVO bbsNttItemVO = new BbsNttItemVO(); + bbsNttItemVO.setBbsId("N000000000000000000028"); // 소통의장 + bbsNttItemVO.setRegUserId(userId); // + + return mainMngDAO.selectListMyBbsAnswer(bbsNttItemVO); + } + + public List selectListRecentBbs(BbsNttItemVO bbsNttItemVO) throws Exception { + return mainMngDAO.selectListRecentBbs(bbsNttItemVO); + } + + @Override + public List selectMainPopupList(BbsNttItemVO searchVO) { + return mainMngDAO.selectMainPopupList(searchVO); + } +} diff --git a/src/main/java/kccf/main/service/impl/MainSeniorServiceImpl.java b/src/main/java/kccf/main/service/impl/MainSeniorServiceImpl.java new file mode 100644 index 0000000..62e896e --- /dev/null +++ b/src/main/java/kccf/main/service/impl/MainSeniorServiceImpl.java @@ -0,0 +1,71 @@ +package kccf.main.service.impl; + +import java.lang.invoke.MethodHandles; +import java.util.List; + +import org.apache.commons.lang3.StringUtils; +import org.jsoup.Jsoup; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import kccf.act.vo.ActVO; +import kccf.bbs.service.BbsNttService; +import kccf.bbs.vo.BbsNttItemVO; +import kccf.bbs.vo.LectureItemVO; +import kccf.main.dao.MainSeniorDAO; +import kccf.main.service.MainSeniorService; +import lombok.RequiredArgsConstructor; + +@Service +@RequiredArgsConstructor +public class MainSeniorServiceImpl implements MainSeniorService { + + + private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + private final MainSeniorDAO mainSeniorDAO; + + private final BbsNttService bbsNttService; + + + public List selectListBanner() throws Exception { + return mainSeniorDAO.selectListBanner(); + } + + public List selectLastFestivalIntro() throws Exception { + return mainSeniorDAO.selectLastFestivalIntro(); + } + + public List selectListActsByDate(String searchDate) throws Exception { + return mainSeniorDAO.selectListActsByDate(searchDate); + } + + public List selectListRecentNotice() throws Exception { + List retList = mainSeniorDAO.selectListRecentNotice(); + if(retList == null || retList.isEmpty()) return null; + + // 요약문 없는 경우, 요약문 생성 + for(int i=0; i selectListRecentFestivalInfos() throws Exception { + return mainSeniorDAO.selectListRecentFestivalInfos(); + } + + public List selectListOnlineLectures() throws Exception { + return mainSeniorDAO.selectListOnlineLectures(); + } + + public List selectListActInfo() throws Exception { + return mainSeniorDAO.selectListActInfo(); + } + +} diff --git a/src/main/java/kccf/main/vo/CmmBaseVO.java b/src/main/java/kccf/main/vo/CmmBaseVO.java new file mode 100644 index 0000000..89d5e86 --- /dev/null +++ b/src/main/java/kccf/main/vo/CmmBaseVO.java @@ -0,0 +1,68 @@ +package kccf.main.vo; + +import kccf.util.StrUtil; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Getter +@Setter +@ToString +@NoArgsConstructor +public class CmmBaseVO { + + String selMenuId; /* 요청 메뉴ID */ + String selMenuNm; /* 요청 메뉴명 */ + + String curUserIp; /* 접속IP */ + + String regUserId; /* 등록자ID */ + String regUserNm; /* 등록자명 */ + String regDttm; /* 등록일시 */ + + String updUserId; /* 수정자ID */ + String updUserNm; /* 수정자명 */ + String updDttm; /* 수정일시 */ + + int rn; /* 행번호 */ + int totCnt; /* 총건수 */ + int pageSize; /* 페이지크기 */ + int pageNo; /* 페이지번호 */ + + String empty; /* DataTable 빈컬럼 생성용 */ + + String resultCode; /* 처리결과코드 : S, F, W */ + String resultMessage; /* 처리결과메시지 */ + + public int getPageSize() { + if(pageSize < 1) return 10; + return pageSize; + } + + public int getPageNo() { + if(pageNo < 1) return 1; + return pageNo; + } + + public String getRegDttmFormatted() { + return StrUtil.formatDateStr(regDttm); + } + + public String getUpdDttmFormatted() { + return StrUtil.formatDateStr(updDttm); + } + + public String getRegUserNmIfEmpty() { + return StrUtil.ifEmpty(regUserNm, "-"); + } + + public String getUpdUserNmIfEmpty() { + return StrUtil.ifEmpty(updUserNm, "-"); + } + + public void setResult(String resultCode, String resultMessage) { + this.resultCode = resultCode; + this.resultMessage = resultMessage; + } +} diff --git a/src/main/java/kccf/main/vo/CmmCodeVO.java b/src/main/java/kccf/main/vo/CmmCodeVO.java new file mode 100644 index 0000000..79fcfe7 --- /dev/null +++ b/src/main/java/kccf/main/vo/CmmCodeVO.java @@ -0,0 +1,28 @@ +package kccf.main.vo; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Setter +@Getter +@ToString +@NoArgsConstructor +@AllArgsConstructor + +public class CmmCodeVO extends CmmBaseVO { + + private String code; /* 코드 */ + private String detailCode; /* 상세코드 */ + private String detailCodeNm; /* 상세코드명 */ + private String aditAtrbInfoValue1; /* 추가속성정보값1 */ + private String aditAtrbInfoValue2; /* 추가속성정보값2 */ + private String aditAtrbInfoValue3; /* 추가속성정보값3 */ + private String dcCn; /* 설명내용 */ + private String sortSn; /* 정렬순번 */ + private String indictYn; /* 표시여부 */ + private String useYn; /* 사용여부 */ + +} diff --git a/src/main/java/kccf/main/vo/CurationGitemVO.java b/src/main/java/kccf/main/vo/CurationGitemVO.java new file mode 100644 index 0000000..c96b249 --- /dev/null +++ b/src/main/java/kccf/main/vo/CurationGitemVO.java @@ -0,0 +1,57 @@ +package kccf.main.vo; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang3.StringUtils; + +import kccf.cmm.vo.CmmBaseVO; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +/** + * CurationGitemVO.java + * Description : 큐레이션 분류코드 정보를 담는 VO + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-11-22 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-11-22   KNKIM      최초 생성
    + *  
    + * 
    + */ + +@Getter +@Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class CurationGitemVO extends CmmBaseVO { + + String contentType; /* 큐레이션 유형 */ + String codeNm; /* 큐레이션 유형명 */ + int contentCnt; /* 큐레이션 유형 컨텐츠 건수 */ + + List pitems; /* 큐레이션 컨텐츠 리스트 */ + + public void setContentCnt(int contentCnt) { + this.contentCnt = contentCnt; + } + + public void setContentCnt(String cntStr) { + if(StringUtils.isAllBlank(cntStr)) this.contentCnt = 0; + try { + this.contentCnt = Integer.parseInt(cntStr); + } catch(Exception e) { + this.contentCnt = 0; + } + } +} diff --git a/src/main/java/kccf/main/vo/CurationInfoVO.java b/src/main/java/kccf/main/vo/CurationInfoVO.java new file mode 100644 index 0000000..f758e7d --- /dev/null +++ b/src/main/java/kccf/main/vo/CurationInfoVO.java @@ -0,0 +1,60 @@ +package kccf.main.vo; + +import java.util.ArrayList; +import java.util.List; + +import kccf.cmm.vo.CmmBaseVO; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +/** + * CurationInfoVO.java + * Description : 큐레이션 정보를 담는 VO + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-11-21 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-11-21   KNKIM      최초 생성
    + *  
    + * 
    + */ + +@Getter +@Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class CurationInfoVO extends CmmBaseVO implements Cloneable { + + // API 입력값 + String postDay; /* 검색일자 */ + + // API 출력값 + List gitems; /* 큐레이션 분류 리스트 */ + + // 기타 처리관련 + String curationHtml; /* 큐레이션 메인화면 표시 HTML */ + + int sucCnt = 0; /* 성공건수 */ + int errCnt = 0; /* 오류건수 */ + + String bbsId; /* 큐레이션 게시판ID */ + String nttId; /* 큐레이션 게시물ID */ + String html; /* 큐레이션 메인홈 HTML */ + + public void incSucCnt() { + this.sucCnt++; + } + + public void incErrCnt() { + this.errCnt++; + } +} diff --git a/src/main/java/kccf/main/vo/CurationPitemVO.java b/src/main/java/kccf/main/vo/CurationPitemVO.java new file mode 100644 index 0000000..79bb2c9 --- /dev/null +++ b/src/main/java/kccf/main/vo/CurationPitemVO.java @@ -0,0 +1,49 @@ +package kccf.main.vo; + +import java.util.ArrayList; +import java.util.List; + +import kccf.cmm.vo.CmmBaseVO; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +/** + * CurationGitemVO.java + * Description : 큐레이션 분류코드 정보를 담는 VO + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-11-22 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-11-22   KNKIM      최초 생성
    + *  
    + * 
    + */ + +@Getter +@Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class CurationPitemVO extends CmmBaseVO { + + String id; /* id */ + String title; /* 제목 */ + String summary; /* 요약 */ + String mainImg; /* 메인 이미지 */ + String mainImgOrignlFileNm; /* 메인 이미지 오리지날 파일명 */ + String useAt; /* 사용여부 */ + String beginAt; /* 게시시작일자 */ + String endAt; /* 게시종료일자 */ + String contentType; /* 큐레이션 유형 */ + String tags; /* 태그 */ + String contentCnt; /* 건수 */ + +} diff --git a/src/main/java/kccf/main/vo/DataTablesResponseVO.java b/src/main/java/kccf/main/vo/DataTablesResponseVO.java new file mode 100644 index 0000000..e19b68c --- /dev/null +++ b/src/main/java/kccf/main/vo/DataTablesResponseVO.java @@ -0,0 +1,20 @@ +package kccf.main.vo; + +import java.util.List; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class DataTablesResponseVO { + + private List data; + private int recordsTotal; + private int recordsFiltered; + +} diff --git a/src/main/java/kccf/main/vo/TreeNodeVO.java b/src/main/java/kccf/main/vo/TreeNodeVO.java new file mode 100644 index 0000000..41ec709 --- /dev/null +++ b/src/main/java/kccf/main/vo/TreeNodeVO.java @@ -0,0 +1,48 @@ +package kccf.main.vo; + +import java.util.List; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +/** + * TreeItemVO.java + * Description : Tree 정보를 담는 VO + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-09-26 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-09-26   KNKIM      최초 생성
    + *  
    + * 
    + */ + +@Getter +@Setter +@ToString +@NoArgsConstructor +public class TreeNodeVO { + + String id; /* ID */ + String nm; /* 노느명 */ + String text; /* 노느표출명 */ + String seCode; /* 구분코드 */ + List children; /* 자식노드 */ + + String resultCode; /* 처리결과코드 */ + String resultMessage; /* 처리결과메시지 */ + + public TreeNodeVO(String id, String nm, String text, String seCode) { + this.id = id; + this.nm = nm; + this.text = text; + this.seCode = seCode; + } +} diff --git a/src/main/java/kccf/main/web/JobCurationBatch.java b/src/main/java/kccf/main/web/JobCurationBatch.java new file mode 100644 index 0000000..4d08159 --- /dev/null +++ b/src/main/java/kccf/main/web/JobCurationBatch.java @@ -0,0 +1,59 @@ +package kccf.main.web; + +import java.lang.invoke.MethodHandles; +import java.net.HttpURLConnection; +import java.net.URL; + +import org.apache.commons.lang3.StringUtils; +import org.quartz.Job; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @Class : JobCurationBatch.java + * @Description : 큐레이션 자료 생성 서비스 호출 JOB + * + * @Modification + * + * 수정일 수정자 수정내용 + * ---------- ------- --------------------------- + * 2023-12-12 KNKIM 최초 생성 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-12-12 + * + */ +public class JobCurationBatch implements Job { + + private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + private static final String conSiteUrl = ""; + + public void execute(JobExecutionContext context) throws JobExecutionException { + + LOGGER.info("================================================"); + LOGGER.info("Quration Batch"); + LOGGER.info("================================================"); + + String genUrl = context.getMergedJobDataMap().getString("url"); + LOGGER.info("genUrl : " + genUrl); + + if(StringUtils.isAllBlank(genUrl)) { + LOGGER.error("Failed. Quration Generator's url is required"); + return; + } + + try { + URL url = new URL(genUrl); + HttpURLConnection con = (HttpURLConnection) url.openConnection(); + con.setRequestMethod("GET"); + int respCode = con.getResponseCode(); + LOGGER.info("RESPONSE CODE : " + respCode); + } catch(Exception e) { + LOGGER.error("Failed : " + e.toString()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/kccf/main/web/MainController.java b/src/main/java/kccf/main/web/MainController.java new file mode 100644 index 0000000..4200276 --- /dev/null +++ b/src/main/java/kccf/main/web/MainController.java @@ -0,0 +1,290 @@ +package kccf.main.web; + +import java.lang.invoke.MethodHandles; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.ResponseEntity; +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 kccf.act.vo.ActVO; +import kccf.bbs.vo.BbsNttItemVO; +import kccf.bbs.vo.LectureItemVO; +import kccf.cmm.web.CmmBaseController; +import kccf.code.service.CmmDetailCodeService; +import kccf.code.vo.CmmDetailCodeVO; +import kccf.lcltt.service.LclttService; +import kccf.lcltt.vo.LclttVO; +import kccf.login.vo.UserVO; +import kccf.main.service.MainKccfService; +import kccf.main.service.MainMngService; +import kccf.main.service.MainSeniorService; +import kccf.main.vo.CurationInfoVO; +import lombok.RequiredArgsConstructor; + +/** + * @Class : MainController.java + * @Description : 메인홈 서비스를 위한 컨트롤러 + * + * @Modification + * + * 수정일 수정자 수정내용 + * ---------- ------- --------------------------- + * 2023-09-11 KNKIM 최초 생성 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-09-11 + * + */ + +@Controller +@RequiredArgsConstructor +public class MainController extends CmmBaseController { + + private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + private final MainMngService mainMngService; + private final MainKccfService mainKccfService; + private final MainSeniorService mainSeniorService; + + private final LclttService lclttService; + private final CmmDetailCodeService cmmCodeDetailService; + + @RequestMapping({"/index.do", "/mngMain.do"}) + public String index(HttpServletRequest request, ModelMap model, HttpSession session, + String isPreview, + @ModelAttribute("siteSeCode") String siteSeCode, + @ModelAttribute("previewVO") BbsNttItemVO previewVO) throws Exception { + + //지방문화원 URL 접근 시 + if("L".equals(getSiteSeCode())) { + String fromUrl = request.getServerName(); + String [] arr = fromUrl.split("\\."); + + model.clear(); + + return "redirect: https://" + arr[0] +".kccf.or.kr:444"; + } + + // 관리자인 경우, 로그인 필요 + if("M".equals(getSiteSeCode())) + { + UserVO userVO = (UserVO)session.getAttribute("user"); + + if(userVO == null || StringUtils.isAllBlank(userVO.getUserId())) { + return "redirect:/login.do"; + } + } + + if("M".equalsIgnoreCase(getSiteSeCode())) + { + setMngMainInfo(model); + } + else if("S".equalsIgnoreCase(getSiteSeCode())) + { + setSeniorMainInfo(model); + } + else + { + setKcccfMainInfo(model); + } + + model.addAttribute("isPreview", isPreview); + + return getHostId() + "/main/main"; + } + + /** + * Description : 한국문화원연합회 누리집 메인화면 컨텐츠 조회 + * @param model + */ + private void setKcccfMainInfo(ModelMap model) throws Exception { + + //------------------------ + // 베너정보 조회 + List listBanner = mainKccfService.selectListBanner(); + model.addAttribute("listBanner", listBanner); + + //------------------------ + // 공지사항 조회 + List listNotice = mainKccfService.selectListRecentNotice(); + model.addAttribute("listNotice", listNotice); + + //------------------------ + // 문화원소식행사 조회 + List listLocalNews = mainKccfService.selectListRecentBbsLocalNews(); + model.addAttribute("listLocalNews", listLocalNews); + + //------------------------ + // 신규 게시물 조회 : 행사,소식,보도 등 + List listBbsEvent = mainKccfService.selectListRecentBbsEvent(); + model.addAttribute("listBbsEvent", listBbsEvent); + + //------------------------ + // 신규 게시물 조회 : 공고, 채용 등 + List listBbsBiz = mainKccfService.selectListRecentBbsBiz(); + model.addAttribute("listBbsBiz", listBbsBiz); + + //------------------------ + // 이달의큐레이션 + String curation = mainKccfService.selectCuration(); + model.addAttribute("curation", curation); + + //------------------------ + // 월간우리문화 + List listRecentWoorimunhwa = mainKccfService.selectListRecentWoorimunhwa(); + model.addAttribute("listRecentWoorimunhwa", listRecentWoorimunhwa); + + //------------------------ + // 우리지역 지방문화원 지역코드 + CmmDetailCodeVO searchVO = new CmmDetailCodeVO(); + searchVO.setCode("AREA_CODE"); + searchVO.setIndictYn("Y"); + searchVO.setUseYn("Y"); + List listArea = cmmCodeDetailService.selectListCmmDetailCode(searchVO); + model.addAttribute("listArea", listArea); + + return; + } + + /** + * Description : 어르신 홈페이지(문화로청춘) 메인화면 컨텐츠 조회 + * @param model + */ + private void setSeniorMainInfo(ModelMap model) throws Exception { + + //------------------------ + // 베너정보 조회 + List listBanner = mainSeniorService.selectListBanner(); + model.addAttribute("listBanner", listBanner); + + //------------------------ + // 실버문화 페스티벌 + List festivalIntroList = mainSeniorService.selectLastFestivalIntro(); + model.addAttribute("festivalIntroList", festivalIntroList); + + //------------------------ + // 프로그램행사일정 + List listAct = mainSeniorService.selectListActsByDate(null); // 오늘이후 가까운 미래 일정 조회 + model.addAttribute("listAct", listAct); + + //------------------------ + // 공지사항 조회 + List listNotice = mainSeniorService.selectListRecentNotice(); + model.addAttribute("listNotice", listNotice); + + //------------------------ + // 역대 실버문화 페스티벌 + List listFestival = mainSeniorService.selectListRecentFestivalInfos(); + model.addAttribute("listFestival", listFestival); + + //------------------------ + // 온라인 배움터 + List listLectures = mainSeniorService.selectListOnlineLectures(); + model.addAttribute("listLectures", listLectures); + + return; + } + + /** + * Description : 관리자 홈페이지 메인화면 컨텐츠 조회 + * @param model + */ + public void setMngMainInfo(ModelMap model) throws Exception { + + // 소통의장 + List listMyBbs = mainMngService.selectListMyBbsAnswer(getUserId()); + model.addAttribute("listMyBbs", listMyBbs); + + // 나의문화원 정보 + UserVO user = getSessionUser(); + if(user != null && !StringUtils.isAllBlank(user.getPsitnLclttId())) { + LclttVO lclttVO = new LclttVO(); + lclttVO.setLclttId(user.getPsitnLclttId()); + model.addAttribute("lclttVO", lclttService.selectLclttDetail(lclttVO)); + } + + // 최신컨텐츠 : 게시물 + BbsNttItemVO recentG = new BbsNttItemVO(); + recentG.setTotCnt(3); + recentG.setBbsTyCode("|G|R|E|A|"); + List listRecentG = mainMngService.selectListRecentBbs(recentG); + model.addAttribute("listRecentG", listRecentG); + + // 최신컨텐츠 : 사진 + BbsNttItemVO recentP = new BbsNttItemVO(); + recentP.setTotCnt(2); + recentP.setBbsTyCode("|P|T|"); + //recentP.setBbsTyCode("|G|R|E|A|"); + List listRecentP = mainMngService.selectListRecentBbs(recentP); + model.addAttribute("listRecentP", listRecentP); + + // 최신컨텐츠 : 동영상 + BbsNttItemVO recentM = new BbsNttItemVO(); + recentM.setTotCnt(2); + recentM.setBbsTyCode("|M|"); + List listRecentM = mainMngService.selectListRecentBbs(recentM); + model.addAttribute("listRecentM", listRecentM); + + } + + @RequestMapping({"/curation/makeCurationContentJson.do", "/sec/curation/makeCurationContentJson.do"}) + public String makeCurationContentJson(ModelMap model, String contentType) throws Exception { + + // 큐레이션 연동 요청 및 생성 처리 + CurationInfoVO retVO = mainKccfService.makeCurationContent(); + boolean result = false; + + if(retVO != null && "S".equals(retVO.getResultCode())) { + // 메인화면용 HTML 생성 + String userId = getUserId(); + if(StringUtils.isAllBlank(userId)) { + userId = "BATCH"; + } + retVO.setUpdUserId(userId); + result = mainKccfService.makeCurationHtml(retVO); + } + + model.addAttribute("result", result); + + return "jsonView"; + } + + /** + * Description : 주어진 일자에 해당하는 프로그램 및 행사 일정 목록을 조회한다. + * @param model + * @param contentType + * @return + * @throws Exception + */ + @RequestMapping("/main/listActScheduleJson.do") + public String listActScheduleJson(ModelMap model, String searchDate) throws Exception { + + List listAct = mainSeniorService.selectListActsByDate(searchDate); // 오늘이후 가까운 미래 일정 조회 + model.addAttribute("listAct", listAct); + + return "jsonView"; + } + + /** + * Description : 팝업 관리에 등록한 공통 및 사이트별 팝업을 조회한다. + * @param request + * @return + */ + @RequestMapping("/main/getMainPopup.do") + public ResponseEntity getMainPopup(@RequestBody BbsNttItemVO searchVO){ + + List popupList = mainMngService.selectMainPopupList(searchVO); + + return ResponseEntity.ok(popupList); + } +} \ No newline at end of file diff --git a/src/main/java/kccf/menu/dao/MenuDAO.java b/src/main/java/kccf/menu/dao/MenuDAO.java new file mode 100644 index 0000000..60c5751 --- /dev/null +++ b/src/main/java/kccf/menu/dao/MenuDAO.java @@ -0,0 +1,80 @@ +package kccf.menu.dao; + +import java.util.List; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Repository; + +import kccf.cmm.dao.CmmBaseDAO; +import kccf.menu.vo.MenuContentMapVO; +import kccf.menu.vo.MenuItemVO; + +/** + * @class : MenuDAO.java + * @description : 메뉴관리 DAO + * + * @author 한국문화원연합회 / (주)디지탈쉽 + * @since 2023-09-15 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-09-15   KNKIM      최초 생성
    + *  
    + * 
    + */ +@Repository +public class MenuDAO extends CmmBaseDAO { + + + public int insertMenuItemInfo(MenuItemVO menuItem) throws Exception { + return insert("menuDAO.insertMenuItemInfo", menuItem); + } + + public int updateMenuItemInfo(MenuItemVO menuItem) throws Exception { + return update("menuDAO.updateMenuItemInfo", menuItem); + } + + public int deleteMenuItemInfo(MenuItemVO menuItem) throws Exception { + return delete("menuDAO.deleteMenuItemInfo", menuItem); + } + + + /** + * Description : 사이트별 대메뉴 목록을 조회한다. + * @param siteSeCode 사이트구분코드 + * @return + * @throws Exception + */ + public List selectListMenuInfo(MenuItemVO menuItem) throws Exception { + return selectList("menuDAO.selectListMenuInfo", menuItem); + } + + public MenuItemVO selectMenuDetailInfo(MenuItemVO menuItem) throws Exception { + return selectOne("menuDAO.selectMenuDetailInfo", menuItem); + } + + public MenuItemVO selectSelMenuIdInfo(MenuItemVO menuItem) throws Exception { + return selectOne("menuDAO.selectSelMenuIdInfo", menuItem); + } + + public List selectListAuthMenu(MenuItemVO menuItem) throws Exception { + return selectList("menuDAO.selectListAuthMenu", menuItem); + } + + public int updateAuthMenu(MenuItemVO authMenu) throws Exception { + if(authMenu == null) return -1; + if(StringUtils.isAllBlank(authMenu.getMenuId())) return 0; + else if(StringUtils.isAllBlank(authMenu.getAuthCode())) return 0; + else if(StringUtils.isAllBlank(authMenu.getUpdUserId())) return 0; + + return update("menuDAO.updateAuthMenu", authMenu); + } + + public List selectListMenuContentMap(MenuContentMapVO menuContentMapVO) throws Exception { + return selectList("menuDAO.selectListMenuContentMap", menuContentMapVO); + } + +} diff --git a/src/main/java/kccf/menu/service/MenuService.java b/src/main/java/kccf/menu/service/MenuService.java new file mode 100644 index 0000000..702edaf --- /dev/null +++ b/src/main/java/kccf/menu/service/MenuService.java @@ -0,0 +1,58 @@ +package kccf.menu.service; + +import java.util.List; + +import kccf.cmm.vo.TreeNodeVO; +import kccf.menu.vo.MenuContentMapVO; +import kccf.menu.vo.MenuItemVO; + +/** + * MenuService.java + * Description : 메뉴관리 서비스 인터페이스 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-09-18 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-09-18   KNKIM      최초 생성
    + *  
    + * 
    + */ +public interface MenuService { + + public String getMenuHtml(String siteSeCode, boolean isForMobile) throws Exception; + + public void generateMenuHtml(String siteSeCode, boolean isForMobile) throws Exception; + + public MenuItemVO insertMenuItemInfo(MenuItemVO menuItem) throws Exception; + + public MenuItemVO updateMenuItemInfo(MenuItemVO menuItem) throws Exception; + + public MenuItemVO deleteMenuItemInfo(MenuItemVO menuItem) throws Exception; + + + public List selectDispMenuList(String siteSeCode) throws Exception; + + public MenuItemVO selectDispMenuTree(MenuItemVO menuItem) throws Exception; + + public MenuItemVO selectMenuTree(MenuItemVO menuItem) throws Exception; + + public MenuItemVO selectSelMenuIdInfo(MenuItemVO menuItem) throws Exception; + + public MenuItemVO getSelMenuItemInfo(MenuItemVO menuTree) throws Exception; + + public MenuItemVO selectMenuDetailInfo(MenuItemVO menuItem) throws Exception; + + public TreeNodeVO selectMenuTreeOfTreeNode(MenuItemVO menuItem) throws Exception; + + public List selectListAuthMenu(MenuItemVO menuItem) throws Exception; + + public MenuItemVO updateAuthMenu(MenuItemVO menuItem) throws Exception; + + public List selectListMenuContentMap(MenuContentMapVO menuContentMapVO) throws Exception; + +} diff --git a/src/main/java/kccf/menu/service/impl/MenuServiceImpl.java b/src/main/java/kccf/menu/service/impl/MenuServiceImpl.java new file mode 100644 index 0000000..2b8ebf3 --- /dev/null +++ b/src/main/java/kccf/menu/service/impl/MenuServiceImpl.java @@ -0,0 +1,599 @@ +package kccf.menu.service.impl; + +import java.lang.invoke.MethodHandles; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import kccf.cmm.vo.TreeNodeVO; +import kccf.menu.dao.MenuDAO; +import kccf.menu.service.MenuService; +import kccf.menu.vo.MenuContentMapVO; +import kccf.menu.vo.MenuItemVO; +import kccf.util.StrUtil; +import kccf.util.WebUtil; +import lombok.RequiredArgsConstructor; + +/** + * MenuServiceImpl.java + * Description : 메뉴관리 서비스 구현 클래스 + * + * @author 한국문화원연합회 / 디지탈쉽 + * @since 2023-09-18 + * + *
    + * 변경이력(Modification Information)
    + *   
    + * 수정일         수정자       수정내용
    + * ----------   -------    ---------------------------
    + * 2023-09-18   KNKIM      최초 생성
    + *  
    + * 
    + */ + +@Service +@RequiredArgsConstructor +public class MenuServiceImpl implements MenuService { + + private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + private final MenuDAO menuDAO; + + private static Map MENU_HTML = new HashMap(); + + private String removeEmpMenuNmText(String name) { + if(StringUtils.isAllBlank(name)) return name; + + if(name.indexOf("[") > -1) { + return name.replace("[", "").replace("]", ""); + } + + return name; + } + + private void generateMenuChildrenHtml(StringBuffer sb, StringBuffer eventSb, List menuChildren, int menuLvl, boolean isForMobile) { + + if(menuChildren == null || menuChildren.size() < 1) return; + + // LI 메뉴 목록 출력 + for(int i=0, len=menuChildren.size(); i"); + sb.append(""); + + if(menuLvl > 1) sb.append(""); + sb.append(menuNm); + if(menuLvl > 1) sb.append(""); + if(isForMobile && menuLvl == 1) { + sb.append("+"); + sb.append(""); + } + sb.append(""); + + // 클릭 이벤트 + MenuItemVO clickInfo = getClickMenuInfo(item); + if(clickInfo == null) { + eventSb.append("$('#" + linkId + "').on('click', function() { return false; });\n"); + } else if(!isForMobile || (isForMobile && item.sizeOfSubMenu() < 1)) { + String menuLink = StrUtil.ifEmpty(clickInfo.getLinkUrl(), ""); + if(!StringUtils.isAllBlank(clickInfo.getCntntsSeCode())) { + if("KF_BBS_NTT".equals(clickInfo.getCntntsSeCode())) { + menuLink = WebUtil.addParamToUrl(menuLink, "bbsId", clickInfo.getCntntsGroupId()); + menuLink = WebUtil.addParamToUrl(menuLink, "nttId", clickInfo.getCntntsId()); + } else { + menuLink = WebUtil.addParamToUrl(menuLink, "cntntsGroupId", clickInfo.getCntntsGroupId()); + menuLink = WebUtil.addParamToUrl(menuLink, "cntntsId" , clickInfo.getCntntsId()); + } + } + eventSb.append("$('#" + linkId + "').on('click', function() { gfnGotoMenu('" + clickInfo.getMenuId() + "', null, '" + menuLink + "', null, null, null, " + + ("N".equals(item.getLinkMthdCode()) ? "true" : "false") + "); }); \n"); + } + + // 하위 메뉴 존재시 + if(item.sizeOfSubMenu() > 0) { + if(menuLvl == 1) { // 하위 2단계 메뉴 + sb.append((!isForMobile ? "
    " : "") + "
      "); + } else if(menuLvl == 2) { // 하위 3단계 메뉴 + sb.append("
        "); + } + + generateMenuChildrenHtml(sb, eventSb, item.getSubMenuList(), menuLvl+1, isForMobile); + + if(menuLvl == 1) { // 하위 2단계 메뉴 + sb.append("
      " + (!isForMobile ? "
      " : "")); + } else if(menuLvl == 2) { // 하위 3단계 메뉴 + sb.append("
    "); + } + } + + sb.append(""); + } + + } + + private MenuItemVO getClickMenuInfo(MenuItemVO menuItem) { + if(menuItem == null) return null; + if(menuItem.sizeOfSubMenu() > 0) { + return getClickMenuInfo(menuItem.getSubMenu(0)); + } + + return menuItem; + } + + @Override + public void generateMenuHtml(String siteSeCode, boolean isForMobile) throws Exception { + + if(StringUtils.isAllBlank(siteSeCode)) return; + + MenuItemVO paramMenuItem = new MenuItemVO(); + paramMenuItem.setSiteSeCode(siteSeCode); + paramMenuItem.setPurposeType("M"); // 메뉴표시용 + + MenuItemVO dispMenuTree = selectDispMenuTree(paramMenuItem); + List menuChildren = (dispMenuTree == null) ? null : dispMenuTree.getSubMenuList(); + if(menuChildren != null && menuChildren.size() > 0) { + StringBuffer gnbSb = new StringBuffer(); // 메뉴 + StringBuffer gnbEventSb = new StringBuffer(); // 메뉴 클릭 이벤트 + + // UL 메뉴 여는 시작 태그 + if(!isForMobile) gnbSb.append("