svn에서 옮김.

master
강석 최 2022-03-17 11:34:44 +09:00
parent d23b7969f9
commit e50392877b
1426 changed files with 124125 additions and 0 deletions

7
.checkstyle Normal file
View File

@ -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>

1
.gitignore vendored
View File

@ -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

1258
.pmd Normal file

File diff suppressed because it is too large Load Diff

440
pom.xml Normal file
View File

@ -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>

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -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();
}
}
}
}

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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";
}
}

View File

@ -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";
}

View File

@ -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;
}
}

View File

@ -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>&#160;";
previousPageLabel = "<a href=\"#\" onclick=\"{0}({1}); return false;\">" + "<image src='" + servletContext.getContextPath() + "/images/cmmn/btn_page_pre1.gif' border=0/></a>&#160;";
currentPageLabel = "<strong>{0}</strong>&#160;";
otherPageLabel = "<a href=\"#\" onclick=\"{0}({1}); return false;\">{2}</a>&#160;";
nextPageLabel = "<a href=\"#\" onclick=\"{0}({1}); return false;\">" + "<image src='" + servletContext.getContextPath() + "/images/cmmn/btn_page_next1.gif' border=0/></a>&#160;";
lastPageLabel = "<a href=\"#\" onclick=\"{0}({1}); return false;\">" + "<image src='" + servletContext.getContextPath() + "/images/cmmn/btn_page_next10.gif' border=0/></a>&#160;";
}
@Override
public void setServletContext(ServletContext servletContext) {
this.servletContext = servletContext;
initVariables();
}
}

View File

@ -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";
}

View File

@ -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());
}
}
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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
}

View File

@ -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
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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!!");
}
}
}
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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);
}
}
}

View File

@ -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;
}
}

View File

@ -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 = &lt;time_low&gt; &quot;-&quot; &lt;time_mid&gt; &quot;-&quot;
* &lt;time_high_and_version&gt; &quot;-&quot;
* &lt;variant_and_sequence&gt; &quot;-&quot;
* &lt;node&gt;
* time_low = 4*&lt;hexOctet&gt;
* time_mid = 2*&lt;hexOctet&gt;
* time_high_and_version = 2*&lt;hexOctet&gt;
* variant_and_sequence = 2*&lt;hexOctet&gt;
* node = 6*&lt;hexOctet&gt;
* hexOctet = &lt;hexDigit&gt;&lt;hexDigit&gt;
* hexDigit =
* &quot;0&quot; | &quot;1&quot; | &quot;2&quot; | &quot;3&quot; | &quot;4&quot; | &quot;5&quot; | &quot;6&quot; | &quot;7&quot; | &quot;8&quot; | &quot;9&quot;
* | &quot;a&quot; | &quot;b&quot; | &quot;c&quot; | &quot;d&quot; | &quot;e&quot; | &quot;f&quot;
* | &quot;A&quot; | &quot;B&quot; | &quot;C&quot; | &quot;D&quot; | &quot;E&quot; | &quot;F&quot;
* </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;
}
}

View File

@ -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() {
}
}

View File

@ -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("&lt;");
break;
case '>':
strBuff.append("&gt;");
break;
//case '&':
//strBuff.append("&amp;");
//break;
case '"':
strBuff.append("&quot;");
break;
case '\'':
strBuff.append("&apos;");
break;
default:
strBuff.append(c);
break;
}
}
values[i] = strBuff.toString();
} else {
values[i] = null;
}
}
return values;
}
public String getParameter(String parameter) {
String value = super.getParameter(parameter);
if(value==null){
return null;
}
StringBuffer strBuff = new StringBuffer();
for (int i = 0; i < value.length(); i++) {
char c = value.charAt(i);
switch (c) {
case '<':
strBuff.append("&lt;");
break;
case '>':
strBuff.append("&gt;");
break;
case '&':
strBuff.append("&amp;");
break;
case '"':
strBuff.append("&quot;");
break;
case '\'':
strBuff.append("&apos;");
break;
default:
strBuff.append(c);
break;
}
}
value = strBuff.toString();
return value;
}
}

View File

@ -0,0 +1,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);
}
}

View File

@ -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&quot;);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS"; BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.io.UnsupportedEncodingException;
import java.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 &quot;&quot; .
* &#064;param src null String .
* &#064;return String null &quot;&quot; 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 &quot;&quot; .
* &#064;param src null String .
* &#064;return String null &quot;&quot; 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 &quot;0&quot; .
* &#064;param src null String .
* &#064;return String null &quot;0&quot; 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 &quot;&quot; .
* &#064;param src null String .
* &#064;return String null &quot;&quot; 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("&lt;");
break;
case '>':
strTxt.append("&gt;");
break;
case '"':
strTxt.append("&quot;");
break;
case 10:
strTxt.append("<br>");
break;
case ' ':
strTxt.append("&nbsp;");
break;
//case '&' :
//strTxt.append("&amp;");
//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 ('<' -> "&lt"
* @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("&lt;");
break;
case '>':
strTxt.append("&gt;");
break;
case '&':
strTxt.append("&amp;");
break;
default:
strTxt.append(chrBuff);
}
}
rtnStr = strTxt.toString();
} catch (Exception e) {
LOGGER.debug("{}", e);
}
return rtnStr;
}
/**
* 17TIMESTAMP
*
* @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("&lt;", "<");
tmpString = tmpString.replaceAll("&gt;", ">");
tmpString = tmpString.replaceAll("&amp;", "&");
tmpString = tmpString.replaceAll("&nbsp;", " ");
tmpString = tmpString.replaceAll("&apos;", "\'");
tmpString = tmpString.replaceAll("&quot;", "\"");
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 "";
}
}

View File

@ -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("&", "&amp;");
returnValue = returnValue.replaceAll("<", "&lt;");
returnValue = returnValue.replaceAll(">", "&gt;");
returnValue = returnValue.replaceAll("\"", "&#34;");
returnValue = returnValue.replaceAll("\'", "&#39;");
returnValue = returnValue.replaceAll("[.]", "&#46;");
returnValue = returnValue.replaceAll("%2E", "&#46;");
returnValue = returnValue.replaceAll("%2F", "&#47;");
return returnValue;
}
public static String clearXSSMaximum(String value) {
String returnValue = value;
returnValue = clearXSSMinimum(returnValue);
returnValue = returnValue.replaceAll("%00", null);
returnValue = returnValue.replaceAll("%", "&#37;");
// \\. => .
returnValue = returnValue.replaceAll("\\.\\./", ""); // ../
returnValue = returnValue.replaceAll("\\.\\.\\\\", ""); // ..\
returnValue = returnValue.replaceAll("\\./", ""); // ./
returnValue = returnValue.replaceAll("%2F", "");
return returnValue;
}
public static String filePathBlackList(String value) {
String returnValue = value;
if (returnValue == null || returnValue.trim().equals("")) {
return "";
}
returnValue = returnValue.replaceAll("\\.\\./", ""); // ../
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(";", "");
}
}

View File

@ -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 + "]";
}
}

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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;
}
}

View File

@ -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("#,###"));
}
}

View File

@ -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");
}
}
}

View File

@ -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();
}
}
}

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -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("");
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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);
}
}

View File

@ -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();
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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";
}
}

View File

@ -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();
}
}
}

View File

@ -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";
}
}

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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);
}
}

View File

@ -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() {
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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() {
}
}

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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);
}*/
}

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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();
}
}

View File

@ -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");
}
}

View File

@ -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;
}

View File

@ -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();
};
}

View File

@ -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 {
}

View File

@ -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;
}
}

View File

@ -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";
}
}

View File

@ -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();
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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