프로젝트 생성

cks
강석 최 2023-10-12 13:15:42 +09:00
commit ad715837c2
296 changed files with 63848 additions and 0 deletions

View File

@ -0,0 +1,45 @@
# Compiled class file
*.class
.github/
# files
files/
# Log file
*.log
# DB files
DATABASE/
# DB files
Docs/
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# Setting Files #
.idea/
.settings/
.project
.classpath
.git/
.svn/
# Build #
target/
# OS
.DS_Store
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

View File

@ -0,0 +1,214 @@
<?xml version="1.0" encoding="UTF-8"?>
<pmd>
<useProjectRuleSet>false</useProjectRuleSet>
<ruleSetFile>.ruleset</ruleSetFile>
<rules>
<rule>
<name>WhileLoopsMustUseBraces</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>UnnecessaryParentheses</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>EmptyCatchBlock</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>EmptyIfStmt</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>EmptyWhileStmt</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>EmptyTryBlock</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>EmptyFinallyBlock</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>EmptyStatementNotInLoop</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>UnnecessaryConversionTemporary</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>AssignmentInOperand</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>UnnecessaryParentheses</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>VariableNamingConventions</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>MisleadingVariableName</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>SimplifyBooleanExpressions</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>SwitchStmtsShouldHaveDefault</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>AvoidReassigningParameters</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>FinalFieldCouldBeStatic</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>EqualsNull</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>SimpleDateFormatNeedsLocale</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>ImmutableField</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>AssignmentToNonFinalStatic</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>AvoidSynchronizedAtMethodLevel</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>AbstractClassWithoutAbstractMethod</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>UncommentedEmptyMethod</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>AvoidConstantsInterface</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>AvoidThrowingRawExceptionTypes</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>AvoidThrowingNullPointerException</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>EmptyCatchBlock</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>EmptyIfStmt</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>EmptyWhileStmt</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>EmptyTryBlock</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>EmptyFinallyBlock</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>EmptyStatementNotInLoop</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>WhileLoopsMustUseBraces</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>AvoidArrayLoops</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>UnnecessaryWrapperObjectCreation</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>DuplicateImports</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>ImportFromSamePackage</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>AvoidReassigningParameters</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>EmptyIfStmt</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>UnnecessaryConversionTemporary</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>AssignmentInOperand</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>StringInstantiation</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>StringToString</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>InefficientStringBuffering</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>InefficientEmptyStringCheck</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>UselessStringValueOf</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>SystemPrintln</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>UnusedPrivateField</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>UnusedPrivateMethod</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
<rule>
<name>UnusedFormalParameter</name>
<ruleset>pmd-eclipse</ruleset>
</rule>
</rules>
<includeDerivedFiles>false</includeDerivedFiles>
<violationsAsErrors>true</violationsAsErrors>
<fullBuildEnabled>true</fullBuildEnabled>
</pmd>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<beansProjectDescription>
<version>1</version>
<pluginVersion><![CDATA[3.5.1.201404300732-RELEASE]]></pluginVersion>
<configSuffixes>
<configSuffix><![CDATA[xml]]></configSuffix>
</configSuffixes>
<enableImports><![CDATA[false]]></enableImports>
<configs>
</configs>
<autoconfigs>
<config>src/main/resources/egovframework/spring/com/context-validator.xml</config>
<config>src/main/resources/egovframework/spring/com/context-transaction.xml</config>
<config>src/main/resources/egovframework/spring/com/context-aspect.xml</config>
<config>src/main/resources/egovframework/spring/com/context-common.xml</config>
<config>src/main/webapp/WEB-INF/config/egovframework/springmvc/egov-com-servlet.xml</config>
<config>src/main/resources/egovframework/spring/com/context-idgen.xml</config>
<config>src/main/resources/egovframework/spring/com/context-datasource.xml</config>
<config>src/main/resources/egovframework/spring/com/context-sqlMap.xml</config>
<config>src/main/resources/egovframework/spring/com/context-properties.xml</config>
</autoconfigs>
<configSets>
</configSets>
</beansProjectDescription>

View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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.

View File

@ -0,0 +1,60 @@
# 표준프레임워크 심플홈페이지 BackEnd
![java](https://img.shields.io/badge/java-007396?style=for-the-badge&logo=JAVA&logoColor=white)
![Spring_boot](https://img.shields.io/badge/Spring_Boot-F2F4F9?style=for-the-badge&logo=spring-boot)
![maven](https://img.shields.io/badge/Maven-C71A36?style=for-the-badge&logo=apache-maven&logoColor=white)
![swagger](https://img.shields.io/badge/swagger-85EA2D?style=for-the-badge&logo=swagger&logoColor=black)
![workflow](https://github.com/eGovFramework/egovframe-template-simple-backend/actions/workflows/maven.yml/badge.svg)
※ 본 프로젝트는 기존 JSP 뷰 방식에서 벗어나 BackEnd와 FrontEnd를 분리하기 위한 예시 파일로 참고만 하시길 바랍니다.
## 환경 설정
프로젝트에서 사용된 환경 프로그램 정보는 다음과 같다.
| 프로그램 명 | 버전 명 |
| :--------- | :------ |
| java | 1.8 이상 |
| maven | 3.8.4 |
## BackEnd 구동
### CLI 구동 방법
```bash
mvn spring-boot:run
```
### IDE 구동 방법
개발환경에서 프로젝트 우클릭 > Run As > Spring Boot App을 통해 구동한다.
### 구동 후 확인
구동 후, 브라우저에서 `http://localhost:포트번호/` 로 확인이 가능하다.
초기 포트번호는 8080이며 `/src/main/resources/application.properties` 파일의 `server.port` 항목에서 변경 가능하다.
또한, `http://localhost:포트번호/swagger-ui/index.html#/` 로 애플리케이션의 엔드포인트를 확인 가능하다.
## FrontEnd 구동 (React)
현재 FrontEnd는 React 관련 예제로 구성되어 있다.
[심플홈페이지FrontEnd](https://github.com/eGovFramework/egovframe-template-simple-react.git) 소스를 받아 구동한다.
## 변경 사항
### 1. [Java Config 변환](./Docs/java-config-convert.md)
#### 1) Web.xml -> WebApplicationInitializer 구현체로 변환
#### 2) context-\*.xml -> @Configuration 변환
#### 3) properties 변환(예정) boot 지원
### 2. API 변환
직접 View와 연결하던 방법에서 API 형식으로 변환 -> 다양한 프론트에서 적용 가능 하도록 예제 제공\
※ API를 사용한 Controller들은 ~ApiController.java에서 확인 가능합니다.
## Jar 실행시
```bash
java -jar <jar> --spring.profiles.active=<profile>
```

View File

@ -0,0 +1,519 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.egovframe.template</groupId>
<artifactId>simpleHomePage</artifactId>
<packaging>jar</packaging>
<version>1.0.0</version>
<name>egovframework</name>
<url>example.egovframework.com</url>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<properties>
<spring.maven.artifact.version>5.3.20</spring.maven.artifact.version>
<org.egovframe.rte.version>4.1.0</org.egovframe.rte.version>
<logback.version>1.2.11</logback.version>
</properties>
<repositories>
<repository>
<id>mvn2s</id>
<url>https://repo1.maven.org/maven2/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>egovframe2</id>
<url>https://maven.egovframe.go.kr/maven/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<!-- spring Boot Parent 설정 -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.0</version>
</parent>
<dependencies>
<!-- spring boot dependency start -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>9.0.73</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-el</artifactId>
<version>9.0.73</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<version>9.0.73</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-websocket</artifactId>
<version>9.0.73</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-annotations-api</artifactId>
<version>9.0.73</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<!-- war 배포 시 해당 주석 제거
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
-->
<!-- spring boot dependency end -->
<!-- swagger -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.egovframe.rte</groupId>
<artifactId>org.egovframe.rte.ptl.mvc</artifactId>
<version>${org.egovframe.rte.version}</version>
</dependency>
<dependency>
<groupId>org.egovframe.rte</groupId>
<artifactId>org.egovframe.rte.psl.dataaccess</artifactId>
<version>${org.egovframe.rte.version}</version>
</dependency>
<dependency>
<groupId>org.egovframe.rte</groupId>
<artifactId>org.egovframe.rte.fdl.idgnr</artifactId>
<version>${org.egovframe.rte.version}</version>
</dependency>
<dependency>
<groupId>org.egovframe.rte</groupId>
<artifactId>org.egovframe.rte.fdl.property</artifactId>
<version>${org.egovframe.rte.version}</version>
</dependency>
<dependency>
<groupId>org.egovframe.rte</groupId>
<artifactId>org.egovframe.rte.fdl.string</artifactId>
<version>${org.egovframe.rte.version}</version>
</dependency>
<dependency>
<groupId>org.egovframe.rte</groupId>
<artifactId>org.egovframe.rte.fdl.crypto</artifactId>
<version>${org.egovframe.rte.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>org.springmodules</groupId>
<artifactId>spring-modules-validation</artifactId>
<version>0.8</version>
</dependency>
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-impl</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr</artifactId>
<version>3.5</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.21</version>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.6.0</version>
</dependency>
<!-- validator -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>7.0.4.Final</version>
</dependency>
<!-- log4jdbc driver -->
<dependency>
<groupId>com.googlecode.log4jdbc</groupId>
<artifactId>log4jdbc</artifactId>
<version>1.2</version>
<exclusions>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<!-- JWT 2022.07.27 -->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
</dependency>
<!--
취약점 점검 조치중 2021.12.17
-->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
<version>71.1</version>
</dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
<directory>${basedir}/target</directory>
<finalName>sht_webapp</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<port>80</port>
<path>/</path>
<systemProperties>
<JAVA_OPTS>-Xms256m -Xmx768m -XX:MaxPermSize=256m</JAVA_OPTS>
</systemProperties>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<maxmem>1024m</maxmem>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>3.0</version>
<configuration>
<components>
<component>
<name>hbm2ddl</name>
<implementation>annotationconfiguration</implementation>
</component>
</components>
</configuration>
<dependencies>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.5.0</version>
</dependency>
</dependencies>
</plugin>
<!-- EMMA -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>emma-maven-plugin</artifactId>
<version>1.0-alpha-3</version>
</plugin>
<!-- PMD manven plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.17.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.1.3</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
<processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
</configuration>
</execution>
<execution>
<id>generate-test-entities</id>
<phase>generate-test-sources</phase>
<goals>
<goal>test-process</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/generated-test-sources</outputDirectory>
<processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
<options>
<querydsl.generatedAnnotationClass>javax.annotation.Generated</querydsl.generatedAnnotationClass>
</options>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>4.4.0</version>
</dependency>
</dependencies>
</plugin>
<!-- EMMA -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
<forkMode>once</forkMode>
<reportFormat>xml</reportFormat>
<excludes>
<exclude>**/Abstract*.java</exclude>
<exclude>**/*Suite.java</exclude>
</excludes>
<includes>
<include>**/*Test.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>emma-maven-plugin</artifactId>
<inherited>true</inherited>
</plugin>
<!-- JavaDoc -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
<!-- spring-boot-maven-plugin -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<outputDirectory>${basedir}/target/site</outputDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.3.0</version>
<reportSets>
<reportSet>
<id>sunlink</id>
<reports>
<report>javadoc</report>
</reports>
<inherited>true</inherited>
<configuration>
<links>
<link>https://docs.oracle.com/javase/8/docs/api/</link>
</links>
</configuration>
</reportSet>
</reportSets>
</plugin>
<!-- JUnit Test Results & EMMA Coverage Reporting -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>emma-maven-plugin</artifactId>
<inherited>true</inherited>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>surefire-report-maven-plugin</artifactId>
<inherited>true</inherited>
<reportSets>
<reportSet>
<reports>
<report>report-only</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<!-- Generating JavaDoc Report -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<minmemory>128m</minmemory>
<maxmemory>512m</maxmemory>
<encoding>${encoding}</encoding>
<docencoding>${encoding}</docencoding>
<charset>${encoding}</charset>
</configuration>
</plugin>
<!-- Generating Java Source in HTML -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<configuration>
<inputEncoding>${encoding}</inputEncoding>
<outputEncoding>${encoding}</outputEncoding>
<linkJavadoc>true</linkJavadoc>
<javadocDir>apidocs</javadocDir>
</configuration>
</plugin>
</plugins>
</reporting>
</project>

View File

@ -0,0 +1,48 @@
package egovframework;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.Import;
import egovframework.com.config.EgovWebApplicationInitializer;
import lombok.extern.slf4j.Slf4j;
/**
*
* @author :
* @since : 2023. 8. 9.
* @version : 1.0
*
* @package : egovframework
* @filename : EgovBootApplication.java
* @modificationInformation
*
* <pre>
* << (Modification Information) >>
*
*
* ---------- ---------- ----------------------
* 2023. 8. 9.
* </pre>
*
*
*/
@Slf4j
@ServletComponentScan
@SpringBootApplication
@Import({EgovWebApplicationInitializer.class})
public class EgovBootApplication {
public static void main(String[] args) {
log.debug("##### EgovBootApplication Start #####");
SpringApplication springApplication = new SpringApplication(EgovBootApplication.class);
springApplication.setBannerMode(Banner.Mode.OFF);
// springApplication.setLogStartupInfo(false);
springApplication.run(args);
log.debug("##### EgovBootApplication End #####");
}
}

View File

@ -0,0 +1,124 @@
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.egovframe.rte.psl.orm.ibatis.support.AbstractLobTypeHandler;
import org.springframework.jdbc.support.lob.LobCreator;
import org.springframework.jdbc.support.lob.LobHandler;
import lombok.extern.slf4j.Slf4j;
/**
* iBATIS TypeHandler implementation for Strings that get mapped to CLOBs.
* Retrieves the LobHandler to use from SqlMapClientFactoryBean at config time.
*
* <p>Particularly useful for storing Strings with more than 4000 characters in an
* Oracle database (only possible via CLOBs), in combination with OracleLobHandler.
*
* <p>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
*
* @version : 1.0
* @modificationInformation
*
* <pre>
* << (Modification Information) >>
*
*
* ---------- ---------- ----------------------
*
* </pre>
*/
@Slf4j
@SuppressWarnings("deprecation")
public class AltibaseClobStringTypeHandler extends AbstractLobTypeHandler {
/**
* 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);
}
@Override
protected void setParameterInternal(
PreparedStatement ps, int index, Object value, String jdbcType, LobCreator lobCreator)
throws SQLException {
lobCreator.setClobAsString(ps, index, (String) value);
}
@Override
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) {
log.debug("ie: {}", ie);//SQLException sqle = new SQLException(ie.getMessage());
//throw sqle;
// 2011.10.10 보안점검 후속조치
} finally {
try {
rd.close();
} catch (IOException ignore) {
log.debug("IGNORE: {}", ignore.getMessage());
}
}
return read_data.toString();
//return lobHandler.getClobAsString(rs, index);
}
@Override
public Object valueOf(String s) {
return s;
}
}

View File

@ -0,0 +1,60 @@
package egovframework.com.cmm;
import java.io.Serializable;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
/**
*
* @author
* @since 2009.06.01
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.3.11
*
* </pre>
*/
@Getter
@Setter
public class ComDefaultCodeVO implements Serializable {
/**
* serialVersion UID
*/
private static final long serialVersionUID = -2020648489890016404L;
/** 코드 ID */
private String codeId = "";
/** 상세코드 */
private String code = "";
/** 코드명 */
private String codeNm = "";
/** 코드설명 */
private String codeDc = "";
/** 특정테이블명 */
private String tableNm = ""; //특정테이블에서 코드정보를추출시 사용
/** 상세 조건 여부 */
private String haveDetailCondition = "N";
/** 상세 조건 */
private String detailCondition = "";
/**
* toString .
*/
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
}

View File

@ -0,0 +1,68 @@
package egovframework.com.cmm;
import java.io.Serializable;
import lombok.Getter;
import lombok.Setter;
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
*
*/
@Getter
@Setter
public class ComDefaultVO implements Serializable {
private static final long serialVersionUID = 1L;
/** 검색조건 */
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 String toString() {
return ToStringBuilder.reflectionToString(this);
}
}

View File

@ -0,0 +1,416 @@
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;
/**
* Cross-Site Scripting JSP TLD,
*
* @author
* @since 2010.11.09
* @version 1.0
* @see <pre>
* &lt;&lt; (Modification Information) &gt;&gt;
*
*
* ------- -------- ---------------------------
* 2010.11.09
*
* </pre>
*/
public class EgovComCrossSiteHndlr extends BodyTagSupport {
public static final int HIGHEST_SPECIAL = '>';
public static char[][] specialCharactersRepresentation = new char[HIGHEST_SPECIAL + 1][];
static {
specialCharactersRepresentation['&'] = "&amp;".toCharArray();
specialCharactersRepresentation['<'] = "&lt;".toCharArray();
specialCharactersRepresentation['>'] = "&gt;".toCharArray();
specialCharactersRepresentation['"'] = "&#034;".toCharArray();
specialCharactersRepresentation['\''] = "&#039;".toCharArray();
}
/*
* (One almost wishes XML and JSP could support "anonymous tags," given the
* amount of trouble we had naming this one!) :-) - sb
*/
// *********************************************************************
// Internal state
private static final long serialVersionUID = -6750233818675360686L;
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 String m_sDiffChar ="()[]{}\"',:;= \t\r\n%!+-";
//private String m_sDiffChar ="()[]{}\"',:;=%!+-";
private String m_sArrDiffChar [] = {
"&#40;","&#41;",
"&#91;","&#93;",
"&#123;","&#125;",
"&#34;","&#39;",
"&#44;","&#58;",
"&#59;","&#61;",
" ","\t", //" ","\t",
"\r","\n", //"\r","\n",
"&#37;","&#33;",
"&#43;","&#45;"
};
/**
* 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)
@Override
public void release() {
super.release();
init();
}
// *********************************************************************
// Tag logic
// evaluates 'value' and determines if the body should be evaluted
@Override
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();
//log.debug("EgovComCrossSiteFilter> ============================");
try {
// print value if available; otherwise, try 'default'
if (value != null) {
//log.debug("EgovComCrossSiteFilter> =value");
String sWriteEscapedXml = getWriteEscapedXml();
//log.debug("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;
}
//log.debug("EgovComCrossSiteFilter def> ="+def);
// if we do have 'default', print it
else {
// good 'default'
out(pageContext, escapeXml, def);
//log.debug("EgovComCrossSiteFilter> ="+def);
}
return SKIP_BODY;
}
} catch (IOException ex) {
throw new JspException(ex.toString(), ex);
}
}
// prints the body if necessary; reports errors
@Override
public int doEndTag() throws JspException {
try {
//log.debug("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());
//log.debug("EgovComCrossSiteFilter> end");
//log.debug("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 <tt>text</tt> to <tt>pageContext</tt>'s current JspWriter. If
* <tt>escapeXml</tt> is true, performs the following substring replacements
* (to facilitate output to XML/HTML pages):
*
* & -> &amp; < -> &lt; > -> &gt; " -> &#034; ' -> &#039;
*
* 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 <= HIGHEST_SPECIAL) {
char[] escaped = 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 <= HIGHEST_SPECIAL) {
char[] escaped = specialCharactersRepresentation[c];
if (escaped != null) {
// add unescaped portion
//if (start < i) {
// sRtn = sRtn + text.substring(start, i - start);
//}
// add escaped xml
//sRtn = sRtn + escaped;
//log.debug(buffer[i]+" :: " + escaped);
for (int j = 0; j < escaped.length; j++) {
//log.debug(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 <= HIGHEST_SPECIAL) {
char[] escaped = specialCharactersRepresentation[c];
if (escaped != null) {
// add unescaped portion
//if (start < i) {
// sRtn = sRtn + text.substring(start, i - start);
//}
// add escaped xml
//sRtn = sRtn + escaped;
//log.debug(buffer[i]+" :: " + escaped);
for (int j = 0; j < escaped.length; j++) {
//log.debug(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;
}
/*
public static void main(String[] args) throws IOException
{
EgovComCrossSiteHndlr egovComCrossSiteHndlr = new EgovComCrossSiteHndlr();
egovComCrossSiteHndlr.value = "TRNSMIT";
String sCrossSiteHndlr = egovComCrossSiteHndlr.getWriteEscapedXml();
//log.debug("writeEscapedXml " + egovComCrossSiteHndlr.getWriteEscapedXml());
log.debug("sCrossSiteHndlr|"+ sCrossSiteHndlr + "|");
try{
log.debug("TRY TEST 1");
throw new Exception();
}catch(Exception e){
log.debug("TRY TEST 2");
}finally{
log.debug("TRY TEST 3");
}
}
*/
}

View File

@ -0,0 +1,32 @@
package egovframework.com.cmm;
import org.egovframe.rte.fdl.cmmn.exception.handler.ExceptionHandler;
import lombok.extern.slf4j.Slf4j;
/**
* @Class Name : EgovComExcepHndlr.java
* @Description : exception
* @Modification Information
*
*
* ------- ------- -------------------
* 2009. 3. 13.
*
* @author
* @since 2009. 3. 13.
* @version
* @see
*
*/
@Slf4j
public class EgovComExcepHndlr implements ExceptionHandler {
/**
* Exception .
*/
public void occur(Exception ex, String packageName) {
log.debug("[HANDLER][PACKAGE]::: {}", packageName);
log.debug("[HANDLER][Exception]:::", ex);
}
}

View File

@ -0,0 +1,35 @@
package egovframework.com.cmm;
import org.egovframe.rte.fdl.cmmn.exception.handler.ExceptionHandler;
import lombok.extern.slf4j.Slf4j;
/**
*
* @author :
* @since : 2023. 8. 9.
* @version : 1.0
*
* @package : egovframework.com.cmm
* @filename : EgovComOthersExcepHndlr.java
* @modificationInformation
*
* <pre>
* << (Modification Information) >>
*
*
* ---------- ---------- ----------------------
* 2023. 8. 9. 2023. 8. 9.
* </pre>
*
*
*/
@Slf4j
public class EgovComOthersExcepHndlr implements ExceptionHandler {
public void occur(Exception exception, String packageName) {
//log.debug(" EgovServiceExceptionHandler run...............");
log.error(packageName, exception);
}
}

View File

@ -0,0 +1,32 @@
package egovframework.com.cmm;
import org.egovframe.rte.fdl.cmmn.trace.handler.TraceHandler;
import lombok.extern.slf4j.Slf4j;
/**
* @Class Name : EgovComTraceHandler.java
* @Description : trace
* @Modification Information
*
*
* ------- ------- -------------------
* 2011. 09. 30. JJY
*
* @author JJY
* @since 2011. 9. 30.
*
*/
@Slf4j
public class EgovComTraceHandler implements TraceHandler {
/**
* .
*/
public void todo(Class<?> clazz, String message) {
//log.debug("log ==> DefaultTraceHandler run...............");
log.debug("[TRACE]CLASS::: {}", clazz.getName());
log.debug("[TRACE]MESSAGE::: {}", message);
//이곳에서 후속처리로 필요한 액션을 취할 수 있다.
}
}

View File

@ -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;
import org.springframework.util.ObjectUtils;
/**
* EgovComUtil
*
* @author
* @since 2011.09.15
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- ------------- ----------------------
* 2011.09.15
* </pre>
*/
@Service("egovUtil")
public class EgovComponentChecker extends EgovAbstractServiceImpl implements ApplicationContextAware{
public static ApplicationContext context;
@Override
@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);
// Fix: Null pointers should not be dereferenced 이슈 수정
if(ObjectUtils.isEmpty(component)){
return false;
}else{
return true;
}
}catch(NoSuchBeanDefinitionException ex){// 해당 컴포넌트를 찾을 수없을 경우 false반환
return false;
}
}
}

View File

@ -0,0 +1,64 @@
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
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.03.11
*
* </pre>
*/
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;
}
/**
* Default Locale
* @param code -
* @return String
*/
public String getMessage(String code) {
return this.getMessage(code, Locale.getDefault());
}
/**
*
* @param code -
* @param locale - locale
* @return String
*/
public String getMessage(String code, Locale locale) {
return getReloadableResourceBundleMessageSource().getMessage(code, null, locale);
}
}

View File

@ -0,0 +1,135 @@
package egovframework.com.cmm;
import egovframework.com.cmm.service.ResultVO;
import java.util.regex.Pattern;
/**
* ( )
*
* <pre>
* << (Modification Information) >>
*
*
* ----------- -------- ---------------------------
* 2011.10.10
* 2017-02-07 (ES) - [CWE-22, CWE-23, CWE-95, CWE-99]
* 2018.08.17 filePathBlackList
* 2018.10.10 . => \\.
* </pre>
*/
public class EgovWebUtil {
public static ResultVO handleAuthError(int code, String msg) {
ResultVO resultVO = new ResultVO();
resultVO.setResultCode(code);
resultVO.setResultMessage(msg);
return resultVO;
}
public static String clearXSSMinimum(String value) {
if (value == null || value.trim().equals("")) {
return "";
}
String returnValue = value;
returnValue = returnValue.replaceAll("&", "&amp;");
returnValue = returnValue.replaceAll("<", "&lt;");
returnValue = returnValue.replaceAll(">", "&gt;");
returnValue = returnValue.replaceAll("\"", "&#34;");
returnValue = returnValue.replaceAll("\'", "&#39;");
returnValue = returnValue.replaceAll("\\.", "&#46;");
returnValue = returnValue.replaceAll("%2E", "&#46;");
returnValue = returnValue.replaceAll("%2F", "&#47;");
return returnValue;
}
public static String clearXSSMaximum(String value) {
String returnValue = value;
returnValue = clearXSSMinimum(returnValue);
returnValue = returnValue.replaceAll("%00", null);
returnValue = returnValue.replaceAll("%", "&#37;");
// \\. => .
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(";", "");
}
}

View File

@ -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
*
* <pre>
* << (Modification Information) >>
*
*
* ------- ------------- ----------------------
* 2011. 9. 16. ContextPath
* </pre>
*/
public class ImagePaginationRenderer extends AbstractPaginationRenderer implements ServletContextAware{
private ServletContext servletContext;
public ImagePaginationRenderer() {
}
public void initVariables(){
firstPageLabel = "<li>&#160;</li><li><a href=\"?pageIndex={1}\" onclick=\"{0}({1});return false; \"><img src=\"" + servletContext.getContextPath() + "/images/egovframework/com/cmm/mod/icon/icon_prevend.gif\" alt=\"처음\" border=\"0\"/></a></li>";
previousPageLabel = "<li><a href=\"?pageIndex={1}\" onclick=\"{0}({1});return false; \"><img src=\"" + servletContext.getContextPath() + "/images/egovframework/com/cmm/mod/icon/icon_prev.gif\" alt=\"이전\" border=\"0\"/></a></li>";
currentPageLabel = "<li><strong>{0}</strong></li>";
otherPageLabel = "<li><a href=\"?pageIndex={1}\" onclick=\"{0}({1});return false; \">{2}</a></li>";
nextPageLabel = "<li>&#160;<a href=\"?pageIndex={1}\" onclick=\"{0}({1});return false; \"><img src=\"" + servletContext.getContextPath() + "/images/egovframework/com/cmm/mod/icon/icon_next.gif\" alt=\"다음\" border=\"0\"/></a></li>";
lastPageLabel = "<li><a href=\"?pageIndex={1}\" onclick=\"{0}({1});return false; \"><img src=\"" + servletContext.getContextPath() + "/images/egovframework/com/cmm/mod/icon/icon_nextend.gif\" alt=\"마지막\" border=\"0\"/></a></li>";
}
public void setServletContext(ServletContext servletContext) {
this.servletContext = servletContext;
initVariables();
}
}

View File

@ -0,0 +1,32 @@
package egovframework.com.cmm;
import lombok.Getter;
import lombok.Setter;
/**
* IncludedInfo annotation VO
* @author
* @since 2011.08.26
* @version 2.0.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2011.08.26
*
* </pre>
*/
@Getter
@Setter
public class IncludedCompInfoVO {
private String name;
private String listUrl;
private int order;
private int gid;
}

View File

@ -0,0 +1,80 @@
package egovframework.com.cmm;
import java.io.Serializable;
import javax.validation.constraints.Email;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
/**
* @Class Name : LoginVO.java
* @Description : Login VO class
* @Modification Information
* @
* @
* @ ------- -------- ---------------------------
* @ 2009.03.03
*
* @author
* @since 2009.03.03
* @version 1.0
* @see
*
*/
@Schema(description = "사용자 정보 VO")
@Getter
@Setter
public class LoginVO implements Serializable{
/**
*
*/
private static final long serialVersionUID = -8274004534207618049L;
@Schema(description = "아이디")
private String id;
@Schema(description = "이름")
private String name;
@Schema(description = "주민등록번호")
private String ihidNum;
@Email(regexp = "[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,3}")
@Schema(description = "이메일주소")
private String email;
@Schema(description = "비밀번호")
private String password;
@Schema(description = "비밀번호 힌트")
private String passwordHint;
@Schema(description = "비밀번호 정답")
private String passwordCnsr;
@Schema(description = "사용자 구분", allowableValues = {"GNR", "ENT", "USR"}, defaultValue = "USR")
private String userSe;
@Schema(description = "조직(부서)ID")
private String orgnztId;
@Schema(description = "조직(부서)명")
private String orgnztNm;
@Schema(description = "고유아이디")
private String uniqId;
@Schema(description = "로그인 후 이동할 페이지")
private String url;
@Schema(description = "사용자 IP정보")
private String ip;
@Schema(description = "GPKI인증 DN")
private String dn;
}

View File

@ -0,0 +1,50 @@
package egovframework.com.cmm;
/**
*
* @author :
* @since : 2023. 8. 9.
* @version : 1.0
*
* @package : egovframework.com.cmm
* @filename : ResponseCode.java
* @modificationInformation
*
* <pre>
* << (Modification Information) >>
*
*
* ---------- ---------- ----------------------
* 2023. 8. 9.
* </pre>
*
*
*/
public enum ResponseCode {
SUCCESS(200, "성공했습니다."),
AUTH_ERROR(403, "인가된 사용자가 아닙니다."),
DELETE_ERROR(700, "삭제 중 내부 오류가 발생했습니다."),
SAVE_ERROR(800, "저장시 내부 오류가 발생했습니다."),
INPUT_CHECK_ERROR(900, "입력값 무결성 오류 입니다.");
private int code;
private String message;
private ResponseCode(int code, String message) {
this.code = code;
this.message = message;
}
public int getCode() {
return code;
}
public String getMessage() {
return message;
}
}

View File

@ -0,0 +1,42 @@
package egovframework.com.cmm;
import java.io.Serializable;
import lombok.Getter;
import lombok.Setter;
/**
* VO
* @author
* @since 2009.03.06
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.03.06
*
* </pre>
*/
@Getter
@Setter
public class SessionVO implements Serializable {
private static final long serialVersionUID = -2848741427493626376L;
/** 아이디 */
private String sUserId;
/** 이름 */
private String sUserNm;
/** 이메일 */
private String sEmail;
/** 사용자구분 */
private String sUserSe;
/** 조직(부서)ID */
private String orgnztId;
/** 고유아이디 */
private String uniqId;
}

View File

@ -0,0 +1,32 @@
package egovframework.com.cmm.annotation;
/**
* annotation
* Controller annotation ,
* Controller url mapping
* annotation .
* @author
* @since 2011.08.26
* @version 2.0.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2011.08.26
*
* </pre>
*/
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(대분류 구분)
}

View File

@ -0,0 +1,67 @@
/*
* Copyright 2008-2009 MOPAS(Ministry of Public Administration and Security).
*
* 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;
/**
*
* @author :
* @since : 2023. 8. 9.
* @version : 1.0
*
* @package : egovframework.com.cmm.filter
* @filename : HTMLTagFilter.java
* @modificationInformation
*
* <pre>
* << (Modification Information) >>
*
*
* ---------- ---------- ----------------------
* 2023. 8. 9.
* </pre>
*
*
*/
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() {
}
}

View File

@ -0,0 +1,130 @@
/*
* Copyright 2008-2009 MOPAS(Ministry of Public Administration and Security).
*
* 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 javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
/**
*
* @author :
* @since : 2023. 8. 9.
* @version : 1.0
*
* @package : egovframework.com.cmm.filter
* @filename : HTMLTagFilterRequestWrapper.java
* @modificationInformation
*
* <pre>
* << (Modification Information) >>
*
*
* ---------- ---------- ----------------------
* 2023. 8. 9.
* </pre>
*
*
*/
public class HTMLTagFilterRequestWrapper extends HttpServletRequestWrapper {
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) {
StringBuffer strBuff = new StringBuffer();
for (int j = 0; j < values[i].length(); j++) {
char c = values[i].charAt(j);
switch (c) {
case '<':
strBuff.append("&lt;");
break;
case '>':
strBuff.append("&gt;");
break;
//case '&':
//strBuff.append("&amp;");
//break;
case '"':
strBuff.append("&quot;");
break;
case '\'':
strBuff.append("&apos;");
break;
default:
strBuff.append(c);
break;
}
}
values[i] = strBuff.toString();
} else {
values[i] = null;
}
}
return values;
}
public String getParameter(String parameter) {
String value = super.getParameter(parameter);
if(value==null){
return null;
}
StringBuffer strBuff = new StringBuffer();
for (int i = 0; i < value.length(); i++) {
char c = value.charAt(i);
switch (c) {
case '<':
strBuff.append("&lt;");
break;
case '>':
strBuff.append("&gt;");
break;
case '&':
strBuff.append("&amp;");
break;
case '"':
strBuff.append("&quot;");
break;
case '\'':
strBuff.append("&apos;");
break;
default:
strBuff.append(c);
break;
}
}
value = strBuff.toString();
return value;
}
}

View File

@ -0,0 +1,98 @@
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.annotation.WebFilter;
import javax.servlet.http.HttpServletResponse;
import egovframework.com.cmm.service.EgovProperties;
import lombok.extern.slf4j.Slf4j;
/**
* SimpleCORSFilter.java
*
* @author
* @since 2019. 10. 18.
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ---------- ---------- ----------------------
* 2019.10.18
* </pre>
*/
@Slf4j
@WebFilter(urlPatterns = "*.do")
public class SimpleCORSFilter implements Filter {
//private final List<String> allowedOrigins = Arrays.asList("http://localhost:9700");
public SimpleCORSFilter() {
log.info("SimpleCORSFilter init");
}
@Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
throws IOException, ServletException {
log.debug("===>>> SimpleCORSFilter > doFilter()");
//HttpServletRequest request = (HttpServletRequest)req;
HttpServletResponse response = (HttpServletResponse)res;
// Access-Control-Allow-Origin
//String origin = request.getHeader("Origin");
//HTTP parameter directly written to HTTP header
String originHeader = EgovProperties.getProperty("Globals.Allow.Origin");
log.debug("===>>> origin = " + originHeader);
if (isValidOriginHeader(originHeader)) {
// Security - Potential HTTP Response Splitting 분할응답 조치
originHeader = originHeader
.replace("\r", "")
.replace("\n", "");
}
setCorsHeaders(response, originHeader);
chain.doFilter(req, res);
}
private static boolean isValidOriginHeader(String originHeader) {
return originHeader != null && !originHeader.isEmpty();
}
private static void setCorsHeaders(HttpServletResponse response, String originHeader) {
response.setHeader("Access-Control-Allow-Origin", originHeader);
// Access-Control-Max-Age
response.setHeader("Access-Control-Max-Age", "3600");
// Access-Control-Allow-Credentials
response.setHeader("Access-Control-Allow-Credentials", "true");
// Access-Control-Allow-Methods
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE");
// Access-Control-Allow-Headers
response.setHeader("Access-Control-Allow-Headers",
"Origin, X-Requested-With, Content-Type, Accept, Authorization, " + "X-CSRF-TOKEN");
}
@Override
public void init(FilterConfig filterConfig) {}
@Override
public void destroy() {}
}

View File

@ -0,0 +1,46 @@
package egovframework.com.cmm.interceptor;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.egovframe.rte.fdl.cmmn.aspect.ExceptionTransfer;
/**
*
* @author :
* @since : 2023. 8. 9.
* @version : 1.0
*
* @package : egovframework.com.cmm.interceptor
* @filename : AopExceptionTransfer.java
* @modificationInformation
*
* <pre>
* << (Modification Information) >>
*
*
* ---------- ---------- ----------------------
* 2023. 8. 9.
* </pre>
*
*
*/
@Aspect
public class AopExceptionTransfer {
private ExceptionTransfer exceptionTransfer;
public void setExceptionTransfer(ExceptionTransfer exceptionTransfer) {
this.exceptionTransfer = exceptionTransfer;
}
@Pointcut("execution(* egovframework.let..impl.*Impl.*(..)) or execution(* egovframework.com..impl.*Impl.*(..))")
private void exceptionTransferService() {}
@AfterThrowing(pointcut= "exceptionTransferService()", throwing="ex")
public void doAfterThrowingExceptionTransferService(JoinPoint thisJoinPoint, Exception ex) throws Exception{
exceptionTransfer.transfer(thisJoinPoint, ex);
}
}

View File

@ -0,0 +1,58 @@
package egovframework.com.cmm.interceptor;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.ModelAndViewDefiningException;
import org.springframework.web.servlet.mvc.WebContentInterceptor;
import egovframework.com.cmm.LoginVO;
import egovframework.com.cmm.util.EgovUserDetailsHelper;
import lombok.extern.slf4j.Slf4j;
/**
*
* @author
* @since 2011.07.01
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2011.07.01
* 2011.09.07 URL
* 2014.06.11 URL (xml )
* </pre>
*/
@Slf4j
public class AuthenticInterceptor extends WebContentInterceptor {
/**
* (LoginVO) .
* (LoginVO) , .
*/
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws ServletException {
LoginVO loginVO = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
if (loginVO.getId() != null) {
log.debug("AuthenticInterceptor sessionID "+loginVO.getId());
log.debug("AuthenticInterceptor ================== ");
return true;
}
log.debug("AuthenticInterceptor Fail!!!!!!!!!!!!================== ");
ModelAndView modelAndView = new ModelAndView("redirect:http://localhost:3000/login");
throw new ModelAndViewDefiningException(modelAndView);
}
}

View File

@ -0,0 +1,45 @@
package egovframework.com.cmm.interceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import lombok.extern.slf4j.Slf4j;
/**
*
* @author
* @since 2011.07.01
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2011.07.01
* 2011.09.07 URL
* </pre>
*/
@Slf4j
public class CustomAuthenticInterceptor extends HandlerInterceptorAdapter {
/**
* (LoginVO) .
* (LoginVO) , .
*/
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
HttpSession session = request.getSession();
log.debug("CustomAuthenticInterceptor sessionID "+session.getId());
log.debug("CustomAuthenticInterceptor ================== ");
return true;
}
}

View File

@ -0,0 +1,70 @@
package egovframework.com.cmm.service;
import java.io.Serializable;
import lombok.Getter;
import lombok.Setter;
/**
*
* @author
* @since 2009.04.01
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.04.01
*
* </pre>
*/
@Getter
@Setter
public class CmmnDetailCode implements Serializable {
private static final long serialVersionUID = -6508801327314181679L;
/*
* 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 = "";
}

View File

@ -0,0 +1,62 @@
package egovframework.com.cmm.service;
import java.util.List;
import java.util.Map;
import egovframework.com.cmm.ComDefaultCodeVO;
/**
*
*
* @author
* @since 2009.04.01
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.03.11
*
* </pre>
*/
public interface EgovCmmUseService {
/**
* .
*
* @param vo
* @return List()
* @throws Exception
*/
public List<CmmnDetailCode> selectCmmCodeDetail(ComDefaultCodeVO vo) throws Exception;
/**
* ComDefaultCodeVO .
*
* @param voList
* @return Map()
* @throws Exception
*/
public Map<String, List<CmmnDetailCode>> selectCmmCodeDetails(List<?> voList) throws Exception;
/**
* .
*
* @param vo
* @return List
* @throws Exception
*/
public List<CmmnDetailCode> selectOgrnztIdDetail(ComDefaultCodeVO vo) throws Exception;
/**
* .
*
* @param vo
* @return List
* @throws Exception
*/
public List<CmmnDetailCode> selectGroupIdDetail(ComDefaultCodeVO vo) throws Exception;
}

View File

@ -0,0 +1,115 @@
package egovframework.com.cmm.service;
import java.util.List;
import java.util.Map;
/**
* @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<FileVO> 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<String, Object> selectFileListByFileNm(FileVO fvo) throws Exception;
/**
* .
*
* @param vo
* @return
* @throws Exception
*/
public List<FileVO> selectImageFileList(FileVO vo) throws Exception;
}

View File

@ -0,0 +1,473 @@
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.util.ArrayList;
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 javax.servlet.http.HttpServletResponse;
import org.egovframe.rte.fdl.idgnr.EgovIdGnrService;
import org.egovframe.rte.fdl.property.EgovPropertyService;
import org.springframework.stereotype.Component;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.multipart.MultipartFile;
//import java.util.HashMap;
import egovframework.com.cmm.EgovWebUtil;
import egovframework.let.utl.fcc.service.EgovStringUtil;
import lombok.extern.slf4j.Slf4j;
/**
* @Class Name : EgovFileMngUtil.java
* @Description :
* @Modification Information
*
*
* ------- -------- ---------------------------
* 2009.02.13
* 2011.08.31 JJY 릿
*
* @author
* @since 2009. 02. 13
* @version 1.0
* @see
*
*/
@Slf4j
@Component("EgovFileMngUtil")
public class EgovFileMngUtil {
public static final int BUFF_SIZE = 2048;
@Resource(name = "propertiesService")
protected EgovPropertyService propertyService;
@Resource(name = "egovFileIdGnrService")
private EgovIdGnrService idgenService;
/**
* .
*
* @param files
* @return
* @throws Exception
*/
public List<FileVO> parseFileInf(Map<String, MultipartFile> files, String KeyStr, int fileKeyParam, String atchFileId, String storePath) throws Exception {
int fileKey = fileKeyParam;
String storePathString = "";
String atchFileIdString = "";
if ("".equals(storePath) || storePath == null) {
storePathString = propertyService.getString("Globals.fileStorePath");
} else {
storePathString = propertyService.getString(storePath);
}
atchFileId = atchFileId.replaceAll("\\s", "");
if ("".equals(atchFileId) || atchFileId == null) {
atchFileIdString = idgenService.getNextStringId();
} else {
atchFileIdString = atchFileId;
}
File saveFolder = new File(EgovWebUtil.filePathBlackList(storePathString));
if (!saveFolder.exists() || saveFolder.isFile()) {
saveFolder.mkdirs();
}
Iterator<Entry<String, MultipartFile>> itr = files.entrySet().iterator();
MultipartFile file;
String filePath = "";
List<FileVO> result = new ArrayList<FileVO>();
FileVO fvo;
while (itr.hasNext()) {
Entry<String, MultipartFile> entry = itr.next();
file = entry.getValue();
String orginFileName = file.getOriginalFilename();
//--------------------------------------
// 원 파일명이 null인 경우 처리
//--------------------------------------
if (orginFileName == null) {
orginFileName = "";
}
////------------------------------------
//--------------------------------------
// 원 파일명이 없는 경우 처리
// (첨부가 되지 않은 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 + EgovStringUtil.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));
//writeFile(file, newName, storePathString);
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;
String stordFilePathReal = EgovWebUtil.filePathBlackList(stordFilePath);
newName = EgovWebUtil.filePathBlackList(newName);
try {
stream = file.getInputStream();
File cFile = new File(stordFilePathReal);
if (!cFile.isDirectory()) {
boolean _flag = cFile.mkdir();
if (!_flag) {
throw new IOException("Directory creation Failed ");
}
}
bos = new FileOutputStream(stordFilePathReal + 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);
}
} catch (FileNotFoundException fnfe) {
log.debug("fnfe: {}", fnfe);
} catch (IOException ioe) {
log.debug("ioe: {}", ioe);
} finally {
if (bos != null) {
try {
bos.close();
} catch (IOException ignore) {
log.debug("IGNORED: {}", ignore.getMessage());
}
}
if (stream != null) {
try {
stream.close();
} catch (IOException ignore) {
log.debug("IGNORED: {}", ignore.getMessage());
}
}
}
}
/**
* .
*
* @param request
* @param response
* @throws Exception
*/
public static void downFile(HttpServletRequest request, HttpServletResponse response) throws Exception {
String downFileName = EgovWebUtil.filePathBlackList(EgovStringUtil.isNullToString(request.getAttribute("downFile")));
String orgFileName = EgovWebUtil.filePathBlackList(EgovStringUtil.isNullToString(request.getAttribute("orgFileName")));
/*if ((String)request.getAttribute("downFile") == null) {
downFileName = "";
} else {
downFileName = EgovStringUtil.isNullToString(request.getAttribute("downFile"));
}*/
/*if ((String)request.getAttribute("orgFileName") == null) {
orgFileName = "";
} else {
orgFileName = (String)request.getAttribute("orginFile");
}*/
File file = new File(downFileName);
if (!file.exists()) {
throw new FileNotFoundException(downFileName);
}
if (!file.isFile()) {
throw new FileNotFoundException(downFileName);
}
byte[] b = new byte[BUFF_SIZE]; //buffer size 2K.
String fName = (new String(orgFileName.getBytes(), "UTF-8")).replaceAll("\r\n","");
response.setContentType("application/x-msdownload");
response.setHeader("Content-Disposition:", "attachment; filename=" + fName);
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 {
if (outs != null) {
try {
outs.close();
} catch (IOException ignore) {
log.debug("IGNORED: {}", ignore.getMessage());
}
}
if (fin != null) {
try {
fin.close();
} catch (IOException ignore) {
log.debug("IGNORED: {}", ignore.getMessage());
}
}
}
}
/**
* .
*
* @param file
* @return
* @throws Exception
public static HashMap<String, String> uploadFile(MultipartFile file) throws Exception {
HashMap<String, String> map = new HashMap<String, String>();
//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 = EgovStringUtil.getTimeStamp() + "." + fileExt;
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;
newName = EgovWebUtil.filePathBlackList(EgovStringUtil.isNullToString(newName));
stordFilePath = EgovWebUtil.filePathBlackList(EgovStringUtil.isNullToString(stordFilePath));
try {
stream = file.getInputStream();
File cFile = new File(stordFilePath);
if (!cFile.isDirectory()) {
cFile.mkdir();
}
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);
}
} catch (FileNotFoundException fnfe) {
log.debug("fnfe: {}", fnfe);
} catch (IOException ioe) {
log.debug("ioe: {}", ioe);
} finally {
if (bos != null) {
try {
bos.close();
} catch (IOException ignore) {
log.debug("IGNORED: {}", ignore.getMessage());
}
}
if (stream != null) {
try {
stream.close();
} catch (IOException ignore) {
log.debug("IGNORED: {}", ignore.getMessage());
}
}
}
}
/**
* .
*
* @param response
* @param streFileNm
* :
* @param orignFileNm
* @throws Exception
*/
public void downFile(HttpServletResponse response, String streFileNm, String orignFileNm) throws Exception {
// String downFileName = EgovStringUtil.isNullToString(request.getAttribute("downFile")).replaceAll("..","");
// String orgFileName = EgovStringUtil.isNullToString(request.getAttribute("orgFileName")).replaceAll("..","");
String downFileName = EgovWebUtil.filePathBlackList(EgovStringUtil.isNullToString(streFileNm));
String orgFileName = EgovWebUtil.filePathBlackList(EgovStringUtil.isNullToString(orignFileNm));
File file = new File(downFileName);
//log.debug(this.getClass().getName()+" downFile downFileName "+downFileName);
//log.debug(this.getClass().getName()+" downFile orgFileName "+orgFileName);
if (!file.exists()) {
throw new FileNotFoundException(downFileName);
}
if (!file.isFile()) {
throw new FileNotFoundException(downFileName);
}
//byte[] b = new byte[BUFF_SIZE]; //buffer size 2K.
int fSize = (int)file.length();
if (fSize > 0) {
BufferedInputStream in = null;
try {
in = new BufferedInputStream(new FileInputStream(file));
String mimetype = "text/html"; //"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 {
if (in != null) {
try {
in.close();
} catch (IOException ignore) {
log.debug("IGNORED: {}", ignore.getMessage());
}
}
}
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("<html>");
printwriter.println("<br><br><br><h2>Could not get file name:<br>" + requestedFile + "</h2>");
printwriter.println("<br><br><br><center><h3><a href='javascript: history.go(-1)'>Back</a></h3></center>");
printwriter.println("<br><br><br>&copy; webAccess");
printwriter.println("</html>");
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();
//*/
}
}

View File

@ -0,0 +1,238 @@
package egovframework.com.cmm.service;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.ResourcePatternUtils;
import egovframework.com.cmm.EgovWebUtil;
import lombok.extern.slf4j.Slf4j;
//import java.io.FileNotFoundException;
//import java.io.IOException;
//import java.util.Properties;
/**
* Class Name : EgovProperties.java
* Description : properties Globals
* .
* Modification Information
*
*
* ------- -------- ---------------------------
* 2009.01.19
* 2011.07.20 Globals
* 2011.08.31 JJY 릿
*
* @author
* @since 2009. 01. 19
* @version 1.0
* @see
*
*/
@Slf4j
public class EgovProperties {
//프로퍼티값 로드시 에러발생하면 반환되는 에러문자열
public static final String ERR_CODE = " EXCEPTION OCCURRED";
public static final String ERR_CODE_FNFE = " EXCEPTION(FNFE) OCCURRED";
public static final String ERR_CODE_IOE = " EXCEPTION(IOE) OCCURRED";
//파일구분자
static final String FILE_SEPARATOR = System.getProperty("file.separator");
//프로퍼티 파일의 물리적 위치
/*public static final String GLOBALS_PROPERTIES_FILE
= System.getProperty("user.home") + System.getProperty("file.separator") + "egovProps"
+ System.getProperty("file.separator") + "globals.properties";*/
// 프로퍼티 파일의 위치 prefix
// /target/classes/egovframework
//public static final String RELATIVE_PATH_PREFIX = "classpath:" + FILE_SEPARATOR + "egovframework";
// 프로퍼티 파일의 위치
// /target/classes/egovframework/egovProps/globals.properties
//public static final String GLOBALS_PROPERTIES_FILE = RELATIVE_PATH_PREFIX + FILE_SEPARATOR +"egovProps"+ FILE_SEPARATOR + "globals.properties";
// /target/classes/application.properties
public static final String GLOBALS_PROPERTIES_FILE = "classpath:" + FILE_SEPARATOR + "application.properties";
/**
* Key (Globals.java )
* @param keyName String
* @return String
public static String getPathProperty(String keyName){
String value = ERR_CODE;
value="99";
debug(GLOBALS_PROPERTIES_FILE + " : " + keyName);
FileInputStream fis = null;
try{
Properties props = new Properties();
fis = new FileInputStream(GLOBALS_PROPERTIES_FILE);
props.load(new java.io.BufferedInputStream(fis));
value = props.getProperty(keyName).trim();
value = RELATIVE_PATH_PREFIX + "egovProps" + System.getProperty("file.separator") + value;
}catch(FileNotFoundException fne){
debug(fne);
}catch(IOException ioe){
debug(ioe);
}catch(Exception e){
debug(e);
}finally{
try {
if (fis != null) fis.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
return value;
}
*/
/**
* Key (Globals.java )
* @param keyName String
* @return String
*/
public static String getProperty(String keyName) {
String value = ERR_CODE;
value = "99";
Resource resources = ResourcePatternUtils.getResourcePatternResolver(new DefaultResourceLoader())
.getResource(GLOBALS_PROPERTIES_FILE);
debug(GLOBALS_PROPERTIES_FILE + " : " + keyName);
try (InputStream in = resources.getInputStream()) {
Properties props = new Properties();
props.load(new java.io.BufferedInputStream(in));
value = props.getProperty(keyName).trim();
} catch (FileNotFoundException fne) {
debug(fne);
} catch (IOException ioe) {
debug(ioe);
}
return value;
}
/**
* Key
* @param fileName String
* @param key String
* @return String
public static String getPathProperty(String fileName, String key){
FileInputStream fis = null;
try{
java.util.Properties props = new java.util.Properties();
fis = new FileInputStream(fileName);
props.load(new java.io.BufferedInputStream(fis));
fis.close();
String value = props.getProperty(key);
value = RELATIVE_PATH_PREFIX + "egovProps" + System.getProperty("file.separator") + value;
return value;
}catch(java.io.FileNotFoundException fne){
return ERR_CODE_FNFE;
}catch(java.io.IOException ioe){
return ERR_CODE_IOE;
}finally{
try {
if (fis != null) fis.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
*/
/**
* Key
* @param fileName String
* @param key String
* @return String
public static String getProperty(String fileName, String key){
FileInputStream fis = null;
try{
java.util.Properties props = new java.util.Properties();
fis = new FileInputStream(fileName);
props.load(new java.io.BufferedInputStream(fis));
fis.close();
String value = props.getProperty(key);
return value;
}catch(java.io.FileNotFoundException fne){
return ERR_CODE_FNFE;
}catch(java.io.IOException ioe){
return ERR_CODE_IOE;
}finally{
try {
if (fis != null) fis.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
*/
/**
* (key-value) .
* @param property String
* @return ArrayList
*/
@SuppressWarnings("unused")
public static ArrayList<Map<String, String>> loadPropertyFile(String property) {
// key - value 형태로 된 배열 결과
ArrayList<Map<String, String>> keyList = new ArrayList<Map<String, String>>();
String src = EgovWebUtil.filePathBlackList(property.replace("\\", FILE_SEPARATOR).replace("/", FILE_SEPARATOR));
try (FileInputStream fis = new FileInputStream(src)) {
File srcFile = new File(src);
if (srcFile.exists()) {
java.util.Properties props = new java.util.Properties();
props.load(new java.io.BufferedInputStream(fis));
int i = 0;
Enumeration<?> plist = props.propertyNames();
if (plist != null) {
while (plist.hasMoreElements()) {
Map<String, String> map = new HashMap<String, String>();
String key = (String)plist.nextElement();
map.put(key, props.getProperty(key));
keyList.add(map);
}
}
}
} catch (FileNotFoundException ex) {
debug("FileNotFoundException:" + ex);
} catch (IOException ex) {
debug("IOException:" + ex);
}
return keyList;
}
/**
* .
* @param obj Object
*/
private static void debug(Object obj) {
if (obj instanceof java.lang.Exception) {
log.debug("IGNORED: {}", ((Exception)obj).getMessage());
}
}
}

View File

@ -0,0 +1,46 @@
package egovframework.com.cmm.service;
import java.util.List;
/**
*
* @author :
* @since : 2023. 8. 9.
* @version : 1.0
*
* @package : egovframework.com.cmm.service
* @filename : EgovUserDetailsService.java
* @modificationInformation
*
* <pre>
* << (Modification Information) >>
*
*
* ---------- ---------- ----------------------
* 2023. 8. 9.
* </pre>
*
*
*/
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<String> getAuthorities();
/**
* .
* @return Boolean - (TRUE / FALSE)
*/
public Boolean isAuthenticated();
}

View File

@ -0,0 +1,70 @@
package egovframework.com.cmm.service;
import java.io.Serializable;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* @Class Name : FileVO.java
* @Description : VO
* @Modification Information
*
*
* ------- ------- -------------------
* 2009. 3. 25.
*
* @author
* @since 2009. 3. 25.
* @version
* @see
*
*/
@Schema(description = "파일 정보 VO")
@Getter
@Setter
public class FileVO implements Serializable {
/**
* serialVersion UID
*/
private static final long serialVersionUID = -287950405903719128L;
@Schema(description = "첨부파일 아이디")
public String atchFileId = "";
@Schema(description = "생성일자")
public String creatDt = "";
@Schema(description = "파일내용")
public String fileCn = "";
@Schema(description = "파일확장자")
public String fileExtsn = "";
@Schema(description = "파일크기")
public String fileMg = "";
@Schema(description = "파일연번")
public String fileSn = "";
@Schema(description = "파일저장경로")
public String fileStreCours = "";
@Schema(description = "원파일명")
public String orignlFileNm = "";
@Schema(description = "저장파일명")
public String streFileNm = "";
/**
* toString .
*/
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
}

View File

@ -0,0 +1,30 @@
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 {
//파일 업로드 원 파일명
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";
}

View File

@ -0,0 +1,52 @@
package egovframework.com.cmm.service;
import java.util.HashMap;
import java.util.Map;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
/**
*
* @author :
* @since : 2023. 8. 9.
* @version : 1.0
*
* @package : egovframework.com.cmm.service
* @filename : ResultVO.java
* @modificationInformation
*
* <pre>
* << (Modification Information) >>
*
*
* ---------- ---------- ----------------------
* 2023. 8. 9.
* </pre>
*
*
*/
@Schema(description = "응답 객체 VO")
@Getter
@Setter
public class ResultVO {
@Schema(description = "응답 코드")
private int resultCode = 0;
@Schema(description = "응답 메시지")
private String resultMessage = "OK";
private Map<String, Object> result = new HashMap<String, Object>();
public void putResult(String key, Object value) {
result.put(key, value);
}
public Object getResult(String key) {
return this.result.get(key);
}
}

View File

@ -0,0 +1,63 @@
package egovframework.com.cmm.service.impl;
import java.util.List;
import egovframework.com.cmm.ComDefaultCodeVO;
import egovframework.com.cmm.service.CmmnDetailCode;
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
*/
@SuppressWarnings("unchecked")
public List<CmmnDetailCode> selectCmmCodeDetail(ComDefaultCodeVO vo) throws Exception {
return (List<CmmnDetailCode>) list("CmmUseDAO.selectCmmCodeDetail", vo);
}
/**
* .
*
* @param vo
* @return
* @throws Exception
*/
@SuppressWarnings("unchecked")
public List<CmmnDetailCode> selectOgrnztIdDetail(ComDefaultCodeVO vo) throws Exception {
return (List<CmmnDetailCode>) list("CmmUseDAO.selectOgrnztIdDetail", vo);
}
/**
* .
*
* @param vo
* @return
* @throws Exception
*/
@SuppressWarnings("unchecked")
public List<CmmnDetailCode> selectGroupIdDetail(ComDefaultCodeVO vo) throws Exception {
return (List<CmmnDetailCode>) list("CmmUseDAO.selectGroupIdDetail", vo);
}
}

View File

@ -0,0 +1,95 @@
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 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<CmmnDetailCode> selectCmmCodeDetail(ComDefaultCodeVO vo) throws Exception {
return cmmUseDAO.selectCmmCodeDetail(vo);
}
/**
* ComDefaultCodeVO .
*
* @param voList
* @return
* @throws Exception
*/
@Override
public Map<String, List<CmmnDetailCode>> selectCmmCodeDetails(List<?> voList) throws Exception {
ComDefaultCodeVO vo;
Map<String, List<CmmnDetailCode>> map = new HashMap<String, List<CmmnDetailCode>>();
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
*/
@Override
public List<CmmnDetailCode> selectOgrnztIdDetail(ComDefaultCodeVO vo) throws Exception {
return cmmUseDAO.selectOgrnztIdDetail(vo);
}
/**
* .
*
* @param vo
* @return List
* @throws Exception
*/
@Override
public List<CmmnDetailCode> selectGroupIdDetail(ComDefaultCodeVO vo) throws Exception {
return cmmUseDAO.selectGroupIdDetail(vo);
}
}

View File

@ -0,0 +1,33 @@
package egovframework.com.cmm.service.impl;
import javax.annotation.Resource;
import org.apache.ibatis.session.SqlSessionFactory;
import org.egovframe.rte.psl.dataaccess.EgovAbstractMapper;
/**
* EgovComAbstractDAO.java
*
* @author
* @since 2011. 9. 23.
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- ------------- ----------------------
* 2011. 9. 23.
* </pre>
*/
public abstract class EgovComAbstractDAO extends EgovAbstractMapper {
@Override
@Resource(name = "egov.sqlSession")
public void setSqlSessionFactory(SqlSessionFactory sqlSession) {
super.setSqlSessionFactory(sqlSession);
}
}

View File

@ -0,0 +1,167 @@
package egovframework.com.cmm.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 org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
/**
* @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;
/**
* .
*
* @see egovframework.com.cmm.service.EgovFileMngService#deleteFileInfs(java.util.List)
*/
@Override
public void deleteFileInfs(List<?> fvoList) throws Exception {
fileMngDAO.deleteFileInfs(fvoList);
}
/**
* ( ) .
*
* @see egovframework.com.cmm.service.EgovFileMngService#insertFileInf(egovframework.com.cmm.service.FileVO)
*/
@Override
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)
*/
@Override
public String insertFileInfs(List<?> fvoList) throws Exception {
String atchFileId = "";
if (fvoList.size() != 0) {
atchFileId = fileMngDAO.insertFileInfs(fvoList);
}
if("".equals(atchFileId)){
atchFileId = null;
}
return atchFileId;
}
/**
* .
*
* @see egovframework.com.cmm.service.EgovFileMngService#selectFileInfs(egovframework.com.cmm.service.FileVO)
*/
@Override
public List<FileVO> selectFileInfs(FileVO fvo) throws Exception {
return fileMngDAO.selectFileInfs(fvo);
}
/**
* ( ) .
*
* @see egovframework.com.cmm.service.EgovFileMngService#updateFileInfs(java.util.List)
*/
@Override
public void updateFileInfs(List<?> fvoList) throws Exception {
//Delete & Insert
fileMngDAO.updateFileInfs(fvoList);
}
/**
* .
*
* @see egovframework.com.cmm.service.EgovFileMngService#deleteFileInf(egovframework.com.cmm.service.FileVO)
*/
@Override
public void deleteFileInf(FileVO fvo) throws Exception {
fileMngDAO.deleteFileInf(fvo);
}
/**
* .
*
* @see egovframework.com.cmm.service.EgovFileMngService#selectFileInf(egovframework.com.cmm.service.FileVO)
*/
@Override
public FileVO selectFileInf(FileVO fvo) throws Exception {
return fileMngDAO.selectFileInf(fvo);
}
/**
* .
*
* @see egovframework.com.cmm.service.EgovFileMngService#getMaxFileSN(egovframework.com.cmm.service.FileVO)
*/
@Override
public int getMaxFileSN(FileVO fvo) throws Exception {
return fileMngDAO.getMaxFileSN(fvo);
}
/**
* .
*
* @see egovframework.com.cmm.service.EgovFileMngService#deleteAllFileInf(egovframework.com.cmm.service.FileVO)
*/
@Override
public void deleteAllFileInf(FileVO fvo) throws Exception {
fileMngDAO.deleteAllFileInf(fvo);
}
/**
* .
*
* @see egovframework.com.cmm.service.EgovFileMngService#selectFileListByFileNm(egovframework.com.cmm.service.FileVO)
*/
@Override
public Map<String, Object> selectFileListByFileNm(FileVO fvo) throws Exception {
List<FileVO> result = fileMngDAO.selectFileListByFileNm(fvo);
int cnt = fileMngDAO.selectFileListCntByFileNm(fvo);
Map<String, Object> map = new HashMap<String, Object>();
map.put("resultList", result);
map.put("resultCnt", Integer.toString(cnt));
return map;
}
/**
* .
*
* @see egovframework.com.cmm.service.EgovFileMngService#selectImageFileList(egovframework.com.cmm.service.FileVO)
*/
@Override
public List<FileVO> selectImageFileList(FileVO vo) throws Exception {
return fileMngDAO.selectImageFileList(vo);
}
}

View File

@ -0,0 +1,87 @@
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
*
* <pre>
* (Modification Information)
*
*
* ------- -------- ---------------------------
* 2011. 8. 12.
*
* </pre>
*/
public class EgovTestUserDetailsServiceImpl extends EgovAbstractServiceImpl implements
EgovUserDetailsService {
@Override
public Object getAuthenticatedUser() {
LoginVO loginVO = new LoginVO();
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;
// return
// RequestContextHolder.getRequestAttributes().getAttribute("loginVO",
// RequestAttributes.SCOPE_SESSION);
}
@Override
public List<String> getAuthorities() {
// 권한 설정을 리턴한다.
List<String> listAuth = new ArrayList<String>();
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() {
// 인증된 유저인지 확인한다.
/*if (RequestContextHolder.getRequestAttributes() == null) {
return false;
} else {
if (RequestContextHolder.getRequestAttributes().getAttribute(
"loginVO", RequestAttributes.SCOPE_SESSION) == null) {
return false;
} else {
return true;
}
}*/
return true;
}
}

View File

@ -0,0 +1,51 @@
package egovframework.com.cmm.service.impl;
import java.util.List;
import egovframework.com.cmm.service.EgovUserDetailsService;
import egovframework.com.cmm.util.EgovUserDetailsHelper;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
/**
*
* @author
* @since 2011. 6. 25.
* @version 1.0
* @see
*
* <pre>
* (Modification Information)
*
*
* ------- -------- ---------------------------
* 2011. 8. 12.
*
* </pre>
*/
public class EgovUserDetailsSessionServiceImpl extends EgovAbstractServiceImpl implements
EgovUserDetailsService {
@Override
public Object getAuthenticatedUser() {
if (EgovUserDetailsHelper.isAuthenticated()) {
return EgovUserDetailsHelper.getAuthenticatedUser();
}
return null;
}
@Override
public List<String> getAuthorities() {
// return listAuth;
return EgovUserDetailsHelper.getAuthorities();
}
@Override
public Boolean isAuthenticated() {
// 인증된 유저인지 확인한다.
return EgovUserDetailsHelper.isAuthenticated();
}
}

View File

@ -0,0 +1,182 @@
package egovframework.com.cmm.service.impl;
import java.util.Iterator;
import java.util.List;
import egovframework.com.cmm.service.FileVO;
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 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();
FileVO vo;
while (iter.hasNext()) {
vo = (FileVO) iter.next();
delete("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<FileVO> selectFileInfs(FileVO vo) throws Exception {
return (List<FileVO>) 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<FileVO> selectFileListByFileNm(FileVO fvo) throws Exception {
return (List<FileVO>) 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<FileVO> selectImageFileList(FileVO vo) throws Exception {
return (List<FileVO>) list("FileManageDAO.selectImageFileList", vo);
}
}

View File

@ -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
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2014.09.18
*
* </pre>
*/
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);
}
}

View File

@ -0,0 +1,96 @@
package egovframework.com.cmm.util;
import javax.sql.DataSource;
import org.egovframe.rte.fdl.idgnr.impl.EgovTableIdGnrServiceImpl;
import org.egovframe.rte.fdl.idgnr.impl.strategy.EgovIdGnrStrategyImpl;
/**
* @ClassName : EgovIdGnrBuilder.java
* @Description : IdGen builder
*
* @author :
* @since : 2021. 7. 20
* @version : 1.0
*
* <pre>
* << (Modification Information) >>
*
*
* ------------- ------------ ---------------------
* 2021. 7. 20
* </pre>
*
*/
public class EgovIdGnrBuilder {
// TODO : 기본값 설정, 예외처리 필요
private DataSource dataSource;
private EgovIdGnrStrategyImpl egovIdGnrStrategyImpl;
private String preFix;
private int cipers;
private char fillChar;
private int blockSize;
private String table;
private String tableName;
public EgovIdGnrBuilder setDataSource(DataSource dataSource) {
this.dataSource = dataSource;
return this;
}
public EgovIdGnrBuilder setEgovIdGnrStrategyImpl(EgovIdGnrStrategyImpl egovIdGnrStrategyImpl) {
this.egovIdGnrStrategyImpl = egovIdGnrStrategyImpl;
return this;
}
public EgovIdGnrBuilder setPreFix(String preFix) {
this.preFix = preFix;
return this;
}
public EgovIdGnrBuilder setCipers(int cipers) {
this.cipers = cipers;
return this;
}
public EgovIdGnrBuilder setFillChar(char fillChar) {
this.fillChar = fillChar;
return this;
}
public EgovIdGnrBuilder setBlockSize(int blockSize) {
this.blockSize = blockSize;
return this;
}
public EgovIdGnrBuilder setTable(String table) {
this.table = table;
return this;
}
public EgovIdGnrBuilder setTableName(String tableName) {
this.tableName = tableName;
return this;
}
public EgovTableIdGnrServiceImpl build() {
EgovTableIdGnrServiceImpl egovTableIdGnrServiceImpl = new EgovTableIdGnrServiceImpl();
egovTableIdGnrServiceImpl.setDataSource(dataSource);
if(egovIdGnrStrategyImpl != null) {
egovIdGnrStrategyImpl = new EgovIdGnrStrategyImpl();
egovIdGnrStrategyImpl.setPrefix(preFix);
egovIdGnrStrategyImpl.setCipers(cipers);
egovIdGnrStrategyImpl.setFillChar(fillChar);
egovTableIdGnrServiceImpl.setStrategy(egovIdGnrStrategyImpl);
}
egovTableIdGnrServiceImpl.setBlockSize(blockSize);
egovTableIdGnrServiceImpl.setTable(table);
egovTableIdGnrServiceImpl.setTableName(tableName);
return egovTableIdGnrServiceImpl;
}
}

View File

@ -0,0 +1,128 @@
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
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2014.09.18
*
* </pre>
*/
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!!");
}
}
}
}
/**
* 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!!");
}
} 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!!");
}
} else if (object instanceof Connection) {
try {
((Connection)object).close();
} catch (SQLException ignore) {
EgovBasicLogger.ignore("Occurred SQLException 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!!");
}
try {
socket.close();
} catch (IOException ignore) {
EgovBasicLogger.ignore("Occurred IOException to close resource is ingored!!");
}
}
if (server != null) {
try {
server.close();
} catch (IOException ignore) {
EgovBasicLogger.ignore("Occurred IOException to close resource is ingored!!");
}
}
}
/**
* 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!!");
}
try {
socket.close();
} catch (IOException ignore) {
EgovBasicLogger.ignore("Occurred IOException to close resource is ingored!!");
}
}
}
}
}

View File

@ -0,0 +1,60 @@
package egovframework.com.cmm.util;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import egovframework.com.cmm.LoginVO;
/**
* EgovUserDetails Helper
*
* @author sjyoon
* @since 2009.06.01
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- ------------- ----------------------
* 2009.03.10 sjyoon
* 2011.08.31 JJY 릿
*
* </pre>
*/
public class EgovUserDetailsHelper {
/**
* VO .
* @return Object - ValueObject
*/
public static Object getAuthenticatedUser() {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
return (LoginVO) authentication.getPrincipal();
}
/**
* .
* ) [ROLE_ADMIN, ROLE_USER, ROLE_A, ROLE_B, ROLE_RESTRICTED, IS_AUTHENTICATED_FULLY, IS_AUTHENTICATED_REMEMBERED, IS_AUTHENTICATED_ANONYMOUSLY]
* @return List -
*/
public static List<String> getAuthorities() {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
return authentication.getAuthorities().stream().map(GrantedAuthority::getAuthority).collect(Collectors.toList());
}
/**
* .
* @return Boolean - (TRUE / FALSE)
*/
public static Boolean isAuthenticated() {
return EgovUserDetailsHelper.getAuthenticatedUser()!=null? Boolean.TRUE : Boolean.FALSE ;
}
}

View File

@ -0,0 +1,41 @@
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;
/**
*
* @author :
* @since : 2023. 8. 9.
* @version : 1.0
*
* @package : egovframework.com.cmm.web
* @filename : EgovBindingInitializer.java
* @modificationInformation
*
* <pre>
* << (Modification Information) >>
*
*
* ---------- ---------- ----------------------
* 2023. 8. 9.
* </pre>
*
*
*/
public class EgovBindingInitializer implements WebBindingInitializer {
@Override
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));
}
}

View File

@ -0,0 +1,199 @@
package egovframework.com.cmm.web;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.Base64;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.egovframe.rte.fdl.cmmn.exception.EgovBizException;
import org.egovframe.rte.fdl.cryptography.EgovCryptoService;
import org.springframework.stereotype.Controller;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import egovframework.com.cmm.EgovWebUtil;
import egovframework.com.cmm.service.EgovFileMngService;
import egovframework.com.cmm.service.EgovProperties;
import egovframework.com.cmm.service.FileVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
/**
*
* @author
* @since 2009.06.01
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.3.25
*
* Copyright (C) 2009 by MOPAS All right reserved.
* </pre>
*/
@Slf4j
@Controller
@Tag(name="EgovFileDownloadController",description = "파일 다운로드")
public class EgovFileDownloadController {
@Resource(name = "EgovFileMngService")
private EgovFileMngService fileService;
/** 암호화서비스 */
@Resource(name="egovARIACryptoService")
EgovCryptoService cryptoService;
public static final String ALGORITM_KEY = EgovProperties.getProperty("Globals.crypto.algoritm");
/**
* .
*
* @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";
}
/**
* Disposition .
*
* @param filename
* @param request
* @param response
* @throws Exception
*/
private void setDisposition(String filename, HttpServletRequest request, HttpServletResponse response)
throws Exception {
String browser = getBrowser(request);
String dispositionPrefix = "attachment; filename=";
String encodedFilename = null;
if (browser.equals("MSIE")) {
encodedFilename = URLEncoder.encode(filename, "UTF-8").replaceAll("\\+", "%20");
} else if (browser.equals("Trident")) { // IE11 문자열 깨짐 방지
encodedFilename = URLEncoder.encode(filename, "UTF-8").replaceAll("\\+", "%20");
} else if (browser.equals("Firefox")) {
encodedFilename = "\"" + new String(filename.getBytes("UTF-8"), "8859_1") + "\"";
} else if (browser.equals("Opera")) {
encodedFilename = "\"" + new String(filename.getBytes("UTF-8"), "8859_1") + "\"";
} else if (browser.equals("Chrome")) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < filename.length(); i++) {
char c = filename.charAt(i);
if (c > '~') {
sb.append(URLEncoder.encode("" + c, "UTF-8"));
} else {
sb.append(c);
}
}
encodedFilename = sb.toString();
} else {
//throw new RuntimeException("Not supported browser");
throw new IOException("Not supported browser");
}
response.setHeader("Content-Disposition", dispositionPrefix + encodedFilename);
if ("Opera".equals(browser)) {
response.setContentType("application/octet-stream;charset=UTF-8");
}
}
/**
* .
*
* @param commandMap
* @param response
* @throws Exception
*/
@Operation(
summary = "파일 다운로드",
description = "첨부파일로 등록된 파일에 대하여 다운로드를 제공",
tags = {"EgovFileDownloadController"}
)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "성공")
})
@GetMapping(value = "/cmm/fms/FileDown.do")
public void cvplFileDownload(@RequestParam Map<String, Object> commandMap, HttpServletRequest request, HttpServletResponse response) throws Exception {
// 암호화된 atchFileId 를 복호화 (2022.12.06 추가) - 파일아이디가 유추 불가능하도록 조치
String param_atchFileId = (String) commandMap.get("atchFileId");
param_atchFileId = param_atchFileId.replaceAll(" ", "+");
byte[] decodedBytes = Base64.getDecoder().decode(param_atchFileId);
String decodedFileId = new String(cryptoService.decrypt(decodedBytes,ALGORITM_KEY));
String fileSn = (String) commandMap.get("fileSn");
FileVO fileVO = new FileVO();
fileVO.setAtchFileId(decodedFileId);
fileVO.setFileSn(fileSn);
FileVO fvo = fileService.selectFileInf(fileVO);
String fileStreCours = EgovWebUtil.filePathBlackList(fvo.getFileStreCours());
String streFileNm = EgovWebUtil.filePathBlackList(fvo.getStreFileNm());
File uFile = new File(fileStreCours, streFileNm);
long fSize = uFile.length();
if (fSize > 0) {
//String mimetype = "application/x-msdownload";
String mimetype = "application/x-stuff";
//response.setBufferSize(fSize); // OutOfMemeory 발생
response.setContentType(mimetype);
//response.setHeader("Content-Disposition", "attachment; filename=\"" + URLEncoder.encode(fvo.getOrignlFileNm(), "utf-8") + "\"");
setDisposition(fvo.getOrignlFileNm(), request, response);
//response.setContentLength(fSize);
/*
* FileCopyUtils.copy(in, response.getOutputStream());
* in.close();
* response.getOutputStream().flush();
* response.getOutputStream().close();
*/
// Try-with-resources를 이용한 자원 해제 처리 (try 구문에 선언한 리소스를 자동 반납)
// try에 전달할 수 있는 자원은 java.lang.AutoCloseable 인터페이스의 구현 객체로 한정
try (BufferedInputStream in = new BufferedInputStream(new FileInputStream(uFile));
BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());){
FileCopyUtils.copy(in, out);
out.flush();
} catch (FileNotFoundException ex) {
log.debug("IGNORED: {}", ex.getMessage());
}
} else {
throw new EgovBizException();
}
}
}

View File

@ -0,0 +1,94 @@
package egovframework.com.cmm.web;
import java.util.Base64;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.egovframe.rte.fdl.cryptography.EgovCryptoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import egovframework.com.cmm.ResponseCode;
import egovframework.com.cmm.service.EgovFileMngService;
import egovframework.com.cmm.service.FileVO;
import egovframework.com.cmm.service.ResultVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
/**
* , ,
* @author
* @since 2009.06.01
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.03.25
* 2011.08.31 JJY 릿
*
* </pre>
*/
@RestController
@Tag(name="EgovFileMngApiController",description = "파일 관리")
public class EgovFileMngApiController {
@Resource(name = "EgovFileMngService")
private EgovFileMngService fileService;
/** 암호화서비스 */
@Resource(name="egovARIACryptoService")
EgovCryptoService cryptoService;
/**
* .
*
* @param atchFileId
* @param fileSn
* @return resultVO
* @throws Exception
*/
@Operation(
summary = "파일 삭제",
description = "첨부파일에 대한 삭제를 처리",
tags = {"EgovFileMngApiController"}
)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "성공")
})
@PostMapping(value ="/cmm/fms/deleteFileInfsAPI.do")
public ResultVO deleteFileInf(HttpServletRequest request, @RequestBody FileVO fileVO) throws Exception {
ResultVO resultVO = new ResultVO();
// 암호화된 atchFileId 를 복호화 (2022.12.06 추가) - 파일아이디가 유추 불가능하도록 조치
String atchFileId = fileVO.getAtchFileId().replaceAll(" ", "+");
byte[] decodedBytes = Base64.getDecoder().decode(atchFileId);
String decodedFileId = new String(cryptoService.decrypt(decodedBytes,EgovFileDownloadController.ALGORITM_KEY));
fileVO.setAtchFileId(decodedFileId);
//Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();
fileService.deleteFileInf(fileVO);
resultVO.setResultCode(200);
resultVO.setResultMessage("삭제 성공");
//--------------------------------------------
// contextRoot가 있는 경우 제외 시켜야 함
//--------------------------------------------
////return "forward:/cmm/fms/selectFileInfs.do";
//return "forward:" + returnUrl;
return resultVO;
}
}

View File

@ -0,0 +1,143 @@
package egovframework.com.cmm.web;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Base64;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletResponse;
import org.egovframe.rte.fdl.cryptography.EgovCryptoService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import egovframework.com.cmm.EgovWebUtil;
import egovframework.com.cmm.SessionVO;
import egovframework.com.cmm.service.EgovFileMngService;
import egovframework.com.cmm.service.FileVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
/**
* @Class Name : EgovImageProcessController.java
* @Description :
* @Modification Information
*
*
* ------- ------- -------------------
* 2009. 4. 2.
* 2011.08.31. JJY 릿
*
* @author
* @since 2009. 4. 2.
* @version
* @see
*
*/
@Slf4j
@Controller
@Tag(name="EgovImageProcessController",description = "이미지 처리")
public class EgovImageProcessController extends HttpServlet {
/**
* serialVersion UID
*/
private static final long serialVersionUID = -6339945210971171173L;
@Resource(name = "EgovFileMngService")
private EgovFileMngService fileService;
/** 암호화서비스 */
@Resource(name="egovARIACryptoService")
EgovCryptoService cryptoService;
/**
* .
*
* @param atchFileId
* @param fileSn
* @param sessionVO
* @param model
* @param response
* @throws Exception
*/
@Operation(
summary = "이미지 미리보기",
description = "첨부된 이미지에 대한 미리보기 기능을 제공",
tags = {"EgovImageProcessController"}
)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "성공")
})
@GetMapping("/cmm/fms/getImage.do")
public void getImageInf(SessionVO sessionVO, ModelMap model, @RequestParam Map<String, Object> commandMap,
HttpServletResponse response) throws Exception {
// 암호화된 atchFileId 를 복호화. (2022.12.06 추가) - 파일아이디가 유추 불가능하도록 조치
String param_atchFileId = (String) commandMap.get("atchFileId");
param_atchFileId = param_atchFileId.replaceAll(" ", "+");
byte[] decodedBytes = Base64.getDecoder().decode(param_atchFileId);
String decodedFileId = new String(cryptoService.decrypt(decodedBytes,EgovFileDownloadController.ALGORITM_KEY));
String fileSn = (String) commandMap.get("fileSn");
FileVO vo = new FileVO();
vo.setAtchFileId(decodedFileId);
vo.setFileSn(fileSn);
FileVO fvo = fileService.selectFileInf(vo);
//String fileLoaction = fvo.getFileStreCours() + fvo.getStreFileNm();
String fileStreCours = EgovWebUtil.filePathBlackList(fvo.getFileStreCours());
String streFileNm = EgovWebUtil.filePathBlackList(fvo.getStreFileNm());
File file = new File(fileStreCours, streFileNm);
// Try-with-resources를 이용한 자원 해제 처리 (try 구문에 선언한 리소스를 자동 반납)
// try에 전달할 수 있는 자원은 java.lang.AutoCloseable 인터페이스의 구현 객체로 한정
try (FileInputStream fis = new FileInputStream(file);
BufferedInputStream in = new BufferedInputStream(fis);
ByteArrayOutputStream bStream = new ByteArrayOutputStream();) {
int imgByte;
while ((imgByte = in.read()) != -1) {
bStream.write(imgByte);
}
String type = "";
if (fvo.getFileExtsn() != null && !"".equals(fvo.getFileExtsn())) {
if ("jpg".equals(fvo.getFileExtsn().toLowerCase())) {
type = "image/jpeg";
} else {
type = "image/" + fvo.getFileExtsn().toLowerCase();
}
type = "image/" + fvo.getFileExtsn().toLowerCase();
} else {
log.debug("Image fileType is null.");
}
response.setHeader("Content-Type", type);
response.setContentLength(bStream.size());
bStream.writeTo(response.getOutputStream());
response.getOutputStream().flush();
response.getOutputStream().close();
} catch (IOException e) {
log.debug("{}", e);
}
}
}

View File

@ -0,0 +1,149 @@
package egovframework.com.cmm.web;
/*
* Copyright 2001-2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the ";License&quot;);
* 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.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.let.utl.fcc.service.EgovFileUploadUtil;
import lombok.extern.slf4j.Slf4j;
/**
*
*
* @author
* @since 2009.06.01
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ---------- -------- ---------------------------
* 2009.03.25
* 2011.06.11 3.0 API
* 2020.10.27
* 2020.10.29 (globals.properties > Globals.fileUpload.Extensions)
*
* </pre>
*/
@Slf4j
public class EgovMultipartResolver extends CommonsMultipartResolver {
public EgovMultipartResolver() {
}
/**
* multipart resolver .
*
* @param servletContext
*/
public EgovMultipartResolver(ServletContext servletContext) {
super(servletContext);
}
/**
* multipart parsing .
*/
@Override
protected MultipartParsingResult parseFileItems(List<FileItem> fileItems, String encoding) {
// 스프링 3.0변경으로 수정한 부분
MultiValueMap<String, MultipartFile> multipartFiles = new LinkedMultiValueMap<String, MultipartFile>();
Map<String, String[]> multipartParameters = new HashMap<String, String[]>();
String whiteListFileUploadExtensions = EgovProperties.getProperty("Globals.fileUpload.Extensions");
Map<String, String> mpParamContentTypes = new HashMap<String, String>();
// Extract multipart files and multipart parameters.
for (Iterator<FileItem> 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) {
log.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);
log.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);
log.debug("Found File Extension = "+fileExtension);
if (whiteListFileUploadExtensions == null || "".equals(whiteListFileUploadExtensions)) {
log.debug("The file extension whitelist has not been set.");
} else {
if (fileName == null || "".equals(fileName)) {
log.debug("No file name.");
} else {
if ("".equals(fileExtension)) { // 확장자 없는 경우 처리 불가
throw new SecurityException("[No file extension] File extension not allowed.");
}
if ((whiteListFileUploadExtensions+".").contains("."+fileExtension.toLowerCase()+".")) {
log.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 처리
}
}

View File

@ -0,0 +1,45 @@
package egovframework.com.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.PropertySources;
/**
*
* @author :
* @since : 2023. 8. 9.
* @version : 1.0
*
* @package : egovframework.com.config
* @filename : EgovConfigApp.java
* @modificationInformation
*
* <pre>
* << (Modification Information) >>
*
*
* ---------- ---------- ----------------------
* 2023. 8. 9.
* </pre>
*
*
*/
@Configuration
@Import({
EgovConfigAppAspect.class,
EgovConfigAppCommon.class,
EgovConfigAppDatasource.class,
EgovConfigAppIdGen.class,
EgovConfigAppProperties.class,
EgovConfigAppMapper.class,
EgovConfigAppTransaction.class,
EgovConfigAppValidator.class,
EgovConfigAppWhitelist.class
})
@PropertySources({
@PropertySource("classpath:/application.properties")
}) //CAUTION: min JDK 8
public class EgovConfigApp {
}

View File

@ -0,0 +1,94 @@
package egovframework.com.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.util.AntPathMatcher;
import egovframework.com.cmm.EgovComExcepHndlr;
import egovframework.com.cmm.EgovComOthersExcepHndlr;
import egovframework.com.cmm.interceptor.AopExceptionTransfer;
import org.egovframe.rte.fdl.cmmn.aspect.ExceptionTransfer;
import org.egovframe.rte.fdl.cmmn.exception.handler.ExceptionHandler;
import org.egovframe.rte.fdl.cmmn.exception.manager.DefaultExceptionHandleManager;
import org.egovframe.rte.fdl.cmmn.exception.manager.ExceptionHandlerService;
/**
* @ClassName : EgovConfigAppAspect.java
* @Description : Aspect
*
* @author :
* @since : 2021. 7. 20
* @version : 1.0
*
* <pre>
* << (Modification Information) >>
*
*
* ------------- ------------ ---------------------
* 2021. 7. 20
* </pre>
*
*/
@Configuration
@EnableAspectJAutoProxy
public class EgovConfigAppAspect {
@Autowired
AntPathMatcher antPathMatcher;
@Bean
public EgovComExcepHndlr egovHandler() {
EgovComExcepHndlr egovComExcepHndlr = new EgovComExcepHndlr();
return egovComExcepHndlr;
}
@Bean
public EgovComOthersExcepHndlr otherHandler() {
EgovComOthersExcepHndlr egovComOthersExcepHndlr = new EgovComOthersExcepHndlr();
return egovComOthersExcepHndlr;
}
@Bean
public DefaultExceptionHandleManager defaultExceptionHandleManager(ExceptionHandler egovHandler) {
DefaultExceptionHandleManager defaultExceptionHandleManager = new DefaultExceptionHandleManager();
defaultExceptionHandleManager.setReqExpMatcher(antPathMatcher);
defaultExceptionHandleManager.setPatterns(new String[] {"**service.impl.*"});
defaultExceptionHandleManager.setHandlers(new ExceptionHandler[] {egovHandler});
return defaultExceptionHandleManager;
}
@Bean
public DefaultExceptionHandleManager otherExceptionHandleManager() {
DefaultExceptionHandleManager defaultExceptionHandleManager = new DefaultExceptionHandleManager();
defaultExceptionHandleManager.setReqExpMatcher(antPathMatcher);
defaultExceptionHandleManager.setPatterns(new String[] {"**service.impl.*"});
defaultExceptionHandleManager.setHandlers(new ExceptionHandler[] {otherHandler()});
return defaultExceptionHandleManager;
}
/**
* @return
* Exception ExceptionTransfer
*/
@Bean
public ExceptionTransfer exceptionTransfer(
@Qualifier("defaultExceptionHandleManager") DefaultExceptionHandleManager defaultExceptionHandleManager,
@Qualifier("otherExceptionHandleManager") DefaultExceptionHandleManager otherExceptionHandleManager) {
ExceptionTransfer exceptionTransfer = new ExceptionTransfer();
exceptionTransfer.setExceptionHandlerService(new ExceptionHandlerService[] {
defaultExceptionHandleManager, otherExceptionHandleManager
});
return exceptionTransfer;
}
@Bean
public AopExceptionTransfer aopExceptionTransfer(ExceptionTransfer exceptionTransfer) {
AopExceptionTransfer aopExceptionTransfer = new AopExceptionTransfer();
aopExceptionTransfer.setExceptionTransfer(exceptionTransfer);
return aopExceptionTransfer;
}
}

View File

@ -0,0 +1,171 @@
package egovframework.com.config;
import java.util.HashMap;
import java.util.Map;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import org.springframework.util.AntPathMatcher;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
import egovframework.com.cmm.EgovComTraceHandler;
import egovframework.com.cmm.ImagePaginationRenderer;
import egovframework.com.cmm.web.EgovMultipartResolver;
import org.egovframe.rte.fdl.cmmn.trace.LeaveaTrace;
import org.egovframe.rte.fdl.cmmn.trace.handler.TraceHandler;
import org.egovframe.rte.fdl.cmmn.trace.manager.DefaultTraceHandleManager;
import org.egovframe.rte.fdl.cmmn.trace.manager.TraceHandlerService;
import org.egovframe.rte.fdl.cryptography.EgovPasswordEncoder;
import org.egovframe.rte.fdl.cryptography.impl.EgovARIACryptoServiceImpl;
import org.egovframe.rte.ptl.mvc.tags.ui.pagination.DefaultPaginationManager;
import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationRenderer;
/**
* @ClassName : EgovConfigAppCommon.java
* @Description : Bean
*
* @author :
* @since : 2021. 7. 20
* @version : 1.0
*
* <pre>
* << (Modification Information) >>
*
*
* ------------- ------------ ---------------------
* 2021. 7. 20
* 2023. 5. 05 crlee remove EgovMessageSource config
* </pre>
*
*/
@Configuration
@ComponentScan(basePackages = "egovframework", includeFilters = {
@ComponentScan.Filter(type = FilterType.ANNOTATION, value = Service.class),
@ComponentScan.Filter(type = FilterType.ANNOTATION, value = Repository.class)
}, excludeFilters = {
@ComponentScan.Filter(type = FilterType.ANNOTATION, value = Controller.class),
@ComponentScan.Filter(type = FilterType.ANNOTATION, value = Configuration.class)
})
public class EgovConfigAppCommon {
/**
* @return AntPathMatcher . Ant
*/
@Bean
public AntPathMatcher antPathMatcher() {
return new AntPathMatcher();
}
/**
* @return [LeaveaTrace ] defaultTraceHandler
*/
@Bean
public EgovComTraceHandler defaultTraceHandler() {
return new EgovComTraceHandler();
}
/**
* @return [LeaveaTrace ] traceHandlerService . TraceHandler
*/
@Bean
public DefaultTraceHandleManager traceHandlerService() {
DefaultTraceHandleManager defaultTraceHandleManager = new DefaultTraceHandleManager();
defaultTraceHandleManager.setReqExpMatcher(antPathMatcher());
defaultTraceHandleManager.setPatterns(new String[] {"*"});
defaultTraceHandleManager.setHandlers(new TraceHandler[] {defaultTraceHandler()});
return defaultTraceHandleManager;
}
/**
* @return [LeaveaTrace ] LeaveaTrace
*/
@Bean
public LeaveaTrace leaveaTrace() {
LeaveaTrace leaveaTrace = new LeaveaTrace();
leaveaTrace.setTraceHandlerServices(new TraceHandlerService[] {traceHandlerService()});
return leaveaTrace;
}
/**
* @return [ImagePaginationRenderer ] ImagePaginationRenderer
*/
@Bean
public ImagePaginationRenderer imageRenderer() {
return new ImagePaginationRenderer();
}
/**
* @return [ImagePaginationRenderer ] defaultPaginationManager .
*/
@Bean
public DefaultPaginationManager paginationManager() {
DefaultPaginationManager defaultPaginationManager = new DefaultPaginationManager();
Map<String, PaginationRenderer> rendererType = new HashMap<>();
rendererType.put("image", imageRenderer());
defaultPaginationManager.setRendererType(rendererType);
return defaultPaginationManager;
}
/**
* @return [MultipartResolver ] CommonsMultipartResolver
*/
@Bean
public CommonsMultipartResolver springRegularCommonsMultipartResolver() {
CommonsMultipartResolver commonsMultipartResolver = new CommonsMultipartResolver();
commonsMultipartResolver.setMaxUploadSize(100000000);
commonsMultipartResolver.setSupportedMethods("POST","PUT");
commonsMultipartResolver.setMaxInMemorySize(100000000);
return commonsMultipartResolver;
}
/**
* : globals.properties > Globals.fileUpload.Extensions
* @return [MultipartResolver ] EgovMultipartResolver
*/
@Bean
public EgovMultipartResolver localMultiCommonsMultipartResolver() {
EgovMultipartResolver egovMultipartResolver = new EgovMultipartResolver();
egovMultipartResolver.setSupportedMethods("POST","PUT");
egovMultipartResolver.setMaxUploadSize(100000000);
egovMultipartResolver.setMaxInMemorySize(100000000);
return egovMultipartResolver;
}
@Bean
public CommonsMultipartResolver multipartResolver() {
return localMultiCommonsMultipartResolver();
}
/**
*
* @return [EgovPasswordEncoder ] EgovPasswordEncoder
*/
@Bean
public EgovPasswordEncoder egovPasswordEncoder() {
EgovPasswordEncoder egovPasswordEncoder = new EgovPasswordEncoder();
egovPasswordEncoder.setAlgorithm("SHA-256");
egovPasswordEncoder.setHashedPassword("gdyYs/IZqY86VcWhT8emCYfqY1ahw2vtLG+/FzNqtrQ=");
return egovPasswordEncoder;
}
/**
*
* @return [EgovARIACryptoServiceImpl ] EgovARIACryptoServiceImpl
*/
@Bean
public EgovARIACryptoServiceImpl egovARIACryptoService() {
EgovARIACryptoServiceImpl egovARIACryptoServiceImpl = new EgovARIACryptoServiceImpl();
egovARIACryptoServiceImpl.setPasswordEncoder(egovPasswordEncoder());
egovARIACryptoServiceImpl.setBlockSize(1024);
return egovARIACryptoServiceImpl;
}
}

View File

@ -0,0 +1,114 @@
package egovframework.com.config;
import javax.annotation.PostConstruct;
import javax.sql.DataSource;
import org.apache.commons.dbcp2.BasicDataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
/**
* @ClassName : EgovConfigAppDatasource.java
* @Description : DataSource
*
* @author :
* @since : 2021. 7. 20
* @version : 1.0
*
* <pre>
* << (Modification Information) >>
*
*
* ------------- ------------ ---------------------
* 2021. 7. 20
* </pre>
*
*/
@Configuration
public class EgovConfigAppDatasource {
/**
* @Value
*/
// @Value("${Globals.DbType}")
// private String dbType;
//
// @Value("${Globals.DriverClassName}")
// private String className;
//
// @Value("${Globals.Url}")
// private String url;
//
// @Value("${Globals.UserName}")
// private String userName;
//
// @Value("${Globals.Password}")
// private String password;
/**
* Environment
*/
@Autowired
Environment env;
private String dbType;
private String className;
private String url;
private String userName;
private String password;
@PostConstruct
void init() {
dbType = env.getProperty("Globals.DbType");
//Exception 처리 필요
className = env.getProperty("Globals." + dbType + ".DriverClassName");
url = env.getProperty("Globals." + dbType + ".Url");
userName = env.getProperty("Globals." + dbType + ".UserName");
password = env.getProperty("Globals." + dbType + ".Password");
}
/**
* @return [dataSource ] HSQL
*/
private DataSource dataSourceHSQL() {
return new EmbeddedDatabaseBuilder()
.setType(EmbeddedDatabaseType.HSQL)
.setScriptEncoding("UTF8")
.addScript("classpath:/db/shtdb.sql")
// .addScript("classpath:/otherpath/other.sql")
.build();
}
/**
* @return [dataSource ] basicDataSource
*/
private DataSource basicDataSource() {
BasicDataSource basicDataSource = new BasicDataSource();
basicDataSource.setDriverClassName(className);
basicDataSource.setUrl(url);
basicDataSource.setUsername(userName);
basicDataSource.setPassword(password);
return basicDataSource;
}
/**
* @return [DataSource ]
*/
@Bean(name = {"dataSource", "egov.dataSource", "egovDataSource"})
public DataSource dataSource() {
if ("hsql".equals(dbType)) {
return dataSourceHSQL();
} else {
return basicDataSource();
}
}
}

View File

@ -0,0 +1,90 @@
package egovframework.com.config;
import java.io.IOException;
import javax.annotation.PostConstruct;
import javax.sql.DataSource;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.PropertySources;
import org.springframework.core.env.Environment;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.support.lob.DefaultLobHandler;
/**
* @ClassName : EgovConfigAppMapper.java
* @Description : Mapper
*
* @author :
* @since : 2021. 7. 20
* @version : 1.0
*
* <pre>
* << (Modification Information) >>
*
*
* ------------- ------------ ---------------------
* 2021. 7. 20
* </pre>
*
*/
@Configuration
@PropertySources({
@PropertySource("classpath:/application.properties")
})
public class EgovConfigAppMapper {
@Autowired
DataSource dataSource;
@Autowired
Environment env;
private String dbType;
@PostConstruct
void init() {
dbType = env.getProperty("Globals.DbType");
}
@Bean
@Lazy
public DefaultLobHandler lobHandler() {
return new DefaultLobHandler();
}
@Bean(name = {"sqlSession", "egov.sqlSession"})
public SqlSessionFactoryBean sqlSession() {
SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
sqlSessionFactoryBean.setDataSource(dataSource);
PathMatchingResourcePatternResolver pathMatchingResourcePatternResolver = new PathMatchingResourcePatternResolver();
sqlSessionFactoryBean.setConfigLocation(
pathMatchingResourcePatternResolver
.getResource("classpath:/egovframework/mapper/config/mapper-config.xml"));
try {
sqlSessionFactoryBean.setMapperLocations(
pathMatchingResourcePatternResolver
.getResources("classpath:/egovframework/mapper/let/**/*_" + dbType + ".xml"));
} catch (IOException e) {
// TODO Exception 처리 필요
}
return sqlSessionFactoryBean;
}
@Bean
public SqlSessionTemplate egovSqlSessionTemplate(@Qualifier("sqlSession") SqlSessionFactory sqlSession) {
SqlSessionTemplate sqlSessionTemplate = new SqlSessionTemplate(sqlSession);
return sqlSessionTemplate;
}
}

View File

@ -0,0 +1,46 @@
package egovframework.com.config;
import egovframework.com.cmm.EgovMessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
/**
* fileName : EgovConfigAppMsg
* author : crlee
* date : 2023/05/05
* description :
* ===========================================================
* DATE AUTHOR NOTE
* -----------------------------------------------------------
* 2023/05/05 crlee
*/
@Configuration
public class EgovConfigAppMsg {
/**
* @return [Resource ] Properties
*/
@Bean
public ReloadableResourceBundleMessageSource messageSource() {
ReloadableResourceBundleMessageSource reloadableResourceBundleMessageSource = new ReloadableResourceBundleMessageSource();
reloadableResourceBundleMessageSource.setBasenames(
"classpath:/egovframework/message/com/message-common",
"classpath:/org/egovframe/rte/fdl/idgnr/messages/idgnr",
"classpath:/org/egovframe/rte/fdl/property/messages/properties");
reloadableResourceBundleMessageSource.setCacheSeconds(60);
return reloadableResourceBundleMessageSource;
}
/**
* @return [Resource ]
*/
@Bean
public EgovMessageSource egovMessageSource() {
EgovMessageSource egovMessageSource = new EgovMessageSource();
egovMessageSource.setReloadableResourceBundleMessageSource(messageSource());
return egovMessageSource;
}
}

View File

@ -0,0 +1,61 @@
package egovframework.com.config;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.egovframe.rte.fdl.property.impl.EgovPropertyServiceImpl;
/**
* @ClassName : EgovConfigAppProperties.java
* @Description : Properties
*
* @author :
* @since : 2021. 7. 20
* @version : 1.0
*
* <pre>
* << (Modification Information) >>
*
*
* ------------- ------------ ---------------------
* 2021. 7. 20
* </pre>
*
*/
@Configuration
public class EgovConfigAppProperties {
@Value("${Globals.fileStorePath}")
private String fileStorePath;
@Value("${Globals.addedOptions}")
private String addedOptions;
@Value("${Globals.pageUnit}")
private String pageUnit;
@Value("${Globals.pageSize}")
private String pageSize;
@Value("${Globals.posblAtchFileSize}")
private String posblAtchFileSize;
@Bean(destroyMethod = "destroy")
public EgovPropertyServiceImpl propertiesService() {
EgovPropertyServiceImpl egovPropertyServiceImpl = new EgovPropertyServiceImpl();
Map<String, String> properties = new HashMap<String, String>();
properties.put("Globals.pageUnit", pageUnit);
properties.put("Globals.pageSize", pageSize);
properties.put("Globals.posblAtchFileSize", posblAtchFileSize);
properties.put("Globals.fileStorePath", fileStorePath);
properties.put("Globals.addedOptions", addedOptions);
egovPropertyServiceImpl.setProperties(properties);
return egovPropertyServiceImpl;
}
}

View File

@ -0,0 +1,92 @@
package egovframework.com.config;
import java.util.Collections;
import java.util.HashMap;
import javax.sql.DataSource;
import org.springframework.aop.Advisor;
import org.springframework.aop.aspectj.AspectJExpressionPointcut;
import org.springframework.aop.support.DefaultPointcutAdvisor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource;
import org.springframework.transaction.interceptor.RollbackRuleAttribute;
import org.springframework.transaction.interceptor.RuleBasedTransactionAttribute;
import org.springframework.transaction.interceptor.TransactionAttribute;
import org.springframework.transaction.interceptor.TransactionInterceptor;
/**
* @ClassName : EgovConfigAppTransaction.java
* @Description : Transaction
*
* @author :
* @since : 2021. 7. 20
* @version : 1.0
*
* <pre>
* << (Modification Information) >>
*
*
* ------------- ------------ ---------------------
* 2021. 7. 20
* </pre>
*
*/
@Configuration
public class EgovConfigAppTransaction {
@Autowired
DataSource dataSource;
@Bean
public DataSourceTransactionManager txManager() {
DataSourceTransactionManager dataSourceTransactionManager = new DataSourceTransactionManager();
dataSourceTransactionManager.setDataSource(dataSource);
return dataSourceTransactionManager;
}
// -------------------------------------------------------------
// TransactionAdvice 설정
// -------------------------------------------------------------
@Bean
public TransactionInterceptor txAdvice(DataSourceTransactionManager txManager) {
TransactionInterceptor txAdvice = new TransactionInterceptor();
txAdvice.setTransactionManager(txManager);
txAdvice.setTransactionAttributeSource(getNameMatchTransactionAttributeSource());
return txAdvice;
}
private NameMatchTransactionAttributeSource getNameMatchTransactionAttributeSource() {
NameMatchTransactionAttributeSource txAttributeSource = new NameMatchTransactionAttributeSource();
txAttributeSource.setNameMap(getRuleBasedTxAttributeMap());
return txAttributeSource;
}
private HashMap<String, TransactionAttribute> getRuleBasedTxAttributeMap() {
HashMap<String, TransactionAttribute> txMethods = new HashMap<String, TransactionAttribute>();
RuleBasedTransactionAttribute txAttribute = new RuleBasedTransactionAttribute();
txAttribute.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
txAttribute.setRollbackRules(Collections.singletonList(new RollbackRuleAttribute(Exception.class)));
txMethods.put("*", txAttribute);
return txMethods;
}
// -------------------------------------------------------------
// TransactionAdvisor 설정
// -------------------------------------------------------------
@Bean
public Advisor txAdvisor(DataSourceTransactionManager txManager) {
AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut();
pointcut.setExpression(
"execution(* egovframework.let..impl.*Impl.*(..)) or execution(* egovframework.com..*Impl.*(..))");
return new DefaultPointcutAdvisor(pointcut, txAdvice(txManager));
}
}

View File

@ -0,0 +1,79 @@
package egovframework.com.config;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springmodules.validation.commons.DefaultBeanValidator;
import org.springmodules.validation.commons.DefaultValidatorFactory;
/**
* @ClassName : EgovConfigAppValidator.java
* @Description : Validator
*
* @author :
* @since : 2021. 7. 20
* @version : 1.0
*
* <pre>
* << (Modification Information) >>
*
*
* ------------- ------------ ---------------------
* 2021. 7. 20
* </pre>
*
*/
@Configuration
public class EgovConfigAppValidator {
@Bean
public DefaultBeanValidator beanValidator() {
DefaultBeanValidator defaultBeanValidator = new DefaultBeanValidator();
defaultBeanValidator.setValidatorFactory(validatorFactory());
return defaultBeanValidator;
}
/** validation config location
* @return
*/
@Bean
public DefaultValidatorFactory validatorFactory() {
DefaultValidatorFactory defaultValidatorFactory = new DefaultValidatorFactory();
defaultValidatorFactory.setValidationConfigLocations(getValidationConfigLocations());
return defaultValidatorFactory;
}
private Resource[] getValidationConfigLocations() {
PathMatchingResourcePatternResolver pathMatchingResourcePatternResolver = new PathMatchingResourcePatternResolver();
List<Resource> validationConfigLocations = new ArrayList<Resource>();
Resource[] validationRulesConfigLocations = new Resource[] {
pathMatchingResourcePatternResolver
.getResource("classpath:/egovframework/validator/validator-rules-let.xml")
};
Resource[] validationFormSetLocations = new Resource[] {};
try {
validationFormSetLocations = pathMatchingResourcePatternResolver
.getResources("classpath:/egovframework/validator/let/**/*.xml");
} catch (IOException e) {
// TODO Exception 처리 필요
}
validationConfigLocations.addAll(Arrays.asList(validationRulesConfigLocations));
validationConfigLocations.addAll(Arrays.asList(validationFormSetLocations));
return validationConfigLocations.toArray(new Resource[validationConfigLocations.size()]);
}
}

View File

@ -0,0 +1,51 @@
package egovframework.com.config;
import java.util.ArrayList;
import java.util.List;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @ClassName : EgovConfigAppWhitelist.java
* @Description : whiteList
*
* @author :
* @since : 2021. 7. 20
* @version : 1.0
*
* <pre>
* << (Modification Information) >>
*
*
* ------------- ------------ ---------------------
* 2021. 7. 20
* </pre>
*
*/
@Configuration
public class EgovConfigAppWhitelist {
@Bean
public List<String> egovPageLinkWhitelist() {
List<String> whiteList = new ArrayList<String>();
whiteList.add("main/inc/EgovIncHeader");
whiteList.add("main/inc/EgovIncTopnav");
whiteList.add("main/inc/EgovIncLeftmenu");
whiteList.add("main/inc/EgovIncFooter");
whiteList.add("main/sample_menu/Intro");
whiteList.add("main/sample_menu/EgovDownloadDetail");
whiteList.add("main/sample_menu/EgovDownloadModify");
whiteList.add("main/sample_menu/EgovQADetail");
whiteList.add("main/sample_menu/EgovAboutSite");
whiteList.add("main/sample_menu/EgovHistory");
whiteList.add("main/sample_menu/EgovOrganization");
whiteList.add("main/sample_menu/EgovLocation");
whiteList.add("main/sample_menu/EgovProductInfo");
whiteList.add("main/sample_menu/EgovServiceInfo");
whiteList.add("main/sample_menu/EgovDownload");
whiteList.add("main/sample_menu/EgovQA");
whiteList.add("main/sample_menu/EgovService");
return whiteList;
}
}

View File

@ -0,0 +1,126 @@
package egovframework.com.config;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import egovframework.com.cmm.interceptor.AuthenticInterceptor;
import egovframework.com.cmm.interceptor.CustomAuthenticInterceptor;
/**
* @ClassName : EgovConfigWebDispatcherServlet.java
* @Description : DispatcherServlet
*
* @author :
* @since : 2021. 7. 20
* @version : 1.0
*
* <pre>
* << (Modification Information) >>
*
*
* ------------- ------------ ---------------------
* 2021. 7. 20
* </pre>
*
*/
@Configuration
@ComponentScan(basePackages = "egovframework", excludeFilters = {
@ComponentScan.Filter(type = FilterType.ANNOTATION, value = Service.class),
@ComponentScan.Filter(type = FilterType.ANNOTATION, value = Repository.class),
@ComponentScan.Filter(type = FilterType.ANNOTATION, value = Configuration.class)
})
public class EgovConfigWebDispatcherServlet implements WebMvcConfigurer {
//final static String RESOLVER_DEFAULT_ERROR_VIEW = "cmm/error/egovError";
//final static int URL_BASED_VIEW_RESOLVER_ORDER = 1;
//final static String URL_BASED_VIEW_RESOLVER_PREFIX = "/WEB-INF/jsp/";
//final static String URL_BASED_VIEW_RESOLVER_SUFFIX = ".jsp";
//private final String[] CORS_ORIGIN_SERVER_URLS = {"http://127.0.0.1:3000", "http://localhost:3000"};
// =====================================================================
// RequestMappingHandlerMapping 설정
// =====================================================================
// -------------------------------------------------------------
// RequestMappingHandlerMapping 설정 - Interceptor 추가
// -------------------------------------------------------------
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new AuthenticInterceptor())
.addPathPatterns(
// "/cop/com/*.do",
// "/cop/bbs/*Master*.do",
"/auth/*")
.excludePathPatterns(
"/auth/login",
"/auth/login-jwt",
"/auth/logout"
);
registry.addInterceptor(new CustomAuthenticInterceptor())
.addPathPatterns(
"/**/*.do")
.excludePathPatterns(
"/auth/**");
}
// -------------------------------------------------------------
// RequestMappingHandlerMapping 설정 View Controller 추가
// -------------------------------------------------------------
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/cmmn/validator.do")
.setViewName("cmmn/validator");
registry.addViewController("/").setViewName("forward:/index.html");
}
// -------------------------------------------------------------
// HandlerExceptionResolver 설정
// -------------------------------------------------------------
/*
@Override
public void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers) {
SimpleMappingExceptionResolver simpleMappingExceptionResolver = new SimpleMappingExceptionResolver();
simpleMappingExceptionResolver.setDefaultErrorView(RESOLVER_DEFAULT_ERROR_VIEW);
Properties mappings = new Properties();
mappings.setProperty("org.springframework.dao.DataAccessException", "cmm/error/dataAccessFailure");
mappings.setProperty("org.springframework.transaction.TransactionException", "cmm/error/transactionFailure");
mappings.setProperty("org.egovframe.rte.fdl.cmmn.exception.EgovBizException", "cmm/error/egovError");
mappings.setProperty("org.springframework.security.AccessDeniedException", "cmm/error/accessDenied");
simpleMappingExceptionResolver.setExceptionMappings(mappings);
exceptionResolvers.add(simpleMappingExceptionResolver);
}
*/
// -------------------------------------------------------------
// View Resolver 설정
// -------------------------------------------------------------
/*
* @Bean public UrlBasedViewResolver urlBasedViewResolver() {
* UrlBasedViewResolver urlBasedViewResolver = new UrlBasedViewResolver();
* urlBasedViewResolver.setOrder(URL_BASED_VIEW_RESOLVER_ORDER);
* urlBasedViewResolver.setViewClass(JstlView.class);
* urlBasedViewResolver.setPrefix(URL_BASED_VIEW_RESOLVER_PREFIX);
* urlBasedViewResolver.setSuffix(URL_BASED_VIEW_RESOLVER_SUFFIX); return
* urlBasedViewResolver; }
*/
// -------------------------------------------------------------
// CORS 설정 추가
// -------------------------------------------------------------
// @Override
// public void addCorsMappings(CorsRegistry registry) {
// registry.addMapping("*.do").allowedOrigins(CORS_ORIGIN_SERVER_URLS);
// }
}

View File

@ -0,0 +1,121 @@
package egovframework.com.config;
import javax.servlet.FilterRegistration;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration;
import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;
import lombok.extern.slf4j.Slf4j;
/**
* @ClassName : EgovWebApplicationInitializer.java
* @Description : 3.10 EgovWebApplicationInitializer
*
* @author :
* @since : 2021. 7. 20
* @version : 1.0
*
* <pre>
* << (Modification Information) >>
*
*
* ------------- ------------ ---------------------
* 2021. 7. 20
* </pre>
*
*/
@Slf4j
public class EgovWebApplicationInitializer implements WebApplicationInitializer {
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
log.debug("EgovWebApplicationInitializer START-============================================");
// -------------------------------------------------------------
// Spring Root Context 설정
// -------------------------------------------------------------
addRootContext(servletContext);
// -------------------------------------------------------------
// Spring Servlet Context 설정
// -------------------------------------------------------------
addWebServletContext(servletContext);
// -------------------------------------------------------------
// Egov Web ServletContextListener 설정 - System property setting
// -------------------------------------------------------------
servletContext.addListener(new egovframework.com.config.EgovWebServletContextListener());
// -------------------------------------------------------------
// 필터설정
// -------------------------------------------------------------
addFilters(servletContext);
log.debug("EgovWebApplicationInitializer END-============================================");
}
/**
* @param servletContext
* Root Context .
*/
private void addRootContext(ServletContext servletContext) {
AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
rootContext.register(EgovConfigApp.class);
servletContext.addListener(new ContextLoaderListener(rootContext));
}
/**
* @param servletContext
* Servlet Context .
*/
private void addWebServletContext(ServletContext servletContext) {
AnnotationConfigWebApplicationContext webApplicationContext = new
AnnotationConfigWebApplicationContext();
webApplicationContext.register(EgovConfigWebDispatcherServlet.class);
ServletRegistration.Dynamic dispatcher = servletContext.addServlet("action",
new DispatcherServlet(webApplicationContext));
dispatcher.setLoadOnStartup(1);
dispatcher.addMapping("*.do"); }
/**
* @param servletContext
* .
*/
private void addFilters(ServletContext servletContext) {
addEncodingFilter(servletContext);
// addCORSFilter(servletContext);
}
/**
* @param servletContext
* Spring CharacterEncodingFilter
*/
private void addEncodingFilter(ServletContext servletContext) {
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");
}
/**
* @param servletContext
* CORSFilter
*/
// private void addCORSFilter(ServletContext servletContext) {
// FilterRegistration.Dynamic corsFilter = servletContext.addFilter("SimpleCORSFilter",
// new SimpleCORSFilter());
// corsFilter.addMappingForUrlPatterns(null, false, "*.do");
// }
}

View File

@ -0,0 +1,61 @@
package egovframework.com.config;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import egovframework.com.cmm.service.EgovProperties;
import lombok.extern.slf4j.Slf4j;
/**
*
* @author :
* @since : 2023. 8. 9.
* @version : 1.0
*
* @package : egovframework.com.config
* @filename : EgovWebServletContextListener.java
* @modificationInformation
*
* <pre>
* << (Modification Information) >>
*
*
* ---------- ---------- ----------------------
* 2023. 8. 9.
* </pre>
*
*
*/
@Slf4j
public class EgovWebServletContextListener implements ServletContextListener {
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 {
log.debug("===========================Start EgovServletContextLoad START ===========");
System.setProperty("spring.profiles.active",
EgovProperties.getProperty("Globals.DbType") + "," + EgovProperties.getProperty("Globals.Auth"));
log.debug("Setting spring.profiles.active>" + System.getProperty("spring.profiles.active"));
log.debug("===========================END EgovServletContextLoad END ===========");
} catch (IllegalArgumentException e) {
log.error("[IllegalArgumentException] Try/Catch...usingParameters Runing : " + e.getMessage());
}
}
}

View File

@ -0,0 +1,91 @@
package egovframework.com.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
//accessToken 입력 화면과 처리 라이브러리 추가(아래4줄)
import springfox.documentation.spi.service.contexts.SecurityContext;
import springfox.documentation.service.*;
import java.util.Arrays;
import java.util.List;
/**
*
* @author :
* @since : 2023. 8. 9.
* @version : 1.0
*
* @package : egovframework.com.config
* @filename : SwaggerConfig.java
* @modificationInformation
*
* <pre>
* << (Modification Information) >>
*
*
* ---------- ---------- ----------------------
* 2023. 8. 9.
* </pre>
*
*
*/
@Configuration
@EnableSwagger2
public class SwaggerConfig {
private static final String API_NAME = "Simple Homepage Project API";
private static final String API_VERSION = "4.1.0";
private static final String API_DESCRIPTION = "심플홈페이지 프로젝트 명세서";
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("egovframework"))
.paths(PathSelectors.any())
.build()
.securityContexts(Arrays.asList(securityContext())) // 스웨그에서 컨텐츠 url 접근 시 인증처리를 위한 보안 규칙 호출
.securitySchemes(Arrays.asList(apiKey())); // 스웨그 화면상단에 토큰값 입력하는 창 구조 호출, 여기에 배열로 추가 apiKey메서드를 입력가능
}
// Authorization창에 Token값 입력 화면 구조
private ApiKey apiKey() {
return new ApiKey("Authorization", "Authorization", "header");
}
// 스웨그에서 컨텐츠 url 접근 시 인증처리를 위한 보안 규칙 추가(아래)
private SecurityContext securityContext() {
return springfox
.documentation
.spi.service
.contexts
.SecurityContext
.builder()
.securityReferences(defaultAuth()).operationSelector(operationContext -> true).build();
}
// 토큰 인증영역 배열리스트을 반환하는 매서드
List<SecurityReference> defaultAuth() {
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); // 인증영역 객체 생성
AuthorizationScope[] authorizationScopeArray = new AuthorizationScope[1]; // 빈 배열 인증영역 객체 생성
authorizationScopeArray[0] = authorizationScope; // 배열변수에 인증영역 객체 등록
return Arrays.asList(new SecurityReference("Authorization", authorizationScopeArray)); // 여기에 배열로 추가 SecurityReference객체를 입력가능
}
public ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title(API_NAME)
.version(API_VERSION)
.description(API_DESCRIPTION)
.contact(new Contact("eGovFrame", "https://www.egovframe.go.kr/", "egovframesupport@gmail.com"))
.build();
}
}

View File

@ -0,0 +1,102 @@
package egovframework.com.jwt;
import java.io.Serializable;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;
import org.springframework.stereotype.Component;
import egovframework.com.cmm.LoginVO;
import egovframework.com.cmm.service.EgovProperties;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import lombok.extern.slf4j.Slf4j;
/**
*
* @author :
* @since : 2023. 8. 9.
* @version : 1.0
*
* @package : egovframework.com.jwt
* @filename : EgovJwtTokenUtil.java
* @modificationInformation
*
* <pre>
* << (Modification Information) >>
*
*
* ---------- ---------- ----------------------
* 2023. 8. 9.
* </pre>
*
*
*/
//security 관련 제외한 jwt util 클래스
@Slf4j
@Component
public class EgovJwtTokenUtil implements Serializable{
private static final long serialVersionUID = -5180902194184255251L;
//public static final long JWT_TOKEN_VALIDITY = 24 * 60 * 60; //하루
public static final long JWT_TOKEN_VALIDITY = (long) ((1 * 60 * 60) / 60) * 60; //토큰의 유효시간 설정, 기본 60분
public static final String SECRET_KEY = EgovProperties.getProperty("Globals.jwt.secret");
//retrieve username from jwt token
public String getUserIdFromToken(String token) {
Claims claims = getClaimFromToken(token);
return claims.get("id").toString();
}
public String getUserSeFromToken(String token) {
Claims claims = getClaimFromToken(token);
return claims.get("userSe").toString();
}
public String getInfoFromToken(String type, String token) {
Claims claims = getClaimFromToken(token);
return claims.get(type).toString();
}
public Claims getClaimFromToken(String token) {
final Claims claims = getAllClaimsFromToken(token);
return claims;
}
//for retrieveing any information from token we will need the secret key
public Claims getAllClaimsFromToken(String token) {
log.debug("===>>> secret = "+SECRET_KEY);
return Jwts.parser().setSigningKey(SECRET_KEY).parseClaimsJws(token).getBody();
}
//generate token for user
public String generateToken(LoginVO loginVO) {
return doGenerateToken(loginVO, "Authorization");
}
//while creating the token -
//1. Define claims of the token, like Issuer, Expiration, Subject, and the ID
//2. Sign the JWT using the HS512 algorithm and secret key.
//3. According to JWS Compact Serialization(https://tools.ietf.org/html/draft-ietf-jose-json-web-signature-41#section-3.1)
// compaction of the JWT to a URL-safe string
private String doGenerateToken(LoginVO loginVO, String subject) {
Map<String, Object> claims = new HashMap<>();
claims.put("id", loginVO.getId() );
claims.put("name", loginVO.getName() );
claims.put("userSe", loginVO.getUserSe() );
claims.put("orgnztId", loginVO.getOrgnztId() );
claims.put("uniqId", loginVO.getUniqId() );
claims.put("type", subject);
log.debug("===>>> secret = "+SECRET_KEY);
return Jwts.builder().setClaims(claims).setSubject(subject).setIssuedAt(new Date(System.currentTimeMillis()))
.setExpiration(new Date(System.currentTimeMillis() + JWT_TOKEN_VALIDITY * 1000))
.signWith(SignatureAlgorithm.HS512, SECRET_KEY).compact();
}
}

View File

@ -0,0 +1,53 @@
package egovframework.com.jwt;
import com.fasterxml.jackson.databind.ObjectMapper;
import egovframework.com.cmm.EgovWebUtil;
import egovframework.com.cmm.LoginVO;
import egovframework.com.cmm.ResponseCode;
import egovframework.com.cmm.service.ResultVO;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
/**
* fileName : JwtAuthenticationEntryPoint
* author : crlee
* date : 2023/06/11
* description :
* ===========================================================
* DATE AUTHOR NOTE
* -----------------------------------------------------------
* 2023/06/11 crlee
*/
@Component
public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint {
@Override
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException {
ResultVO resultVO = new ResultVO();
resultVO.setResultCode(ResponseCode.AUTH_ERROR.getCode());
resultVO.setResultMessage(ResponseCode.AUTH_ERROR.getMessage());
ObjectMapper mapper = new ObjectMapper();
//Convert object to JSON string
String jsonInString = mapper.writeValueAsString(resultVO);
response.setStatus(HttpStatus.UNAUTHORIZED.value());
response.setContentType(MediaType.APPLICATION_JSON.toString());
response.setCharacterEncoding("UTF-8");
response.getWriter().println(jsonInString);
}
}

View File

@ -0,0 +1,87 @@
package egovframework.com.jwt;
import egovframework.com.cmm.LoginVO;
import egovframework.let.utl.fcc.service.EgovStringUtil;
import io.jsonwebtoken.ExpiredJwtException;
import io.jsonwebtoken.MalformedJwtException;
import io.jsonwebtoken.SignatureException;
import io.jsonwebtoken.UnsupportedJwtException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
import org.springframework.web.filter.OncePerRequestFilter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
/**
* fileName : JwtAuthenticationFilter
* author : crlee
* date : 2023/06/11
* description :
* ===========================================================
* DATE AUTHOR NOTE
* -----------------------------------------------------------
* 2023/06/11 crlee
*/
public class JwtAuthenticationFilter extends OncePerRequestFilter {
@Autowired
private EgovJwtTokenUtil jwtTokenUtil;
public static final String HEADER_STRING = "Authorization";
@Override
protected void doFilterInternal(HttpServletRequest req, HttpServletResponse res, FilterChain chain)
throws IOException, ServletException {
boolean verificationFlag = true;
// step 1. request header에서 토큰을 가져온다.
String jwtToken = EgovStringUtil.isNullToString(req.getHeader(HEADER_STRING));
// step 2. 토큰에 내용이 있는지 확인해서 id값을 가져옴
// Exception 핸들링 추가처리 (토큰 유효성, 토큰 변조 여부, 토큰 만료여부)
// 내부적으로 parse하는 과정에서 해당 여부들이 검증됨
String id = null;
try {
id = jwtTokenUtil.getUserIdFromToken(jwtToken);
if (id == null) {
logger.debug("jwtToken not validate");
verificationFlag = false;
}
logger.debug("===>>> id = " + id);
} catch (IllegalArgumentException | ExpiredJwtException | MalformedJwtException | UnsupportedJwtException | SignatureException e) {
logger.debug("Unable to verify JWT Token: " + e.getMessage());
verificationFlag = false;
}
LoginVO loginVO = new LoginVO();
if( verificationFlag ){
logger.debug("jwtToken validated");
loginVO.setId(id);
loginVO.setUserSe( jwtTokenUtil.getUserSeFromToken(jwtToken) );
loginVO.setUniqId( jwtTokenUtil.getInfoFromToken("uniqId",jwtToken) );
loginVO.setOrgnztId( jwtTokenUtil.getInfoFromToken("orgnztId",jwtToken) );
loginVO.setName( jwtTokenUtil.getInfoFromToken("name",jwtToken) );
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(loginVO, null,
Arrays.asList(new SimpleGrantedAuthority("ROLE_USER"))
);
authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(req));
SecurityContextHolder.getContext().setAuthentication(authentication);
}
chain.doFilter(req, res);
}
}

View File

@ -0,0 +1,45 @@
package egovframework.com.security;
import egovframework.com.cmm.LoginVO;
import org.springframework.core.MethodParameter;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.support.WebDataBinderFactory;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.method.support.ModelAndViewContainer;
/**
* fileName : CustomAuthenticationPrincipalResolver
* author : crlee
* date : 2023/07/13
* description :
* ===========================================================
* DATE AUTHOR NOTE
* -----------------------------------------------------------
* 2023/07/13 crlee
*/
public class CustomAuthenticationPrincipalResolver implements HandlerMethodArgumentResolver {
@Override
public boolean supportsParameter(MethodParameter parameter) {
return parameter.hasParameterAnnotation(AuthenticationPrincipal.class) &&
parameter.getParameterType().equals(LoginVO.class);
}
@Override
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer,
NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication == null ||
authentication.getPrincipal() == null ||
"anonymousUser".equals(authentication.getPrincipal())
) {
return new LoginVO();
}
return authentication.getPrincipal();
}
}

View File

@ -0,0 +1,106 @@
package egovframework.com.security;
import egovframework.com.jwt.JwtAuthenticationEntryPoint;
import egovframework.com.jwt.JwtAuthenticationFilter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.CorsConfigurationSource;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import java.util.Arrays;
/**
* fileName : SecurityConfig
* author : crlee
* date : 2023/06/10
* description :
* ===========================================================
* DATE AUTHOR NOTE
* -----------------------------------------------------------
* 2023/06/10 crlee
*/
@Configuration
@EnableWebSecurity
public class SecurityConfig {
//Http Methpd : Get 인증예외 List
private String[] AUTH_GET_WHITELIST = {
"/schedule/daily", //일별 일정 조회
"/schedule/week", //주간 일정 조회
"/schedule/{schdulId}", //일정 상세조회
};
// 인증 예외 List
private String[] AUTH_WHITELIST = {
"/",
"/login/**",
"/auth/login-jwt",//JWT 로그인
"/auth/login",//일반 로그인
"/cmm/main/**.do", // 메인페이지
"/cmm/fms/FileDown.do", //파일 다운로드
"/cmm/fms/getImage.do", //갤러리 이미지보기
"/cop/bbs/selectUserBBSMasterInfAPI.do", //게시판 마스터 상세 조회
"/cop/bbs/selectBoardListAPI.do", //게시판 목록조회
"/cop/bbs/selectBoardArticleAPI.do", //게시물 상세조회
/* swagger v2 */
"/v2/api-docs",
"/swagger-resources",
"/swagger-resources/**",
"/swagger-ui.html",
"/swagger-ui/**"
};
private static final String[] ORIGINS_WHITELIST = {
"http://localhost:3000",
};
@Bean
public JwtAuthenticationFilter authenticationTokenFilterBean() throws Exception {
return new JwtAuthenticationFilter();
}
@Bean
protected CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration configuration = new CorsConfiguration();
configuration.setAllowedOriginPatterns(Arrays.asList("*"));
configuration.setAllowedMethods(Arrays.asList("HEAD","POST","GET","DELETE","PUT"));
configuration.setAllowedOrigins(Arrays.asList(ORIGINS_WHITELIST));
configuration.setAllowedHeaders(Arrays.asList("*"));
configuration.setAllowCredentials(true);
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", configuration);
return source;
}
@Bean
protected SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
return http
.csrf(AbstractHttpConfigurer::disable)
.authorizeHttpRequests(authorize -> authorize
.antMatchers(AUTH_WHITELIST).permitAll()
.antMatchers(HttpMethod.GET,AUTH_GET_WHITELIST).permitAll()
.anyRequest().authenticated()
).sessionManagement((sessionManagement) ->
sessionManagement.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
)
.cors().and()
.addFilterBefore(authenticationTokenFilterBean(), UsernamePasswordAuthenticationFilter.class)
.exceptionHandling(exceptionHandlingConfigurer ->
exceptionHandlingConfigurer
.authenticationEntryPoint(new JwtAuthenticationEntryPoint())
)
.build();
}
}

View File

@ -0,0 +1,25 @@
package egovframework.com.security;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import java.util.List;
/**
* fileName : WebMvcConfig
* author : crlee
* date : 2023/07/13
* description :
* ===========================================================
* DATE AUTHOR NOTE
* -----------------------------------------------------------
* 2023/07/13 crlee
*/
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
argumentResolvers.add(new CustomAuthenticationPrincipalResolver());
}
}

View File

@ -0,0 +1,195 @@
package egovframework.dbnt.kcsc.standardCode;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;
/**
*
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2023.10.11
*
* </pre>
*/
@RestController
@Tag(name="StandardCodeController",description = "건설기준코드 관리 컨트롤러")
public class StandardCodeController {
/*
@Resource(name = "EgovBBSManageService")
private EgovBBSManageService bbsMngService;
@Resource(name = "EgovBBSAttributeManageService")
private EgovBBSAttributeManageService bbsAttrbService;
@Resource(name = "EgovFileMngService")
private EgovFileMngService fileMngService;*/
/**
* .
*
*
* @param request
* @param searchVO
* @return resultVO
* @throws Exception
*/
/*@Operation(
summary = "게시판 마스터 상세 조회",
description = "게시판 마스터 상세내용을 조회 (파일 첨부가능 여부 조회용)",
tags = {"EgovBBSManageApiController"}
)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "조회 성공"),
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
})
@PostMapping(value = "/cop/bbs/selectUserBBSMasterInfAPI.do", consumes = MediaType.APPLICATION_JSON_VALUE)
public ResultVO selectUserBBSMasterInf(@RequestBody BoardMasterVO searchVO)
throws Exception {
ResultVO resultVO = new ResultVO();
Map<String, Object> resultMap = new HashMap<String, Object>();
BoardMasterVO master = bbsAttrbService.selectBBSMasterInf(searchVO);
resultMap.put("brdMstrVO", master);
resultVO.setResult(resultMap);
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
return resultVO;
}*/
/**
* .
*
* @param boardVO
* @return resultVO
* @throws Exception
*/
/*@Operation(
summary = "게시물 목록 조회",
description = "게시물에 대한 목록을 조회",
tags = {"EgovBBSManageApiController"}
)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "조회 성공"),
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
})
@PostMapping(value = "/cop/bbs/selectBoardListAPI.do", consumes = MediaType.APPLICATION_JSON_VALUE)
public ResultVO selectBoardArticles(@RequestBody BoardVO boardVO, @AuthenticationPrincipal LoginVO user)
throws Exception {
ResultVO resultVO = new ResultVO();
BoardMasterVO vo = new BoardMasterVO();
vo.setBbsId(boardVO.getBbsId());
vo.setUniqId(user.getUniqId());
BoardMasterVO master = bbsAttrbService.selectBBSMasterInf(vo);
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(boardVO.getPageIndex());
paginationInfo.setRecordCountPerPage(propertyService.getInt("Globals.pageUnit"));
paginationInfo.setPageSize(propertyService.getInt("Globals.pageSize"));
boardVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
boardVO.setLastIndex(paginationInfo.getLastRecordIndex());
boardVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
Map<String, Object> resultMap = bbsMngService.selectBoardArticles(boardVO, vo.getBbsAttrbCode());
int totCnt = Integer.parseInt((String)resultMap.get("resultCnt"));
paginationInfo.setTotalRecordCount(totCnt);
resultMap.put("boardVO", boardVO);
resultMap.put("brdMstrVO", master);
resultMap.put("paginationInfo", paginationInfo);
resultMap.put("user", user);
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
resultVO.setResult(resultMap);
return resultVO;
}*/
/**
* .
*
* @param boardVO
* @return resultVO
* @throws Exception
*/
/*@Operation(
summary = "게시물 상세 조회",
description = "게시물에 대한 상세 정보를 조회",
tags = {"EgovBBSManageApiController"}
)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "조회 성공"),
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
})
@PostMapping(value = "/cop/bbs/selectBoardArticleAPI.do")
public ResultVO selectBoardArticle(@RequestBody BoardVO boardVO,@AuthenticationPrincipal LoginVO user)
throws Exception {
ResultVO resultVO = new ResultVO();
// 조회수 증가 여부 지정
boardVO.setPlusCount(true);
//---------------------------------
// 2009.06.29 : 2단계 기능 추가
//---------------------------------
if (!boardVO.getSubPageIndex().equals("")) {
boardVO.setPlusCount(false);
}
////-------------------------------
boardVO.setLastUpdusrId(user.getUniqId());
BoardVO vo = bbsMngService.selectBoardArticle(boardVO);
//----------------------------
// template 처리 (기본 BBS template 지정 포함)
//----------------------------
BoardMasterVO master = new BoardMasterVO();
master.setBbsId(boardVO.getBbsId());
master.setUniqId(user.getUniqId());
BoardMasterVO masterVo = bbsAttrbService.selectBBSMasterInf(master);
//model.addAttribute("brdMstrVO", masterVo);
Map<String, Object> resultMap = new HashMap<String, Object>();
resultMap.put("boardVO", vo);
resultMap.put("sessionUniqId", user.getUniqId());
resultMap.put("brdMstrVO", masterVo);
resultMap.put("user", user);
// 2021-06-01 신용호 추가
// 첨부파일 확인
if (vo != null && vo.getAtchFileId() != null && !vo.getAtchFileId().isEmpty()) {
FileVO fileVO = new FileVO();
fileVO.setAtchFileId(vo.getAtchFileId());
List<FileVO> resultFiles = fileService.selectFileInfs(fileVO);
// FileId를 유추하지 못하도록 암호화하여 표시한다. (2022.12.06 추가) - 파일아이디가 유추 불가능하도록 조치
for (FileVO file : resultFiles) {
String toEncrypt = file.atchFileId;
file.setAtchFileId(Base64.getEncoder().encodeToString(cryptoService.encrypt(toEncrypt.getBytes(),EgovFileDownloadController.ALGORITM_KEY)));
}
resultMap.put("resultFiles", resultFiles);
}
resultVO.setResult(resultMap);
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
return resultVO;
}*/
}

View File

@ -0,0 +1,113 @@
package egovframework.let.cop.bbs.service;
import java.io.Serializable;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import io.swagger.v3.oas.annotations.media.Schema;
/**
*
* @author
* @since 2009.03.06
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.03.06
* 2011.08.31 JJY 릿
*
* </pre>
*/
@Schema(description = "게시물 모델")
@Getter
@Setter
public class Board implements Serializable {
/**
* serialVersion UID
*/
private static final long serialVersionUID = -8868310931851410226L;
@Schema(description = "게시물 첨부파일 아이디")
private String atchFileId = "";
@Schema(description = "게시판 아이디")
private String bbsId = "";
@Schema(description = "최초등록자 아이디")
private String frstRegisterId = "";
@Schema(description = "최초등록시점")
private String frstRegisterPnttm = "";
@Schema(description = "최종수정자 아이디")
private String lastUpdusrId = "";
@Schema(description = "최종수정시점")
private String lastUpdusrPnttm = "";
@Schema(description = "게시시작일")
private String ntceBgnde = "";
@Schema(description = "게시종료일")
private String ntceEndde = "";
@Schema(description = "게시자 아이디")
private String ntcrId = "";
@Schema(description = "게시자명")
private String ntcrNm = "";
@Schema(description = "게시물 내용")
private String nttCn = "";
@Schema(description = "게시물 아이디")
private long nttId = 0L;
@Schema(description = "게시물 번호")
private long nttNo = 0L;
@Schema(description = "게시물 제목")
private String nttSj = "";
@Schema(description = "부모글번호")
private String parnts = "0";
@Schema(description = "패스워드")
private String password = "";
@Schema(description = "조회수")
private int inqireCo = 0;
@Schema(description = "답장여부")
private String replyAt = "";
@Schema(description = "답장위치")
private String replyLc = "0";
@Schema(description = "정렬순서(DESC,ASC)")
private long sortOrdr = 0L;
@Schema(description = "사용여부", allowableValues = {"Y", "N"})
private String useAt = "";
@Schema(description = "게시 종료일")
private String ntceEnddeView = "";
@Schema(description = "게시 시작일")
private String ntceBgndeView = "";
/**
* toString .
*/
public String toString(){
return ToStringBuilder.reflectionToString(this);
}
}

View File

@ -0,0 +1,117 @@
package egovframework.let.cop.bbs.service;
import java.io.Serializable;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import io.swagger.v3.oas.annotations.media.Schema;
/**
*
* @author
* @since 2009.03.12
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.03.12
* 2011.08.31 JJY 릿
*
* </pre>
*/
@Schema(description = "게시판 속성 정보 엔티티")
@Getter
@Setter
public class BoardMaster implements Serializable {
/**
* serialVersion UID
*/
private static final long serialVersionUID = 2821358749509367821L;
@Schema(description = "게시판 속성코드")
private String bbsAttrbCode = "";
@Schema(description = "게시판 아이디")
private String bbsId = "";
@Schema(description = "게시판 소개")
private String bbsIntrcn = "";
@Schema(description = "게시판 명")
private String bbsNm = "";
@Schema(description = "게시판 유형코드")
private String bbsTyCode = "";
@Schema(description = "파일첨부가능여부")
private String fileAtchPosblAt = "";
@Schema(description = "최초등록자 아이디")
private String frstRegisterId = "";
@Schema(description = "최초등록시점")
private String frstRegisterPnttm = "";
@Schema(description = "최종수정자 아이디")
public String lastUpdusrId = "";
@Schema(description = "최종수정시점")
private String lastUpdusrPnttm = "";
@Schema(description = "첨부가능파일숫자")
private int posblAtchFileNumber = 0;
@Schema(description = "첨부가능파일사이즈")
private String posblAtchFileSize = "";
@Schema(description = "답장가능여부")
private String replyPosblAt = "";
@Schema(description = "템플릿 아이디")
private String tmplatId = "";
@Schema(description = "사용여부")
private String useAt = "";
@Schema(description = "사용플래그")
private String bbsUseFlag = "";
@Schema(description = "대상 아이디")
private String trgetId = "";
@Schema(description = "등록구분코드")
private String registSeCode = "";
@Schema(description = "유일 아이디")
private String uniqId = "";
@Schema(description = "템플릿 명")
private String tmplatNm = "";
//---------------------------------
// 2009.06.26 : 2단계 기능 추가
//---------------------------------
@Schema(description = "추가 option (댓글-comment, 만족도조사-stsfdg)")
private String option = "";
@Schema(description = "댓글 여부")
private String commentAt = "";
@Schema(description = "만족도조사")
private String stsfdgAt = "";
////-------------------------------
/**
* toString .
*/
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
}

View File

@ -0,0 +1,99 @@
package egovframework.let.cop.bbs.service;
import java.io.Serializable;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* VO
* @author
* @since 2009.03.12
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.03.12
* 2011.08.31 JJY 릿
*
* </pre>
*/
@Schema(description = "게시판 속성 정보 VO")
@Getter
@Setter
public class BoardMasterVO extends BoardMaster implements Serializable {
/**
* serialVersion UID
*/
private static final long serialVersionUID = -8070768280461816170L;
@Schema(description = "검색시작일")
private String searchBgnDe = "";
@Schema(description = "검색조건")
private String searchCnd = "";
@Schema(description = "검색종료일")
private String searchEndDe = "";
@Schema(description = "검색단어")
private String searchWrd = "";
@Schema(description = "정렬순서(DESC,ASC)")
private String sortOrdr = "";
@Schema(description = "검색사용여부")
private String searchUseYn = "";
@Schema(description = "현재페이지")
private int pageIndex = 1;
@Schema(description = "페이지갯수")
private int pageUnit = 10;
@Schema(description = "페이지사이즈")
private int pageSize = 10;
@Schema(description = "첫페이지 인덱스")
private int firstIndex = 1;
@Schema(description = "마지막페이지 인덱스")
private int lastIndex = 1;
@Schema(description = "페이지당 레코드 개수")
private int recordCountPerPage = 10;
@Schema(description = "레코드 번호")
private int rowNo = 0;
@Schema(description = "최초 등록자명")
private String frstRegisterNm = "";
@Schema(description = "게시판유형 코드명")
private String bbsTyCodeNm = "";
@Schema(description = "게시판속성 코드명")
private String bbsAttrbCodeNm = "";
@Schema(description = "최종 수정자명")
private String lastUpdusrNm = "";
@Schema(description = "권한지정 여부")
private String authFlag = "";
/**
* toString .
*/
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
}

View File

@ -0,0 +1,128 @@
package egovframework.let.cop.bbs.service;
import java.io.Serializable;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* VO
* @author
* @since 2009.03.19
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.03.19
* 2009.06.29 2 (, )
* 2011.08.31 JJY 릿
*
* </pre>
*/
@Schema(description = "게시물 VO")
@Getter
@Setter
public class BoardVO extends Board implements Serializable {
/**
* serialVersion UID
*/
private static final long serialVersionUID = -3779821913760046011L;
@Schema(description = "검색시작일")
private String searchBgnDe = "";
@Schema(description = "검색조건")
private String searchCnd = "";
@Schema(description = "검색종료일")
private String searchEndDe = "";
@Schema(description = "검색단어")
private String searchWrd = "";
@Schema(description = "정렬순서(DESC,ASC)")
private long sortOrdr = 0L;
@Schema(description = "검색사용여부")
private String searchUseYn = "";
@Schema(description = "현재페이지")
private int pageIndex = 1;
@Schema(description = "페이지갯수")
private int pageUnit = 10;
@Schema(description = "페이지사이즈")
private int pageSize = 10;
@Schema(description = "첫페이지 인덱스")
private int firstIndex = 1;
@Schema(description = "마지막페이지 인덱스")
private int lastIndex = 1;
@Schema(description = "페이지당 레코드 개수")
private int recordCountPerPage = 10;
@Schema(description = "레코드 번호")
private int rowNo = 0;
@Schema(description = "최초 등록자명")
private String frstRegisterNm = "";
@Schema(description = "최종 수정자명")
private String lastUpdusrNm = "";
@Schema(description = "유효여부")
private String isExpired = "N";
@Schema(description = "상위 정렬 순서")
private String parntsSortOrdr = "";
@Schema(description = "상위 답변 위치")
private String parntsReplyLc = "";
@Schema(description = "게시판 유형코드")
private String bbsTyCode = "";
@Schema(description = "게시판 속성코드")
private String bbsAttrbCode = "";
@Schema(description = "게시판 명")
private String bbsNm = "";
@Schema(description = "파일첨부가능여부")
private String fileAtchPosblAt = "";
@Schema(description = "첨부가능파일숫자")
private int posblAtchFileNumber = 0;
@Schema(description = "답장가능여부")
private String replyPosblAt = "";
@Schema(description = "조회 수 증가 여부")
private boolean plusCount = false;
//---------------------------------
// 2009.06.29 : 2단계 기능 추가
//---------------------------------
@Schema(description = "하위 페이지 인덱스 (댓글 및 만족도 조사 여부 확인용)")
private String subPageIndex = "";
////-------------------------------
/**
* toString .
*/
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
}

View File

@ -0,0 +1,126 @@
package egovframework.let.cop.bbs.service;
import java.util.List;
import java.util.Map;
/**
*
* @author
* @since 2009.03.12
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.03.12
* 2011.08.31 JJY 릿
*
* </pre>
*/
public interface EgovBBSAttributeManageService {
/**
* .
* @param BoardMaster
*
* @param boardMaster
* @exception Exception Exception
*/
public void deleteBBSMasterInf(BoardMaster boardMaster)
throws Exception;
/**
* .
* @param BoardMaster
*
* @param boardMaster
* @exception Exception Exception
*/
public String insertBBSMastetInf(BoardMaster boardMaster)
throws Exception;
/**
* .
* @param searchVO
* @return
*
* @param vo
* @exception Exception Exception
*/
public List<BoardMasterVO> selectAllBBSMasteInf(BoardMasterVO vo)
throws Exception;
/**
* , .
* @return
*
* @param vo
* @exception Exception Exception
*/
public List<BoardMasterVO> selectAllBdMstrByTrget(BoardMasterVO vo)
throws Exception;
/**
* .
* @param BoardMasterVO
*
* @param searchVO
* @exception Exception Exception
*/
public BoardMasterVO selectBBSMasterInf(BoardMaster searchVO)
throws Exception;
/**
* .
* @param BoardMasterVO
*
* @param searchVO
* @exception Exception Exception
*/
public Map<String, Object> selectBBSMasterInfs(BoardMasterVO searchVO)
throws Exception;
/**
* .
* @param BoardMasterVO
*
* @param vo
* @exception Exception Exception
*/
public Map<String, Object> selectBdMstrListByTrget(BoardMasterVO vo)
throws Exception;
/**
* .
* @return
*
* @param vo
* @exception Exception Exception
*/
public Map<String, Object> selectNotUsedBdMstrList(BoardMasterVO vo)
throws Exception;
/**
* .
* @param BoardMaster
*
* @param boardMaster
* @exception Exception Exception
*/
public void updateBBSMasterInf(BoardMaster boardMaster)
throws Exception;
/**
* 릿 .
* @param BoardMasterVO
*
* @param searchVO
* @exception Exception Exception
*/
public void validateTemplate(BoardMasterVO searchVO)
throws Exception;
}

View File

@ -0,0 +1,74 @@
package egovframework.let.cop.bbs.service;
import java.util.Map;
/**
*
* @author
* @since 2009.08.25
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.08.25
* 2011.08.31 JJY 릿
*
* </pre>
*/
public interface EgovBBSLoneMasterService {
/**
* .
* @param BoardMaster
*
* @param boardMaster
* @exception Exception Exception
*/
public void deleteMaster(BoardMaster boardMaster)
throws Exception;
/**
* .
* @param BoardMaster
*
* @param boardMaster
* @exception Exception Exception
*/
public String insertMaster(BoardMaster boardMaster)
throws Exception;
/**
* .
* @param BoardMasterVO
*
* @param searchVO
* @exception Exception Exception
*/
public BoardMasterVO selectMaster(BoardMaster searchVO)
throws Exception;
/**
* .
* @param BoardMasterVO
*
* @param searchVO
* @exception Exception Exception
*/
public Map<String, Object> selectMasterList(BoardMasterVO searchVO)
throws Exception;
/**
* .
* @param BoardMaster
*
* @param boardMaster
* @exception Exception Exception
*/
public void updateMaster(BoardMaster boardMaster)
throws Exception;
}

View File

@ -0,0 +1,101 @@
package egovframework.let.cop.bbs.service;
import java.util.Map;
/**
*
* @author
* @since 2009.03.19
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.03.19
* 2011.08.31 JJY 릿
*
* </pre>
*/
public interface EgovBBSManageService {
/**
* .
*
* @param Board
* @exception Exception Exception
*/
public void deleteBoardArticle(Board Board)
throws Exception;
/**
* .
*
* @param boardVO
* @exception Exception Exception
*/
public void deleteGuestList(BoardVO boardVO)
throws Exception;
/**
* .
* @return
*
* @param Board
* @exception Exception Exception
*/
public String getPasswordInf(Board Board)
throws Exception;
/**
* .
*
* @param Board
* @exception Exception Exception
*/
public void insertBoardArticle(Board Board)
throws Exception;
/**
* .
* @return
*
* @param boardVO
* @exception Exception Exception
*/
public BoardVO selectBoardArticle(BoardVO boardVO)
throws Exception;
/**
* .
* @return
*
* @param boardVO
* @param attrbFlag
* @exception Exception Exception
*/
public Map<String, Object> selectBoardArticles(BoardVO boardVO, String attrbFlag)
throws Exception;
/**
* .
* @return
*
* @param boardVO
* @exception Exception Exception
*/
public Map<String, Object> selectGuestList(BoardVO boardVO)
throws Exception;
/**
* .
*
* @param Board
* @exception Exception Exception
*/
public void updateBoardArticle(Board Board)
throws Exception;
}

View File

@ -0,0 +1,55 @@
package egovframework.let.cop.bbs.service.impl;
import egovframework.let.cop.bbs.service.BoardMaster;
import egovframework.let.cop.bbs.service.BoardMasterVO;
import org.egovframe.rte.psl.dataaccess.EgovAbstractMapper;
import org.springframework.stereotype.Repository;
/**
* 2 (, )
* @author
* @since 2009.06.26
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.06.26
* 2011.08.31 JJY 릿
*
* </pre>
*/
@Repository("BBSAddedOptionsDAO")
public class BBSAddedOptionsDAO extends EgovAbstractMapper {
/**
* .
*
* @param BoardMaster
*/
public int insertAddedOptionsInf(BoardMaster boardMaster) throws Exception {
return (int)insert("BBSAddedOptionsDAO.insertAddedOptionsInf", boardMaster);
}
/**
* .
*
* @param BoardMasterVO
*/
public BoardMasterVO selectAddedOptionsInf(BoardMaster vo) throws Exception {
return (BoardMasterVO)selectOne("BBSAddedOptionsDAO.selectAddedOptionsInf", vo);
}
/**
* .
*
* @param BoardMaster
*/
public void updateAddedOptionsInf(BoardMaster boardMaster) throws Exception {
update("BBSAddedOptionsDAO.updateAddedOptionsInf", boardMaster);
}
}

View File

@ -0,0 +1,163 @@
package egovframework.let.cop.bbs.service.impl;
import java.util.List;
import egovframework.let.cop.bbs.service.BoardMaster;
import egovframework.let.cop.bbs.service.BoardMasterVO;
import org.egovframe.rte.psl.dataaccess.EgovAbstractMapper;
import org.springframework.stereotype.Repository;
/**
*
* @author
* @since 2009.03.12
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.03.12
* 2011.08.31 JJY 릿
*
* </pre>
*/
@Repository("BBSAttributeManageDAO")
public class BBSAttributeManageDAO extends EgovAbstractMapper {
/**
* .
*
* @param BoardMaster
*/
public void deleteBBSMasterInf(BoardMaster boardMaster) throws Exception {
update("BBSAttributeManageDAO.deleteBBSMasterInf", boardMaster);
}
/**
* .
*
* @param BoardMaster
*/
public int insertBBSMasterInf(BoardMaster boardMaster) throws Exception {
return (int)insert("BBSAttributeManageDAO.insertBBSMasterInf", boardMaster);
}
/**
* .
*
* @param BoardMasterVO
*/
public BoardMasterVO selectBBSMasterInf(BoardMaster vo) throws Exception {
return (BoardMasterVO)selectOne("BBSAttributeManageDAO.selectBBSMasterInf", vo);
}
/**
* .
*
* @param BoardMasterVO
*/
@SuppressWarnings("unchecked")
public List<BoardMasterVO> selectBBSMasterInfs(BoardMasterVO vo) throws Exception {
return (List<BoardMasterVO>) list("BBSAttributeManageDAO.selectBBSMasterInfs", vo);
}
/**
*
*
* @param vo
* @return
* @throws Exception
*/
public int selectBBSMasterInfsCnt(BoardMasterVO vo) throws Exception {
return (Integer)selectOne("BBSAttributeManageDAO.selectBBSMasterInfsCnt", vo);
}
/**
* .
*
* @param BoardMaster
*/
public void updateBBSMasterInf(BoardMaster boardMaster) throws Exception {
update("BBSAttributeManageDAO.updateBBSMasterInf", boardMaster);
}
/**
* 릿 .
*
* @param BoardMasterVO
*/
public boolean validateTemplate(BoardMasterVO vo) throws Exception {
return true;
}
/**
* .
*
* @param vo
* @return
* @throws Exception
*/
@SuppressWarnings("unchecked")
public List<BoardMasterVO> selectAllBBSMasteInf(BoardMasterVO vo) throws Exception {
// 커뮤니티, 동호회의 게시판이 나오지 않도록 LETTNBBSUSE 테이블과 Join 필요
return (List<BoardMasterVO>) list("BBSAttributeManageDAO.selectAllBBSMaster", vo);
}
/**
* .
*
* @param BoardMasterVO
*/
@SuppressWarnings("unchecked")
public List<BoardMasterVO> selectBdMstrListByTrget(BoardMasterVO vo) throws Exception {
return (List<BoardMasterVO>) list("BBSAttributeManageDAO.selectBdMstrListByTrget", vo);
}
/**
*
*
* @param vo
* @return
* @throws Exception
*/
public int selectBdMstrListCntByTrget(BoardMasterVO vo) throws Exception {
return (Integer)selectOne("BBSAttributeManageDAO.selectBdMstrListCntByTrget", vo);
}
/**
* , .
*
* @param vo
* @return
* @throws Exception
*/
@SuppressWarnings("unchecked")
public List<BoardMasterVO> selectAllBdMstrByTrget(BoardMasterVO vo) throws Exception {
return (List<BoardMasterVO>) list("BBSAttributeManageDAO.selectAllBdMstrByTrget", vo);
}
/**
* .
*
* @param BoardMasterVO
*/
@SuppressWarnings("unchecked")
public List<BoardMasterVO> selectNotUsedBdMstrList(BoardMasterVO vo) throws Exception {
return (List<BoardMasterVO>) list("BBSAttributeManageDAO.selectNotUsedBdMstrList", vo);
}
/**
*
*
* @param vo
* @return
* @throws Exception
*/
public int selectNotUsedBdMstrListCnt(BoardMasterVO vo) throws Exception {
return (Integer)selectOne("BBSAttributeManageDAO.selectNotUsedBdMstrListCnt", vo);
}
}

View File

@ -0,0 +1,87 @@
package egovframework.let.cop.bbs.service.impl;
import java.util.List;
import egovframework.let.cop.bbs.service.BoardMaster;
import egovframework.let.cop.bbs.service.BoardMasterVO;
import org.egovframe.rte.psl.dataaccess.EgovAbstractMapper;
import org.springframework.stereotype.Repository;
/**
*
* @author
* @since 2009.08.25
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.08.25
* 2011.08.31 JJY 릿
*
* </pre>
*/
@Repository("BBSLoneMasterDAO")
public class BBSLoneMasterDAO extends EgovAbstractMapper {
/**
* .
*
* @param BoardMaster
*/
public void deleteMaster(BoardMaster boardMaster) throws Exception {
update("BBSLoneMasterDAO.deleteMaster", boardMaster);
}
/**
* .
*
* @param BoardMaster
*/
public int insertMaster(BoardMaster boardMaster) throws Exception {
return (int)insert("BBSLoneMasterDAO.insertMaster", boardMaster);
}
/**
* .
*
* @param BoardMasterVO
*/
public BoardMasterVO selectMaster(BoardMaster vo) throws Exception {
return (BoardMasterVO)selectOne("BBSLoneMasterDAO.selectMaster", vo);
}
/**
* .
*
* @param BoardMasterVO
*/
@SuppressWarnings("unchecked")
public List<BoardMasterVO> selectMasterList(BoardMasterVO vo) throws Exception {
return (List<BoardMasterVO>) list("BBSLoneMasterDAO.selectMasterList", vo);
}
/**
*
*
* @param vo
* @return
* @throws Exception
*/
public int selectMasterListCnt(BoardMasterVO vo) throws Exception {
return (Integer)selectOne("BBSLoneMasterDAO.selectMasterListCnt", vo);
}
/**
* .
*
* @param BoardMaster
*/
public void updateMaster(BoardMaster boardMaster) throws Exception {
update("BBSLoneMasterDAO.updateMaster", boardMaster);
}
}

View File

@ -0,0 +1,228 @@
package egovframework.let.cop.bbs.service.impl;
import java.util.Iterator;
import java.util.List;
import egovframework.let.cop.bbs.service.Board;
import egovframework.let.cop.bbs.service.BoardVO;
import org.egovframe.rte.psl.dataaccess.EgovAbstractMapper;
import org.springframework.stereotype.Repository;
/**
*
* @author
* @since 2009.03.19
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.03.19
* 2011.08.31 JJY 릿
*
* </pre>
*/
@Repository("BBSManageDAO")
public class BBSManageDAO extends EgovAbstractMapper {
/**
* .
*
* @param board
* @throws Exception
*/
public void insertBoardArticle(Board board) throws Exception {
long nttId = (Long)selectOne("BBSManageDAO.selectMaxNttId");
board.setNttId(nttId);
insert("BBSManageDAO.insertBoardArticle", board);
}
/**
* .
*
* @param board
* @throws Exception
*/
public long replyBoardArticle(Board board) throws Exception {
long nttId = (Long)selectOne("BBSManageDAO.selectMaxNttId");
board.setNttId(nttId);
insert("BBSManageDAO.replyBoardArticle", board);
//----------------------------------------------------------
// 현재 글 이후 게시물에 대한 NTT_NO를 증가 (정렬을 추가하기 위해)
//----------------------------------------------------------
//String parentId = board.getParnts();
long nttNo = (Long)selectOne("BBSManageDAO.getParentNttNo", board);
board.setNttNo(nttNo);
update("BBSManageDAO.updateOtherNttNo", board);
board.setNttNo(nttNo + 1);
update("BBSManageDAO.updateNttNo", board);
return nttId;
}
/**
* .
*
* @param boardVO
* @return
* @throws Exception
*/
public BoardVO selectBoardArticle(BoardVO boardVO) throws Exception {
return (BoardVO)selectOne("BBSManageDAO.selectBoardArticle", boardVO);
}
/**
* .
*
* @param boardVO
* @return
* @throws Exception
*/
@SuppressWarnings("unchecked")
public List<BoardVO> selectBoardArticleList(BoardVO boardVO) throws Exception {
return (List<BoardVO>) list("BBSManageDAO.selectBoardArticleList", boardVO);
}
/**
* .
*
* @param boardVO
* @return
* @throws Exception
*/
public int selectBoardArticleListCnt(BoardVO boardVO) throws Exception {
return (Integer)selectOne("BBSManageDAO.selectBoardArticleListCnt", boardVO);
}
/**
* .
*
* @param board
* @throws Exception
*/
public void updateBoardArticle(Board board) throws Exception {
update("BBSManageDAO.updateBoardArticle", board);
}
/**
* .
*
* @param board
* @throws Exception
*/
public void deleteBoardArticle(Board board) throws Exception {
update("BBSManageDAO.deleteBoardArticle", board);
}
/**
* .
*
* @param board
* @throws Exception
*/
public void updateInqireCo(BoardVO boardVO) throws Exception {
update("BBSManageDAO.updateInqireCo", boardVO);
}
/**
* .
*
* @param boardVO
* @return
* @throws Exception
*/
public int selectMaxInqireCo(BoardVO boardVO) throws Exception {
return (Integer)selectOne("BBSManageDAO.selectMaxInqireCo", boardVO);
}
/**
* .
*
* @param boardVO
* @return
* @throws Exception
*/
@SuppressWarnings("unchecked")
public List<BoardVO> selectNoticeListForSort(Board board) throws Exception {
return (List<BoardVO>) list("BBSManageDAO.selectNoticeListForSort", board);
}
/**
* .
*
* @param sortList
* @throws Exception
*/
public void updateSortOrder(List<BoardVO> sortList) throws Exception {
BoardVO vo;
Iterator<BoardVO> iter = sortList.iterator();
while (iter.hasNext()) {
vo = (BoardVO)iter.next();
update("BBSManageDAO.updateSortOrder", vo);
}
}
/**
* .
*
* @param boardVO
* @return
* @throws Exception
*/
public long selectNoticeItemForSort(Board board) throws Exception {
return (Long)selectOne("BBSManageDAO.selectNoticeItemForSort", board);
}
/**
* .
*
* @param boardVO
* @return
* @throws Exception
*/
@SuppressWarnings("unchecked")
public List<BoardVO> selectGuestList(BoardVO boardVO) throws Exception {
return (List<BoardVO>) list("BBSManageDAO.selectGuestList", boardVO);
}
/**
* .
*
* @param boardVO
* @return
* @throws Exception
*/
public int selectGuestListCnt(BoardVO boardVO) throws Exception {
return (Integer)selectOne("BBSManageDAO.selectGuestListCnt", boardVO);
}
/**
* .
*
* @param boardVO
* @throws Exception
*/
public void deleteGuestList(BoardVO boardVO) throws Exception {
update("BBSManageDAO.deleteGuestList", boardVO);
}
/**
* .
*
* @param board
* @return
* @throws Exception
*/
public String getPasswordInf(Board board) throws Exception {
return (String)selectOne("BBSManageDAO.getPasswordInf", board);
}
}

View File

@ -0,0 +1,289 @@
package egovframework.let.cop.bbs.service.impl;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.egovframe.rte.fdl.idgnr.EgovIdGnrService;
import org.egovframe.rte.fdl.property.EgovPropertyService;
import org.springframework.stereotype.Service;
import egovframework.let.cop.bbs.service.BoardMaster;
import egovframework.let.cop.bbs.service.BoardMasterVO;
import egovframework.let.cop.bbs.service.EgovBBSAttributeManageService;
import egovframework.let.cop.com.service.BoardUseInf;
import egovframework.let.cop.com.service.EgovUserInfManageService;
import egovframework.let.cop.com.service.UserInfVO;
import egovframework.let.cop.com.service.impl.BBSUseInfoManageDAO;
import lombok.extern.slf4j.Slf4j;
/**
*
* @author
* @since 2009.03.24
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.03.24
* 2009.06.26 2 (, )
* 2011.08.31 JJY 릿
*
* </pre>
*/
@Slf4j
@Service("EgovBBSAttributeManageService")
public class EgovBBSAttributeManageServiceImpl extends EgovAbstractServiceImpl implements EgovBBSAttributeManageService {
@Resource(name = "BBSAttributeManageDAO")
private BBSAttributeManageDAO attrbMngDAO;
@Resource(name = "BBSUseInfoManageDAO")
private BBSUseInfoManageDAO bbsUseDAO;
@Resource(name = "EgovUserInfManageService")
private EgovUserInfManageService userService;
@Resource(name = "egovBBSMstrIdGnrService")
private EgovIdGnrService idgenService;
@Resource(name = "propertiesService")
protected EgovPropertyService propertyService;
//---------------------------------
// 2009.06.26 : 2단계 기능 추가
//---------------------------------
@Resource(name = "BBSAddedOptionsDAO")
private BBSAddedOptionsDAO addedOptionsDAO;
////-------------------------------
/**
* .
*
* @see egovframework.let.cop.bbs.brd.service.EgovBBSAttributeManageService#deleteBBSMasterInf(egovframework.let.cop.bbs.brd.service.BoardMaster)
*/
public void deleteBBSMasterInf(BoardMaster boardMaster) throws Exception {
attrbMngDAO.deleteBBSMasterInf(boardMaster);
BoardUseInf bdUseInf = new BoardUseInf();
bdUseInf.setBbsId(boardMaster.getBbsId());
bdUseInf.setLastUpdusrId(boardMaster.getLastUpdusrId());
bbsUseDAO.deleteBBSUseInfByBoardId(bdUseInf);
}
/**
* .
*
* @see egovframework.let.cop.bbs.brd.service.EgovBBSAttributeManageService#insertBBSMastetInf(egovframework.let.cop.bbs.brd.service.BoardMaster)
*/
public String insertBBSMastetInf(BoardMaster boardMaster) throws Exception {
String bbsId = idgenService.getNextStringId();
boardMaster.setBbsId(bbsId);
attrbMngDAO.insertBBSMasterInf(boardMaster);
//---------------------------------
// 2009.06.26 : 2단계 기능 추가
//---------------------------------
if (boardMaster.getOption().equals("comment") || boardMaster.getOption().equals("stsfdg")) {
addedOptionsDAO.insertAddedOptionsInf(boardMaster);
}
////-------------------------------
if ("Y".equals(boardMaster.getBbsUseFlag())) {
BoardUseInf bdUseInf = new BoardUseInf();
bdUseInf.setBbsId(bbsId);
bdUseInf.setTrgetId(boardMaster.getTrgetId());
bdUseInf.setRegistSeCode(boardMaster.getRegistSeCode());
bdUseInf.setFrstRegisterId(boardMaster.getFrstRegisterId());
bdUseInf.setUseAt("Y");
bbsUseDAO.insertBBSUseInf(bdUseInf);
UserInfVO userVO = new UserInfVO();
userVO.setTrgetId(boardMaster.getTrgetId());
List<UserInfVO> tmpList = null;
Iterator<UserInfVO> iter = null;
if ("REGC05".equals(boardMaster.getRegistSeCode())) {
tmpList = userService.selectAllClubUser(userVO);
iter = tmpList.iterator();
while (iter.hasNext()) {
bdUseInf = new BoardUseInf();
bdUseInf.setBbsId(bbsId);
bdUseInf.setTrgetId(((UserInfVO)iter.next()).getUniqId());
bdUseInf.setRegistSeCode("REGC07");
bdUseInf.setUseAt("Y");
bdUseInf.setFrstRegisterId(boardMaster.getFrstRegisterId());
bbsUseDAO.insertBBSUseInf(bdUseInf);
}
} else if ("REGC06".equals(boardMaster.getRegistSeCode())) {
tmpList = userService.selectAllCmmntyUser(userVO);
iter = tmpList.iterator();
while (iter.hasNext()) {
bdUseInf = new BoardUseInf();
bdUseInf.setBbsId(bbsId);
bdUseInf.setTrgetId(((UserInfVO)iter.next()).getUniqId());
bdUseInf.setRegistSeCode("REGC07");
bdUseInf.setUseAt("Y");
bdUseInf.setFrstRegisterId(boardMaster.getFrstRegisterId());
bbsUseDAO.insertBBSUseInf(bdUseInf);
}
}
}
return bbsId;
}
/**
* .
*
* @see egovframework.let.cop.bbs.brd.service.EgovBBSAttributeManageService#selectAllBBSMasteInf(egovframework.let.cop.bbs.brd.service.BoardMasterVO)
*/
public List<BoardMasterVO> selectAllBBSMasteInf(BoardMasterVO vo) throws Exception {
return attrbMngDAO.selectAllBBSMasteInf(vo);
}
/**
* .
*
* @see egovframework.let.cop.bbs.brd.service.EgovBBSAttributeManageService#selectBBSMasterInf(egovframework.let.cop.bbs.brd.service.BoardMasterVO)
*/
public BoardMasterVO selectBBSMasterInf(BoardMaster searchVO) throws Exception {
//---------------------------------
// 2009.06.26 : 2단계 기능 추가
//---------------------------------
//return attrbMngDAO.selectBBSMasterInf(searchVO);
BoardMasterVO result = attrbMngDAO.selectBBSMasterInf(searchVO);
String flag = propertyService.getString("Globals.addedOptions");
if (flag != null && flag.trim().equalsIgnoreCase("true")) {
BoardMasterVO options = addedOptionsDAO.selectAddedOptionsInf(searchVO);
if (options != null) {
if (options.getCommentAt().equals("Y")) {
result.setOption("comment");
}
if (options.getStsfdgAt().equals("Y")) {
result.setOption("stsfdg");
}
} else {
result.setOption("na"); // 미지정 상태로 수정 가능 (이미 지정된 경우는 수정 불가로 처리)
}
}
return result;
////-------------------------------
}
/**
* .
*
* @see egovframework.let.cop.bbs.brd.service.EgovBBSAttributeManageService#selectBBSMasterInfs(egovframework.let.cop.bbs.brd.service.BoardMasterVO)
*/
public Map<String, Object> selectBBSMasterInfs(BoardMasterVO searchVO) throws Exception {
List<BoardMasterVO> result = attrbMngDAO.selectBBSMasterInfs(searchVO);
int cnt = attrbMngDAO.selectBBSMasterInfsCnt(searchVO);
Map<String, Object> map = new HashMap<String, Object>();
map.put("resultList", result);
map.put("resultCnt", Integer.toString(cnt));
return map;
}
/**
* .
*
* @see egovframework.let.cop.bbs.brd.service.EgovBBSAttributeManageService#updateBBSMasterInf(egovframework.let.cop.bbs.brd.service.BoardMaster)
*/
public void updateBBSMasterInf(BoardMaster boardMaster) throws Exception {
attrbMngDAO.updateBBSMasterInf(boardMaster);
//---------------------------------
// 2009.06.26 : 2단계 기능 추가
//---------------------------------
String flag = propertyService.getString("Globals.addedOptions");
if (flag != null && flag.trim().equalsIgnoreCase("true")) {
if (boardMaster.getOption().equals("na")) {
return;
}
BoardMasterVO options = addedOptionsDAO.selectAddedOptionsInf(boardMaster);
if (options == null) {
boardMaster.setFrstRegisterId(boardMaster.getLastUpdusrId());
addedOptionsDAO.insertAddedOptionsInf(boardMaster);
} else {
//수정 기능 제외 (새롭게 선택사항을 지정한 insert만 처리함)
//addedOptionsDAO.updateAddedOptionsInf(boardMaster);
log.debug("BBS Master update ignored...");
}
}
////-------------------------------
}
/**
* 릿 .
*
* @see egovframework.let.cop.bbs.brd.service.EgovBBSAttributeManageService#validateTemplate(egovframework.let.cop.bbs.brd.service.BoardMasterVO)
*/
public void validateTemplate(BoardMasterVO searchVO) throws Exception {
log.debug("validateTemplate method ignored...");
}
/**
* .
*/
public Map<String, Object> selectBdMstrListByTrget(BoardMasterVO vo) throws Exception {
List<BoardMasterVO> result = attrbMngDAO.selectBdMstrListByTrget(vo);
int cnt = attrbMngDAO.selectBdMstrListCntByTrget(vo);
Map<String, Object> map = new HashMap<String, Object>();
map.put("resultList", result);
map.put("resultCnt", Integer.toString(cnt));
return map;
}
/**
* , .
*/
public List<BoardMasterVO> selectAllBdMstrByTrget(BoardMasterVO vo) throws Exception {
return attrbMngDAO.selectAllBdMstrByTrget(vo);
}
/**
* .
*/
public Map<String, Object> selectNotUsedBdMstrList(BoardMasterVO searchVO) throws Exception {
List<BoardMasterVO> result = attrbMngDAO.selectNotUsedBdMstrList(searchVO);
int cnt = attrbMngDAO.selectNotUsedBdMstrListCnt(searchVO);
Map<String, Object> map = new HashMap<String, Object>();
map.put("resultList", result);
map.put("resultCnt", Integer.toString(cnt));
return map;
}
}

View File

@ -0,0 +1,116 @@
package egovframework.let.cop.bbs.service.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import egovframework.let.cop.bbs.service.BoardMaster;
import egovframework.let.cop.bbs.service.BoardMasterVO;
import egovframework.let.cop.bbs.service.EgovBBSLoneMasterService;
import egovframework.let.cop.com.service.BoardUseInf;
import egovframework.let.cop.com.service.impl.BBSUseInfoManageDAO;
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.08.25
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.08.25
* 2011.08.31 JJY 릿
*
* </pre>
*/
@Service("EgovBBSLoneMasterService")
public class EgovBBSLoneMasterServiceImpl extends EgovAbstractServiceImpl implements EgovBBSLoneMasterService {
@Resource(name = "BBSLoneMasterDAO")
private BBSLoneMasterDAO masterDAO;
@Resource(name = "BBSUseInfoManageDAO")
private BBSUseInfoManageDAO bbsUseDAO;
@Resource(name = "egovBBSMstrIdGnrService")
private EgovIdGnrService idgenService;
/**
* .
*/
public void deleteMaster(BoardMaster boardMaster) throws Exception {
masterDAO.deleteMaster(boardMaster);
BoardUseInf bdUseInf = new BoardUseInf();
bdUseInf.setBbsId(boardMaster.getBbsId());
bdUseInf.setLastUpdusrId(boardMaster.getLastUpdusrId());
bbsUseDAO.deleteBBSUseInfByBoardId(bdUseInf);
}
/**
* .
*/
public String insertMaster(BoardMaster boardMaster) throws Exception {
String bbsId = idgenService.getNextStringId();
boardMaster.setBbsId(bbsId);
masterDAO.insertMaster(boardMaster);
//----------------------------------------------
// 게시판 사용 등록 (시스템)
//----------------------------------------------
BoardUseInf bdUseInf = new BoardUseInf();
bdUseInf.setBbsId(bbsId);
bdUseInf.setTrgetId("SYSTEM_DEFAULT_BOARD");
bdUseInf.setRegistSeCode("REGC01");
bdUseInf.setFrstRegisterId(boardMaster.getFrstRegisterId());
bdUseInf.setUseAt("Y");
bbsUseDAO.insertBBSUseInf(bdUseInf);
return bbsId;
}
/**
* .
*/
public BoardMasterVO selectMaster(BoardMaster searchVO) throws Exception {
return masterDAO.selectMaster(searchVO);
}
/**
* .
*/
public Map<String, Object> selectMasterList(BoardMasterVO searchVO) throws Exception {
List<BoardMasterVO> result = masterDAO.selectMasterList(searchVO);
int cnt = masterDAO.selectMasterListCnt(searchVO);
Map<String, Object> map = new HashMap<String, Object>();
map.put("resultList", result);
map.put("resultCnt", Integer.toString(cnt));
return map;
}
/**
* .
*/
public void updateMaster(BoardMaster boardMaster) throws Exception {
masterDAO.updateMaster(boardMaster);
}
}

View File

@ -0,0 +1,207 @@
package egovframework.let.cop.bbs.service.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
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.let.cop.bbs.service.Board;
import egovframework.let.cop.bbs.service.BoardVO;
import egovframework.let.cop.bbs.service.EgovBBSManageService;
import egovframework.let.utl.fcc.service.EgovDateUtil;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.egovframe.rte.fdl.property.EgovPropertyService;
/**
*
* @author
* @since 2009.03.19
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.03.19
* 2011.08.31 JJY 릿
*
* </pre>
*/
@Service("EgovBBSManageService")
public class EgovBBSManageServiceImpl extends EgovAbstractServiceImpl implements EgovBBSManageService {
@Resource(name = "BBSManageDAO")
private BBSManageDAO bbsMngDAO;
@Resource(name = "EgovFileMngService")
private EgovFileMngService fileService;
@Resource(name = "propertiesService")
protected EgovPropertyService propertyService;
/**
* .
*
* @see egovframework.let.cop.bbs.brd.service.EgovBBSManageService#deleteBoardArticle(egovframework.let.cop.bbs.brd.service.Board)
*/
@Override
public void deleteBoardArticle(Board board) throws Exception {
FileVO fvo = new FileVO();
fvo.setAtchFileId(board.getAtchFileId());
board.setNttSj("이 글은 작성자에 의해서 삭제되었습니다.");
bbsMngDAO.deleteBoardArticle(board);
if (!"".equals(fvo.getAtchFileId()) || fvo.getAtchFileId() != null) {
fileService.deleteAllFileInf(fvo);
}
}
/**
* .
*
* @see egovframework.let.cop.bbs.brd.service.EgovBBSManageService#insertBoardArticle(egovframework.let.cop.bbs.brd.service.Board)
*/
@Override
public void insertBoardArticle(Board board) throws Exception {
// SORT_ORDR는 부모글의 소트 오더와 같게, NTT_NO는 순서대로 부여
if ("Y".equals(board.getReplyAt())) {
// 답글인 경우 1. Parnts를 세팅, 2.Parnts의 sortOrdr을 현재글의 sortOrdr로 가져오도록, 3.nttNo는 현재 게시판의 순서대로
// replyLc는 부모글의 ReplyLc + 1
@SuppressWarnings("unused") long tmpNttId = 0L; // 답글 게시물 ID
tmpNttId = bbsMngDAO.replyBoardArticle(board);
} else {
// 답글이 아닌경우 Parnts = 0, replyLc는 = 0, sortOrdr = nttNo(Query에서 처리)
board.setParnts("0");
board.setReplyLc("0");
board.setReplyAt("N");
bbsMngDAO.insertBoardArticle(board);
}
}
/**
* .
*
* @see egovframework.let.cop.bbs.brd.service.EgovBBSManageService#selectBoardArticle(egovframework.let.cop.bbs.brd.service.BoardVO)
*/
@Override
public BoardVO selectBoardArticle(BoardVO boardVO) throws Exception {
if (boardVO.isPlusCount()) {
int iniqireCo = bbsMngDAO.selectMaxInqireCo(boardVO);
boardVO.setInqireCo(iniqireCo);
bbsMngDAO.updateInqireCo(boardVO);
}
return bbsMngDAO.selectBoardArticle(boardVO);
}
/**
* .
*
* @see egovframework.let.cop.bbs.brd.service.EgovBBSManageService#selectBoardArticles(egovframework.let.cop.bbs.brd.service.BoardVO)
*/
@Override
public Map<String, Object> selectBoardArticles(BoardVO boardVO, String attrbFlag) throws Exception {
List<BoardVO> list = bbsMngDAO.selectBoardArticleList(boardVO);
List<BoardVO> result = new ArrayList<BoardVO>();
if ("BBSA01".equals(attrbFlag)) {
// 유효게시판 임
String today = EgovDateUtil.getToday();
BoardVO vo;
Iterator<BoardVO> iter = list.iterator();
while (iter.hasNext()) {
vo = iter.next();
if (!"".equals(vo.getNtceBgnde()) || !"".equals(vo.getNtceEndde())) {
if (EgovDateUtil.getDaysDiff(today, vo.getNtceBgnde()) > 0
|| EgovDateUtil.getDaysDiff(today, vo.getNtceEndde()) < 0) {
// 시작일이 오늘날짜보다 크거나, 종료일이 오늘 날짜보다 작은 경우
vo.setIsExpired("Y");
}
}
result.add(vo);
}
} else {
result = list;
}
int cnt = bbsMngDAO.selectBoardArticleListCnt(boardVO);
Map<String, Object> map = new HashMap<String, Object>();
map.put("resultList", result);
map.put("resultCnt", Integer.toString(cnt));
return map;
}
/**
* .
*
* @see egovframework.let.cop.bbs.brd.service.EgovBBSManageService#updateBoardArticle(egovframework.let.cop.bbs.brd.service.Board)
*/
@Override
public void updateBoardArticle(Board board) throws Exception {
bbsMngDAO.updateBoardArticle(board);
}
/**
* .
*
* @see egovframework.let.cop.bbs.brd.service.EgovBBSManageService#deleteGuestList(egovframework.let.cop.bbs.brd.service.BoardVO)
*/
@Override
public void deleteGuestList(BoardVO boardVO) throws Exception {
bbsMngDAO.deleteGuestList(boardVO);
}
/**
* .
*
* @see egovframework.let.cop.bbs.brd.service.EgovBBSManageService#selectGuestList(egovframework.let.cop.bbs.brd.service.BoardVO)
*/
@Override
public Map<String, Object> selectGuestList(BoardVO boardVO) throws Exception {
List<BoardVO> result = bbsMngDAO.selectGuestList(boardVO);
int cnt = bbsMngDAO.selectGuestListCnt(boardVO);
Map<String, Object> map = new HashMap<String, Object>();
map.put("resultList", result);
map.put("resultCnt", Integer.toString(cnt));
return map;
}
/**
* .
*
* @param board
* @return
* @throws Exception
*/
@Override
public String getPasswordInf(Board board) throws Exception {
return bbsMngDAO.getPasswordInf(board);
}
}

View File

@ -0,0 +1,324 @@
package egovframework.let.cop.bbs.web;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.egovframe.rte.fdl.cmmn.exception.EgovBizException;
import org.egovframe.rte.fdl.property.EgovPropertyService;
import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
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.ResponseCode;
import egovframework.com.cmm.service.EgovCmmUseService;
import egovframework.com.cmm.service.ResultVO;
import egovframework.let.cop.bbs.service.BoardMasterVO;
import egovframework.let.cop.bbs.service.EgovBBSAttributeManageService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
/**
*
* @author
* @since 2009.03.12
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.03.12
* 2009.06.26 2 (, )
* 2011.08.31 JJY 릿
*
* </pre>
*/
@RestController
@Tag(name="EgovBBSAttributeManageApiController",description = "게시판 속성관리")
public class EgovBBSAttributeManageApiController {
/** EgovBBSAttributeManageService */
@Resource(name = "EgovBBSAttributeManageService")
private EgovBBSAttributeManageService bbsAttrbService;
/** EgovCmmUseService */
@Resource(name = "EgovCmmUseService")
private EgovCmmUseService cmmUseService;
/** EgovPropertyService */
@Resource(name = "propertiesService")
protected EgovPropertyService propertyService;
/** DefaultBeanValidator */
@Autowired
private DefaultBeanValidator beanValidator;
/** EgovMessageSource */
@Resource(name = "egovMessageSource")
EgovMessageSource egovMessageSource;
/**
* .
*
* @param request
* @param boardMasterVO
* @return resultVO
* @throws Exception
*/
@Operation(
summary = "게시판 마스터 조회",
description = "게시판 마스터 목록을 조회",
tags = {"EgovBBSAttributeManageApiController"}
)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "조회 성공"),
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
})
@PostMapping(value ="/cop/bbs/selectBBSMasterInfsAPI.do")
public ResultVO selectBBSMasterInfs(HttpServletRequest request,
@RequestBody BoardMasterVO boardMasterVO)
throws Exception {
ResultVO resultVO = new ResultVO();
boardMasterVO.setPageUnit(propertyService.getInt("Globals.pageUnit"));
boardMasterVO.setPageSize(propertyService.getInt("Globals.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<String, Object> resultMap = bbsAttrbService.selectBBSMasterInfs(boardMasterVO);
int totCnt = Integer.parseInt((String)resultMap.get("resultCnt"));
paginationInfo.setTotalRecordCount(totCnt);
resultMap.put("paginationInfo", paginationInfo);
resultVO.setResult(resultMap);
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
return resultVO;
}
/**
* .
*
* @param request
* @param searchVO
* @return resultVO
* @throws Exception
*/
@Operation(
summary = "게시판 마스터 상세 조회",
description = "게시판 마스터 상세내용을 조회",
tags = {"EgovBBSAttributeManageApiController"}
)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "조회 성공"),
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
})
@PostMapping(value ="/cop/bbs/selectBBSMasterInfAPI.do")
public ResultVO selectBBSMasterInf(HttpServletRequest request,
@RequestBody BoardMasterVO searchVO)
throws Exception {
ResultVO resultVO = new ResultVO();
Map<String, Object> resultMap = new HashMap<String, Object>();
BoardMasterVO vo = bbsAttrbService.selectBBSMasterInf(searchVO);
resultMap.put("boardMasterVO", vo);
resultVO.setResult(resultMap);
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
// return "cop/bbs/EgovBoardMstrUpdt";
return resultVO;
}
/**
* .
*
* @param request
* @param boardMasterVO
* @param bindingResult
* @return resultVO
* @throws Exception
*/
@Operation(
summary = "게시판 마스터 등록",
description = "신규 게시판 마스터 정보를 등록",
tags = {"EgovBBSAttributeManageApiController"}
)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "조회 성공"),
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님"),
@ApiResponse(responseCode = "900", description = "입력값 무결성 오류")
})
@PostMapping(value ="/cop/bbs/insertBBSMasterInfAPI.do")
public ResultVO insertBBSMasterInf(HttpServletRequest request,
BoardMasterVO boardMasterVO,
BindingResult bindingResult,
@AuthenticationPrincipal LoginVO loginVO
)
throws Exception {
ResultVO resultVO = new ResultVO();
Map<String, Object> resultMap = new HashMap<String, Object>();
beanValidator.validate(boardMasterVO, bindingResult);
if (bindingResult.hasErrors()) {
ComDefaultCodeVO vo = new ComDefaultCodeVO();
vo.setCodeId("COM004");
List<?> codeResult = cmmUseService.selectCmmCodeDetail(vo);
resultMap.put("typeList", codeResult);
vo.setCodeId("COM009");
codeResult = cmmUseService.selectCmmCodeDetail(vo);
resultMap.put("attrbList", codeResult);
resultVO.setResult(resultMap);
resultVO.setResultCode(ResponseCode.INPUT_CHECK_ERROR.getCode());
resultVO.setResultMessage(ResponseCode.INPUT_CHECK_ERROR.getMessage());
return resultVO;
}
boardMasterVO.setFrstRegisterId(loginVO.getUniqId());
boardMasterVO.setUseAt("Y");
boardMasterVO.setTrgetId("SYSTEMDEFAULT_REGIST");
boardMasterVO.setPosblAtchFileSize(propertyService.getString("posblAtchFileSize"));
bbsAttrbService.insertBBSMastetInf(boardMasterVO);
resultVO.setResult(resultMap);
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
return resultVO;
}
/**
* .
*
* @param request
* @param bbsId
* @param boardMasterVO
* @param bindingResult
* @return resultVO
* @throws Exception
*/
@Operation(
summary = "게시판 마스터 수정",
description = "게시판 마스터 정보를 수정",
tags = {"EgovBBSAttributeManageApiController"}
)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "수정 성공"),
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님"),
@ApiResponse(responseCode = "900", description = "입력값 무결성 오류")
})
@PutMapping(value ="/cop/bbs/updateBBSMasterInfAPI/{bbsId}.do")
public ResultVO updateBBSMasterInf(HttpServletRequest request,
@PathVariable("bbsId") String bbsId,
@RequestBody BoardMasterVO boardMasterVO,
BindingResult bindingResult,
@AuthenticationPrincipal LoginVO loginVO
) throws Exception {
ResultVO resultVO = new ResultVO();
Map<String, Object> resultMap = new HashMap<String, Object>();
beanValidator.validate(boardMasterVO, bindingResult);
if (bindingResult.hasErrors()) {
BoardMasterVO vo = bbsAttrbService.selectBBSMasterInf(boardMasterVO);
resultMap.put("BoardMasterVO", vo);
resultVO.setResult(resultMap);
resultVO.setResultCode(ResponseCode.INPUT_CHECK_ERROR.getCode());
resultVO.setResultMessage(ResponseCode.INPUT_CHECK_ERROR.getMessage());
return resultVO;
}
boardMasterVO.setLastUpdusrId(loginVO.getUniqId());
boardMasterVO.setPosblAtchFileSize(propertyService.getString("posblAtchFileSize"));
bbsAttrbService.updateBBSMasterInf(boardMasterVO);
resultVO.setResult(resultMap);
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
return resultVO;
}
/**
* .
*
* @param request
* @param bbsId
* @param boardMasterVO
* @return resultVO
* @throws Exception
*/
@Operation(
summary = "게시판 마스터 삭제",
description = "게시판 마스터 정보를 삭제",
tags = {"EgovBBSAttributeManageApiController"}
)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "삭제 성공"),
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
})
@PutMapping(value ="/cop/bbs/deleteBBSMasterInfAPI/{bbsId}.do")
public ResultVO deleteBBSMasterInf(HttpServletRequest request,
@AuthenticationPrincipal LoginVO loginVO,
@PathVariable("bbsId") String bbsId,
@RequestBody BoardMasterVO boardMasterVO) throws Exception {
ResultVO resultVO = new ResultVO();
boardMasterVO.setLastUpdusrId(loginVO.getUniqId());
bbsAttrbService.deleteBBSMasterInf(boardMasterVO);
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
return resultVO;
}
}

View File

@ -0,0 +1,545 @@
package egovframework.let.cop.bbs.web;
import java.util.Base64;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.egovframe.rte.fdl.cryptography.EgovCryptoService;
import org.egovframe.rte.fdl.property.EgovPropertyService;
import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
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.ResponseCode;
import egovframework.com.cmm.service.EgovFileMngService;
import egovframework.com.cmm.service.EgovFileMngUtil;
import egovframework.com.cmm.service.FileVO;
import egovframework.com.cmm.service.ResultVO;
import egovframework.com.cmm.web.EgovFileDownloadController;
import egovframework.let.cop.bbs.service.BoardMasterVO;
import egovframework.let.cop.bbs.service.BoardVO;
import egovframework.let.cop.bbs.service.EgovBBSAttributeManageService;
import egovframework.let.cop.bbs.service.EgovBBSManageService;
import egovframework.let.utl.sim.service.EgovFileScrty;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
/**
*
* @author
* @since 2009.03.19
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.03.19
* 2009.06.29 2 (, )
* 2011.08.31 JJY 릿
*
* </pre>
*/
@RestController
@Tag(name="EgovBBSManageApiController",description = "게시물 관리")
public class EgovBBSManageApiController {
@Resource(name = "EgovBBSManageService")
private EgovBBSManageService bbsMngService;
@Resource(name = "EgovBBSAttributeManageService")
private EgovBBSAttributeManageService bbsAttrbService;
@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 = "EgovFileMngService")
private EgovFileMngService fileService;
/** 암호화서비스 */
@Resource(name="egovARIACryptoService")
EgovCryptoService cryptoService;
//---------------------------------
// 2009.06.29 : 2단계 기능 추가
//---------------------------------
//SHT-CUSTOMIZING//@Resource(name = "EgovBBSCommentService")
//SHT-CUSTOMIZING//private EgovBBSCommentService bbsCommentService;
//SHT-CUSTOMIZING//@Resource(name = "EgovBBSSatisfactionService")
//SHT-CUSTOMIZING//private EgovBBSSatisfactionService bbsSatisfactionService;
//SHT-CUSTOMIZING//@Resource(name = "EgovBBSScrapService")
//SHT-CUSTOMIZING//private EgovBBSScrapService bbsScrapService;
////-------------------------------
@Autowired
private DefaultBeanValidator beanValidator;
/**
* .
*
*
* @param request
* @param searchVO
* @return resultVO
* @throws Exception
*/
@Operation(
summary = "게시판 마스터 상세 조회",
description = "게시판 마스터 상세내용을 조회 (파일 첨부가능 여부 조회용)",
tags = {"EgovBBSManageApiController"}
)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "조회 성공"),
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
})
@PostMapping(value = "/cop/bbs/selectUserBBSMasterInfAPI.do", consumes = MediaType.APPLICATION_JSON_VALUE)
public ResultVO selectUserBBSMasterInf(@RequestBody BoardMasterVO searchVO)
throws Exception {
ResultVO resultVO = new ResultVO();
Map<String, Object> resultMap = new HashMap<String, Object>();
BoardMasterVO master = bbsAttrbService.selectBBSMasterInf(searchVO);
resultMap.put("brdMstrVO", master);
resultVO.setResult(resultMap);
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
return resultVO;
}
/**
* .
*
* @param boardVO
* @return resultVO
* @throws Exception
*/
@Operation(
summary = "게시물 목록 조회",
description = "게시물에 대한 목록을 조회",
tags = {"EgovBBSManageApiController"}
)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "조회 성공"),
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
})
@PostMapping(value = "/cop/bbs/selectBoardListAPI.do", consumes = MediaType.APPLICATION_JSON_VALUE)
public ResultVO selectBoardArticles(@RequestBody BoardVO boardVO, @AuthenticationPrincipal LoginVO user)
throws Exception {
ResultVO resultVO = new ResultVO();
BoardMasterVO vo = new BoardMasterVO();
vo.setBbsId(boardVO.getBbsId());
vo.setUniqId(user.getUniqId());
BoardMasterVO master = bbsAttrbService.selectBBSMasterInf(vo);
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(boardVO.getPageIndex());
paginationInfo.setRecordCountPerPage(propertyService.getInt("Globals.pageUnit"));
paginationInfo.setPageSize(propertyService.getInt("Globals.pageSize"));
boardVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
boardVO.setLastIndex(paginationInfo.getLastRecordIndex());
boardVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
Map<String, Object> resultMap = bbsMngService.selectBoardArticles(boardVO, vo.getBbsAttrbCode());
int totCnt = Integer.parseInt((String)resultMap.get("resultCnt"));
paginationInfo.setTotalRecordCount(totCnt);
resultMap.put("boardVO", boardVO);
resultMap.put("brdMstrVO", master);
resultMap.put("paginationInfo", paginationInfo);
resultMap.put("user", user);
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
resultVO.setResult(resultMap);
return resultVO;
}
/**
* .
*
* @param boardVO
* @return resultVO
* @throws Exception
*/
@Operation(
summary = "게시물 상세 조회",
description = "게시물에 대한 상세 정보를 조회",
tags = {"EgovBBSManageApiController"}
)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "조회 성공"),
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
})
@PostMapping(value = "/cop/bbs/selectBoardArticleAPI.do")
public ResultVO selectBoardArticle(@RequestBody BoardVO boardVO,@AuthenticationPrincipal LoginVO user)
throws Exception {
ResultVO resultVO = new ResultVO();
// 조회수 증가 여부 지정
boardVO.setPlusCount(true);
//---------------------------------
// 2009.06.29 : 2단계 기능 추가
//---------------------------------
if (!boardVO.getSubPageIndex().equals("")) {
boardVO.setPlusCount(false);
}
////-------------------------------
boardVO.setLastUpdusrId(user.getUniqId());
BoardVO vo = bbsMngService.selectBoardArticle(boardVO);
//----------------------------
// template 처리 (기본 BBS template 지정 포함)
//----------------------------
BoardMasterVO master = new BoardMasterVO();
master.setBbsId(boardVO.getBbsId());
master.setUniqId(user.getUniqId());
BoardMasterVO masterVo = bbsAttrbService.selectBBSMasterInf(master);
//model.addAttribute("brdMstrVO", masterVo);
Map<String, Object> resultMap = new HashMap<String, Object>();
resultMap.put("boardVO", vo);
resultMap.put("sessionUniqId", user.getUniqId());
resultMap.put("brdMstrVO", masterVo);
resultMap.put("user", user);
// 2021-06-01 신용호 추가
// 첨부파일 확인
if (vo != null && vo.getAtchFileId() != null && !vo.getAtchFileId().isEmpty()) {
FileVO fileVO = new FileVO();
fileVO.setAtchFileId(vo.getAtchFileId());
List<FileVO> resultFiles = fileService.selectFileInfs(fileVO);
// FileId를 유추하지 못하도록 암호화하여 표시한다. (2022.12.06 추가) - 파일아이디가 유추 불가능하도록 조치
for (FileVO file : resultFiles) {
String toEncrypt = file.atchFileId;
file.setAtchFileId(Base64.getEncoder().encodeToString(cryptoService.encrypt(toEncrypt.getBytes(),EgovFileDownloadController.ALGORITM_KEY)));
}
resultMap.put("resultFiles", resultFiles);
}
resultVO.setResult(resultMap);
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
return resultVO;
}
/**
* .
*
* @param boardVO
* @param multiRequest
* @param bindingResult
* @param request
* @return resultVO
* @throws Exception
*/
@Operation(
summary = "게시물 수정",
description = "게시물에 대한 내용을 수정",
tags = {"EgovBBSManageApiController"}
)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "수정 성공"),
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님"),
@ApiResponse(responseCode = "900", description = "입력값 무결성 오류")
})
@PostMapping(value ="/cop/bbs/updateBoardArticleAPI.do")
public ResultVO updateBoardArticle(final MultipartHttpServletRequest multiRequest,
BoardVO boardVO,
BindingResult bindingResult,
HttpServletRequest request)
throws Exception {
ResultVO resultVO = new ResultVO();
// 사용자권한 처리
LoginVO user = new LoginVO();
user.setUniqId("USRCNFRM_00000000000");
String atchFileId = boardVO.getAtchFileId().replaceAll("\\s", "");
beanValidator.validate(boardVO, bindingResult);
if (bindingResult.hasErrors()) {
resultVO.setResultCode(ResponseCode.INPUT_CHECK_ERROR.getCode());
resultVO.setResultMessage(ResponseCode.INPUT_CHECK_ERROR.getMessage());
return resultVO;
}
final Map<String, MultipartFile> files = multiRequest.getFileMap();
if (!files.isEmpty()) {
if ("".equals(atchFileId)) {
List<FileVO> result = fileUtil.parseFileInf(files, "BBS_", 0, atchFileId, "");
atchFileId = fileMngService.insertFileInfs(result);
boardVO.setAtchFileId(atchFileId);
} else {
FileVO fvo = new FileVO();
fvo.setAtchFileId(atchFileId);
int cnt = fileMngService.getMaxFileSN(fvo);
List<FileVO> _result = fileUtil.parseFileInf(files, "BBS_", cnt, atchFileId, "");
fileMngService.updateFileInfs(_result);
}
}
boardVO.setLastUpdusrId(user.getUniqId());
boardVO.setNtcrNm(""); // dummy 오류 수정 (익명이 아닌 경우 validator 처리를 위해 dummy로 지정됨)
boardVO.setPassword(EgovFileScrty.encryptPassword("", user.getUniqId())); // dummy 오류 수정 (익명이 아닌 경우 validator 처리를 위해 dummy로 지정됨)
boardVO.setNttCn(unscript(boardVO.getNttCn())); // XSS 방지
bbsMngService.updateBoardArticle(boardVO);
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
return resultVO;
}
/**
* .
*
* @param multiRequest
* @param boardVO
* @param bindingResult
* @param request
* @return
* @throws Exception
*/
@Operation(
summary = "게시물 등록",
description = "게시물을 등록",
tags = {"EgovBBSManageApiController"}
)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "등록 성공"),
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님"),
@ApiResponse(responseCode = "900", description = "입력값 무결성 오류")
})
@PostMapping(value ="/cop/bbs/insertBoardArticleAPI.do")
public ResultVO insertBoardArticle(final MultipartHttpServletRequest multiRequest,
BoardVO boardVO,
BindingResult bindingResult,
HttpServletRequest request)
throws Exception {
ResultVO resultVO = new ResultVO();
LoginVO user = new LoginVO();
user.setUniqId("USRCNFRM_00000000000");
beanValidator.validate(boardVO, bindingResult);
if (bindingResult.hasErrors()) {
resultVO.setResultCode(ResponseCode.INPUT_CHECK_ERROR.getCode());
resultVO.setResultMessage(ResponseCode.INPUT_CHECK_ERROR.getMessage());
return resultVO;
}
List<FileVO> result = null;
String atchFileId = "";
final Map<String, MultipartFile> files = multiRequest.getFileMap();
if (!files.isEmpty()) {
result = fileUtil.parseFileInf(files, "BBS_", 0, "", "");
atchFileId = fileMngService.insertFileInfs(result);
}
boardVO.setAtchFileId(atchFileId);
boardVO.setFrstRegisterId(user.getUniqId());
boardVO.setBbsId(boardVO.getBbsId());
boardVO.setNtcrNm(""); // dummy 오류 수정 (익명이 아닌 경우 validator 처리를 위해 dummy로 지정됨)
boardVO.setPassword(EgovFileScrty.encryptPassword("", user.getUniqId())); // dummy 오류 수정 (익명이 아닌 경우 validator 처리를 위해 dummy로 지정됨)
// board.setNttCn(unscript(board.getNttCn())); // XSS 방지
bbsMngService.insertBoardArticle(boardVO);
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
return resultVO;
}
/**
* .
*
* @param multiRequest
* @param boardVO
* @param bindingResult
* @param request
* @return resultVO
* @throws Exception
*/
@Operation(
summary = "게시물 답변 등록",
description = "게시물에 대한 답변을 등록",
tags = {"EgovBBSManageApiController"}
)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "등록 성공"),
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님"),
@ApiResponse(responseCode = "900", description = "입력값 무결성 오류")
})
@PostMapping(value ="/cop/bbs/replyBoardArticleAPI.do")
public ResultVO replyBoardArticle(final MultipartHttpServletRequest multiRequest,
BoardVO boardVO,
BindingResult bindingResult,
HttpServletRequest request)
throws Exception {
ResultVO resultVO = new ResultVO();
LoginVO user = new LoginVO();
user.setUniqId("USRCNFRM_00000000000");
beanValidator.validate(boardVO, bindingResult);
if (bindingResult.hasErrors()) {
resultVO.setResultCode(ResponseCode.INPUT_CHECK_ERROR.getCode());
resultVO.setResultMessage(ResponseCode.INPUT_CHECK_ERROR.getMessage());
return resultVO;
}
final Map<String, MultipartFile> files = multiRequest.getFileMap();
String atchFileId = "";
if (!files.isEmpty()) {
List<FileVO> result = fileUtil.parseFileInf(files, "BBS_", 0, "", "");
atchFileId = fileMngService.insertFileInfs(result);
}
boardVO.setAtchFileId(atchFileId);
boardVO.setReplyAt("Y");
boardVO.setFrstRegisterId(user.getUniqId());
boardVO.setBbsId(boardVO.getBbsId());
boardVO.setParnts(Long.toString(boardVO.getNttId()));
boardVO.setSortOrdr(boardVO.getSortOrdr());
boardVO.setReplyLc(Integer.toString(Integer.parseInt(boardVO.getReplyLc()) + 1));
boardVO.setNtcrNm(""); // dummy 오류 수정 (익명이 아닌 경우 validator 처리를 위해 dummy로 지정됨)
boardVO.setPassword(EgovFileScrty.encryptPassword("", user.getUniqId())); // dummy 오류 수정 (익명이 아닌 경우 validator 처리를 위해 dummy로 지정됨)
boardVO.setNttCn(unscript(boardVO.getNttCn())); // XSS 방지
bbsMngService.insertBoardArticle(boardVO);
//return "forward:/cop/bbs/selectBoardList.do";
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
return resultVO;
}
/**
* .
*
* @param boardVO
* @param nttId
* @param request
* @return resultVO
* @throws Exception
*/
@Operation(
summary = "게시물 삭제",
description = "게시물에 대한 내용을 삭제",
tags = {"EgovBBSManageApiController"}
)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "삭제 성공"),
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
})
@PutMapping(value = "/cop/bbs/deleteBoardArticleAPI/{nttId}.do")
public ResultVO deleteBoardArticle(@RequestBody BoardVO boardVO,
@PathVariable("nttId") String nttId,
@AuthenticationPrincipal LoginVO user,
HttpServletRequest request)
throws Exception {
ResultVO resultVO = new ResultVO();
boardVO.setNttId(Long.parseLong(nttId));
boardVO.setLastUpdusrId(user.getUniqId());
bbsMngService.deleteBoardArticle(boardVO);
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
return resultVO;
}
/**
* 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)", "&lt;script");
ret = ret.replaceAll("</(S|s)(C|c)(R|r)(I|i)(P|p)(T|t)", "&lt;/script");
ret = ret.replaceAll("<(O|o)(B|b)(J|j)(E|e)(C|c)(T|t)", "&lt;object");
ret = ret.replaceAll("</(O|o)(B|b)(J|j)(E|e)(C|c)(T|t)", "&lt;/object");
ret = ret.replaceAll("<(A|a)(P|p)(P|p)(L|l)(E|e)(T|t)", "&lt;applet");
ret = ret.replaceAll("</(A|a)(P|p)(P|p)(L|l)(E|e)(T|t)", "&lt;/applet");
ret = ret.replaceAll("<(E|e)(M|m)(B|b)(E|e)(D|d)", "&lt;embed");
ret = ret.replaceAll("</(E|e)(M|m)(B|b)(E|e)(D|d)", "&lt;embed");
ret = ret.replaceAll("<(F|f)(O|o)(R|r)(M|m)", "&lt;form");
ret = ret.replaceAll("</(F|f)(O|o)(R|r)(M|m)", "&lt;form");
return ret;
}
}

View File

@ -0,0 +1,74 @@
package egovframework.let.cop.com.service;
import java.io.Serializable;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import io.swagger.v3.oas.annotations.media.Schema;
/**
*
* @author
* @since 2009.04.02
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.04.02
* 2011.08.31 JJY
*
* </pre>
*/
@Schema(description = "게시판 이용정보 모델")
@Getter
@Setter
public class BoardUseInf implements Serializable {
/**
* serialVersion UID
*/
private static final long serialVersionUID = -8164785314697750055L;
@Schema(description = "게시판 아이디")
private String bbsId = "";
@Schema(description = "대상시스템 아이디")
private String trgetId = "";
@Schema(description = "대상 구분 (커뮤니티, 동호회)")
private String trgetType = "";
@Schema(description = "최초 등록자 아이디")
private String frstRegisterId = "";
@Schema(description = "최초등록시점")
private String frstRegisterPnttm = "";
@Schema(description = "최종수정자 아이디")
private String lastUpdusrId = "";
@Schema(description = "최종수정시점")
private String lastUpdusrPnttm = "";
@Schema(description = "등록구분코드")
private String registSeCode = "";
@Schema(description = "사용여부", allowableValues = {"Y", "N"})
private String useAt = "";
/**
* toString .
*/
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
}

View File

@ -0,0 +1,118 @@
package egovframework.let.cop.com.service;
import java.io.Serializable;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* VO
* @author
* @since 2009.04.02
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.04.02
* 2011.05.31 JJY
*
* </pre>
*/
@Schema(description = "게시판 이용정보 VO")
@Getter
@Setter
public class BoardUseInfVO extends BoardUseInf implements Serializable {
/**
* serialVersion UID
*/
private static final long serialVersionUID = -2688781320530443850L;
@Schema(description = "검색시작일")
private String searchBgnDe = "";
@Schema(description = "검색조건")
private String searchCnd = "";
@Schema(description = "검색종료일")
private String searchEndDe = "";
@Schema(description = "검색단어")
private String searchWrd = "";
@Schema(description = "정렬순서(DESC,ASC)")
private long sortOrdr = 0L;
@Schema(description = "검색사용여부")
private String searchUseYn = "";
@Schema(description = "현재페이지")
private int pageIndex = 1;
@Schema(description = "페이지갯수")
private int pageUnit = 10;
@Schema(description = "페이지사이즈")
private int pageSize = 10;
@Schema(description = "첫페이지 인덱스")
private int firstIndex = 1;
@Schema(description = "마지막페이지 인덱스")
private int lastIndex = 1;
@Schema(description = "페이지당 레코드 개수")
private int recordCountPerPage = 10;
@Schema(description = "레코드 번호")
private int rowNo = 0;
@Schema(description = "최초 등록자명")
private String frstRegisterNm = "";
@Schema(description = "최종 수정자명")
private String lastUpdusrNm = "";
@Schema(description = "등록구분 코드명")
private String registSeCodeNm = "";
@Schema(description = "커뮤니티 아이디")
private String cmmntyId = "";
@Schema(description = "커뮤니티 명")
private String cmmntyNm = "";
@Schema(description = "동호회 아이디")
private String clbId = "";
@Schema(description = "동호회 명")
private String clbNm = "";
@Schema(description = "게시판 명")
private String bbsNm = "";
@Schema(description = "사용자 명")
private String userNm = "";
@Schema(description = "제공 URL")
private String provdUrl = "";
/** 게시판 유형코드 */
@Schema(description = "게시판 유형코드")
private String bbsTyCode = "";
/**
* toString .
*/
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
}

View File

@ -0,0 +1,124 @@
package egovframework.let.cop.com.service;
import java.util.Map;
/**
*
* @author
* @since 2009.04.02
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.04.02
* 2011.08.31 JJY 릿
*
* </pre>
*/
public interface EgovBBSUseInfoManageService {
/**
* .
*
* @param bdUseInf
* @throws Exception
*/
public void deleteBBSUseInf(BoardUseInf bdUseInf) throws Exception;
/**
* .
*
* @param bdUseInf
* @throws Exception
*/
public void deleteBBSUseInfByCmmnty(BoardUseInfVO bdUseVO) throws Exception;
/**
* .
*
* @param bdUseInf
* @throws Exception
*/
public void deleteBBSUseInfByClub(BoardUseInfVO bdUseVO) throws Exception;
/**
* .
*
* @param bdUseInf
* @throws Exception
*/
public void deleteAllBBSUseInfByCmmnty(BoardUseInfVO bdUseVO) throws Exception;
/**
* .
*
* @param bdUseInf
* @throws Exception
*/
public void deleteAllBBSUseInfByClub(BoardUseInfVO bdUseVO) throws Exception;
/**
* .
*
* @param bdUseInf
* @throws Exception
*/
public void insertBBSUseInf(BoardUseInf bdUseInf) throws Exception;
/**
* .
*
* @param bdUseVO
* @return
* @throws Exception
*/
public Map<String, Object> selectBBSUseInfs(BoardUseInfVO bdUseVO) throws Exception;
/**
* .
*
* @param bdUseInf
* @throws Exception
*/
public void updateBBSUseInf(BoardUseInf bdUseInf) throws Exception;
/**
* .
*
* @param bdUseVO
* @return
* @throws Exception
*/
public BoardUseInfVO selectBBSUseInf(BoardUseInfVO bdUseVO) throws Exception;
/**
* .
*
* @param bdUseInf
* @throws Exception
*/
public void deleteBBSUseInfByBoardId(BoardUseInf bdUseInf) throws Exception;
/**
* , .
*
* @param bdUseVO
* @return
* @throws Exception
*/
public Map<String, Object> selectBBSUseInfsByTrget(BoardUseInfVO bdUseVO) throws Exception;
/**
* , .
*
* @param bdUseInf
* @throws Exception
*/
public void updateBBSUseInfByTrget(BoardUseInf bdUseInf) throws Exception;
}

View File

@ -0,0 +1,87 @@
package egovframework.let.cop.com.service;
import java.util.List;
import java.util.Map;
/**
*
* @author
* @since 2009.04.06
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.04.06
* 2011.08.31 JJY 릿
*
* </pre>
*/
public interface EgovUserInfManageService {
/**
* .
*
* @param userVO
* @return
* @throws Exception
*/
public Map<String, Object> selectUserList(UserInfVO userVO) throws Exception;
/**
* .
*
* @param userVO
* @return
* @throws Exception
*/
public Map<String, Object> selectCmmntyUserList(UserInfVO userVO) throws Exception;
/**
* .
*
* @param userVO
* @return
* @throws Exception
*/
public Map<String, Object> selectCmmntyMngrList(UserInfVO userVO) throws Exception;
/**
* .
*
* @param userVO
* @return
* @throws Exception
*/
public Map<String, Object> selectClubUserList(UserInfVO userVO) throws Exception;
/**
* .
*
* @param userVO
* @return
* @throws Exception
*/
public Map<String, Object> selectClubOprtrList(UserInfVO userVO) throws Exception;
/**
* .
*
* @param userVO
* @return
* @throws Exception
*/
public List<UserInfVO> selectAllClubUser(UserInfVO userVO) throws Exception;
/**
* .
*
* @param userVO
* @return
* @throws Exception
*/
public List<UserInfVO> selectAllCmmntyUser(UserInfVO userVO) throws Exception;
}

View File

@ -0,0 +1,113 @@
package egovframework.let.cop.com.service;
import java.io.Serializable;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
/**
* VO
* @author
* @since 2009.04.06
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.04.06
* 2011.08.31 JJY 릿
*
* </pre>
*/
@Getter
@Setter
public class UserInfVO implements Serializable {
/**
* serialVersion UID
*/
private static final long serialVersionUID = -6156707290504312279L;
/** 유일 아이디 */
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";
/**
* toString .
*/
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
}

View File

@ -0,0 +1,179 @@
package egovframework.let.cop.com.service.impl;
import java.util.List;
import egovframework.let.cop.com.service.BoardUseInf;
import egovframework.let.cop.com.service.BoardUseInfVO;
import org.egovframe.rte.psl.dataaccess.EgovAbstractMapper;
import org.springframework.stereotype.Repository;
/**
*
* @author
* @since 2009.04.02
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.04.02
* 2011.05.31 JJY
*
* </pre>
*/
@Repository("BBSUseInfoManageDAO")
public class BBSUseInfoManageDAO extends EgovAbstractMapper {
/**
* .
*
* @param bdUseInf
* @throws Exception
*/
public void deleteBBSUseInf(BoardUseInf bdUseInf) throws Exception {
update("BBSUseInfoManageDAO.deleteBBSUseInf", bdUseInf);
}
/**
* .
*
* @param bdUseInf
* @throws Exception
*/
@SuppressWarnings("unchecked")
public List<BoardUseInf> selectBBSUseInfByCmmnty(BoardUseInfVO bdUseVO) throws Exception {
return (List<BoardUseInf>) list("BBSUseInfoManageDAO.selectBBSUseInfByCmmnty", bdUseVO);
}
/**
* .
*
* @param bdUseInf
* @throws Exception
*/
@SuppressWarnings("unchecked")
public List<BoardUseInf> selectBBSUseInfByClub(BoardUseInfVO bdUseVO) throws Exception {
return (List<BoardUseInf>) list("BBSUseInfoManageDAO.selectBBSUseInfByClub", bdUseVO);
}
/**
* .
*
* @param bdUseInf
* @throws Exception
*/
public void deleteAllBBSUseInfByCmmnty(BoardUseInfVO bdUseVO) throws Exception {
update("BBSUseInfoManageDAO.deleteAllBBSUseInfByCmmnty", bdUseVO);
}
/**
* .
*
* @param bdUseInf
* @throws Exception
*/
public void deleteAllBBSUseInfByClub(BoardUseInfVO bdUseVO) throws Exception {
update("BBSUseInfoManageDAO.deleteAllBBSUseInfByClub", bdUseVO);
}
/**
* .
*
* @param bdUseInf
* @throws Exception
*/
public void insertBBSUseInf(BoardUseInf bdUseInf) throws Exception {
insert("BBSUseInfoManageDAO.insertBBSUseInf", bdUseInf);
}
/**
* .
*
* @param bdUseVO
* @return
* @throws Exception
*/
@SuppressWarnings("unchecked")
public List<BoardUseInfVO> selectBBSUseInfs(BoardUseInfVO bdUseVO) throws Exception {
return (List<BoardUseInfVO>) list("BBSUseInfoManageDAO.selectBBSUseInfs", bdUseVO);
}
/**
*
* @param bdUseVO
* @return
* @throws Exception
*/
public int selectBBSUseInfsCnt(BoardUseInfVO bdUseVO) throws Exception {
return (Integer)selectOne("BBSUseInfoManageDAO.selectBBSUseInfsCnt", bdUseVO);
}
/**
* .
*
* @param bdUseVO
* @return
* @throws Exception
*/
public BoardUseInfVO selectBBSUseInf(BoardUseInfVO bdUseVO) throws Exception {
return (BoardUseInfVO)selectOne("BBSUseInfoManageDAO.selectBBSUseInf", bdUseVO);
}
/**
* .
*
* @param bdUseInf
* @throws Exception
*/
public void updateBBSUseInf(BoardUseInf bdUseInf) throws Exception {
update("BBSUseInfoManageDAO.updateBBSUseInf", bdUseInf);
}
/**
* .
*
* @param bdUseInf
* @throws Exception
*/
public void deleteBBSUseInfByBoardId(BoardUseInf bdUseInf) throws Exception {
update("BBSUseInfoManageDAO.deleteBBSUseInfByBoardId", bdUseInf);
}
/**
* , .
*
* @param bdUseVO
* @return
* @throws Exception
*/
@SuppressWarnings("unchecked")
public List<BoardUseInfVO> selectBBSUseInfsByTrget(BoardUseInfVO bdUseVO) throws Exception {
return (List<BoardUseInfVO>) list("BBSUseInfoManageDAO.selectBBSUseInfsByTrget", bdUseVO);
}
/**
* , .
*
* @param bdUseVO
* @return
* @throws Exception
*/
public int selectBBSUseInfsCntByTrget(BoardUseInfVO bdUseVO) throws Exception {
return (Integer)selectOne("BBSUseInfoManageDAO.selectBBSUseInfsCntByTrget", bdUseVO);
}
/**
* , .
*
* @param bdUseInf
* @throws Exception
*/
public void updateBBSUseInfByTrget(BoardUseInf bdUseInf) throws Exception {
update("BBSUseInfoManageDAO.updateBBSUseInfByTrget", bdUseInf);
}
}

View File

@ -0,0 +1,188 @@
package egovframework.let.cop.com.service.impl;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import egovframework.let.cop.com.service.BoardUseInf;
import egovframework.let.cop.com.service.BoardUseInfVO;
import egovframework.let.cop.com.service.EgovBBSUseInfoManageService;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
/**
*
* @author
* @since 2009.04.02
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.04.02
* 2011.08.31 JJY 릿
*
* </pre>
*/
@Service("EgovBBSUseInfoManageService")
public class EgovBBSUseInfoManageServiceImpl extends EgovAbstractServiceImpl implements EgovBBSUseInfoManageService {
@Resource(name = "BBSUseInfoManageDAO")
private BBSUseInfoManageDAO bbsUseDAO;
/**
* .
*
* @see egovframework.let.cop.bbs.com.service.EgovBBSUseInfoManageService#deleteBBSUseInf(egovframework.let.cop.bbs.com.service.BoardUseInf)
*/
public void deleteBBSUseInf(BoardUseInf bdUseInf) throws Exception {
bbsUseDAO.deleteBBSUseInf(bdUseInf);
}
/**
* .
*
* @see egovframework.let.cop.bbs.com.service.EgovBBSUseInfoManageService#insertBBSUseInf(egovframework.let.cop.bbs.com.service.BoardUseInf)
*/
public void insertBBSUseInf(BoardUseInf bdUseInf) throws Exception {
bbsUseDAO.insertBBSUseInf(bdUseInf);
}
/**
* .
*
* @see egovframework.let.cop.bbs.com.service.EgovBBSUseInfoManageService#selectBBSUseInfs(egovframework.let.cop.bbs.com.service.BoardUseInfVO)
*/
public Map<String, Object> selectBBSUseInfs(BoardUseInfVO bdUseVO) throws Exception {
List<BoardUseInfVO> result = bbsUseDAO.selectBBSUseInfs(bdUseVO);
int cnt = bbsUseDAO.selectBBSUseInfsCnt(bdUseVO);
Map<String, Object> map = new HashMap<String, Object>();
map.put("resultList", result);
map.put("resultCnt", Integer.toString(cnt));
return map;
}
/**
* .
*
* @see egovframework.let.cop.bbs.com.service.EgovBBSUseInfoManageService#updateBBSUseInf(egovframework.let.cop.bbs.com.service.BoardUseInf)
*/
public void updateBBSUseInf(BoardUseInf bdUseInf) throws Exception {
bbsUseDAO.updateBBSUseInf(bdUseInf);
}
/**
* .
*
* @see egovframework.let.cop.bbs.com.service.EgovBBSUseInfoManageService#selectBBSUseInf(egovframework.let.cop.bbs.com.service.BoardUseInfVO)
*/
public BoardUseInfVO selectBBSUseInf(BoardUseInfVO bdUseVO) throws Exception {
return bbsUseDAO.selectBBSUseInf(bdUseVO);
}
/**
* .
*
* @see egovframework.let.cop.com.service.EgovBBSUseInfoManageService#deleteBBSUseInfByClub(egovframework.let.cop.com.service.BoardUseInf)
*/
public void deleteBBSUseInfByClub(BoardUseInfVO bdUseVO) throws Exception {
List<BoardUseInf> result = bbsUseDAO.selectBBSUseInfByClub(bdUseVO);
BoardUseInf bdUseInf = null;
Iterator<BoardUseInf> iter = result.iterator();
while (iter.hasNext()) {
bdUseInf = (BoardUseInf)iter.next();
bdUseInf.setLastUpdusrId(bdUseVO.getLastUpdusrId());
//bdUseInf.setTrgetId(bdUseVO.getClbId()); // 사용자 ID를 넘겨야 함..
bdUseInf.setTrgetId(bdUseVO.getTrgetId());
bbsUseDAO.deleteBBSUseInf(bdUseInf);
}
}
/**
* .
*
* @see egovframework.let.cop.com.service.EgovBBSUseInfoManageService#deleteBBSUseInfByCmmnty(egovframework.let.cop.com.service.BoardUseInf)
*/
public void deleteBBSUseInfByCmmnty(BoardUseInfVO bdUseVO) throws Exception {
List<BoardUseInf> result = bbsUseDAO.selectBBSUseInfByCmmnty(bdUseVO);
BoardUseInf bdUseInf = null;
Iterator<BoardUseInf> iter = result.iterator();
while (iter.hasNext()) {
bdUseInf = (BoardUseInf)iter.next();
bdUseInf.setLastUpdusrId(bdUseVO.getLastUpdusrId());
//bdUseInf.setTrgetId(bdUseVO.getCmmntyId()); // 사용자 ID를 넘겨야 함..
bdUseInf.setTrgetId(bdUseVO.getTrgetId());
bbsUseDAO.deleteBBSUseInf(bdUseInf);
}
}
/**
* .
*
* @see egovframework.let.cop.com.service.EgovBBSUseInfoManageService#deleteAllBBSUseInfByClub(egovframework.let.cop.com.service.BoardUseInfVO)
*/
public void deleteAllBBSUseInfByClub(BoardUseInfVO bdUseVO) throws Exception {
bbsUseDAO.deleteAllBBSUseInfByClub(bdUseVO);
}
/**
* .
*
* @see egovframework.let.cop.com.service.EgovBBSUseInfoManageService#deleteAllBBSUseInfByCmmnty(egovframework.let.cop.com.service.BoardUseInfVO)
*/
public void deleteAllBBSUseInfByCmmnty(BoardUseInfVO bdUseVO) throws Exception {
bbsUseDAO.deleteAllBBSUseInfByCmmnty(bdUseVO);
}
/**
* .
*
* @see egovframework.let.cop.com.service.EgovBBSUseInfoManageService#deleteBBSUseInfByBoardId(egovframework.let.cop.com.service.BoardUseInf)
*/
public void deleteBBSUseInfByBoardId(BoardUseInf bdUseInf) throws Exception {
bbsUseDAO.deleteBBSUseInfByBoardId(bdUseInf);
}
/**
* , .
*
* @see egovframework.let.cop.com.service.EgovBBSUseInfoManageService#selectBBSUseInfsByTrget(egovframework.let.cop.com.service.BoardUseInfVO)
*/
public Map<String, Object> selectBBSUseInfsByTrget(BoardUseInfVO bdUseVO) throws Exception {
List<BoardUseInfVO> result = bbsUseDAO.selectBBSUseInfsByTrget(bdUseVO);
int cnt = bbsUseDAO.selectBBSUseInfsCntByTrget(bdUseVO);
Map<String, Object> map = new HashMap<String, Object>();
map.put("resultList", result);
map.put("resultCnt", Integer.toString(cnt));
return map;
}
/**
* , .
*/
public void updateBBSUseInfByTrget(BoardUseInf bdUseInf) throws Exception {
bbsUseDAO.updateBBSUseInfByTrget(bdUseInf);
}
}

View File

@ -0,0 +1,169 @@
package egovframework.let.cop.com.service.impl;
import java.util.List;
import egovframework.let.cop.com.service.UserInfVO;
import org.egovframe.rte.psl.dataaccess.EgovAbstractMapper;
import org.springframework.stereotype.Repository;
/**
*
* @author
* @since 2009.04.06
* @version 1.0
* @see
*
* <pre>
* << (Modification Information) >>
*
*
* ------- -------- ---------------------------
* 2009.04.06
* 2011.08.31 JJY 릿
*
* </pre>
*/
@Repository("EgovUserInfManageDAO")
public class EgovUserInfManageDAO extends EgovAbstractMapper {
/**
* .
*
* @param userVO
* @return
* @throws Exception
*/
@SuppressWarnings("unchecked")
public List<UserInfVO> selectUserList(UserInfVO userVO) throws Exception {
return (List<UserInfVO>) list("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<UserInfVO> selectCmmntyUserList(UserInfVO userVO) throws Exception {
return (List<UserInfVO>) list("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<UserInfVO> selectCmmntyMngrList(UserInfVO userVO) throws Exception {
return (List<UserInfVO>) list("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<UserInfVO> selectClubUserList(UserInfVO userVO) throws Exception {
return (List<UserInfVO>) list("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<UserInfVO> selectClubOprtrList(UserInfVO userVO) throws Exception {
return (List<UserInfVO>) list("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<UserInfVO> selectAllClubUser(UserInfVO userVO) throws Exception {
return (List<UserInfVO>) list("EgovUserInfManageDAO.selectAllClubUser", userVO);
}
/**
* .
*
* @param userVO
* @return
* @throws Exception
*/
@SuppressWarnings("unchecked")
public List<UserInfVO> selectAllCmmntyUser(UserInfVO userVO) throws Exception {
return (List<UserInfVO>) list("EgovUserInfManageDAO.selectAllCmmntyUser", userVO);
}
}

Some files were not shown because too many files have changed in this diff Show More