svn에서 옮김.
parent
d23b7969f9
commit
e50392877b
|
|
@ -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>
|
||||
|
|
@ -22,6 +22,7 @@ buildNumber.properties
|
|||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff
|
||||
.idea/**
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
|
|
|
|||
|
|
@ -0,0 +1,440 @@
|
|||
<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>imis</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>
|
||||
<!-- Spring-jdbc -->
|
||||
<!-- /database driver -->
|
||||
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-jdbc</artifactId>
|
||||
<version>${spring.maven.artifact.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.0.2</version>
|
||||
<!-- <version>8.0.11</version> -->
|
||||
</dependency>
|
||||
|
||||
|
||||
<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>
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
<defaultGoal>install</defaultGoal>
|
||||
<directory>${basedir}/target</directory>
|
||||
<finalName>imis</finalName>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</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>7</source>
|
||||
<target>7</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,90 @@
|
|||
package kcg.imis.admin.vo;
|
||||
|
||||
import kcg.imis.cmmn.bbs.BaseSearchVO;
|
||||
|
||||
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,123 @@
|
|||
package kcg.imis.admin.vo;
|
||||
|
||||
public class LogVO {
|
||||
|
||||
private int rnum;
|
||||
private String userid;
|
||||
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 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,397 @@
|
|||
package kcg.imis.admin.web;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import kcg.imis.cmmn.CommConstants;
|
||||
import kcg.imis.cmmn.excel.ExcelExporter;
|
||||
import kcg.imis.cmmn.service.CodeService;
|
||||
import kcg.imis.cmmn.vo.CodeVO;
|
||||
import kcg.imis.member.service.MemberService;
|
||||
import kcg.imis.member.vo.MemberSearchVO;
|
||||
import kcg.imis.member.vo.MemberVO;
|
||||
import kcg.imis.moniter.service.MoniterService;
|
||||
import kcg.imis.moniter.vo.MoniterSearchVO;
|
||||
import kcg.imis.moniter.vo.MoniterVO;
|
||||
import kcg.imis.sec.LoginSuccessHandler;
|
||||
import kcg.imis.sec.LoginUserVO;
|
||||
import kcg.imis.sec.UserUtil;
|
||||
import kcg.imis.sec.mapper.SecurityMapper;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
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.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.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.support.SessionStatus;
|
||||
|
||||
import egovframework.rte.ptl.mvc.tags.ui.pagination.PaginationInfo;
|
||||
|
||||
/**
|
||||
* @FileName : AdminController.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 4. 18.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/admin")
|
||||
public class AdminController {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AdminController.class);
|
||||
|
||||
@Resource(name = "codeService")
|
||||
CodeService codeService;
|
||||
|
||||
@Resource(name = "memberService")
|
||||
MemberService memberService;
|
||||
|
||||
@Resource(name = "moniterService")
|
||||
MoniterService moniterService;
|
||||
|
||||
@RequestMapping(value = "/memberAuth.do")
|
||||
public String reportSaveList(final MemberSearchVO searchVO, final Model model) throws Exception{
|
||||
|
||||
LoginUserVO user = UserUtil.getMemberInfo();
|
||||
|
||||
/* 페이징 처리 정보 */
|
||||
searchVO.setPageUnit(20);
|
||||
searchVO.setPageSize(15);
|
||||
|
||||
/* 페이징 처리 */
|
||||
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.getMemberListCnt(searchVO);
|
||||
paginationInfo.setTotalRecordCount(totSearchCnt);
|
||||
model.addAttribute("paginationInfo", paginationInfo);
|
||||
|
||||
HashMap<String, Object> result = memberService.getMemberListUserVo(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.getCodeList(CommConstants.CODE_PLACE1, true);
|
||||
model.addAttribute("placeList", placeList);
|
||||
|
||||
return "admin/memberAuth.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 = memberService.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 = memberService.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 = memberService.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 = memberService.updateHead(memberVO);
|
||||
results.put("result", result);
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
@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 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;
|
||||
}
|
||||
|
||||
@RequestMapping("/placeManage.do")
|
||||
public String codeManage(final CodeVO codeVO, final Model model) throws Exception {
|
||||
|
||||
if (codeVO.getCode() != null) {
|
||||
model.addAttribute("code", codeService.getCode(CommConstants.CODE_PLACE1, codeVO.getCode()));
|
||||
}
|
||||
model.addAttribute("place1List", codeService.getCodeList(CommConstants.CODE_PLACE1));
|
||||
|
||||
return "admin/placeManage.tiles";
|
||||
}
|
||||
|
||||
@RequestMapping("/memberList.do")
|
||||
public String memberList(@ModelAttribute("memberSearchVO") final MemberSearchVO searchVO, final Model model) throws Exception {
|
||||
try {
|
||||
/* 페이징 처리 정보 */
|
||||
searchVO.setPageUnit(20);
|
||||
searchVO.setPageSize(15);
|
||||
|
||||
/* 페이징 처리 */
|
||||
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.getMemberListCnt(searchVO);
|
||||
paginationInfo.setTotalRecordCount(totSearchCnt);
|
||||
model.addAttribute("paginationInfo", paginationInfo);
|
||||
|
||||
/* 게시판 상단 페이지 및 게시물 정보 표현을 위한 데이터 */
|
||||
int totCnt = memberService.getMemberListAllCnt(searchVO);
|
||||
model.addAttribute("totalCnt", totCnt);
|
||||
|
||||
model.addAttribute("resultList", memberService.getMemberList(searchVO));
|
||||
model.addAttribute("place1List", codeService.getCodeList(CommConstants.CODE_PLACE1));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return "admin/memberList.tiles";
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("/memberInfo.do")
|
||||
public String memberInfo(final MemberVO memberVO, final Model model) throws Exception {
|
||||
try {
|
||||
model.addAttribute("memberVO", memberService.getMemberInfo(memberVO.getUserid()));
|
||||
model.addAttribute("isAdmin", UserUtil.isAdmin());
|
||||
model.addAttribute("isSysAdmin", UserUtil.isSysAdmin());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return "admin/memberInfo.tiles";
|
||||
}
|
||||
|
||||
@RequestMapping("/memberUpdateView.do")
|
||||
public String memberUpdateView(final MemberVO memberVO, final Model model) throws Exception {
|
||||
try {
|
||||
model.addAttribute("code", codeService.getCodeList(null));
|
||||
model.addAttribute("memberVO", memberService.getMemberInfo(memberVO.getUserid()));
|
||||
model.addAttribute("isAdmin", UserUtil.isAdmin());
|
||||
model.addAttribute("isSysAdmin", UserUtil.isSysAdmin());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return "admin/memberModify.tiles";
|
||||
}
|
||||
@RequestMapping(value = {"/memberUpdate.do"}, method = RequestMethod.POST)
|
||||
public String memberUpdate(@ModelAttribute("memberVO") final MemberVO memberVO,
|
||||
final BindingResult bindingResult, final Model model, final SessionStatus status) throws Exception {
|
||||
|
||||
try {
|
||||
memberService.updateUserInfo(memberVO);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return "redirect:/admin/memberInfo.do?userid="+memberVO.getUserid();
|
||||
}
|
||||
|
||||
// 20180503 신규회원가입 페이지 이동 부분 추가
|
||||
@RequestMapping("/memberNewList.do")
|
||||
public String memberNewList(final MemberVO memberVO, final Model model) throws Exception {
|
||||
|
||||
try {
|
||||
model.addAttribute("code", codeService.getCodeList(null));
|
||||
//model.addAttribute("memberVO", memberService.getMemberInfo(memberVO.getUserid()));
|
||||
//model.addAttribute("isAdmin", UserUtil.isAdmin());
|
||||
model.addAttribute("isSysAdmin", UserUtil.isSysAdmin());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return "admin/memberNewList.tiles";
|
||||
}
|
||||
|
||||
// 20180503 신규회원가입 저장 부분 추가
|
||||
@RequestMapping(value = {"/memberNewSave.do"}, method = RequestMethod.POST)
|
||||
public String memberNewSave(@ModelAttribute("memberVO") final MemberVO memberVO,
|
||||
final BindingResult bindingResult, final Model model, final SessionStatus status) throws Exception {
|
||||
|
||||
try {
|
||||
memberService.insertUserInfo(memberVO);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return "redirect:/admin/memberInfo.do?userid="+memberVO.getUserid();
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/memberListExcel.do")
|
||||
public String faMemberListExcel(@ModelAttribute("memberSearchVO") final MemberSearchVO searchVO, final Model model) throws Exception {
|
||||
|
||||
String title = "경찰관리";
|
||||
|
||||
List<MemberVO> memberList = memberService.getMemberListForExel(searchVO);
|
||||
|
||||
LinkedHashMap<String, String> header = new LinkedHashMap<String, String>();
|
||||
header.put("place1Str", "소속");
|
||||
header.put("place2Str", "세부소속");
|
||||
header.put("dutyStr", "계급");
|
||||
header.put("name", "성명");
|
||||
header.put("userid", "아이디");
|
||||
header.put("usegradeStr", "등급");
|
||||
|
||||
model.addAttribute("excel", new ExcelExporter<MemberVO>(header, memberList, title));
|
||||
model.addAttribute("filename", title);
|
||||
|
||||
return "excelView";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping("/moniterManage.do")
|
||||
public String moniterManage(final Model model) throws Exception {
|
||||
try {
|
||||
|
||||
model.addAttribute("isAdmin", UserUtil.isAdmin());
|
||||
model.addAttribute("isSysAdmin", UserUtil.isSysAdmin());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return "admin/moniterManage.tiles";
|
||||
}
|
||||
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/moniterList.json")
|
||||
public List<Map<String, Object>> moniterList(@RequestParam(value="id", required=false) String id) throws Exception {
|
||||
return moniterService.getMoniterTreeList();
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/saveMoniter.json")
|
||||
public MoniterVO saveMoniter(MoniterVO vo) throws Exception {
|
||||
return moniterService.saveMoniter(vo);
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/deleteMoniter.json")
|
||||
public int deleteMoniterTree(MoniterSearchVO vo) throws Exception {
|
||||
return moniterService.deleteMoniterTree(vo);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package kcg.imis.board.aop;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import kcg.imis.cmmn.CommonsUtils;
|
||||
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Before;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @FileName : BoardPreventSqlInjectionAop.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 21.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
public class BoardPreventSqlInjectionAop {
|
||||
|
||||
// id를 필드로 가지고 있는 객체를 파라미터로 받는 메소드만 걸림
|
||||
@Before("execution(public * kcg.faics.board.service.impl.*Mapper.*(kcg.imis.board.vo.BoardSearchVO))"
|
||||
+ "|| execution(public * kcg.faics.board.service.impl.*Mapper.*(kcg.imis.board.vo.BoardVO))")
|
||||
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,181 @@
|
|||
package kcg.imis.board.mapper;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import kcg.imis.board.vo.BoardSearchVO;
|
||||
import kcg.imis.board.vo.BoardVO;
|
||||
import kcg.imis.board.vo.SearchVO;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @FileName : BoardMapper.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 21.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 이전게시물 번호
|
||||
*
|
||||
* @param boardVO BoardVO 객체
|
||||
* @return 그룹에 해당되는 게시물 개수
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int selectPrevSeq(final BoardVO boardVO) throws Exception {
|
||||
return selectOne("Board.selectPrevSeq", boardVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 다음게시물 번호
|
||||
*
|
||||
* @param boardVO BoardVO 객체
|
||||
* @return 그룹에 해당되는 게시물 개수
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int selectNextSeq(final BoardVO boardVO) throws Exception {
|
||||
return selectOne("Board.selectNextSeq", boardVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 게시물을 추가한다.
|
||||
*
|
||||
* @param boardVO 게시판 내용 구성 객체
|
||||
* @return 글 총 갯수
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public HashMap<String, Object> insertBoard(final BoardVO boardVO) throws Exception {
|
||||
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
try {
|
||||
insert("Board.insertBoard", boardVO);
|
||||
map.put("bdIdx", boardVO.getBdIdx());
|
||||
} 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물을 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 조회수 업데이트
|
||||
* @param boardVO
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public int hitBoard(final BoardVO boardVO) throws Exception {
|
||||
return delete("Board.hitBoard", boardVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 검색용 게시글 목록을 조회한다
|
||||
*
|
||||
* @param searchVO 검색, 페이지 정보 객체
|
||||
* @return 게시물 리스트
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public List<BoardVO> searchBoardList(final SearchVO searchVO) throws Exception {
|
||||
return selectList("Board.searchBoardList", searchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 검색용 게시글 객수를 조회한다.
|
||||
*
|
||||
* @param searchVO 검색, 페이지 정보 객체
|
||||
* @return 게시물 개수
|
||||
* @exception Exception 기본 예외 처리
|
||||
*/
|
||||
public int searchBoardCnt(SearchVO searchVO) throws Exception {
|
||||
return (Integer) selectOne("Board.searchBoardCnt", searchVO);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* BoardService.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 25.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 25. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
package kcg.imis.board.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import kcg.imis.board.vo.BoardSearchVO;
|
||||
import kcg.imis.board.vo.BoardVO;
|
||||
import kcg.imis.board.vo.SearchVO;
|
||||
import kcg.imis.cmmn.bbs.BaseBbsService;
|
||||
|
||||
/**
|
||||
*
|
||||
* @FileName : BoardService.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 21.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
public interface BoardService extends BaseBbsService<BoardSearchVO, BoardVO> {
|
||||
|
||||
Map<String, Object> searchBoard(SearchVO searchVO) throws Exception;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,355 @@
|
|||
package kcg.imis.board.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import kcg.imis.board.mapper.BoardMapper;
|
||||
import kcg.imis.board.vo.BoardSearchVO;
|
||||
import kcg.imis.board.vo.BoardVO;
|
||||
import kcg.imis.board.vo.SearchVO;
|
||||
import kcg.imis.cmmn.egov.file.EgovFileMngUtil;
|
||||
import kcg.imis.cmmn.egov.vo.FileVO;
|
||||
import kcg.imis.cmmn.file.FileUploadUtil;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @FileName : BoardServiceImpl.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 16.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 : 게시판 관련 서비스 객체
|
||||
*/
|
||||
@Service("boardService")
|
||||
public class BoardServiceImpl extends EgovAbstractServiceImpl implements BoardService {
|
||||
|
||||
/**
|
||||
* BoardMapper - 게시판 데이터처리에 관한 Mapper 클래스
|
||||
**/
|
||||
@Resource(name = "boardMapper")
|
||||
private BoardMapper boardMapper;
|
||||
|
||||
@Resource(name = "fileUploadUtil")
|
||||
private FileUploadUtil fileUtil;
|
||||
|
||||
@Resource(name = "EgovFileMngUtil")
|
||||
private EgovFileMngUtil egovFileUtil;
|
||||
/**
|
||||
* 게시판 목록 화면을 반환한다.
|
||||
*
|
||||
* @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 {
|
||||
|
||||
boardMapper.hitBoard(boardVO);
|
||||
BoardVO board = boardMapper.selectBoard(boardVO);
|
||||
board.setPrevSeq(boardMapper.selectPrevSeq(board));
|
||||
board.setNextSeq(boardMapper.selectNextSeq(board));
|
||||
return board;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 게시물을 추가한다.
|
||||
*
|
||||
* @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>();
|
||||
|
||||
/* seq 및 insert 결과 */
|
||||
map = boardMapper.insertBoard(boardVO);
|
||||
|
||||
int seq = (Integer) map.get("bdIdx");
|
||||
|
||||
if (seq > 0) {
|
||||
boardVO.setBdIdx(seq);
|
||||
} 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 {
|
||||
|
||||
List<FileVO> fileList = egovFileUtil.parseFileInf(fileMap, "_", 0, "", "Globals.fileStorePath");
|
||||
|
||||
StringBuffer newFileNameSb = new StringBuffer();
|
||||
StringBuffer realFileNameSb = new StringBuffer();
|
||||
for(FileVO file : fileList){
|
||||
newFileNameSb.append(file.getStreFileNm());
|
||||
realFileNameSb.append(file.getOrignlFileNm());
|
||||
if (file == fileList.get(fileList.size() - 1)) continue;
|
||||
newFileNameSb.append(";");
|
||||
realFileNameSb.append(";");
|
||||
}
|
||||
|
||||
boardVO.setBdFileNames(realFileNameSb.toString());
|
||||
boardVO.setBdFiles(newFileNameSb.toString());
|
||||
|
||||
return insert(boardVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 게시물을 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;
|
||||
|
||||
//기존 업로드 파일 목록들
|
||||
List<String> saveFileList = boardVO.getSaveFileNames();
|
||||
List<String> orgFileList = boardVO.getOrgFileNames();
|
||||
|
||||
if(deleteFiles != null){
|
||||
for(String deleteFile : deleteFiles){
|
||||
int index = saveFileList.indexOf(deleteFile);
|
||||
if(index > -1){
|
||||
saveFileList.remove(index);
|
||||
orgFileList.remove(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StringBuffer newSaveFileNameSb = new StringBuffer();
|
||||
StringBuffer newOrgFileNameSb = new StringBuffer();
|
||||
|
||||
for(String fileName : saveFileList){
|
||||
newSaveFileNameSb.append(fileName);
|
||||
if (fileName.equals(saveFileList.get(saveFileList.size() - 1))) continue;
|
||||
newSaveFileNameSb.append(";");
|
||||
}
|
||||
|
||||
for(String fileName : orgFileList){
|
||||
newOrgFileNameSb.append(fileName);
|
||||
if (fileName.equals(orgFileList.get(orgFileList.size() - 1))) continue;
|
||||
newOrgFileNameSb.append(";");
|
||||
}
|
||||
|
||||
//새로 업로드된 파일 목록들
|
||||
List<FileVO> fileList = egovFileUtil.parseFileInf(fileMap, "_", 0, "", "Globals.fileStorePath");
|
||||
|
||||
for(FileVO file : fileList){
|
||||
if(newSaveFileNameSb.length() > 0){
|
||||
newSaveFileNameSb.append(";");
|
||||
newOrgFileNameSb.append(";");
|
||||
}
|
||||
|
||||
newSaveFileNameSb.append(file.getStreFileNm());
|
||||
newOrgFileNameSb.append(file.getOrignlFileNm());
|
||||
if (file == fileList.get(fileList.size() - 1)) continue;
|
||||
newSaveFileNameSb.append(";");
|
||||
newOrgFileNameSb.append(";");
|
||||
}
|
||||
|
||||
boardVO.setBdFiles(newSaveFileNameSb.toString());
|
||||
boardVO.setBdFileNames(newOrgFileNameSb.toString());
|
||||
|
||||
|
||||
result = this.updateBoard(boardVO);
|
||||
|
||||
if (result != 1) {
|
||||
throw new Exception();
|
||||
} else {
|
||||
map.put("result", result);
|
||||
map.put("bdIdx", boardVO.getBdIdx());
|
||||
}
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
@Override
|
||||
public List<BoardVO> selectListAll(BoardSearchVO searchVO) throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> searchBoard(SearchVO searchVO) throws Exception {
|
||||
|
||||
Map<String, Object> resultMap = new HashMap<String, Object>();
|
||||
|
||||
String[] bbsIds = {"confer", "dokdo", "image", "imo", "joint", "law", "notice", "state", "world01", "world02", "world03"};
|
||||
String[] bbsNames = {"국제회의", "독도·이어도", "이미지", "해적/IMO 등", "정보요청", "국제해양법 검토", "공지사항", "국제해양정세", "세계해양분쟁DB-해양치안기관", "세계해양분쟁DB-해양정책·동향", "세계해양분쟁DB-해양분쟁"};
|
||||
|
||||
int totalCnt = 0;
|
||||
|
||||
List<Map<String, Object>> list = new ArrayList<Map<String,Object>>();
|
||||
for( int i = 0 ; i < bbsIds.length ; i ++){
|
||||
|
||||
Map<String, Object> board = new HashMap<String, Object>();
|
||||
|
||||
String bbsId = bbsIds[i];
|
||||
String bbsName = bbsNames[i];
|
||||
|
||||
searchVO.setSearchType("content");
|
||||
searchVO.setBbsId(bbsId);;
|
||||
|
||||
List<BoardVO> list1 = boardMapper.searchBoardList(searchVO);
|
||||
int cnt1 = boardMapper.searchBoardCnt(searchVO);
|
||||
|
||||
searchVO.setSearchType("subject");
|
||||
List<BoardVO> list2 = boardMapper.searchBoardList(searchVO);
|
||||
int cnt2 = boardMapper.searchBoardCnt(searchVO);
|
||||
|
||||
searchVO.setSearchType("file");
|
||||
List<BoardVO> list3 = boardMapper.searchBoardList(searchVO);
|
||||
int cnt3 = boardMapper.searchBoardCnt(searchVO);
|
||||
|
||||
searchVO.setSearchType("name");
|
||||
List<BoardVO> list4 = boardMapper.searchBoardList(searchVO);
|
||||
int cnt4 = boardMapper.searchBoardCnt(searchVO);
|
||||
|
||||
int count = cnt1 + cnt2 + cnt3 + cnt4;
|
||||
|
||||
board.put("contentList", list1);
|
||||
board.put("subjectList", list2);
|
||||
board.put("fileList", list3);
|
||||
board.put("nameList", list4);
|
||||
|
||||
board.put("cnt", count);
|
||||
board.put("name", bbsName);
|
||||
|
||||
list.add(board);
|
||||
|
||||
totalCnt += count;
|
||||
|
||||
}
|
||||
|
||||
resultMap.put("list", list);
|
||||
resultMap.put("totalCnt", totalCnt);
|
||||
|
||||
return resultMap;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,154 @@
|
|||
/*
|
||||
* 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.imis.board.vo;
|
||||
|
||||
import kcg.imis.cmmn.bbs.BaseSearchVO;
|
||||
|
||||
|
||||
/**
|
||||
* @FileName : BoardSearchVO.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 21.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 : 게시판 검색 객체
|
||||
*/
|
||||
public class BoardSearchVO extends BaseSearchVO {
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BoardSearchVO [bbsId=" + bbsId + ", category=" + category + ", ct=" + ct + ", bdNational=" + bdNational + ", pla1=" + pla1 + ", pla2=" + pla2 + ", userid=" + userid
|
||||
+ ", searchCondition=" + searchCondition + "]";
|
||||
}
|
||||
|
||||
/** 테이블 이름 */
|
||||
private String bbsId = "";
|
||||
|
||||
/** 카테고리 이름 */
|
||||
private String category = " ";
|
||||
|
||||
private String ct="";
|
||||
|
||||
private String bdNational;
|
||||
|
||||
private String pla1;
|
||||
|
||||
private String pla2;
|
||||
|
||||
private String userid;
|
||||
|
||||
// 20180528 게시판 내용 검색 부분 추가
|
||||
private String bdContent;
|
||||
|
||||
public String getBdContent() {
|
||||
return bdContent;
|
||||
}
|
||||
|
||||
public void setBdContent(String bdContent) {
|
||||
this.bdContent = bdContent;
|
||||
}
|
||||
|
||||
/** 카테고리 이름 */
|
||||
private String searchCondition = "";
|
||||
|
||||
public BoardSearchVO() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* 카테고리 아이디를 반환한다.
|
||||
* @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;
|
||||
}
|
||||
|
||||
public String getBbsId() {
|
||||
return bbsId;
|
||||
}
|
||||
|
||||
public void setBbsId(String bbsId) {
|
||||
this.bbsId = bbsId;
|
||||
}
|
||||
|
||||
public String getCt() {
|
||||
return ct;
|
||||
}
|
||||
|
||||
public void setCt(String ct) {
|
||||
this.ct = ct;
|
||||
}
|
||||
|
||||
public String getBdNational() {
|
||||
return bdNational;
|
||||
}
|
||||
|
||||
public void setBdNational(String bdNational) {
|
||||
this.bdNational = bdNational;
|
||||
}
|
||||
|
||||
public String getPla1() {
|
||||
return pla1;
|
||||
}
|
||||
|
||||
public void setPla1(String pla1) {
|
||||
this.pla1 = pla1;
|
||||
}
|
||||
|
||||
public String getPla2() {
|
||||
return pla2;
|
||||
}
|
||||
|
||||
public void setPla2(String pla2) {
|
||||
this.pla2 = pla2;
|
||||
}
|
||||
|
||||
public String getUserid() {
|
||||
return userid;
|
||||
}
|
||||
|
||||
public void setUserid(String userid) {
|
||||
this.userid = userid;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,279 @@
|
|||
package kcg.imis.board.vo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @FileName : BoardVO.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 21.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 : 게시판 VO 객체
|
||||
*/
|
||||
public class BoardVO {
|
||||
|
||||
private Integer bdIdx;
|
||||
private String bdYn;
|
||||
private Integer bdIdxGrp = 0;
|
||||
private String bbsId;
|
||||
private String ctId;
|
||||
private String bdPart;
|
||||
private String bdSubject;
|
||||
private String bdContent;
|
||||
private String content;
|
||||
private String bdFiles = "";
|
||||
private String bdFileNames = "";
|
||||
private String bdImgs = "";
|
||||
private String bdImgNames = "";
|
||||
private String grpIdx;
|
||||
private String grpName;
|
||||
private String usrIdx;
|
||||
private String usrName;
|
||||
private String bdIpaddr;
|
||||
private Date bdRegdate;
|
||||
private String bdViewAuth;
|
||||
private String bdViewGrp;
|
||||
private String bdClass = "";
|
||||
private String bdTel = "";
|
||||
private String bdObject = "";
|
||||
private String bdNational = "";
|
||||
private String bdTimelimit = "";
|
||||
private String bdEtc = "";
|
||||
private int bdCount = 0;
|
||||
private String[] checkAuth;
|
||||
private int prevSeq = 0;
|
||||
private int nextSeq = 0;
|
||||
|
||||
public String getBbsId() {
|
||||
return bbsId;
|
||||
}
|
||||
public void setBbsId(String bbsId) {
|
||||
this.bbsId = bbsId;
|
||||
}
|
||||
public String getCtId() {
|
||||
return ctId;
|
||||
}
|
||||
public void setCtId(String ctId) {
|
||||
this.ctId = ctId;
|
||||
}
|
||||
public String getBdPart() {
|
||||
return bdPart;
|
||||
}
|
||||
public void setBdPart(String bdPart) {
|
||||
this.bdPart = bdPart;
|
||||
}
|
||||
public String getBdSubject() {
|
||||
return bdSubject;
|
||||
}
|
||||
public void setBdSubject(String bdSubject) {
|
||||
this.bdSubject = bdSubject;
|
||||
}
|
||||
public String getBdContent() {
|
||||
return bdContent;
|
||||
}
|
||||
public void setBdContent(String bdContent) {
|
||||
this.bdContent = bdContent;
|
||||
}
|
||||
public String getBdFiles() {
|
||||
return bdFiles;
|
||||
}
|
||||
public void setBdFiles(String bdFiles) {
|
||||
this.bdFiles = bdFiles;
|
||||
}
|
||||
public String getBdFileNames() {
|
||||
return bdFileNames;
|
||||
}
|
||||
public void setBdFileNames(String bdFileNames) {
|
||||
this.bdFileNames = bdFileNames;
|
||||
}
|
||||
public String getBdImgNames() {
|
||||
return bdImgNames;
|
||||
}
|
||||
public void setBdImgNames(String bdImgNames) {
|
||||
this.bdImgNames = bdImgNames;
|
||||
}
|
||||
public String getGrpIdx() {
|
||||
return grpIdx;
|
||||
}
|
||||
public void setGrpIdx(String grpIdx) {
|
||||
this.grpIdx = grpIdx;
|
||||
}
|
||||
public String getGrpName() {
|
||||
return grpName;
|
||||
}
|
||||
public void setGrpName(String grpName) {
|
||||
this.grpName = grpName;
|
||||
}
|
||||
public String getUsrIdx() {
|
||||
return usrIdx;
|
||||
}
|
||||
public void setUsrIdx(String usrIdx) {
|
||||
this.usrIdx = usrIdx;
|
||||
}
|
||||
public String getUsrName() {
|
||||
return usrName;
|
||||
}
|
||||
public void setUsrName(String usrName) {
|
||||
this.usrName = usrName;
|
||||
}
|
||||
public String getBdIpaddr() {
|
||||
return bdIpaddr;
|
||||
}
|
||||
public void setBdIpaddr(String bdIpaddr) {
|
||||
this.bdIpaddr = bdIpaddr;
|
||||
}
|
||||
|
||||
public String getBdViewAuth() {
|
||||
return bdViewAuth;
|
||||
}
|
||||
public void setBdViewAuth(String bdViewAuth) {
|
||||
this.bdViewAuth = bdViewAuth;
|
||||
}
|
||||
public String getBdViewGrp() {
|
||||
return bdViewGrp;
|
||||
}
|
||||
public void setBdViewGrp(String bdViewGrp) {
|
||||
this.bdViewGrp = bdViewGrp;
|
||||
}
|
||||
public String getBdClass() {
|
||||
return bdClass;
|
||||
}
|
||||
public void setBdClass(String bdClass) {
|
||||
this.bdClass = bdClass;
|
||||
}
|
||||
public String getBdTel() {
|
||||
return bdTel;
|
||||
}
|
||||
public void setBdTel(String bdTel) {
|
||||
this.bdTel = bdTel;
|
||||
}
|
||||
public String getBdObject() {
|
||||
return bdObject;
|
||||
}
|
||||
public void setBdObject(String bdObject) {
|
||||
this.bdObject = bdObject;
|
||||
}
|
||||
public String getBdNational() {
|
||||
return bdNational;
|
||||
}
|
||||
public void setBdNational(String bdNational) {
|
||||
this.bdNational = bdNational;
|
||||
}
|
||||
public String getBdTimelimit() {
|
||||
return bdTimelimit;
|
||||
}
|
||||
public void setBdTimelimit(String bdTimelimit) {
|
||||
this.bdTimelimit = bdTimelimit;
|
||||
}
|
||||
public String getBdEtc() {
|
||||
return bdEtc;
|
||||
}
|
||||
public void setBdEtc(String bdEtc) {
|
||||
this.bdEtc = bdEtc;
|
||||
}
|
||||
public Integer getBdIdx() {
|
||||
return bdIdx;
|
||||
}
|
||||
public void setBdIdx(Integer bdIdx) {
|
||||
this.bdIdx = bdIdx;
|
||||
}
|
||||
public String getBdYn() {
|
||||
return bdYn;
|
||||
}
|
||||
public void setBdYn(String bdYn) {
|
||||
this.bdYn = bdYn;
|
||||
}
|
||||
public String[] getCheckAuth() {
|
||||
return checkAuth;
|
||||
}
|
||||
public void setCheckAuth(String[] checkAuth) {
|
||||
this.checkAuth = checkAuth;
|
||||
}
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
public int getBdIdxGrp() {
|
||||
return bdIdxGrp;
|
||||
}
|
||||
public void setBdIdxGrp(int bdIdxGrp) {
|
||||
this.bdIdxGrp = bdIdxGrp;
|
||||
}
|
||||
public Date getBdRegdate() {
|
||||
return bdRegdate;
|
||||
}
|
||||
public void setBdRegdate(Date bdRegdate) {
|
||||
this.bdRegdate = bdRegdate;
|
||||
}
|
||||
public String getBdImgs() {
|
||||
return bdImgs;
|
||||
}
|
||||
|
||||
public void setBdImgs(String bdImgs) {
|
||||
this.bdImgs = bdImgs;
|
||||
}
|
||||
public int getFileSize() {
|
||||
if(bdFiles == null || "".equals(bdFiles)){
|
||||
return 0;
|
||||
}
|
||||
return bdFiles.split(";").length;
|
||||
}
|
||||
public int getImgSize() {
|
||||
if(bdImgs == null || "".equals(bdImgs)){
|
||||
return 0;
|
||||
}
|
||||
return bdImgs.split(";").length;
|
||||
}
|
||||
|
||||
public List<String> getOrgFileNames(){
|
||||
if(bdFileNames == null || "".equals(bdFileNames)){
|
||||
return new ArrayList();
|
||||
}
|
||||
return new ArrayList(Arrays.asList(bdFileNames.split(";")));
|
||||
}
|
||||
|
||||
public List<String> getSaveFileNames(){
|
||||
if(bdFiles == null || "".equals(bdFiles)){
|
||||
return new ArrayList();
|
||||
}
|
||||
return new ArrayList(Arrays.asList(bdFiles.split(";")));
|
||||
}
|
||||
|
||||
public List<String> getOrgImgNames(){
|
||||
if(bdImgNames == null || "".equals(bdImgNames)){
|
||||
return new ArrayList();
|
||||
}
|
||||
return new ArrayList(Arrays.asList(bdImgNames.split(";")));
|
||||
}
|
||||
|
||||
public List<String> getSaveImgNames(){
|
||||
if(bdImgs == null || "".equals(bdImgs)){
|
||||
return new ArrayList();
|
||||
}
|
||||
return new ArrayList(Arrays.asList( bdImgs.split(";")));
|
||||
}
|
||||
|
||||
public int getPrevSeq() {
|
||||
return prevSeq;
|
||||
}
|
||||
public void setPrevSeq(int prevSeq) {
|
||||
this.prevSeq = prevSeq;
|
||||
}
|
||||
public int getNextSeq() {
|
||||
return nextSeq;
|
||||
}
|
||||
public void setNextSeq(int nextSeq) {
|
||||
this.nextSeq = nextSeq;
|
||||
}
|
||||
public int getBdCount() {
|
||||
return bdCount;
|
||||
}
|
||||
public void setBdCount(int bdCount) {
|
||||
this.bdCount = bdCount;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package kcg.imis.board.vo;
|
||||
|
||||
public class SearchVO {
|
||||
|
||||
private String bbsId;
|
||||
private String searchKeyWord;
|
||||
private String searchType;
|
||||
private String pla1;
|
||||
private String pla2;
|
||||
private String userid;
|
||||
|
||||
public String getBbsId() {
|
||||
return bbsId;
|
||||
}
|
||||
public void setBbsId(String bbsId) {
|
||||
this.bbsId = bbsId;
|
||||
}
|
||||
public String getSearchKeyWord() {
|
||||
return searchKeyWord;
|
||||
}
|
||||
public void setSearchKeyWord(String searchKeyWord) {
|
||||
this.searchKeyWord = searchKeyWord;
|
||||
}
|
||||
public String getSearchType() {
|
||||
return searchType;
|
||||
}
|
||||
public void setSearchType(String searchType) {
|
||||
this.searchType = searchType;
|
||||
}
|
||||
public String getPla1() {
|
||||
return pla1;
|
||||
}
|
||||
public void setPla1(String pla1) {
|
||||
this.pla1 = pla1;
|
||||
}
|
||||
public String getPla2() {
|
||||
return pla2;
|
||||
}
|
||||
public void setPla2(String pla2) {
|
||||
this.pla2 = pla2;
|
||||
}
|
||||
public String getUserid() {
|
||||
return userid;
|
||||
}
|
||||
public void setUserid(String userid) {
|
||||
this.userid = userid;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,538 @@
|
|||
package kcg.imis.board.web;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.net.URLDecoder;
|
||||
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.imis.board.service.BoardService;
|
||||
import kcg.imis.board.vo.BoardSearchVO;
|
||||
import kcg.imis.board.vo.BoardVO;
|
||||
import kcg.imis.board.vo.SearchVO;
|
||||
import kcg.imis.cmmn.file.FileResponser;
|
||||
import kcg.imis.sec.LoginUserVO;
|
||||
import kcg.imis.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.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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @FileName : BoardController.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 21.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 : 게시판 컨트롤러
|
||||
*/
|
||||
@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;
|
||||
|
||||
/**
|
||||
* 게시판 목록 화면을 반환한다.
|
||||
*
|
||||
* @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 {
|
||||
|
||||
LoginUserVO user = UserUtil.getMemberInfo();
|
||||
|
||||
|
||||
searchVO.setPla1(user.getPlace1());
|
||||
searchVO.setPla2(user.getPlace2());
|
||||
searchVO.setUserid(user.getUserid());
|
||||
// 20180528 검색기능 중에 내용 관련 부분 추가
|
||||
searchVO.setBdContent(user.getBdcontent());
|
||||
|
||||
/* 페이징 처리 정보 */
|
||||
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";
|
||||
}
|
||||
|
||||
if("confer".equals(searchVO.getBbsId())){
|
||||
return "board/conferList.tiles";
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
/* 게시판 내용 */
|
||||
model.addAttribute("boardVO", board);
|
||||
|
||||
/* 세션 사용자 정보 */
|
||||
model.addAttribute("loginUserVO", UserUtil.getMemberInfo());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "error/bizError";
|
||||
}
|
||||
|
||||
if ("joint".equals(boardVO.getBbsId()))
|
||||
return "board/jointView.tiles";
|
||||
|
||||
if ("confer".equals(boardVO.getBbsId()))
|
||||
return "board/conferView.tiles";
|
||||
|
||||
return "board/boardView.tiles";
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물 추가 화면을 반환한다.
|
||||
* searchVO
|
||||
* @param model 모델 객체
|
||||
* @param boardVO 게시판 VO
|
||||
* @return 게시물 조회 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value = "/addView.do", method = RequestMethod.GET)
|
||||
public String boardAddView(final Model model, @RequestParam("bbsId") String param) throws Exception {
|
||||
|
||||
BoardVO modelAttr = new BoardVO();
|
||||
modelAttr.setBbsId(param);
|
||||
|
||||
/* 게시물 입력 Form ModelAttribute */
|
||||
model.addAttribute("boardVO", modelAttr);
|
||||
/* create or modify 플래그 */
|
||||
model.addAttribute("registerFlag", "create");
|
||||
|
||||
if ("joint".equals(param))
|
||||
return "board/jointAdd.tiles";
|
||||
if ("confer".equals(param))
|
||||
return "board/conferAdd.tiles";
|
||||
|
||||
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 {
|
||||
|
||||
if (bindingResult.hasErrors()) {
|
||||
model.addAttribute("boardVO", boardVO);
|
||||
return "board/boardAdd.tiles";
|
||||
}
|
||||
|
||||
final Map<String, MultipartFile> fileMap = multiRequest.getFileMap();
|
||||
|
||||
/* 사용자 정보 입력 */
|
||||
LoginUserVO user = UserUtil.getMemberInfo();
|
||||
boardVO.setUsrIdx(user.getUserid());
|
||||
boardVO.setGrpIdx(user.getPlace1());
|
||||
boardVO.setBdIpaddr(multiRequest.getRemoteAddr());
|
||||
boardVO.setUsrName(user.getName());
|
||||
boardVO.setGrpName(user.getPlace1Str() + " " + user.getPlace2Str());
|
||||
|
||||
if("1".equals(boardVO.getBdViewAuth())){
|
||||
if(boardVO.getCheckAuth() != null && boardVO.getCheckAuth().length > 0){
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for(String str : boardVO.getCheckAuth()){
|
||||
sb.append(str);
|
||||
if(str.equals(boardVO.getCheckAuth()[boardVO.getCheckAuth().length -1])) continue;
|
||||
sb.append(";");
|
||||
}
|
||||
boardVO.setBdViewGrp(sb.toString());
|
||||
}
|
||||
}
|
||||
|
||||
map = boardService.insert(boardVO, fileMap);
|
||||
|
||||
status.setComplete();
|
||||
|
||||
int bdIdx = (Integer) map.get("bdIdx");
|
||||
if ( bdIdx > 0) {
|
||||
return "redirect:/bbs/list.do?bbsId=" + boardVO.getBbsId();
|
||||
}
|
||||
} 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.getUsrIdx()) && !UserUtil.isAdmin()) {
|
||||
return "redirect:/bbs/view.do?bdIdx=" + boardVO.getBdIdx() + "&bbsId=" + boardVO.getBbsId();
|
||||
}
|
||||
|
||||
model.addAttribute("boardVO", updateBoard);
|
||||
model.addAttribute("registerFlag", "modify");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "error/bizError";
|
||||
}
|
||||
|
||||
if ("joint".equals(boardVO.getBbsId()))
|
||||
return "board/jointAdd.tiles";
|
||||
else
|
||||
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.getUsrIdx()) && !UserUtil.isSysAdmin()) {
|
||||
return "redirect:/bbs/view.do?bdIdx=" + boardVO.getBdIdx() + "&bbsId=" + boardVO.getBbsId();
|
||||
}
|
||||
|
||||
if (bindingResult.hasErrors()) {
|
||||
model.addAttribute("boardVO", boardVO);
|
||||
model.addAttribute("registerFlag", "modify");
|
||||
return "board/boardAdd.tiles";
|
||||
}
|
||||
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
String[] deleteDocFiles = multiRequest.getParameterValues("deleteDocFile");
|
||||
final Map<String, MultipartFile> fileMap = multiRequest.getFileMap();
|
||||
map = boardService.update(boardVO, fileMap, deleteDocFiles);
|
||||
|
||||
status.setComplete();
|
||||
|
||||
int bdIdx = (Integer) map.get("bdIdx");
|
||||
if ( bdIdx > 0) {
|
||||
return "redirect:/bbs/list.do?bbsId=" + boardVO.getBbsId();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "error/bizError";
|
||||
}
|
||||
|
||||
return "redirect:/bbs/list.do?id=" + boardVO.getBbsId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물을 삭제한다.
|
||||
*
|
||||
* @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 {
|
||||
if (!UserUtil.isEqualMember(boardVO.getUsrIdx()) && !UserUtil.isSysAdmin()) {
|
||||
return "redirect:/bbs/view.do?bdIdx=" + boardVO.getBdIdx() + "&bbsId=" + boardVO.getBbsId();
|
||||
}
|
||||
|
||||
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?bbsId=" + boardVO.getBbsId();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "error/bizError";
|
||||
}
|
||||
|
||||
return "redirect:/bbs/view.do?bdIdx=" + boardVO.getBdIdx() + "&bbsId=" + boardVO.getBbsId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물을 삭제한다.
|
||||
*
|
||||
* @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(BoardVO boardVO, final Model model, final SessionStatus status) throws Exception {
|
||||
BoardVO replyVO = new BoardVO();
|
||||
replyVO.setBdIdx(boardVO.getBdIdx());
|
||||
replyVO.setBdIdxGrp(boardVO.getBdIdx());
|
||||
replyVO.setBbsId(boardVO.getBbsId());
|
||||
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 {
|
||||
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.setUsrIdx(user.getUserid());
|
||||
boardVO.setGrpIdx(user.getPlace1());
|
||||
boardVO.setBdIpaddr(multiRequest.getRemoteAddr());
|
||||
boardVO.setUsrName(user.getName());
|
||||
boardVO.setGrpName(user.getPlace1Str() + " " + user.getPlace2Str());
|
||||
|
||||
map = boardService.insert(boardVO, fileMap);
|
||||
|
||||
status.setComplete();
|
||||
|
||||
int bdIdx = (Integer) map.get("bdIdx");
|
||||
if ( bdIdx > 0) {
|
||||
return "redirect:/bbs/list.do?bbsId=" + boardVO.getBbsId();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "error/bizError";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return "redirect:/bbs/list.do?id=" + boardVO.getBbsId();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 첨부파일로 등록된 파일에 대하여 다운로드를 제공한다.
|
||||
*
|
||||
* @param boardFileVO 게시판 파일 VO
|
||||
* @param request Request 객체
|
||||
* @param response Response 객체
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value = "/download.do")
|
||||
public void cvplFileDownload(@RequestParam("bdIdx") Integer bdIdx, @RequestParam("fileIdx") Integer fileIdx, final HttpServletRequest request, final HttpServletResponse response) throws Exception {
|
||||
|
||||
|
||||
BoardVO paramVO = new BoardVO();
|
||||
paramVO.setBdIdx(bdIdx);
|
||||
BoardVO boardVO = boardService.select(paramVO);
|
||||
String orgfileName = boardVO.getOrgFileNames().get(fileIdx);
|
||||
String saveFileName = boardVO.getSaveFileNames().get(fileIdx);
|
||||
|
||||
String fileFullPath = propertiesService.getString("Globals.fileStorePath") + File.separator + "document" + File.separator + saveFileName ;
|
||||
|
||||
|
||||
File file = new File(fileFullPath);
|
||||
|
||||
|
||||
if (file.exists()) {
|
||||
FileResponser.setResponse(file, orgfileName, 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/search.do")
|
||||
public String search(final SearchVO searchVO, final Model model, final SessionStatus status) throws Exception {
|
||||
|
||||
|
||||
LoginUserVO user = UserUtil.getMemberInfo();
|
||||
|
||||
searchVO.setPla1(user.getPlace1());
|
||||
searchVO.setPla2(user.getPlace2());
|
||||
searchVO.setUserid(user.getUserid());
|
||||
|
||||
model.addAttribute("searchKeyWord", searchVO.getSearchKeyWord());
|
||||
model.addAttribute("data", boardService.searchBoard(searchVO));
|
||||
|
||||
return "board/searchResult.tiles";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package kcg.imis.cmmn;
|
||||
|
||||
/**
|
||||
* @FileName : CommConstants.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 21.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 : 공통 상수 객체
|
||||
*/
|
||||
public class CommConstants {
|
||||
|
||||
public static final String FILE_TYPE_DOC = "document";
|
||||
public static final String FILE_TYPE_IMG = "image";
|
||||
public static final String FILE_TYPE_REPORT = "report";
|
||||
|
||||
|
||||
public static final String CODE_PLACE1 = "PLA1";
|
||||
public static final String CODE_CATE1 = "CAT1";
|
||||
public static final String CODE_CATE2 = "CAT2";
|
||||
public static final String CODE_DUTY = "DUTY";
|
||||
|
||||
public static final String CODE_JUDGE = "DC05";
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
package kcg.imis.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;
|
||||
|
||||
/**
|
||||
* @FileName : CommConstants.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 21.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 : 공통 유틸 객체
|
||||
*/
|
||||
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.imis.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,22 @@
|
|||
package kcg.imis.cmmn;
|
||||
|
||||
/**
|
||||
* @FileName : MenuPosition.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 21.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 : 메뉴 위치 상수 객체
|
||||
*/
|
||||
public final class MenuPosition {
|
||||
/**
|
||||
* 상단메뉴. (메인메뉴)
|
||||
*/
|
||||
public static final String TOP = "GNB";
|
||||
|
||||
/**
|
||||
* 상단 보조메뉴.
|
||||
*/
|
||||
public static final String TOP_SUB = "SUB";
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,160 @@
|
|||
package kcg.imis.cmmn.aop;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import kcg.imis.cmmn.service.LogService;
|
||||
import kcg.imis.cmmn.service.MenuService;
|
||||
import kcg.imis.cmmn.vo.MenuVO;
|
||||
import kcg.imis.sec.LoginUserVO;
|
||||
import kcg.imis.sec.UserUtil;
|
||||
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
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 egovframework.rte.psl.dataaccess.util.EgovMap;
|
||||
|
||||
/**
|
||||
* @FileName : CommonAop.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 21.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 : 공통AOP 객체
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
public class CommonAop {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(CommonAop.class);
|
||||
|
||||
@Resource(name = "menuService")
|
||||
MenuService menuService;
|
||||
|
||||
@Resource(name = "logService")
|
||||
LogService logService;
|
||||
|
||||
@Around("execution(* kcg.imis..*Controller.*(..))")
|
||||
public Object menuGenerator(final ProceedingJoinPoint thisJoinPoint) throws Throwable {
|
||||
|
||||
HttpServletRequest req = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||
String[] excludeUrls = {"/loginView.do","/member/regist.json","/code/codeList.json", "/member/checkId.json"};
|
||||
String loginUrl = "/loginView.do";
|
||||
String url = req.getRequestURI();
|
||||
|
||||
for(String excludeUrl : excludeUrls){
|
||||
if(excludeUrl.endsWith(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.setRoleLevel(loginUserVO.getRolelevel());
|
||||
List<MenuVO> mainMenuList = menuService.selectMainMenu(menuVO);
|
||||
model.addAttribute("mainMenuList", mainMenuList);
|
||||
model.addAttribute("topMenu", menuService.getTopMenu());
|
||||
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("bbsId") != null) {
|
||||
boardId = req.getParameter("bbsId");
|
||||
}
|
||||
|
||||
if(req.getParameter("ct") != null && !req.getParameter("ct").equals("")){
|
||||
qryCate = "ct=" + req.getParameter("ct");
|
||||
model.addAttribute("worlddb", req.getParameter("ct"));
|
||||
}
|
||||
if(req.getParameter("seq") != null){
|
||||
qryCate = "seq=" + req.getParameter("seq");
|
||||
model.addAttribute("worlddb", req.getParameter("seq"));
|
||||
}
|
||||
menu.put("url", url);
|
||||
menu.put("group", group);
|
||||
menu.put("boardId", boardId);
|
||||
menu.put("query", qryCate);
|
||||
|
||||
EgovMap menuInfo = menuService.getMenuInfo(menu);
|
||||
menuInfo.put("userId", loginUserVO.getUserid());
|
||||
model.addAttribute("menu", menuInfo);
|
||||
|
||||
List<MenuVO> subMenuList = menuService.getSubMenu(menuInfo);
|
||||
|
||||
model.addAttribute("subMenu", subMenuList);
|
||||
|
||||
((BigDecimal) menuInfo.get("depth")).intValue();
|
||||
|
||||
List<EgovMap> currAndHigherMenuList = menuService.selectListWithHigher(menuInfo.get("id").toString());
|
||||
model.addAttribute("currAndHigherMenuList", currAndHigherMenuList);
|
||||
|
||||
addUserLog(req, menuInfo);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Object proc = thisJoinPoint.proceed();
|
||||
return proc;
|
||||
}
|
||||
|
||||
|
||||
private void addUserLog(final HttpServletRequest req, EgovMap menu) {
|
||||
|
||||
try {
|
||||
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", req.getRemoteAddr());
|
||||
paramMap.put("place1", user.getPlace1());
|
||||
paramMap.put("place2", user.getPlace2());
|
||||
paramMap.put("position", user.getDuties());
|
||||
|
||||
paramMap.put("menuid", menu.get("id"));
|
||||
paramMap.put("location", req.getRequestURI());
|
||||
|
||||
logService.insertUserLog(paramMap);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("fail log insert...............");
|
||||
LOGGER.error(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
package kcg.imis.cmmn.bbs;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* @FileName : BaseBbsService.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 22.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 : 기본 게시판 인터페이스
|
||||
*/
|
||||
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,114 @@
|
|||
package kcg.imis.cmmn.bbs;
|
||||
|
||||
/**
|
||||
*
|
||||
* @FileName : BaseFileVO.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 29.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 : 게시판형 공용 첨부파일 VO.
|
||||
*/
|
||||
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,198 @@
|
|||
package kcg.imis.cmmn.bbs;
|
||||
|
||||
/**
|
||||
*
|
||||
* @FileName : BaseSearchVO.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 22.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 : 기본 게시판 검색 VO
|
||||
*/
|
||||
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,37 @@
|
|||
package kcg.imis.cmmn.bbs;
|
||||
|
||||
/**
|
||||
*
|
||||
* @FileName : PageType.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 29.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 : 페이지 화면 구분.
|
||||
*/
|
||||
public enum PageType {
|
||||
/**
|
||||
* 목록화면.
|
||||
*/
|
||||
List,
|
||||
/**
|
||||
* 정보조회화면.
|
||||
*/
|
||||
View,
|
||||
/**
|
||||
* 입력화면.
|
||||
*/
|
||||
Add,
|
||||
/**
|
||||
* 수정화면.
|
||||
*/
|
||||
Upd,
|
||||
/**
|
||||
* 삭제화면.
|
||||
*/
|
||||
Del,
|
||||
/**
|
||||
* 통계현황화면.
|
||||
*/
|
||||
Stats
|
||||
}
|
||||
|
|
@ -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.imis.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.imis.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.imis.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.imis.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.imis.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.imis.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.imis.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.imis.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.imis.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,570 @@
|
|||
|
||||
package kcg.imis.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.imis.cmmn.CommConstants;
|
||||
import kcg.imis.cmmn.egov.util.EgovStringUtil;
|
||||
import kcg.imis.cmmn.egov.util.EgovWebUtil;
|
||||
import kcg.imis.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 {
|
||||
return parseFileInf(files, keyStr, fileKeyParam, atchFileId, storePath, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 첨부파일을 서버에 저장한다.
|
||||
*
|
||||
* @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
|
||||
* @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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 곹오컴포넌트 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, String folderNm)
|
||||
throws Exception {
|
||||
int fileKey = fileKeyParam;
|
||||
|
||||
String baseStorePathString = "";
|
||||
String atchFileIdString = "";
|
||||
|
||||
if (StringUtils.isBlank(storePath)) {
|
||||
baseStorePathString = propertyService.getString(storePath, "Globals.fileStorePath");
|
||||
} else {
|
||||
baseStorePathString = propertyService.getString(storePath);
|
||||
}
|
||||
|
||||
|
||||
if (StringUtils.isBlank(atchFileId)) {
|
||||
atchFileIdString = atchFileId;
|
||||
} else {
|
||||
atchFileIdString = atchFileId;
|
||||
}
|
||||
|
||||
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 storePathString = "";
|
||||
|
||||
if(folderNm != null){
|
||||
|
||||
String id = file.getName();
|
||||
if(id.startsWith(CommConstants.FILE_TYPE_IMG))
|
||||
folderNm = CommConstants.FILE_TYPE_IMG;
|
||||
else if(id.startsWith(CommConstants.FILE_TYPE_DOC))
|
||||
folderNm = CommConstants.FILE_TYPE_DOC;
|
||||
|
||||
storePathString = baseStorePathString + folderNm + File.separator;
|
||||
|
||||
File saveFolder = new File(storePathString);
|
||||
|
||||
if (!saveFolder.exists() || saveFolder.isFile()) {
|
||||
saveFolder.mkdirs();
|
||||
}
|
||||
} else {
|
||||
|
||||
storePathString = baseStorePathString + CommConstants.FILE_TYPE_DOC + File.separator;
|
||||
|
||||
File saveFolder = new File(storePathString);
|
||||
|
||||
if (!saveFolder.exists() || saveFolder.isFile()) {
|
||||
saveFolder.mkdirs();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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.imis.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.imis.cmmn.egov.file.EgovFormBasedFileUtil;
|
||||
import kcg.imis.cmmn.egov.file.EgovFormBasedFileVo;
|
||||
import kcg.imis.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.imis.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.imis.cmmn.egov.EgovResourceCloseHelper;
|
||||
import kcg.imis.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.imis.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.imis.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,45 @@
|
|||
/*
|
||||
* 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.imis.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;
|
||||
|
||||
public class HTMLTagFilter implements Filter{
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private FilterConfig config;
|
||||
|
||||
public void doFilter(ServletRequest request, ServletResponse response,
|
||||
FilterChain chain) throws IOException, ServletException {
|
||||
|
||||
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.imis.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.imis.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.imis.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.imis.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,241 @@
|
|||
package kcg.imis.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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FileVO [atchFileId=" + atchFileId + ", creatDt=" + creatDt + ", fileCn=" + fileCn + ", fileExtsn=" + fileExtsn + ", fileMg=" + fileMg + ", fileSn=" + fileSn + ", fileStreCours="
|
||||
+ fileStreCours + ", orignlFileNm=" + orignlFileNm + ", streFileNm=" + streFileNm + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
/**
|
||||
* AbstractExcelGenerator.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 14.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 14. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
package kcg.imis.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;
|
||||
|
||||
/**
|
||||
* @FileName : AbstractExcelExport.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 29.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
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,15 @@
|
|||
package kcg.imis.cmmn.excel;
|
||||
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
/**
|
||||
* @FileName : ExcelExport.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 29.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
public interface ExcelExport {
|
||||
public abstract XSSFWorkbook makeExcel(XSSFWorkbook wb);
|
||||
}
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
package kcg.imis.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,126 @@
|
|||
package kcg.imis.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;
|
||||
|
||||
/**
|
||||
* @FileName : ExcelStyle.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 29.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
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,58 @@
|
|||
package kcg.imis.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;
|
||||
|
||||
/**
|
||||
* @FileName : ExcelView.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 29.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
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,125 @@
|
|||
package kcg.imis.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;
|
||||
|
||||
/**
|
||||
* @FileName : FileResponser.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 29.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
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,122 @@
|
|||
package kcg.imis.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.imis.cmmn.egov.EgovResourceCloseHelper;
|
||||
import kcg.imis.cmmn.egov.file.EgovFileMngUtil;
|
||||
import kcg.imis.cmmn.egov.util.EgovStringUtil;
|
||||
import kcg.imis.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;
|
||||
/**
|
||||
* @FileName : FileUploadUtil.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 29.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
@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, 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,27 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package kcg.imis.cmmn.json;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider;
|
||||
|
||||
|
||||
/**
|
||||
* @FileName : CustomObjectMapper.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 29.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
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,27 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package kcg.imis.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;
|
||||
|
||||
|
||||
/**
|
||||
* @FileName : NullSerializer.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 29.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
public class NullSerializer extends JsonSerializer<Object> {
|
||||
@Override
|
||||
public void serialize(Object o, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
|
||||
jsonGenerator.writeString("");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
package kcg.imis.cmmn.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import kcg.imis.cmmn.vo.CodeVO;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @FileName : CodeMapper.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 21.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
@Repository("codeMapper")
|
||||
public class CodeMapper extends EgovAbstractMapper {
|
||||
|
||||
/**
|
||||
* 코드 목록을 조회한다
|
||||
* @param group 그룹 코드
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<CodeVO> getCodeList(final String group)
|
||||
throws Exception {
|
||||
|
||||
CodeVO codeVO = new CodeVO();
|
||||
codeVO.setGroup(group);
|
||||
|
||||
return selectList("Code.getCodeList", codeVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 코드 상세 조회 한다
|
||||
* @param group
|
||||
* @param code
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public CodeVO getCode(final String group, final String code)
|
||||
throws Exception {
|
||||
|
||||
CodeVO codeVO = new CodeVO();
|
||||
codeVO.setGroup(group);
|
||||
codeVO.setCode(code);
|
||||
|
||||
return selectOne("Code.getCode", codeVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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,47 @@
|
|||
package kcg.imis.cmmn.mapper;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import kcg.imis.admin.vo.LogSearchVO;
|
||||
import kcg.imis.admin.vo.LogVO;
|
||||
import kcg.imis.sec.LoginUserVO;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
|
||||
|
||||
/**
|
||||
* @FileName : LogMapper.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 29.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
@Repository
|
||||
public class LogMapper extends EgovAbstractMapper {
|
||||
|
||||
/**
|
||||
* 사용자 로그를 추가한다.
|
||||
*
|
||||
* @param paramMap 파라미터 맵
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int insertUserLog(HashMap<String, Object> paramMap) {
|
||||
return insert("Log.insertUserLog", paramMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 설명
|
||||
*
|
||||
* @param 파라미터 파라미터설명
|
||||
* @return 리턴값 설명
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int insertLoginLog(HashMap<String, Object> paramMap) {
|
||||
return (Integer) insert("Log.insertLoginLog", paramMap);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
package kcg.imis.cmmn.mapper;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import kcg.imis.cmmn.vo.MenuVO;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
|
||||
import egovframework.rte.psl.dataaccess.util.EgovMap;
|
||||
|
||||
@Repository("menuMapper")
|
||||
public class MenuMapper extends EgovAbstractMapper {
|
||||
|
||||
/**
|
||||
* 현재 메뉴와 상위메뉴 목록을 반환한다.
|
||||
*
|
||||
* @param menuVO
|
||||
* 검색조건 VO
|
||||
* @return 현재 메뉴를 포함한 상위메뉴 목록
|
||||
*/
|
||||
public List<MenuVO> selectMemuList(final MenuVO menuVO) {
|
||||
return selectList("Menu.selectMemuList", menuVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시판 메뉴에 대한 정보를 가져온다.
|
||||
*
|
||||
* @return 데이터 맵
|
||||
*/
|
||||
public EgovMap getMenuInfo(final HashMap<String, Object> menu) {
|
||||
return selectOne("Menu.getMenuInfo", menu);
|
||||
}
|
||||
|
||||
/**
|
||||
* 설명
|
||||
*
|
||||
* @param 파라미터 파라미터설명
|
||||
* @return 리턴값 설명
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public EgovMap getMenuInfoById(String menuId) {
|
||||
return selectOne("Menu.getMenuInfoById", menuId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 설명
|
||||
*
|
||||
* @param 파라미터 파라미터설명
|
||||
* @return 리턴값 설명
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public EgovMap getMenuInfoByParentId(Map<String, Object> paramMap) {
|
||||
return selectOne("Menu.getMenuInfoByParentId", paramMap);
|
||||
}
|
||||
/**
|
||||
* 서브 메뉴 (3depth) 조회
|
||||
* @param 파라미터 파라미터설명
|
||||
* @return 리턴값 설명
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public List<MenuVO> getSubMenu(EgovMap map) {
|
||||
return selectList("Menu.getSubMenu", map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 탑 메뉴를 조회한다.
|
||||
* @param 파라미터 파라미터설명
|
||||
* @return 리턴값 설명
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public List<MenuVO> getTopMenu(EgovMap map) {
|
||||
return selectList("Menu.getTopMenu", map);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
package kcg.imis.cmmn.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import kcg.imis.cmmn.vo.CodeVO;
|
||||
|
||||
/**
|
||||
*
|
||||
* @FileName : CodeService.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 21.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 : 코드 서비스 인터페이스
|
||||
*/
|
||||
public interface CodeService {
|
||||
|
||||
/**
|
||||
* 소속 구조.
|
||||
*/
|
||||
Map<String, String[]> PLACE_CATEGORY = new TreeMap<String, String[]>(String.CASE_INSENSITIVE_ORDER) {
|
||||
/**
|
||||
* serialVersionUID.
|
||||
*/
|
||||
private static final long serialVersionUID = -8213220033671425747L;
|
||||
|
||||
{
|
||||
//서해본부
|
||||
put("PS92", new String[] { "PS05", "PS06", "PS07", "PS08", "PS09", "ps18" });
|
||||
//남해본부
|
||||
put("PS93", new String[] { "PS01", "PS09", "PS12", "PS13", "PS98" });
|
||||
//동해본부
|
||||
put("PS94", new String[] { "PS03", "PS04", "PS10", "PS11" });
|
||||
put("PS02", new String[] {});
|
||||
put("PS95", new String[] {});
|
||||
put("PS96", new String[] {});
|
||||
put("PS97", new String[] {});
|
||||
put("PS99", new String[] {});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 코드 목록 반환
|
||||
* @param group 코드 그룹
|
||||
* @return
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
List<CodeVO> getCodeList(String group) throws Exception;
|
||||
|
||||
List<CodeVO> getCodeList(String group, boolean includeAll) throws Exception;
|
||||
|
||||
HashMap<String, String> getCodeMap(String group) throws Exception;
|
||||
/**
|
||||
* 코드 상세 반환
|
||||
* @param group 코드 그룹
|
||||
* @param code 코드
|
||||
* @return
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
CodeVO getCode(String group, String code) throws Exception;
|
||||
|
||||
/**
|
||||
* 코드를 수정 한다 CodeVO 객체
|
||||
* @param codeVO
|
||||
* @return
|
||||
* @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;
|
||||
|
||||
public List<CodeVO> getPlace1SubList(final String place1Code) throws Exception;
|
||||
|
||||
public List<CodeVO> getPlace1SubListWithMain(final String place1Code) throws Exception;
|
||||
|
||||
public String getPlace1HighCode(final String place1Code) throws Exception;
|
||||
}
|
||||
|
|
@ -0,0 +1,220 @@
|
|||
package kcg.imis.cmmn.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import kcg.imis.cmmn.CommConstants;
|
||||
import kcg.imis.cmmn.mapper.CodeMapper;
|
||||
import kcg.imis.cmmn.vo.CodeVO;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
*
|
||||
* @FileName : CodeServiceImpl.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 21.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 : 코드 서비스 객체
|
||||
*/
|
||||
@Service("codeService")
|
||||
public class CodeServiceImpl implements CodeService {
|
||||
|
||||
final String LIST_ALL_VAL = "";
|
||||
final String LIST_ALL_STR = "전체";
|
||||
|
||||
/**
|
||||
* CodeMapper.
|
||||
*/
|
||||
@Resource(name = "codeMapper")
|
||||
private CodeMapper codeMapper;
|
||||
|
||||
|
||||
public List<CodeVO> getCodeList(final String group) throws Exception {
|
||||
|
||||
List<CodeVO> codeVOList = new ArrayList<CodeVO>();
|
||||
|
||||
try {
|
||||
codeVOList = codeMapper.getCodeList(group);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
codeVOList = null;
|
||||
}
|
||||
|
||||
return codeVOList;
|
||||
}
|
||||
|
||||
public List<CodeVO> getCodeList(final String group, boolean includeAll) throws Exception {
|
||||
|
||||
List<CodeVO> codeVOList = new ArrayList<CodeVO>();
|
||||
|
||||
try {
|
||||
codeVOList = codeMapper.getCodeList(group);
|
||||
if (includeAll) {
|
||||
codeVOList = addAll(codeVOList);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
codeVOList = null;
|
||||
}
|
||||
|
||||
return codeVOList;
|
||||
}
|
||||
|
||||
public CodeVO getCode(final String group, final String code) throws Exception {
|
||||
|
||||
CodeVO codeVOList = new CodeVO();
|
||||
|
||||
try {
|
||||
codeVOList = codeMapper.getCode(group, code);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
codeVOList = null;
|
||||
}
|
||||
|
||||
return codeVOList;
|
||||
}
|
||||
|
||||
public HashMap<String, String> getCodeMap(final String group) throws Exception {
|
||||
|
||||
try {
|
||||
List<CodeVO> codeVOList = new ArrayList<CodeVO>();
|
||||
codeVOList = codeMapper.getCodeList(group);
|
||||
return convertMap(codeVOList);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* code를 수정한다.
|
||||
*
|
||||
* @param codeVO CodeVO 객체
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
|
||||
public int updateCode(final CodeVO codeVO) throws Exception {
|
||||
return codeMapper.updateCode(codeVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* code를 추가한다.
|
||||
*
|
||||
* @param codeVO CodeVO 객체
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
|
||||
public int insertCode(final CodeVO codeVO) throws Exception {
|
||||
return codeMapper.insertCode(codeVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* code를 삭제한다.
|
||||
*
|
||||
* @param codeVO CodeVO 객체
|
||||
* @return 성공 - 1, 실패 - 0 `
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
@Transactional
|
||||
public int deleteCode(final CodeVO codeVO) throws Exception {
|
||||
return codeMapper.deleteCode(codeVO);
|
||||
}
|
||||
|
||||
|
||||
@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 = getCode(CommConstants.CODE_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 = getCode(CommConstants.CODE_PLACE1, place1Code);
|
||||
codes.add(code);
|
||||
|
||||
// 하위 기관
|
||||
for (int i = 0; i < subCodes.length; i++) {
|
||||
code = getCode(CommConstants.CODE_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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 맵으로 변환
|
||||
* @param list 분류목록
|
||||
* @return ("코드명", "코드") 형식으로 리턴
|
||||
*/
|
||||
private HashMap<String, String> convertMap(final List<CodeVO> list) {
|
||||
HashMap<String, String> map = new HashMap<String, String>();
|
||||
for (CodeVO item : list) {
|
||||
map.put(item.getCode(), item.getName());
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
private List<CodeVO> addAll(final List<CodeVO> list) {
|
||||
if (list != null) {
|
||||
CodeVO allVO = new CodeVO();
|
||||
allVO.setCode(LIST_ALL_VAL);
|
||||
allVO.setGroup(LIST_ALL_VAL);
|
||||
allVO.setName(LIST_ALL_STR);
|
||||
allVO.setShortName(LIST_ALL_STR);
|
||||
list.add(0, allVO);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package kcg.imis.cmmn.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import kcg.imis.admin.vo.LogSearchVO;
|
||||
import kcg.imis.admin.vo.LogVO;
|
||||
|
||||
/**
|
||||
* @FileName : LogService.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 29.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
public interface LogService {
|
||||
|
||||
/**
|
||||
* 사용자 로그 를 저장한다
|
||||
* @param paramMap
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public int insertUserLog(HashMap<String, Object> paramMap) throws Exception;
|
||||
|
||||
/**
|
||||
* 로그인 정보를 저장한다.
|
||||
* @param paramMap
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public int insertLoginLog(HashMap<String, Object> paramMap) throws Exception;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package kcg.imis.cmmn.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import kcg.imis.admin.vo.LogSearchVO;
|
||||
import kcg.imis.admin.vo.LogVO;
|
||||
import kcg.imis.cmmn.mapper.LogMapper;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @FileName : LogServiceImpl.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 29.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
@Service("logService")
|
||||
public class LogServiceImpl implements LogService {
|
||||
|
||||
@Resource(name="logMapper")
|
||||
LogMapper logMapper;
|
||||
|
||||
@Override
|
||||
public int insertUserLog(HashMap<String, Object> paramMap) throws Exception {
|
||||
return logMapper.insertUserLog(paramMap);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int insertLoginLog(HashMap<String, Object> paramMap) throws Exception {
|
||||
return logMapper.insertLoginLog(paramMap);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package kcg.imis.cmmn.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import kcg.imis.cmmn.vo.MenuVO;
|
||||
import egovframework.rte.psl.dataaccess.util.EgovMap;
|
||||
|
||||
/**
|
||||
* @FileName : MenuService.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 29.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
public interface MenuService {
|
||||
|
||||
/**
|
||||
* 현재 메뉴와 상위메뉴 목록을 반환한다.
|
||||
*
|
||||
* @param menuVO
|
||||
* 검색조건 VO
|
||||
* @return 현재 메뉴를 포함한 상위메뉴 목록
|
||||
*/
|
||||
List<MenuVO> selectMainMenu(MenuVO menuVO);
|
||||
|
||||
|
||||
/**
|
||||
* 게시판 메뉴에 대한 정보를 가져온다.
|
||||
*
|
||||
* @param menu
|
||||
* 가져올 메뉴정보
|
||||
* @return 데이터 맵
|
||||
*/
|
||||
EgovMap getMenuInfo(HashMap<String, Object> menu);
|
||||
|
||||
List<EgovMap> selectListWithHigher(String menuId);
|
||||
|
||||
List<MenuVO> getSubMenu(EgovMap map);
|
||||
|
||||
List<MenuVO> getTopMenu();
|
||||
}
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
package kcg.imis.cmmn.service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import kcg.imis.cmmn.MenuPosition;
|
||||
import kcg.imis.cmmn.mapper.MenuMapper;
|
||||
import kcg.imis.cmmn.vo.MenuVO;
|
||||
import kcg.imis.sec.LoginUserVO;
|
||||
import kcg.imis.sec.UserUtil;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.util.EgovMap;
|
||||
|
||||
@Service("menuService")
|
||||
public class MenuServiceImpl implements MenuService {
|
||||
|
||||
/**
|
||||
* MenuMapper - 메뉴 데이터처리에 관한 Mapper 클래스.
|
||||
**/
|
||||
@Resource(name = "menuMapper")
|
||||
private MenuMapper menuMapper;
|
||||
|
||||
@Override
|
||||
public List<MenuVO> selectMainMenu(final MenuVO menuVO) {
|
||||
|
||||
menuVO.setDepth(1);
|
||||
menuVO.setMenuPosition(MenuPosition.TOP);
|
||||
List<MenuVO> list = menuMapper.selectMemuList(menuVO);
|
||||
|
||||
menuVO.setDepth(2);
|
||||
menuVO.setMenuPosition(MenuPosition.TOP);
|
||||
List<MenuVO> list2 = menuMapper.selectMemuList(menuVO);
|
||||
for(MenuVO menuVo2 : list2){
|
||||
|
||||
Map<String, Object> paramMap = new HashMap<String, Object>();
|
||||
paramMap.put("roleLevel", menuVO.getRoleLevel());
|
||||
paramMap.put("id", menuVo2.getId());
|
||||
|
||||
if(menuVo2.getUrl() == null ||"".equals(menuVo2.getUri())){
|
||||
EgovMap map = menuMapper.getMenuInfoByParentId(paramMap);
|
||||
if(map != null){
|
||||
menuVo2.setUrl(String.valueOf(map.get("url")));
|
||||
}
|
||||
}
|
||||
}
|
||||
for(MenuVO menuVo : list){
|
||||
List<MenuVO> dept2List = new ArrayList<MenuVO>();
|
||||
for(MenuVO menuVo2 : list2){
|
||||
if(menuVo.getId() == menuVo2.getParent()){
|
||||
dept2List.add(menuVo2);
|
||||
}
|
||||
}
|
||||
menuVo.setMenuList(dept2List);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/* @Override
|
||||
public List<MenuVO> selectTopSubMenuList(final MenuVO menuVO) {
|
||||
menuVO.setDepth(0);
|
||||
menuVO.setMenuPosition(MenuPosition.TOP_SUB);
|
||||
return menuMapper.selectListWithConnectBy(menuVO);
|
||||
}
|
||||
*/
|
||||
/**
|
||||
* 게시판 메뉴에 대한 정보를 가져온다.
|
||||
*
|
||||
* @return 데이터 맵
|
||||
*/
|
||||
@Override
|
||||
public EgovMap getMenuInfo(final HashMap<String, Object> menu) {
|
||||
return menuMapper.getMenuInfo(menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EgovMap> selectListWithHigher(final String menuId) {
|
||||
|
||||
List<EgovMap> resultList = new ArrayList<EgovMap>();
|
||||
EgovMap currentMenu = menuMapper.getMenuInfoById(menuId);
|
||||
resultList.add(currentMenu);
|
||||
|
||||
int depth = ((BigDecimal)currentMenu.get("depth")).intValue();
|
||||
String parentId = String.valueOf(currentMenu.get("parent"));
|
||||
for(int i = 1 ; i < depth ; i ++){
|
||||
EgovMap parentMenu = menuMapper.getMenuInfoById(parentId);
|
||||
parentId = String.valueOf(parentMenu.get("parent"));
|
||||
resultList.add(parentMenu);
|
||||
}
|
||||
Collections.reverse(resultList);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 서브 메뉴에 대한 정보를 가져온다.
|
||||
*
|
||||
* @return 데이터 맵
|
||||
*/
|
||||
@Override
|
||||
public List<MenuVO> getSubMenu(EgovMap map) {
|
||||
|
||||
LoginUserVO loginUserVO = UserUtil.getMemberInfo();
|
||||
map.put("roleLevel", loginUserVO.getRolelevel());
|
||||
|
||||
List<MenuVO> submenu = menuMapper.getSubMenu(map);
|
||||
return submenu;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MenuVO> getTopMenu() {
|
||||
EgovMap map = new EgovMap();
|
||||
LoginUserVO loginUserVO = UserUtil.getMemberInfo();
|
||||
map.put("roleLevel", loginUserVO.getRolelevel());
|
||||
|
||||
List<MenuVO> topmenu = menuMapper.getTopMenu(map);
|
||||
return topmenu;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
package kcg.imis.cmmn.vo;
|
||||
|
||||
/**
|
||||
*
|
||||
* @FileName : CodeVO.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 21.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 : 코드VO 객체
|
||||
*/
|
||||
public class CodeVO {
|
||||
|
||||
private String group;
|
||||
private String code;
|
||||
private String name;
|
||||
private String shortName;
|
||||
private String order;
|
||||
private String useYn;
|
||||
|
||||
public String getGroup() {
|
||||
return group;
|
||||
}
|
||||
public void setGroup(String group) {
|
||||
this.group = group;
|
||||
}
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getShortName() {
|
||||
return shortName;
|
||||
}
|
||||
public void setShortName(String shortName) {
|
||||
this.shortName = shortName;
|
||||
}
|
||||
public String getOrder() {
|
||||
return order;
|
||||
}
|
||||
public void setOrder(String order) {
|
||||
this.order = order;
|
||||
}
|
||||
public String getUseYn() {
|
||||
return useYn;
|
||||
}
|
||||
public void setUseYn(String useYn) {
|
||||
this.useYn = useYn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,417 @@
|
|||
package kcg.imis.cmmn.vo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* @FileName : MenuVO.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 29.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
public class MenuVO {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MenuVO [menuList=" + menuList + ", id=" + id + ", name=" + name + ", engName=" + engName + ", parent=" + parent + ", depth=" + depth + ", url=" + url + ", uri=" + uri
|
||||
+ ", menuPosition=" + menuPosition + ", visible=" + visible + ", urlGroup=" + urlGroup + ", subVisible=" + subVisible + ", roleLevel=" + roleLevel + ", urlQuery=" + urlQuery
|
||||
+ ", boardId=" + boardId + ", windowTarget=" + windowTarget + ", subMenu=" + subMenu + ", userId=" + userId + ", userType=" + userType + "]";
|
||||
}
|
||||
|
||||
private List<MenuVO> menuList;
|
||||
|
||||
/**
|
||||
* 식별자.
|
||||
*/
|
||||
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 = "?bbsId=" + 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;
|
||||
}
|
||||
|
||||
public List<MenuVO> getMenuList() {
|
||||
return menuList;
|
||||
}
|
||||
|
||||
public void setMenuList(List<MenuVO> menuList) {
|
||||
this.menuList = menuList;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
package kcg.imis.cmmn.web;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import kcg.imis.cmmn.service.CodeServiceImpl;
|
||||
import kcg.imis.cmmn.vo.CodeVO;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
/**
|
||||
*
|
||||
* @FileName : CodeController.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 21.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 : 코드 컨트롤러
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/code")
|
||||
public class CodeController {
|
||||
|
||||
@Resource(name = "codeService")
|
||||
private CodeServiceImpl codeService;
|
||||
|
||||
/**
|
||||
* 코드 리스트를 반환
|
||||
*
|
||||
* @param codeVO 코드VO
|
||||
* @return 소속 코드 리스트
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping("/codeList.json")
|
||||
public HashMap<String, Object> codeList(final CodeVO codeVO) throws Exception {
|
||||
HashMap<String, Object> result = new HashMap<String, Object>();
|
||||
result.put("data", codeService.getCodeList(codeVO.getGroup()));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 코드를 반환
|
||||
*
|
||||
* @param codeVO 코드VO
|
||||
* @return 소속 코드 리스트
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping("/code.json")
|
||||
public HashMap<String, Object> code(final CodeVO codeVO) throws Exception {
|
||||
HashMap<String, Object> result = new HashMap<String, Object>();
|
||||
result.put("data", codeService.getCode(codeVO.getGroup(),codeVO.getCode()));
|
||||
return result;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping("/insert.json")
|
||||
public HashMap<String, Object> insert(final CodeVO codeVO) throws Exception {
|
||||
HashMap<String, Object> result = new HashMap<String, Object>();
|
||||
result.put("cnt", codeService.insertCode(codeVO));
|
||||
return result;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping("/update.json")
|
||||
public HashMap<String, Object> update(final CodeVO codeVO) throws Exception {
|
||||
HashMap<String, Object> result = new HashMap<String, Object>();
|
||||
result.put("cnt", codeService.updateCode(codeVO));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 코드를 삭제한다.
|
||||
*
|
||||
* @param codeVO CodeVO 객체
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping("/delete.json")
|
||||
public HashMap<String, Object> deleteCode(final CodeVO codeVO) throws Exception {
|
||||
HashMap<String, Object> resultMap = new HashMap<String, Object>();
|
||||
resultMap.put("cnt", codeService.deleteCode(codeVO));
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,171 @@
|
|||
package kcg.imis.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.imis.board.service.BoardService;
|
||||
import kcg.imis.board.vo.BoardSearchVO;
|
||||
import kcg.imis.board.vo.BoardVO;
|
||||
import kcg.imis.cmmn.service.CodeServiceImpl;
|
||||
import kcg.imis.notice.service.NoticeService;
|
||||
import kcg.imis.notice.vo.NoticeVO;
|
||||
import kcg.imis.report.service.ReportJudgeService;
|
||||
import kcg.imis.report.vo.ReportSearchVO;
|
||||
import kcg.imis.report.vo.ReportVO;
|
||||
import kcg.imis.sec.LoginUserVO;
|
||||
import kcg.imis.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;
|
||||
|
||||
|
||||
/**
|
||||
* @FileName : CommonController.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 29.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
@Controller
|
||||
@SessionAttributes(types = LoginUserVO.class)
|
||||
public class CommonController {
|
||||
|
||||
@Resource(name = "codeService")
|
||||
private CodeServiceImpl codeService;
|
||||
|
||||
@Resource(name = "reportJudgeService")
|
||||
private ReportJudgeService judgeService;
|
||||
|
||||
@Resource(name = "boardService")
|
||||
private BoardService boardService;
|
||||
|
||||
@Resource(name = "noticeService")
|
||||
private NoticeService noticeService;
|
||||
|
||||
|
||||
/**
|
||||
* 로그인 화면으로 이동한다. 이미 로그인 되어 있을 경우, 메인페이지로 이동한다.
|
||||
*
|
||||
* @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);
|
||||
model.addAttribute("code", codeService.getCodeList(null));
|
||||
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, -12);
|
||||
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);
|
||||
|
||||
//내 실적 조회 최근 1달치
|
||||
mon = Calendar.getInstance();
|
||||
mon.add(Calendar.MONTH, -1);
|
||||
stSdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
stDate = stSdf.format(mon.getTime());
|
||||
|
||||
today = new Date();
|
||||
date = new SimpleDateFormat("yyyy-MM-dd");
|
||||
enDate = date.format(today);
|
||||
|
||||
/* 공지사항 리스트 */
|
||||
searchVO.setBbsId("notice");
|
||||
List<BoardVO> noticeList = boardService.selectList(searchVO);
|
||||
model.addAttribute("noticeList", noticeList);
|
||||
|
||||
/* 국제회의 리스트 */
|
||||
searchVO.setBbsId("confer");
|
||||
List<BoardVO> bbsList = boardService.selectList(searchVO);
|
||||
model.addAttribute("conferList", bbsList);
|
||||
|
||||
/* 해양정세리포트 리스트 */
|
||||
searchVO.setBbsId("report");
|
||||
List<BoardVO> dataList = boardService.selectList(searchVO);
|
||||
model.addAttribute("stateList", dataList);
|
||||
|
||||
/* 공지팝업 목록 */
|
||||
List<NoticeVO> noticePopList = noticeService.selectNoticePopupList();
|
||||
model.addAttribute("noticePopList", noticePopList);
|
||||
|
||||
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,194 @@
|
|||
package kcg.imis.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;
|
||||
|
||||
/**
|
||||
* @FileName : KcgFieldChecks.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 29.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
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,40 @@
|
|||
package kcg.imis.etc.web;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
/**
|
||||
* @FileName : EtcMenuController.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 29.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
@Controller
|
||||
public class EtcMenuController {
|
||||
|
||||
/**
|
||||
* 사이트맵.
|
||||
*
|
||||
* @return 사이트맵 화면
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping("/sitemap.do")
|
||||
public String sitemap() throws Exception {
|
||||
return "etc/sitemap.tiles";
|
||||
}
|
||||
|
||||
/**
|
||||
* QnA.
|
||||
*
|
||||
* @return QnA 화면
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping("/qna.do")
|
||||
public String qna() throws Exception {
|
||||
return "etc/qna";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,163 @@
|
|||
package kcg.imis.member.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import kcg.imis.member.vo.MemberSearchVO;
|
||||
import kcg.imis.member.vo.MemberVO;
|
||||
import kcg.imis.sec.LoginUserVO;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
|
||||
|
||||
/**
|
||||
* @FileName : MemberMapper.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 4. 9.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
@Repository("memberMapper")
|
||||
public class MemberMapper extends EgovAbstractMapper {
|
||||
|
||||
/**
|
||||
* 회원 목록(no paging)을 반환한다.
|
||||
* @param searchVO
|
||||
* 검색정보 객체
|
||||
* @return 게시물 리스트
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
public List<MemberVO> getMemberListAll(final MemberSearchVO searchVO) throws Exception {
|
||||
return selectList("Member.getMemberListAll", searchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 회원 정보 상세 조회
|
||||
* @param userid
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public MemberVO getMemberInfo(String userid) throws Exception {
|
||||
return selectOne("Member.getMemberInfo", userid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 담당관 정보 조회
|
||||
* @param userid
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public MemberVO getHeadMember() throws Exception {
|
||||
return selectOne("Member.getHeadMember");
|
||||
}
|
||||
|
||||
/**
|
||||
* 팀장 정보조회
|
||||
* @param userid
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public MemberVO getSectionMember() throws Exception {
|
||||
return selectOne("Member.getSectionMember");
|
||||
}
|
||||
|
||||
/**
|
||||
* 회원 목록 을 반환한다.
|
||||
* @param searchVO 검색정보 객체
|
||||
* @return 게시물 리스트
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
public List<MemberVO> getMemberList(final MemberSearchVO searchVO) throws Exception {
|
||||
return selectList("Member.getMemberList", searchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 엑셀용 회원 목록 을 반환한다.
|
||||
* @param searchVO
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<MemberVO> getMemberListForExel(final MemberSearchVO searchVO) throws Exception {
|
||||
return selectList("Member.getMemberListForExel", searchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 회원 목록 조회
|
||||
* @param searchVO
|
||||
* @return
|
||||
*/
|
||||
public List<LoginUserVO> getMemberListUserVO(MemberSearchVO searchVO) throws Exception {
|
||||
return selectList("Member.getMemberListUserVO", searchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 회원목록 갯수
|
||||
* @param searchVO
|
||||
* @return
|
||||
*/
|
||||
public int getMemberListCnt(MemberSearchVO searchVO) throws Exception {
|
||||
return (Integer) selectOne("Member.getMemberListCnt", searchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 회원목록 전체 갯수
|
||||
* @param searchVO
|
||||
* @return
|
||||
*/
|
||||
public int getMemberListAllCnt(MemberSearchVO searchVO) throws Exception {
|
||||
return (Integer) selectOne("Member.getMemberListAllCnt", searchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 회원 등급 설정
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public int updateUsrLv(MemberVO vo) throws Exception {
|
||||
return update("Member.updateUsrLv", vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 회원 견문권한 설정
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public int updateRtpAuth(MemberVO vo) throws Exception {
|
||||
return update("Member.updateRtpAuth", vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 회원가입
|
||||
* @param vo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public int insertUserInfo(MemberVO vo) throws Exception {
|
||||
return update("Member.insertUserInfo", vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 회원정보 수정
|
||||
* @param vo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public int updateUserInfo(MemberVO vo) throws Exception {
|
||||
return update("Member.updateUserInfo", vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 회원아이다 중복체크
|
||||
* @param vo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public int selectCheckId(String userid) throws Exception {
|
||||
return selectOne("Member.selectCheckId", userid);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
package kcg.imis.member.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import kcg.imis.cmmn.bbs.BaseBbsService;
|
||||
import kcg.imis.member.vo.MemberSearchVO;
|
||||
import kcg.imis.member.vo.MemberVO;
|
||||
|
||||
/**
|
||||
* @FileName : MemberService.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 4. 9.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
public interface MemberService {
|
||||
|
||||
/**
|
||||
* 회워 목록(no paging)읇 반환한다.
|
||||
*
|
||||
* @param searchVO
|
||||
* 검색조건 VO
|
||||
* @return 게시물 리스트
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
List<MemberVO> getMemberListAll(MemberSearchVO searchVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 회원 상세 정보 조회
|
||||
* @param searchVO
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
MemberVO getMemberInfo(String userid) throws Exception;
|
||||
|
||||
/**
|
||||
* 팀장 정보 조회
|
||||
* @param userid
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
MemberVO getHeadMember() throws Exception;
|
||||
|
||||
/**
|
||||
* 담당관 정보 조회
|
||||
* @param userid
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
MemberVO getSectionMember() throws Exception;
|
||||
|
||||
/**
|
||||
* 회원 목록 조회
|
||||
* @param searchVO
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
List<MemberVO> getMemberList(MemberSearchVO searchVO) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* 엑셀용 회원 목록 조회
|
||||
* @param searchVO
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
List<MemberVO> getMemberListForExel(final MemberSearchVO searchVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 회원 목록 갯수
|
||||
* @param searchVO
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
int getMemberListCnt(final MemberSearchVO searchVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 회원 목록 전체 갯수
|
||||
* @param searchVO
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
int getMemberListAllCnt(final MemberSearchVO searchVO) throws Exception;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 회원 권한을 설정한다.
|
||||
*
|
||||
* @param memberVO userid, usegrade 정보
|
||||
* @return 결과 : 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
int updateMemberAuth(final MemberVO memberVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 회원 견문권한을 설정한다.
|
||||
*
|
||||
* @param memberVO userid, usegrade 정보
|
||||
* @return 결과 : 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
int updateMemberRpt(final MemberVO memberVO) throws Exception;
|
||||
/**
|
||||
* 회원 팀장 권한을 설정한다.
|
||||
*
|
||||
* @param memberVO userid 정보
|
||||
* @return 결과 : 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
int updateSection(final MemberVO memberVO) throws Exception ;
|
||||
|
||||
/**
|
||||
* 회원 담당관 권한을 설정한다.
|
||||
*
|
||||
* @param memberVO userid 정보
|
||||
* @return 결과 : 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
int updateHead(final MemberVO memberVO) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* 회원가입
|
||||
* @param vo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
int insertUserInfo(MemberVO vo) throws Exception;
|
||||
|
||||
/**
|
||||
*회원정보수정
|
||||
* @param vo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
int updateUserInfo(MemberVO vo) throws Exception;
|
||||
|
||||
/**
|
||||
* 회원아이다 중복체크
|
||||
* @param vo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
int selectCheckId(String userid) throws Exception;
|
||||
|
||||
HashMap<String, Object> getMemberListUserVo(final MemberSearchVO searchVO) throws Exception;
|
||||
}
|
||||
|
|
@ -0,0 +1,175 @@
|
|||
/**
|
||||
* AdminServiceImpl.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 28.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 28. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
package kcg.imis.member.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import kcg.imis.member.mapper.MemberMapper;
|
||||
import kcg.imis.member.vo.MemberSearchVO;
|
||||
import kcg.imis.member.vo.MemberVO;
|
||||
import kcg.imis.sec.LoginUserVO;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 사용자 정보 비지니스로직.
|
||||
*
|
||||
* AdminServiceImpl.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 28.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 28. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* @author kimnomin
|
||||
*
|
||||
*/
|
||||
@Service("memberService")
|
||||
public class MemberServiceImpl implements MemberService {
|
||||
|
||||
/**
|
||||
* 사용자 Mapper 객체.
|
||||
*/
|
||||
@Resource(name = "memberMapper")
|
||||
private MemberMapper memberMapper;
|
||||
|
||||
@Override
|
||||
public List<MemberVO> getMemberListAll(MemberSearchVO searchVO) throws Exception {
|
||||
return memberMapper.getMemberListAll(searchVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MemberVO getMemberInfo(String userid) throws Exception {
|
||||
return memberMapper.getMemberInfo(userid);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MemberVO getHeadMember() throws Exception {
|
||||
return memberMapper.getHeadMember();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MemberVO getSectionMember() throws Exception {
|
||||
return memberMapper.getSectionMember();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public HashMap<String, Object> getMemberListUserVo(final MemberSearchVO searchVO) throws Exception {
|
||||
|
||||
MemberVO headVO = getHeadMember();
|
||||
MemberVO sectionVO = getSectionMember();
|
||||
|
||||
List<LoginUserVO> userList = memberMapper.getMemberListUserVO(searchVO);
|
||||
Iterator<LoginUserVO> it = userList.iterator();
|
||||
while (it.hasNext()) {
|
||||
LoginUserVO user = it.next();
|
||||
/* 담당관 */
|
||||
if (headVO != null) {
|
||||
String head = headVO.getUserid();
|
||||
user.setAuthHead(head != null && head.equals(user.getUserid()) ? 1 : 0);
|
||||
}
|
||||
/* 팀장 */
|
||||
if (sectionVO != null) {
|
||||
String section = sectionVO.getUserid();
|
||||
user.setAuthSection(section != null && section.equals(user.getUserid()) ? 1 : 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HashMap<String, Object> result = new HashMap<String, Object>();
|
||||
result.put("head", headVO);
|
||||
result.put("section", sectionVO);
|
||||
result.put("resultList", userList);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MemberVO> getMemberList(MemberSearchVO searchVO) throws Exception {
|
||||
return memberMapper.getMemberList(searchVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMemberListCnt(final MemberSearchVO searchVO) throws Exception {
|
||||
return memberMapper.getMemberListCnt(searchVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMemberListAllCnt(final MemberSearchVO searchVO) throws Exception {
|
||||
return memberMapper.getMemberListAllCnt(searchVO);
|
||||
}
|
||||
@Override
|
||||
public int updateMemberAuth(MemberVO memberVO) throws Exception {
|
||||
return memberMapper.updateUsrLv(memberVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateMemberRpt(MemberVO memberVO) throws Exception {
|
||||
return memberMapper.updateRtpAuth(memberVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateSection(MemberVO memberVO) throws Exception {
|
||||
|
||||
MemberVO section = memberMapper.getSectionMember();
|
||||
|
||||
if(section != null){
|
||||
section.setUsegrade(6);
|
||||
memberMapper.updateUsrLv(section);
|
||||
}
|
||||
// 20180517 권한관련 팀장4, 담당관3 수정
|
||||
memberVO.setUsegrade(4);
|
||||
return memberMapper.updateUsrLv(memberVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateHead(MemberVO memberVO) throws Exception {
|
||||
|
||||
MemberVO head = memberMapper.getHeadMember();
|
||||
if(head != null){
|
||||
head.setUsegrade(6);
|
||||
memberMapper.updateUsrLv(head);
|
||||
}
|
||||
// 20180517 권한관련 팀장4, 담당관3 수정
|
||||
memberVO.setUsegrade(3);
|
||||
return memberMapper.updateUsrLv(memberVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertUserInfo(MemberVO vo) throws Exception {
|
||||
return memberMapper.insertUserInfo(vo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int selectCheckId(String userid) throws Exception {
|
||||
return memberMapper.selectCheckId(userid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateUserInfo(MemberVO vo) throws Exception {
|
||||
return memberMapper.updateUserInfo(vo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MemberVO> getMemberListForExel(MemberSearchVO searchVO) throws Exception {
|
||||
return memberMapper.getMemberListForExel(searchVO);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package kcg.imis.member.vo;
|
||||
|
||||
/**
|
||||
* 직위.
|
||||
*
|
||||
* @author kimnomin
|
||||
*
|
||||
*/
|
||||
public final class Duty {
|
||||
/**
|
||||
* 계장.
|
||||
*/
|
||||
public static final String SECTION = "03";
|
||||
/**
|
||||
* 과장.
|
||||
*/
|
||||
public static final String HEAD = "04";
|
||||
|
||||
/**
|
||||
* 생성자.
|
||||
*/
|
||||
private Duty() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,214 @@
|
|||
/**
|
||||
* MemberSearchVO.java
|
||||
* @author 임새미
|
||||
* @since 2016. 11. 2.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 11. 2. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
package kcg.imis.member.vo;
|
||||
|
||||
import kcg.imis.cmmn.bbs.BaseSearchVO;
|
||||
|
||||
/**
|
||||
*
|
||||
* @FileName : MemberSearchVO.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 4. 9.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
public class MemberSearchVO extends BaseSearchVO {
|
||||
|
||||
private int recordCountPerAuthPage = 20;
|
||||
|
||||
private String userid;
|
||||
private String place1;
|
||||
private String position;
|
||||
private String name;
|
||||
private String usertype = UserType.FA;
|
||||
private int ordertype;
|
||||
private int ordercode;
|
||||
private String orderkey;
|
||||
|
||||
public MemberSearchVO() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the recordCountPerAuthPage
|
||||
*/
|
||||
public int getRecordCountPerAuthPage() {
|
||||
return recordCountPerAuthPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param recordCountPerAuthPage the recordCountPerAuthPage to set
|
||||
*/
|
||||
public void setRecordCountPerAuthPage(int recordCountPerAuthPage) {
|
||||
this.recordCountPerAuthPage = recordCountPerAuthPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the userid
|
||||
*/
|
||||
public String getUserid() {
|
||||
return userid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param userid the userid to set
|
||||
*/
|
||||
public void setUserid(String userid) {
|
||||
this.userid = userid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 usertype
|
||||
*/
|
||||
public String getUsertype() {
|
||||
return usertype;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param usertype the usertype to set
|
||||
*/
|
||||
public void setUsertype(String usertype) {
|
||||
this.usertype = usertype;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the orderkey
|
||||
*/
|
||||
public String getOrderkey() {
|
||||
return orderkey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param orderkey the orderkey to set
|
||||
*/
|
||||
public void setOrderkey(String orderkey) {
|
||||
}
|
||||
/**
|
||||
* @return the ordercode
|
||||
*/
|
||||
public int getOrdercode() {
|
||||
return ordercode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ordercode the ordercode to set
|
||||
*/
|
||||
public void setOrdercode(int ordercode) {
|
||||
String key = "";
|
||||
this.ordercode = ordercode;
|
||||
switch (ordercode) {
|
||||
case 0:
|
||||
key = "PLACE1";
|
||||
break;
|
||||
case 1:
|
||||
key = "PLACE2";
|
||||
break;
|
||||
case 2:
|
||||
key = "POSITION";
|
||||
break;
|
||||
case 3:
|
||||
key = "NAME";
|
||||
break;
|
||||
case 4:
|
||||
key = "USERID";
|
||||
break;
|
||||
case 5:
|
||||
key = "JOBTYPE";
|
||||
break;
|
||||
case 6:
|
||||
key = "USEGRADE";
|
||||
break;
|
||||
case 7:
|
||||
key = "TOTALEXCAREER";
|
||||
break;
|
||||
case 8:
|
||||
key = "DUTIES";
|
||||
break;
|
||||
case 9:
|
||||
key = "LOGINCHK";
|
||||
break;
|
||||
case 10:
|
||||
key = "CHKCNT";
|
||||
break;
|
||||
case 11:
|
||||
key = "INOUT";
|
||||
break;
|
||||
case 12:
|
||||
key = "NOWPOSITION";
|
||||
break;
|
||||
case 13:
|
||||
key = "NOWPLACE";
|
||||
break;
|
||||
default:
|
||||
key = "";
|
||||
break;
|
||||
}
|
||||
this.orderkey = key;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the ordertype
|
||||
*/
|
||||
public int getOrdertype() {
|
||||
return ordertype;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ordertype the ordertype to set
|
||||
*/
|
||||
public void setOrdertype(int ordertype) {
|
||||
this.ordertype = ordertype;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the position
|
||||
*/
|
||||
public String getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param position the position to set
|
||||
*/
|
||||
public void setPosition(String position) {
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,322 @@
|
|||
package kcg.imis.member.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @FileName : MemberVO.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 4. 2.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
public class MemberVO implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -7486836904063956439L;
|
||||
|
||||
/**
|
||||
* rnum.
|
||||
*/
|
||||
private int rnum;
|
||||
|
||||
/**
|
||||
* 사용자 ID.
|
||||
*/
|
||||
private String userid;
|
||||
/**
|
||||
* 비밀번호.
|
||||
*/
|
||||
private String passwd;
|
||||
/**
|
||||
* 비밀번호확인.
|
||||
*/
|
||||
private String passwd2;
|
||||
/**
|
||||
* 이름.
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 소속1.
|
||||
*/
|
||||
private String place1;
|
||||
/**
|
||||
* 소속2.
|
||||
*/
|
||||
private String place2;
|
||||
/**
|
||||
* 계급.
|
||||
*/
|
||||
private String loginchk;
|
||||
/**
|
||||
* 직책(없음/반장/계장/과장).
|
||||
*/
|
||||
private String duties;
|
||||
|
||||
/**
|
||||
* 사용자 등급.
|
||||
*/
|
||||
private int usegrade;
|
||||
|
||||
private String usegradeStr;
|
||||
|
||||
/**
|
||||
* 소속1 명칭.
|
||||
*/
|
||||
private String place1Str;
|
||||
/**
|
||||
* 소속2 명칭.
|
||||
*/
|
||||
private String place2Str;
|
||||
/**
|
||||
* 직급 명칭.
|
||||
*/
|
||||
private String dutyStr;
|
||||
|
||||
/**
|
||||
* 견문 권한
|
||||
*/
|
||||
private int rptAuth;
|
||||
|
||||
/**
|
||||
* 권한 레벨.
|
||||
*/
|
||||
private int rolelevel;
|
||||
|
||||
/**
|
||||
* @return the rnum
|
||||
*/
|
||||
public int getRnum() {
|
||||
return rnum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rnum the rnum 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 passwd
|
||||
*/
|
||||
public String getPasswd() {
|
||||
return passwd;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param passwd the passwd to set
|
||||
*/
|
||||
public void setPasswd(String passwd) {
|
||||
this.passwd = passwd;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the passwd2
|
||||
*/
|
||||
public String getPasswd2() {
|
||||
return passwd2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param passwd2 the passwd2 to set
|
||||
*/
|
||||
public void setPasswd2(String passwd2) {
|
||||
this.passwd2 = passwd2;
|
||||
}
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the place1
|
||||
*/
|
||||
public String getPlace1() {
|
||||
return place1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param place1 the place1 to set
|
||||
*/
|
||||
public void setPlace1(String place1) {
|
||||
this.place1 = place1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the place2
|
||||
*/
|
||||
public String getPlace2() {
|
||||
return place2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param place2 the place2 to set
|
||||
*/
|
||||
public void setPlace2(String place2) {
|
||||
this.place2 = place2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the loginchk
|
||||
*/
|
||||
public String getLoginchk() {
|
||||
return loginchk;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param loginchk the loginchk to set
|
||||
*/
|
||||
public void setLoginchk(String loginchk) {
|
||||
this.loginchk = loginchk;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the duties
|
||||
*/
|
||||
public String getDuties() {
|
||||
return duties;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param duties the duties to set
|
||||
*/
|
||||
public void setDuties(String duties) {
|
||||
this.duties = duties;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the usegrade
|
||||
*/
|
||||
public int getUsegrade() {
|
||||
return usegrade;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param usegrade the usegrade to set
|
||||
*/
|
||||
public void setUsegrade(int usegrade) {
|
||||
this.usegrade = usegrade;
|
||||
|
||||
if(usegrade == 1){
|
||||
setUsegradeStr("관리자");
|
||||
}else if(usegrade == 2){
|
||||
setUsegradeStr("중간관리자");
|
||||
}else if(usegrade == 3){
|
||||
setUsegradeStr("국제협력관");
|
||||
}else if(usegrade == 4){
|
||||
setUsegradeStr("국제법규팀장");
|
||||
}else if(usegrade == 6){
|
||||
setUsegradeStr("사용자(쓰기)");
|
||||
}else{
|
||||
setUsegradeStr("사용중지");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the place1Str
|
||||
*/
|
||||
public String getPlace1Str() {
|
||||
return place1Str;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param place1Str the place1Str to set
|
||||
*/
|
||||
public void setPlace1Str(String place1Str) {
|
||||
this.place1Str = place1Str;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the place2Str
|
||||
*/
|
||||
public String getPlace2Str() {
|
||||
return place2Str;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param place2Str the place2Str to set
|
||||
*/
|
||||
public void setPlace2Str(String place2Str) {
|
||||
this.place2Str = place2Str;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dutyStr
|
||||
*/
|
||||
public String getDutyStr() {
|
||||
return dutyStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dutyStr the dutyStr to set
|
||||
*/
|
||||
public void setDutyStr(String dutyStr) {
|
||||
this.dutyStr = dutyStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rptAuth
|
||||
*/
|
||||
public int getRptAuth() {
|
||||
return rptAuth;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rptAuth the rptAuth to set
|
||||
*/
|
||||
public void setRptAuth(int rptAuth) {
|
||||
this.rptAuth = rptAuth;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rolelevel
|
||||
*/
|
||||
public int getRolelevel() {
|
||||
return rolelevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rolelevel the rolelevel to set
|
||||
*/
|
||||
public void setRolelevel(int rolelevel) {
|
||||
this.rolelevel = rolelevel;
|
||||
}
|
||||
|
||||
public String getUsegradeStr() {
|
||||
return usegradeStr;
|
||||
}
|
||||
|
||||
public void setUsegradeStr(String usegradeStr) {
|
||||
this.usegradeStr = usegradeStr;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package kcg.imis.member.vo;
|
||||
|
||||
/**
|
||||
* 사용자 구분.
|
||||
*
|
||||
* @author kimnomin
|
||||
*
|
||||
*/
|
||||
public final class UserType {
|
||||
/**
|
||||
* 외사경찰.
|
||||
*/
|
||||
public static final String FA = "f";
|
||||
/**
|
||||
* 일반경찰.
|
||||
*/
|
||||
public static final String CM = "g";
|
||||
|
||||
/**
|
||||
* 생성자.
|
||||
*/
|
||||
private UserType() {
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
package kcg.imis.member.web;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import kcg.imis.cmmn.service.CodeService;
|
||||
import kcg.imis.member.service.MemberService;
|
||||
import kcg.imis.member.vo.MemberSearchVO;
|
||||
import kcg.imis.member.vo.MemberVO;
|
||||
import kcg.imis.sec.LoginUserVO;
|
||||
import kcg.imis.sec.UserUtil;
|
||||
|
||||
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 egovframework.rte.fdl.property.EgovPropertyService;
|
||||
|
||||
/**
|
||||
* @FileName : MemberController.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 4. 9.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/member")
|
||||
public class MemberController {
|
||||
|
||||
@Resource(name = "memberService")
|
||||
MemberService memberService;
|
||||
|
||||
@Resource(name = "propertiesService")
|
||||
private EgovPropertyService propertiesService;
|
||||
|
||||
/**
|
||||
* 코드관련 정보 인터페이스.
|
||||
*/
|
||||
@Resource(name = "codeService")
|
||||
private CodeService codeService;
|
||||
|
||||
|
||||
@RequestMapping("/update.do")
|
||||
public String memberUpdateView(final Model model) throws Exception {
|
||||
try {
|
||||
|
||||
LoginUserVO user = UserUtil.getMemberInfo();
|
||||
model.addAttribute("code", codeService.getCodeList(null));
|
||||
model.addAttribute("memberVO", memberService.getMemberInfo(user.getUserid()));
|
||||
model.addAttribute("isAdmin", UserUtil.isAdmin());
|
||||
model.addAttribute("isSysAdmin", UserUtil.isSysAdmin());
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return "member/update.tiles";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/memberUpdate.do"}, method = RequestMethod.POST)
|
||||
public String memberUpdate(@ModelAttribute("memberVO") final MemberVO memberVO,
|
||||
final BindingResult bindingResult, final Model model, final SessionStatus status) throws Exception {
|
||||
|
||||
try {
|
||||
memberService.updateUserInfo(memberVO);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return "redirect:/main.do";
|
||||
}
|
||||
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/getMemberListAll.json")
|
||||
public List<MemberVO> getMemberListAll(final MemberSearchVO searchVO) throws Exception {
|
||||
return memberService.getMemberListAll(searchVO);
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping("/regist.json")
|
||||
public HashMap<String, Object> regist2(final MemberVO memberVO) throws Exception {
|
||||
HashMap<String, Object> resultMap = new HashMap<String, Object>();
|
||||
try {
|
||||
int result = memberService.insertUserInfo(memberVO);
|
||||
resultMap.put("result", result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping("/checkId.json")
|
||||
public HashMap<String, Object> checkId(final MemberVO memberVO) throws Exception {
|
||||
HashMap<String, Object> resultMap = new HashMap<String, Object>();
|
||||
try {
|
||||
int result = memberService.selectCheckId(memberVO.getUserid());
|
||||
resultMap.put("cnt", result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
package kcg.imis.moniter.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import kcg.imis.moniter.vo.MoniterSearchVO;
|
||||
import kcg.imis.moniter.vo.MoniterVO;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
|
||||
|
||||
/**
|
||||
* @FileName : MoniterMapper.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 4. 13.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
@Repository("moniterMapper")
|
||||
public class MoniterMapper extends EgovAbstractMapper {
|
||||
|
||||
/**
|
||||
* 국가별 참고사이트 목록 조회
|
||||
* @param idx
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<MoniterVO> getMoniterList(final String idx) throws Exception {
|
||||
return selectList("Moniter.getMoniterList", idx);
|
||||
}
|
||||
|
||||
/**
|
||||
* 모니터링 시스템 목록 조회
|
||||
* @param vo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<Map<String, Object>> getMoniterList(final MoniterSearchVO vo) throws Exception {
|
||||
return selectList("Moniter.getMoniterTree", vo);
|
||||
}
|
||||
|
||||
|
||||
public MoniterVO getMoniterInfo(final String idx) throws Exception {
|
||||
return selectOne("Moniter.getMoniterInfo", idx);
|
||||
}
|
||||
|
||||
public int getMaxIdx() throws Exception {
|
||||
return (Integer)selectOne("Moniter.getMaxIdx");
|
||||
}
|
||||
|
||||
public int insertMoniterInfo(final MoniterVO vo) throws Exception {
|
||||
return insert("Moniter.insertMoniterInfo", vo);
|
||||
}
|
||||
|
||||
public int updateMoniterInfo(final MoniterVO vo) throws Exception {
|
||||
return update("Moniter.updateMoniterInfo", vo);
|
||||
}
|
||||
|
||||
public int deleteMoniterTree(final MoniterSearchVO vo) throws Exception {
|
||||
return delete("Moniter.deleteMoniterTree", vo);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package kcg.imis.moniter.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import kcg.imis.moniter.vo.MoniterSearchVO;
|
||||
import kcg.imis.moniter.vo.MoniterVO;
|
||||
|
||||
|
||||
public interface MoniterService {
|
||||
|
||||
List<MoniterVO> getMoniterList(String idx) throws Exception;
|
||||
|
||||
List<Map<String, Object>> getMoniterTreeList() throws Exception;
|
||||
|
||||
MoniterVO saveMoniter(MoniterVO vo) throws Exception;
|
||||
|
||||
int deleteMoniterTree(MoniterSearchVO vo) throws Exception;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,174 @@
|
|||
/**
|
||||
* AdminServiceImpl.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 28.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 28. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
package kcg.imis.moniter.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import kcg.imis.moniter.mapper.MoniterMapper;
|
||||
import kcg.imis.moniter.vo.MoniterSearchVO;
|
||||
import kcg.imis.moniter.vo.MoniterVO;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@Service("moniterService")
|
||||
public class MoniterServiceImpl implements MoniterService {
|
||||
|
||||
@Resource(name = "moniterMapper")
|
||||
private MoniterMapper moniterMapper;
|
||||
|
||||
@Override
|
||||
public List<MoniterVO> getMoniterList(String idx) throws Exception {
|
||||
|
||||
List<MoniterVO> list = moniterMapper.getMoniterList(idx);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getMoniterTreeList() throws Exception {
|
||||
|
||||
List<Map<String, Object>> list1 = createMoniterTreeList(1);
|
||||
|
||||
for (Map<String, Object> depth1 : list1) {
|
||||
|
||||
List<Map<String, Object>> list2 = createMoniterTreeList(depth1);
|
||||
|
||||
for (Map<String, Object> depth2 : list2) {
|
||||
|
||||
List<Map<String, Object>> list3 = createMoniterTreeList(depth2);
|
||||
|
||||
for (Map<String, Object> depth3 : list3) {
|
||||
|
||||
List<Map<String, Object>> list4 = createMoniterTreeList(depth3);
|
||||
|
||||
for (Map<String, Object> depth4 : list4) {
|
||||
|
||||
List<Map<String, Object>> list5 = createMoniterTreeList(depth4);
|
||||
|
||||
for (Map<String, Object> depth5 : list5) {
|
||||
|
||||
List<Map<String, Object>> list6 = createMoniterTreeList(depth5);
|
||||
|
||||
for (Map<String, Object> depth6 : list6) {
|
||||
depth6.put("state", "open");
|
||||
}
|
||||
|
||||
if(list6.size() == 0){
|
||||
depth5.put("state", "open");
|
||||
}
|
||||
depth5.put("children", list6);
|
||||
|
||||
}
|
||||
if(list5.size() == 0){
|
||||
depth4.put("state", "open");
|
||||
}
|
||||
depth4.put("children", list5);
|
||||
|
||||
}
|
||||
if(list4.size() == 0){
|
||||
depth3.put("state", "open");
|
||||
}
|
||||
depth3.put("children", list4);
|
||||
|
||||
}
|
||||
if(list3.size() == 0){
|
||||
depth2.put("state", "open");
|
||||
}
|
||||
depth2.put("children", list3);
|
||||
|
||||
}
|
||||
if(list2.size() == 0){
|
||||
depth1.put("state", "open");
|
||||
}
|
||||
depth1.put("children", list2);
|
||||
|
||||
}
|
||||
|
||||
return list1;
|
||||
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> createMoniterTreeList(int depth ) throws Exception {
|
||||
|
||||
MoniterSearchVO vo = new MoniterSearchVO();
|
||||
vo.setDepth(depth);
|
||||
|
||||
List<Map<String, Object>> list1 = moniterMapper.getMoniterList(vo);
|
||||
return list1;
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> createMoniterTreeList(Map<String, Object> moniter) throws Exception {
|
||||
|
||||
MoniterSearchVO vo = new MoniterSearchVO();
|
||||
|
||||
int dep = Integer.parseInt(String.valueOf(moniter.get("depth"))) + 1;
|
||||
String idx = String.valueOf(moniter.get("id"));
|
||||
|
||||
vo.setDepth(dep);
|
||||
vo.setIdx(idx);
|
||||
|
||||
return moniterMapper.getMoniterList(vo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MoniterVO saveMoniter(MoniterVO vo) throws Exception {
|
||||
|
||||
String id = vo.getJmIdx();
|
||||
|
||||
int result = 0;
|
||||
|
||||
if(!StringUtils.isEmpty(id)){
|
||||
result = moniterMapper.updateMoniterInfo(vo);
|
||||
}else{
|
||||
//신규
|
||||
MoniterVO insertVo = moniterMapper.getMoniterInfo(vo.getParentId());
|
||||
int idx = moniterMapper.getMaxIdx();
|
||||
int depth = Integer.parseInt(insertVo.getJmDepth()) + 1;
|
||||
if(depth == 2){
|
||||
insertVo.setJmDepth2Idx(String.valueOf(idx));
|
||||
} else if(depth == 3){
|
||||
insertVo.setJmDepth3Idx(String.valueOf(idx));
|
||||
} else if(depth == 4){
|
||||
insertVo.setJmDepth4Idx(String.valueOf(idx));
|
||||
} else if(depth == 5){
|
||||
insertVo.setJmDepth5Idx(String.valueOf(idx));
|
||||
} else if(depth == 6){
|
||||
insertVo.setJmDepth6Idx(String.valueOf(idx));
|
||||
}
|
||||
|
||||
insertVo.setJmIdx(String.valueOf(idx));
|
||||
insertVo.setJmDepth(String.valueOf(depth));
|
||||
insertVo.setJmOrder(vo.getJmOrder());
|
||||
insertVo.setJmName(vo.getJmName());
|
||||
insertVo.setJmHref(vo.getJmHref());
|
||||
|
||||
result = moniterMapper.insertMoniterInfo(insertVo);
|
||||
|
||||
id = String.valueOf(idx);
|
||||
}
|
||||
|
||||
if(result == 1){
|
||||
return moniterMapper.getMoniterInfo(id);
|
||||
}
|
||||
else{
|
||||
return new MoniterVO();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteMoniterTree(MoniterSearchVO vo) throws Exception {
|
||||
return moniterMapper.deleteMoniterTree(vo);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package kcg.imis.moniter.vo;
|
||||
|
||||
|
||||
public class MoniterSearchVO {
|
||||
|
||||
private String idx;
|
||||
private int depth;
|
||||
|
||||
public String getIdx() {
|
||||
return idx;
|
||||
}
|
||||
public void setIdx(String idx) {
|
||||
this.idx = idx;
|
||||
}
|
||||
public int getDepth() {
|
||||
return depth;
|
||||
}
|
||||
public void setDepth(int depth) {
|
||||
this.depth = depth;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,142 @@
|
|||
package kcg.imis.moniter.vo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MoniterVO {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MoniterVO [jmIdx=" + jmIdx + ", jmDepth=" + jmDepth + ", jmDepth1Idx=" + jmDepth1Idx + ", jmDepth2Idx=" + jmDepth2Idx + ", jmDepth3Idx=" + jmDepth3Idx + ", jmDepth4Idx=" + jmDepth4Idx
|
||||
+ ", jmDepth5Idx=" + jmDepth5Idx + ", jmDepth6Idx=" + jmDepth6Idx + ", jmName=" + jmName + ", jmOrder=" + jmOrder + ", jmChild=" + jmChild + ", jmHref=" + jmHref + ", parentId="
|
||||
+ parentId + ", monterList=" + monterList + "]";
|
||||
}
|
||||
|
||||
private String jmIdx;
|
||||
private String jmDepth;
|
||||
private String jmDepth1Idx;
|
||||
private String jmDepth2Idx;
|
||||
private String jmDepth3Idx;
|
||||
private String jmDepth4Idx;
|
||||
private String jmDepth5Idx;
|
||||
private String jmDepth6Idx;
|
||||
private String jmName;
|
||||
private String jmOrder;
|
||||
private String jmChild;
|
||||
private String jmHref;
|
||||
private String parentId;
|
||||
|
||||
private List<MoniterVO> monterList;
|
||||
|
||||
public String getJmIdx() {
|
||||
return jmIdx;
|
||||
}
|
||||
|
||||
public void setJmIdx(String jmIdx) {
|
||||
this.jmIdx = jmIdx;
|
||||
}
|
||||
|
||||
public String getJmDepth() {
|
||||
return jmDepth;
|
||||
}
|
||||
|
||||
public void setJmDepth(String jmDepth) {
|
||||
this.jmDepth = jmDepth;
|
||||
}
|
||||
|
||||
public String getJmDepth1Idx() {
|
||||
return jmDepth1Idx;
|
||||
}
|
||||
|
||||
public void setJmDepth1Idx(String jmDepth1Idx) {
|
||||
this.jmDepth1Idx = jmDepth1Idx;
|
||||
}
|
||||
|
||||
public String getJmDepth2Idx() {
|
||||
return jmDepth2Idx;
|
||||
}
|
||||
|
||||
public void setJmDepth2Idx(String jmDepth2Idx) {
|
||||
this.jmDepth2Idx = jmDepth2Idx;
|
||||
}
|
||||
|
||||
public String getJmDepth3Idx() {
|
||||
return jmDepth3Idx;
|
||||
}
|
||||
|
||||
public void setJmDepth3Idx(String jmDepth3Idx) {
|
||||
this.jmDepth3Idx = jmDepth3Idx;
|
||||
}
|
||||
|
||||
public String getJmDepth4Idx() {
|
||||
return jmDepth4Idx;
|
||||
}
|
||||
|
||||
public void setJmDepth4Idx(String jmDepth4Idx) {
|
||||
this.jmDepth4Idx = jmDepth4Idx;
|
||||
}
|
||||
|
||||
public String getJmDepth5Idx() {
|
||||
return jmDepth5Idx;
|
||||
}
|
||||
|
||||
public void setJmDepth5Idx(String jmDepth5Idx) {
|
||||
this.jmDepth5Idx = jmDepth5Idx;
|
||||
}
|
||||
|
||||
public String getJmDepth6Idx() {
|
||||
return jmDepth6Idx;
|
||||
}
|
||||
|
||||
public void setJmDepth6Idx(String jmDepth6Idx) {
|
||||
this.jmDepth6Idx = jmDepth6Idx;
|
||||
}
|
||||
|
||||
public String getJmName() {
|
||||
return jmName;
|
||||
}
|
||||
|
||||
public void setJmName(String jmName) {
|
||||
this.jmName = jmName;
|
||||
}
|
||||
|
||||
public String getJmOrder() {
|
||||
return jmOrder;
|
||||
}
|
||||
|
||||
public void setJmOrder(String jmOrder) {
|
||||
this.jmOrder = jmOrder;
|
||||
}
|
||||
|
||||
public String getJmChild() {
|
||||
return jmChild;
|
||||
}
|
||||
|
||||
public void setJmChild(String jmChild) {
|
||||
this.jmChild = jmChild;
|
||||
}
|
||||
|
||||
public String getJmHref() {
|
||||
return jmHref;
|
||||
}
|
||||
|
||||
public void setJmHref(String jmHref) {
|
||||
this.jmHref = jmHref;
|
||||
}
|
||||
|
||||
public List<MoniterVO> getMonterList() {
|
||||
return monterList;
|
||||
}
|
||||
|
||||
public void setMonterList(List<MoniterVO> monterList) {
|
||||
this.monterList = monterList;
|
||||
}
|
||||
|
||||
public String getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(String parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
package kcg.imis.moniter.web;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import kcg.imis.moniter.service.MoniterService;
|
||||
import kcg.imis.moniter.vo.MoniterVO;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
/**
|
||||
* @FileName : MoniterController.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 4. 13.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/moniter")
|
||||
public class MoniterController {
|
||||
|
||||
@Resource(name = "moniterService")
|
||||
MoniterService moniterService;
|
||||
|
||||
@RequestMapping(value = "/list.do")
|
||||
public String reportSaveList(@RequestParam(value="idx", required=false) String idx, final Model model) {
|
||||
|
||||
try {
|
||||
if(idx == null) idx = "1";
|
||||
model.addAttribute("data", moniterService.getMoniterList(idx));
|
||||
model.addAttribute("idx", idx);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return "moniter/moniterList.tiles";
|
||||
}
|
||||
|
||||
/*@ResponseBody
|
||||
@RequestMapping(value = "/getMoniterList.json")
|
||||
public List<MoniterVO> getMemberListAll(@RequestParam(value="idx", required=false) String idx) throws Exception {
|
||||
return moniterService.getMemberList(idx);
|
||||
}*/
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package kcg.imis.nation.mapper;
|
||||
|
||||
import kcg.imis.nation.vo.NationVO;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
|
||||
|
||||
|
||||
/**
|
||||
* @FileName : NationMapper.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 4. 11.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
@Repository("nationMapper")
|
||||
public class NationMapper extends EgovAbstractMapper {
|
||||
|
||||
/**
|
||||
* 해양세력 정보 조회
|
||||
* @param naSeq
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public NationVO getNationInfo(final String naSeq) throws Exception {
|
||||
return selectOne("Nation.getNationInfo", naSeq);
|
||||
}
|
||||
|
||||
/**
|
||||
* 해양세력 정보 업데이트
|
||||
* @param nationVO
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public int updateNation(NationVO nationVO) throws Exception {
|
||||
return update("Nation.updateNationInfo", nationVO);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package kcg.imis.nation.service;
|
||||
|
||||
import kcg.imis.nation.vo.NationVO;
|
||||
|
||||
/**
|
||||
* @FileName : NationService.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 4. 11.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
public interface NationService {
|
||||
|
||||
/**
|
||||
* 해양 세력 정보 조회
|
||||
* @param naSeq
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
NationVO getNationInfo(final String naSeq) throws Exception;
|
||||
|
||||
/**
|
||||
* 해양 세력 정보 업데이트
|
||||
* @param nationVO
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
int updateNation(NationVO nationVO) throws Exception;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package kcg.imis.nation.service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import kcg.imis.nation.mapper.NationMapper;
|
||||
import kcg.imis.nation.vo.NationVO;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service("nationService")
|
||||
public class NationServiceImpl implements NationService {
|
||||
|
||||
@Resource(name = "nationMapper")
|
||||
private NationMapper nationMapper;
|
||||
|
||||
@Override
|
||||
public NationVO getNationInfo(String naSeq) throws Exception {
|
||||
return nationMapper.getNationInfo(naSeq);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateNation(NationVO nationVO) throws Exception {
|
||||
return nationMapper.updateNation(nationVO);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,260 @@
|
|||
package kcg.imis.nation.vo;
|
||||
|
||||
public class NationVO {
|
||||
|
||||
private String naSeq;
|
||||
private String naName;
|
||||
private String naEngName;
|
||||
private String naArea;
|
||||
private String naOldArea;
|
||||
private String naNisid;
|
||||
private String naFlag;
|
||||
private String naInfo1;
|
||||
private String naInfo2;
|
||||
private String naInfo3;
|
||||
private String naInfo4;
|
||||
private String naInfo5;
|
||||
private String naInfo6;
|
||||
private String naInfo7;
|
||||
private String naData1;
|
||||
private String naData2;
|
||||
private String naData3;
|
||||
private String naData4;
|
||||
private String naData5;
|
||||
private String naData6;
|
||||
private String naData7;
|
||||
private String naData8;
|
||||
private String naData9;
|
||||
private String naData10;
|
||||
private String naData11;
|
||||
private String naData12;
|
||||
private String naData13;
|
||||
private String naData14;
|
||||
private String naData15;
|
||||
private String naData16;
|
||||
private String naData17;
|
||||
private String naData18;
|
||||
private String naData19;
|
||||
private String naData20;
|
||||
private String naData21;
|
||||
private String naData22;
|
||||
|
||||
public String getNaSeq() {
|
||||
return naSeq;
|
||||
}
|
||||
public void setNaSeq(String naSeq) {
|
||||
this.naSeq = naSeq;
|
||||
}
|
||||
public String getNaName() {
|
||||
return naName;
|
||||
}
|
||||
public void setNaName(String naName) {
|
||||
this.naName = naName;
|
||||
}
|
||||
public String getNaEngName() {
|
||||
return naEngName;
|
||||
}
|
||||
public void setNaEngName(String naEngName) {
|
||||
this.naEngName = naEngName;
|
||||
}
|
||||
public String getNaArea() {
|
||||
return naArea;
|
||||
}
|
||||
public void setNaArea(String naArea) {
|
||||
this.naArea = naArea;
|
||||
}
|
||||
public String getNaOldArea() {
|
||||
return naOldArea;
|
||||
}
|
||||
public void setNaOldArea(String naOldArea) {
|
||||
this.naOldArea = naOldArea;
|
||||
}
|
||||
public String getNaNisid() {
|
||||
return naNisid;
|
||||
}
|
||||
public void setNaNisid(String naNisid) {
|
||||
this.naNisid = naNisid;
|
||||
}
|
||||
public String getNaFlag() {
|
||||
return naFlag;
|
||||
}
|
||||
public void setNaFlag(String naFlag) {
|
||||
this.naFlag = naFlag;
|
||||
}
|
||||
public String getNaInfo1() {
|
||||
return naInfo1;
|
||||
}
|
||||
public void setNaInfo1(String naInfo1) {
|
||||
this.naInfo1 = naInfo1;
|
||||
}
|
||||
public String getNaInfo2() {
|
||||
return naInfo2;
|
||||
}
|
||||
public void setNaInfo2(String naInfo2) {
|
||||
this.naInfo2 = naInfo2;
|
||||
}
|
||||
public String getNaInfo3() {
|
||||
return naInfo3;
|
||||
}
|
||||
public void setNaInfo3(String naInfo3) {
|
||||
this.naInfo3 = naInfo3;
|
||||
}
|
||||
public String getNaInfo4() {
|
||||
return naInfo4;
|
||||
}
|
||||
public void setNaInfo4(String naInfo4) {
|
||||
this.naInfo4 = naInfo4;
|
||||
}
|
||||
public String getNaInfo5() {
|
||||
return naInfo5;
|
||||
}
|
||||
public void setNaInfo5(String naInfo5) {
|
||||
this.naInfo5 = naInfo5;
|
||||
}
|
||||
public String getNaInfo6() {
|
||||
return naInfo6;
|
||||
}
|
||||
public void setNaInfo6(String naInfo6) {
|
||||
this.naInfo6 = naInfo6;
|
||||
}
|
||||
public String getNaInfo7() {
|
||||
return naInfo7;
|
||||
}
|
||||
public void setNaInfo7(String naInfo7) {
|
||||
this.naInfo7 = naInfo7;
|
||||
}
|
||||
public String getNaData1() {
|
||||
return naData1;
|
||||
}
|
||||
public void setNaData1(String naData1) {
|
||||
this.naData1 = naData1;
|
||||
}
|
||||
public String getNaData2() {
|
||||
return naData2;
|
||||
}
|
||||
public void setNaData2(String naData2) {
|
||||
this.naData2 = naData2;
|
||||
}
|
||||
public String getNaData3() {
|
||||
return naData3;
|
||||
}
|
||||
public void setNaData3(String naData3) {
|
||||
this.naData3 = naData3;
|
||||
}
|
||||
public String getNaData4() {
|
||||
return naData4;
|
||||
}
|
||||
public void setNaData4(String naData4) {
|
||||
this.naData4 = naData4;
|
||||
}
|
||||
public String getNaData5() {
|
||||
return naData5;
|
||||
}
|
||||
public void setNaData5(String naData5) {
|
||||
this.naData5 = naData5;
|
||||
}
|
||||
public String getNaData6() {
|
||||
return naData6;
|
||||
}
|
||||
public void setNaData6(String naData6) {
|
||||
this.naData6 = naData6;
|
||||
}
|
||||
public String getNaData7() {
|
||||
return naData7;
|
||||
}
|
||||
public void setNaData7(String naData7) {
|
||||
this.naData7 = naData7;
|
||||
}
|
||||
public String getNaData8() {
|
||||
return naData8;
|
||||
}
|
||||
public void setNaData8(String naData8) {
|
||||
this.naData8 = naData8;
|
||||
}
|
||||
public String getNaData9() {
|
||||
return naData9;
|
||||
}
|
||||
public void setNaData9(String naData9) {
|
||||
this.naData9 = naData9;
|
||||
}
|
||||
public String getNaData10() {
|
||||
return naData10;
|
||||
}
|
||||
public void setNaData10(String naData10) {
|
||||
this.naData10 = naData10;
|
||||
}
|
||||
public String getNaData11() {
|
||||
return naData11;
|
||||
}
|
||||
public void setNaData11(String naData11) {
|
||||
this.naData11 = naData11;
|
||||
}
|
||||
public String getNaData12() {
|
||||
return naData12;
|
||||
}
|
||||
public void setNaData12(String naData12) {
|
||||
this.naData12 = naData12;
|
||||
}
|
||||
public String getNaData13() {
|
||||
return naData13;
|
||||
}
|
||||
public void setNaData13(String naData13) {
|
||||
this.naData13 = naData13;
|
||||
}
|
||||
public String getNaData14() {
|
||||
return naData14;
|
||||
}
|
||||
public void setNaData14(String naData14) {
|
||||
this.naData14 = naData14;
|
||||
}
|
||||
public String getNaData15() {
|
||||
return naData15;
|
||||
}
|
||||
public void setNaData15(String naData15) {
|
||||
this.naData15 = naData15;
|
||||
}
|
||||
public String getNaData16() {
|
||||
return naData16;
|
||||
}
|
||||
public void setNaData16(String naData16) {
|
||||
this.naData16 = naData16;
|
||||
}
|
||||
public String getNaData17() {
|
||||
return naData17;
|
||||
}
|
||||
public void setNaData17(String naData17) {
|
||||
this.naData17 = naData17;
|
||||
}
|
||||
public String getNaData18() {
|
||||
return naData18;
|
||||
}
|
||||
public void setNaData18(String naData18) {
|
||||
this.naData18 = naData18;
|
||||
}
|
||||
public String getNaData19() {
|
||||
return naData19;
|
||||
}
|
||||
public void setNaData19(String naData19) {
|
||||
this.naData19 = naData19;
|
||||
}
|
||||
public String getNaData20() {
|
||||
return naData20;
|
||||
}
|
||||
public void setNaData20(String naData20) {
|
||||
this.naData20 = naData20;
|
||||
}
|
||||
public String getNaData21() {
|
||||
return naData21;
|
||||
}
|
||||
public void setNaData21(String naData21) {
|
||||
this.naData21 = naData21;
|
||||
}
|
||||
public String getNaData22() {
|
||||
return naData22;
|
||||
}
|
||||
public void setNaData22(String naData22) {
|
||||
this.naData22 = naData22;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
package kcg.imis.nation.web;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import kcg.imis.nation.service.NationService;
|
||||
import kcg.imis.nation.vo.NationVO;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @FileName : NationController.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 4. 11.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/nation")
|
||||
public class NationController {
|
||||
|
||||
@Resource(name = "nationService")
|
||||
private NationService nationService;
|
||||
|
||||
@RequestMapping(value = "/info.do", method = RequestMethod.GET)
|
||||
public String info(final Model model, @RequestParam(value="seq") String naSeq) {
|
||||
|
||||
try {
|
||||
model.addAttribute("nation", nationService.getNationInfo(naSeq));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return "nation/nationInfo.tiles";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update.do", method = RequestMethod.POST)
|
||||
public String updateNation(final Model model, @ModelAttribute("reportVO") final NationVO nationVO) {
|
||||
|
||||
try {
|
||||
nationService.updateNation(nationVO);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return "redirect:/nation/info.do?seq="+nationVO.getNaSeq();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,158 @@
|
|||
package kcg.imis.notice.mapper;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import kcg.imis.notice.vo.NoticeSearchVO;
|
||||
import kcg.imis.notice.vo.NoticeVO;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
|
||||
|
||||
/**
|
||||
* @FileName : NoticeMapper.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 4. 26.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
@Repository("noticeMapper")
|
||||
public class NoticeMapper extends EgovAbstractMapper {
|
||||
|
||||
|
||||
/**
|
||||
* 공지 목록 화면을 반환한다.
|
||||
*
|
||||
* @param searchVO 검색, 페이지 정보 객체
|
||||
* @return 게시물 리스트
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public List<NoticeVO> selectNoticeList(final NoticeSearchVO searchVO) throws Exception {
|
||||
return selectList("Notice.selectNoticeList", searchVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 검색 키워드에 따른 총 게시물 개수를 조회한다.
|
||||
*
|
||||
* @param searchVO 검색, 페이지 정보 객체
|
||||
* @return 게시물 개수
|
||||
* @exception Exception 기본 예외 처리
|
||||
*/
|
||||
public int selectNoticeListTotCnt(final NoticeSearchVO searchVO) throws Exception {
|
||||
return (Integer) selectOne("Notice.selectNoticeListTotCnt", searchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 전체 게시물 개수를 가져온다.
|
||||
* @param searchVO
|
||||
*
|
||||
* @return 게시물 개수
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int selectNoticeTotalCnt(final NoticeSearchVO searchVO) throws Exception {
|
||||
return (Integer) selectOne("Notice.selectNoticeTotalCnt", searchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 답글 추가에 따른 group seq를 수정한다
|
||||
*
|
||||
* @param noticeVO NoticeVO 객체
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int updateGrpStep(final NoticeVO noticeVO) throws Exception {
|
||||
return update("Notice.updateGrpStep", noticeVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 이전게시물 번호
|
||||
*
|
||||
* @param noticeVO NoticeVO 객체
|
||||
* @return 그룹에 해당되는 게시물 개수
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int selectPrevSeq(final NoticeVO noticeVO) throws Exception {
|
||||
return selectOne("Notice.selectPrevSeq", noticeVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 다음게시물 번호
|
||||
*
|
||||
* @param noticeVO NoticeVO 객체
|
||||
* @return 그룹에 해당되는 게시물 개수
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int selectNextSeq(final NoticeVO noticeVO) throws Exception {
|
||||
return selectOne("Notice.selectNextSeq", noticeVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 게시물을 추가한다.
|
||||
*
|
||||
* @param noticeVO 공지 내용 구성 객체
|
||||
* @return 글 총 갯수
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public HashMap<String, Object> insertNotice(final NoticeVO noticeVO) throws Exception {
|
||||
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
try {
|
||||
insert("Notice.insertNotice", noticeVO);
|
||||
map.put("npIdx", noticeVO.getNpIdx());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return map;
|
||||
};
|
||||
|
||||
/**
|
||||
* 선택한 게시물의 내용을 반환한다.
|
||||
*
|
||||
* @param noticeVO 게시물 VO
|
||||
* @return 선택한 게시물 내용 반환
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public NoticeVO selectNotice(final NoticeVO noticeVO) throws Exception {
|
||||
return selectOne("Notice.selectNotice", noticeVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물을 DB에 업데이트 한다.
|
||||
*
|
||||
* @param noticeVO 게시물 VO
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int updateNotice(final NoticeVO noticeVO) throws Exception {
|
||||
return update("Notice.updateNotice", noticeVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물을 삭제한다.
|
||||
*
|
||||
* @param noticeVO 게시물 VO
|
||||
* @return HashMap/ seq : 게시물 번호 , result : 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int deleteNotice(final NoticeVO noticeVO) throws Exception {
|
||||
return delete("Notice.deleteNotice", noticeVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 공지 팝업 목록 화면을 반환한다.
|
||||
*
|
||||
* @param searchVO 검색, 페이지 정보 객체
|
||||
* @return 게시물 리스트
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public List<NoticeVO> selectNoticePopupList() throws Exception {
|
||||
return selectList("Notice.selectNoticePopupList");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
/**
|
||||
* BoardService.java
|
||||
* @author 임새미
|
||||
* @since 2016. 10. 25.
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- -------- ---------------------------
|
||||
* 2016. 10. 25. 임새미 최초생성
|
||||
*
|
||||
*/
|
||||
package kcg.imis.notice.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import kcg.imis.notice.vo.NoticeSearchVO;
|
||||
import kcg.imis.notice.vo.NoticeVO;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @FileName : BoardService.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 21.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
public interface NoticeService {
|
||||
|
||||
/**
|
||||
* 공지 목록 화면을 반환한다.
|
||||
*
|
||||
* @param searchVO 검색, 페이지 정보 객체
|
||||
* @return 게시물 리스트
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public List<NoticeVO> selectList(final NoticeSearchVO searchVO) throws Exception ;
|
||||
|
||||
/**
|
||||
* 검색 키워드에 따른 총 게시물 개수를 조회한다.
|
||||
*
|
||||
* @param searchVO 검색, 페이지 정보 객체
|
||||
* @return 게시물 개수
|
||||
* @exception Exception 기본 예외 처리
|
||||
*/
|
||||
public int selectListCnt(final NoticeSearchVO searchVO) throws Exception ;
|
||||
|
||||
/**
|
||||
* 전체 게시물 개수를 가져온다.
|
||||
*
|
||||
* @return 게시물 개수
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int selectTotalCnt(final NoticeSearchVO searchVO) throws Exception ;
|
||||
|
||||
|
||||
/**
|
||||
* 선택한 게시물의 내용을 반환한다.
|
||||
*
|
||||
* @param bdSeq 공지
|
||||
* @return 선택한 게시물 내용 반환
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public NoticeVO select(final NoticeVO noticeVO) throws Exception;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 게시물을 추가한다.
|
||||
*
|
||||
* @param noticeVO 공지 내용 구성 객체
|
||||
* @param fileMap 업로드 파일정보체
|
||||
* @return HashMap/ seq : 게시물 , result : 성공 - 1, 실패 - 0
|
||||
* @exception Exception 기본 예외 처리
|
||||
*/
|
||||
public HashMap<String, Object> insert(final NoticeVO noticeVO) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* 게시물을 업데이트 한다.
|
||||
*
|
||||
* @param noticeVO 게시물 VO
|
||||
* @param fileMap MultipartFile형태의 파일정보
|
||||
* @param deleteFiles 삭제할 파일리스트
|
||||
* @return HashMap/ seq : 게시물 번호 , result : 성공 - 1, 실패 - 0
|
||||
*/
|
||||
public HashMap<String, Object> update(final NoticeVO noticeVO) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* 게시물을 삭제한다.
|
||||
*
|
||||
* @param bdSeq 게시물 번호
|
||||
* @return HashMap/ seq : 게시물 번호 , result : 성공 - 1, 실패 - 0
|
||||
*/
|
||||
public HashMap<String, Object> delete(final NoticeVO noticeVO) throws Exception;
|
||||
|
||||
public List<NoticeVO> selectNoticePopupList() throws Exception;
|
||||
}
|
||||
|
|
@ -0,0 +1,194 @@
|
|||
package kcg.imis.notice.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import kcg.imis.cmmn.file.FileUploadUtil;
|
||||
import kcg.imis.notice.mapper.NoticeMapper;
|
||||
import kcg.imis.notice.vo.NoticeSearchVO;
|
||||
import kcg.imis.notice.vo.NoticeVO;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||
|
||||
/**
|
||||
* @FileName : NoticeServiceImpl.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 4. 26.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
@Service("noticeService")
|
||||
public class NoticeServiceImpl extends EgovAbstractServiceImpl implements NoticeService {
|
||||
|
||||
/**
|
||||
* NoticeMapper - 게시판 데이터처리에 관한 Mapper 클래스
|
||||
**/
|
||||
@Resource(name = "noticeMapper")
|
||||
private NoticeMapper noticeMapper;
|
||||
|
||||
@Resource(name = "fileUploadUtil")
|
||||
private FileUploadUtil fileUtil;
|
||||
|
||||
|
||||
/**
|
||||
* 게시판 목록 화면을 반환한다.
|
||||
*
|
||||
* @param searchVO 검색, 페이지 정보 객체
|
||||
* @return 게시물 리스트
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public List<NoticeVO> selectList(final NoticeSearchVO searchVO) throws Exception {
|
||||
return noticeMapper.selectNoticeList(searchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 검색 키워드에 따른 총 게시물 개수를 조회한다.
|
||||
*
|
||||
* @param searchVO 검색, 페이지 정보 객체
|
||||
* @return 게시물 개수
|
||||
* @exception Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public int selectListCnt(final NoticeSearchVO searchVO) throws Exception {
|
||||
return noticeMapper.selectNoticeListTotCnt(searchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 전체 게시물 개수를 가져온다.
|
||||
*
|
||||
* @return 게시물 개수
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public int selectTotalCnt(final NoticeSearchVO searchVO) throws Exception {
|
||||
return noticeMapper.selectNoticeTotalCnt(searchVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 선택한 게시물의 내용을 반환한다.
|
||||
*
|
||||
* @param bdSeq 게시판
|
||||
* @return 선택한 게시물 내용 반환
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@Override
|
||||
public NoticeVO select(final NoticeVO noticeVO) throws Exception {
|
||||
|
||||
NoticeVO board = noticeMapper.selectNotice(noticeVO);
|
||||
board.setPrevSeq(noticeMapper.selectPrevSeq(board));
|
||||
board.setNextSeq(noticeMapper.selectNextSeq(board));
|
||||
return board;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 게시물을 추가한다.
|
||||
*
|
||||
* @param noticeVO 게시판 내용 구성 객체
|
||||
* @return HashMap/ seq : 게시물 , result : 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public HashMap<String, Object> insert(final NoticeVO noticeVO) throws Exception {
|
||||
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
/* seq 및 insert 결과 */
|
||||
map = noticeMapper.insertNotice(noticeVO);
|
||||
|
||||
int seq = (Integer) map.get("npIdx");
|
||||
|
||||
if (seq > 0) {
|
||||
noticeVO.setNpIdx(seq);
|
||||
} else {
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 게시물을 DB에 업데이트 한다.
|
||||
*
|
||||
* @param noticeVO 게시물 VO
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
private int updateNotice(final NoticeVO noticeVO) throws Exception {
|
||||
return noticeMapper.updateNotice(noticeVO);
|
||||
};
|
||||
|
||||
/**
|
||||
* 게시물을 업데이트 한다.
|
||||
*
|
||||
* @param noticeVO 게시물 VO
|
||||
* @param fileMap MultipartFile형태의 파일정보
|
||||
* @param deleteFiles 삭제할 파일리스트
|
||||
* @return HashMap/ seq : 게시물 번호 , result : 성공 - 1, 실패 - 0
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public HashMap<String, Object> update(final NoticeVO noticeVO) throws Exception {
|
||||
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
int result = 0;
|
||||
|
||||
result = this.updateNotice(noticeVO);
|
||||
|
||||
if (result != 1) {
|
||||
throw new Exception();
|
||||
} else {
|
||||
map.put("result", result);
|
||||
map.put("npIdx", noticeVO.getNpIdx());
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 게시물을 삭제한다.
|
||||
*
|
||||
* @param bdSeq 게시물 번호
|
||||
* @return HashMap/ seq : 게시물 번호 , result : 성공 - 1, 실패 - 0
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public HashMap<String, Object> delete(final NoticeVO noticeVO) throws Exception {
|
||||
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
int result = 0;
|
||||
|
||||
/* 삭제 후 처리를 위해 데이터 캐싱 */
|
||||
NoticeVO delNotice = noticeMapper.selectNotice(noticeVO);
|
||||
|
||||
result = noticeMapper.deleteNotice(delNotice);
|
||||
|
||||
if (result == 1) {
|
||||
map.put("result", result);
|
||||
} else {
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NoticeVO> selectNoticePopupList() throws Exception {
|
||||
return noticeMapper.selectNoticePopupList();
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* 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.imis.notice.vo;
|
||||
|
||||
import kcg.imis.cmmn.bbs.BaseSearchVO;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @FileName : NoticeSearchVO.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 4. 26.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
public class NoticeSearchVO extends BaseSearchVO {
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
package kcg.imis.notice.vo;
|
||||
|
||||
/**
|
||||
*
|
||||
* @FileName : NoticeVO.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 4. 26.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
public class NoticeVO {
|
||||
|
||||
private int npIdx;
|
||||
private String npSubject;
|
||||
private String npText;
|
||||
private String npActive;
|
||||
private String npWidth;
|
||||
private String npHeight;
|
||||
private String npStart;
|
||||
private String npEnd;
|
||||
private String npRegdate;
|
||||
private String npWriter;
|
||||
|
||||
private int prevSeq;
|
||||
private int nextSeq;
|
||||
public String getNpSubject() {
|
||||
return npSubject;
|
||||
}
|
||||
public void setNpSubject(String npSubject) {
|
||||
this.npSubject = npSubject;
|
||||
}
|
||||
public String getNpText() {
|
||||
return npText;
|
||||
}
|
||||
public void setNpText(String npText) {
|
||||
this.npText = npText;
|
||||
}
|
||||
public String getNpActive() {
|
||||
return npActive;
|
||||
}
|
||||
public void setNpActive(String npActive) {
|
||||
this.npActive = npActive;
|
||||
}
|
||||
public String getNpWidth() {
|
||||
return npWidth;
|
||||
}
|
||||
public void setNpWidth(String npWidth) {
|
||||
this.npWidth = npWidth;
|
||||
}
|
||||
public String getNpHeight() {
|
||||
return npHeight;
|
||||
}
|
||||
public void setNpHeight(String npHeight) {
|
||||
this.npHeight = npHeight;
|
||||
}
|
||||
public String getNpStart() {
|
||||
return npStart;
|
||||
}
|
||||
public void setNpStart(String npStart) {
|
||||
this.npStart = npStart;
|
||||
}
|
||||
public String getNpEnd() {
|
||||
return npEnd;
|
||||
}
|
||||
public void setNpEnd(String npEnd) {
|
||||
this.npEnd = npEnd;
|
||||
}
|
||||
public String getNpRegdate() {
|
||||
return npRegdate;
|
||||
}
|
||||
public void setNpRegdate(String npRegdate) {
|
||||
this.npRegdate = npRegdate;
|
||||
}
|
||||
public String getNpWriter() {
|
||||
return npWriter;
|
||||
}
|
||||
public void setNpWriter(String npWriter) {
|
||||
this.npWriter = npWriter;
|
||||
}
|
||||
public int getPrevSeq() {
|
||||
return prevSeq;
|
||||
}
|
||||
public void setPrevSeq(int prevSeq) {
|
||||
this.prevSeq = prevSeq;
|
||||
}
|
||||
public int getNextSeq() {
|
||||
return nextSeq;
|
||||
}
|
||||
public void setNextSeq(int nextSeq) {
|
||||
this.nextSeq = nextSeq;
|
||||
}
|
||||
public int getNpIdx() {
|
||||
return npIdx;
|
||||
}
|
||||
public void setNpIdx(int npIdx) {
|
||||
this.npIdx = npIdx;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,382 @@
|
|||
package kcg.imis.notice.web;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import kcg.imis.notice.service.NoticeService;
|
||||
import kcg.imis.notice.vo.NoticeSearchVO;
|
||||
import kcg.imis.notice.vo.NoticeVO;
|
||||
import kcg.imis.sec.LoginUserVO;
|
||||
import kcg.imis.sec.UserUtil;
|
||||
|
||||
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.SessionAttributes;
|
||||
import org.springframework.web.bind.support.SessionStatus;
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @FileName : BoardController.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 21.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 : 게시판 컨트롤러
|
||||
*/
|
||||
@Controller
|
||||
@SessionAttributes(types = NoticeVO.class)
|
||||
@RequestMapping("/notice")
|
||||
public class NoticeController {
|
||||
|
||||
/**
|
||||
* EgovPropertyService - properties값을 가져오는 인터페이스.
|
||||
**/
|
||||
@Resource(name = "propertiesService")
|
||||
private EgovPropertyService propertiesService;
|
||||
|
||||
/**
|
||||
* Validator - 유효성 검사.
|
||||
**/
|
||||
@Resource(name = "beanValidator")
|
||||
private DefaultBeanValidator beanValidator;
|
||||
|
||||
/**
|
||||
* NoticeService - 게시판 데이터처리에 관한 인터페이스.
|
||||
**/
|
||||
@Resource(name = "noticeService")
|
||||
private NoticeService noticeService;
|
||||
|
||||
/**
|
||||
* 게시판 목록 화면을 반환한다.
|
||||
*
|
||||
* @param req
|
||||
* Request 객체
|
||||
* @param searchVO
|
||||
* 검색, 페이지 정보 객체
|
||||
* @param model
|
||||
* 모델 객체
|
||||
* @return 게시판 목록 화면
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value = "/list.do")
|
||||
public String noticeList(final HttpServletRequest req, @ModelAttribute("searchVO") final NoticeSearchVO 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 = noticeService.selectListCnt(searchVO);
|
||||
paginationInfo.setTotalRecordCount(totSearchCnt);
|
||||
model.addAttribute("paginationInfo", paginationInfo);
|
||||
|
||||
/* 게시판 리스트 */
|
||||
List<NoticeVO> noticeList = noticeService.selectList(searchVO);
|
||||
model.addAttribute("resultList", noticeList);
|
||||
|
||||
/* 게시판 상단 페이지 및 게시물 정보 표현을 위한 데이터 */
|
||||
int totCnt = noticeService.selectTotalCnt(searchVO);
|
||||
model.addAttribute("totalCnt", totCnt);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "error/bizError";
|
||||
}
|
||||
|
||||
return "notice/noticeList.tiles";
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물의 내용을 확인하는 페이지를 반환한다.
|
||||
*
|
||||
* @param noticeVO
|
||||
* 게시판 VO
|
||||
* @param model
|
||||
* 모델 객체
|
||||
* @return 게시물 조회 화면
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value = "/view.do", method = RequestMethod.GET)
|
||||
public String noticeView(final NoticeVO noticeVO, final Model model) throws Exception {
|
||||
|
||||
try {
|
||||
/* 작성자와 조회자가 다른 경우 조회수 증가 */
|
||||
NoticeVO notice = noticeService.select(noticeVO);
|
||||
|
||||
/* 게시판 내용 */
|
||||
model.addAttribute("noticeVO", notice);
|
||||
|
||||
/* 세션 사용자 정보 */
|
||||
model.addAttribute("loginUserVO", UserUtil.getMemberInfo());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "error/bizError";
|
||||
}
|
||||
|
||||
return "notice/noticeView.tiles";
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물 추가 화면을 반환한다. searchVO
|
||||
*
|
||||
* @param model
|
||||
* 모델 객체
|
||||
* @param noticeVO
|
||||
* 게시판 VO
|
||||
* @return 게시물 조회 화면
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value = "/addView.do", method = RequestMethod.GET)
|
||||
public String noticeAddView(final Model model) throws Exception {
|
||||
|
||||
NoticeVO modelAttr = new NoticeVO();
|
||||
model.addAttribute("noticeVO", modelAttr);
|
||||
/* create or modify 플래그 */
|
||||
model.addAttribute("registerFlag", "create");
|
||||
|
||||
return "notice/noticeAdd.tiles";
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물을 추가한 후 추가한 게시물 화면으로 이동한다.
|
||||
*
|
||||
* @param multiRequest
|
||||
* multpart타입의 요청 객체
|
||||
* @param noticeVO
|
||||
* 게시물 정보 객체
|
||||
* @param bindingResult
|
||||
* 바인딩 객체
|
||||
* @param model
|
||||
* 모델 객체
|
||||
* @param status
|
||||
* 세선 상태 객체
|
||||
* @return 게시물 화면
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value = "/add.do", method = RequestMethod.POST)
|
||||
public String noticeAdd(@ModelAttribute("noticeVO") final NoticeVO noticeVO, 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 {
|
||||
|
||||
if (bindingResult.hasErrors()) {
|
||||
model.addAttribute("noticeVO", noticeVO);
|
||||
return "notice/noticeAdd.tiles";
|
||||
}
|
||||
|
||||
/* 사용자 정보 입력 */
|
||||
LoginUserVO user = UserUtil.getMemberInfo();
|
||||
noticeVO.setNpWriter(user.getUserid());
|
||||
|
||||
map = noticeService.insert(noticeVO);
|
||||
|
||||
status.setComplete();
|
||||
|
||||
int npIdx = (Integer) map.get("npIdx");
|
||||
if (npIdx > 0) {
|
||||
return "redirect:/notice/list.do";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "error/bizError";
|
||||
}
|
||||
}
|
||||
|
||||
return "error/bizError";
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물을 추가한 후 추가한 게시물 화면으로 이동한다.
|
||||
*
|
||||
* @param noticeVO
|
||||
* 게시판VO 객체
|
||||
* @param model
|
||||
* 모델 객체
|
||||
* @return 게시물 화면
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value = "/updateView.do", method = RequestMethod.POST)
|
||||
public String updateView(final NoticeVO noticeVO, final Model model) throws Exception {
|
||||
|
||||
NoticeVO updateBoard = noticeService.select(noticeVO);
|
||||
try {
|
||||
/* 글 작성자와 세션 사용자의 아이디를 비교하여 본인여부를 판단한다 */
|
||||
if (updateBoard == null || !UserUtil.isEqualMember(updateBoard.getNpWriter()) && !UserUtil.isSysAdmin()) {
|
||||
return "redirect:/notice/view.do?npIdx=" + noticeVO.getNpIdx();
|
||||
}
|
||||
|
||||
model.addAttribute("noticeVO", updateBoard);
|
||||
model.addAttribute("registerFlag", "modify");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "error/bizError";
|
||||
}
|
||||
|
||||
return "notice/noticeAdd.tiles";
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물을 수정한다.
|
||||
*
|
||||
* @param multiRequest
|
||||
* multpart타입의 요청 객체
|
||||
* @param noticeVO
|
||||
* 게시물 정보 객체
|
||||
* @param bindingResult
|
||||
* 바인딩 객체
|
||||
* @param model
|
||||
* 모델 객체
|
||||
* @param status
|
||||
* 세선 상태 객체
|
||||
* @return 게시물 화면
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value = "/update.do", method = RequestMethod.POST)
|
||||
public String update(final MultipartHttpServletRequest multiRequest, @ModelAttribute("noticeVO") final NoticeVO noticeVO, final BindingResult bindingResult, final Model model,
|
||||
final SessionStatus status) throws Exception {
|
||||
|
||||
try {
|
||||
/* 글 작성자와 세션 사용자의 아이디를 비교하여 본인여부를 판단한다 */
|
||||
if (!UserUtil.isEqualMember(noticeVO.getNpWriter()) && !UserUtil.isSysAdmin()) {
|
||||
return "redirect:/notice/view.do?npIdx=" + noticeVO.getNpIdx();
|
||||
}
|
||||
|
||||
if (bindingResult.hasErrors()) {
|
||||
model.addAttribute("noticeVO", noticeVO);
|
||||
model.addAttribute("registerFlag", "modify");
|
||||
return "notice/noticeAdd.tiles";
|
||||
}
|
||||
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
map = noticeService.update(noticeVO);
|
||||
|
||||
status.setComplete();
|
||||
|
||||
int npIdx = (Integer) map.get("npIdx");
|
||||
if (npIdx > 0) {
|
||||
return "redirect:/notice/list.do";
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "error/bizError";
|
||||
}
|
||||
|
||||
return "redirect:/notice/list.do";
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물을 삭제한다.
|
||||
*
|
||||
* @param noticeVO
|
||||
* 게시판 VO
|
||||
* @param model
|
||||
* 모델 객체
|
||||
* @param status
|
||||
* 세선 상태 객체
|
||||
* @return 게시물 화면
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value = "/delete.do", method = RequestMethod.POST)
|
||||
public String delete(final NoticeVO noticeVO, final Model model, final SessionStatus status) throws Exception {
|
||||
|
||||
try {
|
||||
if (!UserUtil.isEqualMember(noticeVO.getNpWriter()) && !UserUtil.isSysAdmin()) {
|
||||
return "redirect:/notice/view.do";
|
||||
}
|
||||
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
map = noticeService.delete(noticeVO);
|
||||
|
||||
status.setComplete();
|
||||
|
||||
if ((Integer) map.get("result") > 0) {
|
||||
return "redirect:/notice/list.do";
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "error/bizError";
|
||||
}
|
||||
|
||||
return "redirect:/notice/view.do";
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물을 삭제한다.
|
||||
*
|
||||
* @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 {
|
||||
/*
|
||||
* NoticeVO noticeVO = NoticeVOHandler.getNoticeVO(bdId, 0); if
|
||||
* (deleteBoard != null) {
|
||||
* noticeService.selectAndDelete(noticeVO, deleteBoard); }
|
||||
*/
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
status.setComplete();
|
||||
}
|
||||
return "redirect:/notice/list.do";
|
||||
}
|
||||
|
||||
@RequestMapping("/popup.do")
|
||||
public String loginView(NoticeVO noticeVO, final Model model) throws Exception {
|
||||
|
||||
model.addAttribute("noticeVO", noticeService.select(noticeVO));
|
||||
return "notice/noticePop";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
package kcg.imis.report.mapper;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import kcg.imis.report.vo.ReportFileVO;
|
||||
import kcg.imis.report.vo.ReportVO;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
|
||||
|
||||
/**
|
||||
* @FileName : ReportFileMapper.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 29.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
@Repository("reportFileMapper")
|
||||
public class ReportFileMapper extends EgovAbstractMapper {
|
||||
|
||||
/**
|
||||
* 파일 정보를 입력한다.
|
||||
*
|
||||
* @param fileVO 파일 VO
|
||||
* @return 1-성공, 0-실패
|
||||
*/
|
||||
public int insertFile(final ReportVO fileVO) {
|
||||
return update("ReportFile.insert", fileVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 시퀀스에 업로드된 파일 갯수를 갱신한다.
|
||||
*
|
||||
* @param map 업로드된 파일 갯수와 시퀀스를 담고있는 맵
|
||||
* @return 1-성공, 0-실패
|
||||
*/
|
||||
public int updateFileSeq(final HashMap<String, Object> map) {
|
||||
return update("ReportFile.updateFileSeq", map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일 정보를 갱신한다.
|
||||
*
|
||||
* @param fileVO 파일 VO
|
||||
* @return 1-성공, 0-실패
|
||||
*/
|
||||
public int updateFile(final ReportVO fileVO) {
|
||||
return update("ReportFile.insert", fileVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일을 저장할 시퀀스를 반환한다.
|
||||
* @return 파일 시퀀스
|
||||
*/
|
||||
public ReportFileVO selectFileSeq(Integer fsSeq) {
|
||||
return selectOne("ReportFile.selectFileSeq", fsSeq);
|
||||
}
|
||||
|
||||
public int selectMaxFileSeq() {
|
||||
return selectOne("ReportFile.selectMaxFileSeq");
|
||||
}
|
||||
|
||||
/**
|
||||
* 견문 파일 저장 시퀀스를 증가시킨다.
|
||||
* @return 시퀀스
|
||||
*/
|
||||
public int insertFileSeq() {
|
||||
ReportFileVO reportFileVO = new ReportFileVO();
|
||||
int result = insert("ReportFile.insertFileSeq", reportFileVO);
|
||||
return reportFileVO.getFsSeq();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,210 @@
|
|||
package kcg.imis.report.mapper;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import kcg.imis.cmmn.vo.CodeVO;
|
||||
import kcg.imis.member.vo.MemberVO;
|
||||
import kcg.imis.report.vo.ReportJudgeVO;
|
||||
import kcg.imis.report.vo.ReportSearchVO;
|
||||
import kcg.imis.report.vo.ReportVO;
|
||||
import kcg.imis.sec.LoginUserVO;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
|
||||
import egovframework.rte.psl.dataaccess.util.EgovMap;
|
||||
|
||||
/**
|
||||
* @FileName : ReportJudgeMapper.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 29.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
@Repository("reportJudgeMapper")
|
||||
public class ReportJudgeMapper extends EgovAbstractMapper {
|
||||
|
||||
/**
|
||||
* 평가 정보를 반환한다.
|
||||
*
|
||||
* @param juseq 견문 평가 객체
|
||||
* @return 평가
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
public ReportJudgeVO selectOne(final int juseq) throws Exception {
|
||||
return selectOne("ReportJudge.selectOne", juseq);
|
||||
}
|
||||
|
||||
/**
|
||||
* 평가명을 반환한다.
|
||||
*
|
||||
* @param judgeCode 평가코드
|
||||
* @return 평가명
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
public String getJudgeName(final int judgeCode) throws Exception {
|
||||
return selectOne("ReportJudge.getJudgeName", judgeCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 견문 결재 정보를 반환한다.
|
||||
*
|
||||
* @param loginUserVO 접속한 사용자 객체
|
||||
* @return 결문 결재 정보
|
||||
*/
|
||||
public MemberVO selectApprove(final String usrLv) {
|
||||
return selectOne("ReportJudge.selectApprove", usrLv);
|
||||
}
|
||||
|
||||
/**
|
||||
* 견문 평가 입력
|
||||
* @param reportJudgeVO 견문 평가 객체
|
||||
* @return 성공:1
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
public int insert(final ReportJudgeVO reportJudgeVO) throws Exception {
|
||||
int result = 0;
|
||||
try {
|
||||
result = insert("ReportJudge.insert", reportJudgeVO);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return reportJudgeVO.getJuSeq();
|
||||
}
|
||||
|
||||
/**
|
||||
* 견문 평가 수정
|
||||
* @param reportJudgeVO 견문 평가 객체
|
||||
* @return 성공:1
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
public int update(final ReportJudgeVO reportJudgeVO) throws Exception {
|
||||
return update("ReportJudge.update", reportJudgeVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 견문의 결재 대기 목록을 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 객체
|
||||
* @return 견문 결재 대기 목록
|
||||
*/
|
||||
public List<ReportVO> selectWaitList(final ReportSearchVO reportSearchVO) {
|
||||
return selectList("Report.selectWaitList", reportSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 견문의 결재 대기 전체 목록을 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 객체
|
||||
* @return 견문 결재 대기 전체 목록
|
||||
*/
|
||||
public List<ReportVO> selectWaitListAll(final ReportSearchVO reportSearchVO) {
|
||||
return selectList("Report.selectWaitListAll", reportSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 견문의 결재 대기 목록 전체 갯수를 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색조건 vo
|
||||
* @return 견문 임시저장목록 결과 갯수
|
||||
*/
|
||||
public int selectWaitListCnt(final ReportSearchVO reportSearchVO) {
|
||||
return selectOne("Report.selectWaitListCnt", reportSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 견문 처리 목록을 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 객체
|
||||
* @return 견문 처리 목록
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public List<ReportVO> selectApproveList(final ReportSearchVO reportSearchVO) throws Exception {
|
||||
return selectList("Report.selectAprList", reportSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 견문 처리 목록 갯수를 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 객체
|
||||
* @return 견문 처리 목록 갯수
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int selectApproveListCnt(final ReportSearchVO reportSearchVO) throws Exception {
|
||||
return selectOne("Report.selectAprListCnt", reportSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 견문 처리 전체 목록을 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 객체
|
||||
* @return 견문 처리 전체 목록
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public List<ReportVO> selectApproveListAll(final ReportSearchVO reportSearchVO) throws Exception {
|
||||
return selectList("Report.selectAprListAll", reportSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 내 실적 조회 목록을 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 객체
|
||||
* @return 내 실적 조회 목록
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public List<ReportVO> selectMyList(final ReportSearchVO reportSearchVO) throws Exception {
|
||||
return selectList("Report.selectMyList", reportSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 내 실적 조회 목록 갯수를 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 객체
|
||||
* @return 내 실적 조회 목록 갯수
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int selectMyListCnt(final ReportSearchVO reportSearchVO) throws Exception {
|
||||
return selectOne("Report.selectMyListCnt", reportSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 내 실적 조회 전체 목록을 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 객체
|
||||
* @return 내 실적 조회 전체 목록
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public List<ReportVO> selectMyListAll(final ReportSearchVO reportSearchVO) throws Exception {
|
||||
return selectList("Report.selectMyListAll", reportSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 분야별 통계를 조회한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 객체
|
||||
* @return 분야별통계
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public List<HashMap<String, String>> statsCategory(final ReportSearchVO reportSearchVO) throws Exception {
|
||||
return selectList("ReportJudge.statsCategory", reportSearchVO);
|
||||
}
|
||||
|
||||
public List<HashMap<String, String>> selectPlace(final ReportSearchVO reportSearchVO) throws Exception {
|
||||
return selectList("ReportJudge.selectPlace", reportSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 평가별 통계를 조회한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 객체
|
||||
* @return 평가별통계
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public List<HashMap<String, String>> statsJudge(final ReportSearchVO reportSearchVO) throws Exception {
|
||||
return selectList("ReportJudge.statsJudge", reportSearchVO);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,297 @@
|
|||
package kcg.imis.report.mapper;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import kcg.imis.report.vo.ReportGoalVO;
|
||||
import kcg.imis.report.vo.ReportSearchVO;
|
||||
import kcg.imis.report.vo.ReportVO;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
|
||||
|
||||
|
||||
/**
|
||||
* @FileName : ReportMapper.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 29.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
@Repository("reportMapper")
|
||||
public class ReportMapper extends EgovAbstractMapper {
|
||||
|
||||
/**
|
||||
* 견문 정보를 반환한다.
|
||||
*
|
||||
* @param reportVO 견문vo
|
||||
*
|
||||
* @return 견문VO
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public ReportVO select(final ReportVO reportVO) throws Exception {
|
||||
return selectOne("Report.select", reportVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 페이징 처리 없이 견문 전체 목록을 반환한다.
|
||||
*
|
||||
* @param reportSearchVO
|
||||
* 검색정보 객체
|
||||
* @return 견문 목록
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public List<ReportVO> selectListAll(final ReportSearchVO reportSearchVO) throws Exception {
|
||||
return selectList("Report.selectListAll", reportSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 견문정보 총 개수를 반환한다.
|
||||
*
|
||||
* @param reportSearchVO
|
||||
* 검색, 페이지정보 객체
|
||||
* @return 견문정보 총 개수
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
public int selectTotalCnt(final ReportSearchVO reportSearchVO) throws Exception {
|
||||
return (Integer) selectOne("Report.selectTotalCnt", reportSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 견문 목록를 반환한다.
|
||||
*
|
||||
* @param reportSearchVO
|
||||
* 검색, 페이지정보 객체
|
||||
* @return 견문 목록
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
public List<ReportVO> selectList(final ReportSearchVO reportSearchVO) throws Exception {
|
||||
return selectList("Report.selectList", reportSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 견문 목록 개수를 반환한다.
|
||||
*
|
||||
* @param reportSearchVO
|
||||
* 검색, 페이지정보 객체
|
||||
* @return 견문 목록 개수
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
public int selectListCnt(final ReportSearchVO reportSearchVO) throws Exception {
|
||||
return (Integer) selectOne("Report.selectListCnt", reportSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 견문 정보를 입력한다.
|
||||
*
|
||||
* @param reportVO 견문 VO
|
||||
* @return 맵 객체 {result: 성공여부, seq: 입력된 레코드의 key 값}
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public HashMap<String, Object> insert(final ReportVO reportVO) throws Exception {
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
int result = 0;
|
||||
try {
|
||||
result = insert("Report.insert", reportVO);
|
||||
|
||||
map.put("result", result);
|
||||
map.put("seq", reportVO.getInSeq());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 견문 정보를 갱신한다.
|
||||
*
|
||||
* @param reportVO
|
||||
* 견문 VO
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
public int update(final ReportVO reportVO) throws Exception {
|
||||
return update("Report.update", reportVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 견문 정보를 삭제한다.
|
||||
*
|
||||
* @param reportVO
|
||||
* 견문 VO
|
||||
* @return 성공 - 1, 실패 - 0
|
||||
* @throws Exception
|
||||
* 기본 예외 처리
|
||||
*/
|
||||
public int delete(final ReportVO reportVO) throws Exception {
|
||||
return delete("Report.delete", reportVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 견문의 새 소속번호를 반환한다.
|
||||
*
|
||||
* @param reportVO 견문vo
|
||||
* @return 새 소속번호
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
public int selectPlaceNum(final ReportVO reportVO) {
|
||||
return selectOne("Report.selectPlaceNum", reportVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 견문의 임시저장목록을 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색조건 vo
|
||||
* @return 견문 임시저장목록
|
||||
*/
|
||||
public List<ReportVO> selectSaveList(final ReportSearchVO reportSearchVO) {
|
||||
return selectList("Report.selectSaveList", reportSearchVO);
|
||||
}
|
||||
/**
|
||||
* 견문의 임시저장목록 결과 갯수를 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색조건 vo
|
||||
* @return 견문 임시저장목록 결과 갯수
|
||||
*/
|
||||
public int selectSaveListCnt(final ReportSearchVO reportSearchVO) {
|
||||
return selectOne("Report.selectSaveListCnt", reportSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 견문제출현황을 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 객체
|
||||
* @return 견문제출현황 목록
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public List<ReportVO> selectPresentList(final ReportSearchVO reportSearchVO) throws Exception {
|
||||
return selectList("Report.selectPresentList", reportSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 견문제출현황 갯수를 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 객체
|
||||
* @return 견문제출현황 목록 갯수
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int selectPresentListCnt(final ReportSearchVO reportSearchVO) throws Exception {
|
||||
return selectOne("Report.selectPresentListCnt", reportSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 견문제출현황 전체목록을 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 객체
|
||||
* @return 견문제출현황 전체 목록
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public List<ReportVO> selectPresentListAll(final ReportSearchVO reportSearchVO) throws Exception {
|
||||
return selectList("Report.selectPresentListAll", reportSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 평가기록부을 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 객체
|
||||
* @return 견문제출현황 목록
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public List<ReportVO> selectRecordList(final ReportSearchVO reportSearchVO) throws Exception {
|
||||
return selectList("Report.selectRecordList", reportSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 평가기록부 갯수를 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 객체
|
||||
* @return 평가기록부 목록 갯수
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public int selectRecordListCnt(final ReportSearchVO reportSearchVO) throws Exception {
|
||||
return selectOne("Report.selectRecordListCnt", reportSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 평가기록부 전체목록을 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 객체
|
||||
* @return 평가기록부 전체 목록
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
public List<ReportVO> selectRecordListAll(final ReportSearchVO reportSearchVO) throws Exception {
|
||||
return selectList("Report.selectRecordListAll", reportSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 목표 관리 목록을 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 객체
|
||||
* @return 목표 관리
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
public List<ReportGoalVO> selectGoalList(final ReportSearchVO reportSearchVO) throws Exception {
|
||||
return selectList("ReportGoal.selectList", reportSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 목표 레코드 1개를 조회한다.
|
||||
*
|
||||
* @param reportGoalVO 견문 검색 객체
|
||||
* @return 목표 레코드
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
public ReportGoalVO selectGoal(final ReportGoalVO reportGoalVO) throws Exception {
|
||||
return selectOne("ReportGoal.select", reportGoalVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 목표를 입력한다.
|
||||
*
|
||||
* @param reportGoalVO 견문 검색 객체
|
||||
* @return 목표 레코드
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
public int insertGoal(final ReportGoalVO reportGoalVO) throws Exception {
|
||||
return insert("ReportGoal.insert", reportGoalVO);
|
||||
}
|
||||
/**
|
||||
* 목표를 수정한다.
|
||||
*
|
||||
* @param reportGoalVO 견문 검색 객체
|
||||
* @return 목표 레코드
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
public int updateGoal(final ReportGoalVO reportGoalVO) throws Exception {
|
||||
return update("ReportGoal.update", reportGoalVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 사용자별 목표 통계를 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색객체
|
||||
* @return 목표 통계
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
public List<HashMap<String, Object>> getGoalStats(final ReportSearchVO reportSearchVO) throws Exception {
|
||||
return selectList("ReportGoal.getStats", reportSearchVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 소속별 목표 통계를 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색객체
|
||||
* @return 목표 통계
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
public List<HashMap<String, Object>> getGoalStatsPlace(final ReportSearchVO reportSearchVO) throws Exception {
|
||||
return selectList("ReportGoal.getStatsPlace", reportSearchVO);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package kcg.imis.report.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import kcg.imis.report.vo.ReportVO;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* @FileName : ReportFileService.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 29.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
public interface ReportFileService {
|
||||
|
||||
/**
|
||||
* property 파일에서 읽은 저장 경로 키워드.
|
||||
*/
|
||||
static final String FILE_PATH_KEYWORD = "Report.fileStorePath";
|
||||
|
||||
/**
|
||||
* 견문 파일 시퀀스를 반환한다.
|
||||
*
|
||||
* @return 견문 파일 시퀀스
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
int selectFileSeq() throws Exception;
|
||||
|
||||
/**
|
||||
* 첨부파일정보 입력 및 업로드
|
||||
*
|
||||
* @param dataVO 견문객체
|
||||
* @param fileMap 파일맵
|
||||
* @return 성공:1, 실패:0
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
int insertAndSaveFiles(final ReportVO dataVO, final Map<String, MultipartFile> fileMap) throws Exception;
|
||||
|
||||
/**
|
||||
* 첨부파일 정보를 삭제하고 디렉토리내의 파일도 삭제한다.
|
||||
*
|
||||
* @param dataVO 견문 객체
|
||||
* @param deleteFiles 삭제할 첨부파일 순번
|
||||
* @return 성공:1, 실패:0
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
int deleteAndRemoveFiles(final ReportVO dataVO, String[] deleteFiles) throws Exception;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,172 @@
|
|||
package kcg.imis.report.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import kcg.imis.cmmn.egov.file.EgovFileMngUtil;
|
||||
import kcg.imis.cmmn.egov.vo.FileVO;
|
||||
import kcg.imis.report.mapper.ReportFileMapper;
|
||||
import kcg.imis.report.vo.ReportFileVO;
|
||||
import kcg.imis.report.vo.ReportVO;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||
/**
|
||||
* @FileName : ReportFileServiceImpl.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 29.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
@Service("reportFileService")
|
||||
public class ReportFileServiceImpl extends EgovAbstractServiceImpl implements ReportFileService {
|
||||
|
||||
/**
|
||||
* 견문 파일 시퀀스당 저장될 견문의 최대 갯수
|
||||
*/
|
||||
private static final int SEQCNTLIMIT = 1000;
|
||||
|
||||
/**
|
||||
* 견문 관련 파일 Mapper 클래스.
|
||||
*/
|
||||
@Resource(name = "reportFileMapper")
|
||||
private ReportFileMapper reportFileMapper;
|
||||
|
||||
/**
|
||||
* 견문 관련 인터페이스.
|
||||
*/
|
||||
@Resource(name = "reportService")
|
||||
private ReportService reportService;
|
||||
|
||||
/**
|
||||
* 전자정부프레임워크에서 제공되는 파일 업로드 처리 관련 Utility.
|
||||
**/
|
||||
@Resource(name = "EgovFileMngUtil")
|
||||
private EgovFileMngUtil fileUtil;
|
||||
|
||||
@Override
|
||||
public int insertAndSaveFiles(final ReportVO dataVO, final Map<String, MultipartFile> fileMap) throws Exception {
|
||||
int result = 1;
|
||||
ReportVO originVO = reportService.select(dataVO);
|
||||
List<String> deleteFiles = new ArrayList<String>();
|
||||
|
||||
if (fileMap != null) {
|
||||
|
||||
if (dataVO.getInFsseq() <= 0) {
|
||||
dataVO.setInFsseq(selectFileSeq());
|
||||
}
|
||||
if (dataVO.getInFsseq() <= 0) {
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
List<FileVO> files = fileUtil.parseFileInf(fileMap, "_", 0, "", FILE_PATH_KEYWORD, String.valueOf(dataVO.getInFsseq()));
|
||||
|
||||
for (FileVO file : files) {
|
||||
if ("fileObj1".equalsIgnoreCase(file.getFileSn())) {
|
||||
dataVO.setInFile1(file.getOrignlFileNm());
|
||||
dataVO.setInFileName1(file.getStreFileNm());
|
||||
if (StringUtils.isNotBlank(originVO.getInFile1())) {
|
||||
deleteFiles.add("1");
|
||||
}
|
||||
} else if ("fileObj2".equalsIgnoreCase(file.getFileSn())) {
|
||||
dataVO.setInFile2(file.getOrignlFileNm());
|
||||
dataVO.setInFileName2(file.getStreFileNm());
|
||||
if (StringUtils.isNotBlank(originVO.getInFile2())) {
|
||||
deleteFiles.add("2");
|
||||
}
|
||||
} else if ("fileObj3".equalsIgnoreCase(file.getFileSn())) {
|
||||
dataVO.setInFile3(file.getOrignlFileNm());
|
||||
dataVO.setInFileName3(file.getStreFileNm());
|
||||
if (StringUtils.isNotBlank(originVO.getInFile3())) {
|
||||
deleteFiles.add("3");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (deleteFiles.size() > 0) {
|
||||
result = deleteAndRemoveFiles(dataVO, deleteFiles.toArray(new String[deleteFiles.size()]));
|
||||
}
|
||||
|
||||
result = reportFileMapper.insertFile(dataVO);
|
||||
if (result != 0) {
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("cnt", files.size());
|
||||
map.put("fsseq", dataVO.getInFsseq());
|
||||
result = reportFileMapper.updateFileSeq(map);
|
||||
}
|
||||
|
||||
if (result == 0) {
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteAndRemoveFiles(final ReportVO dataVO, final String[] deleteFiles) throws Exception {
|
||||
ReportVO reportVO = reportService.select(dataVO);
|
||||
String fsSeq = String.valueOf(dataVO.getInFsseq());
|
||||
int deletedCnt = 0;
|
||||
|
||||
if (dataVO.getInFsseq() <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (String idx : deleteFiles) {
|
||||
if (idx.equals("1")) {
|
||||
reportVO.setInFile1("");
|
||||
fileUtil.deleteFile(dataVO.getInFile1(), FILE_PATH_KEYWORD, fsSeq);
|
||||
deletedCnt++;
|
||||
}
|
||||
if (idx.equals("2")) {
|
||||
reportVO.setInFile2("");
|
||||
fileUtil.deleteFile(dataVO.getInFile2(), FILE_PATH_KEYWORD, fsSeq);
|
||||
deletedCnt++;
|
||||
}
|
||||
if (idx.equals("3")) {
|
||||
reportVO.setInFile3("");
|
||||
fileUtil.deleteFile(dataVO.getInFile3(), FILE_PATH_KEYWORD, fsSeq);
|
||||
deletedCnt++;
|
||||
}
|
||||
}
|
||||
|
||||
int result = reportFileMapper.updateFile(reportVO);
|
||||
|
||||
if (result > 0) {
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("cnt", (-deletedCnt));
|
||||
map.put("fsseq", fsSeq);
|
||||
result = reportFileMapper.updateFileSeq(map);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int selectFileSeq() throws Exception {
|
||||
int result = 0;
|
||||
|
||||
ReportFileVO rptFileVO = reportFileMapper.selectFileSeq(reportFileMapper.selectMaxFileSeq());
|
||||
int seq = rptFileVO.getFsSeq();
|
||||
int cnt = rptFileVO.getFsFileCount();
|
||||
|
||||
if (seq == 0 || cnt > SEQCNTLIMIT) {
|
||||
seq = reportFileMapper.insertFileSeq();
|
||||
}
|
||||
|
||||
if (seq > 0) {
|
||||
result = seq;
|
||||
} else {
|
||||
throw new Exception();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,166 @@
|
|||
package kcg.imis.report.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import kcg.imis.cmmn.vo.CodeVO;
|
||||
import kcg.imis.member.vo.MemberVO;
|
||||
import kcg.imis.report.vo.ReportJudgeVO;
|
||||
import kcg.imis.report.vo.ReportSearchVO;
|
||||
import kcg.imis.report.vo.ReportVO;
|
||||
|
||||
/**
|
||||
* @FileName : ReportJudgeService.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 29.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
public interface ReportJudgeService {
|
||||
|
||||
/**
|
||||
* 견문 평가 정보를 반환한다.
|
||||
*
|
||||
* @param juseq 견문 평가 시퀀스
|
||||
* @return 견문 평가 객체
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
ReportJudgeVO selectOne(int juseq) throws Exception;
|
||||
|
||||
/**
|
||||
* 평가코드명을 반환한다.
|
||||
*
|
||||
* @param judgeCode 평가코드
|
||||
* @return 평가명
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
String getJudgeStr(int judgeCode) throws Exception;
|
||||
|
||||
/**
|
||||
* 견문 평가를 입력한다.
|
||||
* @param reportJudgeVO 견문 평가 객체
|
||||
* @return 성공 : 1
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
int insert(ReportJudgeVO reportJudgeVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 견문 평가를 수정한다.
|
||||
* @param reportJudgeVO 견문 평가 객체
|
||||
* @return 성공 : 1
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
int update(ReportJudgeVO reportJudgeVO) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* 견문 결재 정보를 반환한다.
|
||||
* @return 견문 결재 정보
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
MemberVO selectApprove() throws Exception;
|
||||
|
||||
/**
|
||||
* 견문을 결재한다.
|
||||
*
|
||||
* @param reportVO 견문 객체
|
||||
* @return 성공:1
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
HashMap<String, Object> approve(ReportVO reportVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 견문 처리 목록 목록을 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 객체
|
||||
* @return 내 실적 조회 목록
|
||||
*/
|
||||
List<ReportVO> selectWaitList(ReportSearchVO reportSearchVO);
|
||||
/**
|
||||
* 견문 처리 목록 전체 목록을 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 객체
|
||||
* @return 내 실적 조회 전체 목록
|
||||
*/
|
||||
List<ReportVO> selectWaitListAll(ReportSearchVO reportSearchVO);
|
||||
/**
|
||||
* 견문 처리 목록 갯수를 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 객체
|
||||
* @return 내 실적 조회 목록 갯수
|
||||
*/
|
||||
int selectWaitListCnt(ReportSearchVO reportSearchVO);
|
||||
|
||||
/**
|
||||
* 견문 처리 목록을 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 객체
|
||||
* @return 견문 처리 목록
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
List<ReportVO> selectApproveList(ReportSearchVO reportSearchVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 견문 처리 목록 갯수를 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 객체
|
||||
* @return 견문 처리 목록 갯수
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
int selectApproveListCnt(final ReportSearchVO reportSearchVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 견문 처리 전체 목록을 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 객체
|
||||
* @return 견문 처리 목록
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
List<ReportVO> selectApproveListAll(ReportSearchVO reportSearchVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 내 실적 조회 목록을 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 객체
|
||||
* @return 견문 처리 목록
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
List<ReportVO> selectMyList(ReportSearchVO reportSearchVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 내 실적 조회 목록 갯수를 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 객체
|
||||
* @return 견문 처리 목록 갯수
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
int selectMyListCnt(final ReportSearchVO reportSearchVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 내 실적 조회 목록을 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 객체
|
||||
* @return 견문 처리 목록
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
List<ReportVO> selectMyListAll(ReportSearchVO reportSearchVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 분야별 통계를 조회한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 객체
|
||||
* @return 분야별통계
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
List<HashMap<String, String>> statsCategory(ReportSearchVO reportSearchVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 평가별 통계를 조회한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 객체
|
||||
* @return 평가별통계
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
List<HashMap<String, String>> statsJudge(ReportSearchVO reportSearchVO) throws Exception;
|
||||
}
|
||||
|
|
@ -0,0 +1,414 @@
|
|||
package kcg.imis.report.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import kcg.imis.member.vo.MemberVO;
|
||||
import kcg.imis.report.mapper.ReportJudgeMapper;
|
||||
import kcg.imis.report.vo.ReportJudgeVO;
|
||||
import kcg.imis.report.vo.ReportSearchVO;
|
||||
import kcg.imis.report.vo.ReportVO;
|
||||
import kcg.imis.report.web.ReportCommon;
|
||||
import kcg.imis.sec.LoginUserVO;
|
||||
import kcg.imis.sec.UserUtil;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||
import egovframework.rte.psl.dataaccess.util.EgovMap;
|
||||
|
||||
/**
|
||||
* @FileName : ReportJudgeServiceImpl.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 29.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
@Service("reportJudgeService")
|
||||
public class ReportJudgeServiceImpl extends EgovAbstractServiceImpl implements ReportJudgeService {
|
||||
|
||||
/**
|
||||
* 견문 관련 인터페이스
|
||||
*/
|
||||
@Resource(name = "reportService")
|
||||
private ReportService reportService;
|
||||
|
||||
/**
|
||||
* 견문 평가 맵퍼
|
||||
*/
|
||||
@Resource(name = "reportJudgeMapper")
|
||||
private ReportJudgeMapper reportJudgeMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 견문 평가 정보를 반환한다.
|
||||
*/
|
||||
@Override
|
||||
public ReportJudgeVO selectOne(final int juseq) throws Exception {
|
||||
return reportJudgeMapper.selectOne(juseq);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getJudgeStr(final int judgeCode) throws Exception {
|
||||
return reportJudgeMapper.getJudgeName(judgeCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(final ReportJudgeVO reportJudgeVO) throws Exception {
|
||||
return reportJudgeMapper.insert(reportJudgeVO);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MemberVO selectApprove() throws Exception {
|
||||
LoginUserVO loginUserVO = UserUtil.getMemberInfo();
|
||||
int myDutiesCode = ReportCommon.getDutiesCodeForApprove(loginUserVO.getDuties());
|
||||
String usrLv = "";
|
||||
if(myDutiesCode == 2 ) usrLv = "4";
|
||||
if(myDutiesCode == 3 ) usrLv = "3";
|
||||
return reportJudgeMapper.selectApprove(usrLv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<String, Object> approve(final ReportVO reportVO) throws Exception {
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
String errorMsg = "";
|
||||
try {
|
||||
List<ReportVO> list = new ArrayList<ReportVO>();
|
||||
if (reportVO.getReportList() == null && reportVO.getInSeq() > 0) {
|
||||
list.add(0, reportVO);
|
||||
} else if (reportVO.getReportList() != null && reportVO.getReportList().size() > 0) {
|
||||
list = reportVO.getReportList();
|
||||
} else {
|
||||
map.put("result", -1);
|
||||
map.put("msg", "결재할 견문이 없습니다.");
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
LoginUserVO loginUserVO = UserUtil.getMemberInfo();
|
||||
int myGroupCode = ReportCommon.getMyGroupCode();
|
||||
int myDutiesCode = ReportCommon.getDutiesCodeForApprove(loginUserVO.getDuties());
|
||||
|
||||
MemberVO reportApproveVO = selectApprove();
|
||||
|
||||
if (myDutiesCode == 2 && reportApproveVO == null) {
|
||||
map.put("result", -1);
|
||||
map.put("msg", "국제법규정보팀장 정보가 없습니다. 권한 설정에서 계장을 선택하십시오.");
|
||||
return map;
|
||||
} else if (reportApproveVO == null && myDutiesCode == 3) {
|
||||
map.put("result", -1);
|
||||
map.put("msg", "국제법규정보담당관 정보가 없습니다. 권한 설정에서 과장을 선택하십시오.");
|
||||
return map;
|
||||
}
|
||||
|
||||
// 견문 평가 객체를 생성한다.
|
||||
ReportJudgeVO reportJudgeVO = new ReportJudgeVO();
|
||||
reportJudgeVO.setJuGroupCode(myGroupCode);
|
||||
reportJudgeVO.setJuPlace1(reportApproveVO.getPlace1Str());
|
||||
reportJudgeVO.setJuPlace2(reportApproveVO.getPlace2Str());
|
||||
reportJudgeVO.setJuDuty(reportApproveVO.getDutyStr());
|
||||
reportJudgeVO.setJuName(reportApproveVO.getName());
|
||||
reportJudgeVO.setJuUserid(reportApproveVO.getUserid());
|
||||
reportJudgeVO.setJuProxyId(loginUserVO.getUserid());
|
||||
reportJudgeVO.setJuDutyCode(String.valueOf(myDutiesCode));
|
||||
|
||||
int cnt = 1;
|
||||
int mgcHead = 0;
|
||||
int mgcSection = 0;
|
||||
ReportVO tempVO = new ReportVO();
|
||||
for (ReportVO vo : list) {
|
||||
if (vo.getInSeq() <= 0) {
|
||||
continue;
|
||||
}
|
||||
tempVO = reportService.select(vo);
|
||||
|
||||
if (StringUtils.isNotBlank(vo.getInStateCode())) {
|
||||
tempVO.setInCategory1(vo.getInCategory1());
|
||||
tempVO.setInCategory2(vo.getInCategory2());
|
||||
tempVO.setInSubject(vo.getInSubject());
|
||||
|
||||
String infoDate = vo.getStrInfodate().toString();
|
||||
tempVO.setInInfoYear(Integer.valueOf(infoDate.split("-")[0]));
|
||||
tempVO.setInInfoMonth(Integer.valueOf(infoDate.split("-")[1]));
|
||||
tempVO.setInInfoDay(Integer.valueOf(infoDate.split("-")[2]));
|
||||
|
||||
tempVO.setInStateCode(vo.getInStateCode());
|
||||
}
|
||||
|
||||
if (vo.getInJudge() > 0) {
|
||||
tempVO.setInJudge(vo.getInJudge());
|
||||
}
|
||||
|
||||
tempVO.setJuMsg(vo.getJuMsg());
|
||||
|
||||
if (tempVO.equals(null)) {
|
||||
errorMsg += String.valueOf(cnt) + "번째 견문은 이미 삭제된 견문입니다.\n";
|
||||
continue;
|
||||
} else {
|
||||
|
||||
mgcHead = tempVO.getInJuseqHead();
|
||||
mgcSection = tempVO.getInJuseqSection();
|
||||
|
||||
|
||||
if (mgcHead > 0 && mgcSection > 0) {
|
||||
errorMsg += String.valueOf(cnt) + "번째 견문은 이미 결재된 견문입니다.\n";
|
||||
continue;
|
||||
}
|
||||
if (myDutiesCode == 2 && mgcSection > 0) {
|
||||
errorMsg += String.valueOf(cnt) + "번째 견문은 이미 결재된 견문입니다.\n";
|
||||
continue;
|
||||
}
|
||||
if (myDutiesCode == 3 && mgcHead > 0) {
|
||||
errorMsg += String.valueOf(cnt) + "번째 견문은 이미 결재된 견문입니다.\n";
|
||||
continue;
|
||||
}
|
||||
}
|
||||
String postState = "";
|
||||
if ((myDutiesCode == 2 && mgcHead > 0) || (myDutiesCode == 3 && mgcSection > 0) || loginUserVO.getAuthProxyHead() > 0) {
|
||||
postState = "4";
|
||||
} else {
|
||||
postState = String.valueOf(myDutiesCode);
|
||||
}
|
||||
|
||||
// 상태코드 설정
|
||||
String newStateCode = String.valueOf(myGroupCode) + postState;
|
||||
|
||||
tempVO.setInStateCode(newStateCode);
|
||||
if (Character.getNumericValue(newStateCode.charAt(1)) == 4) {
|
||||
tempVO.setInComplete("1");
|
||||
}
|
||||
|
||||
// 견문 평가 객체를 생성한다.
|
||||
reportJudgeVO.setJuInseq(vo.getInSeq());
|
||||
reportJudgeVO.setJuJudge(vo.getInJudge());
|
||||
reportJudgeVO.setJuMessage(tempVO.getJuMsg());
|
||||
|
||||
/**
|
||||
* 견문 결제
|
||||
*/
|
||||
int juSeq = insert(reportJudgeVO);
|
||||
|
||||
if (myDutiesCode == 2) {
|
||||
tempVO.setInJuseqSection(juSeq);
|
||||
|
||||
} else {
|
||||
tempVO.setInJudge(vo.getInJudge());
|
||||
tempVO.setInJuseqHead(juSeq);
|
||||
}
|
||||
|
||||
HashMap<String, Object> result = reportService.update(tempVO, null, null);
|
||||
|
||||
if (Integer.parseInt(result.get("result").toString()) > 0) {
|
||||
errorMsg = "";
|
||||
}
|
||||
|
||||
cnt++;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
map.put("msg", errorMsg);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(final ReportJudgeVO reportJudgeVO) throws Exception {
|
||||
return reportJudgeMapper.update(reportJudgeVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ReportVO> selectWaitList(final ReportSearchVO reportSearchVO) {
|
||||
return reportJudgeMapper.selectWaitList(reportSearchVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ReportVO> selectWaitListAll(final ReportSearchVO reportSearchVO) {
|
||||
return reportJudgeMapper.selectWaitListAll(reportSearchVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int selectWaitListCnt(final ReportSearchVO reportSearchVO) {
|
||||
return reportJudgeMapper.selectWaitListCnt(reportSearchVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ReportVO> selectApproveList(final ReportSearchVO reportSearchVO) throws Exception {
|
||||
return reportJudgeMapper.selectApproveList(reportSearchVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int selectApproveListCnt(final ReportSearchVO reportSearchVO) throws Exception {
|
||||
return reportJudgeMapper.selectApproveListCnt(reportSearchVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ReportVO> selectApproveListAll(final ReportSearchVO reportSearchVO) throws Exception {
|
||||
return reportJudgeMapper.selectApproveListAll(reportSearchVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ReportVO> selectMyList(final ReportSearchVO reportSearchVO) throws Exception {
|
||||
return reportJudgeMapper.selectMyList(reportSearchVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int selectMyListCnt(final ReportSearchVO reportSearchVO) throws Exception {
|
||||
return reportJudgeMapper.selectMyListCnt(reportSearchVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ReportVO> selectMyListAll(final ReportSearchVO reportSearchVO) throws Exception {
|
||||
return reportJudgeMapper.selectMyListAll(reportSearchVO);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<HashMap<String, String>> statsCategory(ReportSearchVO reportSearchVO) throws Exception {
|
||||
reportSearchVO.setCategoryType(1);
|
||||
List<HashMap<String, String>> cateList1 = reportJudgeMapper.statsCategory(reportSearchVO);
|
||||
reportSearchVO.setCategoryType(2);
|
||||
List<HashMap<String, String>> cateList2= reportJudgeMapper.statsCategory(reportSearchVO);
|
||||
List<HashMap<String, String>> placeList= reportJudgeMapper.selectPlace(reportSearchVO);
|
||||
|
||||
for(HashMap<String, String> place : placeList){
|
||||
String name = (String)place.get("PLACE");
|
||||
for(HashMap<String, String> cateMap : cateList1){
|
||||
if(name.equals((String)cateMap.get("IN_PLACE"))){
|
||||
place.put(cateMap.get("IN_CATEGORY1") + "_1", String.valueOf(cateMap.get("CNT")));
|
||||
}
|
||||
}
|
||||
|
||||
for(HashMap<String, String> cateMap : cateList2){
|
||||
if(name.equals((String)cateMap.get("IN_PLACE"))){
|
||||
place.put(cateMap.get("IN_CATEGORY2") + "_2", String.valueOf(cateMap.get("CNT")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(HashMap<String, String> place : placeList) {
|
||||
int total = 0;
|
||||
for (String mapKey : place.keySet()) {
|
||||
if(!"PLACE_NAME".equals(mapKey) && !"PLACE".equals(mapKey)){
|
||||
total += Integer.parseInt(place.get(mapKey)); }
|
||||
}
|
||||
place.put("TOTAL", String.valueOf(total));
|
||||
}
|
||||
|
||||
for(HashMap<String, String> place : placeList) {
|
||||
for(String cate : reportSearchVO.getCategory1()){
|
||||
String key = cate + "_1";
|
||||
if(place.get(key) == null){
|
||||
place.put(key, "0");
|
||||
}
|
||||
}
|
||||
for(String cate : reportSearchVO.getCategory2()){
|
||||
if(place.get(cate + "_2") == null){
|
||||
place.put(cate + "_2", "0");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (placeList.size() > 0) {
|
||||
HashMap<String, String> totalMap = new HashMap<String, String>();
|
||||
totalMap.put("PLACE_NAME", "누계");
|
||||
|
||||
for (String key : placeList.get(0).keySet()) {
|
||||
if (key.equals("PLACE_NAME") || key.equals("PLACE")) {
|
||||
continue;
|
||||
}
|
||||
int tt = 0;
|
||||
for (HashMap<String, String> hashMap : placeList) {
|
||||
tt = tt + Integer.parseInt(hashMap.get(key));
|
||||
}
|
||||
totalMap.put(key, String.valueOf(tt));
|
||||
}
|
||||
|
||||
placeList.add(placeList.size(), totalMap);
|
||||
}
|
||||
|
||||
return placeList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<HashMap<String, String>> statsJudge(final ReportSearchVO reportSearchVO) throws Exception {
|
||||
reportSearchVO.setCategoryType(3);
|
||||
List<HashMap<String, String>> cateList1 = reportJudgeMapper.statsCategory(reportSearchVO);
|
||||
|
||||
List<HashMap<String, String>> placeList= reportJudgeMapper.selectPlace(reportSearchVO);
|
||||
|
||||
for(HashMap<String, String> place : placeList){
|
||||
String name = (String)place.get("PLACE");
|
||||
for(HashMap<String, String> cateMap : cateList1){
|
||||
if(name.equals((String)cateMap.get("IN_PLACE"))){
|
||||
place.put("C0" + String.valueOf(cateMap.get("IN_JUDGE")), String.valueOf(cateMap.get("CNT")));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
for(HashMap<String, String> place : placeList) {
|
||||
int total = 0;
|
||||
for (String mapKey : place.keySet()) {
|
||||
if(!"PLACE_NAME".equals(mapKey) && !"PLACE".equals(mapKey)){
|
||||
total += Integer.parseInt(place.get(mapKey)); }
|
||||
}
|
||||
place.put("TOTAL", String.valueOf(total));
|
||||
}
|
||||
for(HashMap<String, String> place : placeList) {
|
||||
for(String cate : reportSearchVO.getJudges()){
|
||||
String key = "C" + cate;
|
||||
if(place.get(key) == null){
|
||||
place.put(key, "0");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(HashMap<String, String> place : placeList) {
|
||||
int ju1 = Integer.parseInt(place.get("C01"));
|
||||
int ju2 = Integer.parseInt(place.get("C02"));
|
||||
int ju3 = Integer.parseInt(place.get("C03"));
|
||||
int ju4 = Integer.parseInt(place.get("C04"));
|
||||
int ju5 = Integer.parseInt(place.get("C05"));
|
||||
int ju6 = Integer.parseInt(place.get("C06"));
|
||||
int ju7 = Integer.parseInt(place.get("C07"));
|
||||
|
||||
place.put("AG", String.valueOf(ju1 + ju2));
|
||||
place.put("BG", String.valueOf(ju3 + ju4));
|
||||
place.put("CG", String.valueOf(ju5 + ju6));
|
||||
place.put("DG", String.valueOf(ju7));
|
||||
}
|
||||
|
||||
if (placeList.size() > 0) {
|
||||
HashMap<String, String> totalMap = new HashMap<String, String>();
|
||||
totalMap.put("PLACE_NAME", "누계");
|
||||
|
||||
for (String key : placeList.get(0).keySet()) {
|
||||
if (key.equals("PLACE_NAME") || key.equals("PLACE")) {
|
||||
continue;
|
||||
}
|
||||
int tt = 0;
|
||||
for (HashMap<String, String> hashMap : placeList) {
|
||||
tt = tt + Integer.parseInt(hashMap.get(key));
|
||||
}
|
||||
totalMap.put(key, String.valueOf(tt));
|
||||
}
|
||||
|
||||
placeList.add(placeList.size(), totalMap);
|
||||
}
|
||||
|
||||
return placeList;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,140 @@
|
|||
package kcg.imis.report.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import kcg.imis.cmmn.bbs.BaseBbsService;
|
||||
import kcg.imis.report.vo.ReportGoalVO;
|
||||
import kcg.imis.report.vo.ReportSearchVO;
|
||||
import kcg.imis.report.vo.ReportVO;
|
||||
|
||||
/**
|
||||
* @FileName : ReportService.java
|
||||
* @Project : 국제해양프로젝트
|
||||
* @Date : 2018. 3. 29.
|
||||
* @작성자 : Moon
|
||||
* @변경이력 :
|
||||
* @프로그램 설명 :
|
||||
*/
|
||||
public interface ReportService extends BaseBbsService<ReportSearchVO, ReportVO> {
|
||||
|
||||
/**
|
||||
* 견문의 새 소속번호를 반환한다.
|
||||
*
|
||||
* @param reportVO 견문정보
|
||||
* @return 소속번호
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
int selectPlaceNum(ReportVO reportVO);
|
||||
|
||||
/**
|
||||
* 견문의 임시저장목록을 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색조건 vo
|
||||
* @return 견문 임시저장목록
|
||||
*/
|
||||
List<ReportVO> selectSaveList(ReportSearchVO reportSearchVO);
|
||||
|
||||
/**
|
||||
* 견문 임시저장목록 결과 갯수를 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색조건 vo
|
||||
* @return 견문 임시저장목록 개숫
|
||||
*/
|
||||
int selectSaveListCnt(ReportSearchVO reportSearchVO);
|
||||
|
||||
/**
|
||||
* 선택된 견문을 삭제한다.
|
||||
*
|
||||
* @param selectedSeq 선택된 견문 시퀀스 리스트
|
||||
* @return 성공-1,실패-0
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
int deleteSelected(String[] selectedSeq) throws Exception;
|
||||
|
||||
/**
|
||||
* 견문제출현황 목록을 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 조건 객체
|
||||
* @return 견문제출현황 목록
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
List<ReportVO> selectPresentList(ReportSearchVO reportSearchVO) throws Exception;
|
||||
/**
|
||||
* 견문제출현황 목록 갯수를 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 조건 객체
|
||||
* @return 견문제출현황 목록갯수
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
int selectPresentListCnt(ReportSearchVO reportSearchVO) throws Exception;
|
||||
/**
|
||||
* 견문제출현황 전체목록을 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 조건 객체
|
||||
* @return 견문제출현황 전체목록
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
List<ReportVO> selectPresentListAll(ReportSearchVO reportSearchVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 평가기록부를 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 조건 객체
|
||||
* @return 평가기록부 목록
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
List<ReportVO> selectRecordList(ReportSearchVO reportSearchVO) throws Exception;
|
||||
/**
|
||||
* 평가기록부 목록 갯수를 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 조건 객체
|
||||
* @return 평가기록부 목록갯수
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
int selectRecordListCnt(ReportSearchVO reportSearchVO) throws Exception;
|
||||
/**
|
||||
* 평가기록부 전체목록을 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 조건 객체
|
||||
* @return 평가기록부 전체목록
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
List<ReportVO> selectRecordListAll(ReportSearchVO reportSearchVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 목표 관리 목록을 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색 객체
|
||||
* @return 목표 관리
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
List<ReportGoalVO> selectGoalList(ReportSearchVO reportSearchVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 목표를 입력하고 수정한다.
|
||||
*
|
||||
* @param reportGoalVO 입력 및 수정 작업을 할 목표 객체 목록
|
||||
* @return 성공:1, 실패:0
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
int updateGoal(ReportGoalVO reportGoalVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 사용자별 목표 통계를 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색객체
|
||||
* @return 목표 통계
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
List<HashMap<String, Object>> getGoalStats(final ReportSearchVO reportSearchVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 소속별 목표 통계를 반환한다.
|
||||
*
|
||||
* @param reportSearchVO 견문 검색객체
|
||||
* @return 목표 통계
|
||||
* @throws Exception 기본예외처리
|
||||
*/
|
||||
List<HashMap<String, Object>> getGoalStatsPlace(final ReportSearchVO reportSearchVO) throws Exception;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue