프로젝트 생성
commit
f3a8229fda
|
|
@ -0,0 +1,38 @@
|
|||
HELP.md
|
||||
.gradle
|
||||
build/
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
bin/
|
||||
!**/src/main/**/bin/
|
||||
!**/src/test/**/bin/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
out/
|
||||
!**/src/main/**/out/
|
||||
!**/src/test/**/out/
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
.vs/
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#해양경찰청 외사종합포털
|
||||
|
||||
java 11
|
||||
postgreSql 14.2
|
||||
|
||||
springboot 2.7.2
|
||||
thymeleaf 3.0.15
|
||||
bootstrap 5.2.0
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
plugins {
|
||||
id 'org.springframework.boot' version '2.7.2'
|
||||
id 'io.spring.dependency-management' version '1.0.12.RELEASE'
|
||||
id 'java'
|
||||
}
|
||||
|
||||
group = 'com.dbnt'
|
||||
version = '0.0.1-SNAPSHOT'
|
||||
sourceCompatibility = '11'
|
||||
|
||||
configurations {
|
||||
compileOnly {
|
||||
extendsFrom annotationProcessor
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly 'org.projectlombok:lombok:1.18.24'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-actuator:2.7.2'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-data-jpa:2.7.2'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-security:2.7.2'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf:2.7.2'
|
||||
implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:3.1.0'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-web:2.7.2'
|
||||
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2'
|
||||
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5:3.0.4.RELEASE'
|
||||
implementation 'org.bgee.log4jdbc-log4j2:log4jdbc-log4j2-jdbc4.1:1.16'
|
||||
//엑셀다운
|
||||
implementation 'org.apache.poi:poi:4.1.0'
|
||||
implementation 'org.apache.poi:poi-ooxml:4.1.0'
|
||||
|
||||
developmentOnly 'org.springframework.boot:spring-boot-devtools:2.7.2'
|
||||
runtimeOnly 'org.postgresql:postgresql:42.3.6'
|
||||
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor:2.7.2'
|
||||
annotationProcessor 'org.projectlombok:lombok:1.18.24'
|
||||
}
|
||||
Binary file not shown.
|
|
@ -0,0 +1,5 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
@ -0,0 +1,240 @@
|
|||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original 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
|
||||
#
|
||||
# https://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.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=${0##*/}
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
|
|
@ -0,0 +1 @@
|
|||
rootProject.name = 'faisp'
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.dbnt.faisp;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class FaispApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(FaispApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package com.dbnt.faisp.authMgt;
|
||||
|
||||
import com.dbnt.faisp.authMgt.service.AuthMgtService;
|
||||
import com.dbnt.faisp.authMgt.model.AuthMgt;
|
||||
import com.dbnt.faisp.userInfo.service.UserInfoService;
|
||||
import com.dbnt.faisp.userInfo.model.UserInfo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/authMgt")
|
||||
public class AuthMgtController {
|
||||
|
||||
private final UserInfoService userInfoService;
|
||||
private final AuthMgtService authMgtService;
|
||||
|
||||
@GetMapping("/authMgtPage")
|
||||
public ModelAndView authMgtPage(UserInfo userInfo) {
|
||||
ModelAndView mav = new ModelAndView("adminPage/authMgt/authMgt");
|
||||
userInfo.setQueryInfo();
|
||||
mav.addObject("userInfoList", userInfoService.selectUserInfoList(userInfo));
|
||||
userInfo.setContentCnt(userInfoService.selectUserInfoListCnt(userInfo));
|
||||
userInfo.setPaginationInfo();
|
||||
mav.addObject("searchParams", userInfo);
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/authEditModal")
|
||||
public ModelAndView menuEditModal(UserInfo userInfo){
|
||||
ModelAndView mav = new ModelAndView("adminPage/authMgt/authEditModal");
|
||||
userInfo.setAccessConfigList(authMgtService.selectAccessConfigList(userInfo.getUserSeq(), null));
|
||||
userInfo.setApprovalConfigList(authMgtService.selectApprovalConfigList(userInfo.getUserSeq(), null));
|
||||
mav.addObject("userInfo", userInfo);
|
||||
return mav;
|
||||
}
|
||||
|
||||
@PostMapping("/saveAuth")
|
||||
public String saveAuth(@RequestBody AuthMgt authMgt){
|
||||
authMgtService.saveAuth(authMgt);
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.dbnt.faisp.authMgt.mapper;
|
||||
|
||||
import com.dbnt.faisp.authMgt.model.AccessConfig;
|
||||
import com.dbnt.faisp.authMgt.model.ApprovalConfig;
|
||||
import com.dbnt.faisp.userInfo.model.UserInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface AuthMgtMapper {
|
||||
|
||||
List<AccessConfig> selectAccessConfigList(Map<String, Object> params);
|
||||
|
||||
List<ApprovalConfig> selectApprovalConfigList(Map<String, Object> params);
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package com.dbnt.faisp.authMgt.model;
|
||||
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "access_config")
|
||||
@IdClass(AccessConfig.AccessConfigId.class)
|
||||
public class AccessConfig{
|
||||
@Id
|
||||
@Column(name = "menu_key")
|
||||
private Integer menuKey;
|
||||
@Id
|
||||
@Column(name = "user_seq")
|
||||
private Integer userSeq;
|
||||
@Column(name = "access_auth")
|
||||
private String accessAuth;
|
||||
|
||||
@Transient
|
||||
private String cat1Cd;
|
||||
@Transient
|
||||
private String cat2Cd;
|
||||
@Transient
|
||||
private String cat3Cd;
|
||||
|
||||
@Embeddable
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class AccessConfigId implements Serializable {
|
||||
private Integer menuKey;
|
||||
private Integer userSeq;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package com.dbnt.faisp.authMgt.model;
|
||||
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "approval_config")
|
||||
@IdClass(ApprovalConfig.ApprovalConfigId.class)
|
||||
public class ApprovalConfig {
|
||||
@Id
|
||||
@Column(name = "menu_key")
|
||||
private Integer menuKey;
|
||||
@Id
|
||||
@Column(name = "user_seq")
|
||||
private Integer userSeq;
|
||||
@Column(name = "approval_auth")
|
||||
private String approvalAuth;
|
||||
|
||||
@Transient
|
||||
private String cat1Cd;
|
||||
@Transient
|
||||
private String cat2Cd;
|
||||
@Transient
|
||||
private String cat3Cd;
|
||||
|
||||
@Embeddable
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class ApprovalConfigId implements Serializable {
|
||||
private Integer menuKey;
|
||||
private Integer userSeq;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.dbnt.faisp.authMgt.model;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class AuthMgt {
|
||||
List<AccessConfig> accessConfigList;
|
||||
List<ApprovalConfig> approvalConfigList;
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.dbnt.faisp.authMgt.repository;
|
||||
|
||||
import com.dbnt.faisp.authMgt.model.AccessConfig;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
|
||||
public interface AccessConfigRepository extends JpaRepository<AccessConfig, AccessConfig.AccessConfigId> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.dbnt.faisp.authMgt.repository;
|
||||
|
||||
import com.dbnt.faisp.authMgt.model.ApprovalConfig;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
|
||||
public interface ApprovalConfigRepository extends JpaRepository<ApprovalConfig, ApprovalConfig.ApprovalConfigId> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package com.dbnt.faisp.authMgt.service;
|
||||
|
||||
import com.dbnt.faisp.authMgt.mapper.AuthMgtMapper;
|
||||
import com.dbnt.faisp.authMgt.model.AccessConfig;
|
||||
import com.dbnt.faisp.authMgt.model.ApprovalConfig;
|
||||
import com.dbnt.faisp.authMgt.model.AuthMgt;
|
||||
import com.dbnt.faisp.authMgt.repository.AccessConfigRepository;
|
||||
import com.dbnt.faisp.authMgt.repository.ApprovalConfigRepository;
|
||||
import com.dbnt.faisp.userInfo.model.UserInfo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AuthMgtService {
|
||||
private final AuthMgtMapper authMgtMapper;
|
||||
private final AccessConfigRepository accessConfigRepository;
|
||||
private final ApprovalConfigRepository approvalConfigRepository;
|
||||
|
||||
public List<AccessConfig> selectAccessConfigList(Integer userSeq, String url) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("userSeq", userSeq);
|
||||
params.put("menuUrl", url);
|
||||
return authMgtMapper.selectAccessConfigList(params);
|
||||
}
|
||||
|
||||
public List<ApprovalConfig> selectApprovalConfigList(Integer userSeq, String url) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("userSeq", userSeq);
|
||||
params.put("menuUrl", url);
|
||||
return authMgtMapper.selectApprovalConfigList(params);
|
||||
}
|
||||
|
||||
public void saveAuth(AuthMgt authMgt) {
|
||||
accessConfigRepository.saveAll(authMgt.getAccessConfigList());
|
||||
approvalConfigRepository.saveAll(authMgt.getApprovalConfigList());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.dbnt.faisp.codeMgt;
|
||||
|
||||
import com.dbnt.faisp.codeMgt.model.CodeCatg;
|
||||
import com.dbnt.faisp.codeMgt.service.CodeMgtService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/codeMgt")
|
||||
public class CodeMgtController {
|
||||
|
||||
private final CodeMgtService codeMgtService;
|
||||
|
||||
@GetMapping("/codeMgtPage")
|
||||
public ModelAndView codeMgtPage() {
|
||||
ModelAndView mav = new ModelAndView("adminPage/codeMgt/codeMgt");
|
||||
return mav;
|
||||
}
|
||||
|
||||
@PostMapping("/saveCode")
|
||||
@ResponseBody
|
||||
public String saveCode(@RequestBody List<CodeCatg> codeCategoryList){
|
||||
codeMgtService.saveCode(codeCategoryList);
|
||||
return "";
|
||||
}
|
||||
|
||||
@GetMapping("/selectCodeCatgList")
|
||||
public List<CodeCatg> selectCodeCatgList(){
|
||||
return codeMgtService.selectCodeCatgAndChild();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.dbnt.faisp.codeMgt.model;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "code_catg")
|
||||
public class CodeCatg {
|
||||
@Id
|
||||
@Column(name = "category_cd")
|
||||
private String categoryCd;
|
||||
@Column(name = "category_value", nullable = false)
|
||||
private String categoryValue;
|
||||
@Column(name = "description")
|
||||
private String description;
|
||||
|
||||
@Transient
|
||||
private String status;
|
||||
@Transient
|
||||
private List<CodeMgt> itemList;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.dbnt.faisp.codeMgt.model;
|
||||
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "code_mgt")
|
||||
@IdClass(CodeMgt.CodeMgtId.class)
|
||||
public class CodeMgt {
|
||||
@Id
|
||||
@Column(name = "category_cd")
|
||||
private String categoryCd;
|
||||
@Id
|
||||
@Column(name = "item_cd")
|
||||
private String itemCd;
|
||||
@Column(name = "item_value", nullable = false)
|
||||
private String itemValue;
|
||||
@Column(name = "use_chk")
|
||||
private String useChk;
|
||||
|
||||
@Transient
|
||||
private String status;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CodeMgt [categoryCd=" + categoryCd + ", itemCd=" + itemCd + ", itemValue=" + itemValue + ", useChk="
|
||||
+ useChk + ", status=" + status + "]";
|
||||
}
|
||||
|
||||
@Embeddable
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class CodeMgtId implements Serializable {
|
||||
private String categoryCd;
|
||||
private String itemCd;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.dbnt.faisp.codeMgt.repository;
|
||||
|
||||
import com.dbnt.faisp.codeMgt.model.CodeCatg;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
|
||||
public interface CodeCatgRepository extends JpaRepository<CodeCatg, String> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.dbnt.faisp.codeMgt.repository;
|
||||
|
||||
import com.dbnt.faisp.codeMgt.model.CodeMgt;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface CodeMgtRepository extends JpaRepository<CodeMgt, CodeMgt.CodeMgtId> {
|
||||
|
||||
List<CodeMgt> findByCategoryCdOrderByItemCdAsc(String categoryCd);
|
||||
List<CodeMgt> findByCategoryCdAndUseChkOrderByItemCdAsc(String categoryCd, String useChk);
|
||||
List<CodeMgt> findByUseChkOrderByItemCdAsc(String useChk);
|
||||
List<CodeMgt> findByOrderByItemCdAsc();
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
package com.dbnt.faisp.codeMgt.service;
|
||||
|
||||
import com.dbnt.faisp.codeMgt.model.CodeCatg;
|
||||
import com.dbnt.faisp.codeMgt.model.CodeMgt;
|
||||
import com.dbnt.faisp.codeMgt.repository.CodeCatgRepository;
|
||||
import com.dbnt.faisp.codeMgt.repository.CodeMgtRepository;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CodeMgtService{
|
||||
|
||||
private final CodeMgtRepository codeMgtRepository;
|
||||
private final CodeCatgRepository codeCatgRepository;
|
||||
|
||||
@Transactional
|
||||
public String saveCode(List<CodeCatg> codeMgtList){
|
||||
for(CodeCatg codeCatg: codeMgtList){
|
||||
codeCatgRepository.save(codeCatg);
|
||||
if (codeCatg.getItemList().size()>0){
|
||||
codeItemSave(codeCatg.getItemList());
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private void codeItemSave(List<CodeMgt> itemList){
|
||||
codeMgtRepository.saveAll(itemList);
|
||||
}
|
||||
|
||||
public List<CodeCatg> selectCodeCatgAndChild() {
|
||||
List<CodeCatg> codeCatgList = codeCatgRepository.findAll();
|
||||
for(CodeCatg codeCatg: codeCatgList){
|
||||
codeCatg.setItemList(codeMgtRepository.findByCategoryCdOrderByItemCdAsc(codeCatg.getCategoryCd()));
|
||||
}
|
||||
return codeCatgList;
|
||||
}
|
||||
|
||||
public Map<String, List<CodeMgt>> getCommonCode() {
|
||||
//return codeMgtRepository.findByUseChkOrderByItemCdAsc("T");
|
||||
List<CodeCatg> categoryList = codeCatgRepository.findAll();
|
||||
List<CodeMgt> codeList = codeMgtRepository.findByOrderByItemCdAsc();
|
||||
Map<String, List<CodeMgt>> categoryMap = new HashMap<>();
|
||||
for(CodeCatg category: categoryList){
|
||||
List<CodeMgt> childList = new ArrayList<>();
|
||||
for(CodeMgt code: codeList){
|
||||
if(code.getCategoryCd().equals(category.getCategoryCd())){
|
||||
childList.add(code);
|
||||
}
|
||||
}
|
||||
categoryMap.put(category.getCategoryCd(), childList);
|
||||
}
|
||||
return categoryMap;
|
||||
}
|
||||
|
||||
public List<CodeMgt> selectCodeMgtList(String categoryCd) {
|
||||
return codeMgtRepository.findByCategoryCdAndUseChkOrderByItemCdAsc(categoryCd, "T");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
package com.dbnt.faisp.config;
|
||||
|
||||
import com.dbnt.faisp.menuMgt.service.MenuMgtService;
|
||||
import com.dbnt.faisp.organMgt.service.OrganConfigService;
|
||||
import com.dbnt.faisp.userInfo.model.UserInfo;
|
||||
import com.dbnt.faisp.codeMgt.service.CodeMgtService;
|
||||
|
||||
import com.dbnt.faisp.userInfo.service.UserInfoService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class BaseController {
|
||||
|
||||
private final CodeMgtService codeMgtService;
|
||||
private final OrganConfigService organConfigService;
|
||||
private final MenuMgtService menuMgtService;
|
||||
private final UserInfoService userInfoService;
|
||||
|
||||
@GetMapping("/")
|
||||
public ModelAndView loginCheck(@AuthenticationPrincipal UserInfo loginUser) {
|
||||
ModelAndView mav = null;
|
||||
if(loginUser == null){
|
||||
mav = new ModelAndView("redirect:/login");
|
||||
}else{
|
||||
mav = new ModelAndView("redirect:/dashboard");
|
||||
}
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/login")
|
||||
public ModelAndView goLogin() {
|
||||
ModelAndView mav = new ModelAndView("login/login");
|
||||
mav.addObject("OgList", codeMgtService.selectCodeMgtList("OG"));
|
||||
mav.addObject("OfcList", codeMgtService.selectCodeMgtList("OFC"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/login-error")
|
||||
public ModelAndView loginError() {
|
||||
ModelAndView mav = new ModelAndView("login/login");
|
||||
mav.addObject("OgList", codeMgtService.selectCodeMgtList("OG"));
|
||||
mav.addObject("OfcList", codeMgtService.selectCodeMgtList("OFC"));
|
||||
mav.addObject("loginError", true);
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/denied")
|
||||
public ModelAndView doDenied() {
|
||||
ModelAndView mav = new ModelAndView("login/denied");
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/dashboard")
|
||||
public ModelAndView dashboard() {
|
||||
ModelAndView mav = new ModelAndView("login/dashboard");
|
||||
return mav;
|
||||
}
|
||||
|
||||
public void setSession(@AuthenticationPrincipal UserInfo loginUser, HttpSession session){
|
||||
loginUser.setDownOrganCdList(organConfigService.selectDownOrganListWhereUserOgCd(loginUser.getOgCd()));
|
||||
loginUser.setUpOrganCdList(organConfigService.selectUpOrganListWhereUserOgCd(loginUser.getOgCd()));
|
||||
session.setAttribute("menuList", menuMgtService.selectAccessMenuListWhereUserSeq(loginUser.getUserSeq()));
|
||||
session.setAttribute("commonCode", codeMgtService.getCommonCode());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
package com.dbnt.faisp.config;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.Transient;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class BaseModel {
|
||||
@Transient
|
||||
private List<String> upOrganCdList;
|
||||
@Transient
|
||||
private List<String> downOrganCdList;
|
||||
@Transient
|
||||
private Integer pageIndex=1; //요청페이지
|
||||
@Transient
|
||||
private Integer firstIndex=0; // 쿼리의 시작 row
|
||||
@Transient
|
||||
private Integer rowCnt=10; //한 페이지에 표현되는 row 수
|
||||
@Transient
|
||||
private Integer startNum=1; // pagination 시작값
|
||||
@Transient
|
||||
private Integer endNum=5; // pagination 마지막값
|
||||
@Transient
|
||||
private Integer maxNum; // pagination 최대값
|
||||
@Transient
|
||||
private Integer contentCnt=0;
|
||||
@Transient
|
||||
private String dateSelector;
|
||||
@Transient
|
||||
private String startDate;
|
||||
@Transient
|
||||
private String endDate;
|
||||
@Transient
|
||||
private Boolean dashboardFlag = false;
|
||||
|
||||
public void setQueryInfo(){
|
||||
setFirstIndex((getPageIndex()-1)*getRowCnt());
|
||||
}
|
||||
|
||||
public void setPaginationInfo(){
|
||||
int contentCnt = getContentCnt();
|
||||
int rowCnt = getRowCnt();
|
||||
int maxNum = (int)Math.ceil(((double)contentCnt)/rowCnt);
|
||||
if (maxNum==0){
|
||||
maxNum = 1;
|
||||
}
|
||||
setMaxNum(maxNum);
|
||||
|
||||
int pageIndex = getPageIndex();
|
||||
int startNum = pageIndex - 2;
|
||||
if(startNum <= 0){
|
||||
startNum = 1;
|
||||
}
|
||||
setStartNum(startNum);
|
||||
|
||||
int endNum = startNum + 4;
|
||||
if(endNum>maxNum){
|
||||
endNum = maxNum;
|
||||
}
|
||||
setEndNum(endNum);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
package com.dbnt.faisp.config;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class BaseService {
|
||||
|
||||
@Value("${spring.servlet.multipart.location}")
|
||||
protected String locationPath;
|
||||
|
||||
protected String calculationSize(double fileSize){
|
||||
String[] units = {"bytes", "KB", "MB", "GB", "TB", "PB"};
|
||||
double unitSelector = Math.floor(Math.log(fileSize)/Math.log(1024));
|
||||
if(fileSize>0){
|
||||
return Math.round((fileSize/Math.pow(1024, unitSelector))*100)/100d+" "+units[(int)unitSelector];
|
||||
}else{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteStoredFile(File deleteFile){
|
||||
deleteFile.delete();
|
||||
}
|
||||
|
||||
public void saveFile(MultipartFile file, File saveFile){
|
||||
if(file.getSize()!=0){ // 저장될 파일 확인
|
||||
if(!saveFile.exists()){ // 저장될 경로 확인
|
||||
if(saveFile.getParentFile().mkdirs()){
|
||||
try{
|
||||
saveFile.createNewFile();
|
||||
}catch (IOException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
file.transferTo(saveFile);
|
||||
}catch (IllegalStateException | IOException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
package com.dbnt.faisp.config;
|
||||
|
||||
import com.dbnt.faisp.fpiMgt.affair.service.AffairService;
|
||||
import com.dbnt.faisp.fpiMgt.affairPlan.service.PlanService;
|
||||
import com.dbnt.faisp.fpiMgt.affairResult.service.ResultService;
|
||||
import com.dbnt.faisp.ivsgtMgt.boardInvestigation.service.BoardInvestigationService;
|
||||
import com.dbnt.faisp.publicBoard.service.PublicBoardService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class FileController {
|
||||
|
||||
private final PlanService planService;
|
||||
private final PublicBoardService publicBoardService;
|
||||
private final AffairService affairService;
|
||||
private final ResultService resultService;
|
||||
private final BoardInvestigationService boardInvestigationService;
|
||||
|
||||
@GetMapping("/file/fileDownload")
|
||||
public void fileDownload(HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
String board,
|
||||
Integer parentKey,
|
||||
Integer fileSeq) {
|
||||
FileInfo downloadFile = null;
|
||||
switch (board){
|
||||
case "affairPlan":
|
||||
downloadFile = planService.selectPlanFile(parentKey, fileSeq);
|
||||
break;
|
||||
case "publicFile":
|
||||
downloadFile = publicBoardService.selectPublicFile(parentKey, fileSeq);
|
||||
break;
|
||||
case "affair":
|
||||
downloadFile = affairService.selectAffairFile(parentKey, fileSeq);
|
||||
break;
|
||||
case "affairResult":
|
||||
downloadFile = resultService.selectResultFile(parentKey, fileSeq);
|
||||
break;
|
||||
case "ivsgt":
|
||||
downloadFile = boardInvestigationService.selectIvsgtFile(parentKey, fileSeq);
|
||||
break;
|
||||
}
|
||||
|
||||
BufferedInputStream in;
|
||||
BufferedOutputStream out;
|
||||
try {
|
||||
File file = new File(downloadFile.getSavePath(), downloadFile.getConvNm());
|
||||
|
||||
setDisposition(downloadFile.getFullName(), request, response);
|
||||
in = new BufferedInputStream(new FileInputStream(file));
|
||||
out = new BufferedOutputStream(response.getOutputStream());
|
||||
FileCopyUtils.copy(in, out);
|
||||
out.flush();
|
||||
if(out!=null) out.close();
|
||||
if(in!=null )in.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
private void setDisposition(String filename, HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
String browser = getBrowser(request);
|
||||
|
||||
String dispositionPrefix = "attachment; filename=";
|
||||
String encodedFilename = null;
|
||||
|
||||
if (browser.equals("MSIE")) {
|
||||
encodedFilename = URLEncoder.encode(filename, "UTF-8").replaceAll("\\+", "%20");
|
||||
} else if (browser.equals("Trident")) { // IE11 문자열 깨짐 방지
|
||||
encodedFilename = URLEncoder.encode(filename, "UTF-8").replaceAll("\\+", "%20");
|
||||
} else if (browser.equals("Firefox")) {
|
||||
encodedFilename = "\"" + new String(filename.getBytes("UTF-8"), "8859_1") + "\"";
|
||||
} else if (browser.equals("Opera")) {
|
||||
encodedFilename = "\"" + new String(filename.getBytes("UTF-8"), "8859_1") + "\"";
|
||||
} else if (browser.equals("Chrome")) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0; i < filename.length(); i++) {
|
||||
char c = filename.charAt(i);
|
||||
if (c > '~') {
|
||||
sb.append(URLEncoder.encode("" + c, "UTF-8"));
|
||||
} else {
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
encodedFilename = sb.toString();
|
||||
} else {
|
||||
throw new IOException("Not supported browser");
|
||||
}
|
||||
|
||||
response.setHeader("Content-Disposition", dispositionPrefix + encodedFilename);
|
||||
|
||||
if ("Opera".equals(browser)) {
|
||||
response.setContentType("application/octet-stream;charset=UTF-8");
|
||||
}
|
||||
}
|
||||
|
||||
private String getBrowser(HttpServletRequest request) {
|
||||
String header = request.getHeader("User-Agent");
|
||||
if (header.indexOf("MSIE") > -1) {
|
||||
return "MSIE";
|
||||
} else if (header.indexOf("Trident") > -1) { // IE11 문자열 깨짐 방지
|
||||
return "Trident";
|
||||
} else if (header.indexOf("Chrome") > -1) {
|
||||
return "Chrome";
|
||||
} else if (header.indexOf("Opera") > -1) {
|
||||
return "Opera";
|
||||
}
|
||||
return "Firefox";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.dbnt.faisp.config;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class FileInfo {
|
||||
|
||||
private String origNm;
|
||||
private String convNm;
|
||||
private String fileExtn;
|
||||
private String fileSize;
|
||||
private String savePath;
|
||||
|
||||
public String getFullName(){
|
||||
return getOrigNm()+"."+getFileExtn();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.dbnt.faisp.config;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum LogStatus {
|
||||
WRITE("작성"),
|
||||
MODIFY("수정"),
|
||||
MOVE("이동"),
|
||||
DELETE("삭제"),
|
||||
FILE_ADD("파일추가"),
|
||||
FILE_REMOVE("파일삭제"),
|
||||
FILE_DOWN("파일다운로드");
|
||||
|
||||
private String value;
|
||||
|
||||
public static HashMap<String, String> getStatusMap(){
|
||||
HashMap<String, String> statusMap = new HashMap<>();
|
||||
for(LogStatus status: LogStatus.values()){
|
||||
statusMap.put(status.name(), status.getValue());
|
||||
}
|
||||
return statusMap;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.dbnt.faisp.config;
|
||||
|
||||
import com.dbnt.faisp.menuMgt.model.MenuMgt;
|
||||
import com.dbnt.faisp.menuMgt.service.MenuMgtService;
|
||||
import com.dbnt.faisp.userInfo.model.UserInfo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/modal")
|
||||
public class ModalController {
|
||||
|
||||
private final MenuMgtService menuMgtService;
|
||||
|
||||
@GetMapping("/menuModal")
|
||||
public ModelAndView menuModalPage(@AuthenticationPrincipal UserInfo loginUser, MenuMgt menuMgt){
|
||||
ModelAndView mav = new ModelAndView("commonModal/menuModal");
|
||||
menuMgt.setUserSeq(loginUser.getUserSeq());
|
||||
menuMgt.setQueryInfo();
|
||||
mav.addObject("menuMgtList", menuMgtService.selectMenuMgtListToAccessAuth(menuMgt));
|
||||
menuMgt.setContentCnt(menuMgtService.selectMenuMgtListToAccessAuthCnt(menuMgt));
|
||||
menuMgt.setPaginationInfo();
|
||||
mav.addObject("searchParams", menuMgt);
|
||||
return mav;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.dbnt.faisp.config;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum Role {
|
||||
USER("ROLE_USER"),
|
||||
SUB_ADMIN("ROLE_SUB_ADMIN"),
|
||||
ADMIN("ROLE_ADMIN");
|
||||
|
||||
private String value;
|
||||
}
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
package com.dbnt.faisp.config;
|
||||
|
||||
import com.dbnt.faisp.userInfo.model.UserInfo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.security.crypto.password.Pbkdf2PasswordEncoder;
|
||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||
import org.springframework.security.web.DefaultRedirectStrategy;
|
||||
import org.springframework.security.web.SecurityFilterChain;
|
||||
import org.springframework.security.web.access.AccessDeniedHandler;
|
||||
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
|
||||
import org.springframework.security.web.savedrequest.HttpSessionRequestCache;
|
||||
import org.springframework.security.web.savedrequest.SavedRequest;
|
||||
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
@RequiredArgsConstructor
|
||||
public class SecurityConfig{
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
private final BaseController baseController;
|
||||
|
||||
@Bean
|
||||
public PasswordEncoder passwordEncoder(){
|
||||
return new Pbkdf2PasswordEncoder();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public WebSecurityCustomizer webSecurityCustomizer() {
|
||||
return (web) -> web.ignoring().antMatchers("/css/**", "/img/**", "/js/**", "/vendor/**");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public AccessDeniedHandler accessDeniedHandler() {
|
||||
log.warn("accessDeniedHandler");
|
||||
return (request, response, e) -> {
|
||||
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
|
||||
response.setContentType("text/html;charset=UTF-8");
|
||||
response.getWriter().println("<script>alert('접근이 거부되었습니다.'); location.href='/';</script>");
|
||||
response.getWriter().flush();
|
||||
response.getWriter().close();
|
||||
};
|
||||
}
|
||||
|
||||
@Bean
|
||||
public AuthenticationEntryPoint authenticationEntryPoint() {
|
||||
return (request, response, e) -> {
|
||||
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
|
||||
response.setContentType("text/html;charset=UTF-8");
|
||||
response.getWriter().println("<script>alert('로그인이 해제되었습니다.'); location.href='/';</script>");
|
||||
response.getWriter().flush();
|
||||
response.getWriter().close();
|
||||
};
|
||||
}
|
||||
|
||||
@Bean
|
||||
public AuthenticationSuccessHandler loginSuccessHandler() {
|
||||
return (request, response, authentication) -> {
|
||||
SavedRequest savedRequest = new HttpSessionRequestCache().getRequest(request,response);
|
||||
baseController.setSession((UserInfo)authentication.getPrincipal(), request.getSession());
|
||||
if(savedRequest != null){
|
||||
String targetUrl = savedRequest.getRedirectUrl();
|
||||
new DefaultRedirectStrategy().sendRedirect(request,response,targetUrl);
|
||||
}else{
|
||||
new DefaultRedirectStrategy().sendRedirect(request,response,"/");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Bean
|
||||
protected SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
||||
http.authorizeRequests() // 페이지 권한 설정
|
||||
.antMatchers(
|
||||
"/dashboard",
|
||||
"/myInfo/**",
|
||||
"/modal/**",
|
||||
"/publicBoard/**",
|
||||
"/faRpt/**",
|
||||
"/affairPlan/**",
|
||||
"/affair/**",
|
||||
"/affairResult/**",
|
||||
"/equip/**",
|
||||
"/target/**",
|
||||
"/translator/**"
|
||||
).hasRole(Role.USER.name()) // USER 접근 허용
|
||||
.antMatchers(
|
||||
"/authMgt/**",
|
||||
"/userMgt/**",
|
||||
"/organMgt/**"
|
||||
).hasRole(Role.SUB_ADMIN.name()) // SUB_ADMIN 접근 허용
|
||||
.antMatchers(
|
||||
"/codeMgt/**",
|
||||
"/menuMgt/**"
|
||||
).hasRole(Role.ADMIN.name()) // ADMIN 접근 허용
|
||||
.antMatchers("/login").permitAll() // 로그인 페이지는 권한 없이 접근 허용
|
||||
.and() // 로그인 설정
|
||||
.formLogin().loginPage("/login") // Custom login form 사용
|
||||
.failureUrl("/login-error") // 로그인 실패 시 이동
|
||||
.defaultSuccessUrl("/") // 로그인 성공 시 이동
|
||||
/*.failureHandler((request, response, exception) -> {
|
||||
|
||||
})*/ // 로그인 실패시 동작 수행
|
||||
.successHandler(loginSuccessHandler()) // 로그인 성공시 동작 수행.
|
||||
.and() // 로그아웃 설정
|
||||
.logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout")) // 로그아웃 시 URL 재정의
|
||||
.logoutSuccessUrl("/") // 로그아웃 성공 시 redirect 이동
|
||||
.invalidateHttpSession(true) // HTTP Session 초기화
|
||||
.deleteCookies("JSESSIONID") // 특정 쿠키 제거
|
||||
.and() // 403 예외처리 핸들링
|
||||
//.exceptionHandling().accessDeniedPage("/denied");
|
||||
.exceptionHandling()
|
||||
.accessDeniedHandler(accessDeniedHandler())
|
||||
.authenticationEntryPoint(authenticationEntryPoint());
|
||||
return http.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,435 @@
|
|||
package com.dbnt.faisp.equip;
|
||||
|
||||
|
||||
import com.dbnt.faisp.authMgt.service.AuthMgtService;
|
||||
import com.dbnt.faisp.equip.model.CellPhone;
|
||||
import com.dbnt.faisp.equip.model.Equip;
|
||||
import com.dbnt.faisp.equip.model.EquipLog;
|
||||
import com.dbnt.faisp.equip.model.UseList;
|
||||
import com.dbnt.faisp.equip.service.EquipService;
|
||||
import com.dbnt.faisp.organMgt.service.OrganConfigService;
|
||||
import com.dbnt.faisp.userInfo.model.UserInfo;
|
||||
import com.dbnt.faisp.userInfo.service.UserInfoService;
|
||||
import com.dbnt.faisp.util.ParamMap;
|
||||
import com.dbnt.faisp.util.Utils;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/equip")
|
||||
public class EquipController {
|
||||
|
||||
private final EquipService equipService;
|
||||
private final AuthMgtService authMgtService;
|
||||
private final OrganConfigService organConfigService;
|
||||
private final UserInfoService userInfoService;
|
||||
|
||||
@GetMapping("/equipStatus")
|
||||
public ModelAndView equipStatus(@AuthenticationPrincipal UserInfo loginUser, Equip equip) {
|
||||
ModelAndView mav = new ModelAndView("equip/equipStatus");
|
||||
|
||||
//메뉴권한 확인
|
||||
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/equip/equipStatus").get(0).getAccessAuth();
|
||||
mav.addObject("accessAuth", accessAuth);
|
||||
mav.addObject("equipList", equipService.selectEquipStatus(equip));
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/equipEditModal")
|
||||
public ModelAndView equipEditModal(@AuthenticationPrincipal UserInfo loginUser) {
|
||||
ModelAndView mav = new ModelAndView("equip/equipEditModal");
|
||||
//메뉴권한 확인
|
||||
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/equip/equipStatus").get(0).getAccessAuth();
|
||||
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
|
||||
mav.addObject("userOrgan", loginUser.getOgCd());
|
||||
mav.addObject("accessAuth", accessAuth);
|
||||
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/equipTypeSelecBox")
|
||||
public ModelAndView equipTypeSelecBox(String equType) {
|
||||
ModelAndView mav = new ModelAndView("equip/equipTypeSelecBox");
|
||||
mav.addObject("equType", equType);
|
||||
return mav;
|
||||
}
|
||||
|
||||
@PostMapping("/saveEquip")
|
||||
public void saveEquip(@AuthenticationPrincipal UserInfo loginUser,Equip equip, MultipartHttpServletRequest request){
|
||||
equip.setWrtNm(loginUser.getUserId());
|
||||
equip.setWrtOrgan(loginUser.getOgCd());
|
||||
equip.setWrtDt(LocalDateTime.now());
|
||||
equipService.saveEquip(equip,request);
|
||||
}
|
||||
|
||||
@GetMapping("/List")
|
||||
public ModelAndView equipList(@AuthenticationPrincipal UserInfo loginUser,Equip equip) {
|
||||
ModelAndView mav = new ModelAndView("equip/equipList");
|
||||
|
||||
//메뉴권한 확인
|
||||
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/equip/equipStatus").get(0).getAccessAuth();
|
||||
mav.addObject("accessAuth", accessAuth);
|
||||
equip.setDownOrganCdList(loginUser.getDownOrganCdList());
|
||||
ParamMap equType = equipService.selectEduType(equip);
|
||||
mav.addObject("equType", equType.get("equ_type"));
|
||||
mav.addObject("detailType", equType.get("detail_type"));
|
||||
equip.setQueryInfo();
|
||||
mav.addObject("equipList", equipService.selectEquipList(equip));
|
||||
equip.setContentCnt(equipService.selectEquipListCnt(equip));
|
||||
equip.setPaginationInfo();
|
||||
mav.addObject("searchParams", equip);
|
||||
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/updatePage")
|
||||
public ModelAndView equipUpdatePage(@AuthenticationPrincipal UserInfo loginUser, Equip equip) {
|
||||
ModelAndView mav = new ModelAndView("equip/equipModifyModal");
|
||||
//메뉴권한 확인
|
||||
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/equip/equipStatus").get(0).getAccessAuth();
|
||||
mav.addObject("accessAuth", accessAuth);
|
||||
mav.addObject("userId", loginUser.getUserId());
|
||||
mav.addObject("wrtId", equipService.selectEquipFirstId(equip));
|
||||
mav.addObject("equInfo", equipService.selectEquipInfo(equip));
|
||||
return mav;
|
||||
}
|
||||
|
||||
@PostMapping("/updateEquip")
|
||||
@ResponseBody
|
||||
public int updateEquip(@AuthenticationPrincipal UserInfo loginUser,Equip equip, MultipartHttpServletRequest request){
|
||||
equip.setWrtNm(loginUser.getUserId());
|
||||
equip.setWrtOrgan(loginUser.getOgCd());
|
||||
equip.setWrtDt(LocalDateTime.now());
|
||||
int result = equipService.updateEquip(equip,request);
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("/historyView")
|
||||
public ModelAndView historyView(Equip equip) {
|
||||
ModelAndView mav = new ModelAndView("equip/equipHistory");
|
||||
mav.addObject("equList", equipService.selectHistoryView(equip));
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/HistoryDetail")
|
||||
@ResponseBody
|
||||
public Equip HistoryDetail(Equip equip){
|
||||
return equipService.selectHistoryDetail(equip);
|
||||
}
|
||||
|
||||
@PostMapping("/epuipDelete")
|
||||
public void epuipDelete(@AuthenticationPrincipal UserInfo loginUser, @RequestBody List<Equip> equip){
|
||||
equipService.equipDelete(equip,loginUser);
|
||||
}
|
||||
|
||||
@GetMapping("/getEquipImg")
|
||||
public void getThumbImage(Equip equip , HttpServletResponse response) throws Exception {
|
||||
|
||||
Equip dbImg = equipService.selectEquipInfo(equip);
|
||||
|
||||
String realFile = dbImg.getFilePath()+"/"+ dbImg.getConvNm();
|
||||
String fileNm = dbImg.getConvNm();
|
||||
|
||||
|
||||
BufferedOutputStream out = null;
|
||||
InputStream in = null;
|
||||
|
||||
try {
|
||||
response.setContentType("image/jpeg;charset=UTF-8");
|
||||
response.setHeader("Content-Disposition", "inline;filename=" + fileNm);
|
||||
File file = new File(realFile);
|
||||
// File file = new File(realFile + "/" + fileNm);
|
||||
if(file.exists()){
|
||||
in = new FileInputStream(file);
|
||||
out = new BufferedOutputStream(response.getOutputStream());
|
||||
int len;
|
||||
byte[] buf = new byte[1024];
|
||||
while ((len = in.read(buf)) > 0) {
|
||||
out.write(buf, 0, len);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
} finally {
|
||||
if(out != null){ out.flush(); }
|
||||
if(out != null){ out.close(); }
|
||||
if(in != null){ in.close(); }
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/Log")
|
||||
public ModelAndView equipLog(@AuthenticationPrincipal UserInfo loginUser,EquipLog equipLog) {
|
||||
ModelAndView mav = new ModelAndView("equip/equipLogList");
|
||||
equipLog.setDownOrganCdList(loginUser.getDownOrganCdList());
|
||||
equipLog.setQueryInfo();
|
||||
mav.addObject("logList", equipService.selectEquipLogList(equipLog));
|
||||
equipLog.setContentCnt(equipService.selectEquipLogListCnt(equipLog));
|
||||
equipLog.setPaginationInfo();
|
||||
mav.addObject("searchParams", equipLog);
|
||||
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/statusExcelDown")
|
||||
public void statisticsExcelDown(Model model,HttpServletResponse response, Equip equip) {
|
||||
String[] headers = { "rownum","equ_type", "item_value", "total", "cnt_bon", "cnt_center", "cnt_incheon", "cnt_pyeongtaek", "cnt_taean","cnt_boryeong","cnt_west","cnt_mokpo","cnt_buan",
|
||||
"cnt_gunsan","cnt_yusu","cnt_wando","cnt_south","cnt_ulsan","cnt_busan","cnt_changwon","cnt_tongyong","cnt_sacheon","cnt_east","cnt_sokcho","cnt_donghe",
|
||||
"cnt_ulgin","cnt_pohang","cnt_jeju","cnt_jejuseo","cnt_seoguipo"};
|
||||
String[] headerNames = { "", "", "", "", "", "중부", "", "","","","서해","","","","","","남해","","","","","","동해","","","","","제주","",""};
|
||||
String[] headerNames2 = { "연번", "분류", "세부분류", "총계", "본청", "청", "인천서", "평택서","태안서","보령서","청","목포서","부안서","군산서","여수서","완도서","청","울산서","부산서","창원서","통영서","서천서","청","속초서","동해서","울진서","포항서","청","제주서","서귀포서"};
|
||||
String[] columnType = { "int", "String", "String", "int", "int", "int", "int", "int","int","int","int","int","int","int","int","int","int","int","int","int",
|
||||
"int","int","int","int","int","int","int","int","int","int"};
|
||||
String sheetName = "외사장비현황";
|
||||
String excelFileName = "외사장비현황";
|
||||
List<ParamMap> equStatusList = equipService.selectEquipStatus(equip);
|
||||
|
||||
try {
|
||||
Utils.downEquipStatusExcel(equStatusList, response, headers, headerNames,headerNames2, columnType, sheetName, excelFileName);
|
||||
} catch (IOException e) {
|
||||
model.addAttribute("message", "엑셀다운로드 중 오류가 발생했습니다.");
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/cellPhoneList")
|
||||
public ModelAndView cellPhoneList(@AuthenticationPrincipal UserInfo loginUser,CellPhone cellPhone,HttpServletResponse response) {
|
||||
ModelAndView mav = new ModelAndView("equip/cellPhoneList");
|
||||
cellPhone.setDownOrganCdList(loginUser.getDownOrganCdList());
|
||||
//엑셀다운
|
||||
if(cellPhone.getExcel() != null && cellPhone.getExcel().equals("Y")){
|
||||
String[] headers = { "phone_key", "sosok", "tel_no", "user_nm", "ext_mail", "webex_no", "katalk_id"};
|
||||
String[] headerNames = { "연번", "소속","전화번호", "사용자(관리자)", "등록 외부메일", "웹엑스 미팅번호", "카카오톡 ID"};
|
||||
String[] columnType = { "int", "String","String", "String", "String", "String", "String", "Stiring"};
|
||||
String sheetName = "업무용 휴대전화 현황";
|
||||
String excelFileName = "업무용 휴대전화 현황";
|
||||
List<CellPhone> cellPhoneList= equipService.selectCellPhoneList(cellPhone);
|
||||
|
||||
try {
|
||||
Utils.cellPhoneListToExcel(cellPhoneList, response, headers, headerNames, columnType, sheetName, excelFileName);
|
||||
} catch (IOException e) {
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
//메뉴권한 확인
|
||||
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/equip/cellPhoneList").get(0).getAccessAuth();
|
||||
mav.addObject("accessAuth", accessAuth);
|
||||
cellPhone.setQueryInfo();
|
||||
mav.addObject("cellPhoneList", equipService.selectCellPhoneList(cellPhone));
|
||||
cellPhone.setContentCnt(equipService.selectCellPhoneListCnt(cellPhone));
|
||||
cellPhone.setPaginationInfo();
|
||||
mav.addObject("searchParams", cellPhone);
|
||||
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/cellPhoneEditModal")
|
||||
public ModelAndView cellPhoneEditModal(@AuthenticationPrincipal UserInfo loginUser,CellPhone cellPhone) {
|
||||
ModelAndView mav = new ModelAndView("equip/cellPhoneEditModal");
|
||||
if(cellPhone.getPhoneKey() != null) {
|
||||
cellPhone = equipService.selectCellPhoneInfo(cellPhone.getPhoneKey());
|
||||
ParamMap param = new ParamMap();
|
||||
param.put("downOrganCdList", organConfigService.selectDownOrganListWhereUserOgCd(cellPhone.getMgtOrgan()));
|
||||
mav.addObject("managerList", userInfoService.selectManagerList(param));
|
||||
}
|
||||
|
||||
if (cellPhone.getPhoneKey() == null) {
|
||||
cellPhone.setWrtOrgan(loginUser.getOgCd());
|
||||
cellPhone.setWrtPart(loginUser.getOfcCd());
|
||||
cellPhone.setWrtUserSeq(loginUser.getUserSeq());
|
||||
cellPhone.setWrtNm(loginUser.getUserNm());
|
||||
}
|
||||
//메뉴권한 확인
|
||||
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/equip/cellPhoneList").get(0).getAccessAuth();
|
||||
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
|
||||
mav.addObject("userOrgan", loginUser.getOgCd());
|
||||
mav.addObject("accessAuth", accessAuth);
|
||||
mav.addObject("info", cellPhone);
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/cellPhoneSelecBox")
|
||||
public ModelAndView cellPhoneSelecBox(String ogCd) {
|
||||
ModelAndView mav = new ModelAndView("equip/cellPhoneSelecBox");
|
||||
ParamMap param = new ParamMap();
|
||||
param.put("downOrganCdList", organConfigService.selectDownOrganListWhereUserOgCd(ogCd));
|
||||
mav.addObject("managerList", userInfoService.selectManagerList(param));
|
||||
return mav;
|
||||
}
|
||||
|
||||
@PostMapping("/saveCellPhone")
|
||||
public Integer saveCellPhone (@AuthenticationPrincipal UserInfo loginUser,CellPhone cellPhone){
|
||||
cellPhone.setWrtDt(LocalDateTime.now());
|
||||
return equipService.saveCellPhone(cellPhone);
|
||||
}
|
||||
|
||||
@PostMapping("/deleteCellPhone")
|
||||
public void deleteCellPhone(@RequestBody List<CellPhone> cellPhone){
|
||||
equipService.deleteCellPhone(cellPhone);
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/pvreUseList")
|
||||
public ModelAndView pvreUseList(@AuthenticationPrincipal UserInfo loginUser,UseList useList,HttpServletResponse response) {
|
||||
ModelAndView mav = new ModelAndView("equip/pvreUseList");
|
||||
useList.setDownOrganCdList(loginUser.getDownOrganCdList());
|
||||
useList.setUseType("PVRE");
|
||||
//엑셀다운
|
||||
if(useList.getExcel() != null && useList.getExcel().equals("Y")){
|
||||
String[] headers = { "use_no", "sosok", "use_dt", "detail_type_name", "people_cnt", "description", "wrt_dt"};
|
||||
String[] headerNames = { "연번", "경찰서","사용일시", "사용사유", "사용인원", "비고", "최종수정일"};
|
||||
String[] columnType = { "String", "String","String", "String", "int", "String", "String"};
|
||||
String sheetName = "휴대용 녹화장비 사용 대장";
|
||||
String excelFileName = "휴대용 녹화장비 사용 대장";
|
||||
List<UseList> useExcelList= equipService.selectUseList(useList);
|
||||
|
||||
try {
|
||||
Utils.useListToExcel(useExcelList, response, headers, headerNames, columnType, sheetName, excelFileName);
|
||||
} catch (IOException e) {
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
//메뉴권한 확인
|
||||
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/equip/pvreUseList").get(0).getAccessAuth();
|
||||
mav.addObject("accessAuth", accessAuth);
|
||||
useList.setQueryInfo();
|
||||
mav.addObject("useList", equipService.selectUseList(useList));
|
||||
useList.setContentCnt(equipService.selectUseListCnt(useList));
|
||||
useList.setPaginationInfo();
|
||||
mav.addObject("organList", equipService.selectOrganList(useList));
|
||||
mav.addObject("searchParams", useList);
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/useEditModal")
|
||||
public ModelAndView useEditModal(@AuthenticationPrincipal UserInfo loginUser,UseList useList) {
|
||||
ModelAndView mav = new ModelAndView("equip/useEditModal");
|
||||
useList.setDownOrganCdList(loginUser.getDownOrganCdList());
|
||||
mav.addObject("organList", equipService.selectOrganList(useList));
|
||||
mav.addObject("userOrgan", loginUser.getOgCd());
|
||||
mav.addObject("useType", useList.getUseType());
|
||||
//메뉴권한 확인
|
||||
String accessAuth;
|
||||
if(useList.getUseType().equals("PVRE")) {
|
||||
accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/equip/pvreUseList").get(0).getAccessAuth();
|
||||
mav.addObject("accessAuth", accessAuth);
|
||||
}else if(useList.getUseType().equals("QIR")) {
|
||||
accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/equip/qirUseList").get(0).getAccessAuth();
|
||||
mav.addObject("accessAuth", accessAuth);
|
||||
}
|
||||
return mav;
|
||||
}
|
||||
|
||||
@PostMapping("/saveUse")
|
||||
public void saveUse(@AuthenticationPrincipal UserInfo loginUser,UseList useList){
|
||||
useList.setWrtOrgan(loginUser.getOgCd());
|
||||
useList.setWrtPart(loginUser.getOfcCd());
|
||||
useList.setWrtUserSeq(loginUser.getUserSeq());
|
||||
useList.setWrtNm(loginUser.getUserId());
|
||||
useList.setWrtDt(LocalDateTime.now());
|
||||
equipService.saveUse(useList);
|
||||
}
|
||||
|
||||
@GetMapping("/useModifyModal")
|
||||
public ModelAndView useModifyModal(@AuthenticationPrincipal UserInfo loginUser,UseList useList) {
|
||||
ModelAndView mav = new ModelAndView("equip/useModifyModal");
|
||||
useList.setDownOrganCdList(loginUser.getDownOrganCdList());
|
||||
mav.addObject("organList", equipService.selectOrganList(useList));
|
||||
mav.addObject("info", equipService.selectUseInfo(useList));
|
||||
//메뉴권한 확인
|
||||
String accessAuth;
|
||||
if(useList.getUseType().equals("PVRE")) {
|
||||
accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/equip/pvreUseList").get(0).getAccessAuth();
|
||||
mav.addObject("accessAuth", accessAuth);
|
||||
}else if(useList.getUseType().equals("QIR")) {
|
||||
accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/equip/qirUseList").get(0).getAccessAuth();
|
||||
mav.addObject("accessAuth", accessAuth);
|
||||
}
|
||||
return mav;
|
||||
}
|
||||
|
||||
@PostMapping("/updateUse")
|
||||
public UseList uadateUse(@AuthenticationPrincipal UserInfo loginUser,UseList useList){
|
||||
useList.setWrtOrgan(loginUser.getOgCd());
|
||||
useList.setWrtPart(loginUser.getOfcCd());
|
||||
useList.setWrtUserSeq(loginUser.getUserSeq());
|
||||
useList.setWrtNm(loginUser.getUserId());
|
||||
useList.setWrtDt(LocalDateTime.now());
|
||||
return equipService.updateUse(useList);
|
||||
}
|
||||
|
||||
@GetMapping("/useHistory")
|
||||
public ModelAndView useHistory(@AuthenticationPrincipal UserInfo loginUser,UseList useList) {
|
||||
ModelAndView mav = new ModelAndView("equip/useHistory");
|
||||
mav.addObject("infoList", equipService.selectUseInfoList(useList));
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/HistoryView")
|
||||
@ResponseBody
|
||||
public UseList HistoryView(UseList useList){
|
||||
return equipService.selectUseInfo(useList);
|
||||
}
|
||||
|
||||
@PostMapping("/useDelete")
|
||||
public void useDelete(@RequestBody List<UseList> useList){
|
||||
equipService.useDelete(useList);
|
||||
}
|
||||
|
||||
@GetMapping("/qirUseList")
|
||||
public ModelAndView qirUseList(@AuthenticationPrincipal UserInfo loginUser,UseList useList,HttpServletResponse response) {
|
||||
ModelAndView mav = new ModelAndView("equip/qirUseList");
|
||||
useList.setDownOrganCdList(loginUser.getDownOrganCdList());
|
||||
useList.setUseType("QIR");
|
||||
//엑셀다운
|
||||
if(useList.getExcel() != null && useList.getExcel().equals("Y")){
|
||||
String[] headers = { "use_no", "sosok", "use_dt", "detail_type_name", "people_cnt", "description", "wrt_dt"};
|
||||
String[] headerNames = { "연번", "경찰서","사용일시", "사용사유", "사용인원", "비고", "최종수정일"};
|
||||
String[] columnType = { "String", "String","String", "String", "int", "String", "String"};
|
||||
String sheetName = "방역조사실 사용대장";
|
||||
String excelFileName = "방역조사실 사용대장";
|
||||
List<UseList> useExcelList= equipService.selectUseList(useList);
|
||||
|
||||
try {
|
||||
Utils.useListToExcel(useExcelList, response, headers, headerNames, columnType, sheetName, excelFileName);
|
||||
} catch (IOException e) {
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
//메뉴권한 확인
|
||||
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/equip/qirUseList").get(0).getAccessAuth();
|
||||
mav.addObject("accessAuth", accessAuth);
|
||||
useList.setQueryInfo();
|
||||
mav.addObject("useList", equipService.selectUseList(useList));
|
||||
useList.setContentCnt(equipService.selectUseListCnt(useList));
|
||||
useList.setPaginationInfo();
|
||||
mav.addObject("searchParams", useList);
|
||||
mav.addObject("organList", equipService.selectOrganList(useList));
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
package com.dbnt.faisp.equip.mapper;
|
||||
|
||||
import com.dbnt.faisp.equip.model.CellPhone;
|
||||
import com.dbnt.faisp.equip.model.Equip;
|
||||
import com.dbnt.faisp.equip.model.EquipLog;
|
||||
import com.dbnt.faisp.equip.model.UseList;
|
||||
import com.dbnt.faisp.util.ParamMap;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface EquipMapper {
|
||||
|
||||
List<ParamMap> selectEquipStatus(Equip equip);
|
||||
|
||||
List<Equip> selectEquipList(Equip equip);
|
||||
|
||||
Integer selectEquipListCnt(Equip equip);
|
||||
|
||||
Equip selectEquipInfo(Equip equip);
|
||||
|
||||
ParamMap selectEduType(Equip equip);
|
||||
|
||||
Equip selectHistoryDetail(Equip equip);
|
||||
|
||||
List<EquipLog> selectEquipLogList(EquipLog equipLog);
|
||||
|
||||
Integer selectEquipLogListCnt(EquipLog equipLog);
|
||||
|
||||
String selectEquipFirstId(Equip equip);
|
||||
|
||||
List<CellPhone> selectCellPhoneList(CellPhone cellPhone);
|
||||
|
||||
Integer selectCellPhoneListCnt(CellPhone cellPhone);
|
||||
|
||||
List<ParamMap> selectOrganList(UseList useList);
|
||||
|
||||
UseList selectUseNoCnt(UseList useList);
|
||||
|
||||
Integer selectLastUseNo(UseList useList);
|
||||
|
||||
List<UseList> selectUseList(UseList useList);
|
||||
|
||||
Integer selectUseListCnt(UseList useList);
|
||||
|
||||
UseList selectUseInfo(UseList useList);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
package com.dbnt.faisp.equip.model;
|
||||
|
||||
import com.dbnt.faisp.config.BaseModel;
|
||||
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "cellphone_mgt")
|
||||
public class CellPhone extends BaseModel{
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "phone_key")
|
||||
private Integer phoneKey;
|
||||
@Column(name = "mgt_organ")
|
||||
private String mgtOrgan;
|
||||
@Column(name = "tel_no")
|
||||
private String telNo;
|
||||
@Column(name = "p_user_seq")
|
||||
private Integer pUserSeq;
|
||||
@Column(name = "ext_mail")
|
||||
private String extMail;
|
||||
@Column(name = "katalk_id")
|
||||
private String katalkId;
|
||||
@Column(name = "webex_no")
|
||||
private String webexNo;
|
||||
@Column(name = "description")
|
||||
private String description;
|
||||
@Column(name = "wrt_organ")
|
||||
private String wrtOrgan;
|
||||
@Column(name = "wrt_part")
|
||||
private String wrtPart;
|
||||
@Column(name = "wrt_user_seq")
|
||||
private Integer wrtUserSeq;
|
||||
@Column(name = "wrt_nm")
|
||||
private String wrtNm;
|
||||
@Column(name = "wrt_dt")
|
||||
private LocalDateTime wrtDt;
|
||||
|
||||
@Transient
|
||||
private String userNm;
|
||||
|
||||
@Transient
|
||||
private String sosok;
|
||||
|
||||
@Transient
|
||||
private String excel;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CellPhone [phoneKey=" + phoneKey + ", mgtOrgan=" + mgtOrgan + ", telNo=" + telNo + ", pUserSeq=" + pUserSeq
|
||||
+ ", extMail=" + extMail + ", katalkId=" + katalkId + ", webexNo=" + webexNo + ", description="
|
||||
+ description + ", wrtOrgan=" + wrtOrgan + ", wrtPart=" + wrtPart + ", wrtUserSeq=" + wrtUserSeq
|
||||
+ ", wrtNm=" + wrtNm + ", wrtDt=" + wrtDt + ", userNm=" + userNm + ", sosok=" + sosok + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
package com.dbnt.faisp.equip.model;
|
||||
|
||||
import com.dbnt.faisp.config.BaseModel;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@IdClass(Equip.EquipId.class)
|
||||
@Table(name = "equ_mgt")
|
||||
public class Equip extends BaseModel implements Serializable{
|
||||
@Id
|
||||
@Column(name = "equ_key")
|
||||
private Integer equKey;
|
||||
@Id
|
||||
@Column(name = "version_no")
|
||||
private Integer versionNo;
|
||||
@Column(name = "mgt_organ")
|
||||
private String mgtOrgan;
|
||||
@Column(name = "equ_type")
|
||||
private String equType;
|
||||
@Column(name = "detail_type")
|
||||
private String detailType;
|
||||
@Column(name = "stored_year")
|
||||
private String storedYear;
|
||||
@Column(name = "item_qty")
|
||||
private Integer itemQty;
|
||||
@Column(name = "item_condition")
|
||||
private String itemCondition;
|
||||
@Column(name = "note")
|
||||
private String note;
|
||||
@Column(name = "wrt_organ")
|
||||
private String wrtOrgan;
|
||||
@Column(name = "wrt_nm")
|
||||
private String wrtNm;
|
||||
@Column(name = "wrt_dt")
|
||||
private LocalDateTime wrtDt;
|
||||
|
||||
@Transient
|
||||
private String sosok;
|
||||
@Transient
|
||||
private String detailSosok;
|
||||
@Transient
|
||||
private String detailName;
|
||||
@Transient
|
||||
private String origNm;
|
||||
@Transient
|
||||
private String convNm;
|
||||
@Transient
|
||||
private String filePath;
|
||||
@Transient
|
||||
private Integer deleteFileKey;
|
||||
@Transient
|
||||
private Integer deleteFileVnum;
|
||||
@Transient
|
||||
private String noUpdateImg;
|
||||
|
||||
@Embeddable
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class EquipId implements Serializable {
|
||||
private Integer equKey;
|
||||
private Integer versionNo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Equip [equKey=" + equKey + ", versionNo=" + versionNo + ", mgtOrgan=" + mgtOrgan + ", equType=" + equType
|
||||
+ ", detailType=" + detailType + ", storedYear=" + storedYear + ", itemQty=" + itemQty + ", itemCondition="
|
||||
+ itemCondition + ", note=" + note + ", wrtOrgan=" + wrtOrgan + ", wrtNm=" + wrtNm + ", wrtDt=" + wrtDt
|
||||
+ ", sosok=" + sosok + ", detailSosok=" + detailSosok + ", detailName=" + detailName + ", origNm=" + origNm
|
||||
+ ", convNm=" + convNm + ", filePath=" + filePath + ", deleteFileKey=" + deleteFileKey + ", deleteFileVnum="
|
||||
+ deleteFileVnum + ", noUpdateImg=" + noUpdateImg + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
package com.dbnt.faisp.equip.model;
|
||||
|
||||
import com.dbnt.faisp.config.BaseModel;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@IdClass(EquipFile.EquipFileId.class)
|
||||
@Table(name = "equ_file")
|
||||
public class EquipFile extends BaseModel implements Serializable{
|
||||
@Id
|
||||
@Column(name = "equ_key")
|
||||
private Integer equKey;
|
||||
@Id
|
||||
@Column(name = "version_no")
|
||||
private Integer versionNo;
|
||||
@Column(name = "orig_nm")
|
||||
private String origNm;
|
||||
@Column(name = "conv_nm")
|
||||
private String convNm;
|
||||
@Column(name = "file_extn")
|
||||
private String fileExtn;
|
||||
@Column(name = "file_size")
|
||||
private String fileSize;
|
||||
@Column(name = "file_path")
|
||||
private String filePath;
|
||||
|
||||
|
||||
|
||||
@Embeddable
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class EquipFileId implements Serializable {
|
||||
private Integer equKey;
|
||||
private Integer versionNo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EquipFile [equKey=" + equKey + ", versionNo=" + versionNo + ", origNm=" + origNm + ", convNm=" + convNm
|
||||
+ ", fileExtn=" + fileExtn + ", fileSize=" + fileSize + ", filePath=" + filePath + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
package com.dbnt.faisp.equip.model;
|
||||
|
||||
|
||||
import com.dbnt.faisp.config.BaseModel;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "equ_Log")
|
||||
public class EquipLog extends BaseModel{
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "el_seq")
|
||||
private Integer userSeq;
|
||||
@Column(name = "equ_type")
|
||||
private String equType;
|
||||
@Column(name = "detail_type")
|
||||
private String detailType;
|
||||
@Column(name = "el_contents")
|
||||
private String elContents;
|
||||
@Column(name = "wrt_nm")
|
||||
private String wrtNm;
|
||||
@Column(name = "wrt_organ")
|
||||
private String wrtOrgan;
|
||||
@Column(name = "wrt_dt")
|
||||
private LocalDateTime wrtDt;
|
||||
|
||||
@Transient
|
||||
private String sosok;
|
||||
@Transient
|
||||
private String detailSosok;
|
||||
@Transient
|
||||
private String detailName;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EquipLog [userSeq=" + userSeq + ", equType=" + equType + ", detailType=" + detailType + ", elContents="
|
||||
+ elContents + ", wrtNm=" + wrtNm + ", wrtOrgan=" + wrtOrgan + ", wrtDt=" + wrtDt + ", sosok=" + sosok
|
||||
+ ", detailSosok=" + detailSosok + ", detailName=" + detailName + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
package com.dbnt.faisp.equip.model;
|
||||
|
||||
import com.dbnt.faisp.config.BaseModel;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@IdClass(UseList.UseListId.class)
|
||||
@Table(name = "use_list")
|
||||
public class UseList extends BaseModel implements Serializable{
|
||||
@Id
|
||||
@Column(name = "mgt_organ")
|
||||
private String mgtOrgan;
|
||||
@Id
|
||||
@Column(name = "use_no")
|
||||
private String useNo;
|
||||
@Id
|
||||
@Column(name = "version_no")
|
||||
private Integer versionNo;
|
||||
@Id
|
||||
@Column(name = "use_type")
|
||||
private String useType;
|
||||
@Column(name = "use_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate useDt;
|
||||
@Column(name = "detail_type")
|
||||
private String detailType;
|
||||
@Column(name = "detail_self")
|
||||
private String detailSelf;
|
||||
@Column(name = "people_cnt")
|
||||
private Integer peopleCnt;
|
||||
@Column(name = "description")
|
||||
private String description;
|
||||
@Column(name = "wrt_organ")
|
||||
private String wrtOrgan;
|
||||
@Column(name = "wrt_part")
|
||||
private String wrtPart;
|
||||
@Column(name = "wrt_user_grd")
|
||||
private String wrtUserGrd;
|
||||
@Column(name = "wrt_user_seq")
|
||||
private Integer wrtUserSeq;
|
||||
@Column(name = "wrt_nm")
|
||||
private String wrtNm;
|
||||
@Column(name = "wrt_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private LocalDateTime wrtDt;
|
||||
|
||||
@Transient
|
||||
private String excel;
|
||||
|
||||
@Transient
|
||||
private String sosok;
|
||||
|
||||
@Transient
|
||||
private String year;
|
||||
@Transient
|
||||
private String detailTypeName;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UseList [mgtOrgan=" + mgtOrgan + ", useNo=" + useNo + ", versionNo=" + versionNo + ", useType=" + useType
|
||||
+ ", useDt=" + useDt + ", detailType=" + detailType + ", detailSelf=" + detailSelf + ", peopleCnt="
|
||||
+ peopleCnt + ", description=" + description + ", wrtOrgan=" + wrtOrgan + ", wrtPart=" + wrtPart
|
||||
+ ", wrtUserGrd=" + wrtUserGrd + ", wrtUserSeq=" + wrtUserSeq + ", wrtNm=" + wrtNm + ", wrtDt=" + wrtDt
|
||||
+ ", excel=" + excel + ", sosok=" + sosok + ", year=" + year + ", detailTypeName=" + detailTypeName + "]";
|
||||
}
|
||||
|
||||
|
||||
@Embeddable
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class UseListId implements Serializable {
|
||||
private String mgtOrgan;
|
||||
private String useNo;
|
||||
private Integer versionNo;
|
||||
private String useType;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.dbnt.faisp.equip.repository;
|
||||
|
||||
import com.dbnt.faisp.equip.model.CellPhone;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
|
||||
|
||||
public interface CellPhoneRepository extends JpaRepository<CellPhone, Integer> {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.dbnt.faisp.equip.repository;
|
||||
|
||||
import com.dbnt.faisp.equip.model.EquipFile;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
|
||||
|
||||
public interface EquipFileRepository extends JpaRepository<EquipFile, EquipFile.EquipFileId> {
|
||||
|
||||
void deleteByEquKey(Integer equKey);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.dbnt.faisp.equip.repository;
|
||||
|
||||
import com.dbnt.faisp.equip.model.EquipLog;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
|
||||
|
||||
public interface EquipLogRepository extends JpaRepository<EquipLog, Integer> {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.dbnt.faisp.equip.repository;
|
||||
|
||||
import com.dbnt.faisp.equip.model.Equip;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
|
||||
|
||||
public interface EquipRepository extends JpaRepository<Equip, Equip.EquipId> {
|
||||
|
||||
Equip findFirstByOrderByEquKeyDesc();
|
||||
|
||||
List<Equip> findByEquKeyOrderByWrtDtDesc(Integer equKey);
|
||||
|
||||
void deleteByEquKey(Integer equKey);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.dbnt.faisp.equip.repository;
|
||||
|
||||
import com.dbnt.faisp.equip.model.UseList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
|
||||
|
||||
public interface UseListRepository extends JpaRepository<UseList, UseList.UseListId> {
|
||||
|
||||
List<UseList> findByMgtOrganAndUseNoAndUseTypeOrderByVersionNoDesc(String mgtOrgan, String useNo, String useType);
|
||||
|
||||
void deleteByMgtOrganAndUseNoAndUseType(String mgtOrgan, String useNo, String useType);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,396 @@
|
|||
package com.dbnt.faisp.equip.service;
|
||||
|
||||
|
||||
import com.dbnt.faisp.equip.mapper.EquipMapper;
|
||||
import com.dbnt.faisp.equip.model.CellPhone;
|
||||
import com.dbnt.faisp.equip.model.Equip;
|
||||
import com.dbnt.faisp.equip.model.Equip.EquipId;
|
||||
import com.dbnt.faisp.equip.model.EquipFile;
|
||||
import com.dbnt.faisp.equip.model.EquipFile.EquipFileId;
|
||||
import com.dbnt.faisp.equip.model.EquipLog;
|
||||
import com.dbnt.faisp.equip.model.UseList;
|
||||
import com.dbnt.faisp.equip.model.UseList.UseListId;
|
||||
import com.dbnt.faisp.equip.repository.CellPhoneRepository;
|
||||
import com.dbnt.faisp.equip.repository.EquipFileRepository;
|
||||
import com.dbnt.faisp.equip.repository.EquipLogRepository;
|
||||
import com.dbnt.faisp.equip.repository.EquipRepository;
|
||||
import com.dbnt.faisp.equip.repository.UseListRepository;
|
||||
import com.dbnt.faisp.userInfo.model.UserInfo;
|
||||
import com.dbnt.faisp.util.ParamMap;
|
||||
import com.dbnt.faisp.util.Utils;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class EquipService {
|
||||
@Value("${spring.servlet.multipart.location}")
|
||||
protected String locationPath;
|
||||
|
||||
private final EquipRepository equipRepository;
|
||||
private final EquipFileRepository equipFileRepository;
|
||||
private final EquipLogRepository equipLogRepository;
|
||||
private final CellPhoneRepository cellPhoneRepository;
|
||||
private final UseListRepository useListRepository;
|
||||
private final EquipMapper equipMapper;
|
||||
|
||||
SimpleDateFormat Date = new SimpleDateFormat("yyyy");
|
||||
String year = Date.format(new Date());
|
||||
|
||||
|
||||
@Transactional
|
||||
public void saveEquip(Equip equip, MultipartHttpServletRequest request) {
|
||||
Equip dbEquip = equipRepository.findFirstByOrderByEquKeyDesc();
|
||||
try {
|
||||
if(dbEquip == null) {
|
||||
equip.setEquKey(1);
|
||||
equip.setVersionNo(1);
|
||||
equipRepository.save(equip);
|
||||
} else {
|
||||
equip.setEquKey(dbEquip.getEquKey()+1);
|
||||
equip.setVersionNo(1);
|
||||
equipRepository.save(equip);
|
||||
}
|
||||
saveFile(equip,request);
|
||||
EquipLog equLog = new EquipLog();
|
||||
equLog.setEquType(equip.getEquType());
|
||||
equLog.setDetailType(equip.getDetailType());
|
||||
equLog.setElContents("입력");
|
||||
equLog.setWrtNm(equip.getWrtNm());
|
||||
equLog.setWrtOrgan(equip.getWrtOrgan());
|
||||
equLog.setWrtDt(equip.getWrtDt());
|
||||
equipLogRepository.save(equLog);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void saveFile(Equip equip, MultipartHttpServletRequest mRequest) throws Exception {
|
||||
try {
|
||||
String path = locationPath;
|
||||
String FileSize;
|
||||
File dir = new File(path);
|
||||
if(!dir.exists()) dir.mkdir();
|
||||
//파일등록
|
||||
List<MultipartFile> mFiles = mRequest.getFiles("file");
|
||||
for(int i = 0; i < mFiles.size(); i++) {
|
||||
MultipartFile mFile = mFiles.get(i);
|
||||
FileSize = calculationSize(mFile.getSize());
|
||||
if(!"".equals(mFile.getOriginalFilename())){
|
||||
String fileName = mFile.getOriginalFilename();
|
||||
if(fileName.contains("\\")){
|
||||
String notSecuredFileName = fileName.substring(fileName.lastIndexOf("\\") +1);
|
||||
fileName = ("".equals(notSecuredFileName) || null == notSecuredFileName) ? fileName : notSecuredFileName;
|
||||
};
|
||||
|
||||
String fileExt = Utils.getFileExtention(fileName);
|
||||
String saveName = Utils.generationSaveName() + "." + fileExt;
|
||||
FileCopyUtils.copy(mFile.getBytes(), new File(path, saveName));
|
||||
|
||||
EquipFile equipFile = new EquipFile();
|
||||
equipFile.setEquKey(equip.getEquKey());
|
||||
equipFile.setVersionNo(equip.getVersionNo());
|
||||
equipFile.setOrigNm(fileName);
|
||||
equipFile.setConvNm(saveName);
|
||||
equipFile.setFileExtn(fileExt);
|
||||
equipFile.setFilePath(path);
|
||||
equipFile.setFileSize(FileSize);
|
||||
|
||||
equipFileRepository.save(equipFile);
|
||||
} else {
|
||||
EquipFile equipFile = new EquipFile();
|
||||
equipFile.setEquKey(equip.getEquKey());
|
||||
equipFile.setVersionNo(equip.getVersionNo());
|
||||
equipFileRepository.save(equipFile);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private String calculationSize(double fileSize){
|
||||
String[] units = {"bytes", "KB", "MB", "GB", "TB", "PB"};
|
||||
double unitSelector = Math.floor(Math.log(fileSize)/Math.log(1024));
|
||||
if(fileSize>0){
|
||||
return Math.round((fileSize/Math.pow(1024, unitSelector))*100)/100d+" "+units[(int)unitSelector];
|
||||
}else{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public List<ParamMap> selectEquipStatus(Equip equip) {
|
||||
return equipMapper.selectEquipStatus(equip);
|
||||
}
|
||||
|
||||
public List<Equip> selectEquipList(Equip equip) {
|
||||
return equipMapper.selectEquipList(equip);
|
||||
}
|
||||
|
||||
public Integer selectEquipListCnt(Equip equip) {
|
||||
return equipMapper.selectEquipListCnt(equip);
|
||||
}
|
||||
|
||||
public Equip selectEquipInfo(Equip equip) {
|
||||
return equipMapper.selectEquipInfo(equip);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public int updateEquip(Equip equip, MultipartHttpServletRequest request) {
|
||||
try {
|
||||
Equip dbEquip = equipRepository.findById(new EquipId(equip.getEquKey(), equip.getVersionNo())).orElse(null);
|
||||
Equip equipTmp = new Equip();
|
||||
equipTmp.setEquKey(dbEquip.getEquKey());
|
||||
equipTmp.setVersionNo(dbEquip.getVersionNo()+1);
|
||||
equipTmp.setMgtOrgan(equip.getMgtOrgan());
|
||||
equipTmp.setEquType(equip.getEquType());
|
||||
equipTmp.setDetailType(equip.getDetailType());
|
||||
equipTmp.setStoredYear(equip.getStoredYear());
|
||||
equipTmp.setItemQty(equip.getItemQty());
|
||||
equipTmp.setItemCondition(equip.getItemCondition());
|
||||
equipTmp.setNote(equip.getNote());
|
||||
equipTmp.setWrtOrgan(equip.getWrtOrgan());
|
||||
equipTmp.setWrtNm(equip.getWrtNm());
|
||||
equipTmp.setWrtDt(equip.getWrtDt());
|
||||
equipRepository.save(equipTmp);
|
||||
updateFile(equip,equipTmp,request);
|
||||
EquipLog equLog = new EquipLog();
|
||||
equLog.setEquType(equip.getEquType());
|
||||
equLog.setDetailType(equip.getDetailType());
|
||||
equLog.setElContents("수정");
|
||||
equLog.setWrtNm(equip.getWrtNm());
|
||||
equLog.setWrtOrgan(equip.getWrtOrgan());
|
||||
equLog.setWrtDt(equip.getWrtDt());
|
||||
equipLogRepository.save(equLog);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return equip.getEquKey();
|
||||
}
|
||||
|
||||
public void updateFile(Equip equip,Equip equipTmp, MultipartHttpServletRequest mRequest) throws Exception {
|
||||
try {
|
||||
String path = locationPath;
|
||||
String FileSize;
|
||||
File dir = new File(path);
|
||||
if(!dir.exists()) dir.mkdir();
|
||||
|
||||
//이미지 삭제했을경우
|
||||
if(equip.getDeleteFileKey() != null) {
|
||||
EquipFile equFile = new EquipFile();
|
||||
equFile.setEquKey(equip.getDeleteFileKey());
|
||||
equFile.setVersionNo(equip.getDeleteFileVnum());
|
||||
EquipFile dbEquFile = equipFileRepository.findById(new EquipFileId(equFile.getEquKey(), equFile.getVersionNo())).orElse(null);
|
||||
if(dbEquFile != null) {
|
||||
File file = new File(dbEquFile.getFilePath(), dbEquFile.getConvNm());
|
||||
|
||||
if(file.exists()) {
|
||||
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
//파일등록
|
||||
List<MultipartFile> mFiles = mRequest.getFiles("file");
|
||||
for(int i = 0; i < mFiles.size(); i++) {
|
||||
MultipartFile mFile = mFiles.get(i);
|
||||
FileSize = calculationSize(mFile.getSize());
|
||||
if(!"".equals(mFile.getOriginalFilename())){
|
||||
String fileName = mFile.getOriginalFilename();
|
||||
if(fileName.contains("\\")){
|
||||
String notSecuredFileName = fileName.substring(fileName.lastIndexOf("\\") +1);
|
||||
fileName = ("".equals(notSecuredFileName) || null == notSecuredFileName) ? fileName : notSecuredFileName;
|
||||
};
|
||||
|
||||
String fileExt = Utils.getFileExtention(fileName);
|
||||
String saveName = Utils.generationSaveName() + "." + fileExt;
|
||||
FileCopyUtils.copy(mFile.getBytes(), new File(path, saveName));
|
||||
|
||||
EquipFile equipFile = new EquipFile();
|
||||
equipFile.setEquKey(equipTmp.getEquKey());
|
||||
equipFile.setVersionNo(equipTmp.getVersionNo());
|
||||
equipFile.setOrigNm(fileName);
|
||||
equipFile.setConvNm(saveName);
|
||||
equipFile.setFileExtn(fileExt);
|
||||
equipFile.setFilePath(path);
|
||||
equipFile.setFileSize(FileSize);
|
||||
|
||||
equipFileRepository.save(equipFile);
|
||||
} else if(equip.getNoUpdateImg() != null) {
|
||||
EquipFile equipFile = new EquipFile();
|
||||
equipFile.setEquKey(equipTmp.getEquKey());
|
||||
equipFile.setVersionNo(equipTmp.getVersionNo());
|
||||
EquipFile dbEquFile = equipFileRepository.findById(new EquipFileId(equip.getEquKey(), equip.getVersionNo())).orElse(null);
|
||||
equipFile.setOrigNm(dbEquFile.getOrigNm());
|
||||
equipFile.setConvNm(dbEquFile.getConvNm());
|
||||
equipFile.setFileExtn(dbEquFile.getFileExtn());
|
||||
equipFile.setFilePath(dbEquFile.getFilePath());
|
||||
equipFile.setFileSize(dbEquFile.getFileSize());
|
||||
equipFileRepository.save(equipFile);
|
||||
} else {
|
||||
EquipFile equipFile = new EquipFile();
|
||||
equipFile.setEquKey(equipTmp.getEquKey());
|
||||
equipFile.setVersionNo(equipTmp.getVersionNo());
|
||||
equipFileRepository.save(equipFile);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public ParamMap selectEduType(Equip equip) {
|
||||
return equipMapper.selectEduType(equip);
|
||||
}
|
||||
|
||||
public List<Equip> selectHistoryView(Equip equip) {
|
||||
return equipRepository.findByEquKeyOrderByWrtDtDesc(equip.getEquKey());
|
||||
}
|
||||
|
||||
public Equip selectHistoryDetail(Equip equip) {
|
||||
return equipMapper.selectHistoryDetail(equip);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void equipDelete(List<Equip> equip,UserInfo loginUser) {
|
||||
for(Equip equ: equip) {
|
||||
//파일삭제
|
||||
Equip dbEquip = equipMapper.selectEquipInfo(equ);
|
||||
if(dbEquip.getOrigNm() != null) {
|
||||
File file = new File(dbEquip.getFilePath(), dbEquip.getConvNm());
|
||||
|
||||
if(file.exists()) {
|
||||
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
equipRepository.deleteByEquKey(equ.getEquKey());
|
||||
equipFileRepository.deleteByEquKey(equ.getEquKey());
|
||||
EquipLog equLog = new EquipLog();
|
||||
equLog.setEquType(dbEquip.getEquType());
|
||||
equLog.setDetailType(dbEquip.getDetailType());
|
||||
equLog.setElContents("삭제");
|
||||
equLog.setWrtNm(loginUser.getUserId());
|
||||
equLog.setWrtOrgan(loginUser.getOgCd());
|
||||
equLog.setWrtDt(LocalDateTime.now());
|
||||
equipLogRepository.save(equLog);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<EquipLog> selectEquipLogList(EquipLog equipLog) {
|
||||
return equipMapper.selectEquipLogList(equipLog);
|
||||
}
|
||||
|
||||
public Integer selectEquipLogListCnt(EquipLog equipLog) {
|
||||
return equipMapper.selectEquipLogListCnt(equipLog);
|
||||
}
|
||||
|
||||
public String selectEquipFirstId(Equip equip) {
|
||||
return equipMapper.selectEquipFirstId(equip);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Integer saveCellPhone(CellPhone cellPhone) {
|
||||
return cellPhoneRepository.save(cellPhone).getPhoneKey();
|
||||
}
|
||||
|
||||
public List<CellPhone> selectCellPhoneList(CellPhone cellPhone) {
|
||||
return equipMapper.selectCellPhoneList(cellPhone);
|
||||
}
|
||||
|
||||
public Integer selectCellPhoneListCnt(CellPhone cellPhone) {
|
||||
return equipMapper.selectCellPhoneListCnt(cellPhone);
|
||||
}
|
||||
|
||||
public CellPhone selectCellPhoneInfo(Integer phoneKey) {
|
||||
return cellPhoneRepository.findById(phoneKey).orElse(null);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void deleteCellPhone(List<CellPhone> cellPhone) {
|
||||
cellPhoneRepository.deleteAll(cellPhone);
|
||||
}
|
||||
|
||||
public List<ParamMap> selectOrganList(UseList useList) {
|
||||
return equipMapper.selectOrganList(useList);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void saveUse(UseList useList) {
|
||||
useList.setYear(year);
|
||||
Integer useNo = equipMapper.selectLastUseNo(useList);
|
||||
if(useNo == null) {
|
||||
useList.setUseNo(year+"-001");
|
||||
useList.setVersionNo(1);
|
||||
} else {
|
||||
useList.setUseNo(year+"-"+String.format("%03d", useNo+1));
|
||||
useList.setVersionNo(1);
|
||||
}
|
||||
useListRepository.save(useList);
|
||||
|
||||
}
|
||||
|
||||
public List<UseList> selectUseList(UseList useList) {
|
||||
return equipMapper.selectUseList(useList);
|
||||
}
|
||||
|
||||
public Integer selectUseListCnt(UseList useList) {
|
||||
return equipMapper.selectUseListCnt(useList);
|
||||
}
|
||||
|
||||
public UseList selectUseInfo(UseList useList) {
|
||||
return equipMapper.selectUseInfo(useList);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public UseList updateUse(UseList useList) {
|
||||
UseList dbUseList = useListRepository
|
||||
.findById(new UseListId(useList.getMgtOrgan(),useList.getUseNo(),useList.getVersionNo(),useList.getUseType())).orElse(null);
|
||||
UseList useTmp = new UseList();
|
||||
useTmp.setMgtOrgan(dbUseList.getMgtOrgan());
|
||||
useTmp.setUseNo(dbUseList.getUseNo());
|
||||
useTmp.setVersionNo(dbUseList.getVersionNo()+1);
|
||||
useTmp.setUseType(dbUseList.getUseType());
|
||||
useTmp.setUseDt(useList.getUseDt());
|
||||
useTmp.setDetailType(useList.getDetailType());
|
||||
useTmp.setDetailSelf(useList.getDetailSelf());
|
||||
useTmp.setPeopleCnt(useList.getPeopleCnt());
|
||||
useTmp.setDescription(useList.getDescription());
|
||||
useTmp.setWrtOrgan(useList.getWrtOrgan());
|
||||
useTmp.setWrtPart(useList.getWrtPart());
|
||||
useTmp.setWrtUserSeq(useList.getWrtUserSeq());
|
||||
useTmp.setWrtNm(useList.getWrtNm());
|
||||
useTmp.setWrtDt(useList.getWrtDt());
|
||||
return useListRepository.save(useTmp);
|
||||
|
||||
}
|
||||
|
||||
public List<UseList> selectUseInfoList(UseList useList) {
|
||||
return useListRepository.findByMgtOrganAndUseNoAndUseTypeOrderByVersionNoDesc(useList.getMgtOrgan(),useList.getUseNo(),useList.getUseType());
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void useDelete(List<UseList> useList) {
|
||||
for(UseList use:useList) {
|
||||
useListRepository.deleteByMgtOrganAndUseNoAndUseType(use.getMgtOrgan(),use.getUseNo(),use.getUseType());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
package com.dbnt.faisp.faRpt;
|
||||
|
||||
import com.dbnt.faisp.authMgt.service.AuthMgtService;
|
||||
import com.dbnt.faisp.faRpt.model.FaRptBoard;
|
||||
import com.dbnt.faisp.faRpt.service.FaRptService;
|
||||
import com.dbnt.faisp.fpiMgt.affairPlan.model.PlanBoard;
|
||||
import com.dbnt.faisp.userInfo.model.UserInfo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/faRpt")
|
||||
public class FaRptController {
|
||||
private final FaRptService faRptService;
|
||||
private final AuthMgtService authMgtService;
|
||||
|
||||
@GetMapping("/faRptBoard")
|
||||
public ModelAndView faRptBoard(@AuthenticationPrincipal UserInfo loginUser, FaRptBoard faRptBoard){
|
||||
ModelAndView mav;
|
||||
if(faRptBoard.getDashboardFlag()){
|
||||
mav = new ModelAndView("/faRpt/faRptDashboard");
|
||||
faRptBoard.setRowCnt(5);
|
||||
}else{
|
||||
mav = new ModelAndView("/faRpt/faRptBoard");
|
||||
}
|
||||
if(faRptBoard.getActiveTab()==null){
|
||||
faRptBoard.setActiveTab("send");
|
||||
}
|
||||
mav.addObject("searchUrl", "/faRpt/faRptBoard");
|
||||
String accessAuth = authMgtService.selectAccessConfigList
|
||||
(loginUser.getUserSeq(), "/affairPlan/planMgt").get(0).getAccessAuth();
|
||||
mav.addObject("accessAuth", accessAuth);
|
||||
|
||||
if(faRptBoard.getActiveTab().equals("send")){
|
||||
faRptBoard.setWrtUserSeq(loginUser.getUserSeq());
|
||||
}else if(faRptBoard.getActiveTab().equals("receive")){
|
||||
faRptBoard.setReceiveUserSeq(loginUser.getUserSeq());
|
||||
}else if(faRptBoard.getActiveTab().equals("all") && accessAuth.equals("ACC003")){
|
||||
faRptBoard.setDownOrganCdList(loginUser.getDownOrganCdList());
|
||||
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
|
||||
}else if(faRptBoard.getActiveTab().equals("all")){
|
||||
faRptBoard.setActiveTab("send");
|
||||
faRptBoard.setWrtUserSeq(loginUser.getUserSeq());
|
||||
}
|
||||
|
||||
faRptBoard.setQueryInfo();
|
||||
mav.addObject("faRptList", faRptService.selectFaRptList(faRptBoard));
|
||||
faRptBoard.setContentCnt(faRptService.selectFaRptCnt(faRptBoard));
|
||||
faRptBoard.setPaginationInfo();
|
||||
mav.addObject("searchParams", faRptBoard);
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/faRptEditModal")
|
||||
public ModelAndView faRptEditModal(@AuthenticationPrincipal UserInfo loginUser, FaRptBoard faRptBoard){
|
||||
ModelAndView mav = new ModelAndView("faRpt/faRptEditModal");
|
||||
if(faRptBoard.getFaRptKey()!=null){
|
||||
faRptBoard = faRptService.selectFaRptBoard(faRptBoard.getFaRptKey());
|
||||
}else{
|
||||
faRptBoard.setWrtOrgan(loginUser.getOgCd());
|
||||
faRptBoard.setWrtPart(loginUser.getOfcCd());
|
||||
faRptBoard.setWrtUserSeq(loginUser.getUserSeq());
|
||||
faRptBoard.setWrtUserGrd(loginUser.getTitleCd());
|
||||
faRptBoard.setWrtUserNm(loginUser.getUserNm());
|
||||
faRptBoard.setWrtDt(LocalDateTime.now());
|
||||
}
|
||||
mav.addObject("faRpt", faRptBoard);
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/faRptViewModal")
|
||||
public ModelAndView faRptViewModal(@AuthenticationPrincipal UserInfo loginUser, FaRptBoard faRptBoard){
|
||||
ModelAndView mav = new ModelAndView("faRpt/faRptViewModal");
|
||||
faRptBoard = faRptService.selectFaRptBoard(faRptBoard.getFaRptKey());
|
||||
mav.addObject("faRpt", faRptBoard);
|
||||
mav.addObject("userSeq",loginUser.getUserSeq());
|
||||
//메뉴권한 확인
|
||||
mav.addObject("accessAuth", authMgtService.selectAccessConfigList
|
||||
(loginUser.getUserSeq(), "/faRpt/faRptBoard").get(0).getAccessAuth());
|
||||
return mav;
|
||||
}
|
||||
|
||||
@PostMapping("/savePlan")
|
||||
public Integer saveFaRpt(FaRptBoard faRptBoard,
|
||||
MultipartHttpServletRequest request,
|
||||
@RequestParam(value = "fileSeq", required = false) List<Integer> deleteFileSeq){
|
||||
faRptBoard.setMultipartFileList(request.getMultiFileMap().get("uploadFiles"));
|
||||
return faRptService.saveFaRptBoard(faRptBoard, deleteFileSeq);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.dbnt.faisp.faRpt.mapper;
|
||||
|
||||
import com.dbnt.faisp.faRpt.model.FaRptBoard;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Mapper
|
||||
public interface FaRptMapper {
|
||||
|
||||
List<FaRptBoard> selectFaRptList(FaRptBoard faRptBoard);
|
||||
|
||||
Integer selectFaRptCnt(FaRptBoard faRptBoard);
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
package com.dbnt.faisp.faRpt.model;
|
||||
|
||||
import com.dbnt.faisp.config.BaseModel;
|
||||
import com.dbnt.faisp.publicBoard.model.PublicComment;
|
||||
import com.dbnt.faisp.publicBoard.model.PublicFile;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "fa_rpt_board")
|
||||
public class FaRptBoard extends BaseModel {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "fa_rpt_key")
|
||||
private Integer faRptKey;
|
||||
@Column(name = "fa_rpt_type")
|
||||
private String faRptType;
|
||||
@Column(name = "title")
|
||||
private String title;
|
||||
@Column(name = "content")
|
||||
private String content;
|
||||
@Column(name = "status")
|
||||
private String status;
|
||||
@Column(name = "wrt_organ")
|
||||
private String wrtOrgan;
|
||||
@Column(name = "wrt_part")
|
||||
private String wrtPart;
|
||||
@Column(name = "wrt_user_seq")
|
||||
private Integer wrtUserSeq;
|
||||
@Column(name = "wrt_user_grd")
|
||||
private String wrtUserGrd;
|
||||
@Column(name = "wrt_user_nm")
|
||||
private String wrtUserNm;
|
||||
@Column(name = "wrt_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private LocalDateTime wrtDt;
|
||||
@Column(name = "ref_key")
|
||||
private Integer refKey;
|
||||
|
||||
@Transient
|
||||
private Integer receiveUserSeq;
|
||||
@Transient
|
||||
private String activeTab;
|
||||
@Transient
|
||||
private Integer fileCnt;
|
||||
@Transient
|
||||
private List<FaRptFile> fileList;
|
||||
@Transient
|
||||
private List<FaRptReadUser> readUserList;
|
||||
@Transient
|
||||
private List<MultipartFile> multipartFileList;
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package com.dbnt.faisp.faRpt.model;
|
||||
|
||||
import com.dbnt.faisp.config.FileInfo;
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "fa_rpt_file")
|
||||
@IdClass(FaRptFile.FaRptFileId.class)
|
||||
public class FaRptFile extends FileInfo {
|
||||
@Id
|
||||
@Column(name = "fa_rpt_key")
|
||||
private Integer faRptKey;
|
||||
@Id
|
||||
@Column(name = "file_seq")
|
||||
private Integer fileSeq;
|
||||
@Column(name = "orig_nm")
|
||||
private String origNm;
|
||||
@Column(name = "conv_nm")
|
||||
private String convNm;
|
||||
@Column(name = "file_extn")
|
||||
private String fileExtn;
|
||||
@Column(name = "file_size")
|
||||
private String fileSize;
|
||||
@Column(name = "save_path")
|
||||
private String savePath;
|
||||
|
||||
|
||||
@Embeddable
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class FaRptFileId implements Serializable {
|
||||
private Integer faRptKey;
|
||||
private Integer fileSeq;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package com.dbnt.faisp.faRpt.model;
|
||||
|
||||
import com.dbnt.faisp.config.FileInfo;
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "fa_rpt_read_user")
|
||||
@IdClass(FaRptReadUser.FaRptReadUserId.class)
|
||||
public class FaRptReadUser extends FileInfo {
|
||||
@Id
|
||||
@Column(name = "fa_rpt_key")
|
||||
private Integer faRptKey;
|
||||
@Id
|
||||
@Column(name = "user_seq")
|
||||
private Integer userSeq;
|
||||
@Column(name = "read_yn")
|
||||
private String readYn;
|
||||
@Column(name = "og_cd")
|
||||
private String ogCd;
|
||||
@Column(name = "ofc_cd")
|
||||
private String ofcCd;
|
||||
@Column(name = "title_cd")
|
||||
private String titleCd;
|
||||
@Column(name = "user_nm")
|
||||
private String userNm;
|
||||
|
||||
|
||||
@Embeddable
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class FaRptReadUserId implements Serializable {
|
||||
private Integer faRptKey;
|
||||
private Integer userSeq;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.dbnt.faisp.faRpt.repository;
|
||||
|
||||
import com.dbnt.faisp.faRpt.model.FaRptBoard;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
|
||||
public interface FaRptBoardRepository extends JpaRepository<FaRptBoard, Integer> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.dbnt.faisp.faRpt.repository;
|
||||
|
||||
import com.dbnt.faisp.faRpt.model.FaRptFile;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
public interface FaRptFileRepository extends JpaRepository<FaRptFile, FaRptFile.FaRptFileId> {
|
||||
List<FaRptFile> findByFaRptKey(Integer faRptKey);
|
||||
Optional<FaRptFile> findTopByFaRptKeyOrderByFileSeq(Integer faRptKey);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.dbnt.faisp.faRpt.repository;
|
||||
|
||||
import com.dbnt.faisp.faRpt.model.FaRptReadUser;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface FaRptReadUserRepository extends JpaRepository<FaRptReadUser, FaRptReadUser.FaRptReadUserId> {
|
||||
List<FaRptReadUser> findByFaRptKey(Integer faRptKey);
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
package com.dbnt.faisp.faRpt.service;
|
||||
|
||||
import com.dbnt.faisp.config.BaseService;
|
||||
import com.dbnt.faisp.config.FileInfo;
|
||||
import com.dbnt.faisp.faRpt.mapper.FaRptMapper;
|
||||
import com.dbnt.faisp.faRpt.model.FaRptBoard;
|
||||
import com.dbnt.faisp.faRpt.model.FaRptReadUser;
|
||||
import com.dbnt.faisp.faRpt.repository.FaRptBoardRepository;
|
||||
import com.dbnt.faisp.faRpt.repository.FaRptFileRepository;
|
||||
import com.dbnt.faisp.faRpt.repository.FaRptReadUserRepository;
|
||||
import com.dbnt.faisp.publicBoard.model.PublicBoard;
|
||||
import com.dbnt.faisp.publicBoard.model.PublicComment;
|
||||
import com.dbnt.faisp.publicBoard.model.PublicFile;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class FaRptService extends BaseService {
|
||||
private final FaRptBoardRepository faRptBoardRepository;
|
||||
private final FaRptFileRepository faRptFileRepository;
|
||||
private final FaRptReadUserRepository faRptReadUserRepository;
|
||||
private final FaRptMapper faRptMapper;
|
||||
|
||||
|
||||
public List<FaRptBoard> selectFaRptList(FaRptBoard faRptBoard) {
|
||||
return faRptMapper.selectFaRptList(faRptBoard);
|
||||
}
|
||||
|
||||
public Integer selectFaRptCnt(FaRptBoard faRptBoard) {
|
||||
return faRptMapper.selectFaRptCnt(faRptBoard);
|
||||
}
|
||||
|
||||
public Integer saveFaRptBoard(FaRptBoard faRptBoard, List<Integer> deleteFileSeq) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public FaRptBoard selectFaRptBoard(Integer faRptKey) {
|
||||
FaRptBoard faRptBoard = faRptBoardRepository.findById(faRptKey).orElse(null);
|
||||
faRptBoard.setFileList(faRptFileRepository.findByFaRptKey(faRptKey));
|
||||
faRptBoard.setReadUserList(faRptReadUserRepository.findByFaRptKey(faRptKey));
|
||||
return faRptBoard;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
package com.dbnt.faisp.faStatistics.internationalCrimeArrest;
|
||||
|
||||
import com.dbnt.faisp.authMgt.service.AuthMgtService;
|
||||
import com.dbnt.faisp.codeMgt.model.CodeMgt;
|
||||
import com.dbnt.faisp.codeMgt.service.CodeMgtService;
|
||||
import com.dbnt.faisp.faStatistics.internationalCrimeArrest.model.InternationalCrimeArrest;
|
||||
import com.dbnt.faisp.faStatistics.internationalCrimeArrest.repository.SuspectPersonInfoRepository;
|
||||
import com.dbnt.faisp.faStatistics.internationalCrimeArrest.service.InternationalCrimeArrestService;
|
||||
import com.dbnt.faisp.organMgt.model.OrganConfig;
|
||||
import com.dbnt.faisp.organMgt.service.OrganConfigService;
|
||||
import com.dbnt.faisp.userInfo.model.UserInfo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/faStatistics")
|
||||
public class InternationalCrimeArrestController {
|
||||
|
||||
private final AuthMgtService authMgtService;
|
||||
private final InternationalCrimeArrestService internationalCrimeArrestService;
|
||||
private final CodeMgtService codeMgtService;
|
||||
private final OrganConfigService organConfigService;
|
||||
private final SuspectPersonInfoRepository suspectPersonInfoRepository;
|
||||
|
||||
@GetMapping("/internationalCrimeArrest")
|
||||
public ModelAndView internationalCrimeArrest(@AuthenticationPrincipal UserInfo loginUser,InternationalCrimeArrest internationalCrimeArrest) {
|
||||
ModelAndView mav = new ModelAndView("faStatistics/internationalCrimeArrest/internationalCrimeArrest");
|
||||
|
||||
//메뉴권한 확인
|
||||
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/faStatistics/internationalCrimeArrest").get(0).getAccessAuth();
|
||||
|
||||
mav.addObject("accessAuth", accessAuth);
|
||||
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
|
||||
|
||||
internationalCrimeArrest.setQueryInfo();
|
||||
List<InternationalCrimeArrest> internationalCrimeArrestList = internationalCrimeArrestService.selectInternationalCrimeArrestList(internationalCrimeArrest);
|
||||
|
||||
for (InternationalCrimeArrest ica:internationalCrimeArrestList) {
|
||||
ica.setSuspectPersonInfoList(suspectPersonInfoRepository.findByIcaKey(ica.getIcaKey()));
|
||||
}
|
||||
|
||||
mav.addObject("internationalCrimeArrestList", internationalCrimeArrestList);
|
||||
internationalCrimeArrest.setContentCnt(internationalCrimeArrestService.selectInternationalCrimeArrestListCnt(internationalCrimeArrest));
|
||||
internationalCrimeArrest.setPaginationInfo();
|
||||
mav.addObject("organConfigList", selectOrganList());
|
||||
mav.addObject("searchParams", internationalCrimeArrest);
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/internationalCrimeArrest/internationalCrimeArrestEditModal")
|
||||
public ModelAndView internationalCrimeArrestEditModal(@AuthenticationPrincipal UserInfo loginUser, InternationalCrimeArrest internationalCrimeArrest){
|
||||
ModelAndView mav = new ModelAndView("faStatistics/internationalCrimeArrest/internationalCrimeArrestEditModal");
|
||||
if(internationalCrimeArrest.getIcaKey()!=null){
|
||||
internationalCrimeArrest = internationalCrimeArrestService.selectInternationalCrimeArrest(internationalCrimeArrest.getIcaKey());
|
||||
}else{
|
||||
internationalCrimeArrest.setWrtOrgan(loginUser.getOgCd());
|
||||
internationalCrimeArrest.setWrtNm(loginUser.getUserNm());
|
||||
internationalCrimeArrest.setWrtDt(LocalDateTime.now());
|
||||
internationalCrimeArrest.setSuspectPersonInfoList(suspectPersonInfoRepository.findByIcaKey(internationalCrimeArrest.getIcaKey()));
|
||||
}
|
||||
mav.addObject("organConfigList", selectOrganList());
|
||||
mav.addObject("internationalCrimeArrest", internationalCrimeArrest);
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/internationalCrimeArrest/internationalCrimeArrestViewModal")
|
||||
public ModelAndView internationalCrimeArrestViewModal(@AuthenticationPrincipal UserInfo loginUser, InternationalCrimeArrest internationalCrimeArrest){
|
||||
ModelAndView mav = new ModelAndView("faStatistics/internationalCrimeArrest/internationalCrimeArrestViewModal");
|
||||
internationalCrimeArrest = internationalCrimeArrestService.selectInternationalCrimeArrest(internationalCrimeArrest.getIcaKey());
|
||||
mav.addObject("internationalCrimeArrest", internationalCrimeArrest);
|
||||
mav.addObject("userSeq",loginUser.getUserSeq());
|
||||
mav.addObject("organConfigList", selectOrganList());
|
||||
//메뉴권한 확인
|
||||
mav.addObject("accessAuth", authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/faStatistics/internationalCrimeArrest").get(0).getAccessAuth());
|
||||
return mav;
|
||||
}
|
||||
|
||||
@PostMapping("/internationalCrimeArrest/saveInternationalCrimeArrest")
|
||||
public Integer saveInternationalCrimeArrest(@AuthenticationPrincipal UserInfo loginUser,
|
||||
InternationalCrimeArrest internationalCrimeArrest){
|
||||
internationalCrimeArrest.setWrtUserSeq(loginUser.getUserSeq());
|
||||
return internationalCrimeArrestService.savedInternationalCrimeArrest(internationalCrimeArrest);
|
||||
}
|
||||
|
||||
public List<OrganConfig> selectOrganList(){
|
||||
List<CodeMgt> organCdList = codeMgtService.selectCodeMgtList("OG");
|
||||
List<OrganConfig> organConfigList = organConfigService.selectSavedOrganList();
|
||||
for(CodeMgt organCode: organCdList){
|
||||
if(!organCode.getItemCd().equals("OG001")){
|
||||
boolean usedFlag = false;
|
||||
for(OrganConfig organConfig: organConfigList){
|
||||
if(organCode.getItemCd().equals(organConfig.getOrganCd())){
|
||||
usedFlag = true;
|
||||
organConfig.setOrganNm(organCode.getItemValue());
|
||||
organConfig.setUseState("T");
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!usedFlag){
|
||||
OrganConfig organConfig = new OrganConfig();
|
||||
organConfig.setOrganCd(organCode.getItemCd());
|
||||
organConfig.setOrganNm(organCode.getItemValue());
|
||||
organConfig.setUseState("F");
|
||||
organConfigList.add(organConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
return organConfigList;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.dbnt.faisp.faStatistics.internationalCrimeArrest.mapper;
|
||||
|
||||
import com.dbnt.faisp.faStatistics.internationalCrimeArrest.model.InternationalCrimeArrest;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface InternationalCrimeArrestMapper{
|
||||
List<InternationalCrimeArrest> selectInternationalCrimeArrestList(InternationalCrimeArrest internationalCrimeArrest);
|
||||
Integer selectInternationalCrimeArrestListCnt(InternationalCrimeArrest internationalCrimeArrest);
|
||||
}
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
package com.dbnt.faisp.faStatistics.internationalCrimeArrest.model;
|
||||
|
||||
import com.dbnt.faisp.config.BaseModel;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "international_crime_arrest")
|
||||
public class InternationalCrimeArrest extends BaseModel {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "ica_key")
|
||||
private Integer icaKey;
|
||||
@Column(name = "organ")
|
||||
private String organ;
|
||||
@Column(name = "department")
|
||||
private String department;
|
||||
@Column(name = "crime_type")
|
||||
private String crimeType;
|
||||
@Column(name = "violation_type")
|
||||
private String violationType;
|
||||
@Column(name = "crime_name")
|
||||
private String crimeName;
|
||||
@Column(name = "smuggling_amount")
|
||||
private String smugglingAmount;
|
||||
@Column(name = "occur_table")
|
||||
private String occurTable;
|
||||
@Column(name = "arrest_table")
|
||||
private String arrestTable;
|
||||
@Column(name = "suspect_table")
|
||||
private String suspectTable;
|
||||
@Column(name = "crime_awareness_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate crimeAwarenessDt;
|
||||
@Column(name = "case_sent_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate caseSentDt;
|
||||
@Column(name = "process_result")
|
||||
private String processResult;
|
||||
@Column(name = "other_crime")
|
||||
private String otherCrime;
|
||||
@Column(name = "case_num")
|
||||
private String caseNum;
|
||||
@Column(name = "case_overview")
|
||||
private String caseOverview;
|
||||
@Column(name = "sea_area")
|
||||
private String seaArea;
|
||||
@Column(name = "arrest_area")
|
||||
private String arrestArea;
|
||||
@Column(name = "means")
|
||||
private String means;
|
||||
@Column(name = "purpose")
|
||||
private String purpose;
|
||||
@Column(name = "smuggled_goods")
|
||||
private String smuggledGoods;
|
||||
@Column(name = "crackdown_personel")
|
||||
private Integer crackdownPersonel;
|
||||
@Column(name = "violation_amount")
|
||||
private String violationAmount;
|
||||
@Column(name = "destination")
|
||||
private String destination;
|
||||
@Column(name = "content_status")
|
||||
private String contentStatus;
|
||||
@Column(name = "crime_form")
|
||||
private String crimeForm;
|
||||
@Column(name = "wrt_organ")
|
||||
private String wrtOrgan;
|
||||
@Column(name = "wrt_user_seq")
|
||||
private Integer wrtUserSeq;
|
||||
@Column(name = "wrt_nm")
|
||||
private String wrtNm;
|
||||
@Column(name = "wrt_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private LocalDateTime wrtDt;
|
||||
|
||||
@Transient
|
||||
private List<SuspectPersonInfo> suspectPersonInfoList;
|
||||
@Transient
|
||||
private List<Integer> deleteSpiKeyList;
|
||||
@Transient
|
||||
private String processResultEtc;
|
||||
@Transient
|
||||
private String smuggledGoodsEtc;
|
||||
@Transient
|
||||
private String meansEtc;
|
||||
@Transient
|
||||
private String purposesEtc;
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package com.dbnt.faisp.faStatistics.internationalCrimeArrest.model;
|
||||
|
||||
import com.dbnt.faisp.config.BaseModel;
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "suspect_person_info")
|
||||
public class SuspectPersonInfo extends BaseModel {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "spi_key")
|
||||
private Integer spiKey;
|
||||
@Column(name = "ica_key")
|
||||
private Integer icaKey;
|
||||
@Column(name = "sex")
|
||||
private String sex;
|
||||
@Column(name = "age")
|
||||
private String age;
|
||||
@Column(name = "country")
|
||||
private String country;
|
||||
@Column(name = "stay_qualification")
|
||||
private String stayQualification;
|
||||
@Column(name = "stay_period_expired_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDateTime stayPeriodExpiredDt;
|
||||
@Column(name = "entry_visa")
|
||||
private String entryVisa;
|
||||
|
||||
@Transient
|
||||
private List<Integer> icaKeyList;
|
||||
@Transient
|
||||
private List<Integer> spiKeyList;
|
||||
@Transient
|
||||
private String countryEtc;
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.dbnt.faisp.faStatistics.internationalCrimeArrest.repository;
|
||||
|
||||
import com.dbnt.faisp.faStatistics.internationalCrimeArrest.model.InternationalCrimeArrest;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface InternationalCrimeArrestRepository extends JpaRepository<InternationalCrimeArrest, Integer> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.dbnt.faisp.faStatistics.internationalCrimeArrest.repository;
|
||||
|
||||
import com.dbnt.faisp.faStatistics.internationalCrimeArrest.model.SuspectPersonInfo;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface SuspectPersonInfoRepository extends JpaRepository<SuspectPersonInfo, SuspectPersonInfo> {
|
||||
List<SuspectPersonInfo> findByIcaKey(Integer icaKey);
|
||||
@Transactional
|
||||
@Modifying
|
||||
@Query("delete from SuspectPersonInfo s where s.spiKey in :idList")
|
||||
void deleteAllByIdInQuery(@Param("idList") List<Integer> deleteKeyList);
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
package com.dbnt.faisp.faStatistics.internationalCrimeArrest.service;
|
||||
|
||||
|
||||
import com.dbnt.faisp.config.BaseService;
|
||||
import com.dbnt.faisp.faStatistics.internationalCrimeArrest.mapper.InternationalCrimeArrestMapper;
|
||||
import com.dbnt.faisp.faStatistics.internationalCrimeArrest.model.InternationalCrimeArrest;
|
||||
import com.dbnt.faisp.faStatistics.internationalCrimeArrest.model.SuspectPersonInfo;
|
||||
import com.dbnt.faisp.faStatistics.internationalCrimeArrest.repository.InternationalCrimeArrestRepository;
|
||||
import com.dbnt.faisp.faStatistics.internationalCrimeArrest.repository.SuspectPersonInfoRepository;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class InternationalCrimeArrestService extends BaseService {
|
||||
private final InternationalCrimeArrestRepository internationalCrimeArrestRepository;
|
||||
private final InternationalCrimeArrestMapper internationalCrimeArrestMapper;
|
||||
private final SuspectPersonInfoRepository suspectPersonInfoRepository;
|
||||
|
||||
public List<InternationalCrimeArrest> selectInternationalCrimeArrestList(InternationalCrimeArrest InternationalCrimeArrest) {
|
||||
return internationalCrimeArrestMapper.selectInternationalCrimeArrestList(InternationalCrimeArrest);
|
||||
}
|
||||
|
||||
public Integer selectInternationalCrimeArrestListCnt(InternationalCrimeArrest internationalCrimeArrest) {
|
||||
return internationalCrimeArrestMapper.selectInternationalCrimeArrestListCnt(internationalCrimeArrest);
|
||||
}
|
||||
|
||||
public InternationalCrimeArrest selectInternationalCrimeArrest(Integer icaKey) {
|
||||
InternationalCrimeArrest savedInternationalCrimeArrest = internationalCrimeArrestRepository.findById(icaKey).orElse(null);
|
||||
if (savedInternationalCrimeArrest != null) {
|
||||
savedInternationalCrimeArrest.setSuspectPersonInfoList(suspectPersonInfoRepository.findByIcaKey(icaKey));
|
||||
}
|
||||
return savedInternationalCrimeArrest;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Integer savedInternationalCrimeArrest(InternationalCrimeArrest internationalCrimeArrest) {
|
||||
if (internationalCrimeArrest.getMeansEtc() != null) {
|
||||
internationalCrimeArrest.setMeans(internationalCrimeArrest.getMeansEtc());
|
||||
}
|
||||
if (internationalCrimeArrest.getPurposesEtc() != null) {
|
||||
internationalCrimeArrest.setPurpose(internationalCrimeArrest.getPurposesEtc());
|
||||
}
|
||||
if (internationalCrimeArrest.getSmuggledGoodsEtc() != null) {
|
||||
internationalCrimeArrest.setSmuggledGoods(internationalCrimeArrest.getSmuggledGoodsEtc());
|
||||
}
|
||||
if (internationalCrimeArrest.getProcessResultEtc() != null) {
|
||||
internationalCrimeArrest.setProcessResult(internationalCrimeArrest.getProcessResultEtc());
|
||||
}
|
||||
|
||||
Integer icaKey = internationalCrimeArrestRepository.save(internationalCrimeArrest).getIcaKey();
|
||||
|
||||
if (internationalCrimeArrest.getDeleteSpiKeyList() != null) {
|
||||
suspectPersonInfoRepository.deleteAllByIdInQuery(internationalCrimeArrest.getDeleteSpiKeyList());
|
||||
}
|
||||
|
||||
if (internationalCrimeArrest.getSuspectPersonInfoList() != null) {
|
||||
for(SuspectPersonInfo info: internationalCrimeArrest.getSuspectPersonInfoList()){
|
||||
if (info.getCountryEtc() != null) {
|
||||
info.setCountry(info.getCountryEtc());
|
||||
}
|
||||
info.setIcaKey(icaKey);
|
||||
}
|
||||
suspectPersonInfoRepository.saveAll(internationalCrimeArrest.getSuspectPersonInfoList());
|
||||
}
|
||||
|
||||
return icaKey;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,477 @@
|
|||
package com.dbnt.faisp.fipTarget;
|
||||
|
||||
|
||||
import com.dbnt.faisp.authMgt.service.AuthMgtService;
|
||||
import com.dbnt.faisp.fipTarget.model.PartInfo;
|
||||
import com.dbnt.faisp.fipTarget.model.PartInfoFile;
|
||||
import com.dbnt.faisp.fipTarget.model.PartWork;
|
||||
import com.dbnt.faisp.fipTarget.model.PartWorkFile;
|
||||
import com.dbnt.faisp.fipTarget.model.VulnFile;
|
||||
import com.dbnt.faisp.fipTarget.model.Vulnerable;
|
||||
import com.dbnt.faisp.fipTarget.service.FipTargetService;
|
||||
import com.dbnt.faisp.organMgt.service.OrganConfigService;
|
||||
import com.dbnt.faisp.userInfo.model.UserInfo;
|
||||
import com.dbnt.faisp.userInfo.service.UserInfoService;
|
||||
import com.dbnt.faisp.util.ParamMap;
|
||||
import com.dbnt.faisp.util.Utils;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/target")
|
||||
public class FipTargetController {
|
||||
|
||||
private final OrganConfigService organConfigService;
|
||||
private final AuthMgtService authMgtService;
|
||||
private final FipTargetService fipTargetService;
|
||||
private final UserInfoService userInfoService;
|
||||
|
||||
// 외사분실운영현황 시작
|
||||
@GetMapping("/partInfoList")
|
||||
public ModelAndView partInfoList(@AuthenticationPrincipal UserInfo loginUser,PartInfo partInfo, HttpServletResponse response) {
|
||||
ModelAndView mav = new ModelAndView("fipTarget/partInfoList");
|
||||
partInfo.setDownOrganCdList(loginUser.getDownOrganCdList());
|
||||
//엑셀다운
|
||||
if(partInfo.getExcel() != null && partInfo.getExcel().equals("Y")){
|
||||
ParamMap header = fipTargetService.selectWorkTypeTotal(partInfo);
|
||||
String[] headers = { "mgt_organ", "land_police", "terminal_nm", "mp_work_type", "mp_people_cnt", "mp_description", "pl_work_type", "pl_people_cnt", "pl_description", "pi_manager_name", "rent_price", "utility_price", "wrt_dt"};
|
||||
String[] headerNames = { "해경서", "육경서","터미넡명", "해경", "", "", "육경", "", "", "", "", "",""};
|
||||
String[] headerNames2 = null;
|
||||
if(header != null) {
|
||||
headerNames2 = new String[] { "", "", "", "상주 "+header.getString("mp_sangju")+"개소 "+header.getString("mp_sangju_total")+"명"
|
||||
,"비상주 "+header.getString("mp_bsangju")+"개소 "+header.getString("mp_bsangju_total")+"명"
|
||||
,"폐쇄 "+header.getString("mp_closure")+"개소 "+header.getString("mp_closure_total")+"명"
|
||||
,"상주 "+header.getString("pl_sangju")+"개소 "+header.getString("pl_sangju_total")+"명"
|
||||
,"비상주 "+header.getString("pl_bsangju")+"개소 "+header.getString("pl_bsangju_total")+"명"
|
||||
,"폐쇄 "+header.getString("pl_closure")+"개소 "+header.getString("pl_closure_total")+"명"
|
||||
, "", "", "", "" };
|
||||
}else {
|
||||
headerNames2 = new String[] { "", "","", "상주 0개소 0명","비상주 0개소 0명","폐쇄 0개소 0명","상주 0개소 0명","비상주 0개소 0명","폐쇄 0개소 0명", "", "", "", "" };
|
||||
}
|
||||
String[] headerNames3 = { "", "","", "근무방법", "명", "비고", "근무방법", "명", "비고", "담당자", "임차료", "공공요금", "최종수정일" };
|
||||
String[] columnType = { "String", "String","String", "String", "int", "String", "String", "int", "String", "String", "String","String", "String"};
|
||||
String sheetName = "외사 분실 현황";
|
||||
String excelFileName = "외사 분실 현황";
|
||||
List<PartInfo> partInfoList= fipTargetService.selectPartInfoList(partInfo);
|
||||
|
||||
try {
|
||||
Utils.partInfolistToExcel(partInfoList, response, headers, headerNames,headerNames2,headerNames3, columnType, sheetName, excelFileName);
|
||||
} catch (IOException e) {
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
//메뉴권한 확인
|
||||
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/target/partInfoList").get(0).getAccessAuth();
|
||||
mav.addObject("accessAuth", accessAuth);
|
||||
partInfo.setQueryInfo();
|
||||
mav.addObject("total", fipTargetService.selectWorkTypeTotal(partInfo));
|
||||
mav.addObject("partInfoList", fipTargetService.selectPartInfoList(partInfo));
|
||||
partInfo.setContentCnt(fipTargetService.selectPartInfoListCnt(partInfo));
|
||||
partInfo.setPaginationInfo();
|
||||
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
|
||||
mav.addObject("searchParams", partInfo);
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/partInfoEditModal")
|
||||
public ModelAndView partInfoEditModal(@AuthenticationPrincipal UserInfo loginUser,PartInfo partInfo) {
|
||||
ModelAndView mav = new ModelAndView("fipTarget/partInfoEditModal");
|
||||
//메뉴권한 확인
|
||||
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/target/partInfoList").get(0).getAccessAuth();
|
||||
mav.addObject("userOrgan", loginUser.getOgCd());
|
||||
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
|
||||
mav.addObject("accessAuth", accessAuth);
|
||||
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/partInfoSelecBox")
|
||||
public ModelAndView equipTypeSelecBox(String ogCd) {
|
||||
ModelAndView mav = new ModelAndView("fipTarget/partInfoSelecBox");
|
||||
ParamMap param = new ParamMap();
|
||||
param.put("downOrganCdList", organConfigService.selectDownOrganListWhereUserOgCd(ogCd));
|
||||
mav.addObject("managerList", userInfoService.selectManagerList(param));
|
||||
return mav;
|
||||
}
|
||||
|
||||
@PostMapping("/savePartInfo")
|
||||
public void savePartInfo (@AuthenticationPrincipal UserInfo loginUser, PartInfo partInfo,MultipartHttpServletRequest request){
|
||||
partInfo.setMultipartFileList(request.getMultiFileMap().get("uploadFiles"));
|
||||
partInfo.setWrtNm(loginUser.getUserId());
|
||||
partInfo.setWrtPart(loginUser.getOfcCd());
|
||||
partInfo.setWrtUserSeq(loginUser.getUserSeq());
|
||||
partInfo.setWrtOrgan(loginUser.getOgCd());
|
||||
partInfo.setWrtDt(LocalDateTime.now());
|
||||
fipTargetService.savePartInfo(partInfo);
|
||||
}
|
||||
|
||||
@GetMapping("/updatePartInfoPage")
|
||||
public ModelAndView updatePartInfoPage(@AuthenticationPrincipal UserInfo loginUser,PartInfo partInfo) {
|
||||
ModelAndView mav = new ModelAndView("fipTarget/partInfoModifyModal");
|
||||
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
|
||||
PartInfo partInfoView = fipTargetService.selectPartInfo(partInfo);
|
||||
ParamMap param = new ParamMap();
|
||||
param.put("downOrganCdList", organConfigService.selectDownOrganListWhereUserOgCd(partInfoView.getMgtOrgan()));
|
||||
mav.addObject("managerList", userInfoService.selectManagerList(param));
|
||||
partInfoView.setFileList(fipTargetService.selectPartInfoFile(partInfo));
|
||||
mav.addObject("partInfo", partInfoView);
|
||||
//메뉴권한 확인
|
||||
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/target/partInfoList").get(0).getAccessAuth();
|
||||
mav.addObject("accessAuth", accessAuth);
|
||||
mav.addObject("userId", loginUser.getUserId());
|
||||
mav.addObject("wrtId", fipTargetService.selectPartInfoFirstId(partInfo));
|
||||
return mav;
|
||||
}
|
||||
|
||||
@PostMapping("/updatePartInfo")
|
||||
public int updatePartInfo (@AuthenticationPrincipal UserInfo loginUser,PartInfo partInfo,
|
||||
MultipartHttpServletRequest request,
|
||||
@RequestParam(value = "fileSeq", required = false) List < Integer > deleteFileSeq){
|
||||
partInfo.setMultipartFileList(request.getMultiFileMap().get("uploadFiles"));
|
||||
partInfo.setWrtUserSeq(loginUser.getUserSeq());
|
||||
partInfo.setWrtNm(loginUser.getUserId());
|
||||
partInfo.setWrtOrgan(loginUser.getOgCd());
|
||||
partInfo.setWrtPart(loginUser.getOfcCd());
|
||||
partInfo.setWrtDt(LocalDateTime.now());
|
||||
fipTargetService.updatePartInfo(partInfo,deleteFileSeq);
|
||||
return partInfo.getPiSeq();
|
||||
}
|
||||
|
||||
@GetMapping("/PartInfoHistoryPage")
|
||||
public ModelAndView PartInfoHistoryPage(PartInfo partInfo) {
|
||||
ModelAndView mav = new ModelAndView("fipTarget/partInfoHistory");
|
||||
mav.addObject("partInfoList", fipTargetService.selectPartInfoSeq(partInfo));
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/partInfoHistoryView")
|
||||
@ResponseBody
|
||||
public PartInfo partInfoHistoryView(PartInfo partInfo){
|
||||
PartInfo partInfoHistory = fipTargetService.selectPartInfoHistoryView(partInfo);
|
||||
partInfoHistory.setFileList(fipTargetService.selectPartInfoFileHistoryView(partInfo));
|
||||
return partInfoHistory;
|
||||
}
|
||||
|
||||
@PostMapping("/deletePartInfo")
|
||||
@ResponseBody
|
||||
public void deletePartInfo(@RequestBody PartInfo partInfo) {
|
||||
fipTargetService.deletePartInfo(partInfo);
|
||||
}
|
||||
|
||||
@GetMapping("/partInfoFileDownload")
|
||||
public void partInfoFileDownload(HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
Integer fileSeq,
|
||||
Integer piSeq,
|
||||
Integer versionNo) {
|
||||
PartInfoFile downloadFile = fipTargetService.selectPartInfoFileDown(fileSeq, piSeq,versionNo);
|
||||
|
||||
BufferedInputStream in;
|
||||
BufferedOutputStream out;
|
||||
try {
|
||||
File file = new File(downloadFile.getFilePath(), downloadFile.getConvNm());
|
||||
|
||||
setDisposition(downloadFile.getOrigNm()+'.'+downloadFile.getFileExtn(), request, response);
|
||||
in = new BufferedInputStream(new FileInputStream(file));
|
||||
out = new BufferedOutputStream(response.getOutputStream());
|
||||
FileCopyUtils.copy(in, out);
|
||||
out.flush();
|
||||
if(out!=null) out.close();
|
||||
if(in!=null )in.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void setDisposition(String filename, HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
String browser = getBrowser(request);
|
||||
|
||||
String dispositionPrefix = "attachment; filename=";
|
||||
String encodedFilename = null;
|
||||
|
||||
if (browser.equals("MSIE")) {
|
||||
encodedFilename = URLEncoder.encode(filename, "UTF-8").replaceAll("\\+", "%20");
|
||||
} else if (browser.equals("Trident")) { // IE11 문자열 깨짐 방지
|
||||
encodedFilename = URLEncoder.encode(filename, "UTF-8").replaceAll("\\+", "%20");
|
||||
} else if (browser.equals("Firefox")) {
|
||||
encodedFilename = "\"" + new String(filename.getBytes("UTF-8"), "8859_1") + "\"";
|
||||
} else if (browser.equals("Opera")) {
|
||||
encodedFilename = "\"" + new String(filename.getBytes("UTF-8"), "8859_1") + "\"";
|
||||
} else if (browser.equals("Chrome")) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0; i < filename.length(); i++) {
|
||||
char c = filename.charAt(i);
|
||||
if (c > '~') {
|
||||
sb.append(URLEncoder.encode("" + c, "UTF-8"));
|
||||
} else {
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
encodedFilename = sb.toString();
|
||||
} else {
|
||||
throw new IOException("Not supported browser");
|
||||
}
|
||||
|
||||
response.setHeader("Content-Disposition", dispositionPrefix + encodedFilename);
|
||||
|
||||
if ("Opera".equals(browser)) {
|
||||
response.setContentType("application/octet-stream;charset=UTF-8");
|
||||
}
|
||||
}
|
||||
|
||||
private String getBrowser(HttpServletRequest request) {
|
||||
String header = request.getHeader("User-Agent");
|
||||
if (header.indexOf("MSIE") > -1) {
|
||||
return "MSIE";
|
||||
} else if (header.indexOf("Trident") > -1) { // IE11 문자열 깨짐 방지
|
||||
return "Trident";
|
||||
} else if (header.indexOf("Chrome") > -1) {
|
||||
return "Chrome";
|
||||
} else if (header.indexOf("Opera") > -1) {
|
||||
return "Opera";
|
||||
}
|
||||
return "Firefox";
|
||||
}
|
||||
//외사분실 운영현황 끝
|
||||
//외사분실실적 시작
|
||||
@GetMapping("/partWorkList")
|
||||
public ModelAndView partWorkList(@AuthenticationPrincipal UserInfo loginUser,PartWork partWork, HttpServletResponse response) {
|
||||
ModelAndView mav = new ModelAndView("fipTarget/partWorkList");
|
||||
partWork.setDownOrganCdList(loginUser.getDownOrganCdList());
|
||||
//엑셀다운
|
||||
if(partWork.getExcel() != null && partWork.getExcel().equals("Y")){
|
||||
String[] headers = { "terminal_nm", "wrt_nm", "work_dt", "work_type_ch", "work_type_poci", "work_type_sri", "work_type_ji", "work_type_mt", "work_type_etc", "description", "file_cnt","wrt_dt"};
|
||||
String[] headerNames = { "외사 터미널명", "작성자","일시", "종류", "", "", "", "", "", "비고", "첨부파일", "최근수정일"};
|
||||
String[] headerNames2 = { "", "","", "사건처리", "범죄첩보제공", "SRI", "합동점검", "회의", "기타", "", "", ""};
|
||||
String[] columnType = { "String", "String","String", "String", "String", "String", "String", "String", "String", "String", "String","String"};
|
||||
String sheetName = "외사분실 실적";
|
||||
String excelFileName = "외사분실 실적";
|
||||
List<PartWork> partWorkList= fipTargetService.selectPartWorkList(partWork);
|
||||
|
||||
try {
|
||||
Utils.partWorkListToExcel(partWorkList, response, headers, headerNames,headerNames2, columnType, sheetName, excelFileName);
|
||||
} catch (IOException e) {
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
//메뉴권한 확인
|
||||
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/target/partWorkList").get(0).getAccessAuth();
|
||||
mav.addObject("accessAuth", accessAuth);
|
||||
partWork.setQueryInfo();
|
||||
mav.addObject("partWorkList", fipTargetService.selectPartWorkList(partWork));
|
||||
partWork.setContentCnt(fipTargetService.selectPartWorkListCnt(partWork));
|
||||
partWork.setPaginationInfo();
|
||||
mav.addObject("uesrId", loginUser.getUserId());
|
||||
mav.addObject("searchParams", partWork);
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/partWorkEditModal")
|
||||
public ModelAndView partWorkEditModal(@AuthenticationPrincipal UserInfo loginUser,PartWork partWork) {
|
||||
ModelAndView mav = new ModelAndView("fipTarget/partWorkEditModal");
|
||||
partWork.setDownOrganCdList(loginUser.getDownOrganCdList());
|
||||
//메뉴권한 확인
|
||||
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/target/partWorkList").get(0).getAccessAuth();
|
||||
mav.addObject("accessAuth", accessAuth);
|
||||
mav.addObject("tnList", fipTargetService.selectTerminalName(partWork));
|
||||
|
||||
return mav;
|
||||
}
|
||||
|
||||
@PostMapping("/savePartWork")
|
||||
public void savePartWork (@AuthenticationPrincipal UserInfo loginUser, PartWork partWork,MultipartHttpServletRequest request){
|
||||
partWork.setMultipartFileList(request.getMultiFileMap().get("uploadFiles"));
|
||||
partWork.setWrtNm(loginUser.getUserId());
|
||||
partWork.setWrtPart(loginUser.getOfcCd());
|
||||
partWork.setWrtUserSeq(loginUser.getUserSeq());
|
||||
partWork.setWrtOrgan(loginUser.getOgCd());
|
||||
partWork.setWrtDt(LocalDateTime.now());
|
||||
fipTargetService.savePartWork(partWork);
|
||||
}
|
||||
|
||||
@GetMapping("/partWorkView")
|
||||
public ModelAndView partWorkView(@AuthenticationPrincipal UserInfo loginUser,PartWork partWork) {
|
||||
ModelAndView mav = new ModelAndView("fipTarget/partWorkModifyModal");
|
||||
partWork.setDownOrganCdList(loginUser.getDownOrganCdList());
|
||||
PartWork partWorkView = fipTargetService.selectPartWorkInfo(partWork);
|
||||
partWorkView.setFileList(fipTargetService.selectPartWorkFile(partWork));
|
||||
mav.addObject("pwInfo", partWorkView);
|
||||
//메뉴권한 확인
|
||||
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/target/partInfoList").get(0).getAccessAuth();
|
||||
mav.addObject("accessAuth", accessAuth);
|
||||
mav.addObject("userId", loginUser.getUserId());
|
||||
return mav;
|
||||
}
|
||||
|
||||
@PostMapping("/updatePartWork")
|
||||
public PartWork updatePartWork (@AuthenticationPrincipal UserInfo loginUser, PartWork partWork,
|
||||
MultipartHttpServletRequest request,
|
||||
@RequestParam(value = "fileSeq", required = false) List < Integer > deleteFileSeq){
|
||||
partWork.setMultipartFileList(request.getMultiFileMap().get("uploadFiles"));
|
||||
partWork.setWrtDt(LocalDateTime.now());
|
||||
fipTargetService.updatePartWork(partWork,deleteFileSeq);
|
||||
return partWork;
|
||||
}
|
||||
|
||||
@PostMapping("/deletePartWork")
|
||||
@ResponseBody
|
||||
public void deletePartWork(@RequestBody PartWork partWork) {
|
||||
fipTargetService.deletePartWork(partWork);
|
||||
}
|
||||
|
||||
@GetMapping("/partWorkFileDownload")
|
||||
public void partWorkFileDownload(HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
Integer fileSeq,
|
||||
Integer pwSeq,
|
||||
Integer piSeq) {
|
||||
PartWorkFile downloadFile = fipTargetService.selectPartWorkFileDown(fileSeq, pwSeq,piSeq);
|
||||
|
||||
BufferedInputStream in;
|
||||
BufferedOutputStream out;
|
||||
try {
|
||||
File file = new File(downloadFile.getFilePath(), downloadFile.getConvNm());
|
||||
|
||||
setDisposition(downloadFile.getOrigNm()+'.'+downloadFile.getFileExtn(), request, response);
|
||||
in = new BufferedInputStream(new FileInputStream(file));
|
||||
out = new BufferedOutputStream(response.getOutputStream());
|
||||
FileCopyUtils.copy(in, out);
|
||||
out.flush();
|
||||
if(out!=null) out.close();
|
||||
if(in!=null )in.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
//외사분실실적 끝
|
||||
//외사취약지 시작
|
||||
|
||||
@GetMapping("/vulnerableList")
|
||||
public ModelAndView vulnerableList(@AuthenticationPrincipal UserInfo loginUser,Vulnerable vulnerable, HttpServletResponse response) {
|
||||
ModelAndView mav = new ModelAndView("fipTarget/vulnerableList");
|
||||
|
||||
mav.addObject("vulnerableList", fipTargetService.selectVulnerableList(vulnerable));
|
||||
//메뉴권한 확인
|
||||
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/target/vulnerableList").get(0).getAccessAuth();
|
||||
mav.addObject("accessAuth", accessAuth);
|
||||
mav.addObject("searchParams", vulnerable);
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/vulnEditModal")
|
||||
public ModelAndView vulnEditModal(@AuthenticationPrincipal UserInfo loginUser,Vulnerable vulnerable) {
|
||||
ModelAndView mav = new ModelAndView("fipTarget/vulnEditModal");
|
||||
vulnerable.setDownOrganCdList(loginUser.getDownOrganCdList());
|
||||
mav.addObject("organList", fipTargetService.selecetVulnOrganList(vulnerable));
|
||||
mav.addObject("userOrgan", loginUser.getOgCd());
|
||||
if(vulnerable.getVulnKey() != null) {
|
||||
vulnerable = fipTargetService.selectVulnInfo(vulnerable);
|
||||
vulnerable.setFileList(fipTargetService.selectVulnFile(vulnerable.getVulnKey()));
|
||||
mav.addObject("userId", loginUser.getUserId());
|
||||
}
|
||||
//메뉴권한 확인
|
||||
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/target/vulnerableList").get(0).getAccessAuth();
|
||||
mav.addObject("accessAuth", accessAuth);
|
||||
vulnerable.setWrtNm(loginUser.getUserId());
|
||||
vulnerable.setWrtPart(loginUser.getOfcCd());
|
||||
vulnerable.setWrtUserSeq(loginUser.getUserSeq());
|
||||
vulnerable.setWrtOrgan(loginUser.getOgCd());
|
||||
mav.addObject("info", vulnerable);
|
||||
return mav;
|
||||
}
|
||||
|
||||
@PostMapping("/saveVulnerable")
|
||||
public Integer saveVulnerable (@AuthenticationPrincipal UserInfo loginUser, Vulnerable vulnerable,MultipartHttpServletRequest request,
|
||||
@RequestParam(value = "fileSeq", required = false) List < Integer > deleteFileSeq){
|
||||
vulnerable.setMultipartFileList(request.getMultiFileMap().get("uploadFiles"));
|
||||
vulnerable.setWrtDt(LocalDateTime.now());
|
||||
Integer result = fipTargetService.saveVulnerable(vulnerable,deleteFileSeq);
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("/vulnInfoModal")
|
||||
public ModelAndView vulnInfoModal(@AuthenticationPrincipal UserInfo loginUser,Vulnerable vulnerable) {
|
||||
ModelAndView mav = new ModelAndView("fipTarget/vulnInfoModal");
|
||||
vulnerable.setDownOrganCdList(loginUser.getDownOrganCdList());;
|
||||
mav.addObject("vulnInfoList", fipTargetService.selectVulnInfoList(vulnerable));
|
||||
mav.addObject("organNm", fipTargetService.selectOrganName(vulnerable.getMgtOrgan()));
|
||||
//메뉴권한 확인
|
||||
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/target/vulnerableList").get(0).getAccessAuth();
|
||||
mav.addObject("accessAuth", accessAuth);
|
||||
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/vulnViewModal")
|
||||
public ModelAndView vulnViewModal(@AuthenticationPrincipal UserInfo loginUser,Vulnerable vulnerable) {
|
||||
ModelAndView mav = new ModelAndView("fipTarget/vulnViewModal");
|
||||
Vulnerable vulnInfo = fipTargetService.selectVulnInfo(vulnerable);
|
||||
vulnInfo.setFileList(fipTargetService.selectVulnFile(vulnInfo.getVulnKey()));
|
||||
mav.addObject("vulnInfo", vulnInfo);
|
||||
//메뉴권한 확인
|
||||
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/target/vulnerableList").get(0).getAccessAuth();
|
||||
mav.addObject("accessAuth", accessAuth);
|
||||
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/vulnFileDownload")
|
||||
public void vulnFileDownload(HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
Integer fileSeq,
|
||||
Integer vulnKey) {
|
||||
VulnFile downloadFile = fipTargetService.selectVulnInfoFileDown(fileSeq, vulnKey);
|
||||
|
||||
BufferedInputStream in;
|
||||
BufferedOutputStream out;
|
||||
try {
|
||||
File file = new File(downloadFile.getFilePath(), downloadFile.getConvNm());
|
||||
|
||||
setDisposition(downloadFile.getOrigNm()+'.'+downloadFile.getFileExtn(), request, response);
|
||||
in = new BufferedInputStream(new FileInputStream(file));
|
||||
out = new BufferedOutputStream(response.getOutputStream());
|
||||
FileCopyUtils.copy(in, out);
|
||||
out.flush();
|
||||
if(out!=null) out.close();
|
||||
if(in!=null )in.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/deleteVulnerable")
|
||||
@ResponseBody
|
||||
public void deleteVulnerable(@RequestBody Vulnerable vulnerable) {
|
||||
fipTargetService.deleteVulnerable(vulnerable);
|
||||
}
|
||||
//외사취약지 끝
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
package com.dbnt.faisp.fipTarget.mapper;
|
||||
|
||||
import com.dbnt.faisp.fipTarget.model.PartInfo;
|
||||
import com.dbnt.faisp.fipTarget.model.PartInfoFile;
|
||||
import com.dbnt.faisp.fipTarget.model.PartWork;
|
||||
import com.dbnt.faisp.fipTarget.model.Vulnerable;
|
||||
import com.dbnt.faisp.util.ParamMap;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface FipTargetMapper {
|
||||
|
||||
List<ParamMap> selectPartInfoManagerList(ParamMap param);
|
||||
|
||||
List<PartInfo> selectPartInfoList(PartInfo partInfo);
|
||||
|
||||
Integer selectPartInfoListCnt(PartInfo partInfo);
|
||||
|
||||
ParamMap selectWorkTypeTotal(PartInfo partInfo);
|
||||
|
||||
PartInfo selectPartInfo(PartInfo partInfo);
|
||||
|
||||
List<PartInfoFile> selectPartInfoFile(PartInfo partInfo);
|
||||
|
||||
List<PartInfo> selectPartInfoSeq(PartInfo partInfo);
|
||||
|
||||
PartInfo selectPartInfoHistoryView(PartInfo partInfo);
|
||||
|
||||
List<PartInfoFile> selectPartInfoFileHistoryView(PartInfo partInfo);
|
||||
|
||||
String selectPartInfoFirstId(Integer piSeq);
|
||||
|
||||
List<ParamMap> selectTerminalName(PartWork partWork);
|
||||
|
||||
List<PartWork> selectPartWorkList(PartWork partWork);
|
||||
|
||||
Integer selectPartWorkListCnt(PartWork partWork);
|
||||
|
||||
PartWork selectPartWorkInfo(PartWork partWork);
|
||||
|
||||
List<ParamMap> selecetVulnOrganList(Vulnerable vulnerable);
|
||||
|
||||
List<ParamMap> selectVulnerableList(Vulnerable vulnerable);
|
||||
|
||||
List<Vulnerable> selectVulnInfoList(Vulnerable vulnerable);
|
||||
|
||||
String selectOrganName(String mgtOrgan);
|
||||
|
||||
Vulnerable selectVulnInfo(Vulnerable vulnerable);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
package com.dbnt.faisp.fipTarget.model;
|
||||
|
||||
import com.dbnt.faisp.config.BaseModel;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@IdClass(PartInfo.PartInfoId.class)
|
||||
@Table(name = "part_info")
|
||||
public class PartInfo extends BaseModel implements Serializable{
|
||||
@Id
|
||||
@Column(name = "pi_seq")
|
||||
private Integer piSeq;
|
||||
@Id
|
||||
@Column(name = "version_no")
|
||||
private Integer versionNo;
|
||||
@Column(name = "mgt_organ")
|
||||
private String mgtOrgan;
|
||||
@Column(name = "pi_user_seq")
|
||||
private Integer piUserSeq;
|
||||
@Column(name = "land_police")
|
||||
private String landPolice;
|
||||
@Column(name = "rent_type")
|
||||
private String rentType;
|
||||
@Column(name = "rent_price")
|
||||
private Integer rentPrice;
|
||||
@Column(name = "utility_type")
|
||||
private String utilityType;
|
||||
@Column(name = "utility_price")
|
||||
private Integer utilityPrice;
|
||||
@Column(name = "terminal_nm")
|
||||
private String terminalNm;
|
||||
@Column(name = "mp_work_type")
|
||||
private String mpWorkType;
|
||||
@Column(name = "mp_people_cnt")
|
||||
private Integer mpPeopleCnt;
|
||||
@Column(name = "mp_description")
|
||||
private String mpDescription;
|
||||
@Column(name = "pl_work_type")
|
||||
private String plWorkType;
|
||||
@Column(name = "pl_people_cnt")
|
||||
private Integer plPeopleCnt;
|
||||
@Column(name = "pl_description")
|
||||
private String plDescription;
|
||||
@Column(name = "wrt_organ")
|
||||
private String wrtOrgan;
|
||||
@Column(name = "wrt_part")
|
||||
private String wrtPart;
|
||||
@Column(name = "wrt_user_seq")
|
||||
private Integer wrtUserSeq;
|
||||
@Column(name = "wrt_nm")
|
||||
private String wrtNm;
|
||||
@Column(name = "wrt_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private LocalDateTime wrtDt;
|
||||
|
||||
@Transient
|
||||
private List<MultipartFile> multipartFileList;
|
||||
|
||||
@Transient
|
||||
private String piManagerName;
|
||||
|
||||
@Transient
|
||||
private String excel;
|
||||
|
||||
@Transient
|
||||
private List<PartInfoFile> fileList;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PartInfo [piSeq=" + piSeq + ", versionNo=" + versionNo + ", mgtOrgan=" + mgtOrgan + ", piUserSeq="
|
||||
+ piUserSeq + ", landPolice=" + landPolice + ", rentType=" + rentType + ", rentPrice=" + rentPrice
|
||||
+ ", utilityType=" + utilityType + ", utilityPrice=" + utilityPrice + ", terminalNm=" + terminalNm
|
||||
+ ", mpWorkType=" + mpWorkType + ", mpPeopleCnt=" + mpPeopleCnt + ", mpDescription=" + mpDescription
|
||||
+ ", plWorkType=" + plWorkType + ", plPeopleCnt=" + plPeopleCnt + ", plDescription=" + plDescription
|
||||
+ ", wrtOrgan=" + wrtOrgan + ", wrtPart=" + wrtPart + ", wrtUserSeq=" + wrtUserSeq + ", wrtNm=" + wrtNm
|
||||
+ ", wrtDt=" + wrtDt + ", multipartFileList=" + multipartFileList + ", piManagerName=" + piManagerName
|
||||
+ ", fileList=" + fileList + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Embeddable
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class PartInfoId implements Serializable {
|
||||
private Integer piSeq;
|
||||
private Integer versionNo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
package com.dbnt.faisp.fipTarget.model;
|
||||
|
||||
import com.dbnt.faisp.config.BaseModel;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@IdClass(PartInfoFile.PartInfoFileId.class)
|
||||
@Table(name = "part_info_file")
|
||||
public class PartInfoFile extends BaseModel implements Serializable{
|
||||
@Id
|
||||
@Column(name = "file_seq")
|
||||
private Integer fileSeq;
|
||||
@Id
|
||||
@Column(name = "pi_seq")
|
||||
private Integer piSeq;
|
||||
@Id
|
||||
@Column(name = "version_no")
|
||||
private Integer versionNo;
|
||||
@Column(name = "orig_nm")
|
||||
private String origNm;
|
||||
@Column(name = "conv_nm")
|
||||
private String convNm;
|
||||
@Column(name = "file_extn")
|
||||
private String fileExtn;
|
||||
@Column(name = "file_size")
|
||||
private String fileSize;
|
||||
@Column(name = "file_path")
|
||||
private String filePath;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PartInfoFile [fileSeq=" + fileSeq + ", piSeq=" + piSeq + ", versionNo=" + versionNo + ", origNm=" + origNm
|
||||
+ ", convNm=" + convNm + ", fileExtn=" + fileExtn + ", fileSize=" + fileSize + ", filePath=" + filePath
|
||||
+ "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Embeddable
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class PartInfoFileId implements Serializable {
|
||||
private Integer fileSeq;
|
||||
private Integer piSeq;
|
||||
private Integer versionNo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
package com.dbnt.faisp.fipTarget.model;
|
||||
|
||||
import com.dbnt.faisp.config.BaseModel;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@IdClass(PartWork.PartWorkId.class)
|
||||
@Table(name = "part_work")
|
||||
public class PartWork extends BaseModel implements Serializable{
|
||||
@Id
|
||||
@Column(name = "pw_seq")
|
||||
private Integer pwSeq;
|
||||
@Id
|
||||
@Column(name = "pi_seq")
|
||||
private Integer piSeq;
|
||||
@Column(name = "work_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate workDt;
|
||||
@Column(name = "work_type")
|
||||
private String workType;
|
||||
@Column(name = "work_info")
|
||||
private String workInfo;
|
||||
@Column(name = "description")
|
||||
private String description;
|
||||
@Column(name = "save_yn")
|
||||
private String saveYn;
|
||||
@Column(name = "wrt_organ")
|
||||
private String wrtOrgan;
|
||||
@Column(name = "wrt_part")
|
||||
private String wrtPart;
|
||||
@Column(name = "wrt_user_seq")
|
||||
private Integer wrtUserSeq;
|
||||
@Column(name = "wrt_nm")
|
||||
private String wrtNm;
|
||||
@Column(name = "wrt_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private LocalDateTime wrtDt;
|
||||
|
||||
@Transient
|
||||
private List<MultipartFile> multipartFileList;
|
||||
|
||||
@Transient
|
||||
private String excel;
|
||||
@Transient
|
||||
private String terminalNm;
|
||||
@Transient
|
||||
private String workTypeCh;
|
||||
@Transient
|
||||
private String workTypePoci;
|
||||
@Transient
|
||||
private String workTypeSri;
|
||||
@Transient
|
||||
private String workTypeJi;
|
||||
@Transient
|
||||
private String workTypeMt;
|
||||
@Transient
|
||||
private String workTypeEtc;
|
||||
@Transient
|
||||
private Integer fileCnt;
|
||||
|
||||
@Transient
|
||||
private List<PartWorkFile> fileList;
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PartWork [pwSeq=" + pwSeq + ", piSeq=" + piSeq + ", workDt=" + workDt + ", workType=" + workType
|
||||
+ ", workInfo=" + workInfo + ", description=" + description + ", saveYn=" + saveYn + ", wrtOrgan="
|
||||
+ wrtOrgan + ", wrtPart=" + wrtPart + ", wrtUserSeq=" + wrtUserSeq + ", wrtNm=" + wrtNm + ", wrtDt=" + wrtDt
|
||||
+ ", multipartFileList=" + multipartFileList + ", excel=" + excel + ", fileList=" + fileList + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Embeddable
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class PartWorkId implements Serializable {
|
||||
private Integer pwSeq;
|
||||
private Integer piSeq;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
package com.dbnt.faisp.fipTarget.model;
|
||||
|
||||
import com.dbnt.faisp.config.BaseModel;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@IdClass(PartWorkFile.PartWorkFileId.class)
|
||||
@Table(name = "part_work_file")
|
||||
public class PartWorkFile extends BaseModel implements Serializable{
|
||||
@Id
|
||||
@Column(name = "file_seq")
|
||||
private Integer fileSeq;
|
||||
@Id
|
||||
@Column(name = "pw_seq")
|
||||
private Integer pwSeq;
|
||||
@Id
|
||||
@Column(name = "pi_seq")
|
||||
private Integer piSeq;
|
||||
@Column(name = "orig_nm")
|
||||
private String origNm;
|
||||
@Column(name = "conv_nm")
|
||||
private String convNm;
|
||||
@Column(name = "file_extn")
|
||||
private String fileExtn;
|
||||
@Column(name = "file_size")
|
||||
private String fileSize;
|
||||
@Column(name = "file_path")
|
||||
private String filePath;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PartWorkFile [fileSeq=" + fileSeq + ", pwSeq=" + pwSeq + ", piSeq=" + piSeq + ", origNm=" + origNm
|
||||
+ ", convNm=" + convNm + ", fileExtn=" + fileExtn + ", fileSize=" + fileSize + ", filePath=" + filePath
|
||||
+ "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Embeddable
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class PartWorkFileId implements Serializable {
|
||||
private Integer fileSeq;
|
||||
private Integer pwSeq;
|
||||
private Integer piSeq;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
package com.dbnt.faisp.fipTarget.model;
|
||||
|
||||
import com.dbnt.faisp.config.BaseModel;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@IdClass(VulnFile.VulnFileId.class)
|
||||
@Table(name = "vuln_file")
|
||||
public class VulnFile extends BaseModel implements Serializable{
|
||||
@Id
|
||||
@Column(name = "file_seq")
|
||||
private Integer fileSeq;
|
||||
@Id
|
||||
@Column(name = "vuln_key")
|
||||
private Integer vulnKey;
|
||||
@Column(name = "orig_nm")
|
||||
private String origNm;
|
||||
@Column(name = "conv_nm")
|
||||
private String convNm;
|
||||
@Column(name = "file_extn")
|
||||
private String fileExtn;
|
||||
@Column(name = "file_size")
|
||||
private String fileSize;
|
||||
@Column(name = "file_path")
|
||||
private String filePath;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VulnFile [fileSeq=" + fileSeq + ", vulnKey=" + vulnKey + ", origNm=" + origNm + ", convNm=" + convNm
|
||||
+ ", fileExtn=" + fileExtn + ", fileSize=" + fileSize + ", filePath=" + filePath + "]";
|
||||
}
|
||||
|
||||
|
||||
@Embeddable
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class VulnFileId implements Serializable {
|
||||
private Integer fileSeq;
|
||||
private Integer vulnKey;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
package com.dbnt.faisp.fipTarget.model;
|
||||
|
||||
import com.dbnt.faisp.config.BaseModel;
|
||||
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "board_vuln")
|
||||
public class Vulnerable extends BaseModel{
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "vuln_key")
|
||||
private Integer vulnKey;
|
||||
@Column(name = "mgt_organ")
|
||||
private String mgtOrgan;
|
||||
@Column(name = "vuln_type")
|
||||
private String vulnType;
|
||||
@Column(name = "vuln_nm")
|
||||
private String vulnNm;
|
||||
@Column(name = "description")
|
||||
private String description;
|
||||
@Column(name = "wrt_organ")
|
||||
private String wrtOrgan;
|
||||
@Column(name = "wrt_part")
|
||||
private String wrtPart;
|
||||
@Column(name = "wrt_user_seq")
|
||||
private Integer wrtUserSeq;
|
||||
@Column(name = "wrt_nm")
|
||||
private String wrtNm;
|
||||
@Column(name = "wrt_dt")
|
||||
private LocalDateTime wrtDt;
|
||||
|
||||
@Transient
|
||||
private List<MultipartFile> multipartFileList;
|
||||
|
||||
@Transient
|
||||
private String organNm;
|
||||
|
||||
@Transient
|
||||
private List<VulnFile> fileList;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Vulnerable [vulnKey=" + vulnKey + ", mgtOrgan=" + mgtOrgan + ", vulnType=" + vulnType + ", vulnNm=" + vulnNm
|
||||
+ ", description=" + description + ", wrtOrgan=" + wrtOrgan + ", wrtPart=" + wrtPart + ", wrtUserSeq="
|
||||
+ wrtUserSeq + ", wrtNm=" + wrtNm + ", wrtDt=" + wrtDt + ", multipartFileList=" + multipartFileList
|
||||
+ ", organNm=" + organNm + ", fileList=" + fileList + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.dbnt.faisp.fipTarget.repository;
|
||||
|
||||
|
||||
import com.dbnt.faisp.fipTarget.model.PartInfoFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
|
||||
|
||||
public interface PartInfoFileRepository extends JpaRepository<PartInfoFile, PartInfoFile.PartInfoFileId> {
|
||||
|
||||
PartInfoFile findTopByPiSeqOrderByFileSeq(Integer piSeq);
|
||||
|
||||
List<PartInfoFile> findByPiSeqAndVersionNoOrderByFileSeqAsc(Integer piSeq, Integer versionNo);
|
||||
|
||||
PartInfoFile findTopByPiSeqOrderByFileSeqDesc(Integer piSeq);
|
||||
|
||||
PartInfoFile findTopByPiSeqAndVersionNoOrderByFileSeqDesc(Integer piSeq, Integer versionNo);
|
||||
|
||||
void deleteByPiSeq(Integer piSeq);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.dbnt.faisp.fipTarget.repository;
|
||||
|
||||
|
||||
import com.dbnt.faisp.fipTarget.model.PartInfo;
|
||||
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
|
||||
|
||||
public interface PartInfoRepository extends JpaRepository<PartInfo, PartInfo.PartInfoId> {
|
||||
|
||||
PartInfo findFirstByOrderByPiSeqDesc();
|
||||
|
||||
void deleteByPiSeq(Integer piSeq);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.dbnt.faisp.fipTarget.repository;
|
||||
|
||||
|
||||
import com.dbnt.faisp.fipTarget.model.PartWorkFile;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
|
||||
|
||||
public interface PartWorkFileRepository extends JpaRepository<PartWorkFile, PartWorkFile.PartWorkFileId> {
|
||||
|
||||
PartWorkFile findTopByPwSeqAndPiSeqOrderByFileSeqDesc(Integer piSeq, Integer piSeq2);
|
||||
|
||||
List<PartWorkFile> findByPwSeqAndPiSeqOrderByFileSeqAsc(Integer pwSeq, Integer piSeq);
|
||||
|
||||
List<PartWorkFile> findByPwSeqAndPiSeq(Integer pwSeq, Integer piSeq);
|
||||
|
||||
void deleteByPwSeqAndPiSeq(Integer pwSeq, Integer piSeq);
|
||||
|
||||
List<PartWorkFile> findByPiSeq(Integer piSeq);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.dbnt.faisp.fipTarget.repository;
|
||||
|
||||
|
||||
import com.dbnt.faisp.fipTarget.model.PartWork;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
|
||||
|
||||
public interface PartWorkRepository extends JpaRepository<PartWork, PartWork.PartWorkId> {
|
||||
|
||||
PartWork findTopByPiSeqOrderByPwSeqDesc(Integer piSeq);
|
||||
|
||||
void deleteByPwSeqAndPiSeq(Integer pwSeq, Integer piSeq);
|
||||
|
||||
void deleteByPiSeq(Integer piSeq);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.dbnt.faisp.fipTarget.repository;
|
||||
|
||||
|
||||
import com.dbnt.faisp.fipTarget.model.VulnFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
|
||||
|
||||
public interface VulnFileRepository extends JpaRepository<VulnFile, VulnFile.VulnFileId> {
|
||||
|
||||
VulnFile findTopByVulnKeyOrderByFileSeqDesc(Integer vulnKey);
|
||||
|
||||
List<VulnFile> findByVulnKeyOrderByFileSeq(Integer vulnKey);
|
||||
|
||||
List<VulnFile> findByVulnKey(Integer vulnKey);
|
||||
|
||||
void deleteByVulnKey(Integer vulnKey);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.dbnt.faisp.fipTarget.repository;
|
||||
|
||||
|
||||
import com.dbnt.faisp.fipTarget.model.Vulnerable;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
|
||||
|
||||
public interface VulnRepository extends JpaRepository<Vulnerable, Integer> {
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,415 @@
|
|||
package com.dbnt.faisp.fipTarget.service;
|
||||
|
||||
|
||||
|
||||
import com.dbnt.faisp.config.BaseService;
|
||||
import com.dbnt.faisp.fipTarget.mapper.FipTargetMapper;
|
||||
import com.dbnt.faisp.fipTarget.model.PartInfo;
|
||||
import com.dbnt.faisp.fipTarget.model.PartInfo.PartInfoId;
|
||||
import com.dbnt.faisp.fipTarget.model.PartInfoFile;
|
||||
import com.dbnt.faisp.fipTarget.model.PartInfoFile.PartInfoFileId;
|
||||
import com.dbnt.faisp.fipTarget.model.PartWork;
|
||||
import com.dbnt.faisp.fipTarget.model.PartWork.PartWorkId;
|
||||
import com.dbnt.faisp.fipTarget.model.PartWorkFile;
|
||||
import com.dbnt.faisp.fipTarget.model.PartWorkFile.PartWorkFileId;
|
||||
import com.dbnt.faisp.fipTarget.model.VulnFile;
|
||||
import com.dbnt.faisp.fipTarget.model.VulnFile.VulnFileId;
|
||||
import com.dbnt.faisp.fipTarget.model.Vulnerable;
|
||||
import com.dbnt.faisp.fipTarget.repository.PartInfoFileRepository;
|
||||
import com.dbnt.faisp.fipTarget.repository.PartInfoRepository;
|
||||
import com.dbnt.faisp.fipTarget.repository.PartWorkFileRepository;
|
||||
import com.dbnt.faisp.fipTarget.repository.PartWorkRepository;
|
||||
import com.dbnt.faisp.fipTarget.repository.VulnFileRepository;
|
||||
import com.dbnt.faisp.fipTarget.repository.VulnRepository;
|
||||
import com.dbnt.faisp.publicBoard.model.PublicFile;
|
||||
import com.dbnt.faisp.util.ParamMap;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class FipTargetService extends BaseService {
|
||||
@Value("${spring.servlet.multipart.location}")
|
||||
protected String locationPath;
|
||||
|
||||
private final PartInfoRepository partInfoRepository;
|
||||
private final PartInfoFileRepository partInfoFileRepository;
|
||||
private final PartWorkRepository partWorkRepository;
|
||||
private final PartWorkFileRepository partWorkFileRepository;
|
||||
private final VulnRepository vulnRepository;
|
||||
private final VulnFileRepository vulnFileRepository;
|
||||
private final FipTargetMapper fipTargetMapper;
|
||||
|
||||
@Transactional
|
||||
public void savePartInfo(PartInfo partInfo) {
|
||||
PartInfo dbPart = partInfoRepository.findFirstByOrderByPiSeqDesc();
|
||||
if(dbPart == null) {
|
||||
partInfo.setPiSeq(1);
|
||||
partInfo.setVersionNo(1);
|
||||
partInfoRepository.save(partInfo);
|
||||
} else {
|
||||
partInfo.setPiSeq(dbPart.getPiSeq()+1);
|
||||
partInfo.setVersionNo(1);
|
||||
partInfoRepository.save(partInfo);
|
||||
}
|
||||
saveUploadFiles(partInfo.getPiSeq(),partInfo.getVersionNo(), partInfo.getMultipartFileList());
|
||||
}
|
||||
|
||||
private void saveUploadFiles(Integer piSeq,Integer versionNo, List<MultipartFile> multipartFileList) {
|
||||
PartInfoFile lastFileInfo = partInfoFileRepository.findTopByPiSeqAndVersionNoOrderByFileSeqDesc(piSeq,versionNo);
|
||||
int fileSeq = lastFileInfo==null?1:(lastFileInfo.getFileSeq()+1);
|
||||
if(multipartFileList == null || multipartFileList.isEmpty()) {
|
||||
if(lastFileInfo == null || lastFileInfo.getOrigNm() == null ) {
|
||||
PartInfoFile fileInfo = new PartInfoFile();
|
||||
fileInfo.setFileSeq(fileSeq);
|
||||
fileInfo.setPiSeq(piSeq);
|
||||
fileInfo.setVersionNo(versionNo);
|
||||
partInfoFileRepository.save(fileInfo);
|
||||
}
|
||||
|
||||
} else {
|
||||
for(MultipartFile file : multipartFileList){
|
||||
String saveName = UUID.randomUUID().toString();
|
||||
String path = locationPath+File.separator+"publicFile"+File.separator;
|
||||
saveFile(file, new File(path+File.separator+saveName));
|
||||
|
||||
String originalFilename = file.getOriginalFilename();
|
||||
int extnIdx = originalFilename.lastIndexOf(".");
|
||||
PartInfoFile fileInfo = new PartInfoFile();
|
||||
fileInfo.setFileSeq(fileSeq++);
|
||||
fileInfo.setPiSeq(piSeq);
|
||||
fileInfo.setVersionNo(versionNo);
|
||||
fileInfo.setOrigNm(originalFilename.substring(0, extnIdx));
|
||||
fileInfo.setFileExtn(originalFilename.substring(extnIdx+1));
|
||||
fileInfo.setConvNm(saveName);
|
||||
fileInfo.setFileSize(calculationSize(file.getSize()));
|
||||
fileInfo.setFilePath(path);
|
||||
partInfoFileRepository.save(fileInfo);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<PartInfo> selectPartInfoList(PartInfo partInfo) {
|
||||
return fipTargetMapper.selectPartInfoList(partInfo);
|
||||
}
|
||||
|
||||
public Integer selectPartInfoListCnt(PartInfo partInfo) {
|
||||
return fipTargetMapper.selectPartInfoListCnt(partInfo);
|
||||
}
|
||||
|
||||
public ParamMap selectWorkTypeTotal(PartInfo partInfo) {
|
||||
return fipTargetMapper.selectWorkTypeTotal(partInfo);
|
||||
}
|
||||
|
||||
public PartInfo selectPartInfo(PartInfo partInfo) {
|
||||
return fipTargetMapper.selectPartInfo(partInfo);
|
||||
}
|
||||
|
||||
public List<PartInfoFile> selectPartInfoFile(PartInfo partInfo) {
|
||||
return fipTargetMapper.selectPartInfoFile(partInfo);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void updatePartInfo(PartInfo partInfo, List<Integer> deleteFileSeq) {
|
||||
PartInfo dbPart = partInfoRepository.findById(new PartInfoId(partInfo.getPiSeq(), partInfo.getVersionNo())).orElse(null);
|
||||
PartInfo partTmp = new PartInfo();
|
||||
partTmp.setPiSeq(dbPart.getPiSeq());
|
||||
partTmp.setVersionNo(dbPart.getVersionNo()+1);
|
||||
partTmp.setMgtOrgan(partInfo.getMgtOrgan());
|
||||
partTmp.setLandPolice(partInfo.getLandPolice());
|
||||
partTmp.setPiUserSeq(partInfo.getPiUserSeq());
|
||||
partTmp.setRentType(partInfo.getRentType());
|
||||
partTmp.setRentPrice(partInfo.getRentPrice());
|
||||
partTmp.setUtilityType(partInfo.getUtilityType());
|
||||
partTmp.setUtilityPrice(partInfo.getUtilityPrice());
|
||||
partTmp.setTerminalNm(partInfo.getTerminalNm());
|
||||
partTmp.setMpWorkType(partInfo.getMpWorkType());
|
||||
partTmp.setMpPeopleCnt(partInfo.getMpPeopleCnt());
|
||||
partTmp.setMpDescription(partInfo.getMpDescription());
|
||||
partTmp.setPlWorkType(partInfo.getPlWorkType());
|
||||
partTmp.setPlPeopleCnt(partInfo.getPlPeopleCnt());
|
||||
partTmp.setPlDescription(partInfo.getPlDescription());
|
||||
partTmp.setWrtUserSeq(partInfo.getWrtUserSeq());
|
||||
partTmp.setWrtNm(partInfo.getWrtNm());
|
||||
partTmp.setWrtPart(partInfo.getWrtPart());
|
||||
partTmp.setWrtOrgan(partInfo.getWrtOrgan());
|
||||
partTmp.setWrtDt(partInfo.getWrtDt());
|
||||
partInfoRepository.save(partTmp);
|
||||
//업데이트하는 버전 파일조회
|
||||
List<PartInfoFile> fileList = partInfoFileRepository.findByPiSeqAndVersionNoOrderByFileSeqAsc(partInfo.getPiSeq(),partInfo.getVersionNo());
|
||||
if(fileList.get(0).getOrigNm() != null) {
|
||||
for(PartInfoFile fileInfo : fileList){
|
||||
PartInfoFile tmpFile = new PartInfoFile();
|
||||
tmpFile.setFileSeq(fileInfo.getFileSeq());
|
||||
tmpFile.setPiSeq(fileInfo.getPiSeq());
|
||||
tmpFile.setVersionNo(partTmp.getVersionNo());
|
||||
tmpFile.setOrigNm(fileInfo.getOrigNm());
|
||||
tmpFile.setConvNm(fileInfo.getConvNm());
|
||||
tmpFile.setFileExtn(fileInfo.getFileExtn());
|
||||
tmpFile.setFileSize(fileInfo.getFileSize());
|
||||
tmpFile.setFilePath(fileInfo.getFilePath());
|
||||
partInfoFileRepository.save(tmpFile);
|
||||
}
|
||||
}
|
||||
//수정시 삭제한 파일삭제
|
||||
if(deleteFileSeq!=null && deleteFileSeq.size()>0){
|
||||
deletePartInfoFile(partTmp.getPiSeq(),partTmp.getVersionNo(), deleteFileSeq);
|
||||
}
|
||||
//파일업로드
|
||||
saveUploadFiles(partTmp.getPiSeq(),partTmp.getVersionNo(), partInfo.getMultipartFileList());
|
||||
}
|
||||
|
||||
private void deletePartInfoFile(Integer piSeq,Integer versionNo, List<Integer> deleteFileSeq) {
|
||||
List<PartInfoFile> partInfoFileList = partInfoFileRepository.findByPiSeqAndVersionNoOrderByFileSeqAsc(piSeq,versionNo);
|
||||
for(PartInfoFile file: partInfoFileList){
|
||||
if(deleteFileSeq.contains(file.getFileSeq())){
|
||||
deleteStoredFile(new File(file.getFilePath(), file.getConvNm()));
|
||||
partInfoFileRepository.deleteById(new PartInfoFileId(file.getFileSeq(),piSeq,versionNo));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<PartInfo> selectPartInfoSeq(PartInfo partInfo) {
|
||||
return fipTargetMapper.selectPartInfoSeq(partInfo);
|
||||
}
|
||||
|
||||
public PartInfo selectPartInfoHistoryView(PartInfo partInfo) {
|
||||
return fipTargetMapper.selectPartInfoHistoryView(partInfo);
|
||||
}
|
||||
|
||||
public List<PartInfoFile> selectPartInfoFileHistoryView(PartInfo partInfo) {
|
||||
return fipTargetMapper.selectPartInfoFileHistoryView(partInfo);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void deletePartInfo(PartInfo partInfo) {
|
||||
//외사실적 파일,데이터삭제
|
||||
List<PartWorkFile> partWorkFileList = partWorkFileRepository.findByPiSeq(partInfo.getPiSeq());
|
||||
if(partWorkFileList != null) {
|
||||
for(PartWorkFile file: partWorkFileList){
|
||||
deleteStoredFile(new File(file.getFilePath(), file.getConvNm()));
|
||||
partWorkFileRepository.deleteByPwSeqAndPiSeq(file.getPwSeq(),file.getPiSeq());
|
||||
}
|
||||
}
|
||||
partWorkRepository.deleteByPiSeq(partInfo.getPiSeq());
|
||||
//외사분실운영현황파일삭제
|
||||
List<PartInfoFile> partInfoFileList= selectPartInfoFile(partInfo);
|
||||
for(PartInfoFile file: partInfoFileList){
|
||||
if(file.getOrigNm() != null){
|
||||
deleteStoredFile(new File(file.getFilePath(), file.getConvNm()));
|
||||
}
|
||||
}
|
||||
partInfoFileRepository.deleteByPiSeq(partInfo.getPiSeq());
|
||||
partInfoRepository.deleteByPiSeq(partInfo.getPiSeq());
|
||||
|
||||
}
|
||||
|
||||
public PartInfoFile selectPartInfoFileDown(Integer fileSeq, Integer piSeq, Integer versionNo) {
|
||||
return partInfoFileRepository.findById(new PartInfoFileId(fileSeq, piSeq,versionNo)).orElse(null);
|
||||
}
|
||||
|
||||
public String selectPartInfoFirstId(PartInfo partInfo) {
|
||||
return fipTargetMapper.selectPartInfoFirstId(partInfo.getPiSeq());
|
||||
}
|
||||
|
||||
public List<ParamMap> selectTerminalName(PartWork partWork) {
|
||||
return fipTargetMapper.selectTerminalName(partWork);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void savePartWork(PartWork partWork) {
|
||||
PartWork dbPart = partWorkRepository.findTopByPiSeqOrderByPwSeqDesc(partWork.getPiSeq());
|
||||
if(dbPart == null) {
|
||||
partWork.setPwSeq(1);
|
||||
partWorkRepository.save(partWork);
|
||||
} else {
|
||||
partWork.setPwSeq(dbPart.getPwSeq()+1);
|
||||
partWorkRepository.save(partWork);
|
||||
}
|
||||
if(partWork.getMultipartFileList()!= null){
|
||||
saveFilesUpload(partWork.getPwSeq(),partWork.getPiSeq(), partWork.getMultipartFileList());
|
||||
}
|
||||
}
|
||||
|
||||
private void saveFilesUpload(Integer pwSeq,Integer piSeq, List<MultipartFile> multipartFileList) {
|
||||
PartWorkFile lastFileInfo = partWorkFileRepository.findTopByPwSeqAndPiSeqOrderByFileSeqDesc(pwSeq,piSeq);
|
||||
int fileSeq = lastFileInfo==null?1:(lastFileInfo.getFileSeq()+1);
|
||||
for(MultipartFile file : multipartFileList){
|
||||
String saveName = UUID.randomUUID().toString();
|
||||
String path = locationPath+File.separator+"publicFile"+File.separator;
|
||||
saveFile(file, new File(path+File.separator+saveName));
|
||||
|
||||
String originalFilename = file.getOriginalFilename();
|
||||
int extnIdx = originalFilename.lastIndexOf(".");
|
||||
PartWorkFile fileInfo = new PartWorkFile();
|
||||
fileInfo.setFileSeq(fileSeq++);
|
||||
fileInfo.setPwSeq(pwSeq);
|
||||
fileInfo.setPiSeq(piSeq);
|
||||
fileInfo.setOrigNm(originalFilename.substring(0, extnIdx));
|
||||
fileInfo.setFileExtn(originalFilename.substring(extnIdx+1));
|
||||
fileInfo.setConvNm(saveName);
|
||||
fileInfo.setFileSize(calculationSize(file.getSize()));
|
||||
fileInfo.setFilePath(path);
|
||||
partWorkFileRepository.save(fileInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<PartWork> selectPartWorkList(PartWork partWork) {
|
||||
return fipTargetMapper.selectPartWorkList(partWork);
|
||||
}
|
||||
|
||||
public Integer selectPartWorkListCnt(PartWork partWork) {
|
||||
return fipTargetMapper.selectPartWorkListCnt(partWork);
|
||||
}
|
||||
|
||||
public PartWork selectPartWorkInfo(PartWork partWork) {
|
||||
return fipTargetMapper.selectPartWorkInfo(partWork);
|
||||
}
|
||||
|
||||
public List<PartWorkFile> selectPartWorkFile(PartWork partWork) {
|
||||
return partWorkFileRepository.findByPwSeqAndPiSeqOrderByFileSeqAsc(partWork.getPwSeq(),partWork.getPiSeq());
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void updatePartWork(PartWork partWork, List<Integer> deleteFileSeq) {
|
||||
PartWork dbParkWork = partWorkRepository.findById(new PartWorkId(partWork.getPwSeq(),partWork.getPiSeq())).orElse(null);
|
||||
partWork.setWrtNm(dbParkWork.getWrtNm());
|
||||
partWork.setWrtOrgan(dbParkWork.getWrtOrgan());
|
||||
partWork.setWrtPart(dbParkWork.getWrtPart());
|
||||
partWork.setWrtUserSeq(dbParkWork.getWrtUserSeq());
|
||||
partWorkRepository.save(partWork);
|
||||
if(deleteFileSeq!=null && deleteFileSeq.size()>0){
|
||||
deletePartWorkFile(partWork, deleteFileSeq);
|
||||
}
|
||||
if(partWork.getMultipartFileList()!= null){
|
||||
saveFilesUpload(partWork.getPwSeq(),partWork.getPiSeq(), partWork.getMultipartFileList());
|
||||
}
|
||||
}
|
||||
|
||||
private void deletePartWorkFile(PartWork partWork, List<Integer> deleteFileSeq) {
|
||||
List<PartWorkFile> partWorkFileList = partWorkFileRepository.findByPwSeqAndPiSeq(partWork.getPwSeq(),partWork.getPiSeq());
|
||||
for(PartWorkFile file: partWorkFileList ){
|
||||
if(deleteFileSeq.contains(file.getFileSeq())){
|
||||
deleteStoredFile(new File(file.getFilePath(), file.getConvNm()));
|
||||
partWorkFileRepository.delete(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void deletePartWork(PartWork partWork) {
|
||||
//파일삭제
|
||||
List<PartWorkFile> partWorkFileList= partWorkFileRepository.findByPwSeqAndPiSeq(partWork.getPwSeq(),partWork.getPiSeq());
|
||||
if(partWorkFileList != null) {
|
||||
for(PartWorkFile file: partWorkFileList){
|
||||
deleteStoredFile(new File(file.getFilePath(), file.getConvNm()));
|
||||
}
|
||||
}
|
||||
partWorkFileRepository.deleteByPwSeqAndPiSeq(partWork.getPwSeq(),partWork.getPiSeq());
|
||||
partWorkRepository.deleteByPwSeqAndPiSeq(partWork.getPwSeq(),partWork.getPiSeq());
|
||||
}
|
||||
|
||||
public PartWorkFile selectPartWorkFileDown(Integer fileSeq, Integer pwSeq, Integer piSeq) {
|
||||
return partWorkFileRepository.findById(new PartWorkFileId(fileSeq, pwSeq,piSeq)).orElse(null);
|
||||
}
|
||||
|
||||
public List<ParamMap> selecetVulnOrganList(Vulnerable vulnerable) {
|
||||
return fipTargetMapper.selecetVulnOrganList(vulnerable);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Integer saveVulnerable(Vulnerable vulnerable, List<Integer> deleteFileSeq) {
|
||||
Integer vulnKey = vulnRepository.save(vulnerable).getVulnKey();
|
||||
if(deleteFileSeq!=null && deleteFileSeq.size()>0){
|
||||
deleteVulnFile(vulnerable, deleteFileSeq);
|
||||
}
|
||||
if(vulnerable.getMultipartFileList()!= null){
|
||||
saveVulnerableFiles(vulnKey, vulnerable.getMultipartFileList());
|
||||
}
|
||||
return vulnKey;
|
||||
}
|
||||
|
||||
private void saveVulnerableFiles(Integer vulnKey, List<MultipartFile> multipartFileList) {
|
||||
VulnFile lastFileInfo = vulnFileRepository.findTopByVulnKeyOrderByFileSeqDesc(vulnKey);
|
||||
int fileSeq = lastFileInfo==null?1:(lastFileInfo.getFileSeq()+1);
|
||||
for(MultipartFile file : multipartFileList){
|
||||
String saveName = UUID.randomUUID().toString();
|
||||
String path = locationPath+File.separator+"publicFile"+File.separator;
|
||||
saveFile(file, new File(path+File.separator+saveName));
|
||||
|
||||
String originalFilename = file.getOriginalFilename();
|
||||
int extnIdx = originalFilename.lastIndexOf(".");
|
||||
VulnFile fileInfo = new VulnFile();
|
||||
fileInfo.setVulnKey(vulnKey);
|
||||
fileInfo.setFileSeq(fileSeq++);
|
||||
fileInfo.setOrigNm(originalFilename.substring(0, extnIdx));
|
||||
fileInfo.setFileExtn(originalFilename.substring(extnIdx+1));
|
||||
fileInfo.setConvNm(saveName);
|
||||
fileInfo.setFileSize(calculationSize(file.getSize()));
|
||||
fileInfo.setFilePath(path);
|
||||
vulnFileRepository.save(fileInfo);
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteVulnFile(Vulnerable vulnerable, List<Integer> deleteFileSeq) {
|
||||
List<VulnFile> VulnFileList = vulnFileRepository.findByVulnKey(vulnerable.getVulnKey());
|
||||
for(VulnFile file: VulnFileList ){
|
||||
if(deleteFileSeq.contains(file.getFileSeq())){
|
||||
deleteStoredFile(new File(file.getFilePath(), file.getConvNm()));
|
||||
vulnFileRepository.delete(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<ParamMap> selectVulnerableList(Vulnerable vulnerable) {
|
||||
return fipTargetMapper.selectVulnerableList(vulnerable);
|
||||
}
|
||||
|
||||
public List<Vulnerable> selectVulnInfoList(Vulnerable vulnerable) {
|
||||
return fipTargetMapper.selectVulnInfoList(vulnerable);
|
||||
}
|
||||
|
||||
public String selectOrganName(String mgtOrgan) {
|
||||
return fipTargetMapper.selectOrganName(mgtOrgan);
|
||||
}
|
||||
|
||||
public Vulnerable selectVulnInfo(Vulnerable vulnerable) {
|
||||
return fipTargetMapper.selectVulnInfo(vulnerable);
|
||||
}
|
||||
|
||||
public List<VulnFile> selectVulnFile(Integer vulnKey) {
|
||||
return vulnFileRepository.findByVulnKeyOrderByFileSeq(vulnKey);
|
||||
}
|
||||
|
||||
public VulnFile selectVulnInfoFileDown(Integer fileSeq, Integer vulnKey) {
|
||||
return vulnFileRepository.findById(new VulnFileId(fileSeq, vulnKey)).orElse(null);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void deleteVulnerable(Vulnerable vulnerable) {
|
||||
//파일삭제
|
||||
List<VulnFile> VulnFileList = vulnFileRepository.findByVulnKey(vulnerable.getVulnKey());
|
||||
if(VulnFileList != null) {
|
||||
for(VulnFile file: VulnFileList){
|
||||
deleteStoredFile(new File(file.getFilePath(), file.getConvNm()));
|
||||
}
|
||||
}
|
||||
vulnFileRepository.deleteByVulnKey(vulnerable.getVulnKey());
|
||||
vulnRepository.deleteById(vulnerable.getVulnKey());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,231 @@
|
|||
package com.dbnt.faisp.fpiMgt.affair;
|
||||
|
||||
import com.dbnt.faisp.authMgt.service.AuthMgtService;
|
||||
import com.dbnt.faisp.codeMgt.service.CodeMgtService;
|
||||
import com.dbnt.faisp.fpiMgt.affair.model.AffairBoard;
|
||||
import com.dbnt.faisp.fpiMgt.affair.model.AffairRating;
|
||||
import com.dbnt.faisp.fpiMgt.affair.service.AffairService;
|
||||
import com.dbnt.faisp.userInfo.model.UserInfo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/affair")
|
||||
public class AffairController { // 첩보수집활동 > 외사경찰 견문관리 > 견문관리
|
||||
private final AffairService affairService;
|
||||
private final AuthMgtService authMgtService;
|
||||
private final CodeMgtService codeMgtService;
|
||||
|
||||
@GetMapping("/affairMgt")
|
||||
public ModelAndView affairMgtPage(@AuthenticationPrincipal UserInfo loginUser, AffairBoard affairBoard){
|
||||
ModelAndView mav;
|
||||
if(affairBoard.getDashboardFlag()){
|
||||
mav = new ModelAndView("igActivities/fpiMgt/affair/affairMgtDashboard");
|
||||
affairBoard.setRowCnt(5);
|
||||
}else{
|
||||
mav = new ModelAndView("igActivities/fpiMgt/affair/affairMgt");
|
||||
}
|
||||
mav.addObject("page", "main");
|
||||
mav.addObject("searchUrl", "/affair/affairMgt");
|
||||
//메뉴권한 확인
|
||||
String accessAuth = authMgtService.selectAccessConfigList
|
||||
(loginUser.getUserSeq(), "/affair/affairMgt?affairCategory="+affairBoard.getAffairCategory()).get(0).getAccessAuth();
|
||||
switch (accessAuth){
|
||||
case "ACC001": // 조회
|
||||
case "ACC002": // 작성
|
||||
affairBoard.setWrtUserSeq(loginUser.getUserSeq());
|
||||
break;
|
||||
case "ACC003": // 관리 // 자신 외 하위 기관에서 작성한 문서 열람가능
|
||||
affairBoard.setDownOrganCdList(loginUser.getDownOrganCdList());
|
||||
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
|
||||
break;
|
||||
}
|
||||
//결재권한 확인
|
||||
String apprvAuth = authMgtService.selectApprovalConfigList
|
||||
(loginUser.getUserSeq(), "/affair/affairMgt?affairCategory="+affairBoard.getAffairCategory()).get(0).getApprovalAuth();
|
||||
affairBoard.setRatingOrgan(loginUser.getOgCd());
|
||||
|
||||
mav.addObject("accessAuth", accessAuth);
|
||||
mav.addObject("apprvAuth", apprvAuth);
|
||||
affairBoard.setQueryInfo();
|
||||
mav.addObject("affairList", affairService.selectAffairBoardList(affairBoard));
|
||||
affairBoard.setContentCnt(affairService.selectAffairBoardListCnt(affairBoard));
|
||||
affairBoard.setPaginationInfo();
|
||||
mav.addObject("searchParams", affairBoard);
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/stayPage")
|
||||
public ModelAndView apprvStayPage(@AuthenticationPrincipal UserInfo loginUser, AffairBoard affairBoard){
|
||||
ModelAndView mav = new ModelAndView("igActivities/fpiMgt/affair/affairMgt");
|
||||
mav.addObject("page", "stay");
|
||||
mav.addObject("searchUrl", "/affair/stayPage");
|
||||
//메뉴권한 확인
|
||||
String accessAuth = authMgtService.selectAccessConfigList
|
||||
(loginUser.getUserSeq(), "/affair/affairMgt?affairCategory="+affairBoard.getAffairCategory()).get(0).getAccessAuth();
|
||||
switch (accessAuth){
|
||||
case "ACC001": // 조회
|
||||
case "ACC002": // 작성
|
||||
break;
|
||||
case "ACC003": // 관리 // 자신 외 하위 기관에서 작성한 문서 열람가능
|
||||
affairBoard.setDownOrganCdList(loginUser.getDownOrganCdList());
|
||||
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
|
||||
break;
|
||||
}
|
||||
//결재권한 확인
|
||||
String apprvAuth = authMgtService.selectApprovalConfigList
|
||||
(loginUser.getUserSeq(), "/affair/affairMgt?affairCategory="+affairBoard.getAffairCategory()).get(0).getApprovalAuth();
|
||||
affairBoard.setRatingOrgan(loginUser.getOgCd());
|
||||
if(apprvAuth==null) {
|
||||
if(!accessAuth.equals("ACC003")){
|
||||
affairBoard.setWrtUserSeq(loginUser.getUserSeq());
|
||||
affairBoard.setUserType("normalStayList");
|
||||
}else{
|
||||
affairBoard.setUserType("managerStayList");
|
||||
}
|
||||
}else{
|
||||
mav.addObject("userNm", loginUser.getUserNm());
|
||||
switch (apprvAuth){
|
||||
case "APC004": // 계장대행
|
||||
case "APC003": // 계장 // 결재대기 문서 조회
|
||||
affairBoard.setAffairStatus("DST002");
|
||||
break;
|
||||
case "APC002": // 부장대행
|
||||
case "APC001": // 부장 // 계장승인 문서 조회
|
||||
affairBoard.setAffairStatus("DST004");
|
||||
break;
|
||||
}
|
||||
}
|
||||
mav.addObject("userOrgan", loginUser.getOgCd());
|
||||
mav.addObject("accessAuth", accessAuth);
|
||||
mav.addObject("apprvAuth", apprvAuth);
|
||||
affairBoard.setQueryInfo();
|
||||
mav.addObject("affairList", affairService.selectAffairBoardList(affairBoard));
|
||||
affairBoard.setContentCnt(affairService.selectAffairBoardListCnt(affairBoard));
|
||||
affairBoard.setPaginationInfo();
|
||||
mav.addObject("searchParams", affairBoard);
|
||||
mav.addObject("ratingCodeList", codeMgtService.selectCodeMgtList("AAR"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/commitPage")
|
||||
public ModelAndView apprvCommitPage(@AuthenticationPrincipal UserInfo loginUser, AffairBoard affairBoard){
|
||||
ModelAndView mav = new ModelAndView("igActivities/fpiMgt/affair/affairMgt");
|
||||
mav.addObject("page", "commit");
|
||||
mav.addObject("searchUrl", "/affair/commitPage");
|
||||
//메뉴권한 확인
|
||||
String accessAuth = authMgtService.selectAccessConfigList
|
||||
(loginUser.getUserSeq(), "/affair/affairMgt?affairCategory="+affairBoard.getAffairCategory()).get(0).getAccessAuth();
|
||||
switch (accessAuth){
|
||||
case "ACC001": // 조회
|
||||
case "ACC002": // 작성
|
||||
break;
|
||||
case "ACC003": // 관리 // 자신 외 하위 기관에서 작성한 문서 열람가능
|
||||
affairBoard.setDownOrganCdList(loginUser.getDownOrganCdList());
|
||||
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
|
||||
break;
|
||||
}
|
||||
//결재권한 확인
|
||||
String apprvAuth = authMgtService.selectApprovalConfigList
|
||||
(loginUser.getUserSeq(), "/affair/affairMgt?affairCategory="+affairBoard.getAffairCategory()).get(0).getApprovalAuth();
|
||||
affairBoard.setRatingOrgan(loginUser.getOgCd());
|
||||
if(apprvAuth==null) {
|
||||
if(!accessAuth.equals("ACC003")){
|
||||
affairBoard.setWrtUserSeq(loginUser.getUserSeq());
|
||||
affairBoard.setUserType("normalCommitList");
|
||||
}else{
|
||||
affairBoard.setUserType("managerCommitList");
|
||||
}
|
||||
}else{
|
||||
switch (apprvAuth) {
|
||||
case "APC004": // 계장대행
|
||||
case "APC003": // 계장 // 계장반려, 계장승인 문서 조회
|
||||
affairBoard.setUserType("sectionCommitList");
|
||||
break;
|
||||
case "APC002": // 부장대행
|
||||
case "APC001": // 부장 // 부장반려, 부장승인 문서 조회
|
||||
affairBoard.setUserType("headCommitList");
|
||||
break;
|
||||
}
|
||||
}
|
||||
mav.addObject("accessAuth", accessAuth);
|
||||
mav.addObject("apprvAuth", apprvAuth);
|
||||
affairBoard.setQueryInfo();
|
||||
mav.addObject("affairList", affairService.selectAffairBoardList(affairBoard));
|
||||
affairBoard.setContentCnt(affairService.selectAffairBoardListCnt(affairBoard));
|
||||
affairBoard.setPaginationInfo();
|
||||
mav.addObject("searchParams", affairBoard);
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/affairEditModal")
|
||||
public ModelAndView affairEditModal(@AuthenticationPrincipal UserInfo loginUser, AffairBoard affairBoard){
|
||||
ModelAndView mav = new ModelAndView("igActivities/fpiMgt/affair/affairEditModal");
|
||||
if(affairBoard.getAffairKey()!=null){
|
||||
affairBoard = affairService.selectAffairBoard(affairBoard.getAffairKey());
|
||||
for(AffairRating rating: affairBoard.getRateList()){
|
||||
if(rating.getRatingOrgan().equals(loginUser.getOgCd())){
|
||||
affairBoard.setAffairStatus(rating.getAffairStatus());
|
||||
}
|
||||
}
|
||||
}else{
|
||||
affairBoard.setWrtOrgan(loginUser.getOgCd());
|
||||
affairBoard.setWrtPart(loginUser.getOfcCd());
|
||||
affairBoard.setWrtUserSeq(loginUser.getUserSeq());
|
||||
affairBoard.setWrtUserNm(loginUser.getUserNm());
|
||||
affairBoard.setWrtDt(LocalDateTime.now());
|
||||
affairBoard.setReportDt(LocalDate.now());
|
||||
}
|
||||
mav.addObject("affair", affairBoard);
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/affairViewModal")
|
||||
public ModelAndView affairViewModal(@AuthenticationPrincipal UserInfo loginUser, AffairBoard affairBoard){
|
||||
ModelAndView mav = new ModelAndView("igActivities/fpiMgt/affair/affairViewModal");
|
||||
affairBoard = affairService.selectAffairBoard(affairBoard.getAffairKey());
|
||||
for(AffairRating rating: affairBoard.getRateList()){
|
||||
if(rating.getRatingOrgan().equals(loginUser.getOgCd())){
|
||||
affairBoard.setAffairStatus(rating.getAffairStatus());
|
||||
}
|
||||
}
|
||||
mav.addObject("affair", affairBoard);
|
||||
mav.addObject("userSeq",loginUser.getUserSeq());
|
||||
mav.addObject("userOrgan", loginUser.getOgCd());
|
||||
//메뉴권한 확인
|
||||
mav.addObject("accessAuth", authMgtService.selectAccessConfigList
|
||||
(loginUser.getUserSeq(), "/affair/affairMgt?affairCategory="+affairBoard.getAffairCategory()).get(0).getAccessAuth());
|
||||
String apprvAuth = authMgtService.selectApprovalConfigList
|
||||
(loginUser.getUserSeq(), "/affair/affairMgt?affairCategory="+affairBoard.getAffairCategory()).get(0).getApprovalAuth();
|
||||
mav.addObject("apprvAuth", apprvAuth);
|
||||
if(apprvAuth!=null && (apprvAuth.equals("APC002") || apprvAuth.equals("APC001"))){
|
||||
mav.addObject("ratingCodeList", codeMgtService.selectCodeMgtList("AAR"));
|
||||
}
|
||||
return mav;
|
||||
}
|
||||
|
||||
@PostMapping("/saveAffair")
|
||||
public Integer saveAffair(AffairBoard affairBoard,
|
||||
MultipartHttpServletRequest request,
|
||||
@RequestParam(value = "fileSeq", required = false) List<Integer> deleteFileSeq){
|
||||
affairBoard.setMultipartFileList(request.getMultiFileMap().get("uploadFiles"));
|
||||
return affairService.saveAffairBoard(affairBoard, deleteFileSeq);
|
||||
}
|
||||
|
||||
@PostMapping("/affairStateChange")
|
||||
@ResponseBody
|
||||
public Integer affairStateChange(@AuthenticationPrincipal UserInfo loginUser, @RequestBody List<AffairRating> ratingList){
|
||||
return affairService.affairStateChange(loginUser, ratingList);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.dbnt.faisp.fpiMgt.affair.mapper;
|
||||
|
||||
import com.dbnt.faisp.fpiMgt.affair.model.AffairBoard;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface AffairMapper {
|
||||
|
||||
List<AffairBoard> selectAffairBoardList(AffairBoard affair);
|
||||
|
||||
Integer selectAffairBoardCnt(AffairBoard affair);
|
||||
|
||||
String selectHashTags(Integer affairKey);
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
package com.dbnt.faisp.fpiMgt.affair.model;
|
||||
|
||||
import com.dbnt.faisp.config.BaseModel;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "affair_board")
|
||||
public class AffairBoard extends BaseModel {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "affair_key")
|
||||
private Integer affairKey;
|
||||
@Column(name = "affair_type1")
|
||||
private String affairType1;
|
||||
@Column(name = "affair_type2")
|
||||
private String affairType2;
|
||||
@Column(name = "affair_type3")
|
||||
private String affairType3;
|
||||
@Column(name = "affair_type4")
|
||||
private String affairType4;
|
||||
@Column(name = "title")
|
||||
private String title;
|
||||
@Column(name = "content")
|
||||
private String content;
|
||||
@Column(name = "wrt_organ")
|
||||
private String wrtOrgan;
|
||||
@Column(name = "wrt_part")
|
||||
private String wrtPart;
|
||||
@Column(name = "wrt_user_nm")
|
||||
private String wrtUserNm;
|
||||
@Column(name = "wrt_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private LocalDateTime wrtDt;
|
||||
@Column(name = "wrt_user_seq")
|
||||
private Integer wrtUserSeq;
|
||||
@Column(name = "etc")
|
||||
private String etc;
|
||||
@Column(name = "report_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate reportDt;
|
||||
@Column(name = "auto_delete")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate autoDelete;
|
||||
@Column(name = "view_status")
|
||||
private String viewStatus;
|
||||
@Column(name = "affair_category")
|
||||
private String affairCategory;
|
||||
|
||||
@Transient
|
||||
private String organUp;
|
||||
@Transient
|
||||
private String affairRate;
|
||||
@Transient
|
||||
private String affairStatus;
|
||||
@Transient
|
||||
private String ratingOrgan;
|
||||
|
||||
@Transient
|
||||
private String hashTags;
|
||||
@Transient
|
||||
private Integer fileCnt;
|
||||
@Transient
|
||||
private String userType;
|
||||
@Transient
|
||||
private List<AffairFile> fileList;
|
||||
@Transient
|
||||
private List<AffairRating> rateList;
|
||||
@Transient
|
||||
private List<MultipartFile> multipartFileList;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package com.dbnt.faisp.fpiMgt.affair.model;
|
||||
|
||||
import com.dbnt.faisp.config.FileInfo;
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "affair_file")
|
||||
@IdClass(AffairFile.AffairFileId.class)
|
||||
public class AffairFile extends FileInfo {
|
||||
@Id
|
||||
@Column(name = "affair_key")
|
||||
private Integer affairKey;
|
||||
@Id
|
||||
@Column(name = "file_seq")
|
||||
private Integer fileSeq;
|
||||
@Column(name = "orig_nm")
|
||||
private String origNm;
|
||||
@Column(name = "conv_nm")
|
||||
private String convNm;
|
||||
@Column(name = "file_extn")
|
||||
private String fileExtn;
|
||||
@Column(name = "file_size")
|
||||
private String fileSize;
|
||||
@Column(name = "save_path")
|
||||
private String savePath;
|
||||
|
||||
|
||||
@Embeddable
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class AffairFileId implements Serializable {
|
||||
private Integer affairKey;
|
||||
private Integer fileSeq;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.dbnt.faisp.fpiMgt.affair.model;
|
||||
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "affair_rating")
|
||||
@IdClass(AffairRating.AffairRatingId.class)
|
||||
public class AffairRating{
|
||||
@Id
|
||||
@Column(name = "affair_key")
|
||||
private Integer affairKey;
|
||||
@Id
|
||||
@Column(name = "rating_organ")
|
||||
private String ratingOrgan;
|
||||
@Column(name = "section_nm")
|
||||
private String sectionNm;
|
||||
@Column(name = "section_apprv_dt")
|
||||
private LocalDateTime sectionApprvDt;
|
||||
@Column(name = "section_apprv")
|
||||
private String sectionApprv;
|
||||
@Column(name = "section_etc")
|
||||
private String sectionEtc;
|
||||
@Column(name = "head_nm")
|
||||
private String headNm;
|
||||
@Column(name = "head_apprv_dt")
|
||||
private LocalDateTime headApprvDt;
|
||||
@Column(name = "head_apprv")
|
||||
private String headApprv;
|
||||
@Column(name = "head_etc")
|
||||
private String headEtc;
|
||||
@Column(name = "affair_rate")
|
||||
private String affairRate;
|
||||
@Column(name = "organ_up")
|
||||
private String organUp;
|
||||
@Column(name = "affair_status")
|
||||
private String affairStatus;
|
||||
|
||||
|
||||
@Embeddable
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class AffairRatingId implements Serializable {
|
||||
private Integer affairKey;
|
||||
private String ratingOrgan;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.dbnt.faisp.fpiMgt.affair.model;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "hash_tag")
|
||||
public class HashTag{
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "tag_key")
|
||||
private Integer tagKey;
|
||||
@Column(name = "tag_nm")
|
||||
private String tagNm;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.dbnt.faisp.fpiMgt.affair.model;
|
||||
|
||||
import com.dbnt.faisp.config.FileInfo;
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "hash_tag_link")
|
||||
@IdClass(HashTagLink.HashTagLinkId.class)
|
||||
public class HashTagLink extends FileInfo {
|
||||
@Id
|
||||
@Column(name = "affair_key")
|
||||
private Integer affairKey;
|
||||
@Id
|
||||
@Column(name = "tag_key")
|
||||
private Integer tagKey;
|
||||
|
||||
|
||||
@Embeddable
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class HashTagLinkId implements Serializable {
|
||||
private Integer affairKey;
|
||||
private Integer tagKey;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.dbnt.faisp.fpiMgt.affair.repository;
|
||||
|
||||
import com.dbnt.faisp.fpiMgt.affair.model.AffairBoard;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
|
||||
public interface AffairBoardRepository extends JpaRepository<AffairBoard, Integer> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.dbnt.faisp.fpiMgt.affair.repository;
|
||||
|
||||
import com.dbnt.faisp.fpiMgt.affair.model.AffairFile;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
public interface AffairFileRepository extends JpaRepository<AffairFile, AffairFile.AffairFileId> {
|
||||
List<AffairFile> findByAffairKey(Integer affairKey);
|
||||
Optional<AffairFile> findTopByAffairKeyOrderByFileSeqDesc(Integer planKey);
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.dbnt.faisp.fpiMgt.affair.repository;
|
||||
|
||||
import com.dbnt.faisp.fpiMgt.affair.model.AffairRating;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface AffairRatingRepository extends JpaRepository<AffairRating, AffairRating.AffairRatingId> {
|
||||
List<AffairRating> findByAffairKeyOrderByRatingOrganAsc(Integer affairKey);
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.dbnt.faisp.fpiMgt.affair.repository;
|
||||
|
||||
import com.dbnt.faisp.fpiMgt.affair.model.HashTagLink;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
|
||||
public interface HashTagLinkRepository extends JpaRepository<HashTagLink, HashTagLink.HashTagLinkId> {
|
||||
void deleteByAffairKey(Integer affairKey);
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.dbnt.faisp.fpiMgt.affair.repository;
|
||||
|
||||
import com.dbnt.faisp.fpiMgt.affair.model.HashTag;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
public interface HashTagRepository extends JpaRepository<HashTag, Integer> {
|
||||
|
||||
Optional<HashTag> findByTagNm(String tagNm);
|
||||
}
|
||||
|
|
@ -0,0 +1,159 @@
|
|||
package com.dbnt.faisp.fpiMgt.affair.service;
|
||||
|
||||
|
||||
import com.dbnt.faisp.config.BaseService;
|
||||
import com.dbnt.faisp.config.FileInfo;
|
||||
import com.dbnt.faisp.fpiMgt.affair.mapper.AffairMapper;
|
||||
import com.dbnt.faisp.fpiMgt.affair.model.*;
|
||||
import com.dbnt.faisp.fpiMgt.affair.repository.*;
|
||||
import com.dbnt.faisp.userInfo.model.UserInfo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AffairService extends BaseService { // 견문보고
|
||||
private final AffairBoardRepository affairBoardRepository;
|
||||
private final AffairFileRepository affairFileRepository;
|
||||
private final AffairRatingRepository affairRatingRepository;
|
||||
private final HashTagRepository hashTagRepository;
|
||||
private final HashTagLinkRepository hashTagLinkRepository;
|
||||
private final AffairMapper affairMapper;
|
||||
|
||||
public List<AffairBoard> selectAffairBoardList(AffairBoard affair){
|
||||
return affairMapper.selectAffairBoardList(affair);
|
||||
}
|
||||
public Integer selectAffairBoardListCnt(AffairBoard affair){
|
||||
return affairMapper.selectAffairBoardCnt(affair);
|
||||
}
|
||||
|
||||
public AffairBoard selectAffairBoard(Integer affairKey){
|
||||
AffairBoard affair = affairBoardRepository.findById(affairKey).orElse(null);
|
||||
if(affair != null){
|
||||
affair.setHashTags(affairMapper.selectHashTags(affairKey));
|
||||
affair.setFileList(affairFileRepository.findByAffairKey(affairKey));
|
||||
affair.setRateList(affairRatingRepository.findByAffairKeyOrderByRatingOrganAsc(affairKey));
|
||||
}
|
||||
return affair;
|
||||
}
|
||||
@Transactional
|
||||
public Integer saveAffairBoard(AffairBoard affair, List<Integer> deleteFileSeq){
|
||||
Integer affairKey = affairBoardRepository.save(affair).getAffairKey();
|
||||
String[] hashTagAry = affair.getHashTags().split(" ");
|
||||
if(hashTagAry.length>0){
|
||||
saveHashTagLink(affairKey, hashTagAry);
|
||||
}
|
||||
if(deleteFileSeq != null && deleteFileSeq.size()>0){
|
||||
deleteAffairFile(affairKey, deleteFileSeq);
|
||||
}
|
||||
if(affair.getMultipartFileList()!=null){
|
||||
saveUploadFiles(affairKey, affair.getMultipartFileList());
|
||||
}
|
||||
|
||||
AffairRating rating = affairRatingRepository.findById(new AffairRating.AffairRatingId(affairKey,affair.getWrtOrgan())).orElse(null);
|
||||
if(rating == null){
|
||||
rating = new AffairRating();
|
||||
rating.setAffairKey(affairKey);
|
||||
rating.setRatingOrgan(affair.getWrtOrgan());
|
||||
}
|
||||
rating.setAffairStatus(affair.getAffairStatus());
|
||||
affairRatingRepository.save(rating);
|
||||
|
||||
return affairKey;
|
||||
}
|
||||
|
||||
private void saveHashTagLink(Integer affairKey, String[] hashTagAry){
|
||||
hashTagLinkRepository.deleteByAffairKey(affairKey);
|
||||
for(String tagNm : hashTagAry){
|
||||
HashTag savedTag = hashTagRepository.findByTagNm(tagNm).orElse(null);
|
||||
Integer tagKey;
|
||||
if(savedTag==null){
|
||||
HashTag tag = new HashTag();
|
||||
tag.setTagNm(tagNm);
|
||||
tagKey = hashTagRepository.save(tag).getTagKey();
|
||||
}else{
|
||||
tagKey = savedTag.getTagKey();
|
||||
}
|
||||
HashTagLink hashTagLink = new HashTagLink();
|
||||
hashTagLink.setAffairKey(affairKey);
|
||||
hashTagLink.setTagKey(tagKey);
|
||||
hashTagLinkRepository.save(hashTagLink);
|
||||
}
|
||||
}
|
||||
private void deleteAffairFile(Integer affairKey, List<Integer> deleteFileSeq) {
|
||||
List<AffairFile> affairFileList = affairFileRepository.findByAffairKey(affairKey);
|
||||
for(AffairFile file: affairFileList){
|
||||
if(deleteFileSeq.contains(file.getFileSeq())){
|
||||
deleteStoredFile(new File(file.getSavePath(), file.getConvNm()));
|
||||
affairFileRepository.delete(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void saveUploadFiles(Integer affairKey, List<MultipartFile> multipartFileList){
|
||||
AffairFile lastFileInfo = affairFileRepository.findTopByAffairKeyOrderByFileSeqDesc(affairKey).orElse(null);
|
||||
int fileSeq = lastFileInfo==null?1:(lastFileInfo.getFileSeq()+1);
|
||||
for(MultipartFile file : multipartFileList){
|
||||
String saveName = UUID.randomUUID().toString();
|
||||
String path = locationPath+File.separator+"affair"+File.separator;
|
||||
saveFile(file, new File(path+File.separator+saveName));
|
||||
|
||||
String originalFilename = file.getOriginalFilename();
|
||||
int extnIdx = originalFilename.lastIndexOf(".");
|
||||
AffairFile fileInfo = new AffairFile();
|
||||
fileInfo.setAffairKey(affairKey);
|
||||
fileInfo.setFileSeq(fileSeq++);
|
||||
fileInfo.setOrigNm(originalFilename.substring(0, extnIdx));
|
||||
fileInfo.setFileExtn(originalFilename.substring(extnIdx+1));
|
||||
fileInfo.setConvNm(saveName);
|
||||
fileInfo.setFileSize(calculationSize(file.getSize()));
|
||||
fileInfo.setSavePath(path);
|
||||
affairFileRepository.save(fileInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Integer affairStateChange(UserInfo loginUser, List<AffairRating> ratingList) {
|
||||
for(AffairRating rating : ratingList){
|
||||
AffairRating savedRating = affairRatingRepository.findById(new AffairRating.AffairRatingId(rating.getAffairKey(), loginUser.getOgCd())).orElse(null);
|
||||
if(savedRating != null){
|
||||
if(rating.getHeadApprv() == null){
|
||||
savedRating.setSectionNm(loginUser.getUserNm());
|
||||
savedRating.setSectionApprvDt(LocalDateTime.now());
|
||||
savedRating.setSectionApprv(rating.getSectionApprv());
|
||||
savedRating.setSectionEtc(rating.getSectionEtc());
|
||||
savedRating.setAffairStatus(rating.getSectionApprv());
|
||||
}else{
|
||||
savedRating.setHeadNm(loginUser.getUserNm());
|
||||
savedRating.setHeadApprvDt(LocalDateTime.now());
|
||||
savedRating.setHeadApprv(rating.getHeadApprv());
|
||||
savedRating.setHeadEtc(rating.getHeadEtc());
|
||||
savedRating.setAffairRate(rating.getAffairRate());
|
||||
savedRating.setOrganUp(rating.getOrganUp()==null?"F":rating.getOrganUp());
|
||||
savedRating.setAffairStatus(rating.getHeadApprv());
|
||||
if(savedRating.getOrganUp().equals("T")){
|
||||
List<String> organList = loginUser.getUpOrganCdList();
|
||||
String upOrgan = organList.get(organList.indexOf(savedRating.getRatingOrgan())-1);
|
||||
AffairRating upRating = new AffairRating();
|
||||
upRating.setRatingOrgan(upOrgan);
|
||||
upRating.setAffairKey(savedRating.getAffairKey());
|
||||
upRating.setAffairStatus("DST002");
|
||||
affairRatingRepository.save(upRating);
|
||||
}
|
||||
}
|
||||
affairRatingRepository.save(savedRating);
|
||||
}
|
||||
}
|
||||
return ratingList.size()>1?0:ratingList.get(0).getAffairKey();
|
||||
}
|
||||
|
||||
public FileInfo selectAffairFile(Integer parentKey, Integer fileSeq) {
|
||||
return affairFileRepository.findById(new AffairFile.AffairFileId(parentKey, fileSeq)).orElse(null);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,204 @@
|
|||
package com.dbnt.faisp.fpiMgt.affairPlan;
|
||||
|
||||
import com.dbnt.faisp.authMgt.service.AuthMgtService;
|
||||
import com.dbnt.faisp.fpiMgt.affairPlan.model.PlanApprv;
|
||||
import com.dbnt.faisp.fpiMgt.affairPlan.model.PlanBoard;
|
||||
import com.dbnt.faisp.fpiMgt.affairPlan.service.PlanService;
|
||||
import com.dbnt.faisp.userInfo.model.UserInfo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/affairPlan")
|
||||
public class PlanController { // 첩보수집활동 > 외사경찰 견문관리 > 계획수립
|
||||
private final PlanService planService;
|
||||
private final AuthMgtService authMgtService;
|
||||
|
||||
@GetMapping("/planMgt")
|
||||
public ModelAndView monthPlanPage(@AuthenticationPrincipal UserInfo loginUser, PlanBoard planBoard){
|
||||
ModelAndView mav = null;
|
||||
if(planBoard.getDashboardFlag()){
|
||||
mav = new ModelAndView("igActivities/fpiMgt/affairPlan/planMgtDashboard");
|
||||
planBoard.setRowCnt(5);
|
||||
}else{
|
||||
mav = new ModelAndView("igActivities/fpiMgt/affairPlan/planMgt");
|
||||
}
|
||||
mav.addObject("page", "main");
|
||||
mav.addObject("searchUrl", "/affairPlan/planMgt");
|
||||
//메뉴권한 확인
|
||||
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/affairPlan/planMgt").get(0).getAccessAuth();
|
||||
switch (accessAuth){
|
||||
case "ACC001": // 조회
|
||||
case "ACC002": // 작성 // 자신이 작성한 문서만 열람가능
|
||||
planBoard.setWrtUserSeq(loginUser.getUserSeq());
|
||||
break;
|
||||
case "ACC003": // 관리 // 자신 외 하위 기관에서 작성한 문서 열람가능
|
||||
planBoard.setDownOrganCdList(loginUser.getDownOrganCdList());
|
||||
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
|
||||
break;
|
||||
}
|
||||
//결재권한 확인
|
||||
String apprvAuth = authMgtService.selectApprovalConfigList(loginUser.getUserSeq(), "/affairPlan/planMgt").get(0).getApprovalAuth();
|
||||
mav.addObject("accessAuth", accessAuth);
|
||||
mav.addObject("apprvAuth", apprvAuth);
|
||||
planBoard.setQueryInfo();
|
||||
mav.addObject("planList", planService.selectPlanBoardList(planBoard));
|
||||
planBoard.setContentCnt(planService.selectPlanBoardListCnt(planBoard));
|
||||
planBoard.setPaginationInfo();
|
||||
mav.addObject("searchParams", planBoard);
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/stayPage")
|
||||
public ModelAndView apprvStayPage(@AuthenticationPrincipal UserInfo loginUser, PlanBoard planBoard){
|
||||
ModelAndView mav = new ModelAndView("igActivities/fpiMgt/affairPlan/planMgt");
|
||||
mav.addObject("page", "stay");
|
||||
mav.addObject("searchUrl", "/affairPlan/stayPage");
|
||||
//메뉴권한 확인
|
||||
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/affairPlan/planMgt").get(0).getAccessAuth();
|
||||
switch (accessAuth){
|
||||
case "ACC001": // 조회
|
||||
case "ACC002": // 작성 // 자신의 관서 내에서 작성한 문서만 열람가능
|
||||
planBoard.setWrtOrgan(loginUser.getOgCd());
|
||||
break;
|
||||
case "ACC003": // 관리 // 자신 외 하위 기관에서 작성한 문서 열람가능
|
||||
planBoard.setDownOrganCdList(loginUser.getDownOrganCdList());
|
||||
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
|
||||
break;
|
||||
}
|
||||
//결재권한 확인
|
||||
String apprvAuth = authMgtService.selectApprovalConfigList(loginUser.getUserSeq(), "/affairPlan/planMgt").get(0).getApprovalAuth();
|
||||
if(apprvAuth==null) {
|
||||
if(!accessAuth.equals("ACC003")){
|
||||
planBoard.setWrtUserSeq(loginUser.getUserSeq());
|
||||
planBoard.setUserType("normalStayList");
|
||||
}else{
|
||||
planBoard.setUserType("managerStayList");
|
||||
}
|
||||
}else{
|
||||
mav.addObject("userNm", loginUser.getUserNm());
|
||||
switch (apprvAuth){
|
||||
case "APC004": // 계장대행
|
||||
case "APC003": // 계장 // 결재대기 문서 조회
|
||||
planBoard.setPlanState("DST002");
|
||||
break;
|
||||
case "APC002": // 부장대행
|
||||
case "APC001": // 부장 // 계장승인 문서 조회
|
||||
planBoard.setPlanState("DST004");
|
||||
break;
|
||||
}
|
||||
}
|
||||
mav.addObject("accessAuth", accessAuth);
|
||||
mav.addObject("apprvAuth", apprvAuth);
|
||||
planBoard.setQueryInfo();
|
||||
mav.addObject("planList", planService.selectPlanBoardList(planBoard));
|
||||
planBoard.setContentCnt(planService.selectPlanBoardListCnt(planBoard));
|
||||
planBoard.setPaginationInfo();
|
||||
mav.addObject("searchParams", planBoard);
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/commitPage")
|
||||
public ModelAndView apprvCommitPage(@AuthenticationPrincipal UserInfo loginUser, PlanBoard planBoard){
|
||||
ModelAndView mav = new ModelAndView("igActivities/fpiMgt/affairPlan/planMgt");
|
||||
mav.addObject("page", "commit");
|
||||
mav.addObject("searchUrl", "/affairPlan/commitPage");
|
||||
//메뉴권한 확인
|
||||
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/affairPlan/planMgt").get(0).getAccessAuth();
|
||||
switch (accessAuth){
|
||||
case "ACC001": // 조회
|
||||
case "ACC002": // 작성 // 자신의 관서 내에서 작성한 문서만 열람가능
|
||||
planBoard.setWrtOrgan(loginUser.getOgCd());
|
||||
break;
|
||||
case "ACC003": // 관리 // 자신 외 하위 기관에서 작성한 문서 열람가능
|
||||
planBoard.setDownOrganCdList(loginUser.getDownOrganCdList());
|
||||
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
|
||||
break;
|
||||
}
|
||||
//결재권한 확인
|
||||
String apprvAuth = authMgtService.selectApprovalConfigList(loginUser.getUserSeq(), "/affairPlan/planMgt").get(0).getApprovalAuth();
|
||||
if(apprvAuth==null) {
|
||||
if(!accessAuth.equals("ACC003")){
|
||||
planBoard.setWrtUserSeq(loginUser.getUserSeq());
|
||||
planBoard.setUserType("normalCommitList");
|
||||
}else{
|
||||
planBoard.setUserType("managerCommitList");
|
||||
}
|
||||
}else{
|
||||
switch (apprvAuth) {
|
||||
case "APC004": // 계장대행
|
||||
case "APC003": // 계장 // 계장반려, 계장승인 문서 조회
|
||||
planBoard.setUserType("sectionCommitList");
|
||||
break;
|
||||
case "APC002": // 부장대행
|
||||
case "APC001": // 부장 // 부장반려, 부장승인 문서 조회
|
||||
planBoard.setUserType("headCommitList");
|
||||
break;
|
||||
}
|
||||
}
|
||||
mav.addObject("accessAuth", accessAuth);
|
||||
mav.addObject("apprvAuth", apprvAuth);
|
||||
planBoard.setQueryInfo();
|
||||
mav.addObject("planList", planService.selectPlanBoardList(planBoard));
|
||||
planBoard.setContentCnt(planService.selectPlanBoardListCnt(planBoard));
|
||||
planBoard.setPaginationInfo();
|
||||
mav.addObject("searchParams", planBoard);
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/planEditModal")
|
||||
public ModelAndView planEditModal(@AuthenticationPrincipal UserInfo loginUser, PlanBoard planBoard){
|
||||
ModelAndView mav = new ModelAndView("igActivities/fpiMgt/affairPlan/planEditModal");
|
||||
if(planBoard.getPlanKey()!=null){
|
||||
planBoard = planService.selectPlanBoard(planBoard.getPlanKey());
|
||||
}else{
|
||||
planBoard.setWrtOrgan(loginUser.getOgCd());
|
||||
planBoard.setWrtPart(loginUser.getOfcCd());
|
||||
planBoard.setWrtUserSeq(loginUser.getUserSeq());
|
||||
planBoard.setWrtUserNm(loginUser.getUserNm());
|
||||
planBoard.setWrtDt(LocalDateTime.now());
|
||||
}
|
||||
mav.addObject("plan", planBoard);
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping("/planViewModal")
|
||||
public ModelAndView planViewModal(@AuthenticationPrincipal UserInfo loginUser, PlanBoard planBoard){
|
||||
ModelAndView mav = new ModelAndView("igActivities/fpiMgt/affairPlan/planViewModal");
|
||||
planBoard = planService.selectPlanBoard(planBoard.getPlanKey());
|
||||
mav.addObject("plan", planBoard);
|
||||
mav.addObject("userSeq",loginUser.getUserSeq());
|
||||
//메뉴권한 확인
|
||||
mav.addObject("accessAuth", authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/affairPlan/planMgt").get(0).getAccessAuth());
|
||||
mav.addObject("apprvAuth", authMgtService.selectApprovalConfigList(loginUser.getUserSeq(), "/affairPlan/planMgt").get(0).getApprovalAuth());
|
||||
return mav;
|
||||
}
|
||||
|
||||
@PostMapping("/savePlan")
|
||||
public Integer savePlan(PlanBoard planBoard,
|
||||
@RequestParam(value = "planInfos", required = false) List<String> planInfos,
|
||||
@RequestParam(value = "detailPlanInfos", required = false)List<String> detailPlanInfos,
|
||||
MultipartHttpServletRequest request,
|
||||
@RequestParam(value = "fileSeq", required = false) List<Integer> deleteFileSeq){
|
||||
planBoard.setMultipartFileList(request.getMultiFileMap().get("uploadFiles"));
|
||||
return planService.savePlanBoard(planBoard, planInfos, detailPlanInfos, deleteFileSeq);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/planStateChange")
|
||||
public Integer planStateChange(@AuthenticationPrincipal UserInfo loginUser, PlanApprv apprv){
|
||||
apprv.setUserSeq(loginUser.getUserSeq());
|
||||
apprv.setUserNm(loginUser.getUserNm());
|
||||
apprv.setSaveDt(LocalDateTime.now());
|
||||
return planService.planStateChange(apprv);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.dbnt.faisp.fpiMgt.affairPlan.mapper;
|
||||
|
||||
import com.dbnt.faisp.fpiMgt.affairPlan.model.PlanBoard;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface PlanMapper {
|
||||
|
||||
List<PlanBoard> selectPlanBoardList(PlanBoard planBoard);
|
||||
|
||||
Integer selectPlanBoardListCnt(PlanBoard planBoard);
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.dbnt.faisp.fpiMgt.affairPlan.model;
|
||||
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "plan_apprv")
|
||||
@IdClass(PlanApprv.PlanApprvId.class)
|
||||
public class PlanApprv {
|
||||
@Id
|
||||
@Column(name = "plan_key")
|
||||
private Integer planKey;
|
||||
@Id
|
||||
@Column(name = "apprv_seq")
|
||||
private Integer apprvSeq;
|
||||
@Column(name = "state")
|
||||
private String state;
|
||||
@Column(name = "user_seq")
|
||||
private Integer userSeq;
|
||||
@Column(name = "user_nm")
|
||||
private String userNm;
|
||||
@Column(name = "etc")
|
||||
private String etc;
|
||||
@Column(name = "save_dt")
|
||||
private LocalDateTime saveDt;
|
||||
|
||||
@Embeddable
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class PlanApprvId implements Serializable {
|
||||
private Integer planKey;
|
||||
private Integer apprvSeq;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package com.dbnt.faisp.fpiMgt.affairPlan.model;
|
||||
|
||||
import com.dbnt.faisp.config.BaseModel;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "plan_board")
|
||||
public class PlanBoard extends BaseModel {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "plan_key")
|
||||
private Integer planKey;
|
||||
@Column(name = "content_title")
|
||||
private String contentTitle;
|
||||
@Column(name = "plan_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate planDt;
|
||||
@Column(name = "wrt_organ")
|
||||
private String wrtOrgan;
|
||||
@Column(name = "wrt_part")
|
||||
private String wrtPart;
|
||||
@Column(name = "wrt_user_nm")
|
||||
private String wrtUserNm;
|
||||
@Column(name = "wrt_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private LocalDateTime wrtDt;
|
||||
@Column(name = "plan_state")
|
||||
private String planState;
|
||||
@Column(name = "wrt_user_seq")
|
||||
private Integer wrtUserSeq;
|
||||
|
||||
@Transient
|
||||
private String userType;
|
||||
@Transient
|
||||
private Integer fileCnt;
|
||||
@Transient
|
||||
private List<PlanMainInfo> mainInfoList;
|
||||
@Transient
|
||||
private List<PlanApprv> apprvList;
|
||||
@Transient
|
||||
private List<PlanFile> fileList;
|
||||
@Transient
|
||||
private List<MultipartFile> multipartFileList;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package com.dbnt.faisp.fpiMgt.affairPlan.model;
|
||||
|
||||
import com.dbnt.faisp.config.FileInfo;
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "plan_file")
|
||||
@IdClass(PlanFile.PlanFileId.class)
|
||||
public class PlanFile extends FileInfo {
|
||||
@Id
|
||||
@Column(name = "plan_key")
|
||||
private Integer planKey;
|
||||
@Id
|
||||
@Column(name = "file_seq")
|
||||
private Integer fileSeq;
|
||||
@Column(name = "orig_nm")
|
||||
private String origNm;
|
||||
@Column(name = "conv_nm")
|
||||
private String convNm;
|
||||
@Column(name = "file_extn")
|
||||
private String fileExtn;
|
||||
@Column(name = "file_size")
|
||||
private String fileSize;
|
||||
@Column(name = "save_path")
|
||||
private String savePath;
|
||||
|
||||
|
||||
@Embeddable
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class PlanFileId implements Serializable {
|
||||
private Integer planKey;
|
||||
private Integer fileSeq;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
package com.dbnt.faisp.fpiMgt.affairPlan.model;
|
||||
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "plan_main_info")
|
||||
@IdClass(PlanMainInfo.PlanMainInfoId.class)
|
||||
public class PlanMainInfo {
|
||||
@Id
|
||||
@Column(name = "plan_key")
|
||||
private Integer planKey;
|
||||
@Id
|
||||
@Column(name = "plan_seq")
|
||||
private Integer planSeq;
|
||||
@Column(name = "plan_type")
|
||||
private String planType;
|
||||
@Column(name = "plan_info")
|
||||
private String planInfo;
|
||||
|
||||
@Embeddable
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class PlanMainInfoId implements Serializable {
|
||||
private Integer planKey;
|
||||
private Integer planSeq;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.dbnt.faisp.fpiMgt.affairPlan.repository;
|
||||
|
||||
import com.dbnt.faisp.fpiMgt.affairPlan.model.PlanApprv;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
public interface PlanApprvRepository extends JpaRepository<PlanApprv, PlanApprv.PlanApprvId> {
|
||||
Optional<PlanApprv> findTopByPlanKeyOrderByApprvSeqDesc(Integer planKey);
|
||||
|
||||
List<PlanApprv> findByPlanKey(Integer planKey);
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.dbnt.faisp.fpiMgt.affairPlan.repository;
|
||||
|
||||
import com.dbnt.faisp.fpiMgt.affairPlan.model.PlanBoard;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
|
||||
public interface PlanBoardRepository extends JpaRepository<PlanBoard, Integer> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.dbnt.faisp.fpiMgt.affairPlan.repository;
|
||||
|
||||
import com.dbnt.faisp.fpiMgt.affairPlan.model.PlanFile;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
public interface PlanFileRepository extends JpaRepository<PlanFile, PlanFile.PlanFileId> {
|
||||
List<PlanFile> findByPlanKey(Integer planKey);
|
||||
Optional<PlanFile> findTopByPlanKeyOrderByFileSeqDesc(Integer planKey);
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.dbnt.faisp.fpiMgt.affairPlan.repository;
|
||||
|
||||
import com.dbnt.faisp.fpiMgt.affairPlan.model.PlanMainInfo;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface PlanMainInfoRepository extends JpaRepository<PlanMainInfo, PlanMainInfo.PlanMainInfoId> {
|
||||
List<PlanMainInfo> findByPlanKey(Integer planKey);
|
||||
}
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
package com.dbnt.faisp.fpiMgt.affairPlan.service;
|
||||
|
||||
|
||||
import com.dbnt.faisp.config.BaseService;
|
||||
import com.dbnt.faisp.config.FileInfo;
|
||||
import com.dbnt.faisp.fpiMgt.affairPlan.mapper.PlanMapper;
|
||||
import com.dbnt.faisp.fpiMgt.affairPlan.model.PlanApprv;
|
||||
import com.dbnt.faisp.fpiMgt.affairPlan.model.PlanBoard;
|
||||
import com.dbnt.faisp.fpiMgt.affairPlan.model.PlanFile;
|
||||
import com.dbnt.faisp.fpiMgt.affairPlan.model.PlanMainInfo;
|
||||
import com.dbnt.faisp.fpiMgt.affairPlan.repository.PlanApprvRepository;
|
||||
import com.dbnt.faisp.fpiMgt.affairPlan.repository.PlanBoardRepository;
|
||||
import com.dbnt.faisp.fpiMgt.affairPlan.repository.PlanFileRepository;
|
||||
import com.dbnt.faisp.fpiMgt.affairPlan.repository.PlanMainInfoRepository;
|
||||
import com.dbnt.faisp.fpiMgt.affairResult.repository.ClearInfoRepository;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PlanService extends BaseService { // 월간계획
|
||||
private final PlanBoardRepository planBoardRepository;
|
||||
private final PlanFileRepository planFileRepository;
|
||||
private final PlanMainInfoRepository planMainInfoRepository;
|
||||
private final PlanApprvRepository planApprvRepository;
|
||||
private final PlanMapper planMapper;
|
||||
|
||||
public List<PlanBoard> selectPlanBoardList(PlanBoard planBoard) {
|
||||
return planMapper.selectPlanBoardList(planBoard);
|
||||
}
|
||||
|
||||
public Integer selectPlanBoardListCnt(PlanBoard planBoard) {
|
||||
return planMapper.selectPlanBoardListCnt(planBoard);
|
||||
}
|
||||
|
||||
public PlanBoard selectPlanBoard(Integer planKey) {
|
||||
PlanBoard savedPlan = planBoardRepository.findById(planKey).orElse(null);
|
||||
if (savedPlan != null) {
|
||||
savedPlan.setFileList(planFileRepository.findByPlanKey(planKey));
|
||||
savedPlan.setMainInfoList(planMainInfoRepository.findByPlanKey(planKey));
|
||||
savedPlan.setApprvList(planApprvRepository.findByPlanKey(planKey));
|
||||
}
|
||||
return savedPlan;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Integer savePlanBoard(PlanBoard planBoard, List<String> planInfos, List<String> detailPlanInfos, List<Integer> deleteFileSeq) {
|
||||
Integer planKey = planBoardRepository.save(planBoard).getPlanKey();
|
||||
Integer infoSeq = savePlanMainInfos(planKey,0, "S", planInfos);//요약 summery
|
||||
savePlanMainInfos(planKey, infoSeq, "D", detailPlanInfos);//상세 detail
|
||||
if(deleteFileSeq != null && deleteFileSeq.size()>0){
|
||||
deletePlanFile(planKey, deleteFileSeq);
|
||||
}
|
||||
if(planBoard.getMultipartFileList()!=null){
|
||||
saveUploadFiles(planKey, planBoard.getMultipartFileList());
|
||||
}
|
||||
return planKey;
|
||||
}
|
||||
|
||||
private Integer savePlanMainInfos(Integer planKey, Integer planSeq, String infoType, List<String> infoList){
|
||||
for(String info: infoList){
|
||||
PlanMainInfo planMainInfo = new PlanMainInfo();
|
||||
planMainInfo.setPlanKey(planKey);
|
||||
planMainInfo.setPlanSeq(++planSeq);
|
||||
planMainInfo.setPlanType(infoType);
|
||||
planMainInfo.setPlanInfo(info);
|
||||
planMainInfoRepository.save(planMainInfo);
|
||||
}
|
||||
return planSeq;
|
||||
}
|
||||
|
||||
private void saveUploadFiles(Integer planKey, List<MultipartFile> multipartFileList){
|
||||
PlanFile lastFileInfo = planFileRepository.findTopByPlanKeyOrderByFileSeqDesc(planKey).orElse(null);
|
||||
int fileSeq = lastFileInfo==null?1:(lastFileInfo.getFileSeq()+1);
|
||||
for(MultipartFile file : multipartFileList){
|
||||
String saveName = UUID.randomUUID().toString();
|
||||
String path = locationPath+File.separator+"monthPlan"+File.separator;
|
||||
saveFile(file, new File(path+File.separator+saveName));
|
||||
|
||||
String originalFilename = file.getOriginalFilename();
|
||||
int extnIdx = originalFilename.lastIndexOf(".");
|
||||
PlanFile fileInfo = new PlanFile();
|
||||
fileInfo.setPlanKey(planKey);
|
||||
fileInfo.setFileSeq(fileSeq++);
|
||||
fileInfo.setOrigNm(originalFilename.substring(0, extnIdx));
|
||||
fileInfo.setFileExtn(originalFilename.substring(extnIdx+1));
|
||||
fileInfo.setConvNm(saveName);
|
||||
fileInfo.setFileSize(calculationSize(file.getSize()));
|
||||
fileInfo.setSavePath(path);
|
||||
planFileRepository.save(fileInfo);
|
||||
}
|
||||
}
|
||||
|
||||
private void deletePlanFile(Integer planKey, List<Integer> deleteFileSeq) {
|
||||
List<PlanFile> planFileList = planFileRepository.findByPlanKey(planKey);
|
||||
for(PlanFile file: planFileList){
|
||||
if(deleteFileSeq.contains(file.getFileSeq())){
|
||||
deleteStoredFile(new File(file.getSavePath(), file.getConvNm()));
|
||||
planFileRepository.delete(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FileInfo selectPlanFile(Integer planKey, Integer fileSeq) {
|
||||
return planFileRepository.findById(new PlanFile.PlanFileId(planKey, fileSeq)).orElse(null);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Integer planStateChange(PlanApprv apprv) {
|
||||
PlanBoard savedPlan = planBoardRepository.findById(apprv.getPlanKey()).orElse(null);
|
||||
savedPlan.setPlanState(apprv.getState());
|
||||
PlanApprv lastApprv = planApprvRepository.findTopByPlanKeyOrderByApprvSeqDesc(apprv.getPlanKey()).orElse(null);
|
||||
apprv.setApprvSeq(lastApprv==null?1:lastApprv.getApprvSeq()+1);
|
||||
planApprvRepository.save(apprv);
|
||||
return apprv.getApprvSeq();
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue