svn에서 이사
parent
e7a65c2b3a
commit
0a3c4dfb82
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
|
||||
<fileset name="all" enabled="true" check-config-name="KGI_Checks" local="false">
|
||||
<file-match-pattern match-pattern="." include-pattern="true"/>
|
||||
</fileset>
|
||||
</fileset-config>
|
||||
|
|
@ -0,0 +1,432 @@
|
|||
<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>kcg</groupId>
|
||||
<artifactId>faics</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>1.0.0</version>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
<properties>
|
||||
<spring.maven.artifact.version>4.0.9.RELEASE</spring.maven.artifact.version>
|
||||
<egovframework.rte.version>3.5.0</egovframework.rte.version>
|
||||
<org.apache.tiles.version>3.0.5</org.apache.tiles.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>mvn2</id>
|
||||
<url>http://repo1.maven.org/maven2/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>egovframe</id>
|
||||
<url>http://www.egovframe.go.kr/maven/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- egovframework.rte -->
|
||||
<dependency>
|
||||
<groupId>egovframework.rte</groupId>
|
||||
<artifactId>egovframework.rte.psl.dataaccess</artifactId>
|
||||
<version>${egovframework.rte.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>egovframework.rte</groupId>
|
||||
<artifactId>egovframework.rte.ptl.mvc</artifactId>
|
||||
<version>${egovframework.rte.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>egovframework.rte</groupId>
|
||||
<artifactId>egovframework.rte.fdl.property</artifactId>
|
||||
<version>${egovframework.rte.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>egovframework.rte</groupId>
|
||||
<artifactId>egovframework.rte.fdl.excel</artifactId>
|
||||
<version>${egovframework.rte.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>egovframework.rte</groupId>
|
||||
<artifactId>egovframework.rte.fdl.crypto</artifactId>
|
||||
<version>${egovframework.rte.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>egovframework.rte</groupId>
|
||||
<artifactId>egovframework.rte.fdl.string</artifactId>
|
||||
<version>${egovframework.rte.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>egovframework.rte</groupId>
|
||||
<artifactId>egovframework.rte.fdl.security</artifactId>
|
||||
<version>${egovframework.rte.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- 기능사용하는 곳 없음. 최종 결과물이 나올 때 까지 해당기능을 사용하지 않으면 삭제 <dependency> <groupId>egovframework.rte</groupId>
|
||||
<artifactId>egovframework.rte.fdl.idgnr</artifactId> <version>${egovframework.rte.version}</version>
|
||||
</dependency> -->
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-dbcp</groupId>
|
||||
<artifactId>commons-dbcp</artifactId>
|
||||
<version>1.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjrt</artifactId>
|
||||
<version>1.8.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjweaver</artifactId>
|
||||
<version>1.8.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjtools</artifactId>
|
||||
<version>1.8.0</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<version>1.0.0.GA</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.sf</groupId>
|
||||
<artifactId>log4jdbc3</artifactId>
|
||||
<version>1.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- validation -->
|
||||
<dependency>
|
||||
<groupId>org.springmodules</groupId>
|
||||
<artifactId>spring-modules-validation</artifactId>
|
||||
<version>0.9</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-validator</groupId>
|
||||
<artifactId>commons-validator</artifactId>
|
||||
<version>1.3.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.antlr</groupId>
|
||||
<artifactId>antlr</artifactId>
|
||||
<version>3.0.1</version>
|
||||
</dependency>
|
||||
<!-- /validation -->
|
||||
|
||||
|
||||
<!-- database driver -->
|
||||
<dependency>
|
||||
<groupId>ojdbc</groupId>
|
||||
<artifactId>ojdbc</artifactId>
|
||||
<version>14</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/ojdbc-14.jar</systemPath>
|
||||
</dependency>
|
||||
<!-- /database driver -->
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>jstl</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>taglibs</groupId>
|
||||
<artifactId>standard</artifactId>
|
||||
<version>1.1.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- tiles -->
|
||||
<dependency>
|
||||
<groupId>org.apache.tiles</groupId>
|
||||
<artifactId>tiles-extras</artifactId>
|
||||
<version>${org.apache.tiles.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.tiles</groupId>
|
||||
<artifactId>tiles-jsp</artifactId>
|
||||
<version>${org.apache.tiles.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.tiles</groupId>
|
||||
<artifactId>tiles-servlet</artifactId>
|
||||
<version>${org.apache.tiles.version}</version>
|
||||
</dependency>
|
||||
<!-- /tiles -->
|
||||
|
||||
<!-- json -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.8.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.sf.json-lib</groupId>
|
||||
<artifactId>json-lib</artifactId>
|
||||
<version>2.4</version>
|
||||
<classifier>jdk15</classifier>
|
||||
</dependency>
|
||||
<!-- /json -->
|
||||
|
||||
<!-- ckeditor -->
|
||||
<dependency>
|
||||
<groupId>com.ckeditor</groupId>
|
||||
<artifactId>ckeditor-java-core</artifactId>
|
||||
<version>3.5.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- file upload -->
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
<version>1.3.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<version>${spring.maven.artifact.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Lucy xss servlet filter -->
|
||||
<dependency>
|
||||
<groupId>com.navercorp.lucy</groupId>
|
||||
<artifactId>lucy-xss-servlet</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.10</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
<defaultGoal>install</defaultGoal>
|
||||
<directory>${basedir}/target</directory>
|
||||
<finalName>faics</finalName>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>hibernate3-maven-plugin</artifactId>
|
||||
<version>2.1</version>
|
||||
<configuration>
|
||||
<components>
|
||||
<component>
|
||||
<name>hbm2ddl</name>
|
||||
<implementation>annotationconfiguration</implementation>
|
||||
</component>
|
||||
</components>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>hsqldb</groupId>
|
||||
<artifactId>hsqldb</artifactId>
|
||||
<version>1.8.0.7</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<!-- EMMA -->
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>emma-maven-plugin</artifactId>
|
||||
<version>1.0-alpha-1</version>
|
||||
</plugin>
|
||||
<!-- PMD manven plugin -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-pmd-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
</plugin>
|
||||
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
|
||||
<plugin>
|
||||
<groupId>org.eclipse.m2e</groupId>
|
||||
<artifactId>lifecycle-mapping</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<configuration>
|
||||
<lifecycleMappingMetadata>
|
||||
<pluginExecutions>
|
||||
<pluginExecution>
|
||||
<pluginExecutionFilter>
|
||||
<groupId>
|
||||
org.apache.maven.plugins
|
||||
</groupId>
|
||||
<artifactId>
|
||||
maven-compiler-plugin
|
||||
</artifactId>
|
||||
<versionRange>
|
||||
[2.5.1,)
|
||||
</versionRange>
|
||||
<goals>
|
||||
<goal>testCompile</goal>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
</pluginExecutionFilter>
|
||||
<action>
|
||||
<ignore/>
|
||||
</action>
|
||||
</pluginExecution>
|
||||
</pluginExecutions>
|
||||
</lifecycleMappingMetadata>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
<plugins>
|
||||
<!-- EMMA -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<skipTests>false</skipTests>
|
||||
<testFailureIgnore>true</testFailureIgnore>
|
||||
<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>
|
||||
|
||||
<!-- CheckStyle 리포트 생성 -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<version>2.17</version>
|
||||
<configuration>
|
||||
<configLocation>${basedir}\src\main\resources\config\KGI_Checks.xml</configLocation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>8</source>
|
||||
<target>8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<reporting>
|
||||
<outputDirectory>${basedir}/target/site</outputDirectory>
|
||||
<plugins>
|
||||
<!-- FindBugs 리포트 생성 -->
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>findbugs-maven-plugin</artifactId>
|
||||
<version>3.0.4</version>
|
||||
</plugin>
|
||||
<!-- javadoc 생성 -->
|
||||
<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>
|
||||
<additionalparam>-Xdoclint:none</additionalparam>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Generating Java Source in HTML -->
|
||||
<plugin>
|
||||
<artifactId>maven-jxr-plugin</artifactId>
|
||||
<configuration>
|
||||
<inputEncoding>${encoding}</inputEncoding>
|
||||
<outputEncoding>${encoding}</outputEncoding>
|
||||
<linkJavadoc>true</linkJavadoc>
|
||||
<javadocDir>apidocs</javadocDir>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
package kcg.faics.admin.vo;
|
||||
|
||||
import kcg.faics.cmmn.bbs.BaseSearchVO;
|
||||
|
||||
/**
|
||||
* LogVO.java
|
||||
* @author 임새미
|
||||
* @since 2016. 11. 10.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 11. 10. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
public class LogSearchVO extends BaseSearchVO {
|
||||
|
||||
public LogSearchVO() {
|
||||
super();
|
||||
}
|
||||
|
||||
private int type = 0;
|
||||
private String sdate;
|
||||
private String edate;
|
||||
private String place1;
|
||||
private String name;
|
||||
private String order;
|
||||
/**
|
||||
* @return the type
|
||||
*/
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
/**
|
||||
* @param type the type to set
|
||||
*/
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
/**
|
||||
* @return the sdate
|
||||
*/
|
||||
public String getSdate() {
|
||||
return sdate;
|
||||
}
|
||||
/**
|
||||
* @param sdate the sdate to set
|
||||
*/
|
||||
public void setSdate(String sdate) {
|
||||
this.sdate = sdate;
|
||||
}
|
||||
/**
|
||||
* @return the edate
|
||||
*/
|
||||
public String getEdate() {
|
||||
return edate;
|
||||
}
|
||||
/**
|
||||
* @param edate the edate to set
|
||||
*/
|
||||
public void setEdate(String edate) {
|
||||
this.edate = edate;
|
||||
}
|
||||
/**
|
||||
* @return the place1
|
||||
*/
|
||||
public String getPlace1() {
|
||||
return place1;
|
||||
}
|
||||
/**
|
||||
* @param place1 the place1 to set
|
||||
*/
|
||||
public void setPlace1(String place1) {
|
||||
this.place1 = place1;
|
||||
}
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
/**
|
||||
* @return the order
|
||||
*/
|
||||
public String getOrder() {
|
||||
return order;
|
||||
}
|
||||
/**
|
||||
* @param order the order to set
|
||||
*/
|
||||
public void setOrder(String order) {
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,147 @@
|
|||
package kcg.faics.admin.vo;
|
||||
|
||||
/**
|
||||
* LogVO.java
|
||||
* @author 임새미
|
||||
* @since 2016. 11. 10.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 11. 10. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
public class LogVO {
|
||||
|
||||
|
||||
private int rnum;
|
||||
private String userid;
|
||||
private int type;
|
||||
private String regdate;
|
||||
private String position;
|
||||
private String name;
|
||||
private String location1;
|
||||
private String location2;
|
||||
private String location3;
|
||||
private String ip;
|
||||
/**
|
||||
* @return the seq
|
||||
*/
|
||||
public int getRnum() {
|
||||
return rnum;
|
||||
}
|
||||
/**
|
||||
* @param seq the seq to set
|
||||
*/
|
||||
public void setRnum(int rnum) {
|
||||
this.rnum = rnum;
|
||||
}
|
||||
/**
|
||||
* @return the userid
|
||||
*/
|
||||
public String getUserid() {
|
||||
return userid;
|
||||
}
|
||||
/**
|
||||
* @param userid the userid to set
|
||||
*/
|
||||
public void setUserid(String userid) {
|
||||
this.userid = userid;
|
||||
}
|
||||
/**
|
||||
* @return the type
|
||||
*/
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
/**
|
||||
* @param type the type to set
|
||||
*/
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
/**
|
||||
* @return the regdate
|
||||
*/
|
||||
public String getRegdate() {
|
||||
return regdate;
|
||||
}
|
||||
/**
|
||||
* @param regdate the regdate to set
|
||||
*/
|
||||
public void setRegdate(String regdate) {
|
||||
this.regdate = regdate;
|
||||
}
|
||||
/**
|
||||
* @return the position
|
||||
*/
|
||||
public String getPosition() {
|
||||
return position;
|
||||
}
|
||||
/**
|
||||
* @param position the position to set
|
||||
*/
|
||||
public void setPosition(String position) {
|
||||
this.position = position;
|
||||
}
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
/**
|
||||
* @return the location1
|
||||
*/
|
||||
public String getLocation1() {
|
||||
return location1;
|
||||
}
|
||||
/**
|
||||
* @param location1 the location1 to set
|
||||
*/
|
||||
public void setLocation1(String location1) {
|
||||
this.location1 = location1;
|
||||
}
|
||||
/**
|
||||
* @return the location2
|
||||
*/
|
||||
public String getLocation2() {
|
||||
return location2;
|
||||
}
|
||||
/**
|
||||
* @param location2 the location2 to set
|
||||
*/
|
||||
public void setLocation2(String location2) {
|
||||
this.location2 = location2;
|
||||
}
|
||||
/**
|
||||
* @return the location3
|
||||
*/
|
||||
public String getLocation3() {
|
||||
return location3;
|
||||
}
|
||||
/**
|
||||
* @param location3 the location3 to set
|
||||
*/
|
||||
public void setLocation3(String location3) {
|
||||
this.location3 = location3;
|
||||
}
|
||||
/**
|
||||
* @return the ip
|
||||
*/
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
/**
|
||||
* @param ip the ip to set
|
||||
*/
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,940 @@
|
|||
/**
|
||||
* AdminController.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 27.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 27. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
package kcg.faics.admin.web;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import kcg.faics.admin.vo.LogSearchVO;
|
||||
import kcg.faics.cmmn.excel.ExcelExporter;
|
||||
import kcg.faics.cmmn.service.CodeService;
|
||||
import kcg.faics.cmmn.service.LogService;
|
||||
import kcg.faics.cmmn.vo.CodeVO;
|
||||
import kcg.faics.member.UserType;
|
||||
import kcg.faics.member.service.MemberAuthService;
|
||||
import kcg.faics.member.service.MemberService;
|
||||
import kcg.faics.member.vo.MemberSearchVO;
|
||||
import kcg.faics.member.vo.MemberVO;
|
||||
import kcg.faics.sec.LoginUserVO;
|
||||
import kcg.faics.sec.UserUtil;
|
||||
import kcg.faics.sec.service.impl.SecurityMapper;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.core.session.SessionInformation;
|
||||
import org.springframework.security.core.session.SessionRegistry;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.support.SessionStatus;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
import egovframework.rte.fdl.property.EgovPropertyService;
|
||||
import egovframework.rte.fdl.security.userdetails.EgovUserDetails;
|
||||
import egovframework.rte.ptl.mvc.tags.ui.pagination.PaginationInfo;
|
||||
|
||||
/**
|
||||
* AdminController.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 27.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 27. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/admin")
|
||||
public class AdminController {
|
||||
|
||||
@Resource(name = "propertiesService")
|
||||
private EgovPropertyService propertiesService;
|
||||
|
||||
@Resource(name = "codeService")
|
||||
CodeService codeService;
|
||||
|
||||
@Resource(name = "memberService")
|
||||
MemberService memberService;
|
||||
|
||||
@Resource(name = "memberAuthService")
|
||||
MemberAuthService memberAuthService;
|
||||
|
||||
@Resource(name = "logService")
|
||||
LogService logService;
|
||||
|
||||
|
||||
/**
|
||||
* 외사경찰 등록화면을 반환한다.
|
||||
*
|
||||
* @param memberVO modelAttribute 객체
|
||||
* @param model 모델 객체
|
||||
* @return 외사경찰 등록화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value = "/faMemberAdd.do", method=RequestMethod.GET)
|
||||
public String faMemberAddView(@ModelAttribute("memberVO") final MemberVO memberVO, Model model) throws Exception {
|
||||
/* 외사경찰 */
|
||||
memberVO.setUsertype(UserType.FA);
|
||||
|
||||
model.addAttribute("memberVO", new MemberVO());
|
||||
model.addAttribute("place1List", codeService.getPlace1List(false));
|
||||
model.addAttribute("positionList", codeService.getPositionList());
|
||||
model.addAttribute("dutiesList", codeService.getDutiesList());
|
||||
model.addAttribute("jobTypeList", codeService.getJobTypeList());
|
||||
model.addAttribute("scholarshipList", codeService.getScholarshipList());
|
||||
|
||||
/* create or modify 플래그 */
|
||||
model.addAttribute("registerFlag", "create");
|
||||
|
||||
return "admin/faMemberAdd.tiles";
|
||||
}
|
||||
|
||||
/**
|
||||
* 외사경찰을 등록한다.
|
||||
*
|
||||
* @param multiRequest multpart타입의 요청 객체
|
||||
* @param memberVO 외사경찰 정보 객체
|
||||
* @param bindingResult 바인딩 객체
|
||||
* @param model 모델 객체
|
||||
* @param status 세선 상태 객체
|
||||
* @return 게시물 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value = "/faMemberAdd.do", method=RequestMethod.POST)
|
||||
public String faMemberAdd(final MultipartHttpServletRequest multiRequest, @ModelAttribute("memberVO") final MemberVO memberVO,
|
||||
final BindingResult bindingResult, final Model model, final SessionStatus status) throws Exception {
|
||||
/* 외사경찰 */
|
||||
memberVO.setUsertype(UserType.FA);
|
||||
|
||||
HashMap<String, Object> result = new HashMap<String, Object>();
|
||||
try {
|
||||
/* 유효성 검사 */
|
||||
MemberVO vo = memberService.select(memberVO);
|
||||
if (vo != null || bindingResult.hasErrors()) {
|
||||
|
||||
if (vo != null) {
|
||||
bindingResult.rejectValue("userid", "member.msg.duplicate");
|
||||
}
|
||||
|
||||
model.addAttribute("memberVO", memberVO);
|
||||
model.addAttribute("place1List", codeService.getPlace1List(false));
|
||||
model.addAttribute("positionList", codeService.getPositionList());
|
||||
model.addAttribute("dutiesList", codeService.getDutiesList());
|
||||
model.addAttribute("jobTypeList", codeService.getJobTypeList());
|
||||
model.addAttribute("scholarshipList", codeService.getScholarshipList());
|
||||
|
||||
/* create or modify 플래그 */
|
||||
model.addAttribute("registerFlag", "create");
|
||||
|
||||
return "admin/faMemberAdd.tiles";
|
||||
}
|
||||
|
||||
result = memberService.insert(memberVO, multiRequest.getFileMap());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if ((Integer) result.get("result") != 1) {
|
||||
return "redirect:/admin/faMemberAdd.do";
|
||||
}
|
||||
|
||||
String newUserId = (String) result.get("userid");
|
||||
newUserId = URLEncoder.encode(newUserId, "UTF-8");
|
||||
return "redirect:/admin/faMemberInfo.do?userid=" + newUserId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 외사경찰 정보를 반환한다.
|
||||
*
|
||||
* @param memberVO 외사경찰 정보 객체
|
||||
* @param model 모델 객체
|
||||
* @return 외사경찰 정보 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping("/faMemberInfo.do")
|
||||
public String faMemberInfo(final MemberVO memberVO, final Model model) throws Exception {
|
||||
try {
|
||||
/* 외사경찰 */
|
||||
memberVO.setUsertype(UserType.FA);
|
||||
model.addAttribute("memberVO", memberService.select(memberVO));
|
||||
model.addAttribute("isAdmin", UserUtil.isAdmin());
|
||||
model.addAttribute("isSysAdmin", UserUtil.isSysAdmin());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return "admin/faMemberInfo.tiles";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 외사경찰 목록을 반환한다.
|
||||
*
|
||||
* @param searchVO 검색, 페이지 정보 객체
|
||||
* @param model 모델 객체
|
||||
* @return 외사경찰 정보 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping("/faMemberList.do")
|
||||
public String faMemberList(@ModelAttribute("memberSearchVO") final MemberSearchVO searchVO, final Model model) throws Exception {
|
||||
try {
|
||||
/* 페이징 처리 정보 */
|
||||
searchVO.setPageUnit(propertiesService.getInt("pageUnit"));
|
||||
searchVO.setPageSize(propertiesService.getInt("pageSize"));
|
||||
|
||||
/* 페이징 처리 */
|
||||
PaginationInfo paginationInfo = new PaginationInfo();
|
||||
paginationInfo.setCurrentPageNo(searchVO.getPageIndex());
|
||||
paginationInfo.setRecordCountPerPage(searchVO.getPageUnit());
|
||||
paginationInfo.setPageSize(searchVO.getPageSize());
|
||||
|
||||
searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
|
||||
searchVO.setLastIndex(paginationInfo.getLastRecordIndex());
|
||||
searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
|
||||
|
||||
int totSearchCnt = memberService.selectListCnt(searchVO);
|
||||
paginationInfo.setTotalRecordCount(totSearchCnt);
|
||||
model.addAttribute("paginationInfo", paginationInfo);
|
||||
|
||||
/* 게시판 상단 페이지 및 게시물 정보 표현을 위한 데이터 */
|
||||
int totCnt = memberService.selectTotalCnt(searchVO);
|
||||
model.addAttribute("totalCnt", totCnt);
|
||||
|
||||
model.addAttribute("resultList", memberService.selectList(searchVO));
|
||||
model.addAttribute("place1List", codeService.getPlace1List(false));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return "admin/faMemberList.tiles";
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 외사경찰 목록을 반환한다.
|
||||
*
|
||||
* @param searchVO 검색, 페이지 정보 객체
|
||||
* @param model 모델 객체
|
||||
* @return 외사경찰 정보 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping("/faMemberCmmnList.do")
|
||||
public String faMemberCmmnList(@ModelAttribute("memberSearchVO") final MemberSearchVO searchVO, final Model model) throws Exception {
|
||||
try {
|
||||
if (searchVO.getPlace1() == null || searchVO.getPlace1().length() == 0) {
|
||||
searchVO.setPlace1("PS00");
|
||||
}
|
||||
/* 페이징 처리 정보 */
|
||||
searchVO.setPageUnit(propertiesService.getInt("pageUnit"));
|
||||
searchVO.setPageSize(propertiesService.getInt("pageSize"));
|
||||
|
||||
/* 페이징 처리 */
|
||||
PaginationInfo paginationInfo = new PaginationInfo();
|
||||
paginationInfo.setCurrentPageNo(searchVO.getPageIndex());
|
||||
paginationInfo.setRecordCountPerPage(searchVO.getPageUnit());
|
||||
paginationInfo.setPageSize(searchVO.getPageSize());
|
||||
|
||||
searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
|
||||
searchVO.setLastIndex(paginationInfo.getLastRecordIndex());
|
||||
searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
|
||||
|
||||
int totSearchCnt = memberService.selectListCnt(searchVO);
|
||||
paginationInfo.setTotalRecordCount(totSearchCnt);
|
||||
model.addAttribute("paginationInfo", paginationInfo);
|
||||
|
||||
/* 게시판 상단 페이지 및 게시물 정보 표현을 위한 데이터 */
|
||||
int totCnt = memberService.selectTotalCnt(searchVO);
|
||||
model.addAttribute("totalCnt", totCnt);
|
||||
|
||||
model.addAttribute("resultList", memberService.selectList(searchVO));
|
||||
model.addAttribute("place1List", codeService.getPlace1List(false));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return "admin/faMemberCmmnList.tiles";
|
||||
}
|
||||
|
||||
/**
|
||||
* 외사 경찰의 현황을 엑셀로 출력한다.
|
||||
*
|
||||
* @param searchVO
|
||||
* 검색조건 VO
|
||||
* @param model
|
||||
* Model객체
|
||||
* @return 외사장비현황
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping("/faMemberListExcel.do")
|
||||
public String faMemberListExcel(@ModelAttribute("memberSearchVO") final MemberSearchVO searchVO, final Model model) throws Exception {
|
||||
|
||||
String title = "외사경찰현황";
|
||||
|
||||
List<MemberVO> memberList = memberService.getFaListAll(searchVO);
|
||||
|
||||
LinkedHashMap<String, String> header = new LinkedHashMap<String, String>();
|
||||
header.put("place1N2Str", "소속");
|
||||
header.put("positionStr", "계급");
|
||||
header.put("name", "성명");
|
||||
header.put("userid", "아이디");
|
||||
header.put("inoutStr", "근무형태");
|
||||
header.put("jobtypeStr", "직별");
|
||||
header.put("usegrade", "등급");
|
||||
|
||||
model.addAttribute("excel", new ExcelExporter<MemberVO>(header, memberList, title));
|
||||
model.addAttribute("filename", title);
|
||||
|
||||
return "excelView";
|
||||
}
|
||||
|
||||
/**
|
||||
* 외사경찰 정보수정 화면을 반환한다.
|
||||
*
|
||||
* "/faMemberUpdateView.do" = 관리자-외사경찰현황
|
||||
* "/cmmnMemberUpdateView.do" = 외사경찰-일반현황
|
||||
*
|
||||
* @param memberVO 외사경찰 정보
|
||||
* @param model 모델 객체
|
||||
* @param request 리퀘스트 객체
|
||||
* @return 외사경찰 정보 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value = {"/faMemberUpdateView.do", "/cmmnMemberUpdateView.do"}, method = RequestMethod.POST)
|
||||
public String faMemberUpdateView(@ModelAttribute("memberVO") final MemberVO memberVO, final Model model,
|
||||
final HttpServletRequest request) throws Exception {
|
||||
/* 외사경찰 */
|
||||
memberVO.setUsertype(UserType.FA);
|
||||
|
||||
model.addAttribute("memberVO", memberService.select(memberVO));
|
||||
model.addAttribute("place1List", codeService.getPlace1List(false));
|
||||
model.addAttribute("positionList", codeService.getPositionList());
|
||||
model.addAttribute("dutiesList", codeService.getDutiesList());
|
||||
model.addAttribute("jobTypeList", codeService.getJobTypeList());
|
||||
model.addAttribute("scholarshipList", codeService.getScholarshipList());
|
||||
|
||||
/* create or modify 플래그 */
|
||||
model.addAttribute("registerFlag", "modify");
|
||||
|
||||
/* 요청한 url에 따라 돌아갈 목록 타입을 설정한다. */
|
||||
String requestUrl = request.getRequestURL().toString();
|
||||
if (requestUrl.indexOf("/faMemberUpdateView.do") > 0) {
|
||||
model.addAttribute("listType", "fa");
|
||||
} else {
|
||||
model.addAttribute("listType", "cmmn");
|
||||
}
|
||||
|
||||
return "admin/faMemberAdd.tiles";
|
||||
}
|
||||
|
||||
/**
|
||||
* 외사경찰 정보를 수정한다.
|
||||
*
|
||||
* @param multiRequest
|
||||
* multpart타입의 요청 객체
|
||||
* @param memberVO
|
||||
* 외사경찰 정보 객체
|
||||
* @param bindingResult
|
||||
* 바인딩 객체
|
||||
* @param model
|
||||
* 모델 객체
|
||||
* @param status
|
||||
* 세선 상태 객체
|
||||
* @return 게시물 화면
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value = {"/faMemberUpdate.do", "/cmmnMemberUpdate.do"}, method = RequestMethod.POST)
|
||||
public String faMemberUpdate(final MultipartHttpServletRequest multiRequest, @ModelAttribute("memberVO") final MemberVO memberVO,
|
||||
final BindingResult bindingResult, final Model model, final SessionStatus status) throws Exception {
|
||||
|
||||
HashMap<String, Object> result = new HashMap<String, Object>();
|
||||
|
||||
try {
|
||||
/* 유효성 검사 */
|
||||
if (bindingResult.hasErrors()) {
|
||||
model.addAttribute("memberVO", memberVO);
|
||||
model.addAttribute("place1List", codeService.getPlace1List(false));
|
||||
model.addAttribute("positionList", codeService.getPositionList());
|
||||
model.addAttribute("dutiesList", codeService.getDutiesList());
|
||||
model.addAttribute("jobTypeList", codeService.getJobTypeList());
|
||||
model.addAttribute("scholarshipList", codeService.getScholarshipList());
|
||||
return "admin/faMemberAdd.tiles";
|
||||
}
|
||||
|
||||
String [] deleteFiles = null;
|
||||
result = memberService.updateFaMember(memberVO, multiRequest.getFileMap(), deleteFiles);
|
||||
|
||||
if ((Integer) result.get("result") != 1) {
|
||||
return "redirect:/admin/faMemberAdd.do";
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
/* 요청한 url에 따라 돌아갈 목록url을 반환한다. */
|
||||
String requestUrl = multiRequest.getRequestURL().toString();
|
||||
if (requestUrl.indexOf("/faMemberUpdate.do") > 0) {
|
||||
return "redirect:/admin/faMemberList.do";
|
||||
} else {
|
||||
return "redirect:/admin/faMemberCmmnList.do";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 외사경찰 권한설정 화면을 반환한다.
|
||||
*
|
||||
* @param searchVO searchVO 객체
|
||||
* @param model 모델 객체
|
||||
* @return 외사경찰 권한설정 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping("/memberAuth.do")
|
||||
public String memberAuth(final MemberSearchVO searchVO, final Model model) throws Exception {
|
||||
|
||||
LoginUserVO user = UserUtil.getMemberInfo();
|
||||
if (StringUtils.isBlank(searchVO.getPlace1())) {
|
||||
searchVO.setPlace1(user.getPlace1());
|
||||
}
|
||||
|
||||
/* 페이징 처리 정보 */
|
||||
searchVO.setPageUnit(20);
|
||||
searchVO.setPageSize(propertiesService.getInt("pageSize"));
|
||||
|
||||
/* 페이징 처리 */
|
||||
PaginationInfo paginationInfo = new PaginationInfo();
|
||||
paginationInfo.setCurrentPageNo(searchVO.getPageIndex());
|
||||
paginationInfo.setRecordCountPerPage(searchVO.getPageUnit());
|
||||
paginationInfo.setPageSize(searchVO.getPageSize());
|
||||
|
||||
searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
|
||||
searchVO.setLastIndex(paginationInfo.getLastRecordIndex());
|
||||
searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
|
||||
|
||||
int totSearchCnt = memberAuthService.getMemberListByPlace1Cnt(searchVO);
|
||||
paginationInfo.setTotalRecordCount(totSearchCnt);
|
||||
model.addAttribute("paginationInfo", paginationInfo);
|
||||
|
||||
HashMap<String, Object> result = memberAuthService.getMemberListByPlace1(searchVO);
|
||||
model.addAttribute("head", result.get("head"));
|
||||
model.addAttribute("section", result.get("section"));
|
||||
model.addAttribute("resultList", result.get("resultList"));
|
||||
model.addAttribute("loginUserVO", user);
|
||||
|
||||
String targetPlace1 = searchVO.getPlace1();
|
||||
if (StringUtils.isBlank(targetPlace1)) {
|
||||
targetPlace1 = user.getPlace1();
|
||||
}
|
||||
model.addAttribute("targetPlace1", targetPlace1);
|
||||
|
||||
|
||||
|
||||
List<CodeVO> placeList = codeService.getPlace1List(true);
|
||||
model.addAttribute("placeList", placeList);
|
||||
|
||||
return "admin/faMemberAuth.tiles";
|
||||
}
|
||||
|
||||
/**
|
||||
* 외사경찰의 권한을 설정한다.
|
||||
*
|
||||
* @param memberVO userid, usegrade 정보
|
||||
* @return 결과 : 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/memberAuth.json")
|
||||
public HashMap<String, Object> memberAuth(final MemberVO memberVO) throws Exception {
|
||||
HashMap<String, Object> results = new HashMap<String, Object>();
|
||||
int result = memberAuthService.updateMemberAuth(memberVO);
|
||||
results.put("result", result);
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* 외사경찰의 견문권한을 설정한다.
|
||||
*
|
||||
* @param memberVO userid, usegrade 정보
|
||||
* @return 결과 : 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/memberRpt.json")
|
||||
public HashMap<String, Object> memberRpt(final MemberVO memberVO) throws Exception {
|
||||
HashMap<String, Object> results = new HashMap<String, Object>();
|
||||
int result = memberAuthService.updateMemberRpt(memberVO);
|
||||
results.put("result", result);
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* 외사경찰 부서 계장 권한을 설정한다.
|
||||
*
|
||||
* @param memberVO userid 정보
|
||||
* @return 결과 : 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/updateSection.json")
|
||||
public HashMap<String, Object> updateSection(final MemberVO memberVO) throws Exception {
|
||||
HashMap<String, Object> results = new HashMap<String, Object>();
|
||||
int result = memberAuthService.updateSection(memberVO);
|
||||
results.put("result", result);
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* 외사경찰 부서 과장 권한을 설정한다.
|
||||
*
|
||||
* @param memberVO userid 정보
|
||||
* @return 결과 : 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/updateHead.json")
|
||||
public HashMap<String, Object> updateHead(final MemberVO memberVO) throws Exception {
|
||||
HashMap<String, Object> results = new HashMap<String, Object>();
|
||||
int result = memberAuthService.updateHead(memberVO);
|
||||
results.put("result", result);
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 일반경찰 목록을 반환한다.
|
||||
*
|
||||
* @param searchVO 검색, 페이지 정보 객체
|
||||
* @param model 모델 객체
|
||||
* @return 외사경찰 정보 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping("/cmmnMemberList.do")
|
||||
public String memberList(@ModelAttribute("memberSearchVO") final MemberSearchVO searchVO, final Model model) throws Exception {
|
||||
try {
|
||||
/* 일반 경찰 */
|
||||
searchVO.setUsertype(UserType.CM);
|
||||
|
||||
/* 페이징 처리 정보 */
|
||||
searchVO.setPageUnit(propertiesService.getInt("pageUnit"));
|
||||
searchVO.setPageSize(propertiesService.getInt("pageSize"));
|
||||
|
||||
/* 페이징 처리 */
|
||||
PaginationInfo paginationInfo = new PaginationInfo();
|
||||
paginationInfo.setCurrentPageNo(searchVO.getPageIndex());
|
||||
paginationInfo.setRecordCountPerPage(searchVO.getPageUnit());
|
||||
paginationInfo.setPageSize(searchVO.getPageSize());
|
||||
|
||||
searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
|
||||
searchVO.setLastIndex(paginationInfo.getLastRecordIndex());
|
||||
searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
|
||||
|
||||
int totSearchCnt = memberService.selectListCnt(searchVO);
|
||||
paginationInfo.setTotalRecordCount(totSearchCnt);
|
||||
model.addAttribute("paginationInfo", paginationInfo);
|
||||
|
||||
/* 게시판 상단 페이지 및 게시물 정보 표현을 위한 데이터 */
|
||||
int totCnt = memberService.selectTotalCnt(searchVO);
|
||||
model.addAttribute("totalCnt", totCnt);
|
||||
List<MemberVO> resultList = memberService.selectList(searchVO);
|
||||
model.addAttribute("resultList", resultList);
|
||||
model.addAttribute("place1List", codeService.getPlace1List(false));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return "admin/cmmnMemberList.tiles";
|
||||
}
|
||||
|
||||
/**
|
||||
* 외사 경찰의 현황을 엑셀로 출력한다.
|
||||
*
|
||||
* @param model Model객체
|
||||
* @return 엑셀
|
||||
*/
|
||||
@RequestMapping("/cmmnMemberListExcel.do")
|
||||
public String memberListExcel(@ModelAttribute("memberSearchVO") final MemberSearchVO searchVO, final Model model) throws Exception {
|
||||
|
||||
/* 일반 경찰 */
|
||||
searchVO.setUsertype(UserType.CM);
|
||||
|
||||
String title = "일반경찰현황";
|
||||
|
||||
searchVO.setUsertype("");
|
||||
List<MemberVO> memberList = memberService.selectListAll(searchVO);
|
||||
|
||||
LinkedHashMap<String, String> header = new LinkedHashMap<String, String>();
|
||||
header.put("place3Str", "소속");
|
||||
header.put("positionStr", "계급");
|
||||
header.put("useridStr", "아이디");
|
||||
header.put("name", "성명");
|
||||
|
||||
model.addAttribute("excel", new ExcelExporter<MemberVO>(header, memberList, title));
|
||||
model.addAttribute("filename", title);
|
||||
|
||||
return "excelView";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 사용자 로그 통계를 반환한다.
|
||||
*
|
||||
* @param searchVO 검색, 페이지 정보 객체
|
||||
* @param model 모델 객체
|
||||
* @return 사용자 로그 통계 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping("/userLogStatistics.do")
|
||||
public String userLogStatistics(@ModelAttribute("logSearchVO") final LogSearchVO searchVO, final Model model) throws Exception {
|
||||
try {
|
||||
/* 페이징 처리 정보 */
|
||||
searchVO.setPageUnit(propertiesService.getInt("pageUnit"));
|
||||
searchVO.setPageSize(propertiesService.getInt("pageSize"));
|
||||
|
||||
if (StringUtils.isEmpty(searchVO.getSdate()) && StringUtils.isEmpty(searchVO.getEdate())) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Calendar day = Calendar.getInstance();
|
||||
day.add(Calendar.MONTH, -1);
|
||||
searchVO.setSdate(sdf.format(day.getTime()));
|
||||
|
||||
searchVO.setEdate(sdf.format(new Date()));
|
||||
}
|
||||
|
||||
/* 페이징 처리 */
|
||||
PaginationInfo paginationInfo = new PaginationInfo();
|
||||
paginationInfo.setCurrentPageNo(searchVO.getPageIndex());
|
||||
paginationInfo.setRecordCountPerPage(searchVO.getPageUnit());
|
||||
paginationInfo.setPageSize(searchVO.getPageSize());
|
||||
|
||||
searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
|
||||
searchVO.setLastIndex(paginationInfo.getLastRecordIndex());
|
||||
searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
|
||||
|
||||
int totSearchCnt = logService.selectListCnt(searchVO);
|
||||
paginationInfo.setTotalRecordCount(totSearchCnt);
|
||||
model.addAttribute("paginationInfo", paginationInfo);
|
||||
|
||||
/* 게시판 상단 페이지 및 게시물 정보 표현을 위한 데이터 */
|
||||
int totCnt = logService.selectTotalCnt(searchVO);
|
||||
model.addAttribute("totalCnt", totCnt);
|
||||
|
||||
model.addAttribute("resultList", logService.getUserLogList(searchVO));
|
||||
model.addAttribute("place1List", codeService.getPlace1List(false));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return "admin/logStatistics.tiles";
|
||||
}
|
||||
|
||||
/**
|
||||
* 접속설정 화면 반환한다.
|
||||
*
|
||||
* @param searchVO 검색, 페이지 정보 객체
|
||||
* @param model 모델 객체
|
||||
* @return 접속설정 정보 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping("/memberManage.do")
|
||||
public String memberManage(@ModelAttribute("memberSearchVO") final MemberSearchVO searchVO, final Model model) throws Exception {
|
||||
try {
|
||||
/* 페이징 처리 정보 */
|
||||
searchVO.setPageUnit(propertiesService.getInt("pageUnit"));
|
||||
searchVO.setPageSize(propertiesService.getInt("pageSize"));
|
||||
|
||||
/* 페이징 처리 */
|
||||
PaginationInfo paginationInfo = new PaginationInfo();
|
||||
paginationInfo.setCurrentPageNo(searchVO.getPageIndex());
|
||||
paginationInfo.setRecordCountPerPage(searchVO.getPageUnit());
|
||||
paginationInfo.setPageSize(searchVO.getPageSize());
|
||||
|
||||
searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
|
||||
searchVO.setLastIndex(paginationInfo.getLastRecordIndex());
|
||||
searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
|
||||
|
||||
int totSearchCnt = memberService.selectListCnt(searchVO);
|
||||
paginationInfo.setTotalRecordCount(totSearchCnt);
|
||||
model.addAttribute("paginationInfo", paginationInfo);
|
||||
|
||||
/* 게시판 상단 페이지 및 게시물 정보 표현을 위한 데이터 */
|
||||
int totCnt = memberService.selectTotalCnt(searchVO);
|
||||
model.addAttribute("totalCnt", totCnt);
|
||||
|
||||
List<MemberVO> memberList = memberService.selectList(searchVO);
|
||||
model.addAttribute("resultList", memberList);
|
||||
model.addAttribute("place1List", codeService.getPlace1List(false));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return "admin/memberManage.tiles";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 접속설정 화면 반환한다.
|
||||
*
|
||||
* @param searchVO 검색, 페이지 정보 객체
|
||||
* @param model 모델 객체
|
||||
* @return 접속설정 정보 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping("/initPw.json")
|
||||
public HashMap<String, Object> initPw(final MemberVO memberVO, final String[] targetId) throws Exception {
|
||||
HashMap<String, Object> resultMap = new HashMap<String, Object>();
|
||||
try {
|
||||
resultMap = memberService.initPassword(memberVO, targetId);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
|
||||
@Autowired
|
||||
private SessionRegistry sessionRegistry;
|
||||
@Resource(name="securityMapper")
|
||||
private SecurityMapper securityMapper;
|
||||
@Resource(name="userService")
|
||||
private UserDetailsService securityService;
|
||||
@Resource(name="loginSuccessHandler")
|
||||
private AuthenticationSuccessHandler successHandler;
|
||||
/**
|
||||
* 사용자 접속을 해지한다.
|
||||
*
|
||||
* @param searchVO 검색, 페이지 정보 객체
|
||||
* @param model 모델 객체
|
||||
* @return 접속설정 정보 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping("/loginUser.do")
|
||||
public void loginUser(final HttpServletRequest request, final HttpServletResponse response, final String userid) throws Exception {
|
||||
Authentication authentication = null;
|
||||
if (userid != null) {
|
||||
authentication = login(userid);
|
||||
} else {
|
||||
authentication = UserUtil.getCurrentAuthentication();
|
||||
}
|
||||
successHandler.onAuthenticationSuccess(request, response, authentication);
|
||||
}
|
||||
|
||||
/**
|
||||
* 사용자 접속을 해지한다.
|
||||
*
|
||||
* @param searchVO 검색, 페이지 정보 객체
|
||||
* @param model 모델 객체
|
||||
* @return 접속설정 정보 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping("/releaseConnection.json")
|
||||
public HashMap<String, Object> releaseConnection(final MemberVO memberVO) throws Exception {
|
||||
HashMap<String, Object> resultMap = new HashMap<String, Object>();
|
||||
resultMap.put("result", logout(memberVO.getUserid()));
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 접속 제한을 해지한다.
|
||||
*
|
||||
* @param searchVO 검색, 페이지 정보 객체
|
||||
* @param model 모델 객체
|
||||
* @return 접속설정 정보 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping("/releaseRestriction.json")
|
||||
public HashMap<String, Object> releaseRestriction(final MemberVO memberVO) throws Exception {
|
||||
HashMap<String, Object> resultMap = new HashMap<String, Object>();
|
||||
resultMap.put("result", 0);
|
||||
|
||||
try {
|
||||
resultMap = memberService.initChkcnt(memberVO);
|
||||
logout(memberVO.getUserid());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 해당 아이디를 세션에서 로그아웃 시킨다.
|
||||
*
|
||||
* @param userid 로그아웃 대상 아이디
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
private final int logout(final String userid) {
|
||||
int result = 0;
|
||||
EgovUserDetails target = null;
|
||||
List<Object> principals = sessionRegistry.getAllPrincipals();
|
||||
for (Object principal: principals) {
|
||||
if (principal instanceof EgovUserDetails) {
|
||||
EgovUserDetails details = (EgovUserDetails) principal;
|
||||
LoginUserVO vo = (LoginUserVO) details.getEgovUserVO();
|
||||
if (userid.equals(vo.getUserid())) {
|
||||
for (final SessionInformation session : sessionRegistry.getAllSessions(principal, false)) {
|
||||
session.expireNow();
|
||||
vo.setLoginchk("N");
|
||||
result = securityMapper.updateLoginInfo(vo);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 해당 아이디로 로그인한다.
|
||||
*
|
||||
* @param userid 로그인 대상 아이디
|
||||
* @return Authentication 인증정보객체
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
private final Authentication login(final String userid) {
|
||||
Authentication auth = null;
|
||||
try {
|
||||
UserDetails user = securityService.loadUserByUsername(userid);
|
||||
auth = new UsernamePasswordAuthenticationToken(user, null, user.getAuthorities());
|
||||
SecurityContextHolder.getContext().setAuthentication(auth);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return auth;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 코드관리 페이지를 반환한다.
|
||||
*
|
||||
* @param searchVO 검색, 페이지 정보 객체
|
||||
* @param model 모델 객체
|
||||
* @return 코드관리 페이지
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping("/codeManage.do")
|
||||
public String codeManage(final CodeVO codeVO, final Model model) throws Exception {
|
||||
|
||||
if (codeVO.getCode1() != null) {
|
||||
model.addAttribute("code", codeService.getCodeValue("C000", codeVO.getCode1()));
|
||||
}
|
||||
model.addAttribute("code1List", codeService.getCodeValues("C000", null));
|
||||
|
||||
return "admin/codeManage.tiles";
|
||||
}
|
||||
|
||||
/**
|
||||
* 세부코드 리스트를 반환한다.
|
||||
*
|
||||
* @param code1 대분류코드
|
||||
* @param model 모델 객체
|
||||
* @return 세부코드 리스트
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping("/getCode2List.json")
|
||||
public HashMap<String, Object> getCode2List(final String code1) throws Exception {
|
||||
HashMap<String, Object> resultMap = new HashMap<String, Object>();
|
||||
try {
|
||||
resultMap.put("code2List", codeService.getCodeValues(code1, null));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 코드를 추가한다.
|
||||
*
|
||||
* @param codeVO CodeVO 객체
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping("/insertCode.json")
|
||||
public HashMap<String, Object> insertCode(final CodeVO codeVO) throws Exception {
|
||||
HashMap<String, Object> resultMap = new HashMap<String, Object>();
|
||||
try {
|
||||
resultMap.put("result", codeService.insertCode(codeVO));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 코드를 수정한다.
|
||||
*
|
||||
* @param codeVO CodeVO 객체
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping("/updateCode.json")
|
||||
public HashMap<String, Object> updateCode(final CodeVO codeVO) throws Exception {
|
||||
HashMap<String, Object> resultMap = new HashMap<String, Object>();
|
||||
try {
|
||||
resultMap.put("result", codeService.updateCode(codeVO));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 코드를 삭제한다.
|
||||
*
|
||||
* @param codeVO CodeVO 객체
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping("/deleteCode.json")
|
||||
public HashMap<String, Object> deleteCode(final CodeVO codeVO) throws Exception {
|
||||
HashMap<String, Object> resultMap = new HashMap<String, Object>();
|
||||
try {
|
||||
resultMap.put("result", codeService.deleteCode(codeVO));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
package kcg.faics.arrest.service;
|
||||
|
||||
/**
|
||||
* ArrestService.java
|
||||
* @author 이영호
|
||||
* @since 2017. 3. 17.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2017. 3. 17. 이영호 최초생성
|
||||
*
|
||||
*/
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import kcg.faics.arrest.vo.ArrestCountVO;
|
||||
import kcg.faics.arrest.vo.ArrestSearchVO;
|
||||
import kcg.faics.arrest.vo.ArrestVO;
|
||||
import kcg.faics.cmmn.vo.CodeVO;
|
||||
|
||||
public interface ArrestService {
|
||||
|
||||
/**
|
||||
* 주소 대분류를 반환한다.
|
||||
*
|
||||
* @param
|
||||
* @return 소속 1 목록
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
List<CodeVO> getAddressAreaList(String area) throws Exception;
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보를 등록한다.
|
||||
*
|
||||
* @param arrestVO
|
||||
* @return Map("result") = 1 : 성공, <else> : 실패
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
HashMap<String, Object> insert(ArrestVO arrestVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보를 수정한다.
|
||||
*
|
||||
* @param arrestVO
|
||||
* @return Map("result") = 1 : 성공, <else> : 실패
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
HashMap<String, Object> update(ArrestVO arrestVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보를 삭제한다.
|
||||
*
|
||||
* @param arrestVO
|
||||
* @return Map("result") = 1 : 성공, <else> : 실패
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
HashMap<String, Object> delete(ArrestVO arrestVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보를 조회한다.
|
||||
*
|
||||
* @param arrestVO
|
||||
* @return Map("result") = 1 : 성공, <else> : 실패
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
ArrestVO select(ArrestVO arrestVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보 목록을 전체조회한다.
|
||||
*
|
||||
* @param arrestVO
|
||||
* @return Map("result") = 1 : 성공, <else> : 실패
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
List<ArrestVO> getArrestListAll(ArrestSearchVO arrestSearchVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보 목록을 조회(검색)한다.
|
||||
*
|
||||
* @param arrestVO
|
||||
* @return Map("result") = 1 : 성공, <else> : 실패
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
List<ArrestVO> getArrestList(ArrestSearchVO arrestSearchVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보 목록을 조회(검색)한다.
|
||||
*
|
||||
* @param arrestVO
|
||||
* @return Map("result") = 1 : 성공, <else> : 실패
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
List<ArrestVO> getArrestListExcel(ArrestSearchVO arrestSearchVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보 목록을 조회(검색)한다.
|
||||
*
|
||||
* @param arrestVO
|
||||
* @return Map("result") = 1 : 성공, <else> : 실패
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
List<HashMap<String, Object>> getArrestListExcelHashMap(ArrestSearchVO arrestSearchVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보 목록 집계정보를 조회한다.
|
||||
*
|
||||
* @param arrestVO
|
||||
* @return Map("result") = 1 : 성공, <else> : 실패
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
ArrestVO getArrestListCount(ArrestSearchVO arrestSearchVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보 목록 집계정보를 조회한다.
|
||||
*
|
||||
* @param arrestVO
|
||||
* @return Map("result") = 1 : 성공, <else> : 실패
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
ArrestVO getArrestListCountExcel(ArrestSearchVO arrestSearchVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보 목록 전체 집계정보를 조회한다.
|
||||
*
|
||||
* @param arrestVO
|
||||
* @return Map("result") = 1 : 성공, <else> : 실패
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
ArrestCountVO getArrestListAllCount(ArrestSearchVO arrestSearchVO) throws Exception;
|
||||
}
|
||||
|
|
@ -0,0 +1,218 @@
|
|||
package kcg.faics.arrest.service.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import kcg.faics.arrest.vo.ArrestCountVO;
|
||||
import kcg.faics.arrest.vo.ArrestSearchVO;
|
||||
import kcg.faics.arrest.vo.ArrestVO;
|
||||
import kcg.faics.board.vo.BoardSearchVO;
|
||||
import kcg.faics.board.vo.BoardVO;
|
||||
import kcg.faics.cmmn.vo.CodeVO;
|
||||
import kcg.faics.member.vo.MemberSearchVO;
|
||||
import kcg.faics.member.vo.MemberVO;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
|
||||
|
||||
|
||||
/**
|
||||
* ArrestMapper.java
|
||||
* @author 이영호
|
||||
* @since 2017. 3. 14.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2017. 3. 16. 이영호 최초생성
|
||||
*
|
||||
*/
|
||||
@Repository("arrestMapper")
|
||||
public class ArrestMapper extends EgovAbstractMapper {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보를 등록한다.
|
||||
*
|
||||
* @param arrestVO 게시판 내용 구성 객체
|
||||
* @return 글 총 갯수
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public HashMap<String, Object> insertArrest(final ArrestVO arrestVO) throws Exception {
|
||||
|
||||
HashMap<String, Object> resultMap = new HashMap<String, Object>();
|
||||
|
||||
int result = 0;
|
||||
try {
|
||||
result = insert("Arrest.insertArrest", arrestVO);
|
||||
resultMap.put("result", result);
|
||||
resultMap.put("id", "");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return resultMap;
|
||||
};
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보를 수정한다.
|
||||
*
|
||||
* @param arrestVO 나포정보 객체
|
||||
* @return 글 총 갯수
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public HashMap<String, Object> updateArrest(final ArrestVO arrestVO) throws Exception {
|
||||
|
||||
HashMap<String, Object> resultMap = new HashMap<String, Object>();
|
||||
|
||||
int result = 0;
|
||||
try {
|
||||
result = insert("Arrest.updateArrest", arrestVO);
|
||||
resultMap.put("result", result);
|
||||
resultMap.put("id", arrestVO.getArrestId());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보를 삭제한다.
|
||||
*
|
||||
* @param boardVO 게시판 내용 구성 객체
|
||||
* @return 글 총 갯수
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public HashMap<String, Object> deleteArrest(final ArrestVO arrestVO) throws Exception {
|
||||
|
||||
HashMap<String, Object> resultMap = new HashMap<String, Object>();
|
||||
|
||||
int result = 0;
|
||||
try {
|
||||
result = insert("Arrest.deleteArrest", arrestVO);
|
||||
resultMap.put("result", result);
|
||||
resultMap.put("arrestId", arrestVO.getArrestId());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return resultMap;
|
||||
};
|
||||
|
||||
/**
|
||||
* 주소지 시군구 명을 반환한다.
|
||||
*
|
||||
* @param onlyCentral
|
||||
* 중앙부처만 반환 - true, 모든 목록반환 - false
|
||||
* @return 소속 1 목록
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public List<CodeVO> getAddressAreaList(String area) throws Exception {
|
||||
List<CodeVO> tempList = selectList("Arrest.getAddressAreaList", area);
|
||||
return tempList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보를 반환한다.
|
||||
*
|
||||
* @param dataVO
|
||||
* @return 선택한 사용자 정보 반환
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public ArrestVO getArrest(final ArrestVO dataVO) {
|
||||
ArrestVO result = selectOne("Arrest.getArrest", dataVO);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보 목록(no paging)을 반환한다.
|
||||
*
|
||||
* @param arrestSearchVO
|
||||
* 검색정보 객체
|
||||
* @return 게시물 리스트
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
public List<ArrestVO> getArrestListAll(final ArrestSearchVO arrestSearchVO) throws Exception {
|
||||
return selectList("Arrest.getArrestListAll", arrestSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보 목록조회
|
||||
*
|
||||
* @param arrestSearchVO
|
||||
* 검색정보 객체
|
||||
* @return 게시물 리스트
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
public List<ArrestVO> getArrestList(final ArrestSearchVO arrestSearchVO) throws Exception {
|
||||
return selectList("Arrest.getArrestList", arrestSearchVO);
|
||||
}
|
||||
/**
|
||||
* 중국어선 나포정보 집계정보조회
|
||||
*
|
||||
* @param arrestSearchVO
|
||||
* 검색정보 객체
|
||||
* @return 게시물 리스트
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
public ArrestVO getArrestListCount(final ArrestSearchVO arrestSearchVO) throws Exception {
|
||||
return selectOne("Arrest.getArrestListCount", arrestSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보 집계정보조회
|
||||
*
|
||||
* @param arrestSearchVO
|
||||
* 검색정보 객체
|
||||
* @return 게시물 리스트
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
public ArrestVO getArrestListCountExcel(final ArrestSearchVO arrestSearchVO) throws Exception {
|
||||
return selectOne("Arrest.getArrestListCountExcel", arrestSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보 집계정보조회
|
||||
*
|
||||
* @param arrestSearchVO
|
||||
* 검색정보 객체
|
||||
* @return 게시물 리스트
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
public ArrestCountVO getArrestListAllCount(final ArrestSearchVO arrestSearchVO) throws Exception {
|
||||
return selectOne("Arrest.getArrestListAllCount", arrestSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보 집계정보조회
|
||||
*
|
||||
* @param arrestSearchVO
|
||||
* 검색정보 객체
|
||||
* @return 게시물 리스트
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
public List<ArrestVO> getArrestListExcel(final ArrestSearchVO arrestSearchVO) throws Exception {
|
||||
return selectList("Arrest.getArrestListExcel", arrestSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보 집계정보조회
|
||||
*
|
||||
* @param arrestSearchVO
|
||||
* 검색정보 객체
|
||||
* @return 게시물 리스트
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
public List<HashMap<String, Object>> getArrestListExcelHashMap(final ArrestSearchVO arrestSearchVO) {
|
||||
return selectList("Arrest.getArrestListExcelHashMap", arrestSearchVO);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,247 @@
|
|||
/**
|
||||
* CommonService.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 13.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 13. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
package kcg.faics.arrest.service.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import kcg.faics.arrest.service.ArrestService;
|
||||
import kcg.faics.arrest.vo.ArrestCountVO;
|
||||
import kcg.faics.arrest.vo.ArrestSearchVO;
|
||||
import kcg.faics.arrest.vo.ArrestVO;
|
||||
import kcg.faics.cmmn.vo.CodeVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
/**
|
||||
* ArrestServiceImpl.java
|
||||
* @author 이영호
|
||||
* @since 2016. 3. 17.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2017. 3. 17. 이영호 최초생성
|
||||
*
|
||||
*/
|
||||
@Service("arrestService")
|
||||
public class ArrestServiceImpl implements ArrestService {
|
||||
|
||||
/**
|
||||
* ArrestMapper.
|
||||
*/
|
||||
@Resource(name = "arrestMapper")
|
||||
private ArrestMapper arrestMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 주소목록을 조회한다.
|
||||
*
|
||||
* @param String area
|
||||
* @param String area
|
||||
* @return List<CodeVO> 특별광역시도 목록
|
||||
* @exception Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public List<CodeVO> getAddressAreaList(String area) throws Exception {
|
||||
List<CodeVO> codeVOList = arrestMapper.getAddressAreaList(area);
|
||||
return codeVOList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보를 추가한다.
|
||||
*
|
||||
* @param dataVO 사용자 정보 객체
|
||||
* @param fileMap 업로드 파일정보
|
||||
* @return HashMap/ seq : 게시물 , result : 성공 - 1, 실패 - 0
|
||||
* @exception Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public HashMap<String, Object> insert(final ArrestVO arrestVO) throws Exception {
|
||||
|
||||
HashMap<String, Object> result = new HashMap<String, Object>();
|
||||
|
||||
//
|
||||
if(!arrestVO.getShipProcType().equals("01")){
|
||||
arrestVO.setCommissionCost("");
|
||||
}
|
||||
|
||||
if(arrestVO.getMarginPaymentYn().equals("N")){
|
||||
arrestVO.setMarginPaymentDate("");
|
||||
}
|
||||
|
||||
result = arrestMapper.insertArrest(arrestVO);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보를 수정한다.
|
||||
*
|
||||
* @param dataVO 사용자 정보 객체
|
||||
* @param fileMap 업로드 파일정보
|
||||
* @return HashMap/ seq : 게시물 , result : 성공 - 1, 실패 - 0
|
||||
* @exception Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public HashMap<String, Object> update(final ArrestVO arrestVO) throws Exception {
|
||||
|
||||
HashMap<String, Object> result = new HashMap<String, Object>();
|
||||
|
||||
if(!arrestVO.getShipProcType().equals("01")){
|
||||
arrestVO.setCommissionCost("");
|
||||
}
|
||||
|
||||
if(arrestVO.getMarginPaymentYn().equals("N")){
|
||||
arrestVO.setMarginPaymentDate("");
|
||||
}
|
||||
|
||||
|
||||
result = arrestMapper.updateArrest(arrestVO);
|
||||
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보를 삭제한다.
|
||||
*
|
||||
* @param dataVO 사용자 정보 객체
|
||||
* @param fileMap 업로드 파일정보
|
||||
* @return HashMap/ seq : 게시물 , result : 성공 - 1, 실패 - 0
|
||||
* @exception Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public HashMap<String, Object> delete(final ArrestVO arrestVO) throws Exception {
|
||||
|
||||
HashMap<String, Object> result = new HashMap<String, Object>();
|
||||
result = arrestMapper.deleteArrest(arrestVO);
|
||||
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보 단건 조회
|
||||
*
|
||||
* @param dataVO userid
|
||||
* @return 선택한 사용자 정보 반환
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public ArrestVO select(final ArrestVO dataVO) throws Exception {
|
||||
|
||||
ArrestVO result = arrestMapper.getArrest(dataVO);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보 목록 전체 조회
|
||||
*
|
||||
* @param dataVO userid
|
||||
* @return 선택한 사용자 정보 반환
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public List<ArrestVO> getArrestListAll(final ArrestSearchVO arrestSearchVO) throws Exception {
|
||||
|
||||
return arrestMapper.getArrestListAll(arrestSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보 목록 전체 조회
|
||||
*
|
||||
* @param dataVO userid
|
||||
* @return 선택한 사용자 정보 반환
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public ArrestCountVO getArrestListAllCount(final ArrestSearchVO arrestSearchVO) throws Exception {
|
||||
|
||||
return arrestMapper.getArrestListAllCount(arrestSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보 목록 조회
|
||||
*
|
||||
* @param dataVO arrestSearchVO
|
||||
* @return 선택한 사용자 정보 반환
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public List<ArrestVO> getArrestList(final ArrestSearchVO arrestSearchVO) throws Exception {
|
||||
|
||||
return arrestMapper.getArrestList(arrestSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보 목록 조회 (엑셀)
|
||||
*
|
||||
* @param dataVO arrestSearchVO
|
||||
* @return 선택한 사용자 정보 반환
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public List<ArrestVO> getArrestListExcel(final ArrestSearchVO arrestSearchVO) throws Exception {
|
||||
|
||||
return arrestMapper.getArrestListExcel(arrestSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보 집계정보 조회
|
||||
*
|
||||
* @param dataVO userid
|
||||
* @return 선택한 사용자 정보 반환
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public ArrestVO getArrestListCount(final ArrestSearchVO arrestSearchVO) throws Exception {
|
||||
|
||||
return arrestMapper.getArrestListCount(arrestSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보 집계정보 조회
|
||||
*
|
||||
* @param dataVO arrestSearchVO
|
||||
* @return 선택한 사용자 정보 반환
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public ArrestVO getArrestListCountExcel(final ArrestSearchVO arrestSearchVO)
|
||||
throws Exception {
|
||||
|
||||
return arrestMapper.getArrestListCountExcel(arrestSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보 목록 조회 (엑셀)
|
||||
*
|
||||
* @param dataVO arrestSearchVO
|
||||
* @return 선택한 사용자 정보 반환
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public List<HashMap<String, Object>> getArrestListExcelHashMap(final ArrestSearchVO arrestSearchVO) throws Exception {
|
||||
|
||||
return arrestMapper.getArrestListExcelHashMap(arrestSearchVO);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,455 @@
|
|||
package kcg.faics.arrest.vo;
|
||||
|
||||
|
||||
public class ArrestCountVO {
|
||||
/**
|
||||
* 특정금지
|
||||
*/
|
||||
private int particularBanCnt = 0;
|
||||
/**
|
||||
* 무허가
|
||||
*/
|
||||
private int withoutLicenseCnt = 0;
|
||||
/**
|
||||
* 영해
|
||||
*/
|
||||
private int territWatersCnt = 0;
|
||||
/**
|
||||
* EEZ
|
||||
*/
|
||||
private int eezCnt = 0;
|
||||
/**
|
||||
* 특공방
|
||||
*/
|
||||
private int specBatlCnt = 0;
|
||||
/**
|
||||
* NLL
|
||||
*/
|
||||
private int nllCnt = 0;
|
||||
/**
|
||||
* 선박제원선원수
|
||||
*/
|
||||
private int shipCrewCnt = 0;
|
||||
/**
|
||||
* 범칙수량
|
||||
*/
|
||||
private int vioCnt = 0;
|
||||
/**
|
||||
* 위판금액
|
||||
*/
|
||||
private int priatedAmt = 0;
|
||||
/**
|
||||
* 조사중
|
||||
*/
|
||||
private int procContNCnt = 0; //
|
||||
/**
|
||||
* 완료
|
||||
*/
|
||||
private int procContYCnt = 0; //
|
||||
/**
|
||||
* 납부액
|
||||
*/
|
||||
private int paymentAmt = 0; //
|
||||
/**
|
||||
* 미납
|
||||
*/
|
||||
private int noPaymentCnt = 0; //
|
||||
/**
|
||||
* 미납액
|
||||
*/
|
||||
private int noPaymentAmt = 0; //
|
||||
/**
|
||||
* 위탁관리
|
||||
*/
|
||||
private int shipProcTypeACnt = 0; //
|
||||
/**
|
||||
* 퇴거
|
||||
*/
|
||||
private int shipProcTypeBCnt = 0; //
|
||||
/**
|
||||
* 직접인계
|
||||
*/
|
||||
private int shipProcTypeCCnt = 0; //
|
||||
/**
|
||||
* 폐기
|
||||
*/
|
||||
private int shipProcTypeDCnt = 0; //
|
||||
/**
|
||||
* 몰수
|
||||
*/
|
||||
private int shipProcTypeECnt = 0; //
|
||||
/**
|
||||
* 구속 선장수
|
||||
*/
|
||||
private int captainCount = 0; //
|
||||
/**
|
||||
* 구속 기관장수
|
||||
*/
|
||||
private int engineerCount = 0; //
|
||||
/**
|
||||
* 구속 항해사수
|
||||
*/
|
||||
private int mateCount = 0; //
|
||||
/**
|
||||
* 구속 선원수
|
||||
*/
|
||||
private int crewCount = 0; //
|
||||
/**
|
||||
* 위탁관리비
|
||||
*/
|
||||
private int commissionCost = 0; //
|
||||
/**
|
||||
* 어구압수 틀
|
||||
*/
|
||||
private int gearCast = 0; //
|
||||
/**
|
||||
* 어구압수 폭
|
||||
*/
|
||||
private int gearWidth = 0; //
|
||||
/**
|
||||
* 현장조사 건수
|
||||
*/
|
||||
private int fieldCnt = 0; //
|
||||
/**
|
||||
* 전체 건수
|
||||
*/
|
||||
private int totalCnt = 0;
|
||||
|
||||
|
||||
/**
|
||||
* @return the noPaymentAmt
|
||||
*/
|
||||
public int getNoPaymentAmt() {
|
||||
return noPaymentAmt;
|
||||
}
|
||||
/**
|
||||
* @param noPaymentAmt the noPaymentAmt to set
|
||||
*/
|
||||
public void setNoPaymentAmt(int noPaymentAmt) {
|
||||
this.noPaymentAmt = noPaymentAmt;
|
||||
}
|
||||
/**
|
||||
* @return the totalCnt
|
||||
*/
|
||||
public int getTotalCnt() {
|
||||
return totalCnt;
|
||||
}
|
||||
/**
|
||||
* @param totalCnt the totalCnt to set
|
||||
*/
|
||||
public void setTotalCnt(int totalCnt) {
|
||||
this.totalCnt = totalCnt;
|
||||
}
|
||||
/**
|
||||
* @return the fieldCnt
|
||||
*/
|
||||
public int getFieldCnt() {
|
||||
return fieldCnt;
|
||||
}
|
||||
/**
|
||||
* @param fieldCnt the fieldCnt to set
|
||||
*/
|
||||
public void setFieldCnt(int fieldCnt) {
|
||||
this.fieldCnt = fieldCnt;
|
||||
}
|
||||
/**
|
||||
* @return the particularBanCnt
|
||||
*/
|
||||
public int getParticularBanCnt() {
|
||||
return particularBanCnt;
|
||||
}
|
||||
/**
|
||||
* @param particularBanCnt the particularBanCnt to set
|
||||
*/
|
||||
public void setParticularBanCnt(int particularBanCnt) {
|
||||
this.particularBanCnt = particularBanCnt;
|
||||
}
|
||||
/**
|
||||
* @return the withoutLicenseCnt
|
||||
*/
|
||||
public int getWithoutLicenseCnt() {
|
||||
return withoutLicenseCnt;
|
||||
}
|
||||
/**
|
||||
* @param withoutLicenseCnt the withoutLicenseCnt to set
|
||||
*/
|
||||
public void setWithoutLicenseCnt(int withoutLicenseCnt) {
|
||||
this.withoutLicenseCnt = withoutLicenseCnt;
|
||||
}
|
||||
/**
|
||||
* @return the territWatersCnt
|
||||
*/
|
||||
public int getTerritWatersCnt() {
|
||||
return territWatersCnt;
|
||||
}
|
||||
/**
|
||||
* @param territWatersCnt the territWatersCnt to set
|
||||
*/
|
||||
public void setTerritWatersCnt(int territWatersCnt) {
|
||||
this.territWatersCnt = territWatersCnt;
|
||||
}
|
||||
/**
|
||||
* @return the eezCnt
|
||||
*/
|
||||
public int getEezCnt() {
|
||||
return eezCnt;
|
||||
}
|
||||
/**
|
||||
* @param eezCnt the eezCnt to set
|
||||
*/
|
||||
public void setEezCnt(int eezCnt) {
|
||||
this.eezCnt = eezCnt;
|
||||
}
|
||||
/**
|
||||
* @return the specBatlCnt
|
||||
*/
|
||||
public int getSpecBatlCnt() {
|
||||
return specBatlCnt;
|
||||
}
|
||||
/**
|
||||
* @param specBatlCnt the specBatlCnt to set
|
||||
*/
|
||||
public void setSpecBatlCnt(int specBatlCnt) {
|
||||
this.specBatlCnt = specBatlCnt;
|
||||
}
|
||||
/**
|
||||
* @return the nllCnt
|
||||
*/
|
||||
public int getNllCnt() {
|
||||
return nllCnt;
|
||||
}
|
||||
/**
|
||||
* @param nllCnt the nllCnt to set
|
||||
*/
|
||||
public void setNllCnt(int nllCnt) {
|
||||
this.nllCnt = nllCnt;
|
||||
}
|
||||
/**
|
||||
* @return the shipCrewCnt
|
||||
*/
|
||||
public int getShipCrewCnt() {
|
||||
return shipCrewCnt;
|
||||
}
|
||||
/**
|
||||
* @param shipCrewCnt the shipCrewCnt to set
|
||||
*/
|
||||
public void setShipCrewCnt(int shipCrewCnt) {
|
||||
this.shipCrewCnt = shipCrewCnt;
|
||||
}
|
||||
/**
|
||||
* @return the vioCnt
|
||||
*/
|
||||
public int getVioCnt() {
|
||||
return vioCnt;
|
||||
}
|
||||
/**
|
||||
* @param vioCnt the vioCnt to set
|
||||
*/
|
||||
public void setVioCnt(int vioCnt) {
|
||||
this.vioCnt = vioCnt;
|
||||
}
|
||||
/**
|
||||
* @return the priatedAmt
|
||||
*/
|
||||
public int getPriatedAmt() {
|
||||
return priatedAmt;
|
||||
}
|
||||
/**
|
||||
* @param priatedAmt the priatedAmt to set
|
||||
*/
|
||||
public void setPriatedAmt(int priatedAmt) {
|
||||
this.priatedAmt = priatedAmt;
|
||||
}
|
||||
/**
|
||||
* @return the procContNCnt
|
||||
*/
|
||||
public int getProcContNCnt() {
|
||||
return procContNCnt;
|
||||
}
|
||||
/**
|
||||
* @param procContNCnt the procContNCnt to set
|
||||
*/
|
||||
public void setProcContNCnt(int procContNCnt) {
|
||||
this.procContNCnt = procContNCnt;
|
||||
}
|
||||
/**
|
||||
* @return the procContYCnt
|
||||
*/
|
||||
public int getProcContYCnt() {
|
||||
return procContYCnt;
|
||||
}
|
||||
/**
|
||||
* @param procContYCnt the procContYCnt to set
|
||||
*/
|
||||
public void setProcContYCnt(int procContYCnt) {
|
||||
this.procContYCnt = procContYCnt;
|
||||
}
|
||||
/**
|
||||
* @return the paymentAmt
|
||||
*/
|
||||
public int getPaymentAmt() {
|
||||
return paymentAmt;
|
||||
}
|
||||
/**
|
||||
* @param paymentAmt the paymentAmt to set
|
||||
*/
|
||||
public void setPaymentAmt(int paymentAmt) {
|
||||
this.paymentAmt = paymentAmt;
|
||||
}
|
||||
/**
|
||||
* @return the noPaymentCnt
|
||||
*/
|
||||
public int getNoPaymentCnt() {
|
||||
return noPaymentCnt;
|
||||
}
|
||||
/**
|
||||
* @param noPaymentCnt the noPaymentCnt to set
|
||||
*/
|
||||
public void setNoPaymentCnt(int noPaymentCnt) {
|
||||
this.noPaymentCnt = noPaymentCnt;
|
||||
}
|
||||
/**
|
||||
* @return the shipProcTypeACnt
|
||||
*/
|
||||
public int getShipProcTypeACnt() {
|
||||
return shipProcTypeACnt;
|
||||
}
|
||||
/**
|
||||
* @param shipProcTypeACnt the shipProcTypeACnt to set
|
||||
*/
|
||||
public void setShipProcTypeACnt(int shipProcTypeACnt) {
|
||||
this.shipProcTypeACnt = shipProcTypeACnt;
|
||||
}
|
||||
/**
|
||||
* @return the shipProcTypeBCnt
|
||||
*/
|
||||
public int getShipProcTypeBCnt() {
|
||||
return shipProcTypeBCnt;
|
||||
}
|
||||
/**
|
||||
* @param shipProcTypeBCnt the shipProcTypeBCnt to set
|
||||
*/
|
||||
public void setShipProcTypeBCnt(int shipProcTypeBCnt) {
|
||||
this.shipProcTypeBCnt = shipProcTypeBCnt;
|
||||
}
|
||||
/**
|
||||
* @return the shipProcTypeCCnt
|
||||
*/
|
||||
public int getShipProcTypeCCnt() {
|
||||
return shipProcTypeCCnt;
|
||||
}
|
||||
/**
|
||||
* @param shipProcTypeCCnt the shipProcTypeCCnt to set
|
||||
*/
|
||||
public void setShipProcTypeCCnt(int shipProcTypeCCnt) {
|
||||
this.shipProcTypeCCnt = shipProcTypeCCnt;
|
||||
}
|
||||
/**
|
||||
* @return the shipProcTypeDCnt
|
||||
*/
|
||||
public int getShipProcTypeDCnt() {
|
||||
return shipProcTypeDCnt;
|
||||
}
|
||||
/**
|
||||
* @param shipProcTypeDCnt the shipProcTypeDCnt to set
|
||||
*/
|
||||
public void setShipProcTypeDCnt(int shipProcTypeDCnt) {
|
||||
this.shipProcTypeDCnt = shipProcTypeDCnt;
|
||||
}
|
||||
/**
|
||||
* @return the shipProcTypeECnt
|
||||
*/
|
||||
public int getShipProcTypeECnt() {
|
||||
return shipProcTypeECnt;
|
||||
}
|
||||
/**
|
||||
* @param shipProcTypeECnt the shipProcTypeECnt to set
|
||||
*/
|
||||
public void setShipProcTypeECnt(int shipProcTypeECnt) {
|
||||
this.shipProcTypeECnt = shipProcTypeECnt;
|
||||
}
|
||||
/**
|
||||
* @return the captainCount
|
||||
*/
|
||||
public int getCaptainCount() {
|
||||
return captainCount;
|
||||
}
|
||||
/**
|
||||
* @param captainCount the captainCount to set
|
||||
*/
|
||||
public void setCaptainCount(int captainCount) {
|
||||
this.captainCount = captainCount;
|
||||
}
|
||||
/**
|
||||
* @return the engineerCount
|
||||
*/
|
||||
public int getEngineerCount() {
|
||||
return engineerCount;
|
||||
}
|
||||
/**
|
||||
* @param engineerCount the engineerCount to set
|
||||
*/
|
||||
public void setEngineerCount(int engineerCount) {
|
||||
this.engineerCount = engineerCount;
|
||||
}
|
||||
/**
|
||||
* @return the mateCount
|
||||
*/
|
||||
public int getMateCount() {
|
||||
return mateCount;
|
||||
}
|
||||
/**
|
||||
* @param mateCount the mateCount to set
|
||||
*/
|
||||
public void setMateCount(int mateCount) {
|
||||
this.mateCount = mateCount;
|
||||
}
|
||||
/**
|
||||
* @return the crewCount
|
||||
*/
|
||||
public int getCrewCount() {
|
||||
return crewCount;
|
||||
}
|
||||
/**
|
||||
* @param crewCount the crewCount to set
|
||||
*/
|
||||
public void setCrewCount(int crewCount) {
|
||||
this.crewCount = crewCount;
|
||||
}
|
||||
/**
|
||||
* @return the commissionCost
|
||||
*/
|
||||
public int getCommissionCost() {
|
||||
return commissionCost;
|
||||
}
|
||||
/**
|
||||
* @param commissionCost the commissionCost to set
|
||||
*/
|
||||
public void setCommissionCost(int commissionCost) {
|
||||
this.commissionCost = commissionCost;
|
||||
}
|
||||
/**
|
||||
* @return the gearCast
|
||||
*/
|
||||
public int getGearCast() {
|
||||
return gearCast;
|
||||
}
|
||||
/**
|
||||
* @param gearCast the gearCast to set
|
||||
*/
|
||||
public void setGearCast(int gearCast) {
|
||||
this.gearCast = gearCast;
|
||||
}
|
||||
/**
|
||||
* @return the gearWidth
|
||||
*/
|
||||
public int getGearWidth() {
|
||||
return gearWidth;
|
||||
}
|
||||
/**
|
||||
* @param gearWidth the gearWidth to set
|
||||
*/
|
||||
public void setGearWidth(int gearWidth) {
|
||||
this.gearWidth = gearWidth;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,349 @@
|
|||
/*
|
||||
* Copyright 2014 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 kcg.faics.arrest.vo;
|
||||
|
||||
import kcg.faics.cmmn.bbs.BaseSearchVO;
|
||||
|
||||
|
||||
/**
|
||||
* ArrestSearchVO.java
|
||||
* @author 이영호
|
||||
* @since 2017. 3. 15.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2017. 3. 15. 이영호 최초생성
|
||||
*
|
||||
*/
|
||||
public class ArrestSearchVO extends BaseSearchVO {
|
||||
|
||||
/**
|
||||
* 시작일자
|
||||
*/
|
||||
private String startDate = "";
|
||||
/**
|
||||
* 종료일자
|
||||
*/
|
||||
private String endDate = "";
|
||||
/**
|
||||
* 검거기관(대분류)
|
||||
*/
|
||||
private String agencyType = "";
|
||||
/**
|
||||
* 검거기관
|
||||
*/
|
||||
private String agencyGuard = "";
|
||||
/**
|
||||
* 검거기관(함정)
|
||||
*/
|
||||
private String agencyVessel = "";
|
||||
/**
|
||||
* 선종
|
||||
*/
|
||||
private String addrArea = "";
|
||||
/**
|
||||
* 선종
|
||||
*/
|
||||
private String addrCity = "";
|
||||
/**
|
||||
* 선종
|
||||
*/
|
||||
private String violateType = "";
|
||||
/**
|
||||
* 선종
|
||||
*/
|
||||
private String shipName = "";
|
||||
|
||||
/**
|
||||
* 기간 처음 invasionType
|
||||
*/
|
||||
private String[] invasionType = null;
|
||||
|
||||
/**
|
||||
* 선종
|
||||
*/
|
||||
private String[] shipType = null;
|
||||
/**
|
||||
* 처리현황
|
||||
*/
|
||||
private String[] procCondition = null;
|
||||
/**
|
||||
* 톤수
|
||||
*/
|
||||
private String[] arrShipTonnage = null;
|
||||
|
||||
/**
|
||||
* 담보금 납부
|
||||
*/
|
||||
private String[] marginPayment = null;
|
||||
/**
|
||||
* 선박처리구분
|
||||
*/
|
||||
private String[] shipProcType = null;
|
||||
/**
|
||||
* 선질
|
||||
*/
|
||||
private String[] shipQuality = null;
|
||||
/**
|
||||
* 선적
|
||||
*/
|
||||
private String[] shipMent = null;
|
||||
/**
|
||||
* NLL여부
|
||||
*/
|
||||
private String[] nllYn = null;
|
||||
/**
|
||||
* 특수공무집행방해여부(특공방)
|
||||
*/
|
||||
private String[] specBatlYn = null;
|
||||
|
||||
/**
|
||||
* @return the agencyType
|
||||
*/
|
||||
public String getAgencyType() {
|
||||
return agencyType;
|
||||
}
|
||||
/**
|
||||
* @param agencyType the agencyType to set
|
||||
*/
|
||||
public void setAgencyType(String agencyType) {
|
||||
this.agencyType = agencyType;
|
||||
}
|
||||
/**
|
||||
* @return the agencyGuard
|
||||
*/
|
||||
public String getAgencyGuard() {
|
||||
return agencyGuard;
|
||||
}
|
||||
/**
|
||||
* @param agencyGuard the agencyGuard to set
|
||||
*/
|
||||
public void setAgencyGuard(String agencyGuard) {
|
||||
this.agencyGuard = agencyGuard;
|
||||
}
|
||||
/**
|
||||
* @return the agencyVessel
|
||||
*/
|
||||
public String getAgencyVessel() {
|
||||
return agencyVessel;
|
||||
}
|
||||
/**
|
||||
* @param agencyVessel the agencyVessel to set
|
||||
*/
|
||||
public void setAgencyVessel(String agencyVessel) {
|
||||
this.agencyVessel = agencyVessel;
|
||||
}
|
||||
/**
|
||||
* @return the nllYn
|
||||
*/
|
||||
public String[] getNllYn() {
|
||||
return nllYn;
|
||||
}
|
||||
/**
|
||||
* @param nllYn the nllYn to set
|
||||
*/
|
||||
public void setNllYn(String[] nllYn) {
|
||||
this.nllYn = nllYn;
|
||||
}
|
||||
/**
|
||||
* @return the specBatlYn
|
||||
*/
|
||||
public String[] getSpecBatlYn() {
|
||||
return specBatlYn;
|
||||
}
|
||||
/**
|
||||
* @param specBatlYn the specBatlYn to set
|
||||
*/
|
||||
public void setSpecBatlYn(String[] specBatlYn) {
|
||||
this.specBatlYn = specBatlYn;
|
||||
}
|
||||
/**
|
||||
* @return the shipProcType
|
||||
*/
|
||||
public String[] getShipProcType() {
|
||||
return shipProcType;
|
||||
}
|
||||
/**
|
||||
* @param shipProcType the shipProcType to set
|
||||
*/
|
||||
public void setShipProcType(String[] shipProcType) {
|
||||
this.shipProcType = shipProcType;
|
||||
}
|
||||
/**
|
||||
* @return the shipQuality
|
||||
*/
|
||||
public String[] getShipQuality() {
|
||||
return shipQuality;
|
||||
}
|
||||
/**
|
||||
* @param shipQuality the shipQuality to set
|
||||
*/
|
||||
public void setShipQuality(String[] shipQuality) {
|
||||
this.shipQuality = shipQuality;
|
||||
}
|
||||
/**
|
||||
* @return the shipMent
|
||||
*/
|
||||
public String[] getShipMent() {
|
||||
return shipMent;
|
||||
}
|
||||
/**
|
||||
* @param shipMent the shipMent to set
|
||||
*/
|
||||
public void setShipMent(String[] shipMent) {
|
||||
this.shipMent = shipMent;
|
||||
}
|
||||
/**
|
||||
* @return the startDate
|
||||
*/
|
||||
public String getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
/**
|
||||
* @param startDate the startDate to set
|
||||
*/
|
||||
public void setStartDate(String startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
/**
|
||||
* @return the endDate
|
||||
*/
|
||||
public String getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
/**
|
||||
* @param endDate the endDate to set
|
||||
*/
|
||||
public void setEndDate(String endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
/**
|
||||
* @return the addrArea
|
||||
*/
|
||||
public String getAddrArea() {
|
||||
return addrArea;
|
||||
}
|
||||
/**
|
||||
* @param addrArea the addrArea to set
|
||||
*/
|
||||
public void setAddrArea(String addrArea) {
|
||||
this.addrArea = addrArea;
|
||||
}
|
||||
/**
|
||||
* @return the addrCity
|
||||
*/
|
||||
public String getAddrCity() {
|
||||
return addrCity;
|
||||
}
|
||||
/**
|
||||
* @param addrCity the addrCity to set
|
||||
*/
|
||||
public void setAddrCity(String addrCity) {
|
||||
this.addrCity = addrCity;
|
||||
}
|
||||
/**
|
||||
* @return the violateType
|
||||
*/
|
||||
public String getViolateType() {
|
||||
return violateType;
|
||||
}
|
||||
/**
|
||||
* @param violateType the violateType to set
|
||||
*/
|
||||
public void setViolateType(String violateType) {
|
||||
this.violateType = violateType;
|
||||
}
|
||||
/**
|
||||
* @return the invasionType
|
||||
*/
|
||||
public String getShipName() {
|
||||
return shipName;
|
||||
}
|
||||
/**
|
||||
* @param shipName the shipName to set
|
||||
*/
|
||||
public void setShipName(String shipName) {
|
||||
this.shipName = shipName;
|
||||
}
|
||||
/**
|
||||
* @return the invasionType
|
||||
*/
|
||||
public String[] getInvasionType() {
|
||||
return invasionType;
|
||||
}
|
||||
/**
|
||||
* @param invasionType the invasionType to set
|
||||
*/
|
||||
public void setInvasionType(String[] invasionType) {
|
||||
this.invasionType = invasionType;
|
||||
}
|
||||
/**
|
||||
* @return the shipType
|
||||
*/
|
||||
public String[] getShipType() {
|
||||
return shipType;
|
||||
}
|
||||
/**
|
||||
* @param shipType the shipType to set
|
||||
*/
|
||||
public void setShipType(String[] shipType) {
|
||||
this.shipType = shipType;
|
||||
}
|
||||
/**
|
||||
* @return the procCondition
|
||||
*/
|
||||
public String[] getProcCondition() {
|
||||
return procCondition;
|
||||
}
|
||||
/**
|
||||
* @param procCondition the procCondition to set
|
||||
*/
|
||||
public void setProcCondition(String[] procCondition) {
|
||||
this.procCondition = procCondition;
|
||||
}
|
||||
/**
|
||||
* @return the arrShipTonnage
|
||||
*/
|
||||
public String[] getArrShipTonnage() {
|
||||
return arrShipTonnage;
|
||||
}
|
||||
/**
|
||||
* @param arrShipTonnage the arrShipTonnage to set
|
||||
*/
|
||||
public void setArrShipTonnage(String[] arrShipTonnage) {
|
||||
this.arrShipTonnage = arrShipTonnage;
|
||||
}
|
||||
/**
|
||||
* @return the marginPayment
|
||||
*/
|
||||
public String[] getMarginPayment() {
|
||||
return marginPayment;
|
||||
}
|
||||
/**
|
||||
* @param marginPayment the marginPayment to set
|
||||
*/
|
||||
public void setMarginPayment(String[] marginPayment) {
|
||||
this.marginPayment = marginPayment;
|
||||
}
|
||||
/**
|
||||
* @return the obj.length
|
||||
*/
|
||||
public static int length(String[] obj){
|
||||
return obj.length;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,508 @@
|
|||
package kcg.faics.arrest.web;
|
||||
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import kcg.faics.arrest.service.ArrestService;
|
||||
import kcg.faics.arrest.vo.ArrestCountVO;
|
||||
import kcg.faics.arrest.vo.ArrestSearchVO;
|
||||
import kcg.faics.arrest.vo.ArrestVO;
|
||||
import kcg.faics.cmmn.excel.ExcelExporter;
|
||||
import kcg.faics.cmmn.service.CodeService;
|
||||
import kcg.faics.cmmn.vo.CodeVO;
|
||||
import kcg.faics.sec.AuthType;
|
||||
import kcg.faics.sec.LoginUserVO;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.support.SessionStatus;
|
||||
|
||||
/**
|
||||
* ArrestController.java
|
||||
* @author 이영호
|
||||
* @since 2017. 3. 12.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2017. 3. 12. 이영호 최초생성
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/arrest")
|
||||
public class ArrestController {
|
||||
|
||||
/**
|
||||
* 코드관련 정보 인터페이스.
|
||||
*/
|
||||
@Resource(name = "codeService")
|
||||
private CodeService codeService;
|
||||
/**
|
||||
* 나포정보 인터페이스.
|
||||
*/
|
||||
@Resource(name = "arrestService")
|
||||
private ArrestService arrestService;
|
||||
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보 목록화면을 반환한다.
|
||||
* @param arrestSearchVo 나포정보검색객체
|
||||
* @param model 모델객체
|
||||
* @return 중국어선 검거현황 목록화면
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
@RequestMapping(value = "/arrestListView.do")
|
||||
public String arrestListView(final ArrestSearchVO arrestSearchVo, Model model) throws Exception {
|
||||
|
||||
try {
|
||||
// 공통코드 조회
|
||||
model = getCommonCode(model);
|
||||
|
||||
// 중국어선 나포정보 목록 조회
|
||||
//arrestList = arrestService.getArrestListAll(arrestSearchVo);
|
||||
|
||||
// 중국어선 나포정보 목록 집계정보 조회(단건)
|
||||
//arrestCntList = arrestService.getArrestListAllCount(arrestSearchVo);
|
||||
|
||||
|
||||
//model.addAttribute("arrestList", arrestList);
|
||||
//model.addAttribute("arrestCntList", arrestCntList);
|
||||
model.addAttribute("listFlag", "init");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "/arrest/arrestList.tiles";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보 목록 검색결과를 반환한다.
|
||||
*
|
||||
* @param arrestSearchVO 견문 검색 객체
|
||||
* @param model 모델객체
|
||||
* @return 견문검색결과화면
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
@RequestMapping(value = "/arrestList.do")
|
||||
public String arrestList(@ModelAttribute final ArrestSearchVO arrestSearchVO, Model model) throws Exception {
|
||||
|
||||
List<ArrestVO> arrestList = null; // 중국어선나포정보목록
|
||||
ArrestVO arrestCntList = null; // 중국어선나포정보 집계건수
|
||||
HashMap<String, Object> resultMap = new HashMap<String, Object>();
|
||||
|
||||
|
||||
try {
|
||||
// 공통코드 조회
|
||||
// model = getCommonCode(model);
|
||||
|
||||
model.addAttribute("arrestList", null);
|
||||
model.addAttribute("arrestCntList", null);
|
||||
|
||||
|
||||
|
||||
// 중국어선 나포정보 목록 조회
|
||||
arrestList = arrestService.getArrestList(arrestSearchVO);
|
||||
|
||||
if (arrestList.size() > 0) {
|
||||
// 중국어선 나포정보 집계정보 조회
|
||||
arrestCntList = arrestService.getArrestListCount(arrestSearchVO);
|
||||
} else {
|
||||
arrestCntList = null;
|
||||
}
|
||||
model.addAttribute("arrestList", arrestList);
|
||||
model.addAttribute("arrestCntList", arrestCntList);
|
||||
model.addAttribute("arrestSearchVO", arrestSearchVO);
|
||||
|
||||
resultMap.put("msg", "정상으로 조회되었습니다.");
|
||||
resultMap.put("code", 0);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "/arrest/arrestResult";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보 화면에서 필요한 공통코드를 조회한다.
|
||||
*
|
||||
* @param model 화면에 넘길 Model 객체
|
||||
|
||||
* @return model 객체
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
public Model getCommonCode(final Model model) throws Exception {
|
||||
List<CodeVO> agencyTypeList = null; // 기관종류
|
||||
List<CodeVO> placeList = null; // 소속
|
||||
List<CodeVO> addressList = null; // 주소
|
||||
List<CodeVO> violateTypeList = null; // 위반내용구분
|
||||
List<CodeVO> shipTypeList = null; // 선종
|
||||
List<CodeVO> shipMentList = null; // 선적
|
||||
List<CodeVO> shipQualityList = null; // 선질
|
||||
List<CodeVO> shipProcTypeList = null; // 선박처리
|
||||
List<CodeVO> invasionTypeList = null; // 침범유형
|
||||
List<CodeVO> woDetentionTypeList = null; // 무혐의불구속
|
||||
List<CodeVO> marginPaymentYnList = null; // 담보금납부여부
|
||||
|
||||
LoginUserVO loginUserVo = new LoginUserVO();
|
||||
|
||||
try {
|
||||
if (AuthType.LOCAL_HEADQUARTERS == loginUserVo.getAuthType()) {
|
||||
placeList = codeService.getPlace1SubList(loginUserVo.getPlace1());
|
||||
} else {
|
||||
placeList = codeService.getPlace1List(false);
|
||||
}
|
||||
|
||||
agencyTypeList = codeService.getCodeValues("T002", ""); /* 검거기관대분류 */
|
||||
addressList = arrestService.getAddressAreaList("0000"); /* 주소(특별광역시도) */
|
||||
violateTypeList = codeService.getCodeValues("T003", ""); /* 위반내용구분 */
|
||||
shipTypeList = codeService.getCodeValues("FA81", ""); /* 선종 조회 */
|
||||
shipMentList = codeService.getCodeValues("SSRR", ""); /* 선적 */
|
||||
shipQualityList = codeService.getCodeValues("T004", ""); /* 선질 */
|
||||
shipProcTypeList = codeService.getCodeValues("T007", ""); /* 선박처리 */
|
||||
invasionTypeList = codeService.getCodeValues("T006", ""); /* 선박처리 */
|
||||
woDetentionTypeList = codeService.getCodeValues("T005", ""); /* 선박처리 */
|
||||
marginPaymentYnList = codeService.getCodeValues("T008", ""); /* 담보금납부여부 */
|
||||
|
||||
Collections.reverse(marginPaymentYnList);
|
||||
//Collections.sort(marginPaymentYnList, comparator);
|
||||
//CodeVO codeVO = marginPaymentYnList.get(1);
|
||||
//marginPaymentYnList.set(1, marginPaymentYnList.get(0));
|
||||
//marginPaymentYnList.set(0, codeVO);
|
||||
|
||||
model.addAttribute("placeList", placeList);
|
||||
model.addAttribute("addressList", addressList);
|
||||
model.addAttribute("shipQualityList", shipQualityList);
|
||||
model.addAttribute("shipMentList", shipMentList);
|
||||
model.addAttribute("shipTypeList", shipTypeList);
|
||||
model.addAttribute("violateTypeList", violateTypeList);
|
||||
model.addAttribute("agencyTypeList", agencyTypeList);
|
||||
model.addAttribute("shipProcTypeList", shipProcTypeList);
|
||||
model.addAttribute("invasionTypeList", invasionTypeList);
|
||||
model.addAttribute("woDetentionTypeList", woDetentionTypeList);
|
||||
model.addAttribute("marginPaymentYnList", marginPaymentYnList);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보 등록/수정화면을 반환한다.
|
||||
*
|
||||
* @param arrestVo 견문 검색 객체
|
||||
* @param model 모델객체
|
||||
* @return 견문검색결과화면
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
@RequestMapping(value = "/arrestAdd.do")
|
||||
public String arrestAdd(final ArrestVO arrestVo, Model model) throws Exception {
|
||||
|
||||
try {
|
||||
// 공통코드 조회
|
||||
model = getCommonCode(model);
|
||||
model.addAttribute("regFlag", "create");
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return "/arrest/arrestAdd.tiles";
|
||||
}
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보 목록화면을 반환한다.
|
||||
*
|
||||
* @param area 특별광역시도 코드
|
||||
* @param arrestVo 나포정보검색객체
|
||||
* @param model 모델객체
|
||||
* @return 중국어선 검거현황 목록화면
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
@RequestMapping(value = "/getAddressAreaList.do")
|
||||
public String getAddressAreaList(@RequestParam("area") final String area,
|
||||
final ArrestVO arrestVo, final Model model) throws Exception {
|
||||
HashMap<String, Object> result = new HashMap<String, Object>();
|
||||
List<CodeVO> addressCityList = null;
|
||||
try {
|
||||
|
||||
/* 특별광역시&도청 목록조회 */
|
||||
addressCityList = arrestService.getAddressAreaList(area);
|
||||
model.addAttribute("addressCityList", addressCityList);
|
||||
|
||||
result.put("result", "OK");
|
||||
result.put("msg", "시목록 조회성공");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return "/arrest/arrestAdd.tiles";
|
||||
}
|
||||
|
||||
/**
|
||||
* 하위소속 코드 리스트를 반환한다.
|
||||
*
|
||||
* @param codeVO
|
||||
* 코드VO
|
||||
* @return 소속 코드 리스트
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping("/getAddressList.json")
|
||||
public HashMap<String, Object> getAddressList(final CodeVO codeVO)
|
||||
throws Exception {
|
||||
HashMap<String, Object> result = new HashMap<String, Object>();
|
||||
List<CodeVO> addressCityList = null;
|
||||
String area = codeVO.getCode1();
|
||||
|
||||
|
||||
/* 특별광역시&도청 목록조회 */
|
||||
addressCityList = arrestService.getAddressAreaList(area);
|
||||
result.put("data", addressCityList);
|
||||
// model.addAttribute("addressCityList", addressCityList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보를 등록한다.
|
||||
*
|
||||
* @param arrestVO
|
||||
* 중국어선나포정보 객체
|
||||
* @param bindingResult
|
||||
* 바인딩 객체
|
||||
* @param model
|
||||
* 모델 객체
|
||||
* @param status
|
||||
* 세선 상태 객체
|
||||
* @return 게시물 화면
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value = "/arrestInsert.do", method = RequestMethod.POST)
|
||||
public String arrestTempInsert(
|
||||
@ModelAttribute("arrestVO") final ArrestVO arrestVO,
|
||||
final BindingResult bindingResult, final Model model,
|
||||
final SessionStatus status) throws Exception {
|
||||
|
||||
HashMap<String, Object> result = new HashMap<String, Object>();
|
||||
try {
|
||||
|
||||
arrestVO.setDelYn("N"); // 삭제여부
|
||||
|
||||
|
||||
/* 중국어선 나포정보 등록 */
|
||||
result = arrestService.insert(arrestVO);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if ((Integer) result.get("result") != 1) {
|
||||
return "redirect:/arrest/arrestAdd.do";
|
||||
}
|
||||
|
||||
return "redirect:/arrest/arrestListView.do";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보를 수정한다.
|
||||
* @param arrestVO
|
||||
* 나포정보 객체
|
||||
* @param bindingResult
|
||||
* 바인딩 객체
|
||||
* @param model
|
||||
* 모델 객체
|
||||
* @param status
|
||||
* 세선 상태 객체
|
||||
* @return 게시물 화면
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value = "/arrestUpdate.do", method = RequestMethod.POST)
|
||||
public String arrestUpdate(@ModelAttribute("arrestVO") final ArrestVO arrestVO,
|
||||
final BindingResult bindingResult, final Model model, final SessionStatus status) throws Exception {
|
||||
|
||||
HashMap<String, Object> result = new HashMap<String, Object>();
|
||||
try {
|
||||
|
||||
arrestVO.setDelYn("N"); // 삭제여부
|
||||
|
||||
result = arrestService.update(arrestVO);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if ((Integer) result.get("result") != 1) {
|
||||
return "redirect:/arrest/arrestAdd.do";
|
||||
}
|
||||
|
||||
return "redirect:/arrest/arrestListView.do";
|
||||
}
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보를 삭제한다.
|
||||
* @param arrestVO
|
||||
* 외사경찰 정보 객체
|
||||
* @param bindingResult
|
||||
* 바인딩 객체
|
||||
* @param model
|
||||
* 모델 객체
|
||||
* @param status
|
||||
* 세선 상태 객체
|
||||
* @return 게시물 화면
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value = "/arrestDelete.do", method = RequestMethod.POST)
|
||||
public String arrestDelete(@ModelAttribute("arrestVO") final ArrestVO arrestVO,
|
||||
final BindingResult bindingResult, final Model model, final SessionStatus status) throws Exception {
|
||||
|
||||
HashMap<String, Object> result = new HashMap<String, Object>();
|
||||
try {
|
||||
|
||||
arrestVO.setDelYn("Y"); // 삭제여부
|
||||
|
||||
result = arrestService.delete(arrestVO);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if ((Integer) result.get("result") != 1) {
|
||||
return "redirect:/arrest/arrestAdd.do";
|
||||
}
|
||||
|
||||
return "redirect:/arrest/arrestListView.do";
|
||||
}
|
||||
|
||||
/**
|
||||
* 중국어선 나포정보를 반환한다.
|
||||
*
|
||||
* @param arrestVO
|
||||
* @param model 모델 객체
|
||||
* @return 중국어선나포정보 수정화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping("/arrestView.do")
|
||||
public String arrestView(final ArrestVO arrestVO, Model model) throws Exception {
|
||||
|
||||
try {
|
||||
// 중국어선 나포정보 단건조회
|
||||
ArrestVO result = arrestService.select(arrestVO);
|
||||
|
||||
// 공통코드 조회
|
||||
model = getCommonCode(model);
|
||||
|
||||
model.addAttribute("arrestVO", result);
|
||||
model.addAttribute("regFlag", "modify");
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return "/arrest/arrestAdd.tiles";
|
||||
}
|
||||
|
||||
/**
|
||||
* 중국어선 나포처리현황 엑셀 다운로드
|
||||
* @param searchVO
|
||||
* @param model Model객체
|
||||
* @return 외사장비 사용실적 현황
|
||||
*/
|
||||
@RequestMapping("/arrestExcelDownload.do")
|
||||
public String arrestExcelDownload(final ArrestSearchVO searchVO, final Model model) throws Exception {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
ArrestVO arrestCntList = null;
|
||||
|
||||
String title = cal.get(cal.YEAR) + "년 중국어선 나포처리현황";
|
||||
|
||||
List<ArrestVO> arrestList = arrestService.getArrestListExcel(searchVO);
|
||||
|
||||
if (arrestList.size() > 0) {
|
||||
arrestCntList = arrestService.getArrestListCount(searchVO);
|
||||
LinkedHashMap<String, String> header = new LinkedHashMap<String, String>();
|
||||
header.put("arrestDate", "나포일시");
|
||||
header.put("addrStr", "위반장소");
|
||||
header.put("violateDetail", "위반내용");
|
||||
header.put("invasion3", "침범유형(영해)");
|
||||
header.put("invasion4", "침범유형(EEZ)");
|
||||
header.put("invasion1", "침범유형(특정금지)");
|
||||
header.put("invasion2", "침범유형(무허가)");
|
||||
header.put("specBatlYn", "침범유형(특공방)");
|
||||
header.put("nllYn", "NLL");
|
||||
header.put("agencyGuardStr", "검거기관");
|
||||
header.put("agencyVessel", "서별(함정)");
|
||||
header.put("shipName", "선박제원(선명)");
|
||||
header.put("shipTonnage", "선박제원(톤수)");
|
||||
header.put("shipCrewCnt", "선박제원(선원)");
|
||||
header.put("shipQualityStr", "선박제원(선질)");
|
||||
header.put("shipMentStr", "선박제원(선적)");
|
||||
header.put("capName", "선장(나이)");
|
||||
header.put("shipTypeStr", "선종");
|
||||
header.put("vioFish", "범칙어종");
|
||||
header.put("vioCnt", "범칙수량");
|
||||
header.put("vioPriatedAmt", "위판금액");
|
||||
header.put("procCondN", "조사중");
|
||||
header.put("procCondY", "완료");
|
||||
header.put("marginPaymentAmt", "납부액(만원)");
|
||||
header.put("marginPaymentDate", "납부일시");
|
||||
header.put("notPayment", "미납");
|
||||
header.put("noMarginPaymentAmt", "미납금액(만원)");
|
||||
header.put("shipProcTypeA", "위탁관리");
|
||||
header.put("shipProcTypeB", "퇴거");
|
||||
header.put("shipProcTypeC", "직접인계");
|
||||
header.put("shipProcTypeD", "폐기");
|
||||
header.put("shipProcTypeE", "몰수");
|
||||
header.put("detentionTotalCnt", "구속(계)");
|
||||
|
||||
header.put("captainCount", "구속선장");
|
||||
header.put("mateCount", "구속항해사");
|
||||
header.put("engineerCount", "구속기관장");
|
||||
header.put("crewCount", "구속선원");
|
||||
header.put("woDetentionStr", "무혐의불구속");
|
||||
header.put("fieldCnt", "현장조사건수");
|
||||
header.put("fieldArrestDate", "나포일시");
|
||||
header.put("fieldReleaseDate", "석방일시");
|
||||
header.put("leadDistance", "거리(해리)");
|
||||
header.put("commissionCost", "위탁금(원)");
|
||||
header.put("gearCast", "틀");
|
||||
header.put("gearWidth", "폭");
|
||||
header.put("gearEtc", "기타");
|
||||
|
||||
arrestCntList.setDetentionTotalCnt(String.valueOf(arrestCntList.getCaptainCount()
|
||||
+ arrestCntList.getMateCount()
|
||||
+ arrestCntList.getEngineerCount()
|
||||
+ arrestCntList.getCrewCount()));
|
||||
arrestCntList.setSpecBatlYn(String.valueOf(arrestCntList.getSpecBatlCnt()));
|
||||
arrestCntList.setNllYn(String.valueOf(arrestCntList.getNllCnt()));
|
||||
arrestCntList.setNoPaymentCnt(String.valueOf(arrestCntList.getNotPayment()));
|
||||
|
||||
|
||||
arrestList.add(0, arrestCntList);
|
||||
|
||||
model.addAttribute("excel", new ExcelExporter<ArrestVO>(header, arrestList, title));
|
||||
model.addAttribute("filename", title);
|
||||
|
||||
return "excelView";
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
/**
|
||||
* BoardPreventSqlInjectionAop.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 19.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 19. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
package kcg.faics.board.aop;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import kcg.faics.cmmn.CommonsUtils;
|
||||
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Before;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* BoardPreventSqlInjectionAop.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 19.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 19. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
public class BoardPreventSqlInjectionAop {
|
||||
|
||||
// id를 필드로 가지고 있는 객체를 파라미터로 받는 메소드만 걸림
|
||||
@Before("execution(public * kcg.faics.board.service.impl.*Mapper.*(kcg.faics.board.vo.BoardSearchVO))"
|
||||
+ "|| execution(public * kcg.faics.board.service.impl.*Mapper.*(kcg.faics.board.vo.BoardVO))"
|
||||
+ "|| execution(public * kcg.faics.board.service.impl.*Mapper.*(kcg.faics.board.vo.BoardFileVO))"
|
||||
+ "|| execution(public * kcg.faics.board.service.impl.*Mapper.*(kcg.faics.board.vo.BoardCommentVO))")
|
||||
public void beforeTargetMethod(JoinPoint thisJoinPoint) {
|
||||
Object[] signatureArgs = thisJoinPoint.getArgs();
|
||||
for (Object signatureArg: signatureArgs) {
|
||||
|
||||
Class<?> clz = signatureArg.getClass();
|
||||
try {
|
||||
Field field = clz.getDeclaredField("id");
|
||||
field.setAccessible(true);
|
||||
|
||||
String id = (String) field.get(signatureArg);
|
||||
id = CommonsUtils.sqlInjectionFilter(id);
|
||||
|
||||
field.set(signatureArg, id);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
/**
|
||||
* BoardService.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 25.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 25. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
package kcg.faics.board.service;
|
||||
|
||||
import kcg.faics.board.vo.BoardSearchVO;
|
||||
import kcg.faics.board.vo.BoardVO;
|
||||
import kcg.faics.cmmn.bbs.BaseBbsExService;
|
||||
import kcg.faics.cmmn.bbs.BaseBbsService;
|
||||
|
||||
/**
|
||||
* BoardService.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 25.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 25. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
public interface BoardService extends BaseBbsService<BoardSearchVO, BoardVO>, BaseBbsExService<BoardSearchVO, BoardVO> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
package kcg.faics.board.service.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import kcg.faics.board.vo.BoardCommentVO;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
|
||||
|
||||
/**
|
||||
* BoardCommentMapper.java
|
||||
* @author 임새미
|
||||
* @since 2016. 9. 29.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 9. 29. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
@Repository("boardCommentMapper")
|
||||
public class BoardCommentMapper extends EgovAbstractMapper {
|
||||
|
||||
/**
|
||||
* throws Exception {한 게시물의 덧글 리스트를 반환한다.
|
||||
*
|
||||
* @param boardCommentVO 게시판 아이디
|
||||
* @return 선택한 게시물의 덧글 리스트
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public List<BoardCommentVO> selectCommentList(final BoardCommentVO boardCommentVO) throws Exception {
|
||||
return selectList("BoardComment.selectCommentList", boardCommentVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 선택한 덧글을 반환한다.
|
||||
*
|
||||
* @param boardCommentVO 덧글 아이디
|
||||
* @return 선택한 덧글의 상세 내용
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public BoardCommentVO selectBoardComment(final BoardCommentVO boardCommentVO) throws Exception {
|
||||
return selectOne("BoardComment.selectBoardComment", boardCommentVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 덧글을 추가한다.
|
||||
*
|
||||
* @param boardCommentVO 덧글 데이터
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public HashMap<String, Object> insertBoardComment(final BoardCommentVO boardCommentVO) throws Exception {
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
int result = 0;
|
||||
result = insert("BoardComment.insertBoardComment", boardCommentVO);
|
||||
|
||||
map.put("seq", boardCommentVO.getSeq());
|
||||
map.put("result", result);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 선택한 덧글을 삭제한다.
|
||||
*
|
||||
* @param boardCommentVO 덧글 아이디
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int deleteBoardComment(final BoardCommentVO boardCommentVO) throws Exception {
|
||||
return delete("BoardComment.deleteBoardComment", boardCommentVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 선택한 게시물의 모든 덧글을 삭제한다.
|
||||
*
|
||||
* @param boardCommentVO 선택한 게시물 아이디
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int deleteBoardCommentAll(final BoardCommentVO boardCommentVO) throws Exception {
|
||||
return delete("BoardComment.deleteBoardCommentAll", boardCommentVO);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package kcg.faics.board.service.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import kcg.faics.board.vo.BoardCommentVO;
|
||||
import kcg.faics.cmmn.bbs.BaseCommentService;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
* BoardCommentServiceImpl.java
|
||||
* @author 임새미
|
||||
* @since 2016. 9. 29.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 9. 29. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
@Service("boardCommentService")
|
||||
public class BoardCommentServiceImpl implements BaseCommentService<BoardCommentVO> {
|
||||
|
||||
/**
|
||||
* BoardMapper - 게시판 덧글 데이터처리에 관한 Mapper 클래스
|
||||
**/
|
||||
@Resource(name = "boardCommentMapper")
|
||||
private BoardCommentMapper boardCommentMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 선택한 게시물의 덧글 리스트를 반환한다.
|
||||
*
|
||||
* @param bdSeq 게시판 아이디
|
||||
* @return 선택한 게시물의 덧글 리스트
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public List<BoardCommentVO> selectList(final BoardCommentVO boardCommentVO) throws Exception {
|
||||
return boardCommentMapper.selectCommentList(boardCommentVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 선택한 덧글을 반환한다.
|
||||
*
|
||||
* @param bcBdSeq 덧글 아이디
|
||||
* @return 선택한 덧글의 상세 내용
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public BoardCommentVO select(final BoardCommentVO boardCommentVO) throws Exception {
|
||||
return boardCommentMapper.selectBoardComment(boardCommentVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 덧글을 추가한다.
|
||||
*
|
||||
* @param boardCommentVO 덧글 데이터
|
||||
* @return 선택한 덧글의 상세 내용
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public HashMap<String, Object> insert(final BoardCommentVO boardCommentVO) throws Exception {
|
||||
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
try {
|
||||
map = boardCommentMapper.insertBoardComment(boardCommentVO);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
map.put("result", 0);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 선택한 덧글을 삭제한다.
|
||||
*
|
||||
* @param bcBdSeq 덧글 아이디
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public int delete(final BoardCommentVO boardCommentVO) throws Exception {
|
||||
return boardCommentMapper.deleteBoardComment(boardCommentVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 선택한 게시물의 모든 덧글을 삭제한다.
|
||||
*
|
||||
* @param bdSeq 선택한 게시물 아이디
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public int deleteAll(final BoardCommentVO boardCommentVO) throws Exception {
|
||||
return boardCommentMapper.deleteBoardCommentAll(boardCommentVO);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package kcg.faics.board.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import kcg.faics.board.vo.BoardFileVO;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
|
||||
|
||||
/**
|
||||
* 게시판에 관한 인터페이스클래스를 정의한다.
|
||||
* @author 임새미
|
||||
* @since 2016. 9. 22.
|
||||
* @version 1.0
|
||||
* @see
|
||||
* <pre>
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- -------------------------
|
||||
* 2016.09.22 임새미 최초 생성
|
||||
* </pre>
|
||||
*/
|
||||
@Repository("boardFileMapper")
|
||||
public class BoardFileMapper extends EgovAbstractMapper {
|
||||
|
||||
/**
|
||||
* 게시물의 첨부파일을 DB에 추가한다.
|
||||
*
|
||||
* @param boardFileVO 업로드 파일 정보 객체
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @exception Exception 기본 예외 처리
|
||||
*/
|
||||
public int insertFile(final BoardFileVO boardFileVO) throws Exception {
|
||||
return insert("BoardFile.insertBoardFile", boardFileVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 선택한 게시물의 파일 리스트를 반환한다.
|
||||
*
|
||||
* @param boardFileVO 게시판 아이디
|
||||
* @return 선택한 게시물의 덧글 리스트
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public List<BoardFileVO> selectFiles(final BoardFileVO boardFileVO) throws Exception {
|
||||
return selectList("BoardFile.selectBoardFiles", boardFileVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 선택한 파일정보를 반환한다.
|
||||
*
|
||||
* @param boardFileVO 덧글 아이디
|
||||
* @return 선택한 덧글의 상세 내용
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public BoardFileVO selectFile(final BoardFileVO boardFileVO) throws Exception {
|
||||
return selectOne("BoardFile.selectBoardFile", boardFileVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* DB에서 파일정보를 삭제한다.
|
||||
*
|
||||
* @param bfSeq 덧글 아이디
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int deleteFile(final BoardFileVO boardFileVO) throws Exception {
|
||||
return delete("BoardFile.deleteBoardFile", boardFileVO);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,207 @@
|
|||
package kcg.faics.board.service.impl;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import kcg.faics.board.util.BoardUtils;
|
||||
import kcg.faics.board.util.BoardVOHandler;
|
||||
import kcg.faics.board.vo.BoardFileVO;
|
||||
import kcg.faics.cmmn.bbs.BaseFileService;
|
||||
import kcg.faics.cmmn.egov.file.EgovFileMngUtil;
|
||||
import kcg.faics.cmmn.egov.vo.FileVO;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
|
||||
/**
|
||||
* BoardFileServiceImpl.java
|
||||
* @author 임새미
|
||||
* @since 2016. 9. 28.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 9. 28. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
@Service("boardFileService")
|
||||
public class BoardFileServiceImpl implements BaseFileService<BoardFileVO> {
|
||||
|
||||
/**
|
||||
* BoardFileMapper - 게시판 파일 데이터 처리에 관한 Mapper 클래스
|
||||
**/
|
||||
@Resource(name = "boardFileMapper")
|
||||
private BoardFileMapper boardFileMapper;
|
||||
|
||||
/**
|
||||
* EgovFileMngUtil - 파일 업로드 처리에 관한 Util 클래스
|
||||
**/
|
||||
@Resource(name = "EgovFileMngUtil")
|
||||
private EgovFileMngUtil fileUtil;
|
||||
|
||||
|
||||
/**
|
||||
* 선택한 게시물의 파일 리스트를 반환한다.
|
||||
*
|
||||
* @param bfBdSeq 게시판 아이디
|
||||
* @return 선택한 게시물의 덧글 리스트
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public List<BoardFileVO> selectList(final BoardFileVO boardFileVO) throws Exception {
|
||||
return (List<BoardFileVO>) boardFileMapper.selectFiles(boardFileVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 선택한 파일정보를 반환한다.
|
||||
*
|
||||
* @param bfSeq 덧글 아이디
|
||||
* @return 선택한 덧글의 상세 내용
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public BoardFileVO select(final BoardFileVO boardFileVO) throws Exception {
|
||||
return boardFileMapper.selectFile(boardFileVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 게시물의 첨부파일을 DB에 추가한다.
|
||||
*
|
||||
* @param bfBdSeq 게시물 아이디
|
||||
* @param fileVO 파일 정보 객체
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @exception Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public int insert(final BoardFileVO boardFileVO) throws Exception {
|
||||
return boardFileMapper.insertFile(boardFileVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물의 첨부파일들을 업로드한다.
|
||||
*
|
||||
* @param bfBdSeq 게시물 아이디
|
||||
* @param fileMap 검색, 페이지 정보 객체
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @exception Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int insertAndSaveFiles(BoardFileVO boardFileVO, final Map<String, MultipartFile> fileMap) throws Exception {
|
||||
int result = 1;
|
||||
String storePathKey = "";
|
||||
String boardId = "";
|
||||
|
||||
/* 파일쓰기 */
|
||||
if (!fileMap.isEmpty()) {
|
||||
if (boardFileVO != null) {
|
||||
boardId = boardFileVO.getId();
|
||||
boardId = StringUtils.lowerCase(boardId);
|
||||
}
|
||||
storePathKey = BoardUtils.getStorePathKey(boardId);
|
||||
|
||||
List<FileVO> uploadedFile = fileUtil.parseFileInf(fileMap, "_", 0, "", storePathKey);
|
||||
|
||||
/* DB에 업로드한 첨부파일 레코드를 추가한다. */
|
||||
Iterator<FileVO> itr = uploadedFile.iterator();
|
||||
while (itr.hasNext()) {
|
||||
FileVO fileVO = itr.next();
|
||||
boardFileVO.setOrgName(fileVO.getOrignlFileNm());
|
||||
boardFileVO.setSaveName(fileVO.getStreFileNm());
|
||||
boardFileVO.setOrders(Integer.parseInt(fileVO.getFileSn().replace("file", "")));
|
||||
result = insert(boardFileVO);
|
||||
if (result != 1) {
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일을 삭제한다.
|
||||
*
|
||||
* @param boardFileVO 파일정보
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public int deleteAndRemoveFile(final BoardFileVO boardFileVO) throws Exception {
|
||||
int result = boardFileMapper.deleteFile(boardFileVO);
|
||||
String storePathKey = "";
|
||||
if (result == 1) {
|
||||
/* DB에서 파일 데이터 삭제 후 실제 파일 삭제 여부는 보장하지 않는다. */
|
||||
try {
|
||||
storePathKey = BoardUtils.getStorePathKey(boardFileVO.getId());
|
||||
fileUtil.deleteFile(boardFileVO.getSaveName(), storePathKey);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 선택한 파일을 삭제한다.
|
||||
*
|
||||
* @param bfBdSeq 선택한 게시물 아이디
|
||||
* @param deleteFiles 선택한 게시물 아이디
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int delete(final BoardFileVO boardFileVO) throws Exception {
|
||||
int result = 1;
|
||||
if (boardFileVO.getDeleteFiles() != null) {
|
||||
for (String fileSeq : boardFileVO.getDeleteFiles()) {
|
||||
BoardFileVO deleteFile = BoardVOHandler.getBFileVO(boardFileVO);
|
||||
deleteFile.setSeq(Integer.parseInt(fileSeq));
|
||||
deleteFile = select(deleteFile);
|
||||
result = deleteAndRemoveFile(deleteFile);
|
||||
|
||||
if (result != 1) {
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 게시물 내의 모든 파일을 삭제한다.
|
||||
*
|
||||
* @param bfBdSeq 선택한 게시물 아이디
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int deleteAndRemoveFiles(final BoardFileVO boardFileVO) throws Exception {
|
||||
|
||||
int result = 1;
|
||||
|
||||
List<BoardFileVO> fileList = boardFileMapper.selectFiles(boardFileVO);
|
||||
|
||||
if (fileList != null) {
|
||||
for (BoardFileVO file : fileList) {
|
||||
result = deleteAndRemoveFile(file);
|
||||
if (result != 1) {
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,163 @@
|
|||
package kcg.faics.board.service.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import kcg.faics.board.vo.BoardSearchVO;
|
||||
import kcg.faics.board.vo.BoardVO;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
|
||||
|
||||
|
||||
/**
|
||||
* BoardMapper.java
|
||||
* @author 임새미
|
||||
* @since 2016. 9. 29.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 9. 29. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
@Repository("boardMapper")
|
||||
public class BoardMapper extends EgovAbstractMapper {
|
||||
|
||||
|
||||
/**
|
||||
* 게시판 목록 화면을 반환한다.
|
||||
*
|
||||
* @param searchVO 검색, 페이지 정보 객체
|
||||
* @return 게시물 리스트
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public List<BoardVO> selectBoardList(final BoardSearchVO searchVO) throws Exception {
|
||||
return selectList("Board.selectBoardList", searchVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 검색 키워드에 따른 총 게시물 개수를 조회한다.
|
||||
*
|
||||
* @param searchVO 검색, 페이지 정보 객체
|
||||
* @return 게시물 개수
|
||||
* @exception Exception 기본 예외 처리
|
||||
*/
|
||||
public int selectBoardListTotCnt(final BoardSearchVO searchVO) throws Exception {
|
||||
return (Integer) selectOne("Board.selectBoardListTotCnt", searchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 전체 게시물 개수를 가져온다.
|
||||
* @param searchVO
|
||||
*
|
||||
* @return 게시물 개수
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int selectBoardTotalCnt(final BoardSearchVO searchVO) throws Exception {
|
||||
return (Integer) selectOne("Board.selectBoardTotalCnt", searchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 답글 추가에 따른 group seq를 수정한다
|
||||
*
|
||||
* @param boardVO BoardVO 객체
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int updateGrpStep(final BoardVO boardVO) throws Exception {
|
||||
return update("Board.updateGrpStep", boardVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* group seq에 해당되는 게시물 개수를 반환한다
|
||||
*
|
||||
* @param boardVO BoardVO 객체
|
||||
* @return 그룹에 해당되는 게시물 개수
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public BoardVO selectPrevBoard(final BoardVO boardVO) throws Exception {
|
||||
return selectOne("Board.selectPrevBoard", boardVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* prevSeq, nextSeq를 업데이트한다.
|
||||
*
|
||||
* @param boardVO BoardVO 객체
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int updatePrevNextSeq(final BoardVO boardVO) throws Exception {
|
||||
return update("Board.updatePrevNextSeq", boardVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물을 추가한다.
|
||||
*
|
||||
* @param boardVO 게시판 내용 구성 객체
|
||||
* @return 글 총 갯수
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public HashMap<String, Object> insertBoard(final BoardVO boardVO) throws Exception {
|
||||
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
int result = 0;
|
||||
try {
|
||||
result = insert("Board.insertBoard", boardVO);
|
||||
|
||||
map.put("result", result);
|
||||
map.put("seq", boardVO.getSeq());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return map;
|
||||
};
|
||||
|
||||
/**
|
||||
* 선택한 게시물의 내용을 반환한다.
|
||||
*
|
||||
* @param boardVO 게시물 VO
|
||||
* @return 선택한 게시물 내용 반환
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public BoardVO selectBoard(final BoardVO boardVO) throws Exception {
|
||||
return selectOne("Board.selectBoard", boardVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 새 게시물의 group 시퀀스를 업데이트한다.
|
||||
*
|
||||
* @param boardVO 게시물 VO
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int updateGrpSeq(final BoardVO boardVO) throws Exception {
|
||||
return update("Board.updateGrpSeq", boardVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물을 DB에 업데이트 한다.
|
||||
*
|
||||
* @param boardVO 게시물 VO
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int updateBoard(final BoardVO boardVO) throws Exception {
|
||||
return update("Board.updateBoard", boardVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물을 삭제한다.
|
||||
*
|
||||
* @param boardVO 게시물 VO
|
||||
* @return HashMap/ seq : 게시물 번호 , result : 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int deleteBoard(final BoardVO boardVO) throws Exception {
|
||||
return delete("Board.deleteBoard", boardVO);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,363 @@
|
|||
package kcg.faics.board.service.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import kcg.faics.board.service.BoardService;
|
||||
import kcg.faics.board.util.BoardVOHandler;
|
||||
import kcg.faics.board.vo.BoardCommentVO;
|
||||
import kcg.faics.board.vo.BoardFileVO;
|
||||
import kcg.faics.board.vo.BoardSearchVO;
|
||||
import kcg.faics.board.vo.BoardVO;
|
||||
import kcg.faics.cmmn.bbs.BaseCommentService;
|
||||
import kcg.faics.cmmn.bbs.BaseFileService;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||
|
||||
|
||||
/**
|
||||
* BoardServiceImpl.java
|
||||
* @author 임새미
|
||||
* @since 2016. 9. 28.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 9. 28. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
@Service("boardService")
|
||||
public class BoardServiceImpl extends EgovAbstractServiceImpl implements BoardService {
|
||||
|
||||
/**
|
||||
* BoardMapper - 게시판 데이터처리에 관한 Mapper 클래스
|
||||
**/
|
||||
@Resource(name = "boardMapper")
|
||||
private BoardMapper boardMapper;
|
||||
|
||||
/**
|
||||
* BoardFileService - 게시판 파일에 관한 인터페이스
|
||||
**/
|
||||
@Resource(name = "boardFileService")
|
||||
private BaseFileService<BoardFileVO> boardFileService;
|
||||
|
||||
/**
|
||||
* BoardCommentService - 게시판 덧글에 관한 인터페이스
|
||||
**/
|
||||
@Resource(name = "boardCommentService")
|
||||
private BaseCommentService<BoardCommentVO> boardCommentService;
|
||||
|
||||
|
||||
/**
|
||||
* 게시판 목록 화면을 반환한다.
|
||||
*
|
||||
* @param searchVO 검색, 페이지 정보 객체
|
||||
* @return 게시물 리스트
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public List<BoardVO> selectList(final BoardSearchVO searchVO) throws Exception {
|
||||
return boardMapper.selectBoardList(searchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 검색 키워드에 따른 총 게시물 개수를 조회한다.
|
||||
*
|
||||
* @param searchVO 검색, 페이지 정보 객체
|
||||
* @return 게시물 개수
|
||||
* @exception Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public int selectListCnt(final BoardSearchVO searchVO) throws Exception {
|
||||
return boardMapper.selectBoardListTotCnt(searchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 전체 게시물 개수를 가져온다.
|
||||
*
|
||||
* @return 게시물 개수
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public int selectTotalCnt(final BoardSearchVO searchVO) throws Exception {
|
||||
return boardMapper.selectBoardTotalCnt(searchVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 선택한 게시물의 내용을 반환한다.
|
||||
*
|
||||
* @param bdSeq 게시판
|
||||
* @return 선택한 게시물 내용 반환
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public BoardVO select(final BoardVO boardVO) throws Exception {
|
||||
return boardMapper.selectBoard(boardVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 이전 글 or 다음 글의 시퀀스 번호를 업데이트한다.
|
||||
*
|
||||
* @param bdSeq 업데이트 대상 게시물 시퀀스
|
||||
* @param prevNextChar 이전(P) or 다음{N)
|
||||
* @param seqValue 시퀀스 값
|
||||
* @return 1-성공, 0-실패
|
||||
*/
|
||||
private int updatePrevNextSeq(final BoardVO boardVO, final String prevNextChar, final int seqValue) {
|
||||
int result = 0;
|
||||
boolean isContinue = false;
|
||||
try {
|
||||
BoardVO updateBoard = boardMapper.selectBoard(boardVO);
|
||||
|
||||
if ("P".equals(prevNextChar)) {
|
||||
updateBoard.setPrevSeq(seqValue);
|
||||
isContinue = true;
|
||||
} else if ("N".equals(prevNextChar)) {
|
||||
updateBoard.setNextSeq(seqValue);
|
||||
isContinue = true;
|
||||
}
|
||||
if (isContinue) {
|
||||
result = boardMapper.updatePrevNextSeq(updateBoard);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물을 추가한다.
|
||||
*
|
||||
* @param boardVO 게시판 내용 구성 객체
|
||||
* @return HashMap/ seq : 게시물 , result : 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
private HashMap<String, Object> insert(final BoardVO boardVO) throws Exception {
|
||||
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
/* 답글인 경우 */
|
||||
if (boardVO.getIsReply() > 0) {
|
||||
boardVO.setDepth(boardVO.getDepth() + 1);
|
||||
boardVO.setStep(boardVO.getStep() + 1);
|
||||
boardVO.setNextSeq(boardVO.getParentSeq());
|
||||
}
|
||||
|
||||
/* seq 및 insert 결과 */
|
||||
map = boardMapper.insertBoard(boardVO);
|
||||
|
||||
int seq = (Integer) map.get("seq");
|
||||
int result = (Integer) map.get("result");
|
||||
|
||||
if (seq > 0 && result > 0) {
|
||||
boardVO.setSeq(seq);
|
||||
|
||||
/* 답글인 경우 */
|
||||
if (boardVO.getIsReply() > 0) {
|
||||
// 스텝순서 변경
|
||||
boardMapper.updateGrpStep(boardVO);
|
||||
// 추가된 글의 다음글의 prevSeq 변경
|
||||
BoardVO nextBoard = BoardVOHandler.getBoardVO(boardVO.getId(), boardVO.getParentSeq());
|
||||
this.updatePrevNextSeq(nextBoard, "P", seq);
|
||||
|
||||
} else {
|
||||
/* 새 게시글 추가의 경우 추가한 게시물의 group seq를 자기 자신으로 설정한다. */
|
||||
boardMapper.updateGrpSeq(boardVO);
|
||||
}
|
||||
|
||||
// 이전글 정보를 가져온다
|
||||
BoardVO prevBoard = boardMapper.selectPrevBoard(boardVO);
|
||||
if (prevBoard != null) {
|
||||
/* 이전 글의 next_seq 설정 */
|
||||
this.updatePrevNextSeq(prevBoard, "N", seq);
|
||||
/* 현재 글의 prev_seq 설정 */
|
||||
this.updatePrevNextSeq(boardVO, "P", prevBoard.getSeq());
|
||||
} else {
|
||||
this.updatePrevNextSeq(boardVO, "P", 0);
|
||||
}
|
||||
|
||||
} else {
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물을 추가한다.
|
||||
*
|
||||
* @param boardVO 게시판 내용 구성 객체
|
||||
* @param fileMap 업로드 파일정보체
|
||||
* @return HashMap/ seq : 게시물 , result : 성공 - 1, 실패 - 0
|
||||
* @exception Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public HashMap<String, Object> insert(final BoardVO boardVO, final Map<String, MultipartFile> fileMap) throws Exception {
|
||||
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
/* seq 획득 */
|
||||
map = insert(boardVO);
|
||||
|
||||
int seq = (Integer) map.get("seq");
|
||||
int result = (Integer) map.get("result");
|
||||
|
||||
/* 파일 업로드 */
|
||||
BoardFileVO boardFileVO = BoardVOHandler.getBFileVO(boardVO.getId(), seq, 0);
|
||||
|
||||
result = boardFileService.insertAndSaveFiles(boardFileVO, fileMap);
|
||||
|
||||
if (result != 1) {
|
||||
throw new Exception();
|
||||
} else {
|
||||
map.put("result", result);
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 게시물을 DB에 업데이트 한다.
|
||||
*
|
||||
* @param boardVO 게시물 VO
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
private int updateBoard(final BoardVO boardVO) throws Exception {
|
||||
return boardMapper.updateBoard(boardVO);
|
||||
};
|
||||
|
||||
/**
|
||||
* 게시물을 업데이트 한다.
|
||||
*
|
||||
* @param boardVO 게시물 VO
|
||||
* @param fileMap MultipartFile형태의 파일정보
|
||||
* @param deleteFiles 삭제할 파일리스트
|
||||
* @return HashMap/ seq : 게시물 번호 , result : 성공 - 1, 실패 - 0
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public HashMap<String, Object> update(final BoardVO boardVO, final Map<String, MultipartFile> fileMap, final String[] deleteFiles) throws Exception {
|
||||
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
int result = 0;
|
||||
|
||||
BoardFileVO boardFileVO= BoardVOHandler.getBFileVO(boardVO);
|
||||
boardFileVO.setDeleteFiles(deleteFiles);
|
||||
boardFileService.delete(boardFileVO);
|
||||
boardFileService.insertAndSaveFiles(boardFileVO, fileMap);
|
||||
|
||||
result = this.updateBoard(boardVO);
|
||||
|
||||
if (result != 1) {
|
||||
throw new Exception();
|
||||
} else {
|
||||
map.put("result", result);
|
||||
map.put("seq", boardVO.getSeq());
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 게시물을 삭제한다.
|
||||
*
|
||||
* @param bdSeq 게시물 번호
|
||||
* @return HashMap/ seq : 게시물 번호 , result : 성공 - 1, 실패 - 0
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public HashMap<String, Object> delete(final BoardVO boardVO) throws Exception {
|
||||
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
int result = 0;
|
||||
|
||||
/* 삭제 후 처리를 위해 데이터 캐싱 */
|
||||
BoardVO delBoard = boardMapper.selectBoard(boardVO);
|
||||
|
||||
result = boardMapper.deleteBoard(delBoard);
|
||||
|
||||
if (result == 1) {
|
||||
/* 이전 글, 다음 글의 이전/다음 시퀀스 재조정 */
|
||||
int prevSeq = boardVO.getPrevSeq();
|
||||
int nextSeq = boardVO.getNextSeq();
|
||||
if (prevSeq > 0) {
|
||||
this.updatePrevNextSeq(BoardVOHandler.getBoardVO(boardVO.getId(), prevSeq), "N", nextSeq);
|
||||
}
|
||||
if (nextSeq > 0) {
|
||||
this.updatePrevNextSeq(BoardVOHandler.getBoardVO(boardVO.getId(), nextSeq), "P", prevSeq);
|
||||
}
|
||||
|
||||
/* 파일을 삭제한다. */
|
||||
boardFileService.deleteAndRemoveFiles(BoardVOHandler.getBFileVO(delBoard));
|
||||
|
||||
/* 댓글을 삭제한다. */
|
||||
boardCommentService.deleteAll(BoardVOHandler.getBCommentVO(delBoard));
|
||||
|
||||
map.put("result", result);
|
||||
} else {
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
return map;
|
||||
};
|
||||
|
||||
/**
|
||||
* 선택한 게시물들을 삭제한다.
|
||||
*
|
||||
* @param bdSeqs 선택한 게시물 아이디 목록
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
*/
|
||||
@Override
|
||||
public HashMap<String, Object> selectAndDelete(final BoardVO boardVO, final int[] boardList) throws Exception {
|
||||
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
int result = 0;
|
||||
|
||||
if (boardList != null) {
|
||||
for (int seq : boardList) {
|
||||
boardVO.setSeq(seq);
|
||||
map = delete(boardVO);
|
||||
result = (Integer) map.get("result");
|
||||
if (result != 1) {
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
map.put("result", result);
|
||||
|
||||
return map;
|
||||
};
|
||||
|
||||
/**
|
||||
* 조회수를 1 증가시킨다.
|
||||
*
|
||||
* @param boardVO 게시물 VO
|
||||
* @return 1-성공, 0-실패
|
||||
*/
|
||||
@Override
|
||||
public int incHit(final BoardVO boardVO) throws Exception {
|
||||
int result = 0;
|
||||
boardVO.incHit();
|
||||
result = this.updateBoard(boardVO);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BoardVO> selectListAll(BoardSearchVO searchVO) throws Exception {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
package kcg.faics.board.util;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* 게시판 관련 유틸리티.
|
||||
*
|
||||
* @author kimnomin
|
||||
*
|
||||
*/
|
||||
public final class BoardUtils {
|
||||
|
||||
/**
|
||||
* 생성자.
|
||||
*/
|
||||
private BoardUtils() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일을 저장할 경로의 프로퍼티 키를 반환한다.
|
||||
*
|
||||
* @param boardId
|
||||
* 게시판ID
|
||||
* @return 파일을 저장할 경로의 프로퍼티 키
|
||||
*/
|
||||
public static String getStorePathKey(final String boardId) {
|
||||
String storePathKey = "";
|
||||
String boardIdLower = "";
|
||||
|
||||
if (StringUtils.isNotBlank(boardId)) {
|
||||
boardIdLower = StringUtils.lowerCase(boardId);
|
||||
}
|
||||
|
||||
switch (boardIdLower) {
|
||||
case "bbs":
|
||||
storePathKey = "Bbs.bbs.fileStorePath";
|
||||
break;
|
||||
case "data":
|
||||
storePathKey = "Bbs.data.fileStorePath";
|
||||
break;
|
||||
case "fa_arrest_rpt":
|
||||
storePathKey = "Bbs.faArrestReport.fileStorePath";
|
||||
break;
|
||||
case "fa_info_rpt":
|
||||
storePathKey = "Bbs.faInfoReport.fileStorePath";
|
||||
break;
|
||||
case "fa_target":
|
||||
storePathKey = "Bbs.faTarget.fileStorePath";
|
||||
break;
|
||||
case "guard_info":
|
||||
storePathKey = "Bbs.guardInfo.fileStorePath";
|
||||
break;
|
||||
case "notice":
|
||||
storePathKey = "Bbs.notice.fileStorePath";
|
||||
break;
|
||||
case "stat_bbs":
|
||||
storePathKey = "Bbs.statBbs.fileStorePath";
|
||||
break;
|
||||
default:
|
||||
storePathKey = "";
|
||||
break;
|
||||
}
|
||||
|
||||
return storePathKey;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
/**
|
||||
* ValueObjectHandler.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 17.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 17. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
package kcg.faics.board.util;
|
||||
|
||||
import kcg.faics.board.vo.BoardCommentVO;
|
||||
import kcg.faics.board.vo.BoardFileVO;
|
||||
import kcg.faics.board.vo.BoardVO;
|
||||
|
||||
/**
|
||||
* ValueObjectHandler.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 17.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 17. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
public class BoardVOHandler {
|
||||
|
||||
public static BoardVO getBoardVO(final BoardVO boardVO) {
|
||||
BoardVO vo = new BoardVO();
|
||||
vo.setId(boardVO.getId());
|
||||
vo.setSeq(boardVO.getSeq());
|
||||
return vo;
|
||||
}
|
||||
|
||||
public static BoardVO getBoardVO(final String bdId, final int bdSeq) {
|
||||
BoardVO vo = new BoardVO();
|
||||
vo.setId(bdId);
|
||||
vo.setSeq(bdSeq);
|
||||
return vo;
|
||||
}
|
||||
|
||||
public static BoardFileVO getBFileVO(final BoardVO boardVO) {
|
||||
BoardFileVO vo = new BoardFileVO();
|
||||
vo.setId(boardVO.getId());
|
||||
vo.setParentSeq(boardVO.getSeq());
|
||||
return vo;
|
||||
}
|
||||
|
||||
public static BoardFileVO getBFileVO(final String bdId, final int bdSeq, final int bfSeq) {
|
||||
BoardFileVO vo = new BoardFileVO();
|
||||
vo.setId(bdId);
|
||||
vo.setParentSeq(bdSeq);
|
||||
vo.setSeq(bfSeq);
|
||||
return vo;
|
||||
}
|
||||
|
||||
public static BoardFileVO getBFileVO(BoardFileVO boardFileVO) {
|
||||
BoardFileVO vo = new BoardFileVO();
|
||||
vo.setId(boardFileVO.getId());
|
||||
vo.setParentSeq(boardFileVO.getParentSeq());
|
||||
return vo;
|
||||
}
|
||||
|
||||
public static BoardCommentVO getBCommentVO(final BoardVO boardVO) {
|
||||
BoardCommentVO vo = new BoardCommentVO();
|
||||
vo.setId(boardVO.getId());
|
||||
vo.setParentSeq(boardVO.getSeq());
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package kcg.faics.board.vo;
|
||||
|
||||
import kcg.faics.cmmn.bbs.BaseCommentVO;
|
||||
|
||||
/**
|
||||
* BoardCommentVO.java
|
||||
* @author 임새미
|
||||
* @since 2016. 9. 29.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 9. 29. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
public class BoardCommentVO extends BaseCommentVO {
|
||||
|
||||
/**
|
||||
* 게시판 아이디
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* @return 게시판 아이디
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param 게시판 아이디
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package kcg.faics.board.vo;
|
||||
|
||||
import kcg.faics.cmmn.bbs.BaseFileVO;
|
||||
|
||||
public class BoardFileVO extends BaseFileVO{
|
||||
|
||||
private String id;
|
||||
private String[] deleteFiles;
|
||||
|
||||
public BoardFileVO() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the deleteFiles
|
||||
*/
|
||||
public String[] getDeleteFiles() {
|
||||
return deleteFiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param deleteFiles the deleteFiles to set
|
||||
*/
|
||||
public void setDeleteFiles(String[] deleteFiles) {
|
||||
this.deleteFiles = deleteFiles;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* Copyright 2014 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 kcg.faics.board.vo;
|
||||
|
||||
import kcg.faics.cmmn.bbs.BaseSearchVO;
|
||||
|
||||
|
||||
/**
|
||||
* BoardSearchVO.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 24.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 24. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
public class BoardSearchVO extends BaseSearchVO {
|
||||
|
||||
/** 테이블 이름 */
|
||||
private String id = "";
|
||||
|
||||
/** 카테고리 이름 */
|
||||
private String category = " ";
|
||||
|
||||
/** 카테고리 이름 */
|
||||
private String searchCondition = "";
|
||||
|
||||
public BoardSearchVO() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시판 아이디를 반환한다.
|
||||
* @return 게시판 아이디
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시판 아이디를 설정한다.
|
||||
* @param id 를 설정한다.
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 카테고리 아이디를 반환한다.
|
||||
* @return 게시판 아이디
|
||||
*/
|
||||
public String getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
/**
|
||||
* 카테고리 아이디를 설정한다.
|
||||
* @param id 를 설정한다.
|
||||
*/
|
||||
public void setCategory(String category) {
|
||||
if (category == null || category.equals("")) {
|
||||
category = " ";
|
||||
}
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 검색 조건을 반환한다.
|
||||
*/
|
||||
public String getSearchCondition() {
|
||||
return searchCondition;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param 검색 조건을 설정한다.
|
||||
*/
|
||||
public void setSearchCondition(String searchCondition) {
|
||||
this.searchCondition = searchCondition;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,431 @@
|
|||
package kcg.faics.board.vo;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class BoardVO {
|
||||
|
||||
/** 테이블 이름*/
|
||||
private String id;
|
||||
|
||||
/** 게시글번호*/
|
||||
private int seq;
|
||||
/** 회원id*/
|
||||
private String userId;
|
||||
/** 그룹seq*/
|
||||
private int groupSeq = 0;
|
||||
/** 카테고리id*/
|
||||
private String category = " ";
|
||||
/** 회원이름*/
|
||||
private String userName;
|
||||
/** 게시글내용*/
|
||||
private String content;
|
||||
/** 게시글제목*/
|
||||
private String subject;
|
||||
/** ?0 */
|
||||
private int parentSeq = 0;
|
||||
/**
|
||||
* 이전 글 시퀀스 번호.
|
||||
*/
|
||||
private int prevSeq = 0;
|
||||
/**
|
||||
* 다음 글 시퀀스 번호.
|
||||
*/
|
||||
private int nextSeq = 0;
|
||||
/** ?3 */
|
||||
private int step = 0;
|
||||
/** ?4 */
|
||||
private int depth = 0;
|
||||
/** 등록날짜*/
|
||||
private Date regdate;
|
||||
/** 조회수*/
|
||||
private int hit;
|
||||
/** 추천수*/
|
||||
private int recommend;
|
||||
/** 등록자ip*/
|
||||
private String ip = "0.0.0.0";
|
||||
/** ?5 */
|
||||
private int notice;
|
||||
/** ?6 */
|
||||
private int html;
|
||||
/** ?7 */
|
||||
private int num1;
|
||||
/** ?8 */
|
||||
private int num2;
|
||||
/** 소속기관명*/
|
||||
private String data1 = "";
|
||||
/** 직급*/
|
||||
private String data2 = "";
|
||||
/** 소속기관id*/
|
||||
private String place1 = "";
|
||||
/** 직급id*/
|
||||
private String position = "";
|
||||
|
||||
private int isReply;
|
||||
|
||||
/**
|
||||
* 첨부파일 개수.
|
||||
*/
|
||||
private int fileCnt = 0;
|
||||
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
* @return the seq
|
||||
*/
|
||||
public int getSeq() {
|
||||
return seq;
|
||||
}
|
||||
/**
|
||||
* @param seq the seq to set
|
||||
*/
|
||||
public void setSeq(int seq) {
|
||||
this.seq = seq;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the category
|
||||
*/
|
||||
public String getCategory() {
|
||||
return category;
|
||||
}
|
||||
/**
|
||||
* @return the userId
|
||||
*/
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
/**
|
||||
* @param userId the userId to set
|
||||
*/
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
/**
|
||||
* @return the groupSeq
|
||||
*/
|
||||
public int getGroupSeq() {
|
||||
return groupSeq;
|
||||
}
|
||||
/**
|
||||
* @param groupSeq the groupSeq to set
|
||||
*/
|
||||
public void setGroupSeq(int groupSeq) {
|
||||
this.groupSeq = groupSeq;
|
||||
}
|
||||
/**
|
||||
* @return the userName
|
||||
*/
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
/**
|
||||
* @param userName the userName to set
|
||||
*/
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
/**
|
||||
* @return the parentSeq
|
||||
*/
|
||||
public int getParentSeq() {
|
||||
return parentSeq;
|
||||
}
|
||||
/**
|
||||
* @param parentSeq the parentSeq to set
|
||||
*/
|
||||
public void setParentSeq(int parentSeq) {
|
||||
this.parentSeq = parentSeq;
|
||||
}
|
||||
/**
|
||||
* @return the prevSeq
|
||||
*/
|
||||
public int getPrevSeq() {
|
||||
return prevSeq;
|
||||
}
|
||||
/**
|
||||
* @param prevSeq the prevSeq to set
|
||||
*/
|
||||
public void setPrevSeq(int prevSeq) {
|
||||
this.prevSeq = prevSeq;
|
||||
}
|
||||
/**
|
||||
* @return the nextSeq
|
||||
*/
|
||||
public int getNextSeq() {
|
||||
return nextSeq;
|
||||
}
|
||||
/**
|
||||
* @param nextSeq the nextSeq to set
|
||||
*/
|
||||
public void setNextSeq(int nextSeq) {
|
||||
this.nextSeq = nextSeq;
|
||||
}
|
||||
/**
|
||||
* @param category the category to set
|
||||
*/
|
||||
public void setCategory(String category) {
|
||||
if (category == null || category.equals("")) {
|
||||
category = " ";
|
||||
}
|
||||
this.category = category;
|
||||
}
|
||||
/**
|
||||
* @return the content
|
||||
*/
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
/**
|
||||
* @param content the content to set
|
||||
*/
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
/**
|
||||
* @return the subject
|
||||
*/
|
||||
public String getSubject() {
|
||||
return subject;
|
||||
}
|
||||
/**
|
||||
* @param subject the subject to set
|
||||
*/
|
||||
public void setSubject(String subject) {
|
||||
this.subject = subject;
|
||||
}
|
||||
/**
|
||||
* @return the step
|
||||
*/
|
||||
public int getStep() {
|
||||
return step;
|
||||
}
|
||||
/**
|
||||
* @param step the step to set
|
||||
*/
|
||||
public void setStep(int step) {
|
||||
this.step = step;
|
||||
}
|
||||
/**
|
||||
* @return the depth
|
||||
*/
|
||||
public int getDepth() {
|
||||
return depth;
|
||||
}
|
||||
/**
|
||||
* @param depth the depth to set
|
||||
*/
|
||||
public void setDepth(int depth) {
|
||||
this.depth = depth;
|
||||
}
|
||||
/**
|
||||
* @return the regdate
|
||||
*/
|
||||
public Date getRegdate() {
|
||||
return regdate;
|
||||
}
|
||||
/**
|
||||
* @param regdate the regdate to set
|
||||
*/
|
||||
public void setRegdate(Date regdate) {
|
||||
this.regdate = regdate;
|
||||
}
|
||||
/**
|
||||
* @return the hit
|
||||
*/
|
||||
public int getHit() {
|
||||
return hit;
|
||||
}
|
||||
/**
|
||||
* @param hit the hit to set
|
||||
*/
|
||||
public void setHit(int hit) {
|
||||
this.hit = hit;
|
||||
}
|
||||
/**
|
||||
* @return the recommend
|
||||
*/
|
||||
public int getRecommend() {
|
||||
return recommend;
|
||||
}
|
||||
/**
|
||||
* @param recommend the recommend to set
|
||||
*/
|
||||
public void setRecommend(int recommend) {
|
||||
this.recommend = recommend;
|
||||
}
|
||||
/**
|
||||
* @return the ip
|
||||
*/
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
/**
|
||||
* @param ip the ip to set
|
||||
*/
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
/**
|
||||
* @return the notice
|
||||
*/
|
||||
public int getNotice() {
|
||||
return notice;
|
||||
}
|
||||
/**
|
||||
* @param notice the notice to set
|
||||
*/
|
||||
public void setNotice(int notice) {
|
||||
this.notice = notice;
|
||||
}
|
||||
/**
|
||||
* @return the html
|
||||
*/
|
||||
public int getHtml() {
|
||||
return html;
|
||||
}
|
||||
/**
|
||||
* @param html the html to set
|
||||
*/
|
||||
public void setHtml(int html) {
|
||||
this.html = html;
|
||||
}
|
||||
/**
|
||||
* @return the num1
|
||||
*/
|
||||
public int getNum1() {
|
||||
return num1;
|
||||
}
|
||||
/**
|
||||
* @param num1 the num1 to set
|
||||
*/
|
||||
public void setNum1(int num1) {
|
||||
this.num1 = num1;
|
||||
}
|
||||
/**
|
||||
* @return the num2
|
||||
*/
|
||||
public int getNum2() {
|
||||
return num2;
|
||||
}
|
||||
/**
|
||||
* @param num2 the num2 to set
|
||||
*/
|
||||
public void setNum2(int num2) {
|
||||
this.num2 = num2;
|
||||
}
|
||||
/**
|
||||
* @return the data1
|
||||
*/
|
||||
public String getData1() {
|
||||
return data1;
|
||||
}
|
||||
/**
|
||||
* @param data1 the data1 to set
|
||||
*/
|
||||
public void setData1(String data1) {
|
||||
this.data1 = data1;
|
||||
}
|
||||
/**
|
||||
* @return the data2
|
||||
*/
|
||||
public String getData2() {
|
||||
return data2;
|
||||
}
|
||||
/**
|
||||
* @param data2 the data2 to set
|
||||
*/
|
||||
public void setData2(String data2) {
|
||||
this.data2 = data2;
|
||||
}
|
||||
/**
|
||||
* @return the place1
|
||||
*/
|
||||
public String getPlace1() {
|
||||
return place1;
|
||||
}
|
||||
/**
|
||||
* @param place1 the place1 to set
|
||||
*/
|
||||
public void setPlace1(String place1) {
|
||||
this.place1 = place1;
|
||||
}
|
||||
/**
|
||||
* @return the position
|
||||
*/
|
||||
public String getPosition() {
|
||||
return position;
|
||||
}
|
||||
/**
|
||||
* @param position the position to set
|
||||
*/
|
||||
public void setPosition(String position) {
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
/**
|
||||
* 조회수를 1 증가시킨다.
|
||||
*/
|
||||
public void incHit() {
|
||||
this.hit += 1;
|
||||
}
|
||||
/**
|
||||
* 조회수를 1 감소시킨다.
|
||||
*/
|
||||
public void decHit() {
|
||||
this.hit -= 1;
|
||||
}
|
||||
/**
|
||||
* @return the isReply
|
||||
*/
|
||||
public int getIsReply() {
|
||||
return isReply;
|
||||
}
|
||||
/**
|
||||
* @param isReply the isReply to set
|
||||
*/
|
||||
public void setIsReply(int isReply) {
|
||||
this.isReply = isReply;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the fileCnt
|
||||
*/
|
||||
public final int getFileCnt() {
|
||||
return fileCnt;
|
||||
}
|
||||
/**
|
||||
* @param fileCnt the fileCnt to set
|
||||
*/
|
||||
public final void setFileCnt(int fileCnt) {
|
||||
this.fileCnt = fileCnt;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BoardVO [id=" + id + ", seq=" + seq + ", userId=" + userId
|
||||
+ ", groupSeq=" + groupSeq + ", category=" + category
|
||||
+ ", userName=" + userName + ", content=" + content
|
||||
+ ", subject=" + subject + ", parentSeq=" + parentSeq
|
||||
+ ", prevSeq=" + prevSeq + ", nextSeq=" + nextSeq + ", step="
|
||||
+ step + ", depth=" + depth + ", regdate=" + regdate + ", hit="
|
||||
+ hit + ", recommend=" + recommend + ", ip=" + ip + ", notice="
|
||||
+ notice + ", html=" + html + ", num1=" + num1 + ", num2="
|
||||
+ num2 + ", data1=" + data1 + ", data2=" + data2 + ", place1="
|
||||
+ place1 + ", position=" + position + ", isReply=" + isReply
|
||||
+ "]";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,576 @@
|
|||
package kcg.faics.board.web;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import kcg.faics.board.service.BoardService;
|
||||
import kcg.faics.board.util.BoardUtils;
|
||||
import kcg.faics.board.util.BoardVOHandler;
|
||||
import kcg.faics.board.vo.BoardCommentVO;
|
||||
import kcg.faics.board.vo.BoardFileVO;
|
||||
import kcg.faics.board.vo.BoardSearchVO;
|
||||
import kcg.faics.board.vo.BoardVO;
|
||||
import kcg.faics.cmmn.bbs.BaseCommentService;
|
||||
import kcg.faics.cmmn.bbs.BaseFileService;
|
||||
import kcg.faics.cmmn.file.FileResponser;
|
||||
import kcg.faics.sec.LoginUserVO;
|
||||
import kcg.faics.sec.UserUtil;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||
import org.springframework.web.bind.support.SessionStatus;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springmodules.validation.commons.DefaultBeanValidator;
|
||||
|
||||
import egovframework.rte.fdl.property.EgovPropertyService;
|
||||
import egovframework.rte.fdl.security.userdetails.util.EgovUserDetailsHelper;
|
||||
import egovframework.rte.ptl.mvc.tags.ui.pagination.PaginationInfo;
|
||||
|
||||
/**
|
||||
* 게시판 관련 컨트롤러.
|
||||
*
|
||||
* BoardController.java
|
||||
* @author 임새미
|
||||
* @since 2016. 9. 28.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 9. 28. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@SessionAttributes(types = BoardVO.class)
|
||||
@RequestMapping("/bbs")
|
||||
public class BoardController {
|
||||
|
||||
/**
|
||||
* EgovPropertyService - properties값을 가져오는 인터페이스.
|
||||
**/
|
||||
@Resource(name = "propertiesService")
|
||||
private EgovPropertyService propertiesService;
|
||||
|
||||
/**
|
||||
* Validator - 유효성 검사.
|
||||
**/
|
||||
@Resource(name = "beanValidator")
|
||||
private DefaultBeanValidator beanValidator;
|
||||
|
||||
/**
|
||||
* BoardService - 게시판 데이터처리에 관한 인터페이스.
|
||||
**/
|
||||
@Resource(name = "boardService")
|
||||
private BoardService boardService;
|
||||
|
||||
/**
|
||||
* BoardFileService - 게시판 파일에 관한 인터페이스.
|
||||
**/
|
||||
@Resource(name = "boardFileService")
|
||||
private BaseFileService<BoardFileVO> boardFileService;
|
||||
|
||||
/**
|
||||
* BoardCommentService - 게시판 덧글에 관한 인터페이스.
|
||||
**/
|
||||
@Resource(name = "boardCommentService")
|
||||
private BaseCommentService<BoardCommentVO> boardCommentService;
|
||||
|
||||
/**
|
||||
* 게시판 목록 화면을 반환한다.
|
||||
*
|
||||
* @param req Request 객체
|
||||
* @param searchVO 검색, 페이지 정보 객체
|
||||
* @param model 모델 객체
|
||||
* @return 게시판 목록 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value = "/list.do")
|
||||
public String boardList(final HttpServletRequest req, @ModelAttribute("searchVO") final BoardSearchVO searchVO, final Model model) throws Exception {
|
||||
try {
|
||||
/* 페이징 처리 정보 */
|
||||
searchVO.setPageUnit(propertiesService.getInt("pageUnit"));
|
||||
searchVO.setPageSize(propertiesService.getInt("pageSize"));
|
||||
|
||||
/* 페이징 처리 */
|
||||
PaginationInfo paginationInfo = new PaginationInfo();
|
||||
paginationInfo.setCurrentPageNo(searchVO.getPageIndex());
|
||||
paginationInfo.setRecordCountPerPage(searchVO.getPageUnit());
|
||||
paginationInfo.setPageSize(searchVO.getPageSize());
|
||||
|
||||
searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
|
||||
searchVO.setLastIndex(paginationInfo.getLastRecordIndex());
|
||||
searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
|
||||
|
||||
int totSearchCnt = boardService.selectListCnt(searchVO);
|
||||
paginationInfo.setTotalRecordCount(totSearchCnt);
|
||||
model.addAttribute("paginationInfo", paginationInfo);
|
||||
|
||||
|
||||
/* 게시판 리스트 */
|
||||
List<BoardVO> boardList = boardService.selectList(searchVO);
|
||||
model.addAttribute("resultList", boardList);
|
||||
|
||||
/* 게시판 상단 페이지 및 게시물 정보 표현을 위한 데이터 */
|
||||
int totCnt = boardService.selectTotalCnt(searchVO);
|
||||
model.addAttribute("totalCnt", totCnt);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "error/bizError";
|
||||
}
|
||||
|
||||
return "board/boardList.tiles";
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물의 내용을 확인하는 페이지를 반환한다.
|
||||
*
|
||||
* @param boardVO 게시판 VO
|
||||
* @param model 모델 객체
|
||||
* @return 게시물 조회 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value = "/view.do", method = RequestMethod.GET)
|
||||
public String boardView(final BoardVO boardVO, final Model model) throws Exception {
|
||||
|
||||
try {
|
||||
/* 작성자와 조회자가 다른 경우 조회수 증가 */
|
||||
BoardVO board = boardService.select(boardVO);
|
||||
if (!UserUtil.isEqualMember(board.getUserId())) {
|
||||
boardService.incHit(board);
|
||||
}
|
||||
/* 게시판 내용 */
|
||||
model.addAttribute("boardVO", boardService.select(boardVO));
|
||||
/* 게시판 파일내용 */
|
||||
model.addAttribute("boardFileVO", boardFileService.selectList(BoardVOHandler.getBFileVO(boardVO)));
|
||||
/* 게시판 덧글내용 */
|
||||
model.addAttribute("boardCommentVOList", boardCommentService.selectList(BoardVOHandler.getBCommentVO(boardVO)));
|
||||
|
||||
/* 덧글 ModelAttribute */
|
||||
model.addAttribute("boardCommentVO", BoardVOHandler.getBCommentVO(boardVO));
|
||||
|
||||
/* 세션 사용자 정보 */
|
||||
model.addAttribute("loginUserVO", UserUtil.getMemberInfo());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "error/bizError";
|
||||
}
|
||||
|
||||
return "board/boardView.tiles";
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물 추가 화면을 반환한다.
|
||||
*
|
||||
* @param model 모델 객체
|
||||
* @param boardVO 게시판 VO
|
||||
* @return 게시물 조회 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value = "/addView.do", method = RequestMethod.GET)
|
||||
public String boardAddView(final Model model, final BoardVO boardVO) throws Exception {
|
||||
|
||||
BoardVO modelAttr = new BoardVO();
|
||||
modelAttr.setId(boardVO.getId());
|
||||
modelAttr.setCategory(boardVO.getCategory());
|
||||
|
||||
/* 게시물 입력 Form ModelAttribute */
|
||||
model.addAttribute("boardVO", modelAttr);
|
||||
/* create or modify 플래그 */
|
||||
model.addAttribute("registerFlag", "create");
|
||||
|
||||
return "board/boardAdd.tiles";
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물을 추가한 후 추가한 게시물 화면으로 이동한다.
|
||||
*
|
||||
* @param multiRequest multpart타입의 요청 객체
|
||||
* @param boardVO 게시물 정보 객체
|
||||
* @param bindingResult 바인딩 객체
|
||||
* @param model 모델 객체
|
||||
* @param status 세선 상태 객체
|
||||
* @return 게시물 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value = "/add.do", method = RequestMethod.POST)
|
||||
public String boardAdd(final MultipartHttpServletRequest multiRequest, @ModelAttribute("boardVO") final BoardVO boardVO,
|
||||
final BindingResult bindingResult, final Model model, final SessionStatus status) throws Exception {
|
||||
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
/* 인증된 사용자인지 확인 */
|
||||
Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();
|
||||
if (isAuthenticated) {
|
||||
try {
|
||||
/* 유효성 검사 */
|
||||
// beanValidator.validate(boardVO, bindingResult);
|
||||
if (bindingResult.hasErrors()) {
|
||||
model.addAttribute("boardVO", boardVO);
|
||||
return "board/boardAdd.tiles";
|
||||
}
|
||||
|
||||
final Map<String, MultipartFile> fileMap = multiRequest.getFileMap();
|
||||
|
||||
/* 사용자 정보 입력 */
|
||||
LoginUserVO user = UserUtil.getMemberInfo();
|
||||
boardVO.setUserId(user.getUserid());
|
||||
boardVO.setUserName(user.getName());
|
||||
boardVO.setPosition(user.getPosition());
|
||||
boardVO.setPlace1(user.getPlace1());
|
||||
boardVO.setData1(user.getPlace1Yak());
|
||||
boardVO.setData2(user.getPositionStr());
|
||||
boardVO.setIsReply(-1);
|
||||
map = boardService.insert(boardVO, fileMap);
|
||||
|
||||
status.setComplete();
|
||||
|
||||
int result = (Integer) map.get("result");
|
||||
int seq = (Integer) map.get("seq");
|
||||
if (result > 0 && seq > 0) {
|
||||
return "redirect:/bbs/view.do?seq=" + seq + "&id=" + boardVO.getId();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "error/bizError";
|
||||
}
|
||||
}
|
||||
|
||||
return "error/bizError";
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물을 추가한 후 추가한 게시물 화면으로 이동한다.
|
||||
*
|
||||
* @param boardVO 게시판VO 객체
|
||||
* @param model 모델 객체
|
||||
* @return 게시물 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value = "/updateView.do", method = RequestMethod.POST)
|
||||
public String updateView(final BoardVO boardVO, final Model model) throws Exception {
|
||||
|
||||
BoardVO updateBoard = boardService.select(boardVO);
|
||||
try {
|
||||
/* 글 작성자와 세션 사용자의 아이디를 비교하여 본인여부를 판단한다 */
|
||||
if (updateBoard == null || !UserUtil.isEqualMember(updateBoard.getUserId()) && !UserUtil.isSysAdmin()) {
|
||||
return "redirect:/bbs/view.do?seq=" + boardVO.getSeq() + "&id=" + boardVO.getId();
|
||||
}
|
||||
|
||||
model.addAttribute("boardVO", updateBoard);
|
||||
model.addAttribute("registerFlag", "modify");
|
||||
model.addAttribute("boardFileVO", boardFileService.selectList(BoardVOHandler.getBFileVO(updateBoard)));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "error/bizError";
|
||||
}
|
||||
|
||||
return "board/boardAdd.tiles";
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물을 수정한다.
|
||||
*
|
||||
* @param multiRequest multpart타입의 요청 객체
|
||||
* @param boardVO 게시물 정보 객체
|
||||
* @param bindingResult 바인딩 객체
|
||||
* @param model 모델 객체
|
||||
* @param status 세선 상태 객체
|
||||
* @return 게시물 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value = "/update.do", method = RequestMethod.POST)
|
||||
public String update(final MultipartHttpServletRequest multiRequest, @ModelAttribute("boardVO") final BoardVO boardVO,
|
||||
final BindingResult bindingResult, final Model model, final SessionStatus status) throws Exception {
|
||||
|
||||
try {
|
||||
/* 글 작성자와 세션 사용자의 아이디를 비교하여 본인여부를 판단한다 */
|
||||
if (!UserUtil.isEqualMember(boardVO.getUserId()) && !UserUtil.isSysAdmin()) {
|
||||
return "redirect:/bbs/view.do?seq=" + boardVO.getSeq() + "&id=" + boardVO.getId();
|
||||
}
|
||||
|
||||
/* 유효성 검사 */
|
||||
// beanValidator.validate(boardVO, bindingResult);
|
||||
if (bindingResult.hasErrors()) {
|
||||
model.addAttribute("boardVO", boardVO);
|
||||
model.addAttribute("registerFlag", "modify");
|
||||
return "board/boardAdd.tiles";
|
||||
}
|
||||
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
String[] deleteFiles = multiRequest.getParameterValues("deleteFile");
|
||||
final Map<String, MultipartFile> fileMap = multiRequest.getFileMap();
|
||||
map = boardService.update(boardVO, fileMap, deleteFiles);
|
||||
|
||||
status.setComplete();
|
||||
|
||||
int result = (Integer) map.get("result");
|
||||
int seq = (Integer) map.get("seq");
|
||||
|
||||
if (result > 0 && seq > 0) {
|
||||
return "redirect:/bbs/view.do?seq=" + seq + "&id=" + boardVO.getId();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "error/bizError";
|
||||
}
|
||||
|
||||
return "redirect:/bbs/list.do?id=" + boardVO.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물을 삭제한다.
|
||||
*
|
||||
* @param boardVO 게시판 VO
|
||||
* @param model 모델 객체
|
||||
* @param status 세선 상태 객체
|
||||
* @return 게시물 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value = "/delete.do", method = RequestMethod.POST)
|
||||
public String delete(final BoardVO boardVO, final Model model, final SessionStatus status) throws Exception {
|
||||
|
||||
try {
|
||||
BoardVO deleteBoard = boardService.select(boardVO);
|
||||
|
||||
if (deleteBoard == null || (!UserUtil.isEqualMember(deleteBoard.getUserId()) && !UserUtil.isSysAdmin())) {
|
||||
return "redirect:/bbs/view.do?seq=" + boardVO.getSeq() + "&id=" + boardVO.getId();
|
||||
}
|
||||
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
map = boardService.delete(boardVO);
|
||||
|
||||
status.setComplete();
|
||||
|
||||
if ((Integer) map.get("result") > 0) {
|
||||
return "redirect:/bbs/list.do?id=" + boardVO.getId();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "error/bizError";
|
||||
}
|
||||
|
||||
return "redirect:/bbs/view.do?seq=" + boardVO.getSeq() + "&id=" + boardVO.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물을 삭제한다.
|
||||
*
|
||||
* @param bdId 삭제할 게시판 ID
|
||||
* @param deleteBoard 모델 객체
|
||||
* @param status 세선 상태 객체
|
||||
* @return 게시물 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value = "/selectedDelete.do", method = RequestMethod.POST)
|
||||
public String deleteSelected(@RequestParam("id") final String bdId, final int[] deleteBoard, final SessionStatus status) throws Exception {
|
||||
/* 관리자만 가능 */
|
||||
if (UserUtil.isAdmin()) {
|
||||
try {
|
||||
BoardVO boardVO = BoardVOHandler.getBoardVO(bdId, 0);
|
||||
if (deleteBoard != null) {
|
||||
boardService.selectAndDelete(boardVO, deleteBoard);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
status.setComplete();
|
||||
}
|
||||
return "redirect:/bbs/list.do?id=" + bdId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 답글쓰기 화면을 반환한다.
|
||||
*
|
||||
* @param boardVO 게시판 VO
|
||||
* @param model 모델 객체
|
||||
* @param status SessionStatus
|
||||
* @return 답글쓰기 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value = "/replyView.do", method = RequestMethod.POST)
|
||||
public String replyView(final BoardVO boardVO, final Model model, final SessionStatus status) throws Exception {
|
||||
BoardVO replyVO = BoardVOHandler.getBoardVO(boardVO);
|
||||
replyVO.setStep(boardVO.getStep());
|
||||
replyVO.setGroupSeq(boardVO.getGroupSeq());
|
||||
replyVO.setDepth(boardVO.getDepth());
|
||||
model.addAttribute("boardVO", replyVO);
|
||||
model.addAttribute("registerFlag", "reply");
|
||||
return "board/boardAdd.tiles";
|
||||
}
|
||||
|
||||
/**
|
||||
* 답글을 등록하고 조회 화면을 반환한다.
|
||||
*
|
||||
* @param boardVO 게시물 VO
|
||||
* @param bindingResult BindingResult
|
||||
* @param model 모델 객체
|
||||
* @param status SessionStatus
|
||||
* @param multiRequest MultipartHttpServletRequest
|
||||
* @return 조회 화면
|
||||
*/
|
||||
@RequestMapping(value = "/reply.do", method = RequestMethod.POST)
|
||||
public String replyAdd(@ModelAttribute("boardVO") final BoardVO boardVO,
|
||||
final BindingResult bindingResult, final Model model, final SessionStatus status, final MultipartHttpServletRequest multiRequest) {
|
||||
|
||||
Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();
|
||||
if (isAuthenticated) {
|
||||
try {
|
||||
// beanValidator.validate(boardVO, bindingResult);
|
||||
if (bindingResult.hasErrors()) {
|
||||
model.addAttribute("boardVO", boardVO);
|
||||
return "board/boardAdd.tiles";
|
||||
}
|
||||
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
final Map<String, MultipartFile> fileMap = multiRequest.getFileMap();
|
||||
|
||||
/* 사용자 정보 입력 */
|
||||
LoginUserVO user = UserUtil.getMemberInfo();
|
||||
boardVO.setUserId(user.getUserid());
|
||||
boardVO.setUserName(user.getName());
|
||||
boardVO.setPosition(user.getPosition());
|
||||
boardVO.setPlace1(user.getPlace1());
|
||||
boardVO.setData1(user.getPlace1Yak());
|
||||
boardVO.setData2(user.getPositionStr());
|
||||
boardVO.setIsReply(1);
|
||||
map = boardService.insert(boardVO, fileMap);
|
||||
|
||||
status.setComplete();
|
||||
|
||||
int result = (Integer) map.get("result");
|
||||
int seq = (Integer) map.get("seq");
|
||||
if (result > 0 && seq > 0) {
|
||||
return "redirect:/bbs/view.do?seq=" + seq + "&id=" + boardVO.getId();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "error/bizError";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return "redirect:/bbs/list.do?id=" + boardVO.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 덧글을 등록한다.
|
||||
*
|
||||
* @param boardCommentVO 덧글 데이터
|
||||
* @param status SessionStatus
|
||||
* @return json 객체
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/commentAdd.json", method = RequestMethod.POST)
|
||||
public Object comment(@ModelAttribute("boardCommentVO") final BoardCommentVO boardCommentVO, final SessionStatus status) {
|
||||
|
||||
HashMap<String, Object> ret = new HashMap<String, Object>();
|
||||
|
||||
Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();
|
||||
if (isAuthenticated) {
|
||||
try {
|
||||
LoginUserVO user = UserUtil.getMemberInfo();
|
||||
boardCommentVO.setUserId(user.getUserid());
|
||||
boardCommentVO.setUserName(user.getName());
|
||||
|
||||
|
||||
ret = boardCommentService.insert(boardCommentVO);
|
||||
if ((Integer) ret.get("result") > 0) {
|
||||
ret.put("comment", boardCommentService.select(boardCommentVO));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
status.setComplete();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* 댓글을 삭제한다.
|
||||
*
|
||||
* @param boardCommentVO 댓글 VO
|
||||
* @param status SessionStatus
|
||||
* @return json 객체
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping("/commentDelete.json")
|
||||
public Object commentDelete(final BoardCommentVO boardCommentVO, final SessionStatus status) {
|
||||
|
||||
HashMap<String, Object> ret = new HashMap<String, Object>();
|
||||
int result = 0;
|
||||
try {
|
||||
BoardCommentVO commentVO = boardCommentService.select(boardCommentVO);
|
||||
if (UserUtil.isEqualMember(commentVO.getUserId()) || UserUtil.isSysAdmin()) {
|
||||
result = boardCommentService.delete(boardCommentVO);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
status.setComplete();
|
||||
|
||||
ret.put("result", result);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* 첨부파일로 등록된 파일에 대하여 다운로드를 제공한다.
|
||||
*
|
||||
* @param boardFileVO 게시판 파일 VO
|
||||
* @param request Request 객체
|
||||
* @param response Response 객체
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value = "/download.do")
|
||||
public void cvplFileDownload(final BoardFileVO boardFileVO, final HttpServletRequest request, final HttpServletResponse response) throws Exception {
|
||||
|
||||
BoardFileVO vo = boardFileService.select(boardFileVO);
|
||||
String fileOrgName = vo.getOrgName();
|
||||
String storePathKey = BoardUtils.getStorePathKey(boardFileVO.getId());
|
||||
String fileFullPath = propertiesService.getString(storePathKey) + vo.getSaveName();
|
||||
|
||||
File file = new File(fileFullPath);
|
||||
if (file.exists()) {
|
||||
FileResponser.setResponse(file, fileOrgName, request, response);
|
||||
BufferedInputStream in = null;
|
||||
try {
|
||||
in = new BufferedInputStream(new FileInputStream(file));
|
||||
FileCopyUtils.copy(in, response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
/**
|
||||
* CommonsUtils.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 14.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 14. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
package kcg.faics.cmmn;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* CommonsUtils.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 14.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 14. 임새미 최초생성
|
||||
* 2016. 12. 14. 하영지 isEmpty 생성
|
||||
*
|
||||
*/
|
||||
public class CommonsUtils {
|
||||
|
||||
public static String sqlInjectionFilter(String str){
|
||||
Pattern evilChars = Pattern.compile("\\[\'-#()@;=*/+%\\]");
|
||||
str = evilChars.matcher(str).replaceAll("");
|
||||
|
||||
String lowerStr = str.toLowerCase();
|
||||
|
||||
if (lowerStr.contains("union") || lowerStr.contains("select") || lowerStr.contains("insert") || lowerStr.contains("drop")
|
||||
|| lowerStr.contains("update") || lowerStr.contains("delete") || lowerStr.contains("join") || lowerStr.contains("from")
|
||||
|| lowerStr.contains("where") || lowerStr.contains("substr") || lowerStr.contains("user_tables") || lowerStr.contains("user_tab_columns")) {
|
||||
|
||||
str = lowerStr;
|
||||
str = str.replaceAll("union", "q-union");
|
||||
str = str.replaceAll("select", "q-select");
|
||||
str = str.replaceAll("insert", "q-insert");
|
||||
str = str.replaceAll("drop", "q-drop");
|
||||
str = str.replaceAll("update", "q-update");
|
||||
str = str.replaceAll("delete", "q-delete");
|
||||
str = str.replaceAll("join", "q-join");
|
||||
str = str.replaceAll("from", "q-from");
|
||||
str = str.replaceAll("where", "q-where");
|
||||
str = str.replaceAll("substr", "q-substr");
|
||||
str = str.replaceAll("user_tables", "q-user_tables");
|
||||
str = str.replaceAll("user_tab_columns", "q-user_tab_columns");
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
public static HashMap<String, Object> getParameterMap(HttpServletRequest request){
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> paramMap = request.getParameterMap();
|
||||
HashMap<String, Object> newMap = new HashMap<String, Object>();
|
||||
|
||||
Set<String> keySet = paramMap.keySet();
|
||||
Iterator<String> it = keySet.iterator();
|
||||
while (it.hasNext()) {
|
||||
String key = it.next();
|
||||
if (paramMap.get(key) instanceof String[]) {
|
||||
newMap.put(key, ((String[]) paramMap.get(key))[0]);
|
||||
} else {
|
||||
newMap.put(key, paramMap.get(key));
|
||||
}
|
||||
}
|
||||
return newMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 객체가 비어있는지 체크
|
||||
*
|
||||
* @param s 체크할 객체
|
||||
* @return 비어있음:true
|
||||
*/
|
||||
public static boolean isEmpty(final Object s) {
|
||||
if (s == null) {
|
||||
return true;
|
||||
}
|
||||
if ((s instanceof String) && ((String.valueOf(s)).trim().length() == 0)) {
|
||||
return true;
|
||||
}
|
||||
if (s instanceof Map) {
|
||||
return ((Map<?, ?>)s).isEmpty();
|
||||
}
|
||||
if (s instanceof List) {
|
||||
return ((List<?>)s).isEmpty();
|
||||
}
|
||||
if (s instanceof Object[]) {
|
||||
return (((Object[])s).length == 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* Copyright 2008-2009 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.
|
||||
*/
|
||||
package kcg.faics.cmmn;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import org.springframework.web.context.ServletContextAware;
|
||||
|
||||
import egovframework.rte.ptl.mvc.tags.ui.pagination.AbstractPaginationRenderer;
|
||||
|
||||
/**
|
||||
* @Class Name : ImagePaginationRenderer.java
|
||||
* @Description : ImagePaginationRenderer Class
|
||||
* @Modification Information
|
||||
* @
|
||||
* @ 수정일 수정자 수정내용
|
||||
* @ --------- --------- -------------------------------
|
||||
* @ 2009.03.16 최초생성
|
||||
*
|
||||
* @author 개발프레임웍크 실행환경 개발팀
|
||||
* @since 2009. 03.16
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* Copyright (C) by MOPAS All right reserved.
|
||||
*/
|
||||
public class ImagePaginationRenderer extends AbstractPaginationRenderer implements ServletContextAware {
|
||||
|
||||
private ServletContext servletContext;
|
||||
|
||||
public ImagePaginationRenderer() {
|
||||
// no-op
|
||||
}
|
||||
|
||||
/**
|
||||
* PaginationRenderer
|
||||
*
|
||||
* @see 개발프레임웍크 실행환경 개발팀
|
||||
*/
|
||||
public void initVariables() {
|
||||
|
||||
firstPageLabel = "<a href=\"#\" onclick=\"{0}({1}); return false;\">" + "<image src='" + servletContext.getContextPath() + "/images/cmmn/btn_page_pre10.gif' border=0/></a> ";
|
||||
previousPageLabel = "<a href=\"#\" onclick=\"{0}({1}); return false;\">" + "<image src='" + servletContext.getContextPath() + "/images/cmmn/btn_page_pre1.gif' border=0/></a> ";
|
||||
currentPageLabel = "<strong>{0}</strong> ";
|
||||
otherPageLabel = "<a href=\"#\" onclick=\"{0}({1}); return false;\">{2}</a> ";
|
||||
nextPageLabel = "<a href=\"#\" onclick=\"{0}({1}); return false;\">" + "<image src='" + servletContext.getContextPath() + "/images/cmmn/btn_page_next1.gif' border=0/></a> ";
|
||||
lastPageLabel = "<a href=\"#\" onclick=\"{0}({1}); return false;\">" + "<image src='" + servletContext.getContextPath() + "/images/cmmn/btn_page_next10.gif' border=0/></a> ";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setServletContext(ServletContext servletContext) {
|
||||
this.servletContext = servletContext;
|
||||
initVariables();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package kcg.faics.cmmn;
|
||||
|
||||
/**
|
||||
* 메뉴 위치.
|
||||
*
|
||||
* @author kimnomin
|
||||
*
|
||||
*/
|
||||
public final class MenuPosition {
|
||||
/**
|
||||
* 상단메뉴. (메인메뉴)
|
||||
*/
|
||||
public static final String TOP = "T";
|
||||
/**
|
||||
* 상단 보조메뉴.
|
||||
*/
|
||||
public static final String TOP_SUB = "TS";
|
||||
|
||||
/**
|
||||
* 생성자.
|
||||
*/
|
||||
private MenuPosition() {
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,188 @@
|
|||
/**
|
||||
* BoardPreventSqlInjectionAop.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 19.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 19. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
package kcg.faics.cmmn.aop;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import kcg.faics.cmmn.service.LogService;
|
||||
import kcg.faics.cmmn.service.MenuService;
|
||||
import kcg.faics.cmmn.vo.MenuVO;
|
||||
import kcg.faics.sec.LoginUserVO;
|
||||
import kcg.faics.sec.UserUtil;
|
||||
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* CommonAop.java
|
||||
*
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 19.
|
||||
*
|
||||
* 수정일 수정자 수정내용 ------------- -------- --------------------------- 2016.
|
||||
* 10. 19. 임새미 최초생성 2016. 11. 10. 임새미 사용자 로그 생성 부분 추가
|
||||
*
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
public class CommonAop {
|
||||
|
||||
@Resource(name = "menuService")
|
||||
MenuService menuService;
|
||||
|
||||
@Resource(name = "logService")
|
||||
LogService logService;
|
||||
|
||||
@Around("execution(* kcg.faics..*Controller.*(..))")
|
||||
public Object menuGenerator(final ProceedingJoinPoint thisJoinPoint)
|
||||
throws Throwable {
|
||||
|
||||
HttpServletRequest req = ((ServletRequestAttributes) RequestContextHolder
|
||||
.getRequestAttributes()).getRequest();
|
||||
String loginUrl = "/loginView.do";
|
||||
String url = req.getRequestURI();
|
||||
|
||||
if (loginUrl.equals(url)) {
|
||||
return thisJoinPoint.proceed();
|
||||
}
|
||||
|
||||
LoginUserVO loginUserVO = null;
|
||||
try {
|
||||
loginUserVO = UserUtil.getMemberInfo();
|
||||
} catch (Exception e) {
|
||||
//세션정보가 없을 경우 로그인 페이지로 이동.
|
||||
if (loginUserVO == null) {
|
||||
return "redirect:" + loginUrl;
|
||||
}
|
||||
}
|
||||
try {
|
||||
for (Object obj : thisJoinPoint.getArgs()) {
|
||||
if (obj instanceof Model) {
|
||||
Model model = (Model) obj;
|
||||
|
||||
MenuVO menuVO = new MenuVO();
|
||||
menuVO.setUserId(loginUserVO.getUserid());
|
||||
menuVO.setUserType(loginUserVO.getType());
|
||||
List<MenuVO> mainMenuList = menuService
|
||||
.selectMainMenuList(menuVO);
|
||||
model.addAttribute("mainMenuList", mainMenuList);
|
||||
|
||||
List<MenuVO> topSubMenuList = menuService
|
||||
.selectTopSubMenuList(menuVO);
|
||||
|
||||
model.addAttribute("topSubMenuList", topSubMenuList);
|
||||
|
||||
HashMap<String, Object> menu = new HashMap<String, Object>();
|
||||
|
||||
String subStr = url.substring(1);
|
||||
String boardId = "";
|
||||
String group = subStr.split("/")[0];
|
||||
String onlyUrl = subStr;
|
||||
String qryCate = "";
|
||||
if (onlyUrl.indexOf("/") > -1) {
|
||||
onlyUrl = subStr.substring(onlyUrl.indexOf("/"));
|
||||
} else {
|
||||
return thisJoinPoint.proceed();
|
||||
}
|
||||
url = onlyUrl;
|
||||
|
||||
if (req.getParameter("id") != null) {
|
||||
boardId = req.getParameter("id");
|
||||
|
||||
switch (boardId) {
|
||||
// 외사통계-통계월보는 타이틀을 같이 쓸것이므로 카테고리를 나누지않는다.
|
||||
case "stat_bbs":
|
||||
break;
|
||||
|
||||
default:
|
||||
if (req.getParameter("category") != null
|
||||
&& !req.getParameter("category")
|
||||
.equals(" ")) {
|
||||
qryCate = "category="
|
||||
+ req.getParameter("category");
|
||||
// url = url + "/" +
|
||||
// req.getParameter("category");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
menu.put("url", url);
|
||||
menu.put("group", group);
|
||||
menu.put("boardId", boardId);
|
||||
menu.put("query", qryCate);
|
||||
|
||||
HashMap<String, Object> menuInfo = menuService
|
||||
.getMenuInfo(menu);
|
||||
menuVO.setId(Integer
|
||||
.parseInt(menuInfo.get("ID").toString()));
|
||||
menuInfo.put("userId", loginUserVO.getUserid());
|
||||
|
||||
List<MenuVO> currAndHigherMenuList = menuService
|
||||
.selectListWithHigher(menuVO);
|
||||
model.addAttribute("currAndHigherMenuList",
|
||||
currAndHigherMenuList);
|
||||
model.addAttribute("menu", menuInfo);
|
||||
model.addAttribute("subMenu",
|
||||
menuService.getSubmenu(menuInfo));
|
||||
|
||||
addUserLog(req, menu);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
}
|
||||
|
||||
Object proc = thisJoinPoint.proceed();
|
||||
return proc;
|
||||
}
|
||||
|
||||
/**
|
||||
* 사용자 로그를 기록한다.
|
||||
*
|
||||
* @param req
|
||||
* Request 객체
|
||||
* @param menu
|
||||
* 메뉴 Map 객체
|
||||
*/
|
||||
private void addUserLog(final HttpServletRequest req,
|
||||
final HashMap<String, Object> menu) {
|
||||
LoginUserVO user = (LoginUserVO) req.getSession()
|
||||
.getAttribute("userVO");
|
||||
|
||||
HashMap<String, Object> paramMap = new HashMap<String, Object>();
|
||||
paramMap.put("userid", user.getUserid());
|
||||
paramMap.put("name", user.getName());
|
||||
paramMap.put("userip", user.getIp());
|
||||
paramMap.put("place1", user.getPlace1());
|
||||
paramMap.put("position", user.getPosition());
|
||||
|
||||
paramMap.put("location1", menu.get("group"));
|
||||
paramMap.put("location2", menu.get("url"));
|
||||
paramMap.put("location3", req.getRequestURI());
|
||||
|
||||
try {
|
||||
logService.insertUserLog(paramMap);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package kcg.faics.cmmn.bbs;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* 확장형 게시판 비지니스 로직 인터페이스.
|
||||
*
|
||||
* @author kimnomin
|
||||
*
|
||||
* @param <SearchT>
|
||||
* 페이징 및 검색조건 VO
|
||||
* @param <DataT>
|
||||
* 실제 데이터 VO
|
||||
*/
|
||||
public interface BaseBbsExService<SearchT, DataT> extends BaseBbsService<SearchT, DataT> {
|
||||
|
||||
/**
|
||||
* seq배열을 받아 해당되는 게시판을 삭제한다.
|
||||
*
|
||||
* @param dataVO
|
||||
* 제네릭 타입의 data 관련 VO
|
||||
* @param seq
|
||||
* 시퀀스 배열
|
||||
* @return 맵 객체 { result: 1-성공 0-실패, idx: 수정된 게시물 idx }
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
HashMap<String, Object> selectAndDelete(DataT dataVO, int[] seq) throws Exception;
|
||||
|
||||
/**
|
||||
* 조회수를 1 증가시킨다.
|
||||
*
|
||||
* @param dataVO
|
||||
* 제네릭 타입의 data 관련 VO
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
int incHit(DataT dataVO) throws Exception;
|
||||
}
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
package kcg.faics.cmmn.bbs;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 기본형 게시판 비지니스 로직 인터페이스.
|
||||
* 기본적인 CRUD를 지원한다.
|
||||
*
|
||||
* @author kimnomin
|
||||
*
|
||||
* @param <SearchT>
|
||||
* 페이징 및 검색조건 VO
|
||||
* @param <DataT>
|
||||
* 실제 데이터 VO
|
||||
*/
|
||||
public interface BaseBbsService<SearchT, DataT> {
|
||||
/**
|
||||
* 데이터 한 건을 반환한다.
|
||||
*
|
||||
* @param dataVO
|
||||
* 조회할 VO (대부분 PK의 값으로 조회한다.)
|
||||
* @return 데이터 한 건
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
DataT select(DataT dataVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 페이징 처리없이 데이터 전체 목록을 반환한다.
|
||||
*
|
||||
* @param searchVO 검색정보 객체
|
||||
* @return 데이터 목록
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
List<DataT> selectListAll(SearchT searchVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 데이터 목록을 반환한다.
|
||||
*
|
||||
* @param searchVO
|
||||
* 검색, 페이지 정보 객체
|
||||
* @return 데이터 목록
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
List<DataT> selectList(SearchT searchVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 데이터 목록 개수를 반환한다.
|
||||
*
|
||||
* @param searchVO
|
||||
* 검색, 페이지 정보 객체
|
||||
* @return 데이터 목록 갯수
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
int selectListCnt(SearchT searchVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 데이터 총 개수를 반환한다.
|
||||
*
|
||||
* @param searchVO
|
||||
* 검색, 페이지 정보 객체
|
||||
* @return 데이터 총 개수
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
int selectTotalCnt(SearchT searchVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 데이터를 입력한다.
|
||||
*
|
||||
* @param dataVO
|
||||
* 입력할 VO
|
||||
* @param fileMap
|
||||
* 파일이 담긴 Map 객체
|
||||
* @return 맵 객체 { result: 1-성공 0-실패, idx: 등록된 게시물 idx }
|
||||
*
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
HashMap<String, Object> insert(DataT dataVO,
|
||||
Map<String, MultipartFile> fileMap) throws Exception;
|
||||
|
||||
/**
|
||||
* 데이터를 수정한다.
|
||||
*
|
||||
* @param dataVO
|
||||
* 수정할 VO
|
||||
* @param fileMap
|
||||
* 파일이 담긴 Map 객체
|
||||
* @param deleteFiles
|
||||
* 삭제할 파일리스트
|
||||
* @return 맵 객체 { result: 1-성공 0-실패, idx: 수정된 게시물 idx }
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
HashMap<String, Object> update(DataT dataVO,
|
||||
Map<String, MultipartFile> fileMap, String[] deleteFiles) throws Exception;
|
||||
|
||||
/**
|
||||
* 데이터를 삭제한다.
|
||||
*
|
||||
* @param dataVO
|
||||
* 삭제할 VO
|
||||
* @return 맵 객체 { result: 1-성공 0-실패, idx: 삭제된 게시물 idx }
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
HashMap<String, Object> delete(DataT dataVO) throws Exception;
|
||||
}
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
/**
|
||||
* BaseCommentService.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 26.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 26. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
package kcg.faics.cmmn.bbs;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* BaseCommentService.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 26.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 26. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
public interface BaseCommentService<T> {
|
||||
/**
|
||||
* 댓글 정보를 반환한다.
|
||||
*
|
||||
* @param commentVO
|
||||
* 제네릭 타입의 댓글 관련 VO
|
||||
* @return 제네릭 타입의 댓글 정보
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
T select(T commentVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 댓글 목록을 반환한다.
|
||||
*
|
||||
* @param commentVO
|
||||
* 제네릭 타입의 댓글 관련 VO
|
||||
* @return 제네릭 타입의 댓글 목록
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
List<T> selectList(T commentVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 댓글 정보를 입력한다.
|
||||
*
|
||||
* @param commentVO
|
||||
* 제네릭 타입의 댓글 관련 VO
|
||||
* @return map 형태의 결과. result : 1-성공, 0-실패, seq : 추가된 댓글 아이디
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
HashMap<String, Object> insert(T commentVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 댓글 정보를 삭제한다.
|
||||
*
|
||||
* @param commentVO
|
||||
* 제네릭 타입의 File 관련 VO
|
||||
* @return 1-성공, 0-실패
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
int delete(T commentVO) throws Exception;
|
||||
|
||||
/**
|
||||
* commentVO의 parentSeq인 모든 댓글을 삭제한다.
|
||||
*
|
||||
* @param commentVO
|
||||
* 제네릭 타입의 File 관련 VO
|
||||
* @return 1-성공, 0-실패
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
int deleteAll(T commentVO) throws Exception;
|
||||
}
|
||||
|
|
@ -0,0 +1,142 @@
|
|||
/**
|
||||
* BaseCommentVO.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 26.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 26. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
package kcg.faics.cmmn.bbs;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* BaseCommentVO.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 26.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 26. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
public class BaseCommentVO {
|
||||
|
||||
/**
|
||||
* 댓글 번호
|
||||
*/
|
||||
private int seq;
|
||||
/**
|
||||
* 댓글 등록자 이름
|
||||
*/
|
||||
private String userName;
|
||||
/**
|
||||
* 댓글 내용
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 댓글 등록 시간
|
||||
*/
|
||||
private Date regdate;
|
||||
/**
|
||||
* 댓글 등록자 IP
|
||||
*/
|
||||
private String ip;
|
||||
/**
|
||||
* 댓글 등록자 아이디
|
||||
*/
|
||||
private String userId;
|
||||
/**
|
||||
* 댓글이 달린 대상의 아이디
|
||||
*/
|
||||
private int parentSeq;
|
||||
|
||||
/**
|
||||
* @return 댓글 번호
|
||||
*/
|
||||
public int getSeq() {
|
||||
return seq;
|
||||
}
|
||||
/**
|
||||
* @param 댓글 번호
|
||||
*/
|
||||
public void setSeq(int seq) {
|
||||
this.seq = seq;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 댓글 등록자 이름
|
||||
*/
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
/**
|
||||
* @param 댓글 등록자 이름
|
||||
*/
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
/**
|
||||
* @return 댓글 내용
|
||||
*/
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
/**
|
||||
* @param 댓글 내용
|
||||
*/
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
/**
|
||||
* @return 댓글 등록 시간
|
||||
*/
|
||||
public Date getRegdate() {
|
||||
return regdate;
|
||||
}
|
||||
/**
|
||||
* @param 댓글 등록 시간
|
||||
*/
|
||||
public void setRegdate(Date regdate) {
|
||||
this.regdate = regdate;
|
||||
}
|
||||
/**
|
||||
* @return 댓글 등록자 IP
|
||||
*/
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
/**
|
||||
* @param 댓글 등록자 IP
|
||||
*/
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
/**
|
||||
* @return 댓글 등록자 아이디
|
||||
*/
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
/**
|
||||
* @param 댓글 등록자 아이디
|
||||
*/
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
/**
|
||||
* @return 댓글이 달린 대상의 아이디
|
||||
*/
|
||||
public int getParentSeq() {
|
||||
return parentSeq;
|
||||
}
|
||||
/**
|
||||
* @param 댓글이 달린 대상의 아이디
|
||||
*/
|
||||
public void setParentSeq(int parentSeq) {
|
||||
this.parentSeq = parentSeq;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
package kcg.faics.cmmn.bbs;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 게시판 공용 첨부파일 관련 서비스 Interface.
|
||||
*
|
||||
* @author kimnomin
|
||||
*
|
||||
* @param <T>
|
||||
* 제네릭 타입.
|
||||
*/
|
||||
public interface BaseFileService<T> {
|
||||
|
||||
/**
|
||||
* 파일 정보를 반환한다.
|
||||
*
|
||||
* @param fileVO
|
||||
* 제네릭 타입의 파일 관련 VO
|
||||
* @return 제네릭 타입의 파일 정보
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
T select(T fileVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 파일 목록을 반환한다.
|
||||
*
|
||||
* @param fileVO
|
||||
* 제네릭 타입의 파일 관련 VO
|
||||
* @return 제네릭 타입의 파일 목록
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
List<T> selectList(T fileVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 파일 정보를 입력한다.
|
||||
*
|
||||
* @param fileVO
|
||||
* 제네릭 타입의 File 관련 VO
|
||||
* @return 1-성공, 0-실패
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
int insert(T fileVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 파일 정보를 삭제한다.
|
||||
*
|
||||
* @param fileVO
|
||||
* 제네릭 타입의 File 관련 VO
|
||||
* @return 1-성공, 0-실패
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
int delete(T fileVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 파일을 폴더에 저장하고 파일 정보를 입력한다.
|
||||
*
|
||||
* @param fileVO
|
||||
* 제네릭 타입의 File 관련 VO
|
||||
* @param fileMap
|
||||
* 파일 객가 담긴 Map 객체
|
||||
* @return 1-성공, 0-실패
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
int insertAndSaveFiles(T fileVO, Map<String, MultipartFile> fileMap)
|
||||
throws Exception;
|
||||
|
||||
/**
|
||||
* 한 건의 파일을 폴더에서 제거하고 파일 정보를 삭제한다.
|
||||
*
|
||||
* @param fileVO
|
||||
* 제네릭 타입의 File 관련 VO
|
||||
* @return 1-성공, 0-실패
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
int deleteAndRemoveFile(T fileVO) throws Exception;
|
||||
|
||||
/**
|
||||
* fileVO의 parentSeq인 모든 파일을 폴더에서 제거하고 파일 정보를 삭제한다.
|
||||
*
|
||||
* @param fileVO
|
||||
* 제네릭 타입의 File 관련 VO
|
||||
* @return 1-성공, 0-실패
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
int deleteAndRemoveFiles(T fileVO) throws Exception;
|
||||
}
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
package kcg.faics.cmmn.bbs;
|
||||
|
||||
/**
|
||||
* 게시판형 공용 첨부파일 VO.
|
||||
*
|
||||
* 1. 모든 게시판형 첨부파일은 해당 VO를 상속받아 사용한다.
|
||||
* 2. 필드명이 다른 경우 Data처리 라이브러리(현재 MyBatis)의 Alias 기능을 활용하여 매칭시킨다.
|
||||
*
|
||||
* @author kimnomin
|
||||
*
|
||||
*/
|
||||
public class BaseFileVO {
|
||||
/**
|
||||
* 파일 번호.
|
||||
*/
|
||||
private int seq;
|
||||
/**
|
||||
* 파일 순서 번호.
|
||||
*/
|
||||
private int orders;
|
||||
/**
|
||||
* 파일 이름.
|
||||
*/
|
||||
private String orgName;
|
||||
/**
|
||||
* 파일 저장 이름.
|
||||
*/
|
||||
private String saveName;
|
||||
/**
|
||||
* 게시글 번호.
|
||||
*/
|
||||
private int parentSeq;
|
||||
|
||||
/**
|
||||
* 파일 번호를 반환한다.
|
||||
*
|
||||
* @return 파일 번호
|
||||
*/
|
||||
public final int getSeq() {
|
||||
return seq;
|
||||
}
|
||||
/**
|
||||
* 파일 번호를 설정한다.
|
||||
*
|
||||
* @param seq 파일 번호
|
||||
*/
|
||||
public final void setSeq(final int seq) {
|
||||
this.seq = seq;
|
||||
}
|
||||
/**
|
||||
* 파일 순서 번호를 반환한다.
|
||||
*
|
||||
* @return 파일 순서 번호
|
||||
*/
|
||||
public final int getOrders() {
|
||||
return orders;
|
||||
}
|
||||
/**
|
||||
* 파일 순서 번호를 설정한다.
|
||||
*
|
||||
* @param order 파일 순서 번호
|
||||
*/
|
||||
public final void setOrders(final int order) {
|
||||
this.orders = order;
|
||||
}
|
||||
/**
|
||||
* 파일 이름을 반환한다.
|
||||
*
|
||||
* @return 파일 이름
|
||||
*/
|
||||
public final String getOrgName() {
|
||||
return orgName;
|
||||
}
|
||||
/**
|
||||
* 파일 이름을 설정한다.
|
||||
*
|
||||
* @param orgName 파일 이름
|
||||
*/
|
||||
public final void setOrgName(final String orgName) {
|
||||
this.orgName = orgName;
|
||||
}
|
||||
/**
|
||||
* 파일 저장 이름을 반환한다.
|
||||
*
|
||||
* @return 파일 저장 이름
|
||||
*/
|
||||
public final String getSaveName() {
|
||||
return saveName;
|
||||
}
|
||||
/**
|
||||
* 파일 저장 이름을 설정한다.
|
||||
*
|
||||
* @param saveName 파일 저장 이름
|
||||
*/
|
||||
public final void setSaveName(final String saveName) {
|
||||
this.saveName = saveName;
|
||||
}
|
||||
/**
|
||||
* 게시글 번호를 반환한다.
|
||||
*
|
||||
* @return 게시글 번호
|
||||
*/
|
||||
public final int getParentSeq() {
|
||||
return parentSeq;
|
||||
}
|
||||
/**
|
||||
* 게시글 번호를 설정한다.
|
||||
*
|
||||
* @param parentSeq 게시글 번호
|
||||
*/
|
||||
public final void setParentSeq(final int parentSeq) {
|
||||
this.parentSeq = parentSeq;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,197 @@
|
|||
package kcg.faics.cmmn.bbs;
|
||||
|
||||
/**
|
||||
* 게시판형 기능에서 검색조건을 저장하는 부모 Value Object.
|
||||
*
|
||||
* 각 기능에서 검색조건을 지정할때는 해당 VO를 상속받아 사용하는 것을 원칙으로 한다.
|
||||
*
|
||||
* @author kimnomin
|
||||
*
|
||||
*/
|
||||
public class BaseSearchVO {
|
||||
/**
|
||||
* 현재 페이지.
|
||||
*/
|
||||
private int pageIndex = 1;
|
||||
|
||||
/**
|
||||
* 페이지 개수.
|
||||
*/
|
||||
private int pageUnit; // properties에서 설정
|
||||
|
||||
/**
|
||||
* 페이지 사이즈.
|
||||
*/
|
||||
private int pageSize; // properties에서 설정
|
||||
|
||||
/**
|
||||
* 시작 인덱스.
|
||||
*/
|
||||
private int firstIndex = 0;
|
||||
|
||||
/**
|
||||
* 끝 인덱스.
|
||||
*/
|
||||
private int lastIndex = 1;
|
||||
|
||||
/**
|
||||
* 페이지별 레코드 개수.
|
||||
*/
|
||||
private int recordCountPerPage = 10;
|
||||
|
||||
/**
|
||||
* 검색 키워드.
|
||||
*/
|
||||
private String searchKeyword = "";
|
||||
/**
|
||||
* 검색 조건.
|
||||
*/
|
||||
private String searchCondition = "";
|
||||
|
||||
/**
|
||||
* 현재 페이지를 반환한다.
|
||||
*
|
||||
* @return 현재 페이지
|
||||
*/
|
||||
public final int getPageIndex() {
|
||||
return pageIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* 현재 페이지를 설정한다.
|
||||
*
|
||||
* @param pageIndex
|
||||
* 현재 페이지
|
||||
*/
|
||||
public final void setPageIndex(final int pageIndex) {
|
||||
this.pageIndex = pageIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* 페이지 개수를 반환한다.
|
||||
*
|
||||
* @return 페이지 개수
|
||||
*/
|
||||
public final int getPageUnit() {
|
||||
return pageUnit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 페이지 개수를 설정한다.
|
||||
*
|
||||
* @param pageUnit
|
||||
* 페이지 개수
|
||||
*/
|
||||
public final void setPageUnit(final int pageUnit) {
|
||||
this.pageUnit = pageUnit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 페이지 사이즈를 반환한다.
|
||||
*
|
||||
* @return 페이지 사이즈
|
||||
*/
|
||||
public final int getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* 페이지 사이즈를 설정한다.
|
||||
*
|
||||
* @param pageSize
|
||||
* 페이지 사이즈
|
||||
*/
|
||||
public final void setPageSize(final int pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* 시작 인덱스를 반환한다.
|
||||
*
|
||||
* @return 시작 인덱스
|
||||
*/
|
||||
public final int getFirstIndex() {
|
||||
return firstIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* 시작 인덱스를 설정한다.
|
||||
*
|
||||
* @param firstIndex
|
||||
* 시작 인덱스
|
||||
*/
|
||||
public final void setFirstIndex(final int firstIndex) {
|
||||
this.firstIndex = firstIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* 끝 인덱스를 반환한다.
|
||||
*
|
||||
* @return 끝 인덱스
|
||||
*/
|
||||
public final int getLastIndex() {
|
||||
return lastIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* 끝 인덱스를 설정한다.
|
||||
*
|
||||
* @param lastIndex
|
||||
* 끝 인덱스
|
||||
*/
|
||||
public final void setLastIndex(final int lastIndex) {
|
||||
this.lastIndex = lastIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* 페이지별 레코드 수를 반환한다.
|
||||
*
|
||||
* @return 페이지별 레코드 수
|
||||
*/
|
||||
public final int getRecordCountPerPage() {
|
||||
return recordCountPerPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 페이지별 레코드 수를 설정한다.
|
||||
*
|
||||
* @param recordCountPerPage
|
||||
* 페이지별 레코드 수
|
||||
*/
|
||||
public final void setRecordCountPerPage(final int recordCountPerPage) {
|
||||
this.recordCountPerPage = recordCountPerPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검색 키워드를 반환한다.
|
||||
*
|
||||
* @return 검색 키워드
|
||||
*/
|
||||
public final String getSearchKeyword() {
|
||||
return searchKeyword;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검색 키워드를 설정한다.
|
||||
*
|
||||
* @param searchKeyword
|
||||
* 검색 키워드
|
||||
*/
|
||||
public final void setSearchKeyword(final String searchKeyword) {
|
||||
this.searchKeyword = searchKeyword;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 검색 조건을 반환한다.
|
||||
*/
|
||||
public String getSearchCondition() {
|
||||
return searchCondition;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param 검색 조건을 설정한다.
|
||||
*/
|
||||
public void setSearchCondition(String searchCondition) {
|
||||
this.searchCondition = searchCondition;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package kcg.faics.cmmn.bbs;
|
||||
|
||||
/**
|
||||
* 페이지 화면 구분.
|
||||
*
|
||||
* @author kimnomin
|
||||
*
|
||||
*/
|
||||
public enum PageType {
|
||||
/**
|
||||
* 목록화면.
|
||||
*/
|
||||
List,
|
||||
/**
|
||||
* 정보조회화면.
|
||||
*/
|
||||
View,
|
||||
/**
|
||||
* 입력화면.
|
||||
*/
|
||||
Add,
|
||||
/**
|
||||
* 수정화면.
|
||||
*/
|
||||
Upd,
|
||||
/**
|
||||
* 삭제화면.
|
||||
*/
|
||||
Del,
|
||||
/**
|
||||
* 통계현황화면.
|
||||
*/
|
||||
Stats
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* 게시판 관련 공용 패키지.
|
||||
*/
|
||||
/**
|
||||
* @author kimnomin
|
||||
*
|
||||
*/
|
||||
package kcg.faics.cmmn.bbs;
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
* CKEditor image upload module for Java.
|
||||
* Copyright guavatak (https://github.com/guavatak/ckeditor-upload-filter-java)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @author guavatak (https://github.com/guavatak/ckeditor-upload-filter-java)
|
||||
*/
|
||||
package kcg.faics.cmmn.ckeditor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.FilterConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Filter class
|
||||
* @author guavatak
|
||||
* @since 2014.12.04
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2014.12.04 표준프레임워크 최초 적용 (패키지 변경 및 소스 정리)
|
||||
* </pre>
|
||||
*/
|
||||
public class CkFilter implements Filter {
|
||||
private static final Log log = LogFactory.getLog(CkFilter.class);
|
||||
|
||||
private static final String IMAGE_BASE_DIR_KEY = "ck.image.dir";
|
||||
private static final String IMAGE_BASE_URL_KEY = "ck.image.url";
|
||||
private static final String IMAGE_ALLOW_TYPE_KEY = "ck.image.type.allow";
|
||||
private static final String IMAGE_SAVE_CLASS_KEY = "ck.image.save.class";
|
||||
|
||||
private CkImageSaver ckImageSaver;
|
||||
|
||||
public void init(FilterConfig filterConfig) throws ServletException {
|
||||
String properties = filterConfig.getInitParameter("properties");
|
||||
InputStream inStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(properties);
|
||||
Properties props = new Properties();
|
||||
try {
|
||||
props.load(inStream);
|
||||
} catch (IOException e) {
|
||||
log.error(e);
|
||||
}
|
||||
|
||||
String imageBaseDir = (String) props.get(IMAGE_BASE_DIR_KEY);
|
||||
String imageDomain = (String) props.get(IMAGE_BASE_URL_KEY);
|
||||
|
||||
String[] allowFileTypeArr = null;
|
||||
String allowFileType = (String) props.get(IMAGE_ALLOW_TYPE_KEY);
|
||||
if (StringUtils.isNotBlank(allowFileType)) {
|
||||
allowFileTypeArr = StringUtils.split(allowFileType, ",");
|
||||
}
|
||||
|
||||
String saveManagerClass = (String) props.get(IMAGE_SAVE_CLASS_KEY);
|
||||
|
||||
ckImageSaver = new CkImageSaver(imageBaseDir, imageDomain, allowFileTypeArr, saveManagerClass);
|
||||
|
||||
}
|
||||
|
||||
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
|
||||
HttpServletRequest request = (HttpServletRequest) req;
|
||||
HttpServletResponse response = (HttpServletResponse) res;
|
||||
|
||||
if (request.getContentType() == null || request.getContentType().indexOf("multipart") == -1) {
|
||||
// contentType 이 multipart 가 아니라면 스킵한다.
|
||||
chain.doFilter(request, response);
|
||||
} else {
|
||||
ckImageSaver.saveAndReturnUrlToClient(request, response);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
// no-op
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,158 @@
|
|||
/*
|
||||
* CKEditor image upload module for Java.
|
||||
* Copyright guavatak (https://github.com/guavatak/ckeditor-upload-filter-java)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @author guavatak (https://github.com/guavatak/ckeditor-upload-filter-java)
|
||||
*/
|
||||
package kcg.faics.cmmn.ckeditor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartRequest;
|
||||
|
||||
/**
|
||||
* Created by guava on 1/20/14.
|
||||
* 이미지 저장 처리 클래스
|
||||
* @author guavatak
|
||||
* @since 2014.12.04
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2014.12.04 표준프레임워크 최초 적용 (패키지 변경 및 소스 정리)
|
||||
* </pre>
|
||||
*/
|
||||
public class CkImageSaver {
|
||||
private static final Log log = LogFactory.getLog(CkFilter.class);
|
||||
|
||||
private static final String FUNC_NO = "CKEditorFuncNum";
|
||||
|
||||
private String imageBaseDir;
|
||||
private String imageDomain;
|
||||
private String[] allowFileTypeArr;
|
||||
|
||||
private FileSaveManager fileSaveManager;
|
||||
|
||||
public CkImageSaver(String imageBaseDir, String imageDomain, String[] allowFileTypeArr, String saveManagerClass) {
|
||||
this.imageBaseDir = imageBaseDir;
|
||||
if (imageBaseDir.endsWith("/")) {
|
||||
StringUtils.removeEnd(imageBaseDir, "/");
|
||||
}
|
||||
if (imageBaseDir.endsWith("\\")) {
|
||||
StringUtils.removeEnd(imageBaseDir, "\\");
|
||||
}
|
||||
|
||||
this.imageDomain = imageDomain;
|
||||
if (imageDomain.endsWith("/")) {
|
||||
StringUtils.removeEnd(imageDomain, "/");
|
||||
}
|
||||
|
||||
this.allowFileTypeArr = allowFileTypeArr;
|
||||
|
||||
if (StringUtils.isBlank(saveManagerClass)) {
|
||||
fileSaveManager = new DefaultFileSaveManager();
|
||||
} else {
|
||||
try {
|
||||
Class<?> klass = Class.forName(saveManagerClass);
|
||||
fileSaveManager = (FileSaveManager) klass.newInstance();
|
||||
} catch (ClassNotFoundException e) {
|
||||
log.error(e);
|
||||
throw new RuntimeException(e);
|
||||
} catch (InstantiationException e) {
|
||||
log.error(e);
|
||||
throw new RuntimeException(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
log.error(e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ckEditor로부터 넘어온 파일을 저장한다.
|
||||
* 원래 소스는 Request 내의 데이터를 FileItem으로 파싱하여 파일을 저장하였으나,
|
||||
* 파싱하지 못하는 버그가 발생하여 MultipartRequest로 변형하였다.
|
||||
*
|
||||
* @param request Request 객체
|
||||
* @param response Response 객체
|
||||
* @throws IOException IO 예외처리
|
||||
*/
|
||||
public void saveAndReturnUrlToClient(final HttpServletRequest request, final HttpServletResponse response) throws IOException {
|
||||
// Parse the request
|
||||
try {
|
||||
MultipartRequest req = (MultipartRequest) request;
|
||||
MultipartFile f = req.getFile("upload");
|
||||
|
||||
String errorMessage = null;
|
||||
String relUrl = null;
|
||||
|
||||
if (isAllowFileType(FilenameUtils.getName(f.getOriginalFilename()))) {
|
||||
relUrl = fileSaveManager.saveFile(f, imageBaseDir, imageDomain);
|
||||
|
||||
} else {
|
||||
errorMessage = "Restricted Image Format";
|
||||
}
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("<script type=\"text/javascript\">\n");
|
||||
sb.append("window.parent.CKEDITOR.tools.callFunction(").append(request.getParameter(FUNC_NO)).append(", '");
|
||||
sb.append(relUrl);
|
||||
if (errorMessage != null) {
|
||||
sb.append("', '").append(errorMessage);
|
||||
}
|
||||
sb.append("');\n </script>");
|
||||
|
||||
response.setContentType("text/html");
|
||||
response.setHeader("Cache-Control", "no-cache");
|
||||
PrintWriter out = response.getWriter();
|
||||
|
||||
out.print(sb.toString());
|
||||
out.flush();
|
||||
out.close();
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isAllowFileType(String fileName) {
|
||||
boolean isAllow = false;
|
||||
if (allowFileTypeArr != null && allowFileTypeArr.length > 0) {
|
||||
for (String allowFileType : allowFileTypeArr) {
|
||||
if (StringUtils.equalsIgnoreCase(allowFileType, StringUtils.substringAfterLast(fileName, "."))) {
|
||||
isAllow = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
isAllow = true;
|
||||
}
|
||||
|
||||
return isAllow;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* CKEditor image upload module for Java.
|
||||
* Copyright guavatak (https://github.com/guavatak/ckeditor-upload-filter-java)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @author guavatak (https://github.com/guavatak/ckeditor-upload-filter-java)
|
||||
*/
|
||||
package kcg.faics.cmmn.ckeditor;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.fileupload.FileItem;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* Created by guava on 1/20/14.
|
||||
* 이미지 저장 처리 클래스
|
||||
* @author guavatak
|
||||
* @since 2014.12.04
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2014.12.04 표준프레임워크 최초 적용 (패키지 변경 및 소스 정리)
|
||||
* </pre>
|
||||
*/
|
||||
public class DefaultFileSaveManager implements FileSaveManager {
|
||||
|
||||
@Override
|
||||
public String saveFile(FileItem fileItem, String imageBaseDir, String imageDomain) {
|
||||
String originalFileName = FilenameUtils.getName(fileItem.getName());
|
||||
String relUrl;
|
||||
// filename
|
||||
String subDir = File.separator + DirectoryPathManager.getDirectoryPathByDateType(DirectoryPathManager.DIR_DATE_TYPE.DATE_POLICY_YYYY_MM);
|
||||
String fileName = RandomStringUtils.randomAlphanumeric(20) + "." + StringUtils.lowerCase(StringUtils.substringAfterLast(originalFileName, "."));
|
||||
|
||||
File newFile = new File(imageBaseDir + subDir + fileName);
|
||||
File fileToSave = DirectoryPathManager.getUniqueFile(newFile.getAbsoluteFile());
|
||||
|
||||
try {
|
||||
FileUtils.writeByteArrayToFile(fileToSave, fileItem.get());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
String savedFileName = FilenameUtils.getName(fileToSave.getAbsolutePath());
|
||||
relUrl = StringUtils.replace(subDir, "\\", "/") + savedFileName;
|
||||
|
||||
return imageDomain + relUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String saveFile(final MultipartFile file, final String imageBaseDir, final String imageDomain) {
|
||||
String originalFileName = FilenameUtils.getName(file.getOriginalFilename());
|
||||
String relUrl;
|
||||
// filename
|
||||
String subDir = File.separator + DirectoryPathManager.getDirectoryPathByDateType(DirectoryPathManager.DIR_DATE_TYPE.DATE_POLICY_YYYY_MM);
|
||||
String fileName = RandomStringUtils.randomAlphanumeric(20) + "." + StringUtils.lowerCase(StringUtils.substringAfterLast(originalFileName, "."));
|
||||
|
||||
File newFile = new File(imageBaseDir + subDir + fileName);
|
||||
File fileToSave = DirectoryPathManager.getUniqueFile(newFile.getAbsoluteFile());
|
||||
|
||||
try {
|
||||
FileUtils.writeByteArrayToFile(fileToSave, file.getBytes());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
String savedFileName = FilenameUtils.getName(fileToSave.getAbsolutePath());
|
||||
relUrl = StringUtils.replace(subDir, "\\", "/") + savedFileName;
|
||||
|
||||
return imageDomain + relUrl;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
* CKEditor image upload module for Java.
|
||||
* Copyright guavatak (https://github.com/guavatak/ckeditor-upload-filter-java)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @author guavatak (https://github.com/guavatak/ckeditor-upload-filter-java)
|
||||
*/
|
||||
package kcg.faics.cmmn.ckeditor;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Calendar;
|
||||
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* 이미지 저장 처리 클래스
|
||||
* @author guavatak
|
||||
* @since 2014.12.04
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2014.12.04 표준프레임워크 최초 적용 (패키지 변경 및 소스 정리)
|
||||
* </pre>
|
||||
*/
|
||||
public class DirectoryPathManager {
|
||||
public enum DIR_DATE_TYPE {
|
||||
DATE_POLICY_YYYY_MM_DD, DATE_POLICY_YYYY_MM, DATE_POLICY_YYYY
|
||||
};
|
||||
|
||||
/**
|
||||
* 2012/12/22/
|
||||
* @param dateType
|
||||
* @return
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public static String getDirectoryPathByDateType(DIR_DATE_TYPE policy) {
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(calendar.get(Calendar.YEAR)).append(File.separator);
|
||||
if (policy.ordinal() <= DIR_DATE_TYPE.DATE_POLICY_YYYY_MM.ordinal()) {
|
||||
sb.append(StringUtils.leftPad(String.valueOf(calendar.get(Calendar.MONTH)), 2, '0')).append(File.separator);
|
||||
}
|
||||
if (policy.ordinal() <= DIR_DATE_TYPE.DATE_POLICY_YYYY_MM_DD.ordinal()) {
|
||||
sb.append(StringUtils.leftPad(String.valueOf(calendar.get(Calendar.DATE)), 2, '0')).append(File.separator);
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static File getUniqueFile(final File file) {
|
||||
if (!file.exists())
|
||||
return file;
|
||||
|
||||
File tmpFile = new File(file.getAbsolutePath());
|
||||
File parentDir = tmpFile.getParentFile();
|
||||
int count = 1;
|
||||
String extension = FilenameUtils.getExtension(tmpFile.getName());
|
||||
String baseName = FilenameUtils.getBaseName(tmpFile.getName());
|
||||
do {
|
||||
tmpFile = new File(parentDir, baseName + "_" + count++ + "_." + extension);
|
||||
} while (tmpFile.exists());
|
||||
return tmpFile;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* CKEditor image upload module for Java.
|
||||
* Copyright guavatak (https://github.com/guavatak/ckeditor-upload-filter-java)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @author guavatak (https://github.com/guavatak/ckeditor-upload-filter-java)
|
||||
*/
|
||||
package kcg.faics.cmmn.ckeditor;
|
||||
|
||||
import org.apache.commons.fileupload.FileItem;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* Created by guava on 1/20/14.
|
||||
* 이미지 저장 처리 클래스
|
||||
* @author guavatak
|
||||
* @since 2014.12.04
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2014.12.04 표준프레임워크 최초 적용 (패키지 변경 및 소스 정리)
|
||||
* </pre>
|
||||
*/
|
||||
public interface FileSaveManager {
|
||||
/**
|
||||
*
|
||||
* @param fileItem FileItem 객체
|
||||
* @param imageBaseDir 기본 이미지 저장 디렉토리. 이 디렉토리 아래로 모든 파일을 넣어도 되고, 폴더를 구분하여 넣어도 된다. 이 파라미터에는 마지막 디렉토리 구분자는 포함되지 않는다.
|
||||
* @param imageDomain 이미지 태그에 들어갈 기본이 되는 URL.
|
||||
* "http://image.my.com" 과 같은 도메인이 들어갈 수도 있고, "/ckimage" 같은 상대 경로가 들어갈 수도 있다.
|
||||
* 이 파라미터는 생략해도 된다.
|
||||
* @return 이미지 파일을 액세스 할 수 있는 URL 을 반환한다. 반환된 URL 은 ckeditor 에게 전달되어 즉시 사용자 브라우져에 이미지가 나타나게 된다.
|
||||
*/
|
||||
String saveFile(FileItem fileItem, String imageBaseDir, String imageDomain);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param file MultipartFile 객체
|
||||
* @param imageBaseDir 기본 이미지 저장 디렉토리. 이 디렉토리 아래로 모든 파일을 넣어도 되고, 폴더를 구분하여 넣어도 된다. 이 파라미터에는 마지막 디렉토리 구분자는 포함되지 않는다.
|
||||
* @param imageDomain 이미지 태그에 들어갈 기본이 되는 URL.
|
||||
* "http://image.my.com" 과 같은 도메인이 들어갈 수도 있고, "/ckimage" 같은 상대 경로가 들어갈 수도 있다.
|
||||
* 이 파라미터는 생략해도 된다.
|
||||
* @return 이미지 파일을 액세스 할 수 있는 URL 을 반환한다. 반환된 URL 은 ckeditor 에게 전달되어 즉시 사용자 브라우져에 이미지가 나타나게 된다.
|
||||
*/
|
||||
String saveFile(MultipartFile file, String imageBaseDir, String imageDomain);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
package kcg.faics.cmmn.egov;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,220 @@
|
|||
package kcg.faics.cmmn.egov;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import kcg.faics.cmmn.egov.util.EgovWebUtil;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Class Name : EgovProperties.java
|
||||
* Description : properties값들을 파일로부터 읽어와 Globals클래스의 정적변수로 로드시켜주는 클래스로
|
||||
* 문자열 정보 기준으로 사용할 전역변수를 시스템 재시작으로 반영할 수 있도록 한다.
|
||||
* Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2009.01.19 박지욱 최초 생성
|
||||
* 2011.07.20 서준식 Globals파일의 상대경로를 읽은 메서드 추가
|
||||
* 2014.10.13 이기하 Globals.properties 값이 null일 경우 오류처리
|
||||
* 2016.09.22 임새미 폴더 path값 변경
|
||||
* @author 공통 서비스 개발팀 박지욱
|
||||
* @since 2009. 01. 19
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
|
||||
public class EgovProperties {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(EgovProperties.class);
|
||||
|
||||
//파일구분자
|
||||
final static String FILE_SEPARATOR = System.getProperty("file.separator");
|
||||
|
||||
//프로퍼티 파일의 물리적 위치
|
||||
//public static final String GLOBALS_PROPERTIES_FILE = System.getProperty("user.home") + FILE_SEPARATOR + "egovProps" +FILE_SEPARATOR + "globals.properties";
|
||||
|
||||
//public static final String RELATIVE_PATH_PREFIX = EgovProperties.class.getResource("").getPath() + FILE_SEPARATOR+ ".." + FILE_SEPARATOR + ".." + FILE_SEPARATOR;
|
||||
|
||||
public static final String RELATIVE_PATH_PREFIX = EgovProperties.class.getResource("").getPath().substring(0, EgovProperties.class.getResource("").getPath().lastIndexOf("kcg"));
|
||||
|
||||
public static final String GLOBALS_PROPERTIES_FILE = RELATIVE_PATH_PREFIX + "property" + FILE_SEPARATOR + "globals.properties";
|
||||
|
||||
/**
|
||||
* 인자로 주어진 문자열을 Key값으로 하는 상대경로 프로퍼티 값을 절대경로로 반환한다(Globals.java 전용)
|
||||
* @param keyName String
|
||||
* @return String
|
||||
*/
|
||||
public static String getPathProperty(String keyName) {
|
||||
String value = "";
|
||||
|
||||
LOGGER.debug("getPathProperty : {} = {}", GLOBALS_PROPERTIES_FILE, keyName);
|
||||
|
||||
FileInputStream fis = null;
|
||||
try {
|
||||
Properties props = new Properties();
|
||||
|
||||
fis = new FileInputStream(EgovWebUtil.filePathBlackList(GLOBALS_PROPERTIES_FILE));
|
||||
props.load(new BufferedInputStream(fis));
|
||||
|
||||
value = props.getProperty(keyName).trim();
|
||||
value = RELATIVE_PATH_PREFIX + "property" + System.getProperty("file.separator") + value;
|
||||
} catch (FileNotFoundException fne) {
|
||||
LOGGER.debug("Property file not found.", fne);
|
||||
throw new RuntimeException("Property file not found", fne);
|
||||
} catch (IOException ioe) {
|
||||
LOGGER.debug("Property file IO exception", ioe);
|
||||
throw new RuntimeException("Property file IO exception", ioe);
|
||||
} finally {
|
||||
EgovResourceCloseHelper.close(fis);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 인자로 주어진 문자열을 Key값으로 하는 프로퍼티 값을 반환한다(Globals.java 전용)
|
||||
* @param keyName String
|
||||
* @return String
|
||||
*/
|
||||
public static String getProperty(String keyName) {
|
||||
String value = "";
|
||||
|
||||
LOGGER.debug("getProperty : {} = {}", GLOBALS_PROPERTIES_FILE, keyName);
|
||||
|
||||
FileInputStream fis = null;
|
||||
try {
|
||||
Properties props = new Properties();
|
||||
|
||||
fis = new FileInputStream(EgovWebUtil.filePathBlackList(GLOBALS_PROPERTIES_FILE));
|
||||
|
||||
props.load(new BufferedInputStream(fis));
|
||||
if (props.getProperty(keyName) == null) {
|
||||
return "";
|
||||
}
|
||||
value = props.getProperty(keyName).trim();
|
||||
} catch (FileNotFoundException fne) {
|
||||
LOGGER.debug("Property file not found.", fne);
|
||||
throw new RuntimeException("Property file not found", fne);
|
||||
} catch (IOException ioe) {
|
||||
LOGGER.debug("Property file IO exception", ioe);
|
||||
throw new RuntimeException("Property file IO exception", ioe);
|
||||
} finally {
|
||||
EgovResourceCloseHelper.close(fis);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 주어진 파일에서 인자로 주어진 문자열을 Key값으로 하는 프로퍼티 상대 경로값을 절대 경로값으로 반환한다
|
||||
* @param fileName String
|
||||
* @param key String
|
||||
* @return String
|
||||
*/
|
||||
public static String getPathProperty(String fileName, String key) {
|
||||
FileInputStream fis = null;
|
||||
try {
|
||||
Properties props = new Properties();
|
||||
|
||||
fis = new FileInputStream(EgovWebUtil.filePathBlackList(fileName));
|
||||
props.load(new BufferedInputStream(fis));
|
||||
fis.close();
|
||||
|
||||
String value = props.getProperty(key);
|
||||
value = RELATIVE_PATH_PREFIX + "property" + System.getProperty("file.separator") + value;
|
||||
|
||||
return value;
|
||||
} catch (FileNotFoundException fne) {
|
||||
LOGGER.debug("Property file not found.", fne);
|
||||
throw new RuntimeException("Property file not found", fne);
|
||||
} catch (IOException ioe) {
|
||||
LOGGER.debug("Property file IO exception", ioe);
|
||||
throw new RuntimeException("Property file IO exception", ioe);
|
||||
} finally {
|
||||
EgovResourceCloseHelper.close(fis);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 주어진 파일에서 인자로 주어진 문자열을 Key값으로 하는 프로퍼티 값을 반환한다
|
||||
* @param fileName String
|
||||
* @param key String
|
||||
* @return String
|
||||
*/
|
||||
public static String getProperty(String fileName, String key) {
|
||||
FileInputStream fis = null;
|
||||
try {
|
||||
Properties props = new Properties();
|
||||
|
||||
fis = new FileInputStream(EgovWebUtil.filePathBlackList(fileName));
|
||||
props.load(new BufferedInputStream(fis));
|
||||
fis.close();
|
||||
|
||||
String value = props.getProperty(key);
|
||||
|
||||
return value;
|
||||
} catch (FileNotFoundException fne) {
|
||||
LOGGER.debug("Property file not found.", fne);
|
||||
throw new RuntimeException("Property file not found", fne);
|
||||
} catch (IOException ioe) {
|
||||
LOGGER.debug("Property file IO exception", ioe);
|
||||
throw new RuntimeException("Property file IO exception", ioe);
|
||||
} finally {
|
||||
EgovResourceCloseHelper.close(fis);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 주어진 프로파일의 내용을 파싱하여 (key-value) 형태의 구조체 배열을 반환한다.
|
||||
* @param property String
|
||||
* @return ArrayList
|
||||
*/
|
||||
public static ArrayList<Map<String, String>> loadPropertyFile(String property) {
|
||||
|
||||
// key - value 형태로 된 배열 결과
|
||||
ArrayList<Map<String, String>> keyList = new ArrayList<Map<String, String>>();
|
||||
|
||||
String src = property.replace('\\', File.separatorChar).replace('/', File.separatorChar);
|
||||
FileInputStream fis = null;
|
||||
try {
|
||||
|
||||
File srcFile = new File(EgovWebUtil.filePathBlackList(src));
|
||||
if (srcFile.exists()) {
|
||||
|
||||
Properties props = new Properties();
|
||||
fis = new FileInputStream(src);
|
||||
props.load(new BufferedInputStream(fis));
|
||||
fis.close();
|
||||
|
||||
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 (IOException ex) {
|
||||
LOGGER.debug("IO Exception", ex);
|
||||
throw new RuntimeException(ex);
|
||||
} finally {
|
||||
EgovResourceCloseHelper.close(fis);
|
||||
}
|
||||
|
||||
return keyList;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
package kcg.faics.cmmn.egov;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
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 (Exception ignore) {
|
||||
EgovBasicLogger.ignore("Occurred Exception to close resource is ingored!!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* JDBC 관련 resource 객체 close 처리
|
||||
* @param objects
|
||||
*/
|
||||
public static void closeDBObjects(Wrapper ... objects) {
|
||||
for (Object object : objects) {
|
||||
if (object != null) {
|
||||
if (object instanceof ResultSet) {
|
||||
try {
|
||||
((ResultSet)object).close();
|
||||
} catch (Exception ignore) {
|
||||
EgovBasicLogger.ignore("Occurred Exception to close resource is ingored!!");
|
||||
}
|
||||
} else if (object instanceof Statement) {
|
||||
try {
|
||||
((Statement)object).close();
|
||||
} catch (Exception ignore) {
|
||||
EgovBasicLogger.ignore("Occurred Exception to close resource is ingored!!");
|
||||
}
|
||||
} else if (object instanceof Connection) {
|
||||
try {
|
||||
((Connection)object).close();
|
||||
} catch (Exception ignore) {
|
||||
EgovBasicLogger.ignore("Occurred Exception to close resource is ingored!!");
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException("Wrapper type is not found : " + object.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Socket 관련 resource 객체 close 처리
|
||||
* @param objects
|
||||
*/
|
||||
public static void closeSocketObjects(Socket socket, ServerSocket server) {
|
||||
if (socket != null) {
|
||||
try {
|
||||
socket.shutdownOutput();
|
||||
} catch (Exception ignore) {
|
||||
EgovBasicLogger.ignore("Occurred Exception to shutdown ouput is ignored!!");
|
||||
}
|
||||
|
||||
try {
|
||||
socket.close();
|
||||
} catch (Exception ignore) {
|
||||
EgovBasicLogger.ignore("Occurred Exception to close resource is ignored!!");
|
||||
}
|
||||
}
|
||||
|
||||
if (server != null) {
|
||||
try {
|
||||
server.close();
|
||||
} catch (Exception ignore) {
|
||||
EgovBasicLogger.ignore("Occurred Exception to close resource is ignored!!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Socket 관련 resource 객체 close 처리
|
||||
*
|
||||
* @param sockets
|
||||
*/
|
||||
public static void closeSockets(Socket ... sockets) {
|
||||
for (Socket socket : sockets) {
|
||||
if (socket != null) {
|
||||
try {
|
||||
socket.shutdownOutput();
|
||||
} catch (Exception ignore) {
|
||||
EgovBasicLogger.ignore("Occurred Exception to shutdown ouput is ignored!!");
|
||||
}
|
||||
|
||||
try {
|
||||
socket.close();
|
||||
} catch (Exception ignore) {
|
||||
EgovBasicLogger.ignore("Occurred Exception to close resource is ignored!!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,727 @@
|
|||
package kcg.faics.cmmn.egov.file;
|
||||
|
||||
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 kcg.faics.cmmn.egov.util.EgovStringUtil;
|
||||
import kcg.faics.cmmn.egov.util.EgovWebUtil;
|
||||
import kcg.faics.cmmn.egov.vo.FileVO;
|
||||
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import egovframework.rte.fdl.property.EgovPropertyService;
|
||||
|
||||
/**
|
||||
* @Class Name : EgovFileMngUtil.java
|
||||
* @Description : 메시지 처리 관련 유틸리티
|
||||
* @Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용 ------- -------- ---------------------------
|
||||
* 2009.02.13 이삼섭 최초 생성 2011.08.31 JJY 경량환경 템플릿 커스터마이징버전 생성
|
||||
* 2016.09.22 임새미 라인 83~85, 126~136
|
||||
* 2016.10.21 하영지 동적으로 폴더를 생성하는 경우가 있어서 폴더명 파라미터 추가parseFileInf Override, deleteFile Override
|
||||
*
|
||||
* @author 공통 서비스 개발팀 이삼섭
|
||||
* @since 2009. 02. 13
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
@Component("EgovFileMngUtil")
|
||||
public class EgovFileMngUtil {
|
||||
|
||||
public static final int BUFF_SIZE = 2048;
|
||||
|
||||
@Resource(name = "propertiesService")
|
||||
protected EgovPropertyService propertyService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(EgovFileMngUtil.class);
|
||||
|
||||
/**
|
||||
* 파일이 존재하면 규칙에 의해 파일명을 수정한다.
|
||||
*
|
||||
* <pre>
|
||||
* 규칙 : {파일명}_{숫자}.{확장자}
|
||||
* </pre>
|
||||
*
|
||||
* @param filePath 파일경로
|
||||
* @param fileNameExt (확장자를 포함한) 파일명
|
||||
* @return 파일명
|
||||
*/
|
||||
public String makeNewFileName(final String filePath, final String fileNameExt) {
|
||||
int idx = 0;
|
||||
String fileExt = "";
|
||||
String fileName = "";
|
||||
String newFileName = "";
|
||||
String filePathName = filePath + fileNameExt;
|
||||
String newFileNameExt = fileNameExt;
|
||||
|
||||
if (!StringUtils.isBlank(filePathName)) {
|
||||
fileExt = FilenameUtils.getExtension(fileNameExt);
|
||||
fileName = FilenameUtils.getName(fileNameExt);
|
||||
fileName = FilenameUtils.removeExtension(fileName);
|
||||
newFileName = fileName;
|
||||
while (true) {
|
||||
File f = new File(filePathName);
|
||||
if (f.isFile()) {
|
||||
newFileName = String.format("%s_%d", fileName, ++idx);
|
||||
filePathName = String.format("%s%s.%s", filePath, newFileName, fileExt);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
newFileNameExt = newFileName;
|
||||
if (!StringUtils.isBlank(fileExt)) {
|
||||
newFileNameExt += "." + fileExt;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return newFileNameExt;
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일을 저장하고 저장된 파일정보 목록을 취득한다.
|
||||
*
|
||||
* @param files
|
||||
* 파일객체
|
||||
* @param keyStr
|
||||
* 구분 값
|
||||
* @param fileKeyParam
|
||||
* 파일순번
|
||||
* @param atchFileId
|
||||
* 파일ID
|
||||
* @param storePath
|
||||
* 저장경로
|
||||
* @return 저장된 파일정보 List
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
public List<FileVO> parseFileInf(final Map<String, MultipartFile> files,
|
||||
final String keyStr, final int fileKeyParam,
|
||||
final String atchFileId, final String storePath) throws Exception {
|
||||
int fileKey = fileKeyParam;
|
||||
|
||||
String storePathString = "";
|
||||
String atchFileIdString = "";
|
||||
|
||||
if (StringUtils.isBlank(storePath)) {
|
||||
storePathString = propertyService.getString("Globals.fileStorePath");
|
||||
} else {
|
||||
storePathString = propertyService.getString(storePath);
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(atchFileId)) {
|
||||
// atchFileIdString = idgenService.getNextStringId();
|
||||
atchFileIdString = atchFileId;
|
||||
} else {
|
||||
atchFileIdString = atchFileId;
|
||||
}
|
||||
|
||||
File saveFolder = new File(storePathString);
|
||||
|
||||
if (!saveFolder.exists() || saveFolder.isFile()) {
|
||||
saveFolder.mkdirs();
|
||||
}
|
||||
|
||||
List<FileVO> result = new ArrayList<FileVO>();
|
||||
if (files != null) {
|
||||
Iterator<Entry<String, MultipartFile>> itr = files.entrySet().iterator();
|
||||
MultipartFile file;
|
||||
String filePath = "";
|
||||
FileVO fvo;
|
||||
while (itr.hasNext()) {
|
||||
Entry<String, MultipartFile> entry = itr.next();
|
||||
|
||||
file = entry.getValue();
|
||||
String orginFileName = file.getOriginalFilename();
|
||||
|
||||
// --------------------------------------
|
||||
// 원 파일명이 없는 경우 처리
|
||||
// (첨부가 되지 않은 input file type)
|
||||
// --------------------------------------
|
||||
if ("".equals(orginFileName)) {
|
||||
continue;
|
||||
}
|
||||
// //------------------------------------
|
||||
|
||||
int index = orginFileName.lastIndexOf(".");
|
||||
// String fileName = orginFileName.substring(0, index);
|
||||
String fileExt = orginFileName.substring(index + 1);
|
||||
String newName = orginFileName;
|
||||
// KeyStr이 없으면 원래 파일명을 사용한다. by KNM
|
||||
if (!StringUtils.isBlank(keyStr)) {
|
||||
newName = keyStr + EgovStringUtil.getTimeStamp() + fileKey;
|
||||
}
|
||||
|
||||
long fileSize = file.getSize();
|
||||
// 같은 경로에 파일이 존재하면 파일 명을 수정한다.
|
||||
String tempFileName = makeNewFileName(storePathString, newName);
|
||||
if (!newName.equalsIgnoreCase(tempFileName)) {
|
||||
newName = tempFileName;
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(orginFileName)) {
|
||||
filePath = storePathString + File.separator + newName;
|
||||
file.transferTo(new File(filePath));
|
||||
}
|
||||
|
||||
fvo = new FileVO();
|
||||
fvo.setFileExtsn(fileExt);
|
||||
fvo.setFileStreCours(storePathString);
|
||||
fvo.setFileMg(Long.toString(fileSize));
|
||||
fvo.setOrignlFileNm(orginFileName);
|
||||
fvo.setStreFileNm(newName);
|
||||
fvo.setAtchFileId(atchFileIdString);
|
||||
fvo.setFileSn(entry.getKey());
|
||||
// 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 = (stordFilePath == null ? "" : stordFilePath).replaceAll("..", "");
|
||||
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) {
|
||||
LOGGER.debug("fnfe: {}", fnfe);
|
||||
} catch (IOException ioe) {
|
||||
LOGGER.debug("ioe: {}", ioe);
|
||||
} catch (Exception e) {
|
||||
LOGGER.debug("e: {}", e);
|
||||
} finally {
|
||||
if (bos != null) {
|
||||
try {
|
||||
bos.close();
|
||||
} catch (Exception ignore) {
|
||||
LOGGER.debug("IGNORED: {}", ignore.getMessage());
|
||||
}
|
||||
}
|
||||
if (stream != null) {
|
||||
try {
|
||||
stream.close();
|
||||
} catch (Exception ignore) {
|
||||
LOGGER.debug("IGNORED: {}", ignore.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 서버의 파일을 다운로드한다.
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void downFile(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
|
||||
String downFileName = EgovStringUtil.isNullToString(request.getAttribute("downFile")).replaceAll("..", "");
|
||||
String orgFileName = EgovStringUtil.isNullToString(request.getAttribute("orgFileName")).replaceAll("..", "");
|
||||
|
||||
/*
|
||||
* 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 (Exception ignore) {
|
||||
LOGGER.debug("IGNORED: {}", ignore.getMessage());
|
||||
}
|
||||
}
|
||||
if (fin != null) {
|
||||
try {
|
||||
fin.close();
|
||||
} catch (Exception ignore) {
|
||||
LOGGER.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(newName);
|
||||
stordFilePath = EgovWebUtil.filePathBlackList(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) {
|
||||
LOGGER.debug("fnfe: {}", fnfe);
|
||||
} catch (IOException ioe) {
|
||||
LOGGER.debug("ioe: {}", ioe);
|
||||
} catch (Exception e) {
|
||||
LOGGER.debug("e: {}", e);
|
||||
} finally {
|
||||
if (bos != null) {
|
||||
try {
|
||||
bos.close();
|
||||
} catch (Exception ignore) {
|
||||
LOGGER.debug("IGNORED: {}", ignore.getMessage());
|
||||
}
|
||||
}
|
||||
if (stream != null) {
|
||||
try {
|
||||
stream.close();
|
||||
} catch (Exception ignore) {
|
||||
LOGGER.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 = EgovStringUtil.isNullToString(streFileNm).replaceAll("..", "");
|
||||
String orgFileName = EgovStringUtil.isNullToString(orignFileNm).replaceAll("..", "");
|
||||
|
||||
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 (Exception ignore) {
|
||||
LOGGER.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>© 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(); //
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* 곹오컴포넌트 EgovFileTool 일부 발췌&변경
|
||||
*
|
||||
* <pre>
|
||||
* Comment : 파일을 삭제한다.
|
||||
* </pre>
|
||||
*
|
||||
* @param savedFile 삭제할 파일명
|
||||
* @param storePath 파일위치
|
||||
* @return 성공하면 삭제된 파일의 절대경로, 아니면블랭크
|
||||
*/
|
||||
public String deleteFile(final String savedFile, final String storePath) {
|
||||
if (StringUtils.isBlank(savedFile)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
String storePathString = "";
|
||||
if (StringUtils.isBlank(storePath)) {
|
||||
storePathString = propertyService.getString("Globals.fileStorePath");
|
||||
} else {
|
||||
storePathString = propertyService.getString(storePath);
|
||||
}
|
||||
String fileDeletePath = storePathString + File.separator + savedFile;
|
||||
// 인자값 유효하지 않은 경우 블랭크 리턴
|
||||
if (fileDeletePath == null || fileDeletePath.equals("")) {
|
||||
return "";
|
||||
}
|
||||
String result = "";
|
||||
File file = new File(EgovWebUtil.filePathBlackList(fileDeletePath));
|
||||
if (file.isFile()) {
|
||||
result = deletePath(file);
|
||||
} else {
|
||||
result = "";
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private String deletePath(File file) {
|
||||
String result = "";
|
||||
if (file.exists()) {
|
||||
result = file.getAbsolutePath();
|
||||
if (!file.delete()) {
|
||||
result = "";
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일을 저장하고 저장된 파일정보 목록을 취득한다.
|
||||
*
|
||||
* @param files
|
||||
* 파일객체
|
||||
* @param keyStr
|
||||
* 구분 값
|
||||
* @param fileKeyParam
|
||||
* 파일순번
|
||||
* @param atchFileId
|
||||
* 파일ID
|
||||
* @param storePath
|
||||
* 저장경로
|
||||
* @param folderNm
|
||||
* 폴더명
|
||||
* @return 저장된 파일정보 List
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
public List<FileVO> parseFileInf(final Map<String, MultipartFile> files,
|
||||
final String keyStr, final int fileKeyParam,
|
||||
final String atchFileId, final String storePath, final String folderNm) throws Exception {
|
||||
int fileKey = fileKeyParam;
|
||||
|
||||
String storePathString = "";
|
||||
String atchFileIdString = "";
|
||||
|
||||
if (StringUtils.isBlank(storePath)) {
|
||||
storePathString = propertyService.getString(storePath, "Globals.fileStorePath");
|
||||
} else {
|
||||
storePathString = propertyService.getString(storePath);
|
||||
}
|
||||
storePathString = storePathString + folderNm + File.separator;
|
||||
|
||||
if (StringUtils.isBlank(atchFileId)) {
|
||||
atchFileIdString = atchFileId;
|
||||
} else {
|
||||
atchFileIdString = atchFileId;
|
||||
}
|
||||
|
||||
File saveFolder = new File(storePathString);
|
||||
|
||||
if (!saveFolder.exists() || saveFolder.isFile()) {
|
||||
saveFolder.mkdirs();
|
||||
}
|
||||
|
||||
List<FileVO> result = new ArrayList<FileVO>();
|
||||
if (files != null) {
|
||||
Iterator<Entry<String, MultipartFile>> itr = files.entrySet().iterator();
|
||||
MultipartFile file;
|
||||
String filePath = "";
|
||||
FileVO fvo;
|
||||
while (itr.hasNext()) {
|
||||
Entry<String, MultipartFile> entry = itr.next();
|
||||
|
||||
file = entry.getValue();
|
||||
String orginFileName = file.getOriginalFilename();
|
||||
|
||||
// --------------------------------------
|
||||
// 원 파일명이 없는 경우 처리
|
||||
// (첨부가 되지 않은 input file type)
|
||||
// --------------------------------------
|
||||
if ("".equals(orginFileName)) {
|
||||
continue;
|
||||
}
|
||||
// //------------------------------------
|
||||
|
||||
int index = orginFileName.lastIndexOf(".");
|
||||
String fileExt = orginFileName.substring(index + 1);
|
||||
String newName = orginFileName;
|
||||
// KeyStr이 없으면 원래 파일명을 사용한다. by KNM
|
||||
if (!StringUtils.isBlank(keyStr)) {
|
||||
newName = keyStr + EgovStringUtil.getTimeStamp() + fileKey;
|
||||
}
|
||||
|
||||
long fileSize = file.getSize();
|
||||
// 같은 경로에 파일이 존재하면 파일 명을 수정한다.
|
||||
String tempFileName = makeNewFileName(storePathString, newName);
|
||||
if (!newName.equalsIgnoreCase(tempFileName)) {
|
||||
newName = tempFileName;
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(orginFileName)) {
|
||||
filePath = storePathString + File.separator + newName;
|
||||
file.transferTo(new File(filePath));
|
||||
}
|
||||
|
||||
fvo = new FileVO();
|
||||
fvo.setFileExtsn(fileExt);
|
||||
fvo.setFileStreCours(storePathString);
|
||||
fvo.setFileMg(Long.toString(fileSize));
|
||||
fvo.setOrignlFileNm(orginFileName);
|
||||
fvo.setStreFileNm(newName);
|
||||
fvo.setAtchFileId(atchFileIdString);
|
||||
fvo.setFileSn(entry.getKey());
|
||||
|
||||
writeFile(file, newName, storePathString);
|
||||
result.add(fvo);
|
||||
|
||||
fileKey++;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 공통컴포넌트 EgovFileTool 일부 발췌&변경
|
||||
*
|
||||
* <pre>
|
||||
* Comment : 파일을 삭제한다.
|
||||
* </pre>
|
||||
*
|
||||
* @param savedFile 삭제할 파일명
|
||||
* @param storePath 루트 디렉토리
|
||||
* @param folderNm 폴더명
|
||||
* @return 성공하면 삭제된 파일의 절대경로, 아니면블랭크
|
||||
*/
|
||||
public String deleteFile(final String savedFile, final String storePath, final String folderNm) {
|
||||
if (StringUtils.isBlank(savedFile)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
String storePathString = "";
|
||||
if (StringUtils.isBlank(storePath)) {
|
||||
storePathString = propertyService.getString("Globals.fileStorePath");
|
||||
} else {
|
||||
storePathString = propertyService.getString(storePath);
|
||||
}
|
||||
|
||||
String fileDeletePath = storePathString + File.separator + folderNm + File.separator + savedFile;
|
||||
// 인자값 유효하지 않은 경우 블랭크 리턴
|
||||
if (fileDeletePath == null || fileDeletePath.equals("")) {
|
||||
return "";
|
||||
}
|
||||
String result = "";
|
||||
File file = new File(EgovWebUtil.filePathBlackList(fileDeletePath));
|
||||
if (file.isFile()) {
|
||||
result = deletePath(file);
|
||||
} else {
|
||||
result = "";
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
package kcg.faics.cmmn.egov.file;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import kcg.faics.cmmn.egov.file.EgovFormBasedFileUtil;
|
||||
import kcg.faics.cmmn.egov.file.EgovFormBasedFileVo;
|
||||
import kcg.faics.cmmn.egov.util.EgovWebUtil;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
/**
|
||||
* @Class Name : EgovFileUploadUtil.java
|
||||
* @Description : Spring 기반 File Upload 유틸리티
|
||||
* @Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2009.08.26 한성곤 최초 생성
|
||||
*
|
||||
* @author 공통컴포넌트 개발팀 한성곤
|
||||
* @since 2009.08.26
|
||||
* @version 1.0
|
||||
* @see
|
||||
*/
|
||||
public class EgovFileUploadUtil extends EgovFormBasedFileUtil {
|
||||
/**
|
||||
* 파일을 Upload 처리한다.
|
||||
*
|
||||
* @param request
|
||||
* @param where
|
||||
* @param maxFileSize
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static List<EgovFormBasedFileVo> uploadFiles(HttpServletRequest request, String where, long maxFileSize) throws Exception {
|
||||
List<EgovFormBasedFileVo> list = new ArrayList<EgovFormBasedFileVo>();
|
||||
|
||||
MultipartHttpServletRequest mptRequest = (MultipartHttpServletRequest) request;
|
||||
Iterator<?> fileIter = mptRequest.getFileNames();
|
||||
|
||||
while (fileIter.hasNext()) {
|
||||
MultipartFile mFile = mptRequest.getFile((String) fileIter.next());
|
||||
|
||||
EgovFormBasedFileVo vo = new EgovFormBasedFileVo();
|
||||
|
||||
String tmp = mFile.getOriginalFilename();
|
||||
|
||||
if (tmp.lastIndexOf("\\") >= 0) {
|
||||
tmp = tmp.substring(tmp.lastIndexOf("\\") + 1);
|
||||
}
|
||||
|
||||
vo.setFileName(tmp);
|
||||
vo.setContentType(mFile.getContentType());
|
||||
vo.setServerSubPath(getTodayString());
|
||||
vo.setPhysicalName(getPhysicalFileName());
|
||||
vo.setSize(mFile.getSize());
|
||||
|
||||
if (tmp.lastIndexOf(".") >= 0) {
|
||||
vo.setPhysicalName(vo.getPhysicalName()); // 2012.11 KISA 보안조치
|
||||
}
|
||||
|
||||
if (mFile.getSize() > 0) {
|
||||
InputStream is = null;
|
||||
|
||||
try {
|
||||
is = mFile.getInputStream();
|
||||
saveFile(is, new File(EgovWebUtil.filePathBlackList(where + SEPERATOR + vo.getServerSubPath() + SEPERATOR + vo.getPhysicalName())));
|
||||
} finally {
|
||||
if (is != null) {
|
||||
is.close();
|
||||
}
|
||||
}
|
||||
list.add(vo);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,283 @@
|
|||
package kcg.faics.cmmn.egov.file;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import kcg.faics.cmmn.egov.EgovResourceCloseHelper;
|
||||
import kcg.faics.cmmn.egov.util.EgovWebUtil;
|
||||
|
||||
import org.apache.commons.fileupload.FileItemIterator;
|
||||
import org.apache.commons.fileupload.FileItemStream;
|
||||
import org.apache.commons.fileupload.servlet.ServletFileUpload;
|
||||
import org.apache.commons.fileupload.util.Streams;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @Class Name : EgovFormBasedFileUtil.java
|
||||
* @Description : Form-based File Upload 유틸리티
|
||||
* @Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2009.08.26 한성곤 최초 생성
|
||||
*
|
||||
* @author 공통컴포넌트 개발팀 한성곤
|
||||
* @since 2009.08.26
|
||||
* @version 1.0
|
||||
* @see
|
||||
*/
|
||||
public class EgovFormBasedFileUtil {
|
||||
/** Buffer size */
|
||||
public static final int BUFFER_SIZE = 8192;
|
||||
|
||||
public static final String SEPERATOR = File.separator;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(EgovFormBasedFileUtil.class);
|
||||
|
||||
/**
|
||||
* 오늘 날짜 문자열 취득.
|
||||
* ex) 20090101
|
||||
* @return
|
||||
*/
|
||||
public static String getTodayString() {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd", Locale.getDefault());
|
||||
|
||||
return format.format(new Date());
|
||||
}
|
||||
|
||||
/**
|
||||
* 물리적 파일명 생성.
|
||||
* @return
|
||||
*/
|
||||
public static String getPhysicalFileName() {
|
||||
return EgovFormBasedUUID.randomUUID().toString().replaceAll("-", "").toUpperCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일명 변환.
|
||||
* @param filename String
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
protected static String convert(String filename) throws Exception {
|
||||
//return java.net.URLEncoder.encode(filename, "utf-8");
|
||||
return filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stream으로부터 파일을 저장함.
|
||||
* @param is InputStream
|
||||
* @param file File
|
||||
* @throws IOException
|
||||
*/
|
||||
public static long saveFile(InputStream is, File file) throws IOException {
|
||||
// 디렉토리 생성
|
||||
if (!file.getParentFile().exists()) {
|
||||
file.getParentFile().mkdirs();
|
||||
}
|
||||
|
||||
OutputStream os = null;
|
||||
long size = 0L;
|
||||
|
||||
try {
|
||||
os = new FileOutputStream(file);
|
||||
|
||||
int bytesRead = 0;
|
||||
byte[] buffer = new byte[BUFFER_SIZE];
|
||||
|
||||
while ((bytesRead = is.read(buffer, 0, BUFFER_SIZE)) != -1) {
|
||||
size += bytesRead;
|
||||
os.write(buffer, 0, bytesRead);
|
||||
}
|
||||
} finally {
|
||||
EgovResourceCloseHelper.close(os);
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일을 Upload 처리한다.
|
||||
*
|
||||
* @param request
|
||||
* @param where
|
||||
* @param maxFileSize
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static List<EgovFormBasedFileVo> uploadFiles(HttpServletRequest request, String where, long maxFileSize) throws Exception {
|
||||
List<EgovFormBasedFileVo> list = new ArrayList<EgovFormBasedFileVo>();
|
||||
|
||||
// Check that we have a file upload request
|
||||
boolean isMultipart = ServletFileUpload.isMultipartContent(request);
|
||||
|
||||
if (isMultipart) {
|
||||
// Create a new file upload handler
|
||||
ServletFileUpload upload = new ServletFileUpload();
|
||||
upload.setFileSizeMax(maxFileSize); // SizeLimitExceededException
|
||||
|
||||
// Parse the request
|
||||
FileItemIterator iter = upload.getItemIterator(request);
|
||||
while (iter.hasNext()) {
|
||||
FileItemStream item = iter.next();
|
||||
String name = item.getFieldName();
|
||||
InputStream stream = item.openStream();
|
||||
if (item.isFormField()) {
|
||||
LOGGER.info("Form field '{}' with value '{}' detected.", name, Streams.asString(stream));
|
||||
} else {
|
||||
LOGGER.info("File field '{}' with file name '{}' detected.", name, item.getName());
|
||||
|
||||
if ("".equals(item.getName())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Process the input stream
|
||||
EgovFormBasedFileVo vo = new EgovFormBasedFileVo();
|
||||
|
||||
String tmp = item.getName();
|
||||
|
||||
if (tmp.lastIndexOf("\\") >= 0) {
|
||||
tmp = tmp.substring(tmp.lastIndexOf("\\") + 1);
|
||||
}
|
||||
|
||||
vo.setFileName(tmp);
|
||||
vo.setContentType(item.getContentType());
|
||||
vo.setServerSubPath(getTodayString());
|
||||
vo.setPhysicalName(getPhysicalFileName());
|
||||
|
||||
if (tmp.lastIndexOf(".") >= 0) {
|
||||
vo.setPhysicalName(vo.getPhysicalName() + tmp.substring(tmp.lastIndexOf(".")));
|
||||
}
|
||||
|
||||
long size = saveFile(stream, new File(EgovWebUtil.filePathBlackList(where) + SEPERATOR + vo.getServerSubPath() + SEPERATOR + vo.getPhysicalName()));
|
||||
|
||||
vo.setSize(size);
|
||||
|
||||
list.add(vo);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new IOException("form's 'enctype' attribute have to be 'multipart/form-data'");
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일을 Download 처리한다.
|
||||
*
|
||||
* @param response
|
||||
* @param where
|
||||
* @param serverSubPath
|
||||
* @param physicalName
|
||||
* @param original
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void downloadFile(HttpServletResponse response, String where, String serverSubPath, String physicalName, String original) throws Exception {
|
||||
String downFileName = where + SEPERATOR + serverSubPath + SEPERATOR + physicalName;
|
||||
|
||||
File file = new File(EgovWebUtil.filePathBlackList(downFileName));
|
||||
|
||||
if (!file.exists()) {
|
||||
throw new FileNotFoundException(downFileName);
|
||||
}
|
||||
|
||||
if (!file.isFile()) {
|
||||
throw new FileNotFoundException(downFileName);
|
||||
}
|
||||
|
||||
byte[] b = new byte[BUFFER_SIZE];
|
||||
|
||||
original = original.replaceAll("\r", "").replaceAll("\n", "");
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + convert(original) + "\";");
|
||||
response.setHeader("Content-Transfer-Encoding", "binary");
|
||||
response.setHeader("Pragma", "no-cache");
|
||||
response.setHeader("Expires", "0");
|
||||
|
||||
BufferedInputStream fin = null;
|
||||
BufferedOutputStream outs = null;
|
||||
|
||||
try {
|
||||
fin = new BufferedInputStream(new FileInputStream(file));
|
||||
outs = new BufferedOutputStream(response.getOutputStream());
|
||||
|
||||
int read = 0;
|
||||
|
||||
while ((read = fin.read(b)) != -1) {
|
||||
outs.write(b, 0, read);
|
||||
}
|
||||
} finally {
|
||||
EgovResourceCloseHelper.close(outs, fin);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 이미지에 대한 미리보기 기능을 제공한다.
|
||||
*
|
||||
* mimeType의 경우는 JSP 상에서 다음과 같이 얻을 수 있다.
|
||||
* getServletConfig().getServletContext().getMimeType(name);
|
||||
*
|
||||
* @param response
|
||||
* @param where
|
||||
* @param serverSubPath
|
||||
* @param physicalName
|
||||
* @param mimeType
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void viewFile(HttpServletResponse response, String where, String serverSubPath, String physicalName, String mimeTypeParam) throws Exception {
|
||||
String mimeType = mimeTypeParam;
|
||||
String downFileName = where + SEPERATOR + serverSubPath + SEPERATOR + physicalName;
|
||||
|
||||
File file = new File(EgovWebUtil.filePathBlackList(downFileName));
|
||||
|
||||
if (!file.exists()) {
|
||||
throw new FileNotFoundException(downFileName);
|
||||
}
|
||||
|
||||
if (!file.isFile()) {
|
||||
throw new FileNotFoundException(downFileName);
|
||||
}
|
||||
|
||||
byte[] b = new byte[BUFFER_SIZE];
|
||||
|
||||
if (mimeType == null) {
|
||||
mimeType = "application/octet-stream;";
|
||||
}
|
||||
|
||||
response.setContentType(EgovWebUtil.removeCRLF(mimeType));
|
||||
response.setHeader("Content-Disposition", "filename=image;");
|
||||
|
||||
BufferedInputStream fin = null;
|
||||
BufferedOutputStream outs = null;
|
||||
|
||||
try {
|
||||
fin = new BufferedInputStream(new FileInputStream(file));
|
||||
outs = new BufferedOutputStream(response.getOutputStream());
|
||||
|
||||
int read = 0;
|
||||
|
||||
while ((read = fin.read(b)) != -1) {
|
||||
outs.write(b, 0, read);
|
||||
}
|
||||
} finally {
|
||||
EgovResourceCloseHelper.close(outs, fin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
package kcg.faics.cmmn.egov.file;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Class Name : EgovFormBasedFileVo.java
|
||||
* @Description : Form-based File Upload VO
|
||||
* @Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2009.08.26 한성곤 최초 생성
|
||||
*
|
||||
* @author 공통컴포넌트 개발팀 한성곤
|
||||
* @since 2009.08.26
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* Copyright (C) 2008 by MOPAS All right reserved.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class EgovFormBasedFileVo implements Serializable {
|
||||
/** 파일명 */
|
||||
private String fileName = "";
|
||||
/** ContextType */
|
||||
private String contentType = "";
|
||||
/** 하위 디렉토리 지정 */
|
||||
private String serverSubPath = "";
|
||||
/** 물리적 파일명 */
|
||||
private String physicalName = "";
|
||||
/** 파일 사이즈 */
|
||||
private long size = 0L;
|
||||
|
||||
/**
|
||||
* fileName attribute를 리턴한다.
|
||||
* @return the fileName
|
||||
*/
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
/**
|
||||
* fileName attribute 값을 설정한다.
|
||||
* @param fileName the fileName to set
|
||||
*/
|
||||
public void setFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
/**
|
||||
* contentType attribute를 리턴한다.
|
||||
* @return the contentType
|
||||
*/
|
||||
public String getContentType() {
|
||||
return contentType;
|
||||
}
|
||||
/**
|
||||
* contentType attribute 값을 설정한다.
|
||||
* @param contentType the contentType to set
|
||||
*/
|
||||
public void setContentType(String contentType) {
|
||||
this.contentType = contentType;
|
||||
}
|
||||
/**
|
||||
* serverSubPath attribute를 리턴한다.
|
||||
* @return the serverSubPath
|
||||
*/
|
||||
public String getServerSubPath() {
|
||||
return serverSubPath;
|
||||
}
|
||||
/**
|
||||
* serverSubPath attribute 값을 설정한다.
|
||||
* @param serverSubPath the serverSubPath to set
|
||||
*/
|
||||
public void setServerSubPath(String serverSubPath) {
|
||||
this.serverSubPath = serverSubPath;
|
||||
}
|
||||
/**
|
||||
* physicalName attribute를 리턴한다.
|
||||
* @return the physicalName
|
||||
*/
|
||||
public String getPhysicalName() {
|
||||
return physicalName;
|
||||
}
|
||||
/**
|
||||
* physicalName attribute 값을 설정한다.
|
||||
* @param physicalName the physicalName to set
|
||||
*/
|
||||
public void setPhysicalName(String physicalName) {
|
||||
this.physicalName = physicalName;
|
||||
}
|
||||
/**
|
||||
* size attribute를 리턴한다.
|
||||
* @return the size
|
||||
*/
|
||||
public long getSize() {
|
||||
return size;
|
||||
}
|
||||
/**
|
||||
* size attribute 값을 설정한다.
|
||||
* @param size the size to set
|
||||
*/
|
||||
public void setSize(long size) {
|
||||
this.size = size;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,529 @@
|
|||
package kcg.faics.cmmn.egov.file;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecureRandom;
|
||||
|
||||
/**
|
||||
*
|
||||
* A class that represents an immutable universally unique identifier (UUID). A
|
||||
* UUID represents a 128-bit value.
|
||||
*
|
||||
* <p>
|
||||
* There exist different variants of these global identifiers. The methods of
|
||||
* this class are for manipulating the Leach-Salz variant, although the
|
||||
* constructors allow the creation of any variant of UUID (described below).
|
||||
*
|
||||
* <p>
|
||||
* The layout of a variant 2 (Leach-Salz) UUID is as follows:
|
||||
*
|
||||
* The most significant long consists of the following unsigned fields:
|
||||
*
|
||||
* <pre>
|
||||
* 0xFFFFFFFF00000000 time_low
|
||||
* 0x00000000FFFF0000 time_mid
|
||||
* 0x000000000000F000 version
|
||||
* 0x0000000000000FFF time_hi
|
||||
* </pre>
|
||||
*
|
||||
* The least significant long consists of the following unsigned fields:
|
||||
*
|
||||
* <pre>
|
||||
* 0xC000000000000000 variant
|
||||
* 0x3FFF000000000000 clock_seq
|
||||
* 0x0000FFFFFFFFFFFF node
|
||||
* </pre>
|
||||
*
|
||||
* <p>
|
||||
* The variant field contains a value which identifies the layout of the
|
||||
* <tt>UUID</tt>. The bit layout described above is valid only for a
|
||||
* <tt>UUID</tt> with a variant value of 2, which indicates the Leach-Salz
|
||||
* variant.
|
||||
*
|
||||
* <p>
|
||||
* The version field holds a value that describes the type of this <tt>UUID</tt>.
|
||||
* There are four different basic types of UUIDs: time-based, DCE security,
|
||||
* name-based, and randomly generated UUIDs. These types have a version value of
|
||||
* 1, 2, 3 and 4, respectively.
|
||||
*
|
||||
* <p>
|
||||
* For more information including algorithms used to create <tt>UUID</tt>s,
|
||||
* see the Internet-Draft <a
|
||||
* href="http://www.ietf.org/internet-drafts/draft-mealling-uuid-urn-03.txt">UUIDs
|
||||
* and GUIDs</a> or the standards body definition at <a
|
||||
* href="http://www.iso.ch/cate/d2229.html">ISO/IEC 11578:1996</a>.
|
||||
*
|
||||
* @version 1.14, 07/12/04
|
||||
* @since 1.5
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class EgovFormBasedUUID implements Serializable {
|
||||
/*
|
||||
* The most significant 64 bits of this UUID.
|
||||
*
|
||||
* @serial
|
||||
*/
|
||||
private final long mostSigBits;
|
||||
|
||||
/*
|
||||
* The least significant 64 bits of this UUID.
|
||||
*
|
||||
* @serial
|
||||
*/
|
||||
private final long leastSigBits;
|
||||
|
||||
/*
|
||||
* The version number associated with this UUID. Computed on demand.
|
||||
*/
|
||||
private transient int version = -1;
|
||||
|
||||
/*
|
||||
* The variant number associated with this UUID. Computed on demand.
|
||||
*/
|
||||
private transient int variant = -1;
|
||||
|
||||
/*
|
||||
* The timestamp associated with this UUID. Computed on demand.
|
||||
*/
|
||||
private transient volatile long timestamp = -1;
|
||||
|
||||
/*
|
||||
* The clock sequence associated with this UUID. Computed on demand.
|
||||
*/
|
||||
private transient int sequence = -1;
|
||||
|
||||
/*
|
||||
* The node number associated with this UUID. Computed on demand.
|
||||
*/
|
||||
private transient long node = -1;
|
||||
|
||||
/*
|
||||
* The hashcode of this UUID. Computed on demand.
|
||||
*/
|
||||
private transient int hashCode = -1;
|
||||
|
||||
/*
|
||||
* The random number generator used by this class to create random based
|
||||
* UUIDs.
|
||||
*/
|
||||
private static volatile SecureRandom numberGenerator = null;
|
||||
|
||||
// Constructors and Factories
|
||||
|
||||
/*
|
||||
* Private constructor which uses a byte array to construct the new UUID.
|
||||
*/
|
||||
private EgovFormBasedUUID(byte[] data) {
|
||||
long msb = 0;
|
||||
long lsb = 0;
|
||||
for (int i = 0; i < 8; i++)
|
||||
msb = (msb << 8) | (data[i] & 0xff);
|
||||
for (int i = 8; i < 16; i++)
|
||||
lsb = (lsb << 8) | (data[i] & 0xff);
|
||||
this.mostSigBits = msb;
|
||||
this.leastSigBits = lsb;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <tt>UUID</tt> using the specified data.
|
||||
* <tt>mostSigBits</tt> is used for the most significant 64 bits of the
|
||||
* <tt>UUID</tt> and <tt>leastSigBits</tt> becomes the least significant
|
||||
* 64 bits of the <tt>UUID</tt>.
|
||||
*
|
||||
* @param mostSigBits
|
||||
* @param leastSigBits
|
||||
*/
|
||||
public EgovFormBasedUUID(long mostSigBits, long leastSigBits) {
|
||||
this.mostSigBits = mostSigBits;
|
||||
this.leastSigBits = leastSigBits;
|
||||
}
|
||||
|
||||
/**
|
||||
* Static factory to retrieve a type 4 (pseudo randomly generated) UUID.
|
||||
*
|
||||
* The <code>UUID</code> is generated using a cryptographically strong
|
||||
* pseudo random number generator.
|
||||
*
|
||||
* @return a randomly generated <tt>UUID</tt>.
|
||||
*/
|
||||
public static EgovFormBasedUUID randomUUID() {
|
||||
SecureRandom ng = numberGenerator;
|
||||
if (ng == null) {
|
||||
numberGenerator = ng = new SecureRandom();
|
||||
}
|
||||
|
||||
byte[] randomBytes = new byte[16];
|
||||
ng.nextBytes(randomBytes);
|
||||
randomBytes[6] &= 0x0f; /* clear version */
|
||||
randomBytes[6] |= 0x40; /* set to version 4 */
|
||||
randomBytes[8] &= 0x3f; /* clear variant */
|
||||
randomBytes[8] |= 0x80; /* set to IETF variant */
|
||||
|
||||
return new EgovFormBasedUUID(randomBytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Static factory to retrieve a type 3 (name based) <tt>UUID</tt> based on
|
||||
* the specified byte array.
|
||||
*
|
||||
* @param name
|
||||
* a byte array to be used to construct a <tt>UUID</tt>.
|
||||
* @return a <tt>UUID</tt> generated from the specified array.
|
||||
*/
|
||||
public static EgovFormBasedUUID nameUUIDFromBytes(byte[] name) {
|
||||
return null;
|
||||
|
||||
/*
|
||||
* 2106.11.18 김노민
|
||||
* FindBugs에서 Array index is out of bounds. 문제를 제시한다.
|
||||
* 어차피 사용하지 않으니 해당 메소드를 수정하지 않고 모두 주석처리한다.
|
||||
*
|
||||
*
|
||||
MessageDigest md;
|
||||
try {
|
||||
// 2011.10.10 보안점검 후속조치 암호화 알고리즘 변경(MD5 -> SHA-256)
|
||||
//md = MessageDigest.getInstance("MD5");
|
||||
md = MessageDigest.getInstance("SHA-256");
|
||||
} catch (NoSuchAlgorithmException nsae) {
|
||||
//throw new InternalError("MD5 not supported");
|
||||
throw new InternalError("SHA-256 not supported");
|
||||
}
|
||||
// 2011.10.10 보안점검 후속조치
|
||||
if (md == null) {
|
||||
throw new RuntimeException("MessageDigest is null!!");
|
||||
}
|
||||
// 2014.09.20 보안점검 후속 조치
|
||||
// Random 방식의 salt 추가
|
||||
SecureRandom ng = new SecureRandom();
|
||||
byte[] randomBytes = new byte[16];
|
||||
ng.nextBytes(randomBytes);
|
||||
|
||||
md.reset();
|
||||
md.update(randomBytes);
|
||||
byte[] sha = md.digest(name);
|
||||
|
||||
|
||||
byte[] md5Bytes = new byte[8];
|
||||
System.arraycopy(sha, 0, md5Bytes, 0, 8);
|
||||
//2011.10.10 보안점검 후속조치 끝
|
||||
|
||||
md5Bytes[6] &= 0x0f; clear version
|
||||
md5Bytes[6] |= 0x30; set to version 3
|
||||
md5Bytes[8] &= 0x3f; clear variant
|
||||
md5Bytes[8] |= 0x80; set to IETF variant
|
||||
|
||||
return new EgovFormBasedUUID(md5Bytes);*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a <tt>UUID</tt> from the string standard representation as
|
||||
* described in the {@link #toString} method.
|
||||
*
|
||||
* @param name
|
||||
* a string that specifies a <tt>UUID</tt>.
|
||||
* @return a <tt>UUID</tt> with the specified value.
|
||||
* @throws IllegalArgumentException
|
||||
* if name does not conform to the string representation as
|
||||
* described in {@link #toString}.
|
||||
*/
|
||||
public static EgovFormBasedUUID fromString(String name) {
|
||||
String[] components = name.split("-");
|
||||
if (components.length != 5)
|
||||
throw new IllegalArgumentException("Invalid UUID string: " + name);
|
||||
for (int i = 0; i < 5; i++)
|
||||
components[i] = "0x" + components[i];
|
||||
|
||||
long mostSigBits = Long.decode(components[0]).longValue();
|
||||
mostSigBits <<= 16;
|
||||
mostSigBits |= Long.decode(components[1]).longValue();
|
||||
mostSigBits <<= 16;
|
||||
mostSigBits |= Long.decode(components[2]).longValue();
|
||||
|
||||
long leastSigBits = Long.decode(components[3]).longValue();
|
||||
leastSigBits <<= 48;
|
||||
leastSigBits |= Long.decode(components[4]).longValue();
|
||||
|
||||
return new EgovFormBasedUUID(mostSigBits, leastSigBits);
|
||||
}
|
||||
|
||||
// Field Accessor Methods
|
||||
|
||||
/**
|
||||
* Returns the least significant 64 bits of this UUID's 128 bit value.
|
||||
*
|
||||
* @return the least significant 64 bits of this UUID's 128 bit value.
|
||||
*/
|
||||
public long getLeastSignificantBits() {
|
||||
return leastSigBits;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the most significant 64 bits of this UUID's 128 bit value.
|
||||
*
|
||||
* @return the most significant 64 bits of this UUID's 128 bit value.
|
||||
*/
|
||||
public long getMostSignificantBits() {
|
||||
return mostSigBits;
|
||||
}
|
||||
|
||||
/**
|
||||
* The version number associated with this <tt>UUID</tt>. The version
|
||||
* number describes how this <tt>UUID</tt> was generated.
|
||||
*
|
||||
* The version number has the following meaning:
|
||||
* <p>
|
||||
* <ul>
|
||||
* <li>1 Time-based UUID
|
||||
* <li>2 DCE security UUID
|
||||
* <li>3 Name-based UUID
|
||||
* <li>4 Randomly generated UUID
|
||||
* </ul>
|
||||
*
|
||||
* @return the version number of this <tt>UUID</tt>.
|
||||
*/
|
||||
public int version() {
|
||||
if (version < 0) {
|
||||
// Version is bits masked by 0x000000000000F000 in MS long
|
||||
version = (int) ((mostSigBits >> 12) & 0x0f);
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
/**
|
||||
* The variant number associated with this <tt>UUID</tt>. The variant
|
||||
* number describes the layout of the <tt>UUID</tt>.
|
||||
*
|
||||
* The variant number has the following meaning:
|
||||
* <p>
|
||||
* <ul>
|
||||
* <li>0 Reserved for NCS backward compatibility
|
||||
* <li>2 The Leach-Salz variant (used by this class)
|
||||
* <li>6 Reserved, Microsoft Corporation backward compatibility
|
||||
* <li>7 Reserved for future definition
|
||||
* </ul>
|
||||
*
|
||||
* @return the variant number of this <tt>UUID</tt>.
|
||||
*/
|
||||
public int variant() {
|
||||
if (variant < 0) {
|
||||
// This field is composed of a varying number of bits
|
||||
if ((leastSigBits >>> 63) == 0) {
|
||||
variant = 0;
|
||||
} else if ((leastSigBits >>> 62) == 2) {
|
||||
variant = 2;
|
||||
} else {
|
||||
variant = (int) (leastSigBits >>> 61);
|
||||
}
|
||||
}
|
||||
return variant;
|
||||
}
|
||||
|
||||
/**
|
||||
* The timestamp value associated with this UUID.
|
||||
*
|
||||
* <p>
|
||||
* The 60 bit timestamp value is constructed from the time_low, time_mid,
|
||||
* and time_hi fields of this <tt>UUID</tt>. The resulting timestamp is
|
||||
* measured in 100-nanosecond units since midnight, October 15, 1582 UTC.
|
||||
* <p>
|
||||
*
|
||||
* The timestamp value is only meaningful in a time-based UUID, which has
|
||||
* version type 1. If this <tt>UUID</tt> is not a time-based UUID then
|
||||
* this method throws UnsupportedOperationException.
|
||||
*
|
||||
* @throws UnsupportedOperationException
|
||||
* if this UUID is not a version 1 UUID.
|
||||
*/
|
||||
public long timestamp() {
|
||||
if (version() != 1) {
|
||||
throw new UnsupportedOperationException("Not a time-based UUID");
|
||||
}
|
||||
long result = timestamp;
|
||||
if (result < 0) {
|
||||
result = (mostSigBits & 0x0000000000000FFFL) << 48;
|
||||
result |= ((mostSigBits >> 16) & 0xFFFFL) << 32;
|
||||
result |= mostSigBits >>> 32;
|
||||
timestamp = result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* The clock sequence value associated with this UUID.
|
||||
*
|
||||
* <p>
|
||||
* The 14 bit clock sequence value is constructed from the clock sequence
|
||||
* field of this UUID. The clock sequence field is used to guarantee
|
||||
* temporal uniqueness in a time-based UUID.
|
||||
* <p>
|
||||
*
|
||||
* The clockSequence value is only meaningful in a time-based UUID, which
|
||||
* has version type 1. If this UUID is not a time-based UUID then this
|
||||
* method throws UnsupportedOperationException.
|
||||
*
|
||||
* @return the clock sequence of this <tt>UUID</tt>.
|
||||
* @throws UnsupportedOperationException
|
||||
* if this UUID is not a version 1 UUID.
|
||||
*/
|
||||
public int clockSequence() {
|
||||
if (version() != 1) {
|
||||
throw new UnsupportedOperationException("Not a time-based UUID");
|
||||
}
|
||||
if (sequence < 0) {
|
||||
sequence = (int) ((leastSigBits & 0x3FFF000000000000L) >>> 48);
|
||||
}
|
||||
return sequence;
|
||||
}
|
||||
|
||||
/**
|
||||
* The node value associated with this UUID.
|
||||
*
|
||||
* <p>
|
||||
* The 48 bit node value is constructed from the node field of this UUID.
|
||||
* This field is intended to hold the IEEE 802 address of the machine that
|
||||
* generated this UUID to guarantee spatial uniqueness.
|
||||
* <p>
|
||||
*
|
||||
* The node value is only meaningful in a time-based UUID, which has version
|
||||
* type 1. If this UUID is not a time-based UUID then this method throws
|
||||
* UnsupportedOperationException.
|
||||
*
|
||||
* @return the node value of this <tt>UUID</tt>.
|
||||
* @throws UnsupportedOperationException
|
||||
* if this UUID is not a version 1 UUID.
|
||||
*/
|
||||
public long node() {
|
||||
if (version() != 1) {
|
||||
throw new UnsupportedOperationException("Not a time-based UUID");
|
||||
}
|
||||
if (node < 0) {
|
||||
node = leastSigBits & 0x0000FFFFFFFFFFFFL;
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
// Object Inherited Methods
|
||||
|
||||
/**
|
||||
* Returns a <code>String</code> object representing this
|
||||
* <code>UUID</code>.
|
||||
*
|
||||
* <p>
|
||||
* The UUID string representation is as described by this BNF :
|
||||
*
|
||||
* <pre>
|
||||
* UUID = <time_low> "-" <time_mid> "-"
|
||||
* <time_high_and_version> "-"
|
||||
* <variant_and_sequence> "-"
|
||||
* <node>
|
||||
* time_low = 4*<hexOctet>
|
||||
* time_mid = 2*<hexOctet>
|
||||
* time_high_and_version = 2*<hexOctet>
|
||||
* variant_and_sequence = 2*<hexOctet>
|
||||
* node = 6*<hexOctet>
|
||||
* hexOctet = <hexDigit><hexDigit>
|
||||
* hexDigit =
|
||||
* "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
|
||||
* | "a" | "b" | "c" | "d" | "e" | "f"
|
||||
* | "A" | "B" | "C" | "D" | "E" | "F"
|
||||
* </pre>
|
||||
*
|
||||
* @return a string representation of this <tt>UUID</tt>.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return (digits(mostSigBits >> 32, 8) + "-"
|
||||
+ digits(mostSigBits >> 16, 4) + "-" + digits(mostSigBits, 4)
|
||||
+ "-" + digits(leastSigBits >> 48, 4) + "-" + digits(
|
||||
leastSigBits, 12));
|
||||
}
|
||||
|
||||
/** Returns val represented by the specified number of hex digits. */
|
||||
private static String digits(long val, int digits) {
|
||||
long hi = 1L << (digits * 4);
|
||||
return Long.toHexString(hi | (val & (hi - 1))).substring(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a hash code for this <code>UUID</code>.
|
||||
*
|
||||
* @return a hash code value for this <tt>UUID</tt>.
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
if (hashCode == -1) {
|
||||
hashCode = (int) ((mostSigBits >> 32) ^ mostSigBits
|
||||
^ (leastSigBits >> 32) ^ leastSigBits);
|
||||
}
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares this object to the specified object. The result is <tt>true</tt>
|
||||
* if and only if the argument is not <tt>null</tt>, is a <tt>UUID</tt>
|
||||
* object, has the same variant, and contains the same value, bit for bit,
|
||||
* as this <tt>UUID</tt>.
|
||||
*
|
||||
* @param obj
|
||||
* the object to compare with.
|
||||
* @return <code>true</code> if the objects are the same;
|
||||
* <code>false</code> otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
// 보안 취약점 점검 지적사항 반영 시작
|
||||
if (obj == null)
|
||||
return false;
|
||||
// 보안 취약점 점검 지적사항 반영 시작 끝
|
||||
if (!(obj instanceof EgovFormBasedUUID))
|
||||
return false;
|
||||
if (((EgovFormBasedUUID) obj).variant() != this.variant())
|
||||
return false;
|
||||
EgovFormBasedUUID id = (EgovFormBasedUUID) obj;
|
||||
return (mostSigBits == id.mostSigBits && leastSigBits == id.leastSigBits);
|
||||
}
|
||||
|
||||
// Comparison Operations
|
||||
|
||||
/**
|
||||
* Compares this UUID with the specified UUID.
|
||||
*
|
||||
* <p>
|
||||
* The first of two UUIDs follows the second if the most significant field
|
||||
* in which the UUIDs differ is greater for the first UUID.
|
||||
*
|
||||
* @param val
|
||||
* <tt>UUID</tt> to which this <tt>UUID</tt> is to be
|
||||
* compared.
|
||||
* @return -1, 0 or 1 as this <tt>UUID</tt> is less than, equal to, or
|
||||
* greater than <tt>val</tt>.
|
||||
*/
|
||||
public int compareTo(EgovFormBasedUUID val) {
|
||||
// The ordering is intentionally set up so that the UUIDs
|
||||
// can simply be numerically compared as two numbers
|
||||
return (this.mostSigBits < val.mostSigBits ? -1
|
||||
: (this.mostSigBits > val.mostSigBits ? 1
|
||||
: (this.leastSigBits < val.leastSigBits ? -1
|
||||
: (this.leastSigBits > val.leastSigBits ? 1 : 0))));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reconstitute the <tt>UUID</tt> instance from a stream (that is,
|
||||
* deserialize it). This is necessary to set the transient fields to their
|
||||
* correct uninitialized value so they will be recomputed on demand.
|
||||
*/
|
||||
private void readObject(java.io.ObjectInputStream in)
|
||||
throws java.io.IOException, ClassNotFoundException {
|
||||
|
||||
in.defaultReadObject();
|
||||
|
||||
// Set "cached computation" fields to their initial values
|
||||
version = -1;
|
||||
variant = -1;
|
||||
timestamp = -1;
|
||||
sequence = -1;
|
||||
node = -1;
|
||||
hashCode = -1;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* 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 kcg.faics.cmmn.egov.filter;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.FilterConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
public class HTMLTagFilter implements Filter{
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private FilterConfig config;
|
||||
|
||||
public void doFilter(ServletRequest request, ServletResponse response,
|
||||
FilterChain chain) throws IOException, ServletException {
|
||||
|
||||
// 2016 12 21 뿌릴때 안되서 막음.
|
||||
// chain.doFilter(new HTMLTagFilterRequestWrapper((HttpServletRequest)request), response);
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
|
||||
public void init(FilterConfig config) throws ServletException {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
* 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 kcg.faics.cmmn.egov.filter;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletRequestWrapper;
|
||||
|
||||
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("<");
|
||||
break;
|
||||
case '>':
|
||||
strBuff.append(">");
|
||||
break;
|
||||
//case '&':
|
||||
//strBuff.append("&");
|
||||
//break;
|
||||
case '"':
|
||||
strBuff.append(""");
|
||||
break;
|
||||
case '\'':
|
||||
strBuff.append("'");
|
||||
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("<");
|
||||
break;
|
||||
case '>':
|
||||
strBuff.append(">");
|
||||
break;
|
||||
case '&':
|
||||
strBuff.append("&");
|
||||
break;
|
||||
case '"':
|
||||
strBuff.append(""");
|
||||
break;
|
||||
case '\'':
|
||||
strBuff.append("'");
|
||||
break;
|
||||
default:
|
||||
strBuff.append(c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
value = strBuff.toString();
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package kcg.faics.cmmn.egov.filter;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.FilterConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class RequestBodyXSSFilter implements Filter {
|
||||
|
||||
@Override
|
||||
public void destroy() {}
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig) throws ServletException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response,
|
||||
FilterChain chain) throws IOException, ServletException {
|
||||
HttpServletRequest req = (HttpServletRequest)request;
|
||||
HttpServletResponse res = (HttpServletResponse)response;
|
||||
// RequestWrapper requestWrapper = null;
|
||||
try{
|
||||
// requestWrapper = new RequestWrapper(req);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
chain.doFilter(req, res);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,895 @@
|
|||
/**
|
||||
* @Class Name : EgovStringUtil.java
|
||||
* @Description : 문자열 데이터 처리 관련 유틸리티
|
||||
* @Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2009.01.13 박정규 최초 생성
|
||||
* 2009.02.13 이삼섭 내용 추가
|
||||
*
|
||||
* @author 공통 서비스 개발팀 박정규
|
||||
* @since 2009. 01. 13
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
|
||||
package kcg.faics.cmmn.egov.util;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2006 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the ";License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS"; BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigDecimal;
|
||||
import java.security.SecureRandom;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class EgovStringUtil {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(EgovStringUtil.class);
|
||||
|
||||
/**
|
||||
* 빈 문자열 <code>""</code>.
|
||||
*/
|
||||
public static final String EMPTY = "";
|
||||
|
||||
/**
|
||||
* <p>Padding을 할 수 있는 최대 수치</p>
|
||||
*/
|
||||
// private static final int PAD_LIMIT = 8192;
|
||||
/**
|
||||
* <p>An array of <code>String</code>s used for padding.</p>
|
||||
* <p>Used for efficient space padding. The length of each String expands as needed.</p>
|
||||
*/
|
||||
/*
|
||||
private static final String[] PADDING = new String[Character.MAX_VALUE];
|
||||
|
||||
static {
|
||||
// space padding is most common, start with 64 chars
|
||||
PADDING[32] = " ";
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* 문자열이 지정한 길이를 초과했을때 지정한길이에다가 해당 문자열을 붙여주는 메서드.
|
||||
* @param source 원본 문자열 배열
|
||||
* @param output 더할문자열
|
||||
* @param slength 지정길이
|
||||
* @return 지정길이로 잘라서 더할분자열 합친 문자열
|
||||
*/
|
||||
public static String cutString(String source, String output, int slength) {
|
||||
String returnVal = null;
|
||||
if (source != null) {
|
||||
if (source.length() > slength) {
|
||||
returnVal = source.substring(0, slength) + output;
|
||||
} else
|
||||
returnVal = source;
|
||||
}
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* 문자열이 지정한 길이를 초과했을때 해당 문자열을 삭제하는 메서드
|
||||
* @param source 원본 문자열 배열
|
||||
* @param slength 지정길이
|
||||
* @return 지정길이로 잘라서 더할분자열 합친 문자열
|
||||
*/
|
||||
public static String cutString(String source, int slength) {
|
||||
String result = null;
|
||||
if (source != null) {
|
||||
if (source.length() > slength) {
|
||||
result = source.substring(0, slength);
|
||||
} else
|
||||
result = source;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* String이 비었거나("") 혹은 null 인지 검증한다.
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtil.isEmpty(null) = true
|
||||
* StringUtil.isEmpty("") = true
|
||||
* StringUtil.isEmpty(" ") = false
|
||||
* StringUtil.isEmpty("bob") = false
|
||||
* StringUtil.isEmpty(" bob ") = false
|
||||
* </pre>
|
||||
*
|
||||
* @param str - 체크 대상 스트링오브젝트이며 null을 허용함
|
||||
* @return <code>true</code> - 입력받은 String 이 빈 문자열 또는 null인 경우
|
||||
*/
|
||||
public static boolean isEmpty(String str) {
|
||||
return str == null || str.length() == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>기준 문자열에 포함된 모든 대상 문자(char)를 제거한다.</p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtil.remove(null, *) = null
|
||||
* StringUtil.remove("", *) = ""
|
||||
* StringUtil.remove("queued", 'u') = "qeed"
|
||||
* StringUtil.remove("queued", 'z') = "queued"
|
||||
* </pre>
|
||||
*
|
||||
* @param str 입력받는 기준 문자열
|
||||
* @param remove 입력받는 문자열에서 제거할 대상 문자열
|
||||
* @return 제거대상 문자열이 제거된 입력문자열. 입력문자열이 null인 경우 출력문자열은 null
|
||||
*/
|
||||
public static String remove(String str, char remove) {
|
||||
if (isEmpty(str) || str.indexOf(remove) == -1) {
|
||||
return str;
|
||||
}
|
||||
char[] chars = str.toCharArray();
|
||||
int pos = 0;
|
||||
for (int i = 0; i < chars.length; i++) {
|
||||
if (chars[i] != remove) {
|
||||
chars[pos++] = chars[i];
|
||||
}
|
||||
}
|
||||
return new String(chars, 0, pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>문자열 내부의 콤마 character(,)를 모두 제거한다.</p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtil.removeCommaChar(null) = null
|
||||
* StringUtil.removeCommaChar("") = ""
|
||||
* StringUtil.removeCommaChar("asdfg,qweqe") = "asdfgqweqe"
|
||||
* </pre>
|
||||
*
|
||||
* @param str 입력받는 기준 문자열
|
||||
* @return " , "가 제거된 입력문자열
|
||||
* 입력문자열이 null인 경우 출력문자열은 null
|
||||
*/
|
||||
public static String removeCommaChar(String str) {
|
||||
return remove(str, ',');
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>문자열 내부의 마이너스 character(-)를 모두 제거한다.</p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtil.removeMinusChar(null) = null
|
||||
* StringUtil.removeMinusChar("") = ""
|
||||
* StringUtil.removeMinusChar("a-sdfg-qweqe") = "asdfgqweqe"
|
||||
* </pre>
|
||||
*
|
||||
* @param str 입력받는 기준 문자열
|
||||
* @return " - "가 제거된 입력문자열
|
||||
* 입력문자열이 null인 경우 출력문자열은 null
|
||||
*/
|
||||
public static String removeMinusChar(String str) {
|
||||
return remove(str, '-');
|
||||
}
|
||||
|
||||
/**
|
||||
* 원본 문자열의 포함된 특정 문자열을 새로운 문자열로 변환하는 메서드
|
||||
* @param source 원본 문자열
|
||||
* @param subject 원본 문자열에 포함된 특정 문자열
|
||||
* @param object 변환할 문자열
|
||||
* @return sb.toString() 새로운 문자열로 변환된 문자열
|
||||
*/
|
||||
public static String replace(String source, String subject, String object) {
|
||||
StringBuffer rtnStr = new StringBuffer();
|
||||
String preStr = "";
|
||||
String nextStr = source;
|
||||
String srcStr = source;
|
||||
|
||||
while (srcStr.indexOf(subject) >= 0) {
|
||||
preStr = srcStr.substring(0, srcStr.indexOf(subject));
|
||||
nextStr = srcStr.substring(srcStr.indexOf(subject) + subject.length(), srcStr.length());
|
||||
srcStr = nextStr;
|
||||
rtnStr.append(preStr).append(object);
|
||||
}
|
||||
rtnStr.append(nextStr);
|
||||
return rtnStr.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 원본 문자열의 포함된 특정 문자열 첫번째 한개만 새로운 문자열로 변환하는 메서드
|
||||
* @param source 원본 문자열
|
||||
* @param subject 원본 문자열에 포함된 특정 문자열
|
||||
* @param object 변환할 문자열
|
||||
* @return sb.toString() 새로운 문자열로 변환된 문자열 / source 특정문자열이 없는 경우 원본 문자열
|
||||
*/
|
||||
public static String replaceOnce(String source, String subject, String object) {
|
||||
StringBuffer rtnStr = new StringBuffer();
|
||||
String preStr = "";
|
||||
String nextStr = source;
|
||||
if (source.indexOf(subject) >= 0) {
|
||||
preStr = source.substring(0, source.indexOf(subject));
|
||||
nextStr = source.substring(source.indexOf(subject) + subject.length(), source.length());
|
||||
rtnStr.append(preStr).append(object).append(nextStr);
|
||||
return rtnStr.toString();
|
||||
} else {
|
||||
return source;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <code>subject</code>에 포함된 각각의 문자를 object로 변환한다.
|
||||
*
|
||||
* @param source 원본 문자열
|
||||
* @param subject 원본 문자열에 포함된 특정 문자열
|
||||
* @param object 변환할 문자열
|
||||
* @return sb.toString() 새로운 문자열로 변환된 문자열
|
||||
*/
|
||||
public static String replaceChar(String source, String subject, String object) {
|
||||
StringBuffer rtnStr = new StringBuffer();
|
||||
String preStr = "";
|
||||
String nextStr = source;
|
||||
String srcStr = source;
|
||||
|
||||
char chA;
|
||||
|
||||
for (int i = 0; i < subject.length(); i++) {
|
||||
chA = subject.charAt(i);
|
||||
|
||||
if (srcStr.indexOf(chA) >= 0) {
|
||||
preStr = srcStr.substring(0, srcStr.indexOf(chA));
|
||||
nextStr = srcStr.substring(srcStr.indexOf(chA) + 1, srcStr.length());
|
||||
srcStr = rtnStr.append(preStr).append(object).append(nextStr).toString();
|
||||
}
|
||||
}
|
||||
|
||||
return srcStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p><code>str</code> 중 <code>searchStr</code>의 시작(index) 위치를 반환.</p>
|
||||
*
|
||||
* <p>입력값 중 <code>null</code>이 있을 경우 <code>-1</code>을 반환.</p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtil.indexOf(null, *) = -1
|
||||
* StringUtil.indexOf(*, null) = -1
|
||||
* StringUtil.indexOf("", "") = 0
|
||||
* StringUtil.indexOf("aabaabaa", "a") = 0
|
||||
* StringUtil.indexOf("aabaabaa", "b") = 2
|
||||
* StringUtil.indexOf("aabaabaa", "ab") = 1
|
||||
* StringUtil.indexOf("aabaabaa", "") = 0
|
||||
* </pre>
|
||||
*
|
||||
* @param str 검색 문자열
|
||||
* @param searchStr 검색 대상문자열
|
||||
* @return 검색 문자열 중 검색 대상문자열이 있는 시작 위치 검색대상 문자열이 없거나 null인 경우 -1
|
||||
*/
|
||||
public static int indexOf(String str, String searchStr) {
|
||||
if (str == null || searchStr == null) {
|
||||
return -1;
|
||||
}
|
||||
return str.indexOf(searchStr);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>오라클의 decode 함수와 동일한 기능을 가진 메서드이다.
|
||||
* <code>sourStr</code>과 <code>compareStr</code>의 값이 같으면
|
||||
* <code>returStr</code>을 반환하며, 다르면 <code>defaultStr</code>을 반환한다.
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtil.decode(null, null, "foo", "bar")= "foo"
|
||||
* StringUtil.decode("", null, "foo", "bar") = "bar"
|
||||
* StringUtil.decode(null, "", "foo", "bar") = "bar"
|
||||
* StringUtil.decode("하이", "하이", null, "bar") = null
|
||||
* StringUtil.decode("하이", "하이 ", "foo", null) = null
|
||||
* StringUtil.decode("하이", "하이", "foo", "bar") = "foo"
|
||||
* StringUtil.decode("하이", "하이 ", "foo", "bar") = "bar"
|
||||
* </pre>
|
||||
*
|
||||
* @param sourceStr 비교할 문자열
|
||||
* @param compareStr 비교 대상 문자열
|
||||
* @param returnStr sourceStr와 compareStr의 값이 같을 때 반환할 문자열
|
||||
* @param defaultStr sourceStr와 compareStr의 값이 다를 때 반환할 문자열
|
||||
* @return sourceStr과 compareStr의 값이 동일(equal)할 때 returnStr을 반환하며,
|
||||
* <br/>다르면 defaultStr을 반환한다.
|
||||
*/
|
||||
public static String decode(String sourceStr, String compareStr, String returnStr, String defaultStr) {
|
||||
if (sourceStr == null && compareStr == null) {
|
||||
return returnStr;
|
||||
}
|
||||
|
||||
if (sourceStr == null && compareStr != null) {
|
||||
return defaultStr;
|
||||
}
|
||||
|
||||
if (sourceStr != null && sourceStr.trim().equals(compareStr)) {
|
||||
return returnStr;
|
||||
}
|
||||
|
||||
return defaultStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>오라클의 decode 함수와 동일한 기능을 가진 메서드이다.
|
||||
* <code>sourStr</code>과 <code>compareStr</code>의 값이 같으면
|
||||
* <code>returStr</code>을 반환하며, 다르면 <code>sourceStr</code>을 반환한다.
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtil.decode(null, null, "foo") = "foo"
|
||||
* StringUtil.decode("", null, "foo") = ""
|
||||
* StringUtil.decode(null, "", "foo") = null
|
||||
* StringUtil.decode("하이", "하이", "foo") = "foo"
|
||||
* StringUtil.decode("하이", "하이 ", "foo") = "하이"
|
||||
* StringUtil.decode("하이", "바이", "foo") = "하이"
|
||||
* </pre>
|
||||
*
|
||||
* @param sourceStr 비교할 문자열
|
||||
* @param compareStr 비교 대상 문자열
|
||||
* @param returnStr sourceStr와 compareStr의 값이 같을 때 반환할 문자열
|
||||
* @return sourceStr과 compareStr의 값이 동일(equal)할 때 returnStr을 반환하며,
|
||||
* <br/>다르면 sourceStr을 반환한다.
|
||||
*/
|
||||
public static String decode(String sourceStr, String compareStr, String returnStr) {
|
||||
return decode(sourceStr, compareStr, returnStr, sourceStr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 객체가 null인지 확인하고 null인 경우 "" 로 바꾸는 메서드
|
||||
* @param object 원본 객체
|
||||
* @return resultVal 문자열
|
||||
*/
|
||||
public static String isNullToString(Object object) {
|
||||
String string = "";
|
||||
|
||||
if (object != null) {
|
||||
string = object.toString().trim();
|
||||
}
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
/**
|
||||
*<pre>
|
||||
* 인자로 받은 String이 null일 경우 ""로 리턴한다.
|
||||
* @param src null값일 가능성이 있는 String 값.
|
||||
* @return 만약 String이 null 값일 경우 ""로 바꾼 String 값.
|
||||
*</pre>
|
||||
*/
|
||||
public static String nullConvert(Object src) {
|
||||
//if (src != null && src.getClass().getName().equals("java.math.BigDecimal")) {
|
||||
if (src != null && src instanceof java.math.BigDecimal) {
|
||||
return ((BigDecimal) src).toString();
|
||||
}
|
||||
|
||||
if (src == null || src.equals("null")) {
|
||||
return "";
|
||||
} else {
|
||||
return ((String) src).trim();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*<pre>
|
||||
* 인자로 받은 String이 null일 경우 ""로 리턴한다.
|
||||
* @param src null값일 가능성이 있는 String 값.
|
||||
* @return 만약 String이 null 값일 경우 ""로 바꾼 String 값.
|
||||
*</pre>
|
||||
*/
|
||||
public static String nullConvert(String src) {
|
||||
|
||||
if (src == null || src.equals("null") || "".equals(src) || " ".equals(src)) {
|
||||
return "";
|
||||
} else {
|
||||
return src.trim();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*<pre>
|
||||
* 인자로 받은 String이 null일 경우 "0"로 리턴한다.
|
||||
* @param src null값일 가능성이 있는 String 값.
|
||||
* @return 만약 String이 null 값일 경우 "0"로 바꾼 String 값.
|
||||
*</pre>
|
||||
*/
|
||||
public static int zeroConvert(Object src) {
|
||||
|
||||
if (src == null || src.equals("null")) {
|
||||
return 0;
|
||||
} else {
|
||||
return Integer.parseInt(((String) src).trim());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*<pre>
|
||||
* 인자로 받은 String이 null일 경우 ""로 리턴한다.
|
||||
* @param src null값일 가능성이 있는 String 값.
|
||||
* @return 만약 String이 null 값일 경우 ""로 바꾼 String 값.
|
||||
*</pre>
|
||||
*/
|
||||
public static int zeroConvert(String src) {
|
||||
|
||||
if (src == null || src.equals("null") || "".equals(src) || " ".equals(src)) {
|
||||
return 0;
|
||||
} else {
|
||||
return Integer.parseInt(src.trim());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>문자열에서 {@link Character#isWhitespace(char)}에 정의된
|
||||
* 모든 공백문자를 제거한다.</p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtil.removeWhitespace(null) = null
|
||||
* StringUtil.removeWhitespace("") = ""
|
||||
* StringUtil.removeWhitespace("abc") = "abc"
|
||||
* StringUtil.removeWhitespace(" ab c ") = "abc"
|
||||
* </pre>
|
||||
*
|
||||
* @param str 공백문자가 제거도어야 할 문자열
|
||||
* @return the 공백문자가 제거된 문자열, null이 입력되면 <code>null</code>이 리턴
|
||||
*/
|
||||
public static String removeWhitespace(String str) {
|
||||
if (isEmpty(str)) {
|
||||
return str;
|
||||
}
|
||||
int sz = str.length();
|
||||
char[] chs = new char[sz];
|
||||
int count = 0;
|
||||
for (int i = 0; i < sz; i++) {
|
||||
if (!Character.isWhitespace(str.charAt(i))) {
|
||||
chs[count++] = str.charAt(i);
|
||||
}
|
||||
}
|
||||
if (count == sz) {
|
||||
return str;
|
||||
}
|
||||
|
||||
return new String(chs, 0, count);
|
||||
}
|
||||
|
||||
/**
|
||||
* Html 코드가 들어간 문서를 표시할때 태그에 손상없이 보이기 위한 메서드
|
||||
*
|
||||
* @param strString
|
||||
* @return HTML 태그를 치환한 문자열
|
||||
*/
|
||||
public static String checkHtmlView(String strString) {
|
||||
String strNew = "";
|
||||
|
||||
StringBuffer strTxt = new StringBuffer("");
|
||||
|
||||
char chrBuff;
|
||||
int len = strString.length();
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
chrBuff = (char) strString.charAt(i);
|
||||
|
||||
switch (chrBuff) {
|
||||
case '<':
|
||||
strTxt.append("<");
|
||||
break;
|
||||
case '>':
|
||||
strTxt.append(">");
|
||||
break;
|
||||
case '"':
|
||||
strTxt.append(""");
|
||||
break;
|
||||
case 10:
|
||||
strTxt.append("<br>");
|
||||
break;
|
||||
case ' ':
|
||||
strTxt.append(" ");
|
||||
break;
|
||||
//case '&' :
|
||||
//strTxt.append("&");
|
||||
//break;
|
||||
default:
|
||||
strTxt.append(chrBuff);
|
||||
}
|
||||
}
|
||||
|
||||
strNew = strTxt.toString();
|
||||
|
||||
return strNew;
|
||||
}
|
||||
|
||||
/**
|
||||
* 문자열을 지정한 분리자에 의해 배열로 리턴하는 메서드.
|
||||
* @param source 원본 문자열
|
||||
* @param separator 분리자
|
||||
* @return result 분리자로 나뉘어진 문자열 배열
|
||||
*/
|
||||
public static String[] split(String source, String separator) throws NullPointerException {
|
||||
String[] returnVal = null;
|
||||
int cnt = 1;
|
||||
|
||||
int index = source.indexOf(separator);
|
||||
int index0 = 0;
|
||||
while (index >= 0) {
|
||||
cnt++;
|
||||
index = source.indexOf(separator, index + 1);
|
||||
}
|
||||
returnVal = new String[cnt];
|
||||
cnt = 0;
|
||||
index = source.indexOf(separator);
|
||||
while (index >= 0) {
|
||||
returnVal[cnt] = source.substring(index0, index);
|
||||
index0 = index + 1;
|
||||
index = source.indexOf(separator, index + 1);
|
||||
cnt++;
|
||||
}
|
||||
returnVal[cnt] = source.substring(index0);
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>{@link String#toLowerCase()}를 이용하여 소문자로 변환한다.</p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtil.lowerCase(null) = null
|
||||
* StringUtil.lowerCase("") = ""
|
||||
* StringUtil.lowerCase("aBc") = "abc"
|
||||
* </pre>
|
||||
*
|
||||
* @param str 소문자로 변환되어야 할 문자열
|
||||
* @return 소문자로 변환된 문자열, null이 입력되면 <code>null</code> 리턴
|
||||
*/
|
||||
public static String lowerCase(String str) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return str.toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>{@link String#toUpperCase()}를 이용하여 대문자로 변환한다.</p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtil.upperCase(null) = null
|
||||
* StringUtil.upperCase("") = ""
|
||||
* StringUtil.upperCase("aBc") = "ABC"
|
||||
* </pre>
|
||||
*
|
||||
* @param str 대문자로 변환되어야 할 문자열
|
||||
* @return 대문자로 변환된 문자열, null이 입력되면 <code>null</code> 리턴
|
||||
*/
|
||||
public static String upperCase(String str) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return str.toUpperCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>입력된 String의 앞쪽에서 두번째 인자로 전달된 문자(stripChars)를 모두 제거한다.</p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtil.stripStart(null, *) = null
|
||||
* StringUtil.stripStart("", *) = ""
|
||||
* StringUtil.stripStart("abc", "") = "abc"
|
||||
* StringUtil.stripStart("abc", null) = "abc"
|
||||
* StringUtil.stripStart(" abc", null) = "abc"
|
||||
* StringUtil.stripStart("abc ", null) = "abc "
|
||||
* StringUtil.stripStart(" abc ", null) = "abc "
|
||||
* StringUtil.stripStart("yxabc ", "xyz") = "abc "
|
||||
* </pre>
|
||||
*
|
||||
* @param str 지정된 문자가 제거되어야 할 문자열
|
||||
* @param stripChars 제거대상 문자열
|
||||
* @return 지정된 문자가 제거된 문자열, null이 입력되면 <code>null</code> 리턴
|
||||
*/
|
||||
public static String stripStart(String str, String stripChars) {
|
||||
int strLen;
|
||||
if (str == null || (strLen = str.length()) == 0) {
|
||||
return str;
|
||||
}
|
||||
int start = 0;
|
||||
if (stripChars == null) {
|
||||
while ((start != strLen) && Character.isWhitespace(str.charAt(start))) {
|
||||
start++;
|
||||
}
|
||||
} else if (stripChars.length() == 0) {
|
||||
return str;
|
||||
} else {
|
||||
while ((start != strLen) && (stripChars.indexOf(str.charAt(start)) != -1)) {
|
||||
start++;
|
||||
}
|
||||
}
|
||||
|
||||
return str.substring(start);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>입력된 String의 뒤쪽에서 두번째 인자로 전달된 문자(stripChars)를 모두 제거한다.</p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtil.stripEnd(null, *) = null
|
||||
* StringUtil.stripEnd("", *) = ""
|
||||
* StringUtil.stripEnd("abc", "") = "abc"
|
||||
* StringUtil.stripEnd("abc", null) = "abc"
|
||||
* StringUtil.stripEnd(" abc", null) = " abc"
|
||||
* StringUtil.stripEnd("abc ", null) = "abc"
|
||||
* StringUtil.stripEnd(" abc ", null) = " abc"
|
||||
* StringUtil.stripEnd(" abcyx", "xyz") = " abc"
|
||||
* </pre>
|
||||
*
|
||||
* @param str 지정된 문자가 제거되어야 할 문자열
|
||||
* @param stripChars 제거대상 문자열
|
||||
* @return 지정된 문자가 제거된 문자열, null이 입력되면 <code>null</code> 리턴
|
||||
*/
|
||||
public static String stripEnd(String str, String stripChars) {
|
||||
int end;
|
||||
if (str == null || (end = str.length()) == 0) {
|
||||
return str;
|
||||
}
|
||||
|
||||
if (stripChars == null) {
|
||||
while ((end != 0) && Character.isWhitespace(str.charAt(end - 1))) {
|
||||
end--;
|
||||
}
|
||||
} else if (stripChars.length() == 0) {
|
||||
return str;
|
||||
} else {
|
||||
while ((end != 0) && (stripChars.indexOf(str.charAt(end - 1)) != -1)) {
|
||||
end--;
|
||||
}
|
||||
}
|
||||
|
||||
return str.substring(0, end);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>입력된 String의 앞, 뒤에서 두번째 인자로 전달된 문자(stripChars)를 모두 제거한다.</p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtil.strip(null, *) = null
|
||||
* StringUtil.strip("", *) = ""
|
||||
* StringUtil.strip("abc", null) = "abc"
|
||||
* StringUtil.strip(" abc", null) = "abc"
|
||||
* StringUtil.strip("abc ", null) = "abc"
|
||||
* StringUtil.strip(" abc ", null) = "abc"
|
||||
* StringUtil.strip(" abcyx", "xyz") = " abc"
|
||||
* </pre>
|
||||
*
|
||||
* @param str 지정된 문자가 제거되어야 할 문자열
|
||||
* @param stripChars 제거대상 문자열
|
||||
* @return 지정된 문자가 제거된 문자열, null이 입력되면 <code>null</code> 리턴
|
||||
*/
|
||||
public static String strip(String str, String stripChars) {
|
||||
if (isEmpty(str)) {
|
||||
return str;
|
||||
}
|
||||
|
||||
String srcStr = str;
|
||||
srcStr = stripStart(srcStr, stripChars);
|
||||
|
||||
return stripEnd(srcStr, stripChars);
|
||||
}
|
||||
|
||||
/**
|
||||
* 문자열을 지정한 분리자에 의해 지정된 길이의 배열로 리턴하는 메서드.
|
||||
* @param source 원본 문자열
|
||||
* @param separator 분리자
|
||||
* @param arraylength 배열 길이
|
||||
* @return 분리자로 나뉘어진 문자열 배열
|
||||
*/
|
||||
public static String[] split(String source, String separator, int arraylength) throws NullPointerException {
|
||||
String[] returnVal = new String[arraylength];
|
||||
int cnt = 0;
|
||||
int index0 = 0;
|
||||
int index = source.indexOf(separator);
|
||||
while (index >= 0 && cnt < (arraylength - 1)) {
|
||||
returnVal[cnt] = source.substring(index0, index);
|
||||
index0 = index + 1;
|
||||
index = source.indexOf(separator, index + 1);
|
||||
cnt++;
|
||||
}
|
||||
returnVal[cnt] = source.substring(index0);
|
||||
if (cnt < (arraylength - 1)) {
|
||||
for (int i = cnt + 1; i < arraylength; i++) {
|
||||
returnVal[i] = "";
|
||||
}
|
||||
}
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* 문자열 A에서 Z사이의 랜덤 문자열을 구하는 기능을 제공 시작문자열과 종료문자열 사이의 랜덤 문자열을 구하는 기능
|
||||
*
|
||||
* @param startChr
|
||||
* - 첫 문자
|
||||
* @param endChr
|
||||
* - 마지막문자
|
||||
* @return 랜덤문자
|
||||
* @exception MyException
|
||||
* @see
|
||||
*/
|
||||
public static String getRandomStr(char startChr, char endChr) {
|
||||
|
||||
int randomInt;
|
||||
String randomStr = null;
|
||||
|
||||
// 시작문자 및 종료문자를 아스키숫자로 변환한다.
|
||||
int startInt = Integer.valueOf(startChr);
|
||||
int endInt = Integer.valueOf(endChr);
|
||||
|
||||
// 시작문자열이 종료문자열보가 클경우
|
||||
if (startInt > endInt) {
|
||||
throw new IllegalArgumentException("Start String: " + startChr + " End String: " + endChr);
|
||||
}
|
||||
|
||||
// 랜덤 객체 생성
|
||||
SecureRandom rnd = new SecureRandom();
|
||||
|
||||
do {
|
||||
// 시작문자 및 종료문자 중에서 랜덤 숫자를 발생시킨다.
|
||||
randomInt = rnd.nextInt(endInt + 1);
|
||||
} while (randomInt < startInt); // 입력받은 문자 'A'(65)보다 작으면 다시 랜덤 숫자 발생.
|
||||
|
||||
// 랜덤 숫자를 문자로 변환 후 스트링으로 다시 변환
|
||||
randomStr = (char) randomInt + "";
|
||||
|
||||
// 랜덤문자열를 리턴
|
||||
return randomStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 문자열을 다양한 문자셋(EUC-KR[KSC5601],UTF-8..)을 사용하여 인코딩하는 기능 역으로 디코딩하여 원래의 문자열을
|
||||
* 복원하는 기능을 제공함 String temp = new String(문자열.getBytes("바꾸기전 인코딩"),"바꿀 인코딩");
|
||||
* String temp = new String(문자열.getBytes("8859_1"),"KSC5601"); => UTF-8 에서
|
||||
* EUC-KR
|
||||
*
|
||||
* @param srcString
|
||||
* - 문자열
|
||||
* @param srcCharsetNm
|
||||
* - 원래 CharsetNm
|
||||
* @param charsetNm
|
||||
* - CharsetNm
|
||||
* @return 인(디)코딩 문자열
|
||||
* @exception MyException
|
||||
* @see
|
||||
*/
|
||||
public static String getEncdDcd(String srcString, String srcCharsetNm, String cnvrCharsetNm) {
|
||||
|
||||
String rtnStr = null;
|
||||
|
||||
if (srcString == null)
|
||||
return null;
|
||||
|
||||
try {
|
||||
rtnStr = new String(srcString.getBytes(srcCharsetNm), cnvrCharsetNm);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
rtnStr = null;
|
||||
}
|
||||
|
||||
return rtnStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 특수문자를 웹 브라우저에서 정상적으로 보이기 위해 특수문자를 처리('<' -> & lT)하는 기능이다
|
||||
* @param srcString - '<'
|
||||
* @return 변환문자열('<' -> "<"
|
||||
* @exception MyException
|
||||
* @see
|
||||
*/
|
||||
public static String getSpclStrCnvr(String srcString) {
|
||||
|
||||
String rtnStr = null;
|
||||
|
||||
try {
|
||||
StringBuffer strTxt = new StringBuffer("");
|
||||
|
||||
char chrBuff;
|
||||
int len = srcString.length();
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
chrBuff = (char) srcString.charAt(i);
|
||||
|
||||
switch (chrBuff) {
|
||||
case '<':
|
||||
strTxt.append("<");
|
||||
break;
|
||||
case '>':
|
||||
strTxt.append(">");
|
||||
break;
|
||||
case '&':
|
||||
strTxt.append("&");
|
||||
break;
|
||||
default:
|
||||
strTxt.append(chrBuff);
|
||||
}
|
||||
}
|
||||
|
||||
rtnStr = strTxt.toString();
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.debug("{}", e);
|
||||
}
|
||||
|
||||
return rtnStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 응용어플리케이션에서 고유값을 사용하기 위해 시스템에서17자리의TIMESTAMP값을 구하는 기능
|
||||
*
|
||||
* @param
|
||||
* @return Timestamp 값
|
||||
* @exception MyException
|
||||
* @see
|
||||
*/
|
||||
public static String getTimeStamp() {
|
||||
|
||||
String rtnStr = null;
|
||||
|
||||
// 문자열로 변환하기 위한 패턴 설정(년도-월-일 시:분:초:초(자정이후 초))
|
||||
String pattern = "yyyyMMddhhmmssSSS";
|
||||
|
||||
SimpleDateFormat sdfCurrent = new SimpleDateFormat(pattern, Locale.KOREA);
|
||||
Timestamp ts = new Timestamp(System.currentTimeMillis());
|
||||
|
||||
rtnStr = sdfCurrent.format(ts.getTime());
|
||||
|
||||
return rtnStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* html의 특수문자를 표현하기 위해
|
||||
*
|
||||
* @param srcString
|
||||
* @return String
|
||||
* @exception Exception
|
||||
* @see
|
||||
*/
|
||||
public static String getHtmlStrCnvr(String srcString) {
|
||||
|
||||
String tmpString = srcString;
|
||||
|
||||
tmpString = tmpString.replaceAll("<", "<");
|
||||
tmpString = tmpString.replaceAll(">", ">");
|
||||
tmpString = tmpString.replaceAll("&", "&");
|
||||
tmpString = tmpString.replaceAll(" ", " ");
|
||||
tmpString = tmpString.replaceAll("'", "\'");
|
||||
tmpString = tmpString.replaceAll(""", "\"");
|
||||
|
||||
return tmpString;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>날짜 형식의 문자열 내부에 마이너스 character(-)를 추가한다.</p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtil.addMinusChar("20100901") = "2010-09-01"
|
||||
* </pre>
|
||||
*
|
||||
* @param date 입력받는 문자열
|
||||
* @return " - "가 추가된 입력문자열
|
||||
*/
|
||||
public static String addMinusChar(String date) {
|
||||
if (date.length() == 8)
|
||||
return date.substring(0, 4).concat("-").concat(date.substring(4, 6)).concat("-").concat(date.substring(6, 8));
|
||||
else
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
package kcg.faics.cmmn.egov.util;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* 교차접속 스크립트 공격 취약성 방지(파라미터 문자열 교체)
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2011.10.10 한성곤 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
public class EgovWebUtil {
|
||||
public static String clearXSSMinimum(String value) {
|
||||
if (value == null || value.trim().equals("")) {
|
||||
return "";
|
||||
}
|
||||
|
||||
String returnValue = value;
|
||||
|
||||
returnValue = returnValue.replaceAll("&", "&");
|
||||
returnValue = returnValue.replaceAll("<", "<");
|
||||
returnValue = returnValue.replaceAll(">", ">");
|
||||
returnValue = returnValue.replaceAll("\"", """);
|
||||
returnValue = returnValue.replaceAll("\'", "'");
|
||||
returnValue = returnValue.replaceAll("[.]", ".");
|
||||
returnValue = returnValue.replaceAll("%2E", ".");
|
||||
returnValue = returnValue.replaceAll("%2F", "/");
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public static String clearXSSMaximum(String value) {
|
||||
String returnValue = value;
|
||||
returnValue = clearXSSMinimum(returnValue);
|
||||
|
||||
returnValue = returnValue.replaceAll("%00", null);
|
||||
|
||||
returnValue = returnValue.replaceAll("%", "%");
|
||||
|
||||
// \\. => .
|
||||
|
||||
returnValue = returnValue.replaceAll("\\.\\./", ""); // ../
|
||||
returnValue = returnValue.replaceAll("\\.\\.\\\\", ""); // ..\
|
||||
returnValue = returnValue.replaceAll("\\./", ""); // ./
|
||||
returnValue = returnValue.replaceAll("%2F", "");
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public static String filePathBlackList(String value) {
|
||||
String returnValue = value;
|
||||
if (returnValue == null || returnValue.trim().equals("")) {
|
||||
return "";
|
||||
}
|
||||
|
||||
returnValue = returnValue.replaceAll("\\.\\./", ""); // ../
|
||||
returnValue = returnValue.replaceAll("\\.\\.\\\\", ""); // ..\
|
||||
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("/", "");
|
||||
// Findbugs 수정 : replaceAll은 첫 번째 인자값을 정규식으로 취급하기때문에 역슬래쉬 1개를 표현하기 위해 4개를 입력해야 한다.
|
||||
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(";", "");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,242 @@
|
|||
package kcg.faics.cmmn.egov.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
||||
/**
|
||||
* @Class Name : FileVO.java
|
||||
* @Description : 파일정보 처리를 위한 VO 클래스
|
||||
* @Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용 ------- ------- ------------------- 2009. 3. 25.
|
||||
* 이삼섭
|
||||
*
|
||||
* @author 공통 서비스 개발팀 이삼섭
|
||||
* @since 2009. 3. 25.
|
||||
* @version
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
public class FileVO implements Serializable {
|
||||
|
||||
/**
|
||||
* serialVersion UID
|
||||
*/
|
||||
private static final long serialVersionUID = -287950405903719128L;
|
||||
/**
|
||||
* 첨부파일 아이디
|
||||
*/
|
||||
public String atchFileId = "";
|
||||
/**
|
||||
* 생성일자
|
||||
*/
|
||||
public String creatDt = "";
|
||||
/**
|
||||
* 파일내용
|
||||
*/
|
||||
public String fileCn = "";
|
||||
/**
|
||||
* 파일확장자
|
||||
*/
|
||||
public String fileExtsn = "";
|
||||
/**
|
||||
* 파일크기
|
||||
*/
|
||||
public String fileMg = "";
|
||||
/**
|
||||
* 파일연번
|
||||
*/
|
||||
public String fileSn = "";
|
||||
/**
|
||||
* 파일저장경로
|
||||
*/
|
||||
public String fileStreCours = "";
|
||||
/**
|
||||
* 원파일명
|
||||
*/
|
||||
public String orignlFileNm = "";
|
||||
/**
|
||||
* 저장파일명
|
||||
*/
|
||||
public String streFileNm = "";
|
||||
|
||||
/**
|
||||
* atchFileId attribute를 리턴한다.
|
||||
*
|
||||
* @return the atchFileId
|
||||
*/
|
||||
public String getAtchFileId() {
|
||||
return atchFileId;
|
||||
}
|
||||
|
||||
/**
|
||||
* atchFileId attribute 값을 설정한다.
|
||||
*
|
||||
* @param atchFileId
|
||||
* the atchFileId to set
|
||||
*/
|
||||
public void setAtchFileId(String atchFileId) {
|
||||
this.atchFileId = atchFileId;
|
||||
}
|
||||
|
||||
/**
|
||||
* creatDt attribute를 리턴한다.
|
||||
*
|
||||
* @return the creatDt
|
||||
*/
|
||||
public String getCreatDt() {
|
||||
return creatDt;
|
||||
}
|
||||
|
||||
/**
|
||||
* creatDt attribute 값을 설정한다.
|
||||
*
|
||||
* @param creatDt
|
||||
* the creatDt to set
|
||||
*/
|
||||
public void setCreatDt(String creatDt) {
|
||||
this.creatDt = creatDt;
|
||||
}
|
||||
|
||||
/**
|
||||
* fileCn attribute를 리턴한다.
|
||||
*
|
||||
* @return the fileCn
|
||||
*/
|
||||
public String getFileCn() {
|
||||
return fileCn;
|
||||
}
|
||||
|
||||
/**
|
||||
* fileCn attribute 값을 설정한다.
|
||||
*
|
||||
* @param fileCn
|
||||
* the fileCn to set
|
||||
*/
|
||||
public void setFileCn(String fileCn) {
|
||||
this.fileCn = fileCn;
|
||||
}
|
||||
|
||||
/**
|
||||
* fileExtsn attribute를 리턴한다.
|
||||
*
|
||||
* @return the fileExtsn
|
||||
*/
|
||||
public String getFileExtsn() {
|
||||
return fileExtsn;
|
||||
}
|
||||
|
||||
/**
|
||||
* fileExtsn attribute 값을 설정한다.
|
||||
*
|
||||
* @param fileExtsn
|
||||
* the fileExtsn to set
|
||||
*/
|
||||
public void setFileExtsn(String fileExtsn) {
|
||||
this.fileExtsn = fileExtsn;
|
||||
}
|
||||
|
||||
/**
|
||||
* fileMg attribute를 리턴한다.
|
||||
*
|
||||
* @return the fileMg
|
||||
*/
|
||||
public String getFileMg() {
|
||||
return fileMg;
|
||||
}
|
||||
|
||||
/**
|
||||
* fileMg attribute 값을 설정한다.
|
||||
*
|
||||
* @param fileMg
|
||||
* the fileMg to set
|
||||
*/
|
||||
public void setFileMg(String fileMg) {
|
||||
this.fileMg = fileMg;
|
||||
}
|
||||
|
||||
/**
|
||||
* fileSn attribute를 리턴한다.
|
||||
*
|
||||
* @return the fileSn
|
||||
*/
|
||||
public String getFileSn() {
|
||||
return fileSn;
|
||||
}
|
||||
|
||||
/**
|
||||
* fileSn attribute 값을 설정한다.
|
||||
*
|
||||
* @param fileSn
|
||||
* the fileSn to set
|
||||
*/
|
||||
public void setFileSn(String fileSn) {
|
||||
this.fileSn = fileSn;
|
||||
}
|
||||
|
||||
/**
|
||||
* fileStreCours attribute를 리턴한다.
|
||||
*
|
||||
* @return the fileStreCours
|
||||
*/
|
||||
public String getFileStreCours() {
|
||||
return fileStreCours;
|
||||
}
|
||||
|
||||
/**
|
||||
* fileStreCours attribute 값을 설정한다.
|
||||
*
|
||||
* @param fileStreCours
|
||||
* the fileStreCours to set
|
||||
*/
|
||||
public void setFileStreCours(String fileStreCours) {
|
||||
this.fileStreCours = fileStreCours;
|
||||
}
|
||||
|
||||
/**
|
||||
* orignlFileNm attribute를 리턴한다.
|
||||
*
|
||||
* @return the orignlFileNm
|
||||
*/
|
||||
public String getOrignlFileNm() {
|
||||
return orignlFileNm;
|
||||
}
|
||||
|
||||
/**
|
||||
* orignlFileNm attribute 값을 설정한다.
|
||||
*
|
||||
* @param orignlFileNm
|
||||
* the orignlFileNm to set
|
||||
*/
|
||||
public void setOrignlFileNm(String orignlFileNm) {
|
||||
this.orignlFileNm = orignlFileNm;
|
||||
}
|
||||
|
||||
/**
|
||||
* streFileNm attribute를 리턴한다.
|
||||
*
|
||||
* @return the streFileNm
|
||||
*/
|
||||
public String getStreFileNm() {
|
||||
return streFileNm;
|
||||
}
|
||||
|
||||
/**
|
||||
* streFileNm attribute 값을 설정한다.
|
||||
*
|
||||
* @param streFileNm
|
||||
* the streFileNm to set
|
||||
*/
|
||||
public void setStreFileNm(String streFileNm) {
|
||||
this.streFileNm = streFileNm;
|
||||
}
|
||||
|
||||
/**
|
||||
* toString 메소드를 대치한다.
|
||||
*/
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
/**
|
||||
* AbstractExcelGenerator.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 14.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 14. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
package kcg.faics.cmmn.excel;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.poi.xssf.usermodel.XSSFCell;
|
||||
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
|
||||
import org.apache.poi.xssf.usermodel.XSSFRow;
|
||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
/**
|
||||
* AbstractExcelGenerator.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 14.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 14. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractExcelExport implements ExcelExport {
|
||||
|
||||
/* 기본적으로 3번 라인이 시작라인 */
|
||||
protected int firstRow = 2;
|
||||
protected String template = null;
|
||||
|
||||
/* 파라미터 맵 */
|
||||
protected Map<String, Object> document = null;
|
||||
|
||||
|
||||
/**
|
||||
* 엑셀을 생성한다.
|
||||
*
|
||||
* @param document 엑셀 파일을 생성하기 위한 데이터셋
|
||||
* @return Workbook 객체
|
||||
*/
|
||||
public abstract XSSFWorkbook makeExcel(XSSFWorkbook wb);
|
||||
|
||||
/**
|
||||
* 타이틀을 설정한다.
|
||||
*
|
||||
* @param 파라미터 파라미터설명
|
||||
*/
|
||||
protected void setTitleRow(XSSFSheet sheet, XSSFCellStyle style, String title) {
|
||||
|
||||
XSSFRow row = sheet.createRow(0);
|
||||
XSSFCell cell = row.createCell(0);
|
||||
|
||||
cell.setCellValue(title);
|
||||
if (style != null) {
|
||||
|
||||
}
|
||||
cell.setCellStyle(style);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* ExcelExport.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 17.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 17. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
package kcg.faics.cmmn.excel;
|
||||
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
/**
|
||||
* ExcelExport.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 17.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 17. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
public interface ExcelExport {
|
||||
public abstract XSSFWorkbook makeExcel(XSSFWorkbook wb);
|
||||
}
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
package kcg.faics.cmmn.excel;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.poi.xssf.usermodel.XSSFCell;
|
||||
import org.apache.poi.xssf.usermodel.XSSFRow;
|
||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
/**
|
||||
* 엑셀 변환 클래스.
|
||||
*
|
||||
* @author kimnomin
|
||||
*
|
||||
* @param <T> 데이터 VO
|
||||
*/
|
||||
public class ExcelExporter<T> extends AbstractExcelExport {
|
||||
|
||||
/**
|
||||
* 헤더 맵 객체.
|
||||
* <해당 VO의 멤버변수명, 값> 형태
|
||||
* ex) {title: 제목}
|
||||
*
|
||||
* 해당 맵 객체에 입력된 순서대로 엑셀이 생성된다.
|
||||
*
|
||||
* !! 주의 !! 해당 맵 객체의 key가 데이터 VO의 멤버변수명과 동일해야 한다.
|
||||
*/
|
||||
private LinkedHashMap<String, String> headers;
|
||||
/**
|
||||
* 데이터 VO List.
|
||||
*/
|
||||
private List<T> list;
|
||||
/**
|
||||
* 엑셀 내 표현될 제목.
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 생성자.
|
||||
*
|
||||
* @param headers 헤더 맵 객체.
|
||||
* @param list 데이터 VO List.
|
||||
* @param title 엑셀 내 표현될 제목.
|
||||
*/
|
||||
public ExcelExporter(final LinkedHashMap<String, String> headers, final List<T> list,
|
||||
final String title) {
|
||||
super();
|
||||
this.headers = headers;
|
||||
this.list = list;
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public XSSFWorkbook makeExcel(final XSSFWorkbook wb) {
|
||||
if (list.size() <= 0 || headers.size() <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
XSSFSheet sheet = null;
|
||||
XSSFRow row = null;
|
||||
XSSFCell cell = null;
|
||||
|
||||
ExcelStyle style = new ExcelStyle(wb);
|
||||
sheet = wb.createSheet(title);
|
||||
setTitleRow(sheet, style.titleStyle, title);
|
||||
|
||||
Set<String> keySet = headers.keySet();
|
||||
|
||||
// 헤더
|
||||
int loopIdx = 0;
|
||||
row = sheet.createRow(firstRow);
|
||||
cell = row.createCell(loopIdx);
|
||||
cell.setCellValue("번호");
|
||||
cell.setCellStyle(style.headerStyle);
|
||||
loopIdx++;
|
||||
for (String key : keySet) {
|
||||
cell = row.createCell(loopIdx);
|
||||
cell.setCellValue(headers.get(key));
|
||||
cell.setCellStyle(style.headerStyle);
|
||||
loopIdx++;
|
||||
}
|
||||
|
||||
// 값
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
T t = list.get(i);
|
||||
row = sheet.createRow(firstRow + 1 + i);
|
||||
|
||||
loopIdx = 0;
|
||||
cell = row.createCell(loopIdx);
|
||||
cell.setCellValue(i + 1);
|
||||
cell.setCellStyle(style.normalTextStyle);
|
||||
loopIdx++;
|
||||
for (String key : keySet) {
|
||||
String value = "";
|
||||
|
||||
try {
|
||||
if (t instanceof Map<?, ?>) {
|
||||
Object o = ((Map<?, ?>) t).get(key);
|
||||
if (o instanceof String) {
|
||||
value = o.toString();
|
||||
} else if (o instanceof Integer || o instanceof Double) {
|
||||
value = String.valueOf(o);
|
||||
} else if (o instanceof BigDecimal) {
|
||||
value = ((BigDecimal) o).toString();
|
||||
}
|
||||
} else {
|
||||
Field f = t.getClass().getDeclaredField(key);
|
||||
f.setAccessible(true);
|
||||
Object val = f.get(t);
|
||||
if (val != null) {
|
||||
value = val.toString();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
cell = row.createCell(loopIdx);
|
||||
cell.setCellValue(value);
|
||||
cell.setCellStyle(style.normalTextStyle);
|
||||
loopIdx++;
|
||||
}
|
||||
}
|
||||
|
||||
return wb;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,128 @@
|
|||
package kcg.faics.cmmn.excel;
|
||||
|
||||
import org.apache.poi.ss.usermodel.BorderStyle;
|
||||
import org.apache.poi.ss.usermodel.CellStyle;
|
||||
import org.apache.poi.ss.usermodel.DataFormat;
|
||||
import org.apache.poi.ss.usermodel.Font;
|
||||
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
|
||||
import org.apache.poi.xssf.usermodel.XSSFColor;
|
||||
import org.apache.poi.xssf.usermodel.XSSFFont;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
/**
|
||||
* ExcelStyle.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 14.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 14. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
public class ExcelStyle {
|
||||
|
||||
private XSSFFont normalFont;
|
||||
private XSSFFont boldFont;
|
||||
private XSSFFont titleFont;
|
||||
|
||||
private XSSFColor yellowColor = new XSSFColor(new java.awt.Color(255, 255, 238));
|
||||
private XSSFColor grayColor = new XSSFColor(new java.awt.Color(238, 238, 238));
|
||||
private XSSFColor cyanColor = new XSSFColor(new java.awt.Color(238, 255, 255));
|
||||
|
||||
private DataFormat numericFormat;
|
||||
|
||||
public XSSFCellStyle titleStyle;
|
||||
public XSSFCellStyle headerStyle;
|
||||
public XSSFCellStyle firstRowTextStyle;
|
||||
public XSSFCellStyle firstRowNumericStyle;
|
||||
public XSSFCellStyle normalTextStyle;
|
||||
public XSSFCellStyle normalLeftBoldTextStyle;
|
||||
public XSSFCellStyle normalNumericStyle;
|
||||
|
||||
|
||||
public ExcelStyle(XSSFWorkbook wb) {
|
||||
defindeStyle(wb);
|
||||
}
|
||||
|
||||
private void defindeStyle(XSSFWorkbook wb) {
|
||||
|
||||
numericFormat = wb.createDataFormat();
|
||||
|
||||
titleStyle = (XSSFCellStyle) wb.createCellStyle();
|
||||
headerStyle = (XSSFCellStyle) wb.createCellStyle();
|
||||
firstRowTextStyle = (XSSFCellStyle) wb.createCellStyle();
|
||||
firstRowNumericStyle = (XSSFCellStyle) wb.createCellStyle();
|
||||
normalTextStyle = (XSSFCellStyle) wb.createCellStyle();
|
||||
normalLeftBoldTextStyle = (XSSFCellStyle) wb.createCellStyle();
|
||||
normalNumericStyle = (XSSFCellStyle) wb.createCellStyle();
|
||||
|
||||
normalFont = (XSSFFont) wb.createFont();
|
||||
normalFont.setFontName("돋음");
|
||||
normalFont.setFontHeightInPoints((short) 9);
|
||||
normalFont.setBoldweight(Font.BOLDWEIGHT_NORMAL);
|
||||
|
||||
boldFont = (XSSFFont) wb.createFont();
|
||||
boldFont.setFontName("돋음");
|
||||
boldFont.setFontHeightInPoints((short) 9);
|
||||
boldFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
|
||||
|
||||
titleFont = (XSSFFont) wb.createFont();
|
||||
titleFont.setFontName("돋음");
|
||||
titleFont.setFontHeightInPoints((short) 12);
|
||||
titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
|
||||
|
||||
titleStyle.setFont(titleFont);
|
||||
titleStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
|
||||
|
||||
headerStyle.setAlignment(CellStyle.ALIGN_CENTER);
|
||||
headerStyle.setFont(boldFont);
|
||||
headerStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
|
||||
headerStyle.setBorderTop(BorderStyle.HAIR);
|
||||
headerStyle.setBorderLeft(BorderStyle.HAIR);
|
||||
headerStyle.setBorderRight(BorderStyle.HAIR);
|
||||
headerStyle.setBorderBottom(BorderStyle.HAIR);
|
||||
headerStyle.setFillForegroundColor(grayColor);
|
||||
headerStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
|
||||
|
||||
firstRowTextStyle.setAlignment(CellStyle.ALIGN_CENTER);
|
||||
firstRowTextStyle.setFont(normalFont);
|
||||
firstRowTextStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
|
||||
firstRowTextStyle.setBorderTop(BorderStyle.HAIR);
|
||||
firstRowTextStyle.setBorderLeft(BorderStyle.HAIR);
|
||||
firstRowTextStyle.setBorderRight(BorderStyle.HAIR);
|
||||
firstRowTextStyle.setBorderBottom(BorderStyle.HAIR);
|
||||
firstRowTextStyle.setFillForegroundColor(yellowColor);
|
||||
firstRowTextStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
|
||||
|
||||
firstRowNumericStyle.setAlignment(CellStyle.ALIGN_CENTER);
|
||||
firstRowNumericStyle.setFont(normalFont);
|
||||
firstRowNumericStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
|
||||
firstRowNumericStyle.setBorderTop(BorderStyle.HAIR);
|
||||
firstRowNumericStyle.setBorderLeft(BorderStyle.HAIR);
|
||||
firstRowNumericStyle.setBorderRight(BorderStyle.HAIR);
|
||||
firstRowNumericStyle.setBorderBottom(BorderStyle.HAIR);
|
||||
firstRowNumericStyle.setFillForegroundColor(yellowColor);
|
||||
firstRowNumericStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
|
||||
firstRowNumericStyle.setDataFormat(numericFormat.getFormat("#,###"));
|
||||
|
||||
normalTextStyle.setAlignment(CellStyle.ALIGN_CENTER);
|
||||
normalTextStyle.setFont(normalFont);
|
||||
normalTextStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
|
||||
normalTextStyle.setBorderTop(BorderStyle.HAIR);
|
||||
normalTextStyle.setBorderLeft(BorderStyle.HAIR);
|
||||
normalTextStyle.setBorderRight(BorderStyle.HAIR);
|
||||
normalTextStyle.setBorderBottom(BorderStyle.HAIR);
|
||||
|
||||
|
||||
normalNumericStyle.setAlignment(CellStyle.ALIGN_CENTER);
|
||||
normalNumericStyle.setFont(normalFont);
|
||||
normalNumericStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
|
||||
normalNumericStyle.setBorderTop(BorderStyle.HAIR);
|
||||
normalNumericStyle.setBorderLeft(BorderStyle.HAIR);
|
||||
normalNumericStyle.setBorderRight(BorderStyle.HAIR);
|
||||
normalNumericStyle.setBorderBottom(BorderStyle.HAIR);
|
||||
normalNumericStyle.setDataFormat(numericFormat.getFormat("#,###"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
/**
|
||||
* ExcelView.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 14.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 14. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
package kcg.faics.cmmn.excel;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.poi.xssf.usermodel.XSSFCell;
|
||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
import egovframework.rte.fdl.excel.util.AbstractPOIExcelView;
|
||||
|
||||
/**
|
||||
* ExcelView.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 14.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 14. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
public class ExcelView extends AbstractPOIExcelView {
|
||||
|
||||
/**
|
||||
* 엑셀파일을 다운로드한다.
|
||||
*
|
||||
* @param model Model객체
|
||||
* @param model Model객체
|
||||
* @param model Model객체
|
||||
* @param model Model객체
|
||||
*/
|
||||
@Override
|
||||
protected void buildExcelDocument(Map<String, Object> model, XSSFWorkbook wb, HttpServletRequest req, HttpServletResponse res) throws Exception {
|
||||
|
||||
if(model.get("filename") != null){
|
||||
String userAgent = req.getHeader("User-Agent");
|
||||
String fileName = (String)model.get("filename");
|
||||
if(userAgent.indexOf("MSIE") > -1){
|
||||
fileName = URLEncoder.encode(fileName, "utf-8");
|
||||
}else{
|
||||
fileName = new String(fileName.getBytes("utf-8"), "iso-8859-1");
|
||||
}
|
||||
model.put("filename", fileName);
|
||||
}
|
||||
|
||||
ExcelExport export = (ExcelExport) model.get("excel");
|
||||
try {
|
||||
export.makeExcel(wb);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
XSSFSheet sheet = wb.createSheet("sheet1");
|
||||
XSSFCell cell = getCell(sheet, 0, 0);
|
||||
setText(cell, "Error");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* 엑셀 Export 관련 패키지.
|
||||
*/
|
||||
/**
|
||||
* @author kimnomin
|
||||
*
|
||||
*/
|
||||
package kcg.faics.cmmn.excel;
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
package kcg.faics.cmmn.file;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
import javax.activation.MimetypesFileTypeMap;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 파일 반환 관련 클래스.
|
||||
*
|
||||
* @author kimnomin
|
||||
*
|
||||
*/
|
||||
public final class FileResponser {
|
||||
|
||||
/**
|
||||
* 생성자.
|
||||
*/
|
||||
private FileResponser() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 브라우저 구분을 반환한다.
|
||||
*
|
||||
* @param request
|
||||
* HttpServletRequest 객체
|
||||
* @return 브라우저 구분
|
||||
*/
|
||||
private static String getBrowser(final 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
|
||||
* HttpServletRequest 객체
|
||||
* @param response
|
||||
* HttpServletResponse 객체
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
private static void setDisposition(final String filename,
|
||||
final HttpServletRequest request, final HttpServletResponse response)
|
||||
throws Exception {
|
||||
String browser = getBrowser(request);
|
||||
|
||||
String dispositionPrefix = "inline; 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");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일 반환을 위해 Response 객체를 설정한다.
|
||||
*
|
||||
* @param file 파일 객체
|
||||
* @param fileOrgName 실제 파일명
|
||||
* @param request HttpServletRequest 객체
|
||||
* @param response HttpServletResponse 객체
|
||||
*/
|
||||
public static void setResponse(final File file,
|
||||
final String fileOrgName,
|
||||
final HttpServletRequest request, final HttpServletResponse response) {
|
||||
if (file == null || request == null || response == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
MimetypesFileTypeMap mimeUtil = new MimetypesFileTypeMap();
|
||||
String mimeType = mimeUtil.getContentType(fileOrgName);
|
||||
response.setContentType(mimeType);
|
||||
response.setContentLength((int) file.length());
|
||||
try {
|
||||
setDisposition(fileOrgName, request, response);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,135 @@
|
|||
/**
|
||||
* FileUploadUtil.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 28.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 28. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
package kcg.faics.cmmn.file;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import kcg.faics.cmmn.egov.EgovResourceCloseHelper;
|
||||
import kcg.faics.cmmn.egov.file.EgovFileMngUtil;
|
||||
import kcg.faics.cmmn.egov.util.EgovStringUtil;
|
||||
import kcg.faics.cmmn.egov.util.EgovWebUtil;
|
||||
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import egovframework.rte.fdl.property.EgovPropertyService;
|
||||
|
||||
/**
|
||||
* FileUploadUtil.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 28.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 28. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
@Component("fileUploadUtil")
|
||||
public class FileUploadUtil extends EgovFileMngUtil {
|
||||
|
||||
/**
|
||||
* 프로퍼티 서비스.
|
||||
*/
|
||||
@Resource(name = "propertiesService")
|
||||
protected EgovPropertyService propertyService;
|
||||
|
||||
/** Buffer size */
|
||||
public static final int BUFFER_SIZE = 8192;
|
||||
|
||||
/**
|
||||
* 파일 분리 문자.
|
||||
*/
|
||||
public static final String SEPERATOR = File.separator;
|
||||
|
||||
/**
|
||||
* MultipartFile을 서버에 저장한다.
|
||||
*
|
||||
* @param mFile
|
||||
* 파일 객체
|
||||
* @param path
|
||||
* 파일이 저장될 경로 Global Property명
|
||||
* @return 저장된 파일명
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
public String uploadWithExt(final MultipartFile mFile, final String path) throws Exception {
|
||||
String storePathString = "";
|
||||
if ("".equals(path) || path == null) {
|
||||
storePathString = propertyService.getString("Globals.fileStorePath");
|
||||
} else {
|
||||
storePathString = propertyService.getString(path);
|
||||
}
|
||||
|
||||
String tmp = mFile.getOriginalFilename();
|
||||
|
||||
if (tmp.lastIndexOf("\\") >= 0) {
|
||||
tmp = tmp.substring(tmp.lastIndexOf("\\") + 1);
|
||||
}
|
||||
|
||||
//String ext = "." + tmp.substring(tmp.lastIndexOf(".") + 1, tmp.length()).toLowerCase();
|
||||
String ext = FilenameUtils.getExtension(tmp);
|
||||
String saveName = EgovStringUtil.getTimeStamp() + "." + ext;
|
||||
saveName = super.makeNewFileName(storePathString, saveName);
|
||||
//saveName = saveName.substring(0, saveName.length() - 3) + ext;
|
||||
|
||||
if (mFile.getSize() > 0) {
|
||||
InputStream is = null;
|
||||
try {
|
||||
is = mFile.getInputStream();
|
||||
saveFile(is, new File(EgovWebUtil.filePathBlackList(storePathString + saveName)));
|
||||
} finally {
|
||||
if (is != null) {
|
||||
is.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
return saveName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stream으로부터 파일을 저장함.
|
||||
* @param is InputStream
|
||||
* @param file File
|
||||
* @throws IOException
|
||||
*/
|
||||
private long saveFile(final InputStream is, final File file) throws IOException {
|
||||
// 디렉토리 생성
|
||||
if (!file.getParentFile().exists()) {
|
||||
file.getParentFile().mkdirs();
|
||||
}
|
||||
|
||||
OutputStream os = null;
|
||||
long size = 0L;
|
||||
|
||||
try {
|
||||
os = new FileOutputStream(file);
|
||||
|
||||
int bytesRead = 0;
|
||||
byte[] buffer = new byte[BUFFER_SIZE];
|
||||
|
||||
while ((bytesRead = is.read(buffer, 0, BUFFER_SIZE)) != -1) {
|
||||
size += bytesRead;
|
||||
os.write(buffer, 0, bytesRead);
|
||||
}
|
||||
} finally {
|
||||
EgovResourceCloseHelper.close(os);
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* 파일관련 Package.
|
||||
*/
|
||||
/**
|
||||
* @author kimnomin
|
||||
*
|
||||
*/
|
||||
package kcg.faics.cmmn.file;
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package kcg.faics.cmmn.json;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider;
|
||||
|
||||
|
||||
/**
|
||||
* CustomObjectMapper.java
|
||||
* @author 임새미
|
||||
* @since 2016. 9. 29.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 9. 29. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
public class CustomObjectMapper extends ObjectMapper {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public CustomObjectMapper() {
|
||||
DefaultSerializerProvider.Impl sp = new DefaultSerializerProvider.Impl();
|
||||
sp.setNullValueSerializer(new NullSerializer());
|
||||
this.setSerializerProvider(sp);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package kcg.faics.cmmn.json;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
|
||||
|
||||
/**
|
||||
* NullSerializer.java
|
||||
* @author 임새미
|
||||
* @since 2016. 9. 29.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 9. 29. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
public class NullSerializer extends JsonSerializer<Object> {
|
||||
@Override
|
||||
public void serialize(Object o, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
|
||||
jsonGenerator.writeString("");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,369 @@
|
|||
/**
|
||||
* CommonService.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 13.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 13. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
package kcg.faics.cmmn.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import kcg.faics.cmmn.vo.CodeVO;
|
||||
|
||||
/**
|
||||
* 코드 관련 Service Interface.
|
||||
*
|
||||
* @author kimnomin
|
||||
*
|
||||
*/
|
||||
public interface CodeService {
|
||||
/**
|
||||
* 목록 중 전체를 표현하는 값.
|
||||
*/
|
||||
String LIST_ALL_VAL = "ALL";
|
||||
/**
|
||||
* 목록 중 전체를 표현하는 문자열.
|
||||
*/
|
||||
String LIST_ALL_STR = "전체";
|
||||
/**
|
||||
* 권한 대분류코드.
|
||||
*/
|
||||
String CODE1_AUTH = "AUTH";
|
||||
/**
|
||||
* 소속 대분류코드.
|
||||
*/
|
||||
String CODE1_PLACE1 = "C001";
|
||||
/**
|
||||
* 계급 대분류 코드.
|
||||
*/
|
||||
String CODE1_POSITION = "C002";
|
||||
/**
|
||||
* 치안대상 업종 대분류코드.
|
||||
*/
|
||||
String CODE1_COPR = "CORP";
|
||||
/**
|
||||
* 교육과정 대분류 코드.
|
||||
*/
|
||||
String CODE1_EDU_COURSE = "EDUC";
|
||||
/**
|
||||
* 교육기관 대분류 코드.
|
||||
*/
|
||||
String CODE1_EDU_PLACE = "EDUP";
|
||||
|
||||
/**
|
||||
* 소속 구조.
|
||||
*/
|
||||
Map<String, String[]> PLACE_CATEGORY = new TreeMap<String, String[]>(String.CASE_INSENSITIVE_ORDER) {
|
||||
/**
|
||||
* serialVersionUID.
|
||||
*/
|
||||
private static final long serialVersionUID = -8213220033671425747L;
|
||||
|
||||
{
|
||||
//중부본부
|
||||
put("ps90", new String[] { "PS14", "PS16", "PS05", "PS02", "PS50" });
|
||||
//제주본부
|
||||
put("PS91", new String[] { "PS13", "PS17" });
|
||||
//서해본부
|
||||
put("PS92", new String[] { "PS06", "PS07", "PS08", "PS09", "ps18" });
|
||||
//남해본부
|
||||
put("PS93", new String[] { "PS01", "PS11", "PS15", "PS12" });
|
||||
//동해본부
|
||||
//20171226 울진해양경찰서 추가(PS19)
|
||||
put("PS94", new String[] { "PS03", "PS04", "PS10", "PS19" });
|
||||
put("PS95", new String[] {});
|
||||
put("PS96", new String[] {});
|
||||
put("PS97", new String[] {});
|
||||
put("PS99", new String[] {});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 외사대상목표 - 치안대상 그룹정보.
|
||||
*/
|
||||
HashMap<String, String> CORP_GROUP = new HashMap<String, String>() {
|
||||
/**
|
||||
* serialVersionUID.
|
||||
*/
|
||||
private static final long serialVersionUID = -4741380958901687806L;
|
||||
|
||||
{
|
||||
put("01", "업무협조기관");
|
||||
put("02", "해운.항만관련 협회");
|
||||
put("03", "외사관련업체");
|
||||
put("04", "외국인고용업체");
|
||||
put("05", "외국인투자업체");
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 해양경비안전서 코드목록.
|
||||
*
|
||||
* <pre>
|
||||
* 서귀포해양경비안전서 코드가 변경되었는데 기존 PHP 소스에서는 수정하지 않고 그대로 사용한 듯 하여
|
||||
* PS98 -> PS17 로 변경하였다.
|
||||
*
|
||||
* 20170330 서해5도특별단 추가(PS50)
|
||||
* 20171226 울진해양경찰서 추가(PS19)
|
||||
* </pre>
|
||||
*/
|
||||
String[] POLICE_STATION_LIST = { "PS01", "PS02", "PS03", "PS04", "PS05", "PS06",
|
||||
"PS07", "PS08", "PS09", "PS10", "PS11", "PS12", "PS13", "PS14", "PS16", "PS17", "ps18", "PS19", "PS50" };
|
||||
|
||||
/**
|
||||
* 코드 정보를 반환한다.
|
||||
*
|
||||
* @param code1
|
||||
* 대분류 코드
|
||||
* @param code2
|
||||
* 중분류 코드
|
||||
* @return 코드 정보
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
CodeVO getCodeValue(String code1, String code2) throws Exception;
|
||||
|
||||
/**
|
||||
* 코드 목록을 반환한다.
|
||||
*
|
||||
* @param code1
|
||||
* 대분류코드
|
||||
* @param code2
|
||||
* 중분류코드
|
||||
* @return CodeVO 객체 리스트
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
List<CodeVO> getCodeValues(String code1, String code2) throws Exception;
|
||||
|
||||
/**
|
||||
* 소속 1 Detph를 반환한다.
|
||||
*
|
||||
* @param onlyCentral
|
||||
* 중앙부처만 반환 - true, 모든 목록반환 - false
|
||||
* @return 소속 1 목록
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
List<CodeVO> getPlace1List(boolean onlyCentral) throws Exception;
|
||||
|
||||
/**
|
||||
* 소속 1 Detph를 반환한다.
|
||||
*
|
||||
* @param onlyCentral
|
||||
* 중앙부처만 반환 - true, 모든 목록반환 - false
|
||||
* @param includeAll
|
||||
* "전체" 포함여부
|
||||
* @return 소속 1 목록
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
List<CodeVO> getPlace1List(boolean onlyCentral, boolean includeAll) throws Exception;
|
||||
|
||||
/**
|
||||
* codes에 해당하는 소속기관을 반환한다.
|
||||
*
|
||||
* @param codes 소속기관 CODE
|
||||
* @return 소속기관 목록
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
List<CodeVO> getPlace1List(String[] codes) throws Exception;
|
||||
|
||||
/**
|
||||
* codes에 해당하는 소속기관을 반환한다.
|
||||
*
|
||||
* @param codes 소속기관 CODE
|
||||
* @param includeAll "전체" 포함여부
|
||||
* @return 소속기관 목록
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
List<CodeVO> getPlace1List(String[] codes, boolean includeAll) throws Exception;
|
||||
|
||||
/**
|
||||
* 소속 1 Depth 중 code1의 하위 기관을 반환한다. 기존 소스의 get_agency_list와 동일
|
||||
*
|
||||
* @param place1Code
|
||||
* 소속 1 Depth Code
|
||||
* @return 하위 기관 목록
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
List<CodeVO> getPlace1SubList(String place1Code) throws Exception;
|
||||
|
||||
/**
|
||||
* 소속1을 포함한 소속 1 Depth 중 code1의 하위 기관을 반환한다.
|
||||
*
|
||||
* @param place1Code
|
||||
* 소속 1 Depth Code
|
||||
* @return 하위 기관 목록
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
List<CodeVO> getPlace1SubListWithMain(String place1Code) throws Exception;
|
||||
|
||||
/**
|
||||
* 소속 1 Depth 중 code1의 상위 기관 코드를 반환한다. 기존 소스의 get_agency_code와 동일
|
||||
*
|
||||
* @param place1Code
|
||||
* 소속 1 Depth Code
|
||||
* @return 상위 기관 코드
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
String getPlace1HighCode(String place1Code) throws Exception;
|
||||
|
||||
/**
|
||||
* 소속 기관명을 반환한다.
|
||||
*
|
||||
* @param placeCode 소속 코드
|
||||
* @return 소속 기관명
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
String getPlace1Str(final String placeCode) throws Exception;
|
||||
|
||||
/**
|
||||
* 소속 부서명을 반환한다.
|
||||
*
|
||||
* @param place1Code 소속 기관코드
|
||||
* @param place2Code 소속 부서코드
|
||||
* @return 소속 부서명
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
String getPlace2Str(final String place1Code, String place2Code) throws Exception;
|
||||
|
||||
/**
|
||||
* 계급 명칭을 반환한다.
|
||||
*
|
||||
* @param positionCode 계급 코드
|
||||
* @return 계급 명칭
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
String getPositionStr(final String positionCode) throws Exception;
|
||||
|
||||
/**
|
||||
* 계급 코드 리스트를 반환한다.
|
||||
* @return 계급 코드 리스트
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
List<CodeVO> getPositionList() throws Exception;
|
||||
|
||||
/**
|
||||
* 하위소속 코드 리스트를 반환한다.
|
||||
* @param codeVO 상위소속 코드
|
||||
* @return 소속 코드 리스트
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
List<CodeVO> getPlace2List(CodeVO codeVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 세부소속 코드 리스트를 반환한다.
|
||||
* @param codeVO 상위소속 코드
|
||||
* @return 소속 코드 리스트
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
List<CodeVO> getPlace3List(CodeVO codeVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 직위 코드 리스트를 반환한다.
|
||||
* @return 직위 코드 리스트
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
List<CodeVO> getDutiesList() throws Exception;
|
||||
|
||||
/**
|
||||
* 직별 코드 리스트를 반환한다.
|
||||
* @return 직별 코드 리스트
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
List<CodeVO> getJobTypeList() throws Exception;
|
||||
|
||||
/**
|
||||
* 학력 코드 리스트를 반환한다.
|
||||
* @return 학력 코드 리스트
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
List<CodeVO> getScholarshipList() throws Exception;
|
||||
|
||||
/**
|
||||
* 외사대상 관련업체/기관 분류 목록을 반환한다.
|
||||
*
|
||||
* @return 외사대상 관련업체/기관 분류
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
List<CodeVO> getCorpOrgList() throws Exception;
|
||||
|
||||
/**
|
||||
* 교육과정 목록을 반환한다.
|
||||
*
|
||||
* @param includeAll
|
||||
* "전체" 포함여부
|
||||
* @return 교육과정 목록
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
List<CodeVO> getEduCourse(final boolean includeAll) throws Exception;
|
||||
|
||||
/**
|
||||
* 교육기관 목록을 반환한다.
|
||||
*
|
||||
* @param includeAll
|
||||
* "전체" 포함여부
|
||||
* @return 교육기관 목록
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
List<CodeVO> getEduPlace(final boolean includeAll) throws Exception;
|
||||
|
||||
/**
|
||||
* 권한 목록을 반환한다.
|
||||
*
|
||||
* @return 권한 목록
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
List<CodeVO> getAuthList() throws Exception;
|
||||
|
||||
/**
|
||||
* code를 수정한다.
|
||||
*
|
||||
* @param codeVO CodeVO 객체
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
int updateCode(final CodeVO codeVO) throws Exception;
|
||||
|
||||
/**
|
||||
* code를 추가한다.
|
||||
*
|
||||
* @param codeVO CodeVO 객체
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
int insertCode(final CodeVO codeVO) throws Exception;
|
||||
|
||||
/**
|
||||
* code를 삭제한다.
|
||||
*
|
||||
* @param codeVO CodeVO 객체
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
int deleteCode(final CodeVO codeVO) throws Exception;
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
package kcg.faics.cmmn.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import kcg.faics.admin.vo.LogSearchVO;
|
||||
import kcg.faics.admin.vo.LogVO;
|
||||
|
||||
/**
|
||||
* LogService.java
|
||||
* @author 임새미
|
||||
* @since 2016. 11. 10.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 11. 10. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
public interface LogService {
|
||||
|
||||
List<LogVO> getUserLogList(LogSearchVO searchVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 사용자 로그를 추가한다.
|
||||
*
|
||||
* @param paramMap 파라미터 맵
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
int insertUserLog(HashMap<String, Object> paramMap) throws Exception;
|
||||
|
||||
/**
|
||||
* 검색 키워드에 따른 총 로그 개수를 조회한다.
|
||||
*
|
||||
* @param searchVO 검색, 페이지 정보 객체
|
||||
* @return 로그 개수
|
||||
* @exception Exception 기본 예외 처리
|
||||
*/
|
||||
int selectListCnt(LogSearchVO searchVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 전체 로그 개수를 가져온다.
|
||||
* @param searchVO
|
||||
*
|
||||
* @return 로그 개수
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
int selectTotalCnt(LogSearchVO searchVO) throws Exception;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package kcg.faics.cmmn.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import kcg.faics.cmmn.MenuPosition;
|
||||
import kcg.faics.cmmn.vo.MenuVO;
|
||||
|
||||
/**
|
||||
* 메뉴관련 서비스 객체.
|
||||
*
|
||||
* @author kimnomin
|
||||
*
|
||||
*/
|
||||
public interface MenuService {
|
||||
|
||||
/**
|
||||
* 현재 메뉴와 상위메뉴 목록을 반환한다.
|
||||
*
|
||||
* @param menuVO
|
||||
* 검색조건 VO
|
||||
* @return 현재 메뉴를 포함한 상위메뉴 목록
|
||||
*/
|
||||
List<MenuVO> selectListWithHigher(MenuVO menuVO);
|
||||
|
||||
/**
|
||||
* 메뉴 목록을 반환한다.
|
||||
*
|
||||
* @param menuVO
|
||||
* 검색조건 VO
|
||||
* @return 메뉴 목록
|
||||
*/
|
||||
List<MenuVO> selectMainMenuList(MenuVO menuVO);
|
||||
|
||||
/**
|
||||
* 상단 보조메뉴 목록을 반환한다.
|
||||
*
|
||||
* @param menuVO
|
||||
* 검색조건 VO
|
||||
* @return 상단 보조메뉴 목록
|
||||
*/
|
||||
List<MenuVO> selectTopSubMenuList(MenuVO menuVO);
|
||||
|
||||
/**
|
||||
* 게시판 메뉴에 대한 정보를 가져온다.
|
||||
*
|
||||
* @param menu
|
||||
* 가져올 메뉴정보
|
||||
* @return 데이터 맵
|
||||
*/
|
||||
HashMap<String, Object> getMenuInfo(HashMap<String, Object> menu);
|
||||
|
||||
/**
|
||||
* 서브 메뉴에 대한 정보를 가져온다.
|
||||
*
|
||||
* @param menu
|
||||
* 가져올 메뉴정보
|
||||
* @return 데이터 맵
|
||||
*/
|
||||
List<HashMap<String, Object>> getSubmenu(HashMap<String, Object> menu);
|
||||
}
|
||||
|
|
@ -0,0 +1,229 @@
|
|||
/**
|
||||
* CommonMapper.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 13.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 13. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
package kcg.faics.cmmn.service.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import kcg.faics.cmmn.vo.CodeVO;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
|
||||
|
||||
/**
|
||||
* 코드 관련 Mapper.
|
||||
*
|
||||
* @author kimnomin
|
||||
*
|
||||
*/
|
||||
@Repository("codeMapper")
|
||||
public class CodeMapper extends EgovAbstractMapper {
|
||||
/**
|
||||
* 코드를 가져온다.
|
||||
*
|
||||
* @param code1
|
||||
* 대분류코드
|
||||
* @param code2
|
||||
* 중분류코드
|
||||
* @return CodeVO 객체 리스트
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
public List<CodeVO> getCodeValues(final String code1, final String code2)
|
||||
throws Exception {
|
||||
|
||||
CodeVO codeVO = new CodeVO();
|
||||
codeVO.setCode1(code1);
|
||||
codeVO.setCode2(code2);
|
||||
|
||||
return selectList("Code.getCodeValues", codeVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 소속 1 Detph를 반환한다.
|
||||
*
|
||||
* @param onlyCentral
|
||||
* 중앙부처만 반환 - true, 모든 목록반환 - false
|
||||
* @return 소속 1 목록
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public List<CodeVO> getPlace1List(final boolean onlyCentral) throws Exception {
|
||||
return selectList("Code.getPlace1List", onlyCentral);
|
||||
}
|
||||
|
||||
/**
|
||||
* 계급 코드 리스트를 반환한다.
|
||||
* @return 계급 코드 리스트
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<CodeVO> getPositionList() throws Exception {
|
||||
return selectList("Code.getPositionList");
|
||||
};
|
||||
|
||||
/**
|
||||
* 하위소속 코드 리스트를 반환한다.
|
||||
* @param codeVO 상위소속 코드
|
||||
* @return 소속 코드 리스트
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<CodeVO> getPlace2List(CodeVO codeVO) throws Exception {
|
||||
return selectList("Code.getPlace2List", codeVO);
|
||||
};
|
||||
|
||||
/**
|
||||
* 세부소속 코드 리스트를 반환한다.
|
||||
* @param codeVO 상위소속 코드
|
||||
* @return 소속 코드 리스트
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<CodeVO> getPlace3List(CodeVO codeVO) throws Exception {
|
||||
return selectList("Code.getPlace3List", codeVO);
|
||||
};
|
||||
|
||||
/**
|
||||
* 직위 코드 리스트를 반환한다.
|
||||
* @return 직위 코드 리스트
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<CodeVO> getDutiesList() throws Exception {
|
||||
return selectList("Code.getDutiesList");
|
||||
};
|
||||
|
||||
/**
|
||||
* 직별 코드 리스트를 반환한다.
|
||||
* @return 직별 코드 리스트
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<CodeVO> getJobTypeList() throws Exception {
|
||||
return selectList("Code.getJobTypeList");
|
||||
};
|
||||
|
||||
/**
|
||||
* 학력 코드 리스트를 반환한다.
|
||||
* @return 학력 코드 리스트
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<CodeVO> getScholarshipList() throws Exception {
|
||||
return selectList("Code.getScholarshipList");
|
||||
};
|
||||
|
||||
/**
|
||||
* 코드에 해당하는 소속기관의 이름을 가져온다.
|
||||
*
|
||||
* @param code 소속기관 코드
|
||||
* @param
|
||||
* @return 소속기관 명
|
||||
*/
|
||||
public String getPlace1NameByCode(String code, boolean yak) {
|
||||
CodeVO codeVO = selectOne("Code.getPlace1NameByCode", code);
|
||||
return (yak) ? codeVO.getCodenmYak() : codeVO.getCodenm();
|
||||
}
|
||||
|
||||
/**
|
||||
* 코드에 해당하는 이름을 가져온다.
|
||||
*
|
||||
* @param place1 소속기관 코드
|
||||
* @param place2 소속부서 코드
|
||||
* @return 소속부서 명
|
||||
*/
|
||||
public String getPlace2NameByCode(String code1, String code2) {
|
||||
HashMap<String, String> map = new HashMap<String, String>();
|
||||
map.put("code1", code1);
|
||||
map.put("code2", code2);
|
||||
return selectOne("Code.getPlace2NameByCode", map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 코드에 해당하는 이름을 가져온다.
|
||||
*
|
||||
* @param place1 소속기관 코드
|
||||
* @param place2 소속부서 코드
|
||||
* @return 소속부서 명
|
||||
*/
|
||||
public String getPlace3NameByCode(String code2) {
|
||||
return selectOne("Code.getPlace3NameByCode", code2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 코드에 해당하는 계급의 이름을 가져온다.
|
||||
*
|
||||
* @param code 계급 코드
|
||||
* @return 계급 명
|
||||
*/
|
||||
public String getPositionNameByCode(String code) {
|
||||
return selectOne("Code.getPositionNameByCode", code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 코드에 해당하는 직위의 이름을 가져온다.
|
||||
*
|
||||
* @param code 직위 코드
|
||||
* @return 직위 명
|
||||
*/
|
||||
public String getDutiesNameByCode(String code) {
|
||||
return selectOne("Code.getDutiesNameByCode", code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 코드에 해당하는 직별의 이름을 가져온다.
|
||||
*
|
||||
* @param code 직별 코드
|
||||
* @return 직별 명
|
||||
*/
|
||||
public String getJobtypeNameByCode(String code) {
|
||||
return selectOne("Code.getJobtypeNameByCode", code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 코드에 해당하는 학위의 이름을 가져온다.
|
||||
*
|
||||
* @param code 학위 코드
|
||||
* @return 학위 명
|
||||
*/
|
||||
public String getScholarshipNameByCode(String code) {
|
||||
return selectOne("Code.getScholarshipNameByCode", code);
|
||||
}
|
||||
|
||||
/**
|
||||
* code를 수정한다.
|
||||
*
|
||||
* @param codeVO CodeVO 객체
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int updateCode(final CodeVO codeVO) throws Exception {
|
||||
return update("Code.updateCode", codeVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* code를 추가한다.
|
||||
*
|
||||
* @param codeVO CodeVO 객체
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int insertCode(final CodeVO codeVO) throws Exception {
|
||||
return insert("Code.insertCode", codeVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* code를 삭제한다.
|
||||
*
|
||||
* @param codeVO CodeVO 객체
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int deleteCode(CodeVO codeVO) {
|
||||
return delete("Code.deleteCode", codeVO);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,380 @@
|
|||
/**
|
||||
* CommonService.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 13.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 13. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
package kcg.faics.cmmn.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import kcg.faics.cmmn.service.CodeService;
|
||||
import kcg.faics.cmmn.vo.CodeVO;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
/**
|
||||
* 코드 관련 비즈니스 로직.
|
||||
*
|
||||
* @author kimnomin
|
||||
*
|
||||
*/
|
||||
@Service("codeService")
|
||||
public class CodeServiceImpl implements CodeService {
|
||||
|
||||
/**
|
||||
* CodeMapper.
|
||||
*/
|
||||
@Resource(name = "codeMapper")
|
||||
private CodeMapper codeMapper;
|
||||
|
||||
/**
|
||||
* List 객체 첫번째 인덱스에 "전체" 항목을 추가하여 반환한다.
|
||||
*
|
||||
* @param list List 객체
|
||||
* @return "전체" 항목이 추가된 List 객체
|
||||
*/
|
||||
private List<CodeVO> addAll(final List<CodeVO> list) {
|
||||
if (list != null) {
|
||||
CodeVO allVO = new CodeVO();
|
||||
allVO.setCode1(LIST_ALL_VAL);
|
||||
allVO.setCode2(LIST_ALL_VAL);
|
||||
allVO.setCodenm(LIST_ALL_STR);
|
||||
allVO.setCodenmYak(LIST_ALL_STR);
|
||||
list.add(0, allVO);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodeVO getCodeValue(final String code1, final String code2) throws Exception {
|
||||
CodeVO codeVO;
|
||||
List<CodeVO> codes = getCodeValues(code1, code2);
|
||||
if (codes.size() <= 0) {
|
||||
codeVO = null;
|
||||
} else {
|
||||
codeVO = codes.get(0);
|
||||
}
|
||||
return codeVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CodeVO> getCodeValues(final String code1, final String code2) throws Exception {
|
||||
|
||||
List<CodeVO> codeVOList = new ArrayList<CodeVO>();
|
||||
|
||||
try {
|
||||
codeVOList = codeMapper.getCodeValues(code1, code2);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
codeVOList = null;
|
||||
}
|
||||
|
||||
return codeVOList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CodeVO> getPlace1List(final boolean onlyCentral) throws Exception {
|
||||
List<CodeVO> codeVOList = new ArrayList<CodeVO>();
|
||||
|
||||
try {
|
||||
codeVOList = codeMapper.getPlace1List(onlyCentral);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
codeVOList = null;
|
||||
}
|
||||
|
||||
return codeVOList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CodeVO> getPlace1List(final boolean onlyCentral, final boolean includeAll)
|
||||
throws Exception {
|
||||
List<CodeVO> codeVOList = getPlace1List(onlyCentral);
|
||||
if (includeAll) {
|
||||
codeVOList = addAll(codeVOList);
|
||||
}
|
||||
return codeVOList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CodeVO> getPlace1List(final String[] codes) {
|
||||
List<CodeVO> codeVOList = new ArrayList<CodeVO>();
|
||||
List<String> policeStationList = Arrays.asList(CodeService.POLICE_STATION_LIST);
|
||||
|
||||
boolean isContains = false;
|
||||
try {
|
||||
codeVOList = codeMapper.getPlace1List(false);
|
||||
for (Iterator<CodeVO> it = codeVOList.iterator(); it.hasNext(); ) {
|
||||
isContains = false;
|
||||
CodeVO vo = it.next();
|
||||
|
||||
for (String item : policeStationList) {
|
||||
if (item.equalsIgnoreCase(vo.getCode2())) {
|
||||
isContains = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isContains) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
codeVOList = null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return codeVOList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CodeVO> getPlace1List(final String[] codes, final boolean includeAll)
|
||||
throws Exception {
|
||||
List<CodeVO> codeVOList = getPlace1List(codes);
|
||||
|
||||
if (includeAll) {
|
||||
codeVOList = addAll(codeVOList);
|
||||
}
|
||||
|
||||
return codeVOList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CodeVO> getPlace1SubList(final String place1Code) throws Exception {
|
||||
CodeVO code = new CodeVO();
|
||||
List<CodeVO> codes = new ArrayList<CodeVO>();
|
||||
try {
|
||||
String[] subCodes = PLACE_CATEGORY.get(place1Code);
|
||||
if (subCodes != null) {
|
||||
for (int i = 0; i < subCodes.length; i++) {
|
||||
code = getCodeValue(CODE1_PLACE1, subCodes[i]);
|
||||
codes.add(code);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
codes = null;
|
||||
}
|
||||
|
||||
return codes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CodeVO> getPlace1SubListWithMain(final String place1Code) throws Exception {
|
||||
CodeVO code = new CodeVO();
|
||||
List<CodeVO> codes = new ArrayList<CodeVO>();
|
||||
try {
|
||||
String[] subCodes = PLACE_CATEGORY.get(place1Code);
|
||||
if (subCodes != null) {
|
||||
code = getCodeValue(CODE1_PLACE1, place1Code);
|
||||
codes.add(code);
|
||||
|
||||
// 하위 기관
|
||||
for (int i = 0; i < subCodes.length; i++) {
|
||||
code = getCodeValue(CODE1_PLACE1, subCodes[i]);
|
||||
codes.add(code);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
codes = null;
|
||||
}
|
||||
|
||||
return codes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlace1HighCode(final String place1Code) throws Exception {
|
||||
for (Map.Entry<String, String[]> entry : PLACE_CATEGORY.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
String[] values = entry.getValue();
|
||||
|
||||
for (String item : values) {
|
||||
if (item.equalsIgnoreCase(place1Code)) {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
}
|
||||
return place1Code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlace1Str(final String placeCode) throws Exception {
|
||||
String retVal = "";
|
||||
if (StringUtils.isBlank(placeCode)) {
|
||||
retVal = "";
|
||||
} else {
|
||||
CodeVO codeVO = getCodeValue(CODE1_PLACE1, placeCode);
|
||||
retVal = codeVO.getCodenm();
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlace2Str(final String place1Code, final String place2Code)
|
||||
throws Exception {
|
||||
String retVal = "";
|
||||
if (StringUtils.isBlank(place1Code) || StringUtils.isBlank(place2Code)) {
|
||||
retVal = "";
|
||||
} else {
|
||||
CodeVO codeVO = getCodeValue(place1Code, place2Code);
|
||||
retVal = codeVO.getCodenm();
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPositionStr(final String positionCode) throws Exception {
|
||||
String retVal = "";
|
||||
if (StringUtils.isBlank(positionCode)) {
|
||||
retVal = "";
|
||||
} else {
|
||||
CodeVO codeVO = getCodeValue(CODE1_POSITION, positionCode);
|
||||
retVal = codeVO.getCodenm();
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* 계급 코드 리스트를 반환한다.
|
||||
* @return 계급 코드 리스트
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public List<CodeVO> getPositionList() throws Exception {
|
||||
return codeMapper.getPositionList();
|
||||
};
|
||||
|
||||
/**
|
||||
* 하위소속 코드 리스트를 반환한다.
|
||||
* @param codeVO 상위소속 코드
|
||||
* @return 소속 코드 리스트
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public List<CodeVO> getPlace2List(final CodeVO codeVO) throws Exception {
|
||||
return codeMapper.getPlace2List(codeVO);
|
||||
};
|
||||
|
||||
/**
|
||||
* 세부소속 코드 리스트를 반환한다.
|
||||
* @param codeVO 상위소속 코드
|
||||
* @return 소속 코드 리스트
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public List<CodeVO> getPlace3List(final CodeVO codeVO) throws Exception {
|
||||
return codeMapper.getPlace3List(codeVO);
|
||||
};
|
||||
|
||||
/**
|
||||
* 직위 코드 리스트를 반환한다.
|
||||
* @return 직위 코드 리스트
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public List<CodeVO> getDutiesList() throws Exception {
|
||||
return codeMapper.getDutiesList();
|
||||
};
|
||||
|
||||
/**
|
||||
* 직별 코드 리스트를 반환한다.
|
||||
* @return 직별 코드 리스트
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public List<CodeVO> getJobTypeList() throws Exception {
|
||||
return codeMapper.getJobTypeList();
|
||||
};
|
||||
|
||||
/**
|
||||
* 학력 코드 리스트를 반환한다.
|
||||
* @return 학력 코드 리스트
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public List<CodeVO> getScholarshipList() throws Exception {
|
||||
return codeMapper.getScholarshipList();
|
||||
};
|
||||
|
||||
@Override
|
||||
public List<CodeVO> getCorpOrgList() throws Exception {
|
||||
return getCodeValues(CODE1_COPR, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CodeVO> getEduCourse(final boolean includeAll) throws Exception {
|
||||
List<CodeVO> list = getCodeValues(CODE1_EDU_COURSE, null);
|
||||
if (includeAll) {
|
||||
list = addAll(list);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CodeVO> getEduPlace(final boolean includeAll) throws Exception {
|
||||
List<CodeVO> list = getCodeValues(CODE1_EDU_PLACE, null);
|
||||
if (includeAll) {
|
||||
list = addAll(list);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CodeVO> getAuthList() throws Exception {
|
||||
return getCodeValues(CODE1_AUTH, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* code를 수정한다.
|
||||
*
|
||||
* @param codeVO CodeVO 객체
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public int updateCode(final CodeVO codeVO) throws Exception {
|
||||
return codeMapper.updateCode(codeVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* code를 추가한다.
|
||||
*
|
||||
* @param codeVO CodeVO 객체
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public int insertCode(final CodeVO codeVO) throws Exception {
|
||||
return codeMapper.insertCode(codeVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* code를 삭제한다.
|
||||
*
|
||||
* @param codeVO CodeVO 객체
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int deleteCode(final CodeVO codeVO) throws Exception {
|
||||
return codeMapper.deleteCode(codeVO);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
package kcg.faics.cmmn.service.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import kcg.faics.admin.vo.LogSearchVO;
|
||||
import kcg.faics.admin.vo.LogVO;
|
||||
import kcg.faics.sec.LoginUserVO;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
|
||||
|
||||
/**
|
||||
* LogMapper.java
|
||||
* @author 임새미
|
||||
* @since 2016. 11. 10.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 11. 10. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
@Repository
|
||||
public class LogMapper extends EgovAbstractMapper {
|
||||
|
||||
|
||||
public List<LogVO> selectUserLog(LogSearchVO searchVO) throws Exception {
|
||||
return selectList("Log.selectUserLog", searchVO);
|
||||
}
|
||||
public List<LogVO> selectLoginoutLog(LogSearchVO searchVO) throws Exception {
|
||||
return selectList("Log.selectLoginoutLog", searchVO);
|
||||
}
|
||||
|
||||
public List<HashMap<String, Object>> selectUrlInfo(LogVO logVO) throws Exception {
|
||||
return selectList("Log.selectUrlInfo", logVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 사용자 로그를 추가한다.
|
||||
*
|
||||
* @param paramMap 파라미터 맵
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int insertUserLog(HashMap<String, Object> paramMap) {
|
||||
return insert("Log.insertUserLog", paramMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 검색 키워드에 따른 총 로그 개수를 조회한다.
|
||||
*
|
||||
* @param searchVO 검색, 페이지 정보 객체
|
||||
* @return 로그 개수
|
||||
* @exception Exception 기본 예외 처리
|
||||
*/
|
||||
public int selectLogListTotCnt(final LogSearchVO searchVO) throws Exception {
|
||||
return (Integer) selectOne("Log.selectLogListTotCnt", searchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 전체 로그 개수를 가져온다.
|
||||
* @param searchVO
|
||||
*
|
||||
* @return 로그 개수
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int selectLogTotalCnt(final LogSearchVO searchVO) throws Exception {
|
||||
return (Integer) selectOne("Log.selectLogTotalCnt", searchVO);
|
||||
}
|
||||
/**
|
||||
* 설명
|
||||
*
|
||||
* @param 파라미터 파라미터설명
|
||||
* @return 리턴값 설명
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int insertLoginoutLog(LoginUserVO user, int type) {
|
||||
HashMap<String, Object> paramMap = new HashMap<String, Object>();
|
||||
paramMap.put("user", user);
|
||||
paramMap.put("type", type);
|
||||
return (Integer) insert("Log.insertLoginoutLog", paramMap);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
/**
|
||||
* LogServiceImpl.java
|
||||
* @author 임새미
|
||||
* @since 2016. 11. 10.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 11. 10. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
package kcg.faics.cmmn.service.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import kcg.faics.admin.vo.LogSearchVO;
|
||||
import kcg.faics.admin.vo.LogVO;
|
||||
import kcg.faics.cmmn.service.LogService;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* LogServiceImpl.java
|
||||
* @author 임새미
|
||||
* @since 2016. 11. 10.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 11. 10. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
@Service("logService")
|
||||
public class LogServiceImpl implements LogService {
|
||||
|
||||
@Resource(name="logMapper")
|
||||
LogMapper logMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public List<LogVO> getUserLogList(LogSearchVO searchVO) throws Exception {
|
||||
List<LogVO> result = null;
|
||||
if (searchVO.getType() == 1) {
|
||||
result = logMapper.selectLoginoutLog(searchVO);
|
||||
} else {
|
||||
result = logMapper.selectUserLog(searchVO);
|
||||
Iterator<LogVO> it = result.iterator();
|
||||
while(it.hasNext()) {
|
||||
LogVO vo = it.next();
|
||||
String url = "";
|
||||
List<HashMap<String, Object>> maps = logMapper.selectUrlInfo(vo);
|
||||
for (int i = 0; i < maps.size(); i++) {
|
||||
String name = (String) maps.get(i).get("NAME");
|
||||
if (name != null) {
|
||||
url = url + maps.get(i).get("NAME");
|
||||
if (maps.size() != i + 1) {
|
||||
url = url + " > ";
|
||||
}
|
||||
}
|
||||
}
|
||||
vo.setLocation1(url);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 사용자 로그를 추가한다.
|
||||
*
|
||||
* @param paramMap 파라미터 맵
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public int insertUserLog(HashMap<String, Object> paramMap) throws Exception {
|
||||
return logMapper.insertUserLog(paramMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 검색 키워드에 따른 총 로그 개수를 조회한다.
|
||||
*
|
||||
* @param searchVO 검색, 페이지 정보 객체
|
||||
* @return 로그 개수
|
||||
* @exception Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public int selectListCnt(LogSearchVO searchVO) throws Exception {
|
||||
return logMapper.selectLogListTotCnt(searchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 전체 로그 개수를 가져온다.
|
||||
* @param searchVO
|
||||
*
|
||||
* @return 로그 개수
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public int selectTotalCnt(LogSearchVO searchVO) throws Exception {
|
||||
return logMapper.selectLogTotalCnt(searchVO);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package kcg.faics.cmmn.service.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import kcg.faics.cmmn.vo.MenuVO;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
|
||||
|
||||
@Repository("menuMapper")
|
||||
public class MenuMapper extends EgovAbstractMapper {
|
||||
|
||||
/**
|
||||
* 현재 메뉴와 상위메뉴 목록을 반환한다.
|
||||
*
|
||||
* @param menuVO
|
||||
* 검색조건 VO
|
||||
* @return 현재 메뉴를 포함한 상위메뉴 목록
|
||||
*/
|
||||
public List<MenuVO> selectListWithHigher(final MenuVO menuVO) {
|
||||
return selectList("Menu.selectListWithHigher", menuVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 계층형 구조의 메뉴 목록을 반환한다.
|
||||
*
|
||||
* @param menuVO 검색조건 VO
|
||||
* @return 메뉴 목록
|
||||
*/
|
||||
public List<MenuVO> selectListWithConnectBy(final MenuVO menuVO) {
|
||||
return selectList("Menu.selectListWithConnectBy", menuVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시판 메뉴에 대한 정보를 가져온다.
|
||||
*
|
||||
* @return 데이터 맵
|
||||
*/
|
||||
public HashMap<String, Object> getMenuInfo(final HashMap<String, Object> menu) {
|
||||
return selectOne("Menu.getMenuInfo", menu);
|
||||
}
|
||||
|
||||
/**
|
||||
* 서브 메뉴에 대한 정보를 가져온다.
|
||||
*
|
||||
* @return 데이터 맵
|
||||
*/
|
||||
public List<HashMap<String, Object>> getSubmenu(final HashMap<String, Object> menu) {
|
||||
return selectList("Menu.getSubmenu", menu);
|
||||
}
|
||||
|
||||
/**
|
||||
* 설명
|
||||
*
|
||||
* @param 파라미터 파라미터설명
|
||||
* @return 리턴값 설명
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public HashMap<String, Object> getMenuInfoById(final HashMap<String, Object> menu) {
|
||||
return selectOne("Menu.getMenuInfoById", menu);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,121 @@
|
|||
package kcg.faics.cmmn.service.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import kcg.faics.cmmn.MenuPosition;
|
||||
import kcg.faics.cmmn.service.MenuService;
|
||||
import kcg.faics.cmmn.vo.MenuVO;
|
||||
import kcg.faics.sec.LoginUserVO;
|
||||
import kcg.faics.sec.UserUtil;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service("menuService")
|
||||
public class MenuServiceImpl implements MenuService {
|
||||
|
||||
/**
|
||||
* MenuMapper - 메뉴 데이터처리에 관한 Mapper 클래스.
|
||||
**/
|
||||
@Resource(name = "menuMapper")
|
||||
private MenuMapper menuMapper;
|
||||
|
||||
@Override
|
||||
public List<MenuVO> selectListWithHigher(final MenuVO menuVO) {
|
||||
return menuMapper.selectListWithHigher(menuVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MenuVO> selectMainMenuList(final MenuVO menuVO) {
|
||||
LoginUserVO loginUserVO = UserUtil.getMemberInfo();
|
||||
|
||||
menuVO.setDepth(1);
|
||||
menuVO.setMenuPosition(MenuPosition.TOP);
|
||||
List<MenuVO> list = menuMapper.selectListWithConnectBy(menuVO);
|
||||
List<MenuVO> menuList = new ArrayList<MenuVO>();
|
||||
|
||||
MenuVO prevMenu = null;
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
MenuVO currVO = list.get(i);
|
||||
if (currVO.getDepth() == 0) {
|
||||
prevMenu = currVO;
|
||||
menuList.add(prevMenu);
|
||||
} else if (currVO.getDepth() == 1) {
|
||||
|
||||
// 견문 메뉴 권한
|
||||
if (loginUserVO.getAuthSearch() <= 0 && "견문검색".equals(currVO.getName())) {
|
||||
continue;
|
||||
}
|
||||
if (loginUserVO.getAuthStatistics() <= 0 && "견문통계".equals(currVO.getName())) {
|
||||
continue;
|
||||
}
|
||||
if (loginUserVO.getAuthManage() <= 0 && !UserUtil.isAdmin() && "관리기능".equals(currVO.getName())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
prevMenu.getSubMenu().add(currVO);
|
||||
}
|
||||
}
|
||||
|
||||
return menuList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MenuVO> selectTopSubMenuList(final MenuVO menuVO) {
|
||||
menuVO.setDepth(0);
|
||||
menuVO.setMenuPosition(MenuPosition.TOP_SUB);
|
||||
return menuMapper.selectListWithConnectBy(menuVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시판 메뉴에 대한 정보를 가져온다.
|
||||
*
|
||||
* @return 데이터 맵
|
||||
*/
|
||||
@Override
|
||||
public HashMap<String, Object> getMenuInfo(final HashMap<String, Object> menu) {
|
||||
|
||||
HashMap<String, Object> paramMenu = menuMapper.getMenuInfo(menu);
|
||||
|
||||
int depth = ((BigDecimal) paramMenu.get("DEPTH")).intValue();
|
||||
if (depth < 3) {
|
||||
return paramMenu;
|
||||
} else {
|
||||
menu.put("id", ((BigDecimal) paramMenu.get("PARENT")).intValue());
|
||||
return menuMapper.getMenuInfoById(menu);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 서브 메뉴에 대한 정보를 가져온다.
|
||||
*
|
||||
* @return 데이터 맵
|
||||
*/
|
||||
@Override
|
||||
public List<HashMap<String, Object>> getSubmenu(final HashMap<String, Object> menu) {
|
||||
List<HashMap<String, Object>> submenu = menuMapper.getSubmenu(menu);
|
||||
List<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
|
||||
LoginUserVO loginUserVO = UserUtil.getMemberInfo();
|
||||
|
||||
// 견문인 경우 권한에 따라 설정해야함.
|
||||
if (submenu.size() > 0 && "report".equals(submenu.get(0).get("URL_GROUP"))) {
|
||||
for (HashMap<String, Object> map : submenu) {
|
||||
if (loginUserVO.getAuthApprove() <= 0 && "/approveList.do".equals(map.get("URL"))) {
|
||||
continue;
|
||||
}
|
||||
if ((loginUserVO.getAuthApprove() <= 0 && loginUserVO.getAuthWaitList() <= 0) && "/waitList.do".equals(map.get("URL"))) {
|
||||
continue;
|
||||
}
|
||||
result.add(map);
|
||||
}
|
||||
} else {
|
||||
result = submenu;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* 공용 데이터 비지니스 로직 Package.
|
||||
*/
|
||||
/**
|
||||
* @author kimnomin
|
||||
*
|
||||
*/
|
||||
package kcg.faics.cmmn.service;
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
package kcg.faics.cmmn.vo;
|
||||
|
||||
/**
|
||||
* 코드 모델. (TCODE)
|
||||
*
|
||||
* @author kimnomin
|
||||
*/
|
||||
public class CodeVO {
|
||||
/**
|
||||
* 대분류 코드.
|
||||
*/
|
||||
private String code1;
|
||||
|
||||
/**
|
||||
* 중분류 코드.
|
||||
*/
|
||||
private String code2;
|
||||
|
||||
/**
|
||||
* 코드명.
|
||||
*/
|
||||
private String codenm;
|
||||
|
||||
/**
|
||||
* 코드명 약자.
|
||||
*/
|
||||
private String codenmYak;
|
||||
|
||||
/**
|
||||
* 코드 사용 여부.
|
||||
*/
|
||||
private String codeUseYN;
|
||||
|
||||
/**
|
||||
* 대분류 코드를 반환한다.
|
||||
* @return 대분류 코드
|
||||
*/
|
||||
public String getCode1() {
|
||||
return code1;
|
||||
}
|
||||
/**
|
||||
* 대분류 코드를 설정한다.
|
||||
*
|
||||
* @param code1 대분류 코드
|
||||
*/
|
||||
public void setCode1(final String code1) {
|
||||
this.code1 = code1;
|
||||
}
|
||||
/**
|
||||
* 중분류 코드를 반환한다.
|
||||
*
|
||||
* @return 중분류 코드
|
||||
*/
|
||||
public String getCode2() {
|
||||
return code2;
|
||||
}
|
||||
/**
|
||||
* 중분류 코드를 설정한다.
|
||||
*
|
||||
* @param code2 중분류 코드
|
||||
*/
|
||||
public void setCode2(final String code2) {
|
||||
this.code2 = code2;
|
||||
}
|
||||
/**
|
||||
* 코드명을 반환한다.
|
||||
*
|
||||
* @return 코드명
|
||||
*/
|
||||
public String getCodenm() {
|
||||
return codenm;
|
||||
}
|
||||
/**
|
||||
* 코드명을 설정한다.
|
||||
*
|
||||
* @param codenm 코드명
|
||||
*/
|
||||
public void setCodenm(final String codenm) {
|
||||
this.codenm = codenm;
|
||||
}
|
||||
/**
|
||||
* 코드명 약자를 반환한다.
|
||||
*
|
||||
* @return 코드명 약자
|
||||
*/
|
||||
public final String getCodenmYak() {
|
||||
return codenmYak;
|
||||
}
|
||||
/**
|
||||
* 코드명 약자를 설정한다.
|
||||
*
|
||||
* @param codenmYak 코드명 약자
|
||||
*/
|
||||
public final void setCodenmYak(final String codenmYak) {
|
||||
this.codenmYak = codenmYak;
|
||||
}
|
||||
/**
|
||||
* 코드 사용 여부를 반환한다.
|
||||
*
|
||||
* @return 코드 사용 여부
|
||||
*/
|
||||
public final String getCodeUseYN() {
|
||||
return codeUseYN;
|
||||
}
|
||||
/**
|
||||
* 코드 사용 여부를 설정한다.
|
||||
*
|
||||
* @param codeUseYN 코드 사용 여부
|
||||
*/
|
||||
public final void setCodeUseYN(final String codeUseYN) {
|
||||
this.codeUseYN = codeUseYN;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,397 @@
|
|||
package kcg.faics.cmmn.vo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* 메뉴 VO.
|
||||
*
|
||||
* @author kimnomin
|
||||
*
|
||||
*/
|
||||
public class MenuVO {
|
||||
/**
|
||||
* 식별자.
|
||||
*/
|
||||
private int id;
|
||||
/**
|
||||
* 메뉴명.
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 영어 메뉴명.
|
||||
*/
|
||||
private String engName;
|
||||
/**
|
||||
* 상위 메뉴 식별자.
|
||||
*/
|
||||
private int parent;
|
||||
/**
|
||||
* 메뉴 깊이.
|
||||
*/
|
||||
private int depth;
|
||||
/**
|
||||
* URL.
|
||||
*/
|
||||
private String url;
|
||||
/**
|
||||
* URI. (쿼리 포함)
|
||||
*/
|
||||
private String uri;
|
||||
/**
|
||||
* 메뉴 위치.
|
||||
*/
|
||||
private String menuPosition;
|
||||
/**
|
||||
* 사용여부.
|
||||
*/
|
||||
private String visible;
|
||||
/**
|
||||
* 메뉴 그룹.
|
||||
*/
|
||||
private String urlGroup;
|
||||
/**
|
||||
* 페이지 내 하위메뉴 표현여부.
|
||||
*/
|
||||
private String subVisible;
|
||||
/**
|
||||
* Role 레벨.
|
||||
*/
|
||||
private int roleLevel;
|
||||
/**
|
||||
* URL 호출시 사용할 GET 파라미터 문자열.
|
||||
*/
|
||||
private String urlQuery;
|
||||
/**
|
||||
* 게시판 ID. (공용뷰를 사용하는 페이지만 적용)
|
||||
*/
|
||||
private String boardId;
|
||||
/**
|
||||
* 메뉴를 조회할 윈도우창 대상(HTML A태그의 TARGET 속성).
|
||||
*/
|
||||
private String windowTarget;
|
||||
/**
|
||||
* 하위메뉴 목록.
|
||||
*/
|
||||
private List<MenuVO> subMenu = new ArrayList<MenuVO>();
|
||||
/**
|
||||
* 사용자 ID.
|
||||
*/
|
||||
private String userId;
|
||||
/**
|
||||
* 사용자 구분.
|
||||
*/
|
||||
private int userType;
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public final int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* the id to set
|
||||
*/
|
||||
public final void setId(final int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public final String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* the name to set
|
||||
*/
|
||||
public final void setName(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the engName
|
||||
*/
|
||||
public final String getEngName() {
|
||||
return engName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param engName
|
||||
* the engName to set
|
||||
*/
|
||||
public final void setEngName(final String engName) {
|
||||
this.engName = engName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the parent
|
||||
*/
|
||||
public final int getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param parent
|
||||
* the parent to set
|
||||
*/
|
||||
public final void setParent(final int parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the depth
|
||||
*/
|
||||
public final int getDepth() {
|
||||
return depth;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param depth
|
||||
* the depth to set
|
||||
*/
|
||||
public final void setDepth(final int depth) {
|
||||
this.depth = depth;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the url
|
||||
*/
|
||||
public final String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param url
|
||||
* the url to set
|
||||
*/
|
||||
public final void setUrl(final String url) {
|
||||
this.url = url;
|
||||
this.makeUri();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the uri
|
||||
*/
|
||||
public final String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uri를 생성한다.
|
||||
*/
|
||||
public void makeUri() {
|
||||
String uri = "#";
|
||||
String qry = "";
|
||||
if (StringUtils.isNotBlank((this.getUrl()))) {
|
||||
uri = "";
|
||||
|
||||
if (StringUtils.isNotBlank((this.getUrlGroup()))) {
|
||||
uri += this.getUrlGroup();
|
||||
}
|
||||
uri += this.getUrl();
|
||||
|
||||
if (StringUtils.isNotBlank((this.getBoardId()))) {
|
||||
qry = "?id=" + this.getBoardId();
|
||||
}
|
||||
if (StringUtils.isNotBlank((this.getUrlQuery()))) {
|
||||
if (StringUtils.isBlank(qry)) {
|
||||
qry += "?";
|
||||
} else {
|
||||
qry += "&";
|
||||
}
|
||||
qry += this.getUrlQuery();
|
||||
}
|
||||
if (StringUtils.isNoneBlank(uri) && !"/".equals(uri.substring(0, 1))) {
|
||||
uri = "/" + uri;
|
||||
}
|
||||
|
||||
uri += qry;
|
||||
}
|
||||
|
||||
this.setUri(uri);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param uri
|
||||
* the uri to set
|
||||
*/
|
||||
public final void setUri(final String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the menuPosition
|
||||
*/
|
||||
public final String getMenuPosition() {
|
||||
return menuPosition;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param menuPosition
|
||||
* the menuPosition to set
|
||||
*/
|
||||
public final void setMenuPosition(final String menuPosition) {
|
||||
this.menuPosition = menuPosition;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the visible
|
||||
*/
|
||||
public final String getVisible() {
|
||||
return visible;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param visible
|
||||
* the visible to set
|
||||
*/
|
||||
public final void setVisible(final String visible) {
|
||||
this.visible = visible;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the urlGroup
|
||||
*/
|
||||
public final String getUrlGroup() {
|
||||
return urlGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param urlGroup
|
||||
* the urlGroup to set
|
||||
*/
|
||||
public final void setUrlGroup(final String urlGroup) {
|
||||
this.urlGroup = urlGroup;
|
||||
this.makeUri();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the subVisible
|
||||
*/
|
||||
public final String getSubVisible() {
|
||||
return subVisible;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param subVisible
|
||||
* the subVisible to set
|
||||
*/
|
||||
public final void setSubVisible(final String subVisible) {
|
||||
this.subVisible = subVisible;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the roleLevel
|
||||
*/
|
||||
public final int getRoleLevel() {
|
||||
return roleLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param roleLevel
|
||||
* the roleLevel to set
|
||||
*/
|
||||
public final void setRoleLevel(final int roleLevel) {
|
||||
this.roleLevel = roleLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the windowTarget
|
||||
*/
|
||||
public final String getWindowTarget() {
|
||||
return windowTarget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param windowTarget
|
||||
* the windowTarget to set
|
||||
*/
|
||||
public final void setWindowTarget(final String windowTarget) {
|
||||
this.windowTarget = windowTarget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the subMenu
|
||||
*/
|
||||
public final List<MenuVO> getSubMenu() {
|
||||
return subMenu;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param subMenu
|
||||
* the subMenu to set
|
||||
*/
|
||||
public final void setSubMenu(final List<MenuVO> subMenu) {
|
||||
this.subMenu = subMenu;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the urlQuery
|
||||
*/
|
||||
public final String getUrlQuery() {
|
||||
return urlQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param urlQuery
|
||||
* the urlQuery to set
|
||||
*/
|
||||
public final void setUrlQuery(final String urlQuery) {
|
||||
this.urlQuery = urlQuery;
|
||||
this.makeUri();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the boardId
|
||||
*/
|
||||
public final String getBoardId() {
|
||||
return boardId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boardId
|
||||
* the boardId to set
|
||||
*/
|
||||
public final void setBoardId(final String boardId) {
|
||||
this.boardId = boardId;
|
||||
this.makeUri();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the userId
|
||||
*/
|
||||
public final String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param userId
|
||||
* the userId to set
|
||||
*/
|
||||
public final void setUserId(final String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the userType
|
||||
*/
|
||||
public final int getUserType() {
|
||||
return userType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param userType
|
||||
* the userType to set
|
||||
*/
|
||||
public final void setUserType(final int userType) {
|
||||
this.userType = userType;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* 공용 데이터 Value Object Package.
|
||||
*/
|
||||
/**
|
||||
* @author kimnomin
|
||||
*
|
||||
*/
|
||||
package kcg.faics.cmmn.vo;
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
package kcg.faics.cmmn.web;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import kcg.faics.cmmn.service.CodeService;
|
||||
import kcg.faics.cmmn.vo.CodeVO;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
|
||||
/**
|
||||
* 코드관련 컨트롤러.
|
||||
*
|
||||
* CodeController.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 10.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 10. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/code")
|
||||
public class CodeController {
|
||||
|
||||
/**
|
||||
* 코드관련 서비스.
|
||||
*/
|
||||
@Resource(name = "codeService")
|
||||
private CodeService codeService;
|
||||
|
||||
/**
|
||||
* 하위소속 코드 리스트를 반환한다.
|
||||
*
|
||||
* @param codeVO 코드VO
|
||||
* @return 소속 코드 리스트
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping("/place2.json")
|
||||
public HashMap<String, Object> place2Json(final CodeVO codeVO) throws Exception {
|
||||
HashMap<String, Object> result = new HashMap<String, Object>();
|
||||
result.put("data", codeService.getPlace2List(codeVO));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 세부소속 코드 리스트를 반환한다.
|
||||
*
|
||||
* @param codeVO 코드VO
|
||||
* @return 소속 코드 리스트
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping("/place3.json")
|
||||
public HashMap<String, Object> place3Json(final CodeVO codeVO) throws Exception {
|
||||
HashMap<String, Object> result = new HashMap<String, Object>();
|
||||
result.put("data", codeService.getPlace3List(codeVO));
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,162 @@
|
|||
package kcg.faics.cmmn.web;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import kcg.faics.board.service.BoardService;
|
||||
import kcg.faics.board.vo.BoardSearchVO;
|
||||
import kcg.faics.board.vo.BoardVO;
|
||||
import kcg.faics.report.service.ReportJudgeService;
|
||||
import kcg.faics.report.vo.ReportSearchVO;
|
||||
import kcg.faics.report.vo.ReportVO;
|
||||
import kcg.faics.sec.LoginUserVO;
|
||||
import kcg.faics.sec.UserUtil;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||
|
||||
import egovframework.rte.fdl.security.userdetails.util.EgovUserDetailsHelper;
|
||||
|
||||
|
||||
/**
|
||||
* 공용 컨트롤러.
|
||||
*
|
||||
* CommonController.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 10.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 10. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@SessionAttributes(types = LoginUserVO.class)
|
||||
public class CommonController {
|
||||
|
||||
/**
|
||||
* BoardService - 게시판 데이터처리에 관한 인터페이스.
|
||||
**/
|
||||
@Resource(name = "boardService")
|
||||
private BoardService boardService;
|
||||
|
||||
/**
|
||||
* 견문 결재 인터페이스.
|
||||
*/
|
||||
@Resource(name = "reportJudgeService")
|
||||
private ReportJudgeService judgeService;
|
||||
|
||||
/**
|
||||
* 로그인 화면으로 이동한다. 이미 로그인 되어 있을 경우, 메인페이지로 이동한다.
|
||||
*
|
||||
* @param request
|
||||
* Request 객체
|
||||
* @param model
|
||||
* Model 객체
|
||||
* @return 로그인된 사용자 - 메인페이지, 로그인되지 않은 사용자 - 로그인화면
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping("/loginView.do")
|
||||
public String loginView(final HttpServletRequest request, final Model model) throws Exception {
|
||||
if (EgovUserDetailsHelper.isAuthenticated()) {
|
||||
return "redirect:/main.do";
|
||||
} else {
|
||||
String error = request.getParameter("error");
|
||||
model.addAttribute("login_error", error);
|
||||
return "common/login";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 메인 화면으로 이동한다.
|
||||
*
|
||||
* @param request
|
||||
* Request 객체
|
||||
* @param model
|
||||
* Model 객체
|
||||
* @return 메인페이지
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value = "/main.do")
|
||||
public String actionMain(final HttpServletRequest request, final Model model) throws Exception {
|
||||
if (EgovUserDetailsHelper.isAuthenticated()) {
|
||||
BoardSearchVO searchVO = new BoardSearchVO();
|
||||
searchVO.setRecordCountPerPage(5);
|
||||
|
||||
/* 내실적 조회 리스트 */
|
||||
LoginUserVO loginUserVO = UserUtil.getMemberInfo();
|
||||
ReportSearchVO reportSearchVO = new ReportSearchVO();
|
||||
reportSearchVO.setRecordCountPerPage(5);
|
||||
reportSearchVO.setType(loginUserVO.getType());
|
||||
reportSearchVO.setUserid(loginUserVO.getUserid());
|
||||
//최근 1달치
|
||||
Calendar mon = Calendar.getInstance();
|
||||
mon.add(Calendar.MONTH, -1);
|
||||
SimpleDateFormat stSdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String stDate = stSdf.format(mon.getTime());
|
||||
|
||||
Date today = new Date();
|
||||
SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String enDate = date.format(today);
|
||||
|
||||
reportSearchVO.setDateStart(stDate);
|
||||
reportSearchVO.setDateEnd(enDate);
|
||||
reportSearchVO.setOrderCol("in_seq");
|
||||
reportSearchVO.setOrderAsc("DESC");
|
||||
List<ReportVO> reportList = judgeService.selectMyList(reportSearchVO);
|
||||
model.addAttribute("reportList", reportList);
|
||||
|
||||
/* 공지사항 리스트 */
|
||||
searchVO.setId("notice");
|
||||
List<BoardVO> noticeList = boardService.selectList(searchVO);
|
||||
model.addAttribute("noticeList", noticeList);
|
||||
|
||||
/* 게시판 리스트 */
|
||||
searchVO.setId("bbs");
|
||||
List<BoardVO> bbsList = boardService.selectList(searchVO);
|
||||
model.addAttribute("bbsList", bbsList);
|
||||
|
||||
/* 자료실 리스트 */
|
||||
searchVO.setId("data");
|
||||
List<BoardVO> dataList = boardService.selectList(searchVO);
|
||||
model.addAttribute("dataList", dataList);
|
||||
|
||||
return "main.tiles";
|
||||
} else {
|
||||
return "common/login";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 권한이 없는 사용자가 접근시 권한제한 화면으로 이동한다.
|
||||
*
|
||||
* @return 권한없음 페이지
|
||||
* @exception Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping("/accessDenied.do")
|
||||
public String accessDenied() throws Exception {
|
||||
return "error/EgovAccessDenied";
|
||||
}
|
||||
|
||||
/**
|
||||
* validator 매핑.
|
||||
*
|
||||
* @return 유효성 검사 코드 반환
|
||||
* @exception Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value = "/validator.do")
|
||||
public String validator() {
|
||||
return "common/validator";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,192 @@
|
|||
package kcg.faics.comn.validator;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.apache.commons.beanutils.PropertyUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.commons.validator.Field;
|
||||
import org.apache.commons.validator.GenericValidator;
|
||||
import org.apache.commons.validator.ValidatorAction;
|
||||
import org.apache.commons.validator.util.ValidatorUtils;
|
||||
import org.apache.oro.text.perl.Perl5Util;
|
||||
import org.springframework.validation.Errors;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springmodules.validation.commons.FieldChecks;
|
||||
|
||||
/**
|
||||
* 유효성 검사 클래스.
|
||||
*
|
||||
* @author kimnomin
|
||||
*
|
||||
*/
|
||||
public class KcgFieldChecks extends FieldChecks {
|
||||
/**
|
||||
* sericalVersion UID.
|
||||
*/
|
||||
private static final long serialVersionUID = -2911390948016164140L;
|
||||
|
||||
/**
|
||||
* <code>Log</code> used by this class.
|
||||
*/
|
||||
private static final Log LOGGER = LogFactory.getLog(FieldChecks.class);
|
||||
|
||||
/**
|
||||
* 파일 확장자 체크.
|
||||
*
|
||||
* @param bean
|
||||
* The bean validation is being performed on.
|
||||
* @param va
|
||||
* The <code>ValidatorAction</code> that is currently being
|
||||
* performed.
|
||||
* @param field
|
||||
* field The <code>Field</code> object associated with the
|
||||
* current field being validated.
|
||||
* @param errors
|
||||
* Errors The <code>Errors</code> object to add errors to if any
|
||||
* validation errors occur.
|
||||
* @return <code>true</code> Valid. <code>false</code> inValid.
|
||||
*/
|
||||
public static boolean validateFileExt(final Object bean,
|
||||
final ValidatorAction va, final Field field, final Errors errors) {
|
||||
|
||||
String value = extractValue(bean, field);
|
||||
String extStr = field.getVarValue("ext");
|
||||
try {
|
||||
String[] validExts;
|
||||
String regexp = "";
|
||||
if (!GenericValidator.isBlankOrNull(extStr)) {
|
||||
int loopIdx = 0;
|
||||
validExts = extStr.split(",");
|
||||
regexp = "\\.(";
|
||||
for (String s : validExts) {
|
||||
if (loopIdx > 0) {
|
||||
regexp += "|";
|
||||
}
|
||||
regexp += s;
|
||||
loopIdx++;
|
||||
}
|
||||
regexp += ")$";
|
||||
}
|
||||
|
||||
Perl5Util matcher = null;
|
||||
try {
|
||||
|
||||
matcher = new Perl5Util();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (value != null) {
|
||||
boolean isValid = matcher.match("/" + regexp + "/i", value);
|
||||
if (!GenericValidator.isBlankOrNull(value) && !isValid) {
|
||||
FieldChecks.rejectValue(errors, field, va);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
KcgFieldChecks.LOGGER.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean validateStrRegex(final Object bean,
|
||||
final ValidatorAction va, final Field field, final Errors errors) {
|
||||
|
||||
String value = FieldChecks.extractValue(bean, field);
|
||||
String idRegex = field.getVarValue("regex");
|
||||
|
||||
if (!value.matches(idRegex)) {
|
||||
FieldChecks.rejectValue(errors, field, va);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 객체 내 프로퍼티의 값을 추출하여 반환한다.
|
||||
*
|
||||
* <pre>
|
||||
* FieldCheck.extractValue 메소드 Override.
|
||||
* </pre>
|
||||
*
|
||||
* @param bean
|
||||
* 값을 추출할 대상 객체
|
||||
* @param field
|
||||
* 실제 값을 추출할 대상 객체의 프로퍼티
|
||||
* @return bean.field가 갖고 있는 값
|
||||
*/
|
||||
protected static String extractValue(final Object bean, final Field field) {
|
||||
String value = null;
|
||||
|
||||
if (bean == null) {
|
||||
return null;
|
||||
} else if (bean instanceof String) {
|
||||
value = (String) bean;
|
||||
} else {
|
||||
value = getValueAsString(bean, field.getProperty());
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 객체 내 프로퍼티의 값을 추출하여 반환한다.
|
||||
*
|
||||
* <pre>
|
||||
* ValidatorUtils.getValueAsString 메소드 커스터 마이징.
|
||||
* </pre>
|
||||
*
|
||||
* @param bean
|
||||
* bean 값을 추출할 대상 객체
|
||||
* @param property
|
||||
* 실제 값을 추출할 대상 객체의 프로퍼티
|
||||
* @return bean.field가 갖고 있는 값
|
||||
*/
|
||||
public static String getValueAsString(final Object bean, final String property) {
|
||||
Object value = null;
|
||||
|
||||
try {
|
||||
value = PropertyUtils.getProperty(bean, property);
|
||||
|
||||
} catch (IllegalAccessException e) {
|
||||
Log log = LogFactory.getLog(ValidatorUtils.class);
|
||||
log.error(e.getMessage(), e);
|
||||
} catch (InvocationTargetException e) {
|
||||
Log log = LogFactory.getLog(ValidatorUtils.class);
|
||||
log.error(e.getMessage(), e);
|
||||
} catch (NoSuchMethodException e) {
|
||||
Log log = LogFactory.getLog(ValidatorUtils.class);
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (value instanceof String[]) {
|
||||
return ((String[]) value).length > 0 ? value.toString() : "";
|
||||
|
||||
} else if (value instanceof Collection) {
|
||||
return ((Collection) value).isEmpty() ? "" : value.toString();
|
||||
|
||||
} else if (value instanceof MultipartFile) {
|
||||
MultipartFile file = (MultipartFile) value;
|
||||
if (file.isEmpty()) {
|
||||
return "";
|
||||
} else {
|
||||
return file.getOriginalFilename();
|
||||
}
|
||||
} else {
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* Validator Package.
|
||||
*/
|
||||
/**
|
||||
* @author kimnomin
|
||||
*
|
||||
*/
|
||||
package kcg.faics.comn.validator;
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package kcg.faics.equip.service;
|
||||
|
||||
import kcg.faics.cmmn.bbs.BaseBbsService;
|
||||
import kcg.faics.equip.vo.ApproveVO;
|
||||
import kcg.faics.equip.vo.EquipSearchVO;
|
||||
|
||||
/**
|
||||
* 장비 사용실적 결재내역 인터페이스.
|
||||
*
|
||||
* @author kimnomin
|
||||
*
|
||||
*/
|
||||
public interface ApproveService extends BaseBbsService<EquipSearchVO, ApproveVO> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
/**
|
||||
* FaEquipmentService.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 13.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 13. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
package kcg.faics.equip.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import kcg.faics.equip.vo.EquipSearchVO;
|
||||
import kcg.faics.equip.vo.EquipVO;
|
||||
|
||||
/**
|
||||
* FaEquipmentService.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 13.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 13. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
public interface EquipmentService {
|
||||
|
||||
/**
|
||||
* 외사 경찰의 장비 보유 현황을 가져온다.
|
||||
*
|
||||
* @return 결과 데이터를 담은 map 리스트
|
||||
*/
|
||||
List<HashMap<String, Object>> getEquipmentList() throws Exception;
|
||||
|
||||
/**
|
||||
* 외사장비의 사용실적을 가져온다.
|
||||
*
|
||||
* @param params 파라미터 맵
|
||||
* type - 사용 or 점검, year - 대상 연도, quater - 대상 분기
|
||||
* @return 결과 데이터를 담은 map 리스트
|
||||
*/
|
||||
List<HashMap<String, Object>> getEquipUseStateList(EquipSearchVO searchVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 외사장비의 사용실적 기록 연도 리스트를 가져온다.
|
||||
*
|
||||
* @return 결과 데이터를 담은 map 리스트
|
||||
*/
|
||||
List<HashMap<String, Object>> getEquipYearList() throws Exception;
|
||||
|
||||
/**
|
||||
* 외사장비 목록 가져온다.
|
||||
*
|
||||
* @return 결과 데이터를 담은 map 리스트
|
||||
*/
|
||||
List<HashMap<String, Object>> getEquipmentCodeList() throws Exception;
|
||||
|
||||
/**
|
||||
* 선택한 조건에 해당되는 사용실적을 가져온다.
|
||||
*
|
||||
* @param params 파라미터 맵
|
||||
* place1 - 기관코드 or 점검, year - 대상 연도, quater - 대상 분기
|
||||
* @return 결과 데이터를 담은 map 리스트
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
List<HashMap<String, Object>> getEquipUseStateInfo(EquipSearchVO searchVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 사용실적을 입력 or 수정한다.
|
||||
*
|
||||
* @param paramMap 장비별 실적 리스트
|
||||
* @return 결과 데이터를 담은 map 리스트
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
int insertEquipUseState(EquipSearchVO searchVO, HashMap<String, HashMap<String, Object>> paramMap) throws Exception;
|
||||
|
||||
/**
|
||||
* 외사장비목록을 조회한다
|
||||
*
|
||||
* @param equipSearchVO
|
||||
* @return List<EquipVO>
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
List<EquipVO> getEquipList(EquipSearchVO equipSearchVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 데이터 한 건을 반환한다.
|
||||
*
|
||||
* @param dataVO
|
||||
* 조회할 VO (대부분 PK의 값으로 조회한다.)
|
||||
* @return 데이터 한 건
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
EquipVO getEquipment(EquipVO equipVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 외사장비를 등록한다
|
||||
*
|
||||
* @param equipVO
|
||||
* @return 데이터 한 건
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
HashMap<String, Object> insertEquipment(EquipVO equipVO, final Map<String, MultipartFile> fileMap) throws Exception;
|
||||
|
||||
/**
|
||||
* 외사장비를 변경한다
|
||||
*
|
||||
* @param equipVO
|
||||
* @return
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
HashMap<String, Object> updateEquipment(EquipVO equipVO, final Map<String, MultipartFile> fileMap, final String[] deleteFiles) throws Exception;
|
||||
|
||||
/**
|
||||
* 외사장비를 삭제한다.
|
||||
*
|
||||
* @param equipVO
|
||||
* @return Map("result") = 1 : 성공, <else> : 실패
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
HashMap<String, Object> deleteEquipment(EquipVO equipVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 게시물의 첨부파일들을 업로드한다.
|
||||
*
|
||||
* @param bfBdSeq 게시물 아이디
|
||||
* @param fileMap 검색, 페이지 정보 객체
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @exception Exception 기본 예외 처리
|
||||
*/
|
||||
// public int insertAndSaveFiles(BoardFileVO boardFileVO, final Map<String, MultipartFile> fileMap) throws Exception;
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package kcg.faics.equip.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import kcg.faics.equip.vo.StateWaitingSearchVO;
|
||||
import kcg.faics.equip.vo.UseStateVO;
|
||||
|
||||
/**
|
||||
* 사용실적 결재목록 관련 인터페이스.
|
||||
*
|
||||
* @author kimnomin
|
||||
*
|
||||
*/
|
||||
public interface StateWaitingService {
|
||||
/**
|
||||
* 사용실적 결재목록을 반환한다.
|
||||
*
|
||||
* @param searchVO
|
||||
* 검색조건 정보 VO
|
||||
* @return 사용실적 결재목록
|
||||
*/
|
||||
List<UseStateVO> selectList(StateWaitingSearchVO searchVO);
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package kcg.faics.equip.service.impl;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import kcg.faics.equip.vo.ApproveVO;
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
|
||||
|
||||
/**
|
||||
* 장비 사용실적 결재관련 Mapper.
|
||||
*
|
||||
* @author kimnomin
|
||||
*
|
||||
*/
|
||||
@Repository("approveMapper")
|
||||
public class ApproveMapper extends EgovAbstractMapper {
|
||||
/**
|
||||
* 네임스페이스.
|
||||
*/
|
||||
private final String namespace = "EquipApprove";
|
||||
|
||||
/**
|
||||
* 한 건의 결재 내역을 반환한다.
|
||||
*
|
||||
* @param vo 검색조건 VO
|
||||
* @return 한 건의 결재 내역
|
||||
*/
|
||||
public ApproveVO select(final ApproveVO vo) {
|
||||
return selectOne(namespace + ".select", vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 결재 내역을 입력한다.
|
||||
*
|
||||
* @param dataVO 입력할 VO
|
||||
* @return 1-성공, 0-실패
|
||||
*/
|
||||
public int insert(final ApproveVO dataVO) {
|
||||
return insert(namespace + ".insert", dataVO);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
package kcg.faics.equip.service.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import kcg.faics.equip.service.ApproveService;
|
||||
import kcg.faics.equip.vo.ApproveVO;
|
||||
import kcg.faics.equip.vo.EquipSearchVO;
|
||||
|
||||
/**
|
||||
* 장비 사용실적 결재관련 비즈니스 로직.
|
||||
*
|
||||
* @author kimnomin
|
||||
*
|
||||
*/
|
||||
@Service("approveService")
|
||||
public class ApproveServiceImpl implements ApproveService {
|
||||
|
||||
/**
|
||||
* 장비 사용실적 결재관련 Mapper.
|
||||
*/
|
||||
@Resource(name = "approveMapper")
|
||||
private ApproveMapper approveMapper;
|
||||
|
||||
@Override
|
||||
public ApproveVO select(final ApproveVO dataVO) throws Exception {
|
||||
return approveMapper.select(dataVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ApproveVO> selectListAll(final EquipSearchVO searchVO)
|
||||
throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ApproveVO> selectList(final EquipSearchVO searchVO) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int selectListCnt(final EquipSearchVO searchVO) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int selectTotalCnt(final EquipSearchVO searchVO) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<String, Object> insert(final ApproveVO dataVO,
|
||||
final Map<String, MultipartFile> fileMap) throws Exception {
|
||||
HashMap<String, Object> result = new HashMap<String, Object>();
|
||||
|
||||
// 이미 결재 내역이 있으면 결재하지 않는다.
|
||||
ApproveVO vo = select(dataVO);
|
||||
if (vo == null) {
|
||||
result.put("result", approveMapper.insert(dataVO));
|
||||
} else {
|
||||
result.put("result", 0);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<String, Object> update(final ApproveVO dataVO,
|
||||
final Map<String, MultipartFile> fileMap, final String[] deleteFiles)
|
||||
throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<String, Object> delete(final ApproveVO dataVO) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,212 @@
|
|||
/**
|
||||
* FaEquipmentMapper.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 13.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 13. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
package kcg.faics.equip.service.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import kcg.faics.arrest.vo.ArrestSearchVO;
|
||||
import kcg.faics.arrest.vo.ArrestVO;
|
||||
import kcg.faics.equip.vo.EquipSearchVO;
|
||||
import kcg.faics.equip.vo.EquipVO;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
|
||||
|
||||
/**
|
||||
* FaEquipmentMapper.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 13.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 13. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
@Repository("equipmentMapper")
|
||||
public class EquipmentMapper extends EgovAbstractMapper {
|
||||
|
||||
/**
|
||||
* 외사 경찰의 장비 보유 현황을 가져온다.
|
||||
*
|
||||
* @return 결과 데이터를 담은 map 리스트
|
||||
*/
|
||||
public List<HashMap<String, Object>> getEquipmentList(HashMap<String, Object> params) {
|
||||
return selectList("Equip.getEquipmentList", params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 외사장비의 사용실적을 가져온다.
|
||||
*
|
||||
* @param isUseState
|
||||
사용 - true, 점검 - false
|
||||
* @return 결과 데이터를 담은 map 리스트
|
||||
*/
|
||||
public List<HashMap<String, Object>> getEquipUseStateList(HashMap<String, Object> params) {
|
||||
return selectList("Equip.getEquipUseStateList", params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 외사장비의 사용실적 기록 연도 리스트를 가져온다.
|
||||
*
|
||||
* @return 결과 데이터를 담은 map 리스트
|
||||
*/
|
||||
public List<HashMap<String, Object>> getEquipYearList() {
|
||||
return selectList("Equip.getEquipYearList");
|
||||
}
|
||||
|
||||
/**
|
||||
* 외사장비 목록 가져온다.
|
||||
*
|
||||
* @return 결과 데이터를 담은 map 리스트
|
||||
*/
|
||||
public List<HashMap<String, Object>> getEquipmentCodeList() {
|
||||
return selectList("Equip.getEquipmentCodeList");
|
||||
}
|
||||
|
||||
/**
|
||||
* 선택한 조건에 해당되는 사용실적 리스트를 가져온다.
|
||||
*
|
||||
* @param params 파라미터 맵
|
||||
* place1 - 기관코드 or 점검, year - 대상 연도, quater - 대상 분기
|
||||
* @return 리턴값 설명
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public List<HashMap<String, Object>> getEquipUseStateInfo(EquipSearchVO params) {
|
||||
return selectList("Equip.getEquipUseStateInfo", params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 선택한 조건에 해당되는 사용실적을 가져온다.
|
||||
*
|
||||
* @param params 파라미터 맵
|
||||
* place1 - 기관코드 or 점검, year - 대상 연도, quater - 대상 분기
|
||||
* @return 리턴값 설명
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public HashMap<String, Object> getEquipUseStateInfoByCode(HashMap<String, Object> params) {
|
||||
return selectOne("Equip.getEquipUseStateInfoByCode", params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 외사장비 사용실적을 추가한다.
|
||||
*
|
||||
* @param params 외사장비 사용실적 데이터 맵
|
||||
* @return 1-성공, 0-실패
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int insertEquipUseState(HashMap<String, Object> params) {
|
||||
return update("Equip.insertEquipUseState", params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 외사장비 사용실적을 수정한다.
|
||||
*
|
||||
* @param params 외사장비 사용실적 데이터 맵
|
||||
* @return 1-성공, 0-실패
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int updateEquipUseState(HashMap<String, Object> searchVO) {
|
||||
return insert("Equip.updateEquipUseState", searchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 외사장비목록을 조회한다
|
||||
*
|
||||
* @param equipSearchVO
|
||||
* 검색정보 객체
|
||||
* @return 외사장비목록 반환
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
public List<EquipVO> getEquipList(final EquipSearchVO equipSearchVO) throws Exception {
|
||||
return selectList("Equip.getEquipList", equipSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 외사장비(단건)를 조회한다
|
||||
*
|
||||
* @param equipVO
|
||||
* 검색정보 객체
|
||||
* @return 외사장비 단건정보 반환
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
public EquipVO getEquipment(final EquipVO equipVO) throws Exception {
|
||||
return selectOne("Equip.getEquipment", equipVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 외사장비를 등록한다.
|
||||
*
|
||||
* @param equipVO 외사장비 구성 객체
|
||||
* @return result
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public HashMap<String, Object> insertEquipment(final EquipVO equipVO) throws Exception {
|
||||
|
||||
HashMap<String, Object> resultMap = new HashMap<String, Object>();
|
||||
|
||||
int result = 0;
|
||||
try {
|
||||
result = insert("Equip.insertEquipment", equipVO);
|
||||
resultMap.put("result", result);
|
||||
resultMap.put("serNo", equipVO.getSerNo());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 외사장비를 삭제한다.
|
||||
*
|
||||
* @param equipVO 외사장비 구성 객체
|
||||
* @return result
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public HashMap<String, Object> deleteEquipment(final EquipVO equipVO) throws Exception {
|
||||
|
||||
HashMap<String, Object> resultMap = new HashMap<String, Object>();
|
||||
|
||||
int result = 0;
|
||||
try {
|
||||
result = delete("Equip.deleteEquipment", equipVO);
|
||||
resultMap.put("result", result);
|
||||
resultMap.put("serNo", equipVO.getSerNo());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
/**
|
||||
* 외사장비를 수정한다.
|
||||
*
|
||||
* @param equipVO 외사장비 구성 객체
|
||||
* @return result
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public HashMap<String, Object> updateEquipment(final EquipVO equipVO) throws Exception {
|
||||
|
||||
HashMap<String, Object> resultMap = new HashMap<String, Object>();
|
||||
|
||||
int result = 0;
|
||||
try {
|
||||
result = insert("Equip.updateEquipment", equipVO);
|
||||
resultMap.put("result", result);
|
||||
resultMap.put("serNo", equipVO.getSerNo());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,363 @@
|
|||
/**
|
||||
* FaEquipmentServiceImpl.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 13.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 13. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
package kcg.faics.equip.service.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import kcg.faics.board.util.BoardVOHandler;
|
||||
import kcg.faics.board.vo.BoardFileVO;
|
||||
import kcg.faics.cmmn.bbs.BaseFileService;
|
||||
import kcg.faics.cmmn.egov.file.EgovFileMngUtil;
|
||||
import kcg.faics.cmmn.file.FileUploadUtil;
|
||||
import kcg.faics.cmmn.service.impl.CodeMapper;
|
||||
import kcg.faics.equip.service.EquipmentService;
|
||||
import kcg.faics.equip.vo.EquipSearchVO;
|
||||
import kcg.faics.equip.vo.EquipVO;
|
||||
|
||||
/**
|
||||
* FaEquipmentServiceImpl.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 13.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 13. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
@Service("equipmentService")
|
||||
public class EquipmentServiceImpl implements EquipmentService {
|
||||
|
||||
@Resource(name = "equipmentMapper")
|
||||
EquipmentMapper equipmentMapper;
|
||||
|
||||
@Resource(name = "codeMapper")
|
||||
CodeMapper codeMapper;
|
||||
|
||||
/**
|
||||
* EgovFileMngUtil - 파일 업로드 처리에 관한 Util 클래스
|
||||
**/
|
||||
@Resource(name = "EgovFileMngUtil")
|
||||
private EgovFileMngUtil fileUtil;
|
||||
|
||||
/**
|
||||
* BoardFileService - 게시판 파일에 관한 인터페이스
|
||||
**/
|
||||
@Resource(name = "boardFileService")
|
||||
private BaseFileService<BoardFileVO> boardFileService;
|
||||
|
||||
/**
|
||||
* 파일 업로드 유틸리티.
|
||||
*/
|
||||
@Resource(name = "fileUploadUtil")
|
||||
private FileUploadUtil fileUploadUtil;
|
||||
|
||||
/**
|
||||
* 전자정부 표준프레임워크 파일관리 유틸리티.
|
||||
*/
|
||||
@Resource(name = "EgovFileMngUtil")
|
||||
private EgovFileMngUtil fileMngUtil;
|
||||
|
||||
/**
|
||||
* 사용자 사진 저장 경로.
|
||||
*/
|
||||
public static final String EQUIP_SAVE_PATH = "Equip.fileStorePath";
|
||||
|
||||
/**
|
||||
* 외사 경찰의 장비 보유 현황을 가져온다.
|
||||
*
|
||||
* @return 결과 데이터를 담은 map 리스트
|
||||
*/
|
||||
@Override
|
||||
public List<HashMap<String, Object>> getEquipmentList() throws Exception {
|
||||
HashMap<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("place1", codeMapper.getPlace1List(true));
|
||||
return equipmentMapper.getEquipmentList(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 외사장비의 사용실적을 가져온다.
|
||||
*
|
||||
* @param params 파라미터 맵
|
||||
* type - 사용 or 점검, year - 대상 연도, quater - 대상 분기
|
||||
* @return 결과 데이터를 담은 map 리스트
|
||||
*/
|
||||
@Override
|
||||
public List<HashMap<String, Object>> getEquipUseStateList(final EquipSearchVO searchVO) throws Exception {
|
||||
List<HashMap<String, Object>> result = null;
|
||||
HashMap<String, Object> params = new HashMap<String, Object>();
|
||||
|
||||
params.put("place1", codeMapper.getPlace1List(true));
|
||||
params.put("criteria", searchVO);
|
||||
params.put("type", (searchVO.getType().equals("a")) ? "EU_CNT" : "EU_CHECK");
|
||||
|
||||
result = equipmentMapper.getEquipUseStateList(params);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 외사장비의 사용실적 기록 연도 리스트를 가져온다.
|
||||
*
|
||||
* @return 결과 데이터를 담은 map 리스트
|
||||
*/
|
||||
@Override
|
||||
public List<HashMap<String, Object>> getEquipYearList() throws Exception {
|
||||
List<HashMap<String, Object>> result = null;
|
||||
result = equipmentMapper.getEquipYearList();
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 외사장비 목록 가져온다.
|
||||
*
|
||||
* @return 결과 데이터를 담은 map 리스트
|
||||
*/
|
||||
@Override
|
||||
public List<HashMap<String, Object>> getEquipmentCodeList() throws Exception {
|
||||
List<HashMap<String, Object>> result = null;
|
||||
result = equipmentMapper.getEquipmentCodeList();
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 선택한 조건에 해당되는 사용실적을 가져온다.
|
||||
*
|
||||
* @param params 파라미터 맵
|
||||
* place1 - 기관코드 or 점검, year - 대상 연도, quater - 대상 분기
|
||||
* @return 리턴값 설명
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public List<HashMap<String, Object>> getEquipUseStateInfo(EquipSearchVO searchVO) throws Exception {
|
||||
List<HashMap<String, Object>> result = null;
|
||||
result = equipmentMapper.getEquipUseStateInfo(searchVO);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 사용실적을 입력 or 수정한다.
|
||||
*
|
||||
* @param paramMap 장비별 실적 리스트
|
||||
* @return 결과 데이터를 담은 map 리스트
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int insertEquipUseState(final EquipSearchVO searchVO, final HashMap<String, HashMap<String, Object>> paramMap) throws Exception {
|
||||
int success = 0;
|
||||
|
||||
Set<String> keySet = paramMap.keySet();
|
||||
Iterator<String> it = keySet.iterator();
|
||||
while (it.hasNext()) {
|
||||
HashMap<String, Object> value = paramMap.get(it.next());
|
||||
HashMap<String, Object> record = equipmentMapper.getEquipUseStateInfoByCode(value);
|
||||
boolean isInsert = (record == null) ? true : false;
|
||||
|
||||
if (isInsert) {
|
||||
success = equipmentMapper.insertEquipUseState(value);
|
||||
} else {
|
||||
success = equipmentMapper.updateEquipUseState(value);
|
||||
}
|
||||
|
||||
if (success != 1) {
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
return success;
|
||||
};
|
||||
|
||||
/**
|
||||
* 외사장비 목록 조회
|
||||
*
|
||||
* @param arrestSearchVO
|
||||
* @return 외사장비목록 반환
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public List<EquipVO> getEquipList(final EquipSearchVO EquipSearchVO) throws Exception {
|
||||
|
||||
return equipmentMapper.getEquipList(EquipSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 외사장비 목록 조회
|
||||
*
|
||||
* @param arrestSearchVO
|
||||
* @return 외사장비단건 반환
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public EquipVO getEquipment(final EquipVO equipVO) throws Exception {
|
||||
|
||||
return equipmentMapper.getEquipment(equipVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 외사장비 등록
|
||||
*
|
||||
* @param equipVO
|
||||
* @return 외사장비목록 반환
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public HashMap<String, Object> insertEquipment(final EquipVO equipVO, final Map<String, MultipartFile> fileMap) throws Exception {
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
try{
|
||||
|
||||
|
||||
/* 파일 업로드 */
|
||||
//BoardFileVO boardFileVO = BoardVOHandler.getBFileVO("EQUIPMENT", serNo, 0);
|
||||
//result = boardFileService.insertAndSaveFiles(boardFileVO, fileMap);
|
||||
|
||||
|
||||
|
||||
|
||||
if (fileMap != null && fileMap.get("file1").getSize() > 0) {
|
||||
String fileName1 = fileUploadUtil.uploadWithExt(fileMap.get("file1"), EQUIP_SAVE_PATH);
|
||||
System.out.println("fileName1 : " + fileName1);
|
||||
equipVO.setFileName1(fileName1);
|
||||
}
|
||||
if (fileMap != null && fileMap.get("file2").getSize() > 0) {
|
||||
String fileName2 = fileUploadUtil.uploadWithExt(fileMap.get("file2"), EQUIP_SAVE_PATH);
|
||||
equipVO.setFileName2(fileName2);
|
||||
}
|
||||
if (fileMap != null && fileMap.get("file3").getSize() > 0) {
|
||||
String fileName3 = fileUploadUtil.uploadWithExt(fileMap.get("file3"), EQUIP_SAVE_PATH);
|
||||
equipVO.setFileName3(fileName3);
|
||||
}
|
||||
|
||||
map = equipmentMapper.insertEquipment(equipVO);
|
||||
|
||||
if ((Integer)map.get("result") != 1) {
|
||||
throw new Exception();
|
||||
} else {
|
||||
map.put("result", 1);
|
||||
}
|
||||
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 외사장비 삭제
|
||||
*
|
||||
* @param equipVO
|
||||
* @return 처리결과 반환
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public HashMap<String, Object> deleteEquipment(final EquipVO equipVO) throws Exception {
|
||||
try{
|
||||
/* 파일을 삭제한다. */
|
||||
//boardFileService.deleteAndRemoveFiles(BoardVOHandler.getBFileVO(boardVO)(equipVO));
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
return equipmentMapper.deleteEquipment(equipVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 외사장비 수정
|
||||
*
|
||||
* @param equipVO
|
||||
* @return 처리결과 반환
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public HashMap<String, Object> updateEquipment(final EquipVO dataVO, final Map<String, MultipartFile> fileMap, final String[] deleteFiles) throws Exception {
|
||||
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
try{
|
||||
System.out.println(deleteFiles);
|
||||
|
||||
|
||||
if( deleteFiles != null ){
|
||||
for (int i = 0; i < deleteFiles.length; i++) {
|
||||
if( deleteFiles[i].equals("1") ){
|
||||
if (dataVO.getFileName1() != null || dataVO.getFileName1().equals("")) {
|
||||
fileMngUtil.deleteFile(dataVO.getFileName1(), EQUIP_SAVE_PATH);
|
||||
dataVO.setFileName1(null);
|
||||
}
|
||||
}else if( deleteFiles[i].equals("2") ){
|
||||
// file2 삭제
|
||||
if (dataVO.getFileName2() != null || dataVO.getFileName2().equals("")) {
|
||||
fileMngUtil.deleteFile(dataVO.getFileName2(), EQUIP_SAVE_PATH);
|
||||
dataVO.setFileName2(null);
|
||||
}
|
||||
}else if( deleteFiles[i].equals("3") ){
|
||||
// file3 삭제
|
||||
if (dataVO.getFileName3() != null || dataVO.getFileName2().equals("")) {
|
||||
fileMngUtil.deleteFile(dataVO.getFileName2(), EQUIP_SAVE_PATH);
|
||||
dataVO.setFileName3(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( fileMap != null ){
|
||||
if ( fileMap.get("file1") != null ) {
|
||||
if( fileMap.get("file1").getSize() > 0){
|
||||
String fileName1 = fileUploadUtil.uploadWithExt(fileMap.get("file1"), EQUIP_SAVE_PATH);
|
||||
System.out.println("fileName1 : " + fileName1);
|
||||
dataVO.setFileName1(fileName1);
|
||||
}
|
||||
}
|
||||
|
||||
if ( fileMap.get("file2") != null ) {
|
||||
if( fileMap.get("file2").getSize() > 0){
|
||||
String fileName2 = fileUploadUtil.uploadWithExt(fileMap.get("file2"), EQUIP_SAVE_PATH);
|
||||
dataVO.setFileName2(fileName2);
|
||||
}
|
||||
}
|
||||
if ( fileMap.get("file3") != null ) {
|
||||
if( fileMap.get("file3").getSize() > 0){
|
||||
String fileName3 = fileUploadUtil.uploadWithExt(fileMap.get("file3"), EQUIP_SAVE_PATH);
|
||||
dataVO.setFileName3(fileName3);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
map = equipmentMapper.updateEquipment(dataVO);
|
||||
|
||||
if ((Integer)map.get("result") != 1) {
|
||||
throw new Exception();
|
||||
} else {
|
||||
map.put("result", 1);
|
||||
}
|
||||
|
||||
}catch(Exception e){
|
||||
|
||||
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package kcg.faics.equip.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import kcg.faics.equip.vo.StateWaitingSearchVO;
|
||||
import kcg.faics.equip.vo.UseStateVO;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
|
||||
|
||||
/**
|
||||
* 사용실적 결재관련 Mapper.
|
||||
*
|
||||
* @author kimnomin
|
||||
*
|
||||
*/
|
||||
@Repository("equipStateWaitingMapper")
|
||||
public class StateWaitingMapper extends EgovAbstractMapper {
|
||||
/**
|
||||
* 사용실적 결재대기 목록을 반환한다.
|
||||
*
|
||||
* @param searchVO
|
||||
* 검색조건 VO
|
||||
* @return 사용실적 결재대기 목록
|
||||
*/
|
||||
public List<UseStateVO> selectList(final StateWaitingSearchVO searchVO) {
|
||||
return selectList("Equip.selectStateWaitingList", searchVO);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package kcg.faics.equip.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import kcg.faics.equip.service.StateWaitingService;
|
||||
import kcg.faics.equip.vo.StateWaitingSearchVO;
|
||||
import kcg.faics.equip.vo.UseStateVO;
|
||||
|
||||
/**
|
||||
* 사용실적 결재관련 비즈니스 로직.
|
||||
*
|
||||
* @author kimnomin
|
||||
*
|
||||
*/
|
||||
@Service("equipStateWaitingSerivce")
|
||||
public class StateWaitingServiceImpl implements StateWaitingService {
|
||||
/**
|
||||
* 사용실적 결재관련 Mapper.
|
||||
*/
|
||||
@Resource(name = "equipStateWaitingMapper")
|
||||
private StateWaitingMapper equipStateWaitingMapper;
|
||||
|
||||
@Override
|
||||
public List<UseStateVO> selectList(final StateWaitingSearchVO searchVO) {
|
||||
return equipStateWaitingMapper.selectList(searchVO);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,279 @@
|
|||
package kcg.faics.equip.vo;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 장비 사용실적 결재내역 VO.
|
||||
*
|
||||
* @author kimnomin
|
||||
*
|
||||
*/
|
||||
public class ApproveVO {
|
||||
/**
|
||||
* 식별자.
|
||||
*/
|
||||
private int seq;
|
||||
/**
|
||||
* 결재일.
|
||||
*/
|
||||
private Date checkDate;
|
||||
/**
|
||||
* 관리기관(경찰서).
|
||||
*/
|
||||
private String police;
|
||||
/**
|
||||
* 관리기관명(경찰서).
|
||||
*/
|
||||
private String policeStr;
|
||||
/**
|
||||
* 년도.
|
||||
*/
|
||||
private String year;
|
||||
/**
|
||||
* 분기.
|
||||
*/
|
||||
private String quater;
|
||||
/**
|
||||
* 결재권자 소속.
|
||||
*/
|
||||
private String place1;
|
||||
/**
|
||||
* 결재권자 소속명칭.
|
||||
*/
|
||||
private String place1Str;
|
||||
/**
|
||||
* 결재권자 계급.
|
||||
*/
|
||||
private String position;
|
||||
/**
|
||||
* 결재권자 계급명칭.
|
||||
*/
|
||||
private String positionStr;
|
||||
/**
|
||||
* 결재권자 성명.
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 결재권자ID.
|
||||
*/
|
||||
private String userId;
|
||||
/**
|
||||
* 실제결재자ID.
|
||||
*/
|
||||
private String proxyId;
|
||||
/**
|
||||
* 검토의견.
|
||||
*/
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* @return the seq
|
||||
*/
|
||||
public final int getSeq() {
|
||||
return seq;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param seq
|
||||
* the seq to set
|
||||
*/
|
||||
public final void setSeq(final int seq) {
|
||||
this.seq = seq;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the checkDate
|
||||
*/
|
||||
public final Date getCheckDate() {
|
||||
return checkDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param checkDate
|
||||
* the checkDate to set
|
||||
*/
|
||||
public final void setCheckDate(final Date checkDate) {
|
||||
this.checkDate = checkDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the police
|
||||
*/
|
||||
public final String getPolice() {
|
||||
return police;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param police
|
||||
* the police to set
|
||||
*/
|
||||
public final void setPolice(final String police) {
|
||||
this.police = police;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the policeStr
|
||||
*/
|
||||
public final String getPoliceStr() {
|
||||
return policeStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param policeStr
|
||||
* the policeStr to set
|
||||
*/
|
||||
public final void setPoliceStr(final String policeStr) {
|
||||
this.policeStr = policeStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the year
|
||||
*/
|
||||
public final String getYear() {
|
||||
return year;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param year
|
||||
* the year to set
|
||||
*/
|
||||
public final void setYear(final String year) {
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the quater
|
||||
*/
|
||||
public final String getQuater() {
|
||||
return quater;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param quater
|
||||
* the quater to set
|
||||
*/
|
||||
public final void setQuater(final String quater) {
|
||||
this.quater = quater;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the place1
|
||||
*/
|
||||
public final String getPlace1() {
|
||||
return place1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param place1
|
||||
* the place1 to set
|
||||
*/
|
||||
public final void setPlace1(final String place1) {
|
||||
this.place1 = place1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the place1Str
|
||||
*/
|
||||
public final String getPlace1Str() {
|
||||
return place1Str;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param place1Str
|
||||
* the place1Str to set
|
||||
*/
|
||||
public final void setPlace1Str(final String place1Str) {
|
||||
this.place1Str = place1Str;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the position
|
||||
*/
|
||||
public final String getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param position
|
||||
* the position to set
|
||||
*/
|
||||
public final void setPosition(final String position) {
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the positionStr
|
||||
*/
|
||||
public final String getPositionStr() {
|
||||
return positionStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param positionStr
|
||||
* the positionStr to set
|
||||
*/
|
||||
public final void setPositionStr(final String positionStr) {
|
||||
this.positionStr = positionStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public final String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* the name to set
|
||||
*/
|
||||
public final void setName(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the userId
|
||||
*/
|
||||
public final String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param userId
|
||||
* the userId to set
|
||||
*/
|
||||
public final void setUserId(final String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the proxyId
|
||||
*/
|
||||
public final String getProxyId() {
|
||||
return proxyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param proxyId
|
||||
* the proxyId to set
|
||||
*/
|
||||
public final void setProxyId(final String proxyId) {
|
||||
this.proxyId = proxyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the message
|
||||
*/
|
||||
public final String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message
|
||||
* the message to set
|
||||
*/
|
||||
public final void setMessage(final String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package kcg.faics.equip.vo;
|
||||
|
||||
import kcg.faics.cmmn.bbs.BaseFileVO;
|
||||
|
||||
/**
|
||||
* 외사수사 관련 파일 Value Object.
|
||||
*
|
||||
* @author lyh
|
||||
*
|
||||
*/
|
||||
public class EquipFileVO extends BaseFileVO {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
/**
|
||||
* EquipSearchVO.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 24.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 24. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
package kcg.faics.equip.vo;
|
||||
|
||||
/**
|
||||
* EquipSearchVO.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 24.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 24. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
public class EquipSearchVO {
|
||||
|
||||
private int year;
|
||||
private int quater;
|
||||
private String type;
|
||||
private String police;
|
||||
|
||||
/**
|
||||
* @return the year
|
||||
*/
|
||||
public int getYear() {
|
||||
return year;
|
||||
}
|
||||
/**
|
||||
* @param year the year to set
|
||||
*/
|
||||
public void setYear(int year) {
|
||||
this.year = year;
|
||||
}
|
||||
/**
|
||||
* @return the quater
|
||||
*/
|
||||
public int getQuater() {
|
||||
return quater;
|
||||
}
|
||||
/**
|
||||
* @param quater the quater to set
|
||||
*/
|
||||
public void setQuater(int quater) {
|
||||
this.quater = quater;
|
||||
}
|
||||
/**
|
||||
* @return the type
|
||||
*/
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
/**
|
||||
* @param type the type to set
|
||||
*/
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
/**
|
||||
* @return the police
|
||||
*/
|
||||
public String getPolice() {
|
||||
return police;
|
||||
}
|
||||
/**
|
||||
* @param police the police to set
|
||||
*/
|
||||
public void setPolice(String police) {
|
||||
this.police = police;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue