Adding files in project 'faisp' to Git...

master
mrson 2022-12-22 10:55:19 +09:00
commit 0cff930690
5104 changed files with 310828 additions and 0 deletions

38
.gitignore vendored Normal file
View File

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

8
README.md Normal file
View File

@ -0,0 +1,8 @@
#해양경찰청 외사종합포털
java 11
postgreSql 14.2
springboot 2.7.2
thymeleaf 3.0.15
bootstrap 5.2.0

55
build.gradle Normal file
View File

@ -0,0 +1,55 @@
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-web:2.7.2'
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2'
//thymeleaf
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf:2.7.2'
implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:3.1.0'
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5:3.0.4.RELEASE'
developmentOnly 'org.springframework.boot:spring-boot-devtools:2.7.2'
implementation 'org.bgee.log4jdbc-log4j2:log4jdbc-log4j2-jdbc4.1:1.16'
runtimeOnly 'org.postgresql:postgresql:42.3.6'
implementation 'com.oracle.database.jdbc:ojdbc8:21.7.0.0'
implementation files('libs/tibero6-jdbc.jar')
// json
implementation group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
//
implementation 'org.apache.poi:poi:4.1.0'
implementation 'org.apache.poi:poi-ooxml:4.1.0'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor:2.7.2'
annotationProcessor 'org.projectlombok:lombok:1.18.24'
//crossEditor
//implementation files('libs/commons-codec-1.15.jar') // .
implementation files('libs/commons-fileupload-1.4.jar')
implementation files('libs/commons-io-2.11.0.jar')
implementation files('libs/java-json.jar')
}

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

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

240
gradlew vendored Normal file
View File

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

91
gradlew.bat vendored Normal file
View File

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

BIN
libs/commons-codec-1.15.jar Normal file

Binary file not shown.

Binary file not shown.

BIN
libs/commons-io-2.11.0.jar Normal file

Binary file not shown.

BIN
libs/java-json.jar Normal file

Binary file not shown.

BIN
libs/tibero6-jdbc.jar Normal file

Binary file not shown.

1
settings.gradle Normal file
View File

@ -0,0 +1 @@
rootProject.name = 'faisp'

View File

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

View File

@ -0,0 +1,106 @@
package com.dbnt.faisp.config;
import com.dbnt.faisp.main.codeMgt.model.CodeMgt;
import com.dbnt.faisp.main.menuMgt.service.MenuMgtService;
import com.dbnt.faisp.main.organMgt.service.OrganConfigService;
import com.dbnt.faisp.main.userInfo.model.UserInfo;
import com.dbnt.faisp.main.codeMgt.service.CodeMgtService;
import com.dbnt.faisp.main.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.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.Map;
@RestController
@RequiredArgsConstructor
public class BaseController {
private final CodeMgtService codeMgtService;
private final OrganConfigService organConfigService;
private final MenuMgtService menuMgtService;
@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");
return mav;
}
@GetMapping("/login-error")
public ModelAndView loginError() {
ModelAndView mav = new ModelAndView("login/login");
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;
}
@GetMapping("/selectBoxOptions")
public ModelAndView codeMgtPage(String categoryCd, String selectedCd) {
ModelAndView mav = new ModelAndView("common/selectBox/options");
mav.addObject("codeList", codeMgtService.selectCodeMgtList(categoryCd));
mav.addObject("selectedCd", selectedCd);
return mav;
}
@GetMapping("/resetSession")
public ModelAndView resetSession(@AuthenticationPrincipal UserInfo loginUser, HttpServletRequest request){
setSession(loginUser, request.getSession());
return new ModelAndView("redirect:/dashboard");
}
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()));
Map<String, List<CodeMgt>> codeMap = codeMgtService.getCommonCode();
session.setAttribute("commonCode", codeMap);
session.setAttribute("userSeq", loginUser.getUserSeq());
session.setAttribute("userOrgan", loginUser.getOgCd());
String belongValue = "";
belongValue += searchCodeValue(loginUser.getOgCd(), codeMap.get("OG"));
belongValue += searchCodeValue(loginUser.getOfcCd(), codeMap.get("OFC"));
belongValue += searchCodeValue(loginUser.getTitleCd(), codeMap.get("JT"));
belongValue += loginUser.getUserNm()+"("+loginUser.getUserId()+")";
session.setAttribute("belongValue", belongValue);
}
private String searchCodeValue(String itemCd, List<CodeMgt> codeList){
if(itemCd==null){
return "";
}else{
for(CodeMgt code: codeList){
if(itemCd.equals(code.getItemCd())){
return code.getItemValue()+" ";
}
}
}
return "";
}
}

View File

@ -0,0 +1,69 @@
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=20; //한 페이지에 표현되는 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;
@Transient
private Integer refDocKey;
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);
}
}

View File

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

View File

@ -0,0 +1,137 @@
package com.dbnt.faisp.config;
import com.dbnt.faisp.util.ParamMap;
import com.dbnt.faisp.util.Utils;
import lombok.RequiredArgsConstructor;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.ui.Model;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
@RestController
@RequiredArgsConstructor
public class EditorController {
@Value("${site.domain}")
protected String siteDomain;
@Value("${file.dir}")
protected String fileDir;
@Value("${file.dir.editor}")
protected String editorPath;
@Value("${editor.img.view}")
protected String imgView;
@PostMapping("/Crosseditor/uploadImg")
public @ResponseBody JSONObject uploadImg(Model model, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
JSONObject jsonObject = new JSONObject();
JSONObject data = new JSONObject();
JSONArray req_array = new JSONArray();
try {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest)request;
MultipartFile mFile = multipartRequest.getFile("imageFile");
if(!"".equals(mFile.getOriginalFilename())){
String attach_file_Name = mFile.getOriginalFilename();
String attach_save_Name = Utils.generationSaveName();
String imageKind = request.getParameter("imageKind");
String editorFrame = request.getParameter("editorFrame");
//파일 타입
String extNm = attach_file_Name.substring( attach_file_Name.lastIndexOf( "." ) + 1);
if("jpg,png,jpeg".contains(extNm.toLowerCase())) {
File dir = new File(fileDir+File.separator+editorPath);
if (!dir.exists()) {
try{
// 생성
boolean result2 = dir.mkdir();
if (result2) {
System.out.println("Directory is created.");
} else {
System.out.println("Failed to create directory.");
}
} catch(Exception e){
System.out.println("Exception occurred.");
e.getStackTrace();
}
} else {
System.out.println("Directory already exists");
}
File file = new File(fileDir+File.separator+editorPath, attach_save_Name +"."+ extNm);
FileCopyUtils.copy(mFile.getBytes(), file);
InputStream is = new FileInputStream(file);
BufferedImage input = ImageIO.read(is);
if(input.getWidth()>720){
int width = 720;
int height = (int) (input.getHeight()*(720d/input.getWidth()));
Image resizeImage = input.getScaledInstance(width, height, Image.SCALE_SMOOTH);
BufferedImage output = new BufferedImage(width, height, input.getType());
Graphics graphics = output.createGraphics();
graphics.drawImage(resizeImage, 0, 0, null);
graphics.dispose();
ImageIO.write(output, extNm, file);
}
String webPath = siteDomain+ imgView + attach_save_Name +"."+ extNm;
jsonObject.put("result","success");
data.put("imageURL",webPath);
data.put("imageKind", imageKind);
data.put("editorFrame", editorFrame);
req_array.add(data);
jsonObject.put("addmsg", req_array);
} else {
ParamMap error = new ParamMap();
error.set("message", "Check File Extentions.");
}
} else {
ParamMap error = new ParamMap();
error.set("message", "Check File Extentions.");
}
} catch (Exception e) {
ParamMap error = new ParamMap();
error.set("message", "Check File Extentions.");
}
return jsonObject;
}
}

View File

@ -0,0 +1,57 @@
package com.dbnt.faisp.config;
import com.dbnt.faisp.main.userInfo.model.UserAlarm;
import com.dbnt.faisp.main.userInfo.model.UserRequestLog;
import com.dbnt.faisp.main.userInfo.service.UserAlarmService;
import com.dbnt.faisp.main.userInfo.service.UserLogService;
import com.dbnt.faisp.util.Utils;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Component
@RequiredArgsConstructor
public class FaispInterceptor implements HandlerInterceptor {
private final UserLogService userLogService;
private final UserAlarmService userAlarmService;
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView mav) throws Exception {
if (mav!=null){
String xReq = request.getHeader("X-Requested-With");
if(xReq == null || !xReq.equals("XMLHttpRequest")){
// mav가 있으면서 ajax요청이 아닐 때 알람 조회.
UserAlarm param = new UserAlarm();
param.setUserSeq((Integer) request.getSession().getAttribute("userSeq"));
param.setViewYn("N");
param.setQueryInfo();
mav.addObject("alarmList", userAlarmService.selectAlarmList(param));
mav.addObject("alarmListCnt", userAlarmService.selectAlarmListCnt(param));
}
}
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
//페이지 렌더링 후 실행.
if(request.getParameter("dashboardFlag") == null){
// 대시보드 ajax 조회 로그 저장시 키 중첩으로 오류 발생.
// 대시보드 ajax 조회는 로그를 쌓지 않음.
UserRequestLog log = new UserRequestLog();
log.setContactIp(Utils.getClientIP(request));
log.setRequestUrl(request.getRequestURI());
log.setRequestMethod(request.getMethod());
log.setSearchParams(request.getQueryString());
log.setHandlerDescription(((HandlerMethod) handler).toString());
log.setUserOrgan((String) request.getSession().getAttribute("userOrgan"));
log.setUserBelong((String) request.getSession().getAttribute("belongValue"));
userLogService.saveRequestLog(log);
}
}
}

View File

@ -0,0 +1,198 @@
package com.dbnt.faisp.config;
import com.dbnt.faisp.main.faRpt.service.FaRptService;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.service.FishingBoatService;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.service.SailorService;
import com.dbnt.faisp.main.fpiMgt.affair.service.AffairService;
import com.dbnt.faisp.main.fpiMgt.affairPlan.service.PlanService;
import com.dbnt.faisp.main.fpiMgt.affairResult.service.ResultService;
import com.dbnt.faisp.main.fpiMgt.sri.service.SriService;
import com.dbnt.faisp.main.ivsgtMgt.boardInvestigation.service.BoardInvestigationService;
import com.dbnt.faisp.main.publicBoard.service.PublicBoardService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLEncoder;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@RestController
@RequiredArgsConstructor
@RequestMapping("/file")
public class FileController {
private final FaRptService faRptService;
private final PlanService planService;
private final PublicBoardService publicBoardService;
private final AffairService affairService;
private final ResultService resultService;
private final BoardInvestigationService boardInvestigationService;
private final FishingBoatService fishingBoatService;
private final SriService sriService;
@Value("${file.dir}")
protected String fileDir;
@Value("${file.dir.editor}")
protected String editorPath;
@GetMapping("/editorFileDisplay")
public ResponseEntity<Resource> editorFileDisplay(HttpServletRequest request,
HttpServletResponse response,
String fileNm) {
String pathStr = fileDir+File.separator+editorPath+File.separator+fileNm;
Resource resource = new FileSystemResource(pathStr);
if(!resource.exists()){
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
HttpHeaders header = new HttpHeaders();
Path filePath = null;
try {
filePath = Paths.get(pathStr);
header.add("Content-type", Files.probeContentType(filePath));
}catch (IOException e){
e.printStackTrace();
}
return new ResponseEntity<Resource>(resource, header, HttpStatus.OK);
}
@GetMapping("/fileDisplay")
public ResponseEntity<Resource> fileDisplay(HttpServletRequest request,
HttpServletResponse response,
String board,
Integer parentKey,
Integer fileSeq) {
FileInfo fileInfo = getFileInfo(board, parentKey, fileSeq);
String pathStr = fileInfo.getSavePath()+fileInfo.getConvNm();
Resource resource = new FileSystemResource(pathStr);
if(!resource.exists()){
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
HttpHeaders header = new HttpHeaders();
Path filePath = null;
try {
filePath = Paths.get(pathStr);
header.add("Content-type", Files.probeContentType(filePath));
}catch (IOException e){
e.printStackTrace();
}
return new ResponseEntity<Resource>(resource, header, HttpStatus.OK);
}
@GetMapping("/fileDownload")
public void fileDownload(HttpServletRequest request,
HttpServletResponse response,
String board,
Integer parentKey,
Integer fileSeq) {
FileInfo fileInfo = getFileInfo(board, parentKey, fileSeq);
BufferedInputStream in;
BufferedOutputStream out;
try {
File file = new File(fileInfo.getSavePath(), fileInfo.getConvNm());
setDisposition(fileInfo.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 FileInfo getFileInfo(String board, Integer parentKey, Integer fileSeq){
FileInfo downloadFile = null;
switch (board){
case "faRpt":
downloadFile = faRptService.selectFaRptFile(parentKey, fileSeq);
break;
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;
case "sailor":
downloadFile = fishingBoatService.selectSailorFile(parentKey, fileSeq);
break;
case "sri":
downloadFile = sriService.selectFaSriFile(parentKey, fileSeq);
break;
}
return downloadFile;
}
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";
}
}

View File

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

View File

@ -0,0 +1,59 @@
package com.dbnt.faisp.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.PlatformTransactionManager;
import javax.sql.DataSource;
import java.util.HashMap;
//@Configuration
//@EnableJpaRepositories(
// basePackages = "com.dbnt.faisp.kwms.repository",
// entityManagerFactoryRef = "kwmsEntityManager",
// transactionManagerRef = "kwmsTransactionManager"
//)
public class KwmsDatabaseConfig {
// @Autowired
// private Environment env;
//
// @Bean
// public LocalContainerEntityManagerFactoryBean kwmsEntityManager(){
// LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
// em.setDataSource(kwmsDataSource());
//
// //Entity 패키지 경로
// em.setPackagesToScan(new String[] { "com.dbnt.faisp.kwms.model" });
//
// HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
// em.setJpaVendorAdapter(vendorAdapter);
//
// //Hibernate 설정
// HashMap<String, Object> properties = new HashMap<>();
// properties.put("hibernate.hbm2ddl.auto", "none");
// properties.put("hibernate.dialect", "org.hibernate.dialect.Oracle10gDialect");
// em.setJpaPropertyMap(properties);
// return em;
// }
//
// @Bean
// @ConfigurationProperties(prefix="spring.datasource-kwms")
// public DataSource kwmsDataSource() {
// return DataSourceBuilder.create().build();
// }
//
// @Bean
// public PlatformTransactionManager kwmsTransactionManager() {
// JpaTransactionManager transactionManager = new JpaTransactionManager();
// transactionManager.setEntityManagerFactory(kwmsEntityManager().getObject());
// return transactionManager;
// }
}

View File

@ -0,0 +1,64 @@
package com.dbnt.faisp.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.PlatformTransactionManager;
import javax.sql.DataSource;
import java.util.HashMap;
@Configuration
@EnableJpaRepositories(
basePackages = "com.dbnt.faisp.main.**.repository",
entityManagerFactoryRef = "masterEntityManager",
transactionManagerRef = "masterTransactionManager"
)
public class MainDatabaseConfig {
@Autowired
private Environment env;
@Bean
@Primary
public LocalContainerEntityManagerFactoryBean masterEntityManager(){
LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(masterDataSource());
//Entity 패키지 경로
em.setPackagesToScan(new String[] { "com.dbnt.faisp.main.**.model" });
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
em.setJpaVendorAdapter(vendorAdapter);
//Hibernate 설정
HashMap<String, Object> properties = new HashMap<>();
properties.put("hibernate.hbm2ddl.auto", "none");
properties.put("hibernate.dialect", "org.hibernate.dialect.PostgreSQLDialect");
em.setJpaPropertyMap(properties);
return em;
}
@Primary
@Bean
@ConfigurationProperties(prefix="spring.datasource-main")
public DataSource masterDataSource() {
return DataSourceBuilder.create().build();
}
@Primary
@Bean
public PlatformTransactionManager masterTransactionManager() {
JpaTransactionManager transactionManager = new JpaTransactionManager();
transactionManager.setEntityManagerFactory(masterEntityManager().getObject());
return transactionManager;
}
}

View File

@ -0,0 +1,84 @@
package com.dbnt.faisp.config;
import com.dbnt.faisp.main.codeMgt.service.CodeMgtService;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.crackdownStatus.CrackdownStatus;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.repository.FishingBoatRepository;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.repository.ProcessResultRepository;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.repository.SailorRepository;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.repository.ViolationRepository;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.service.CrackdownStatusService;
import com.dbnt.faisp.main.menuMgt.model.MenuMgt;
import com.dbnt.faisp.main.menuMgt.service.MenuMgtService;
import com.dbnt.faisp.main.userInfo.model.UserInfo;
import com.dbnt.faisp.main.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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import java.util.List;
@RestController
@RequiredArgsConstructor
@RequestMapping("/modal")
public class ModalController {
private final MenuMgtService menuMgtService;
private final UserInfoService userInfoService;
private final CodeMgtService codeMgtService;
private final CrackdownStatusService crackdownStatusService;
private final ViolationRepository violationRepository;
private final ProcessResultRepository processResultRepository;
private final FishingBoatRepository fishingBoatRepository;
private final SailorRepository sailorRepository;
@GetMapping("/menuModal")
public ModelAndView menuModalPage(@AuthenticationPrincipal UserInfo loginUser, MenuMgt menuMgt){
ModelAndView mav = new ModelAndView("common/modal/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;
}
@GetMapping("/userModal")
public ModelAndView userMoadlPage(@AuthenticationPrincipal UserInfo loginUser, UserInfo userInfo){
ModelAndView mav = new ModelAndView("common/modal/userModal");
userInfo.setQueryInfo();
if(userInfo.getUserStatus() == null || userInfo.getUserStatus().equals("")) {
userInfo.setUserStatus("USC003");
}
mav.addObject("OgList", codeMgtService.selectCodeMgtList("OG"));
mav.addObject("OfcList", codeMgtService.selectCodeMgtList("OFC"));
mav.addObject("userInfoList", userInfoService.selectUserInfoList(userInfo));
userInfo.setContentCnt(userInfoService.selectUserInfoListCnt(userInfo));
userInfo.setPaginationInfo();
mav.addObject("searchParams", userInfo);
return mav;
}
@GetMapping("/crackdownStatusModal")
public ModelAndView crackdownStatusModal(@AuthenticationPrincipal UserInfo loginUser, CrackdownStatus crackdownStatus){
ModelAndView mav = new ModelAndView("common/modal/crackdownStatusModal");
crackdownStatus.setQueryInfo();
List<CrackdownStatus> crackdownList = crackdownStatusService.selectCrackdownStatusList(crackdownStatus);
for (CrackdownStatus cds: crackdownList) {
cds.setViolationList(violationRepository.findByFbKey(cds.getFbKey()));
cds.setProcessResult(processResultRepository.findByCdsKey(cds.getCdsKey()).orElse(null));
cds.setFishingBoat(fishingBoatRepository.findByCdsKey(cds.getCdsKey()).orElse(null));
cds.setSailorList(sailorRepository.findByFbKey(cds.getFbKey()));
}
mav.addObject("crackdownList", crackdownList);
crackdownStatus.setContentCnt(crackdownStatusService.selectCrackdownStatusListCnt(crackdownStatus));
crackdownStatus.setPaginationInfo();
mav.addObject("searchParams", crackdownStatus);
return mav;
}
}

View File

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

View File

@ -0,0 +1,174 @@
package com.dbnt.faisp.config;
import com.dbnt.faisp.main.userInfo.model.UserInfo;
import com.dbnt.faisp.main.userInfo.model.UserInoutLog;
import com.dbnt.faisp.main.userInfo.service.UserLogService;
import com.dbnt.faisp.util.Utils;
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.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.AuthenticationFailureHandler;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
import org.springframework.security.web.authentication.logout.LogoutHandler;
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;
private final UserLogService userLogService;
@Bean
public PasswordEncoder passwordEncoder(){
return new Pbkdf2PasswordEncoder();
}
@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());
UserInoutLog inoutLog = new UserInoutLog();
inoutLog.setInoutType("IOT001");
inoutLog.setContactIp(Utils.getClientIP(request));
inoutLog.setSessionId(request.getSession().getId());
inoutLog.setUserOrgan((String) request.getSession().getAttribute("userOrgan"));
inoutLog.setUserBelong((String) request.getSession().getAttribute("belongValue"));
userLogService.saveInoutLog(inoutLog);
if(savedRequest != null){
String targetUrl = savedRequest.getRedirectUrl();
new DefaultRedirectStrategy().sendRedirect(request,response,targetUrl);
}else{
new DefaultRedirectStrategy().sendRedirect(request,response,"/");
}
};
}
@Bean
public AuthenticationFailureHandler loginFailureHandler(){
return (request, response, exception) -> {
UserInoutLog inoutLog = new UserInoutLog();
inoutLog.setInoutType("IOT002");
inoutLog.setContactIp(Utils.getClientIP(request));
userLogService.saveInoutLog(inoutLog);
new DefaultRedirectStrategy().sendRedirect(request, response, "/login-error");
};
}
@Bean
public LogoutHandler logoutHandler(){
return (request, response, authentication) -> {
UserInoutLog inoutLog = new UserInoutLog();
inoutLog.setInoutType("IOT003");
inoutLog.setContactIp(Utils.getClientIP(request));
inoutLog.setSessionId(request.getSession().getId());
inoutLog.setUserOrgan((String) request.getSession().getAttribute("userOrgan"));
inoutLog.setUserBelong((String) request.getSession().getAttribute("belongValue"));
userLogService.saveInoutLog(inoutLog);
};
}
@Bean
protected SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http.authorizeRequests() // 페이지 권한 설정
.antMatchers(
"/dashboard",
"/myInfo/**",
"/modal/**",
"/selectBoxOptions",
"/publicBoard/**",
"/faRpt/**",
"/ivsgt/**",
"/target/**",
"/equip/**",
"/affairPlan/**",
"/affair/**",
"/affairResult/**",
"/faStatistics/**",
"/translator/**",
"/police/**",
"/sri/**",
"/resetSession"
).hasRole(Role.USER.name()) // USER 접근 허용
.antMatchers(
"/authMgt/**",
"/userMgt/**"
).hasRole(Role.SUB_ADMIN.name()) // SUB_ADMIN 접근 허용
.antMatchers(
"/codeMgt/**",
"/organMgt/**",
"/menuMgt/**"
).hasRole(Role.ADMIN.name()) // ADMIN 접근 허용
.antMatchers(
"/login",
"/css/**",
"/img/**",
"/js/**",
"/vendor/**",
"/Crosseditor/uploadImg"
).permitAll() // 로그인 페이지는 권한 없이 접근 허용
.and() // 로그인 설정
.formLogin().loginPage("/login") // Custom login form 사용
.failureHandler(loginFailureHandler()) // 로그인 실패시 동작 수행
.successHandler(loginSuccessHandler()) // 로그인 성공시 동작 수행.
.and() // 로그아웃 설정
.logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout")) // 로그아웃 시 URL 재정의
.addLogoutHandler(logoutHandler()) // 로그아웃 전 실행.
.logoutSuccessUrl("/login")
.invalidateHttpSession(true) // HTTP Session 초기화
.deleteCookies("JSESSIONID") // 특정 쿠키 제거
.and() // 403 예외처리 핸들링
//.exceptionHandling().accessDeniedPage("/denied");
.exceptionHandling()
.accessDeniedHandler(accessDeniedHandler())
.authenticationEntryPoint(authenticationEntryPoint());
// 나모 에디터 'X-Frame-Options' to 'DENY' 오류로 인하여 추가.
// https://computer-science-student.tistory.com/497
http.headers().frameOptions().sameOrigin();
// 나모에디터 이미지 업로드시 csrf 토큰을 추가할 수 없어서 예외처리.
http.csrf().ignoringAntMatchers("/Crosseditor/uploadImg");
return http.build();
}
}

View File

@ -0,0 +1,31 @@
package com.dbnt.faisp.config;
import org.apache.catalina.connector.Connector;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
//@Configuration
public class TomcatConfiguration {
@Value("${tomcat.ajp.protocol}")
private String protocol;
@Bean
public ServletWebServerFactory servletContainer() {
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
tomcat.addAdditionalTomcatConnectors(createAjpConnector());
return tomcat;
}
private Connector createAjpConnector() {
Connector ajpConnector = new Connector(protocol);
ajpConnector.setPort(8009);
ajpConnector.setSecure(false);
ajpConnector.setAllowTrace(false);
ajpConnector.setScheme("http");
return ajpConnector;
}
}

View File

@ -0,0 +1,31 @@
package com.dbnt.faisp.config;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
@RequiredArgsConstructor
public class WebMvcConfig implements WebMvcConfigurer {
private final FaispInterceptor faispInterceptor;
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(faispInterceptor)
.addPathPatterns("/**")
.excludePathPatterns(
"/",
"/login",
"/favicon.ico",
"/editorFileDisplay",
"/fileDisplay",
"/css/**",
"/img/**",
"/js/**",
"/vendor/**",
"/Crosseditor/**",
"/CrossUploader/**"
);
}
}

View File

@ -0,0 +1,85 @@
package com.dbnt.faisp.kwms;
import com.dbnt.faisp.kwms.model.VEmployee;
import com.dbnt.faisp.kwms.service.KwmsService;
import com.dbnt.faisp.main.codeMgt.service.CodeMgtService;
import com.dbnt.faisp.main.userInfo.model.UserInfo;
import com.dbnt.faisp.main.userInfo.service.UserInfoService;
import lombok.RequiredArgsConstructor;
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("/kwms")
public class KwmsController {
private final KwmsService kwmsService;
private final UserInfoService userInfoService;
private final CodeMgtService codeMgtService;
@GetMapping("/getEmpInfoToJoinForm")
public ModelAndView getEmpInfo(VEmployee empInfo){
ModelAndView mav = new ModelAndView("login/joinForm");
// if(userInfoService.selectUserInfoToDicCode(empInfo.getDicCode()) == null){
// UserInfo userInfo = kwmsService.selectEmpInfo(empInfo.getDicCode());
// if(userInfo==null){
// mav.addObject("joinFlag", "F");
// mav.addObject("userInfo", empInfo);
// mav.addObject("msg", "검색 결과가 없습니다.");
// }else{
mav.addObject("joinFlag", "T");
// mav.addObject("userInfo", userInfo);
mav.addObject("userInfo", new UserInfo());
mav.addObject("ogList", codeMgtService.selectCodeMgtList("OG"));
mav.addObject("ofcList", codeMgtService.selectCodeMgtList("OFC"));
mav.addObject("titleList", codeMgtService.selectCodeMgtList("JT"));
mav.addObject("outturnList", codeMgtService.selectCodeMgtList("OTC"));
mav.addObject("seriesList", codeMgtService.selectCodeMgtList("SRC"));
mav.addObject("languageList", codeMgtService.selectCodeMgtList("LNG"));
// }
// }else{
// mav.addObject("joinFlag", "F");
// mav.addObject("userInfo", empInfo);
// mav.addObject("msg", "이미 가입된 식별번호입니다.");
// }
return mav;
}
// @GetMapping("/updateUserInfoToKwms")
// public ModelAndView updateUserInfoToKwms(VEmployee empInfo){
// ModelAndView mav = new ModelAndView("login/joinForm");
// if(userInfoService.selectUserInfoToDicCode(empInfo.getDicCode()) == null){
// UserInfo userInfo = kwmsService.selectEmpInfo(empInfo.getDicCode());
// if(userInfo==null){
// mav.addObject("joinFlag", "F");
// mav.addObject("userInfo", empInfo);
// mav.addObject("msg", "검색 결과가 없습니다.");
// }else{
// mav.addObject("joinFlag", "T");
// mav.addObject("userInfo", userInfo);
// mav.addObject("ogList", codeMgtService.selectCodeMgtList("OG"));
// mav.addObject("ofcList", codeMgtService.selectCodeMgtList("OFC"));
// mav.addObject("titleList", codeMgtService.selectCodeMgtList("JT"));
// mav.addObject("outturnList", codeMgtService.selectCodeMgtList("OTC"));
// mav.addObject("seriesList", codeMgtService.selectCodeMgtList("SRC"));
// mav.addObject("languageList", codeMgtService.selectCodeMgtList("LNG"));
// }
// }else{
// mav.addObject("joinFlag", "F");
// mav.addObject("userInfo", empInfo);
// mav.addObject("msg", "이미 가입된 식별번호입니다.");
// }
// return mav;
// }
//
// @GetMapping("/kwmsCareerModal")
// public ModelAndView kwmsCareerModal(Integer userSeq, String dicCode){
// ModelAndView mav = new ModelAndView("faisp/career/kwmsCareerModal");
// mav.addObject("crcList", codeMgtService.selectCodeMgtList("CRC"));
// mav.addObject("careerList", kwmsService.selectUserCareerList(userSeq, dicCode));
// return mav;
// }
}

View File

@ -0,0 +1,44 @@
package com.dbnt.faisp.kwms.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.*;
@Getter
@Setter
@Entity
@NoArgsConstructor
//@DynamicInsert
//@DynamicUpdate
//@Table(name = "V_EMPLOYEE")
public class VEmployee {
// @Id
// @Column(name = "DIC_CODE")
// private String dicCode;
// @Column(name = "EMP_NM")
// private String empNm;
// @Column(name = "BIRTH_DATE")
// private String birthDate;
// @Column(name = "SEX")
// private String sex;
// @Column(name = "POLICE_BMNG_IL")
// private String policeBmngIl;
// @Column(name = "JIKGEUP")
// private String jikgeup;
// @Column(name = "HN_JIKGEUP_IMYNGIL")
// private String hnJikgeupImyngil;
// @Column(name = "CALL_BUSEO_NM")
// private String callBuseoNm;
// @Column(name = "SAYONG_YN")
// private String sayongYn;
// @Column(name = "GYUNGGWA")
// private String gyunggwa;
// @Column(name = "JIKBYUL")
// private String jikbyul;
}

View File

@ -0,0 +1,54 @@
package com.dbnt.faisp.kwms.model;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.time.LocalDate;
import java.time.LocalDateTime;
@Getter
@Setter
@Entity
@NoArgsConstructor
//@DynamicInsert
//@DynamicUpdate
//@Table(name = "V_HORD_YUNDONG_STAT")
public class VHordYundongStat {
// @Id
// @Column(name = "HORD_YUNDONG_CD")
// private String hordYundongCd;
// @Column(name = "DIC_CODE")
// private String dicCode;
// @Column(name = "IMYONG_GUBUN_CD")
// private String imyongGubunCd;
// @Column(name = "IMYONG_GUBUN_NM")
// private String imyongGubunNm;
// @Column(name = "BUSEO_CD")
// private String buseoCd;
// @Column(name = "JIKGEUP_CD")
// private String jikgeupCd;
// @Column(name = "START_DATE")
// private LocalDate startDate;
// @Column(name = "END_DATE")
// private LocalDate endDate;
// @Column(name = "WORK_DAY")
// private Integer workDay;
// @Column(name = "WORK_MONTH")
// private Integer workMonth;
// @Column(name = "WORK_MONTH_DESC")
// private String workMonthDesc;
// @Column(name = "IMYONGBUSEO_CHONGCHING")
// private String imyongbuseoChongching;
// @Column(name = "IMYONG_JIKGEUP_NM")
// private String imyongJikgeupNm;
// @Column(name = "SYS_DATE")
// private LocalDateTime sysDate;
}

View File

@ -0,0 +1,12 @@
package com.dbnt.faisp.kwms.repository;
import com.dbnt.faisp.kwms.model.VEmployee;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.Optional;
//public interface VEmployeeRepository extends JpaRepository<VEmployee, String> {
public interface VEmployeeRepository {
// Optional<VEmployee> findByDicCode(String dicCode);
}

View File

@ -0,0 +1,13 @@
package com.dbnt.faisp.kwms.repository;
import com.dbnt.faisp.kwms.model.VHordYundongStat;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
//public interface VHordYundongStatRepository extends JpaRepository<VHordYundongStat, String> {
public interface VHordYundongStatRepository {
// List<VHordYundongStat> findByDicCodeOrderByStartDateDesc(String dicCode);
}

View File

@ -0,0 +1,87 @@
package com.dbnt.faisp.kwms.service;
import com.dbnt.faisp.kwms.model.VEmployee;
import com.dbnt.faisp.kwms.model.VHordYundongStat;
import com.dbnt.faisp.kwms.repository.VEmployeeRepository;
import com.dbnt.faisp.kwms.repository.VHordYundongStatRepository;
import com.dbnt.faisp.main.codeMgt.service.CodeMgtService;
import com.dbnt.faisp.main.userInfo.model.UserCareer;
import com.dbnt.faisp.main.userInfo.model.UserInfo;
import com.dbnt.faisp.main.userInfo.repository.UserCareerRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
@Service
@RequiredArgsConstructor
public class KwmsService {
// private final VEmployeeRepository vEmployeeRepository;
// private final VHordYundongStatRepository vHordRepository;
// private final CodeMgtService codeMgtService;
// private final UserCareerRepository careerRepository;
//
// public UserInfo selectEmpInfo(String dicCode){
// VEmployee empInfo = vEmployeeRepository.findByDicCode(dicCode).orElse(null);
// if(empInfo==null){
// return null;
// }else{
// return convertVEmployeeToUserInfo(empInfo);
// }
// }
//
// private UserInfo convertVEmployeeToUserInfo(VEmployee empInfo){
// UserInfo userInfo = new UserInfo();
// userInfo.setDicCode(empInfo.getDicCode());
// userInfo.setUserNm(empInfo.getEmpNm());
// userInfo.setSex(empInfo.getSex().strip().equals("F")?"SEX001":"SEX002");
// String[] positionAry = empInfo.getCallBuseoNm().split(" ");
// userInfo.setOgCd(codeMgtService.searchCodeToCategoryAndValue("OG", positionAry[0]));
// if (positionAry.length>1){
// userInfo.setOfcCd(codeMgtService.searchCodeToCategoryAndValue("OFC", positionAry[1]));
// }
// userInfo.setTitleCd(codeMgtService.searchCodeToCategoryAndValue("JT", empInfo.getJikgeup()));
// userInfo.setOutturnCd(codeMgtService.searchCodeToCategoryAndValue("OTC", empInfo.getGyunggwa()));
// userInfo.setSeriesCd(codeMgtService.searchCodeToCategoryAndValue("SRC", empInfo.getJikbyul()));
//
// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
// empInfo.setBirthDate(
// (Integer.parseInt(empInfo.getBirthDate().substring(0,2))>60?"19":"20")+empInfo.getBirthDate());
// userInfo.setBirthDate(LocalDate.parse(empInfo.getBirthDate(), formatter));
// userInfo.setPoliceInDate(LocalDate.parse(empInfo.getPoliceBmngIl(), formatter));
// userInfo.setTitleInDate(LocalDate.parse(empInfo.getHnJikgeupImyngil(), formatter));
// return userInfo;
// }
//
// public List<UserCareer> selectUserCareerList(Integer userSeq, String dicCode) {
// List<VHordYundongStat> statList = vHordRepository.findByDicCodeOrderByStartDateDesc(dicCode);
// List<UserCareer> savedList = careerRepository.findByUserSeqOrderByStartDateDesc(userSeq);
// List<UserCareer> careerList = new ArrayList<>();
// for(VHordYundongStat stat: statList){
// boolean savedFlag = false;
// for(UserCareer savedCareer: savedList){
// if (stat.getHordYundongCd().equals(savedCareer.getHordCd())) {
// savedFlag = true;
// break;
// }
// }
// if(!savedFlag){
// UserCareer career = new UserCareer();
// career.setDesignationCd(codeMgtService.searchCodeToCategoryAndValue("DSN", stat.getImyongGubunNm()));
// career.setWorkPositionStr(stat.getImyongbuseoChongching());
// career.setWorkTitle(codeMgtService.searchCodeToCategoryAndValue("JT", stat.getImyongJikgeupNm()));
// career.setStartDate(stat.getStartDate());
// career.setEndDate(stat.getEndDate());
// career.setWorkDay(stat.getWorkDay()==null?0:stat.getWorkDay());
// career.setWorkMonth(stat.getWorkMonth()==null?0:stat.getWorkMonth());
// career.setHordCd(stat.getHordYundongCd());
// careerList.add(career);
// }
// }
// return careerList;
// }
}

View File

@ -0,0 +1,46 @@
package com.dbnt.faisp.main.authMgt;
import com.dbnt.faisp.main.authMgt.service.AuthMgtService;
import com.dbnt.faisp.main.authMgt.model.AuthMgt;
import com.dbnt.faisp.main.userInfo.service.UserInfoService;
import com.dbnt.faisp.main.userInfo.model.UserInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
@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 "";
}
}

View File

@ -0,0 +1,18 @@
package com.dbnt.faisp.main.authMgt.mapper;
import com.dbnt.faisp.main.authMgt.model.AccessConfig;
import com.dbnt.faisp.main.authMgt.model.ApprovalConfig;
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);
List<Integer> selectApprvUserList(Map<String, Object> params);
}

View File

@ -0,0 +1,43 @@
package com.dbnt.faisp.main.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;
}
}

View File

@ -0,0 +1,44 @@
package com.dbnt.faisp.main.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;
}
}

View File

@ -0,0 +1,13 @@
package com.dbnt.faisp.main.authMgt.model;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
public class AuthMgt {
List<AccessConfig> accessConfigList;
List<ApprovalConfig> approvalConfigList;
}

View File

@ -0,0 +1,9 @@
package com.dbnt.faisp.main.authMgt.repository;
import com.dbnt.faisp.main.authMgt.model.AccessConfig;
import org.springframework.data.jpa.repository.JpaRepository;
public interface AccessConfigRepository extends JpaRepository<AccessConfig, AccessConfig.AccessConfigId> {
void deleteByMenuKey(Integer menuKey);
}

View File

@ -0,0 +1,9 @@
package com.dbnt.faisp.main.authMgt.repository;
import com.dbnt.faisp.main.authMgt.model.ApprovalConfig;
import org.springframework.data.jpa.repository.JpaRepository;
public interface ApprovalConfigRepository extends JpaRepository<ApprovalConfig, ApprovalConfig.ApprovalConfigId> {
}

View File

@ -0,0 +1,50 @@
package com.dbnt.faisp.main.authMgt.service;
import com.dbnt.faisp.main.authMgt.mapper.AuthMgtMapper;
import com.dbnt.faisp.main.authMgt.model.AccessConfig;
import com.dbnt.faisp.main.authMgt.model.ApprovalConfig;
import com.dbnt.faisp.main.authMgt.model.AuthMgt;
import com.dbnt.faisp.main.authMgt.repository.AccessConfigRepository;
import com.dbnt.faisp.main.authMgt.repository.ApprovalConfigRepository;
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());
}
public List<Integer> selectApprvUserList(String wrtOrgan, Integer menuKey, String apprvAuth) {
Map<String, Object> params = new HashMap<>();
params.put("ogCd", wrtOrgan);
params.put("menuKey", menuKey);
params.put("apprvAuth", apprvAuth);
return authMgtMapper.selectApprvUserList(params);
}
}

View File

@ -0,0 +1,42 @@
package com.dbnt.faisp.main.codeMgt;
import com.dbnt.faisp.main.codeMgt.model.CodeCatg;
import com.dbnt.faisp.main.codeMgt.model.CodeFormData;
import com.dbnt.faisp.main.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/codeMgt2");
mav.addObject("catgList", codeMgtService.selectAllCategoryList());
mav.addObject("codeList", codeMgtService.selectAllCodeList());
return mav;
}
@PostMapping("/saveCode")
@ResponseBody
public String saveCode(@RequestBody List<CodeCatg> codeCategoryList){
codeMgtService.saveCode(codeCategoryList);
return "";
}
@PostMapping("/saveCode2")
public void saveCode2(CodeFormData formData){
codeMgtService.saveCode2(formData.getCategoryList(), formData.getCodeList());
}
@GetMapping("/selectCodeCatgList")
public List<CodeCatg> selectCodeCatgList(){
return codeMgtService.selectCodeCatgAndChild();
}
}

View File

@ -0,0 +1,33 @@
package com.dbnt.faisp.main.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;
}

View File

@ -0,0 +1,13 @@
package com.dbnt.faisp.main.codeMgt.model;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
public class CodeFormData {
List<CodeCatg> categoryList;
List<CodeMgt> codeList;
}

View File

@ -0,0 +1,51 @@
package com.dbnt.faisp.main.codeMgt.model;
import lombok.*;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Comparator;
@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;
@Column(name = "order_num")
private Integer orderNum;
@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;
}
}

View File

@ -0,0 +1,9 @@
package com.dbnt.faisp.main.codeMgt.repository;
import com.dbnt.faisp.main.codeMgt.model.CodeCatg;
import org.springframework.data.jpa.repository.JpaRepository;
public interface CodeCatgRepository extends JpaRepository<CodeCatg, String> {
}

View File

@ -0,0 +1,18 @@
package com.dbnt.faisp.main.codeMgt.repository;
import com.dbnt.faisp.main.codeMgt.model.CodeMgt;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
import java.util.Optional;
public interface CodeMgtRepository extends JpaRepository<CodeMgt, CodeMgt.CodeMgtId> {
List<CodeMgt> findByCategoryCdOrderByItemCdAsc(String categoryCd);
List<CodeMgt> findByCategoryCdAndUseChkOrderByOrderNumAsc(String categoryCd, String useChk);
Optional<CodeMgt> findByCategoryCdAndItemValue(String categoryCd, String itemValue);
List<CodeMgt> findByUseChkOrderByItemCdAsc(String useChk);
List<CodeMgt> findByOrderByOrderNumAsc();
Optional<CodeMgt> findTop1ByCategoryCdOrderByItemCdDesc(String categoryCd);
}

View File

@ -0,0 +1,111 @@
package com.dbnt.faisp.main.codeMgt.service;
import com.dbnt.faisp.main.codeMgt.model.CodeCatg;
import com.dbnt.faisp.main.codeMgt.model.CodeFormData;
import com.dbnt.faisp.main.codeMgt.model.CodeMgt;
import com.dbnt.faisp.main.codeMgt.repository.CodeCatgRepository;
import com.dbnt.faisp.main.codeMgt.repository.CodeMgtRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
@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 "";
}
@Transactional
public void saveCode2(List<CodeCatg> categoryList, List<CodeMgt> codeList) {
if(categoryList!=null){
codeCatgRepository.saveAll(categoryList);
}
if(codeList!=null){
HashMap<String, Integer> map = new HashMap<>();
for(CodeMgt code: codeList){
if(code.getItemCd().isEmpty()){
CodeMgt lastCode = codeMgtRepository.findTop1ByCategoryCdOrderByItemCdDesc(code.getCategoryCd()).orElse(null);
if(lastCode!=null){
String lastCodeSeq = lastCode.getItemCd().replace(lastCode.getCategoryCd(), "");
map.put(code.getCategoryCd(), Integer.parseInt(lastCodeSeq)+1);
}else{
map.put(code.getCategoryCd(), 1);
}
}
}
for(CodeMgt code: codeList){
if(code.getItemCd().isEmpty()) {
Integer categorySeq = map.get(code.getCategoryCd());
String tempItemCd = "000" + categorySeq++;
code.setItemCd(code.getCategoryCd() + (tempItemCd.substring(tempItemCd.length() - 3)));
map.put(code.getCategoryCd(), categorySeq);
}
}
codeMgtRepository.saveAll(codeList);
}
}
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() {
List<CodeCatg> categoryList = codeCatgRepository.findAll();
List<CodeMgt> codeList = codeMgtRepository.findByOrderByOrderNumAsc();
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.findByCategoryCdAndUseChkOrderByOrderNumAsc(categoryCd, "T");
}
public List<CodeMgt> selectCodeMgtListOrderByDesc(String categoryCd){
List<CodeMgt> codeList = selectCodeMgtList(categoryCd);
codeList.sort((o1, o2) -> o2.getItemCd().compareTo(o1.getItemCd()));
return codeList;
}
public String searchCodeToCategoryAndValue(String categoryCd, String value){
CodeMgt code = codeMgtRepository.findByCategoryCdAndItemValue(categoryCd, value).orElse(null);
return code==null?null:code.getItemCd();
}
public List<CodeCatg> selectAllCategoryList() {
return codeCatgRepository.findAll();
}
public List<CodeMgt> selectAllCodeList() {
return codeMgtRepository.findByOrderByOrderNumAsc();
}
}

View File

@ -0,0 +1,444 @@
package com.dbnt.faisp.main.equip;
import com.dbnt.faisp.main.authMgt.service.AuthMgtService;
import com.dbnt.faisp.main.equip.model.*;
import com.dbnt.faisp.main.equip.service.EquipService;
import com.dbnt.faisp.main.organMgt.service.OrganConfigService;
import com.dbnt.faisp.main.userInfo.model.UserInfo;
import com.dbnt.faisp.main.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.getUserNm());
equip.setWrtOrgan(loginUser.getOgCd());
equip.setWrtPart(loginUser.getOfcCd());
equip.setWrtTitle(loginUser.getTitleCd());
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("userSeq", loginUser.getUserSeq());
mav.addObject("wrtUserSeq", equipService.selectEquipFirstUserSeq(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.getUserNm());
equip.setWrtOrgan(loginUser.getOgCd());
equip.setWrtPart(loginUser.getOfcCd());
equip.setWrtTitle(loginUser.getTitleCd());
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.selectHistoryList(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 {
EquipFile dbImg = equipService.selectEquipFile(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));
mav.addObject("userSeq", loginUser.getUserSeq());
}
if(cellPhone.getPhoneKey() == null) {
cellPhone.setWrtOrgan(loginUser.getOgCd());
cellPhone.setWrtPart(loginUser.getOfcCd());
cellPhone.setWrtTitle(loginUser.getTitleCd());
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.setWrtTitle(loginUser.getTitleCd());
useList.setWrtUserSeq(loginUser.getUserSeq());
useList.setWrtNm(loginUser.getUserNm());
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));
mav.addObject("wrtUserSeq", equipService.selectFirstWrtUserSeq(useList));
mav.addObject("userSeq", loginUser.getUserSeq());
//메뉴권한 확인
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.setWrtTitle(loginUser.getTitleCd());
useList.setWrtUserSeq(loginUser.getUserSeq());
useList.setWrtNm(loginUser.getUserNm());
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.selectUseHistoryList(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;
}
}

View File

@ -0,0 +1,57 @@
package com.dbnt.faisp.main.equip.mapper;
import com.dbnt.faisp.main.equip.model.CellPhone;
import com.dbnt.faisp.main.equip.model.Equip;
import com.dbnt.faisp.main.equip.model.EquipLog;
import com.dbnt.faisp.main.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 selectEquipFirstUserSeq(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);
List<Equip> selectHistoryList(Equip equip);
List<UseList> selectUseHistoryList(UseList useList);
}

View File

@ -0,0 +1,99 @@
package com.dbnt.faisp.main.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_title")
private String wrtTitle;
@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 + "]";
}
}

View File

@ -0,0 +1,121 @@
package com.dbnt.faisp.main.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 javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;
@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_part")
private String wrtPart;
@Column(name = "wrt_title")
private String wrtTitle;
@Column(name = "wrt_user_seq")
private String wrtUserSeq;
@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 + "]";
}
}

View File

@ -0,0 +1,74 @@
package com.dbnt.faisp.main.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 javax.persistence.*;
import java.io.Serializable;
@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 + "]";
}
}

View File

@ -0,0 +1,60 @@
package com.dbnt.faisp.main.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_part")
private String wrtPart;
@Column(name = "wrt_title")
private String wrtTitle;
@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 + "]";
}
}

View File

@ -0,0 +1,126 @@
package com.dbnt.faisp.main.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_title")
private String wrtTitle;
@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
+ ", wrtTitle=" + wrtTitle + ", 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;
}
}

View File

@ -0,0 +1,14 @@
package com.dbnt.faisp.main.equip.repository;
import com.dbnt.faisp.main.equip.model.CellPhone;
import org.springframework.data.jpa.repository.JpaRepository;
public interface CellPhoneRepository extends JpaRepository<CellPhone, Integer> {
}

View File

@ -0,0 +1,16 @@
package com.dbnt.faisp.main.equip.repository;
import com.dbnt.faisp.main.equip.model.EquipFile;
import org.springframework.data.jpa.repository.JpaRepository;
public interface EquipFileRepository extends JpaRepository<EquipFile, EquipFile.EquipFileId> {
void deleteByEquKey(Integer equKey);
}

View File

@ -0,0 +1,15 @@
package com.dbnt.faisp.main.equip.repository;
import com.dbnt.faisp.main.equip.model.EquipLog;
import org.springframework.data.jpa.repository.JpaRepository;
public interface EquipLogRepository extends JpaRepository<EquipLog, Integer> {
}

View File

@ -0,0 +1,24 @@
package com.dbnt.faisp.main.equip.repository;
import com.dbnt.faisp.main.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);
}

View File

@ -0,0 +1,25 @@
package com.dbnt.faisp.main.equip.repository;
import com.dbnt.faisp.main.equip.model.UseList;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
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);
@Query(value = "SELECT wrt_user_seq FROM use_list WHERE mgt_organ=:mgtOrgan AND use_no=:useNo And use_type=:useType order by version_no asc limit 1", nativeQuery = true)
Integer getWrtUserSeq(@Param("mgtOrgan") String mgtOrgan,@Param("useNo") String useNo,@Param("useType") String useType);
}

View File

@ -0,0 +1,398 @@
package com.dbnt.faisp.main.equip.service;
import com.dbnt.faisp.main.equip.mapper.EquipMapper;
import com.dbnt.faisp.main.equip.model.CellPhone;
import com.dbnt.faisp.main.equip.model.Equip;
import com.dbnt.faisp.main.equip.model.Equip.EquipId;
import com.dbnt.faisp.main.equip.model.EquipFile;
import com.dbnt.faisp.main.equip.model.EquipFile.EquipFileId;
import com.dbnt.faisp.main.equip.model.EquipLog;
import com.dbnt.faisp.main.equip.model.UseList;
import com.dbnt.faisp.main.equip.model.UseList.UseListId;
import com.dbnt.faisp.main.equip.repository.CellPhoneRepository;
import com.dbnt.faisp.main.equip.repository.EquipFileRepository;
import com.dbnt.faisp.main.equip.repository.EquipLogRepository;
import com.dbnt.faisp.main.equip.repository.EquipRepository;
import com.dbnt.faisp.main.equip.repository.UseListRepository;
import com.dbnt.faisp.main.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("${file.dir}")
protected String fileDir;
@Value("${file.dir.equip}")
protected String equ;
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.setWrtPart(equip.getWrtPart());
equLog.setWrtTitle(equip.getWrtTitle());
equLog.setWrtDt(equip.getWrtDt());
equipLogRepository.save(equLog);
} catch (Exception e) {
e.printStackTrace();
}
}
public void saveFile(Equip equip, MultipartHttpServletRequest mRequest) throws Exception {
try {
String path = fileDir+equ;
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.setWrtPart(equip.getWrtPart());
equipTmp.setWrtTitle(equip.getWrtTitle());
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());
equLog.setWrtPart(equip.getWrtPart());
equLog.setWrtTitle(equip.getWrtTitle());
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 = fileDir+equ;
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(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> selectHistoryList(Equip equip) {
return equipMapper.selectHistoryList(equip);
}
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.getUserNm());
equLog.setWrtOrgan(loginUser.getOgCd());
equLog.setWrtPart(loginUser.getOfcCd());
equLog.setWrtTitle(loginUser.getTitleCd());
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 selectEquipFirstUserSeq(Equip equip) {
return equipMapper.selectEquipFirstUserSeq(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.setWrtTitle(useList.getWrtTitle());
useTmp.setWrtUserSeq(useList.getWrtUserSeq());
useTmp.setWrtNm(useList.getWrtNm());
useTmp.setWrtDt(useList.getWrtDt());
return useListRepository.save(useTmp);
}
public List<UseList> selectUseHistoryList(UseList useList) {
return equipMapper.selectUseHistoryList(useList);
}
@Transactional
public void useDelete(List<UseList> useList) {
for(UseList use:useList) {
useListRepository.deleteByMgtOrganAndUseNoAndUseType(use.getMgtOrgan(),use.getUseNo(),use.getUseType());
}
}
public Integer selectFirstWrtUserSeq(UseList useList) {
return useListRepository.getWrtUserSeq(useList.getMgtOrgan(),useList.getUseNo(),useList.getUseType());
}
public EquipFile selectEquipFile(Equip equip) {
return equipFileRepository.findById(new EquipFileId(equip.getEquKey(), equip.getVersionNo())).orElse(null);
}
}

View File

@ -0,0 +1,121 @@
package com.dbnt.faisp.main.faRpt;
import com.dbnt.faisp.main.authMgt.service.AuthMgtService;
import com.dbnt.faisp.main.codeMgt.service.CodeMgtService;
import com.dbnt.faisp.main.faRpt.model.FaRptBoard;
import com.dbnt.faisp.main.faRpt.model.FaRptReadUser;
import com.dbnt.faisp.main.faRpt.service.FaRptService;
import com.dbnt.faisp.main.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.ArrayList;
import java.util.List;
@RestController
@RequiredArgsConstructor
@RequestMapping("/faRpt")
public class FaRptController {
private final FaRptService faRptService;
private final AuthMgtService authMgtService;
private final CodeMgtService codeMgtService;
@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(), "/faRpt/faRptBoard").get(0).getAccessAuth();
mav.addObject("accessAuth", accessAuth);
if(faRptBoard.getActiveTab().equals("send")){
faRptBoard.setWrtUserSeq(loginUser.getUserSeq());
}else if(faRptBoard.getActiveTab().equals("receive")){
faRptBoard.setStatus("DST007");
faRptBoard.setReceiveUserSeq(loginUser.getUserSeq());
}else if(faRptBoard.getActiveTab().equals("all") && accessAuth.equals("ACC003")){
faRptBoard.setDownOrganCdList(loginUser.getDownOrganCdList());
}else if(faRptBoard.getActiveTab().equals("all")){
faRptBoard.setActiveTab("send");
faRptBoard.setWrtUserSeq(loginUser.getUserSeq());
}
if(accessAuth.equals("ACC003")){
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
}
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(), null);
}else{
if(faRptBoard.getRefKey()!=null){
FaRptReadUser readUser = new FaRptReadUser();
readUser.setUserSeq(faRptBoard.getWrtUserSeq());
readUser.setOgCd(faRptBoard.getWrtOrgan());
readUser.setOfcCd(faRptBoard.getWrtPart());
readUser.setTitleCd(faRptBoard.getWrtUserGrd());
readUser.setUserNm(faRptBoard.getWrtUserNm());
faRptBoard.setReadUserList(new ArrayList<>());
faRptBoard.getReadUserList().add(readUser);
}
faRptBoard.setWrtUserSeq(loginUser.getUserSeq());
faRptBoard.setWrtOrgan(loginUser.getOgCd());
faRptBoard.setWrtPart(loginUser.getOfcCd());
faRptBoard.setWrtUserGrd(loginUser.getTitleCd());
faRptBoard.setWrtUserNm(loginUser.getUserNm());
faRptBoard.setWrtDt(LocalDateTime.now());
}
mav.addObject("frCategoryList", codeMgtService.selectCodeMgtList("FRC"));
mav.addObject("faRpt", faRptBoard);
return mav;
}
@GetMapping("/faRptViewModal")
public ModelAndView faRptViewModal(@AuthenticationPrincipal UserInfo loginUser, FaRptBoard faRptBoard){
ModelAndView mav = new ModelAndView("faRpt/faRptViewModal");
mav.addObject("faRpt", faRptService.selectFaRptBoard(faRptBoard.getFaRptKey(), loginUser.getUserSeq()));
mav.addObject("userSeq",loginUser.getUserSeq());
//메뉴권한 확인
mav.addObject("accessAuth", authMgtService.selectAccessConfigList
(loginUser.getUserSeq(), "/faRpt/faRptBoard").get(0).getAccessAuth());
return mav;
}
@PostMapping("/saveFaRpt")
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);
}
@PostMapping("/selectedUserTable")
@ResponseBody
public ModelAndView selectedUserTable(@RequestBody List<FaRptReadUser> userList){
ModelAndView mav = new ModelAndView("faRpt/readUserRow");
mav.addObject("userList", userList);
return mav;
}
}

View File

@ -0,0 +1,17 @@
package com.dbnt.faisp.main.faRpt.mapper;
import com.dbnt.faisp.main.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);
String selectHashTags(Integer faRptKey);
}

View File

@ -0,0 +1,70 @@
package com.dbnt.faisp.main.faRpt.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.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 String hashTags;
@Transient
private Integer receiveUserSeq;
@Transient
private String activeTab;
@Transient
private Integer fileCnt;
@Transient
private Integer readCnt;
@Transient
private Integer userCnt;
@Transient
private List<FaRptFile> fileList;
@Transient
private List<FaRptReadUser> readUserList;
@Transient
private List<MultipartFile> multipartFileList;
}

View File

@ -0,0 +1,47 @@
package com.dbnt.faisp.main.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;
}
}

View File

@ -0,0 +1,47 @@
package com.dbnt.faisp.main.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;
}
}

View File

@ -0,0 +1,37 @@
package com.dbnt.faisp.main.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 = "hash_tag_link_fa_rpt")
@IdClass(HashTagLinkFaRpt.HashTagLinkFaRptId.class)
public class HashTagLinkFaRpt extends FileInfo {
@Id
@Column(name = "fa_rpt_key")
private Integer faRptKey;
@Id
@Column(name = "tag_key")
private Integer tagKey;
@Embeddable
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class HashTagLinkFaRptId implements Serializable {
private Integer faRptKey;
private Integer tagKey;
}
}

View File

@ -0,0 +1,9 @@
package com.dbnt.faisp.main.faRpt.repository;
import com.dbnt.faisp.main.faRpt.model.FaRptBoard;
import org.springframework.data.jpa.repository.JpaRepository;
public interface FaRptBoardRepository extends JpaRepository<FaRptBoard, Integer> {
}

View File

@ -0,0 +1,14 @@
package com.dbnt.faisp.main.faRpt.repository;
import com.dbnt.faisp.main.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);
}

View File

@ -0,0 +1,12 @@
package com.dbnt.faisp.main.faRpt.repository;
import com.dbnt.faisp.main.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);
void deleteByFaRptKey(Integer faRptKey);
}

View File

@ -0,0 +1,9 @@
package com.dbnt.faisp.main.faRpt.repository;
import com.dbnt.faisp.main.faRpt.model.HashTagLinkFaRpt;
import org.springframework.data.jpa.repository.JpaRepository;
public interface HashTagLinkFaRptRepository extends JpaRepository<HashTagLinkFaRpt, HashTagLinkFaRpt.HashTagLinkFaRptId> {
void deleteByFaRptKey(Integer faRptKey);
}

View File

@ -0,0 +1,148 @@
package com.dbnt.faisp.main.faRpt.service;
import com.dbnt.faisp.config.BaseService;
import com.dbnt.faisp.config.FileInfo;
import com.dbnt.faisp.main.faRpt.mapper.FaRptMapper;
import com.dbnt.faisp.main.faRpt.model.FaRptBoard;
import com.dbnt.faisp.main.faRpt.model.FaRptFile;
import com.dbnt.faisp.main.faRpt.model.FaRptReadUser;
import com.dbnt.faisp.main.faRpt.model.HashTagLinkFaRpt;
import com.dbnt.faisp.main.faRpt.repository.FaRptBoardRepository;
import com.dbnt.faisp.main.faRpt.repository.FaRptFileRepository;
import com.dbnt.faisp.main.faRpt.repository.FaRptReadUserRepository;
import com.dbnt.faisp.main.faRpt.repository.HashTagLinkFaRptRepository;
import com.dbnt.faisp.main.hashTag.service.HashTagService;
import com.dbnt.faisp.main.userInfo.model.UserAlarm;
import com.dbnt.faisp.main.userInfo.service.UserAlarmService;
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.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
@Service
@RequiredArgsConstructor
public class FaRptService extends BaseService {
private final HashTagService hashTagService;
private final UserAlarmService userAlarmService;
private final FaRptBoardRepository faRptBoardRepository;
private final FaRptFileRepository faRptFileRepository;
private final FaRptReadUserRepository faRptReadUserRepository;
private final HashTagLinkFaRptRepository hashTagLinkFaRptRepository;
private final FaRptMapper faRptMapper;
public List<FaRptBoard> selectFaRptList(FaRptBoard faRptBoard) {
return faRptMapper.selectFaRptList(faRptBoard);
}
public Integer selectFaRptCnt(FaRptBoard faRptBoard) {
return faRptMapper.selectFaRptCnt(faRptBoard);
}
@Transactional
public Integer saveFaRptBoard(FaRptBoard faRptBoard, List<Integer> deleteFileSeq) {
Integer faRptKey = faRptBoardRepository.save(faRptBoard).getFaRptKey();
if(deleteFileSeq!=null && deleteFileSeq.size()>0){
deleteFaRptFile(faRptKey, deleteFileSeq);
}
if(faRptBoard.getMultipartFileList() != null){
saveUploadFiles(faRptKey, faRptBoard.getMultipartFileList());
}
if(faRptBoard.getReadUserList() != null){
saveFaRptReadUser(faRptKey, faRptBoard.getReadUserList());
}
if(!faRptBoard.getHashTags().isEmpty()){
saveHashTagLink(faRptKey, faRptBoard.getHashTags().split(" "));
}
return faRptKey;
}
@Transactional
public FaRptBoard selectFaRptBoard(Integer faRptKey, Integer userSeq) {
FaRptBoard faRptBoard = faRptBoardRepository.findById(faRptKey).orElse(null);
if(faRptBoard != null){
faRptBoard.setFileList(faRptFileRepository.findByFaRptKey(faRptKey));
faRptBoard.setHashTags(faRptMapper.selectHashTags(faRptKey));
faRptBoard.setReadUserList(faRptReadUserRepository.findByFaRptKey(faRptKey));
if(faRptBoard.getStatus().equals("DST007")){
for(FaRptReadUser readUser: faRptBoard.getReadUserList()){
if(readUser.getUserSeq().equals(userSeq)){
readUser.setReadYn("T");
faRptReadUserRepository.save(readUser);
}
}
}
}
return faRptBoard;
}
private void saveFaRptReadUser(Integer faRptKey, List<FaRptReadUser> readUserList) {
faRptReadUserRepository.deleteByFaRptKey(faRptKey);
List<UserAlarm> alarmList = new ArrayList<>();
LocalDateTime dateTime = LocalDateTime.now();
for(FaRptReadUser readUser: readUserList){
readUser.setFaRptKey(faRptKey);
UserAlarm alarm = userAlarmService.makeUserAlarm
(dateTime, readUser.getUserSeq(), faRptKey, 1, "외사정보보고에 수신 문서가 있습니다.");
alarmList.add(alarm);
}
userAlarmService.saveAlarmList(alarmList);
faRptReadUserRepository.saveAll(readUserList);
}
private void saveUploadFiles(Integer faRptKey, List<MultipartFile> multipartFileList) {
FaRptFile lastFile = faRptFileRepository.findTopByFaRptKeyOrderByFileSeq(faRptKey).orElse(null);
int fileSeq = lastFile==null?1:(lastFile.getFileSeq()+1);
for(MultipartFile file: multipartFileList){
String saveName = UUID.randomUUID().toString();
String path = locationPath+File.separator+"faRpt";
saveFile(file, new File(path+File.separator+saveName));
String originalFilename = file.getOriginalFilename();
int extnIdx = originalFilename.lastIndexOf(".");
FaRptFile fileInfo = new FaRptFile();
fileInfo.setFaRptKey(faRptKey);
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);
faRptFileRepository.save(fileInfo);
}
}
private void deleteFaRptFile(Integer faRptKey, List<Integer> deleteFileSeq) {
List<FaRptFile> fileList = faRptFileRepository.findByFaRptKey(faRptKey);
for(FaRptFile file: fileList){
if(deleteFileSeq.contains(file.getFileSeq())){
deleteStoredFile(new File(file.getSavePath(), file.getConvNm()));
faRptFileRepository.delete(file);
}
}
}
private void saveHashTagLink(Integer faRptKey, String[] hashTagAry){
hashTagLinkFaRptRepository.deleteByFaRptKey(faRptKey);
for(String tagNm: hashTagAry){
HashTagLinkFaRpt hashTagLink = new HashTagLinkFaRpt();
hashTagLink.setFaRptKey(faRptKey);
hashTagLink.setTagKey(hashTagService.selectTagKey(tagNm));
hashTagLinkFaRptRepository.save(hashTagLink);
}
}
public FileInfo selectFaRptFile(Integer faRptKey, Integer fileSeq) {
return faRptFileRepository.findById(new FaRptFile.FaRptFileId(faRptKey, fileSeq)).orElse(null);
}
}

View File

@ -0,0 +1,130 @@
package com.dbnt.faisp.main.faStatistics.crackdownsStatus;
import com.dbnt.faisp.main.authMgt.service.AuthMgtService;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.crackdownStatus.CrackdownStatus;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.FishingBoat;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.crackdownStatus.CrackdownStatusVersion;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.processResult.ProcessResult;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.repository.*;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.service.CrackdownStatusService;
import com.dbnt.faisp.main.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.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import java.time.LocalDateTime;
import java.util.List;
@RestController
@RequiredArgsConstructor
@RequestMapping("/faStatistics")
public class CrackdownStatusController {
private final AuthMgtService authMgtService;
private final CrackdownStatusService crackdownStatusService;
private final ViolationRepository violationRepository;
private final ProcessResultRepository processResultRepository;
private final FishingBoatRepository fishingBoatRepository;
private final SailorRepository sailorRepository;
@RequestMapping("/crackdownStatus")
public ModelAndView crackdownStatus(@AuthenticationPrincipal UserInfo loginUser, CrackdownStatus crackdownStatus) {
ModelAndView mav = new ModelAndView("faStatistics/crackdownStatus/crackdownStatus");
//메뉴권한 확인
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/faStatistics/crackdownStatus").get(0).getAccessAuth();
mav.addObject("accessAuth", accessAuth);
crackdownStatus.setYear(((Integer)LocalDateTime.now().getYear()).toString());
List<CrackdownStatus> crackdownStatusList = crackdownStatusService.selectCrackdownStatusList(crackdownStatus);
for (CrackdownStatus cds:crackdownStatusList) {
cds.setViolationList(violationRepository.findByFbKey(cds.getFbKey()));
cds.setProcessResult(processResultRepository.findByCdsKey(cds.getCdsKey()).orElse(new ProcessResult()));
cds.setFishingBoat(fishingBoatRepository.findByCdsKey(cds.getCdsKey()).orElse(new FishingBoat()));
cds.setSailorList(sailorRepository.findByFbKey(cds.getFbKey()));
}
mav.addObject("crackdownStatusList", crackdownStatusList);
mav.addObject("searchParams", crackdownStatus);
return mav;
}
@GetMapping("/crackdownStatus/crackdownStatusViewModal")
public ModelAndView crackdownStatusViewModal(@AuthenticationPrincipal UserInfo loginUser, CrackdownStatus crackdownStatus){
ModelAndView mav = new ModelAndView("faStatistics/crackdownStatus/crackdownStatusViewModal");
crackdownStatus = crackdownStatusService.selectCrackdownStatus(crackdownStatus.getCdsKey());
crackdownStatus.setFishingBoat(fishingBoatRepository.findByCdsKey(crackdownStatus.getCdsKey()).orElse(null));
crackdownStatus.setProcessResult(processResultRepository.findByCdsKey(crackdownStatus.getCdsKey()).orElse(null));
crackdownStatus.setViolationList(violationRepository.findByFbKey(crackdownStatus.getFishingBoat().getFbKey()));
crackdownStatus.setSailorList(sailorRepository.findByFbKey(crackdownStatus.getFishingBoat().getFbKey()));
mav.addObject("crackdownStatus", crackdownStatus);
mav.addObject("userSeq",loginUser.getUserSeq());
//메뉴권한 확인
mav.addObject("accessAuth", authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/faStatistics/crackdownStatus").get(0).getAccessAuth());
return mav;
}
@GetMapping("/crackdownStatus/crackdownStatusEditModal")
public ModelAndView crackdownStatusEditModal(@AuthenticationPrincipal UserInfo loginUser, CrackdownStatus crackdownStatus){
ModelAndView mav = new ModelAndView("faStatistics/crackdownStatus/crackdownStatusEditModal");
if(crackdownStatus.getCdsKey()!=null){
crackdownStatus = crackdownStatusService.selectCrackdownStatus(crackdownStatus.getCdsKey());
crackdownStatus.setFishingBoat(fishingBoatRepository.findByCdsKey(crackdownStatus.getCdsKey()).orElse(null));
crackdownStatus.setProcessResult(processResultRepository.findByCdsKey(crackdownStatus.getCdsKey()).orElse(null));
crackdownStatus.setViolationList(violationRepository.findByFbKey(crackdownStatus.getFishingBoat().getFbKey()));
crackdownStatus.setSailorList(sailorRepository.findByFbKey(crackdownStatus.getFishingBoat().getFbKey()));
}else{
crackdownStatus.setWrtOrgan(loginUser.getOgCd());
crackdownStatus.setWrtPart(loginUser.getOfcCd());
crackdownStatus.setWrtUserGrd(loginUser.getGroupCd());
crackdownStatus.setWrtOrgan(loginUser.getOgCd());
crackdownStatus.setWrtUserNm(loginUser.getUserNm());
crackdownStatus.setWrtDt(LocalDateTime.now());
crackdownStatus.setFishingBoat(new FishingBoat());
crackdownStatus.getFishingBoat().setWrtOrgan(loginUser.getOgCd());
crackdownStatus.getFishingBoat().setWrtUserNm(loginUser.getUserNm());
crackdownStatus.getFishingBoat().setWrtDt(LocalDateTime.now());
crackdownStatus.setProcessResult(new ProcessResult());
crackdownStatus.getProcessResult().setWrtOrgan(loginUser.getOgCd());
crackdownStatus.getProcessResult().setWrtUserNm(loginUser.getUserNm());
crackdownStatus.getProcessResult().setWrtDt(LocalDateTime.now());
}
mav.addObject("crackdownStatus", crackdownStatus);
return mav;
}
@GetMapping("/crackdownStatus/crackdownStatusHistoryViewModal")
public ModelAndView crackdownStatusHistoryViewModal(@AuthenticationPrincipal UserInfo loginUser, CrackdownStatus crackdownStatus){
ModelAndView mav = new ModelAndView("faStatistics/crackdownStatus/crackdownStatusHistoryViewModal");
List<CrackdownStatusVersion> crackdownStatusVersionList = crackdownStatusService.selectCrackdownStatusVersionList(crackdownStatus.getCdsKey());
mav.addObject("crackdownStatusVersionList", crackdownStatusVersionList);
mav.addObject("crackdownStatus", crackdownStatus);
return mav;
}
@GetMapping("/crackdownStatus/crackdownStatusHistoryDetail")
public ModelAndView crackdownStatusHistoryDetail(@AuthenticationPrincipal UserInfo loginUser, CrackdownStatusVersion crackdownStatusVersion){
ModelAndView mav = new ModelAndView("faStatistics/crackdownStatus/crackdownStatusHistoryDetail");
crackdownStatusVersion = crackdownStatusService.selectCrackdownStatusVersion(crackdownStatusVersion.getVersionNo(), crackdownStatusVersion.getCdsKey());
mav.addObject("crackdownStatusVersion", crackdownStatusVersion);
return mav;
}
@PostMapping("/crackdownStatus/saveCrackdownStatus")
public Integer saveCrackdownStatus(@AuthenticationPrincipal UserInfo loginUser,
CrackdownStatus crackdownStatus,
FishingBoat fishingBoat,
ProcessResult processResult){
crackdownStatus.setWrtUserSeq(loginUser.getUserSeq());
crackdownStatus.setFishingBoat(fishingBoat);
crackdownStatus.setProcessResult(processResult);
return crackdownStatusService.saveCrackdownStatus(crackdownStatus);
}
}

View File

@ -0,0 +1,117 @@
package com.dbnt.faisp.main.faStatistics.crackdownsStatus;
import com.dbnt.faisp.main.authMgt.service.AuthMgtService;
import com.dbnt.faisp.main.codeMgt.service.CodeMgtService;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.crackdownStatus.CrackdownStatus;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.FishingBoat;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.FishingBoatVersion;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.processResult.ProcessResult;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.service.FishingBoatService;
import com.dbnt.faisp.main.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("/faStatistics")
public class FishingBoatController {
private final AuthMgtService authMgtService;
private final FishingBoatService fishingBoatService;
private final CodeMgtService codeMgtService;
@RequestMapping("/fishingBoat")
public ModelAndView fishingBoat(@AuthenticationPrincipal UserInfo loginUser, CrackdownStatus crackdownStatus) {
ModelAndView mav = new ModelAndView("faStatistics/fishingBoat/fishingBoatMgt");
if(crackdownStatus.getFishingBoat()==null){
crackdownStatus.setFishingBoat(new FishingBoat());
crackdownStatus.setProcessResult(new ProcessResult());
}
//메뉴권한 확인
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/faStatistics/fishingBoat").get(0).getAccessAuth();
mav.addObject("accessAuth", accessAuth);
crackdownStatus.setQueryInfo();
List<CrackdownStatus> crackdownStatusList = fishingBoatService.selectFishingBoatList(crackdownStatus);
mav.addObject("crackdownStatusList", crackdownStatusList);
crackdownStatus.setContentCnt(fishingBoatService.selectFishingBoatListCnt(crackdownStatus));
crackdownStatus.setPaginationInfo();
mav.addObject("searchParams", crackdownStatus);
return mav;
}
@GetMapping("/fishingBoatViewModal")
public ModelAndView fishingBoatViewModal(@AuthenticationPrincipal UserInfo loginUser, CrackdownStatus crackdownStatus){
ModelAndView mav = new ModelAndView("faStatistics/fishingBoat/fishingBoatViewModal");
crackdownStatus = fishingBoatService.selectCrackdownStatus(crackdownStatus.getCdsKey());
mav.addObject("crackdownStatus", crackdownStatus);
//메뉴권한 확인
mav.addObject("accessAuth", authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/faStatistics/processResult").get(0).getAccessAuth());
mav.addObject("ataList", codeMgtService.selectCodeMgtList("ATA"));
mav.addObject("cpoList", codeMgtService.selectCodeMgtList("CPO"));
mav.addObject("vtList", codeMgtService.selectCodeMgtList("VT"));
mav.addObject("ftList", codeMgtService.selectCodeMgtList("FT"));
mav.addObject("bmList", codeMgtService.selectCodeMgtList("BM"));
mav.addObject("prList", codeMgtService.selectCodeMgtList("PR"));
mav.addObject("bdtList", codeMgtService.selectCodeMgtList("BDT"));
mav.addObject("boatList", codeMgtService.selectCodeMgtList(crackdownStatus.getCrackdownPolice()));
mav.addObject("userSeq", loginUser.getUserSeq());
return mav;
}
@GetMapping("/fishingBoatEditModal")
public ModelAndView fishingBoatEditModal(@AuthenticationPrincipal UserInfo loginUser, CrackdownStatus crackdownStatus){
ModelAndView mav = new ModelAndView("faStatistics/fishingBoat/fishingBoatEditModal");
if(crackdownStatus.getCdsKey()!=null){
crackdownStatus = fishingBoatService.selectCrackdownStatus(crackdownStatus.getCdsKey());
}else{
crackdownStatus.setFishingBoat(new FishingBoat());
crackdownStatus.setProcessResult(new ProcessResult());
crackdownStatus.getFishingBoat().setWrtOrgan(loginUser.getOgCd());
crackdownStatus.getFishingBoat().setWrtPart(loginUser.getOfcCd());
crackdownStatus.getFishingBoat().setWrtUserSeq(loginUser.getUserSeq());
crackdownStatus.getFishingBoat().setWrtUserNm(loginUser.getUserNm());
crackdownStatus.getFishingBoat().setWrtUserGrd(loginUser.getTitleCd());
}
mav.addObject("ataList", codeMgtService.selectCodeMgtList("ATA"));
mav.addObject("cpoList", codeMgtService.selectCodeMgtList("CPO"));
mav.addObject("vtList", codeMgtService.selectCodeMgtList("VT"));
mav.addObject("ftList", codeMgtService.selectCodeMgtList("FT"));
mav.addObject("bmList", codeMgtService.selectCodeMgtList("BM"));
mav.addObject("prList", codeMgtService.selectCodeMgtList("PR"));
mav.addObject("bdtList", codeMgtService.selectCodeMgtList("BDT"));
mav.addObject("crackdownStatus", crackdownStatus);
return mav;
}
@PostMapping("/saveFishingBoat")
public Integer saveFishingBoat(@AuthenticationPrincipal UserInfo loginUser,
CrackdownStatus crackdownStatus,
MultipartHttpServletRequest request){
return fishingBoatService.saveCrackdownStatus(crackdownStatus, request.getMultiFileMap().get("uploadFiles"));
}
@GetMapping("/checkCaseNum")
public Integer checkCaseNum(String caseNum){
return fishingBoatService.checkCaseNum(caseNum);
}
@GetMapping("/fishingBoatVersionInfo")
public ModelAndView fishingBoatVersionInfo(FishingBoatVersion version){
ModelAndView mav = new ModelAndView("faStatistics/fishingBoat/fishingBoardVersionInfo");
mav.addObject("fishingBoat", fishingBoatService.selectFishingBoatVersion(version.getFbKey(), version.getVersionNo()));
mav.addObject("vtList", codeMgtService.selectCodeMgtList("VT"));
mav.addObject("ftList", codeMgtService.selectCodeMgtList("FT"));
mav.addObject("bmList", codeMgtService.selectCodeMgtList("BM"));
return mav;
}
}

View File

@ -0,0 +1,152 @@
package com.dbnt.faisp.main.faStatistics.crackdownsStatus;
import com.dbnt.faisp.main.authMgt.service.AuthMgtService;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.crackdownStatus.CrackdownStatus;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.FishingBoat;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.processResult.ProcessResult;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.processResult.ProcessResultVersion;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.repository.*;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.service.ProcessResultService;
import com.dbnt.faisp.main.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 ProcessResultController {
private final AuthMgtService authMgtService;
private final ProcessResultService processResultService;
private final ViolationRepository violationRepository;
private final CrackdownStatusRepository crackdownStatusRepository;
private final FishingBoatRepository fishingBoatRepository;
private final ProcessResultRepository processResultRepository;
@RequestMapping("/processResult")
public ModelAndView processResult(@AuthenticationPrincipal UserInfo loginUser, ProcessResult processResult) {
ModelAndView mav = new ModelAndView("faStatistics/processResult/processResult");
//메뉴권한 확인
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/faStatistics/processResult").get(0).getAccessAuth();
mav.addObject("accessAuth", accessAuth);
processResult.setQueryInfo();
List<ProcessResult> processResultList = processResultService.selectProcessResultList(processResult);
for (ProcessResult pr:processResultList) {
pr.setCrackdownStatus(crackdownStatusRepository.findByCdsKey(pr.getCdsKey()).orElse(null));
pr.setFishingBoat(fishingBoatRepository.findByCdsKey(pr.getCdsKey()).orElse(null));
pr.setViolationList(violationRepository.findByFbKey(pr.getFishingBoat().getFbKey()));
}
mav.addObject("processResultList", processResultList);
mav.addObject("searchParams", processResult);
return mav;
}
@GetMapping("/processResult/processResultViewModal")
public ModelAndView processResultViewModal(@AuthenticationPrincipal UserInfo loginUser, ProcessResult processResult){
ModelAndView mav = new ModelAndView("faStatistics/processResult/processResultViewModal");
processResult = processResultService.selectProcessResult(processResult.getPrKey());
processResult.setCrackdownStatus(crackdownStatusRepository.findByCdsKey(processResult.getCdsKey()).orElse(null));
processResult.setFbKey(fishingBoatRepository.findByCdsKey(processResult.getCdsKey()).orElse(null).getFbKey());
processResult.setBoatNameKr(fishingBoatRepository.findByCdsKey(processResult.getCdsKey()).orElse(null).getBoatNameKr());
processResult.setViolationList(violationRepository.findByFbKey(processResult.getFbKey()));
mav.addObject("processResult", processResult);
mav.addObject("userSeq",loginUser.getUserSeq());
//메뉴권한 확인
mav.addObject("accessAuth", authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/faStatistics/processResult").get(0).getAccessAuth());
return mav;
}
@GetMapping("/processResult/processResultEditModal")
public ModelAndView crackdownStatusEditModal(@AuthenticationPrincipal UserInfo loginUser, ProcessResult processResult){
ModelAndView mav = new ModelAndView("faStatistics/processResult/processResultEditModal");
if(processResult.getPrKey()!=null){
processResult = processResultService.selectProcessResult(processResult.getPrKey());
processResult.setCrackdownStatus(crackdownStatusRepository.findByCdsKey(processResult.getCdsKey()).orElse(null));
processResult.setFbKey(fishingBoatRepository.findByCdsKey(processResult.getCdsKey()).orElse(null).getFbKey());
processResult.setBoatNameKr(fishingBoatRepository.findByCdsKey(processResult.getCdsKey()).orElse(null).getBoatNameKr());
processResult.setViolationList(violationRepository.findByFbKey(processResult.getFbKey()));
}else{
processResult.setWrtOrgan(loginUser.getOgCd());
processResult.setWrtPart(loginUser.getOfcCd());
processResult.setWrtUserGrd(loginUser.getGroupCd());
processResult.setWrtUserNm(loginUser.getUserNm());
processResult.setWrtDt(LocalDateTime.now());
}
mav.addObject("processResult", processResult);
return mav;
}
@GetMapping("/processResult/processResultHistoryViewModal")
public ModelAndView processResultHistoryViewModal(@AuthenticationPrincipal UserInfo loginUser, ProcessResult processResult){
ModelAndView mav = new ModelAndView("faStatistics/processResult/processResultHistoryViewModal");
List<ProcessResultVersion> processReulstVersionList = processResultService.selectProcessResultVersionList(processResult.getPrKey());
mav.addObject("processReulstVersionList", processReulstVersionList);
mav.addObject("processResult", processResult);
return mav;
}
@GetMapping("/processResult/processResultHistoryDetail")
public ModelAndView processResultHistoryDetail(@AuthenticationPrincipal UserInfo loginUser, ProcessResultVersion processResultVersion){
ModelAndView mav = new ModelAndView("faStatistics/processResult/processResultHistoryDetail");
Integer cdsKey = processResultVersion.getCdsKey();
Integer fbKey = processResultVersion.getFbKey();
processResultVersion = processResultService.selectProcessResultVersion(processResultVersion.getVersionNo(), processResultVersion.getPrKey());
processResultVersion.setFishingBoat(fishingBoatRepository.findByFbKey(fbKey).orElse(null));
processResultVersion.setCrackdownStatus(crackdownStatusRepository.findByCdsKey(cdsKey).orElse(null));
processResultVersion.setViolationList(violationRepository.findByFbKey(fbKey));
mav.addObject("processResultVersion", processResultVersion);
return mav;
}
@GetMapping("/processResult/processResultAddModal")
public ModelAndView sailorAddModal(@AuthenticationPrincipal UserInfo loginUser, ProcessResult processResult){
ModelAndView mav = new ModelAndView("faStatistics/processResult/processResultAddModal");
processResult.setCrackdownStatusList(crackdownStatusRepository.findAll());
processResult.setWrtOrgan(loginUser.getOgCd());
processResult.setWrtUserNm(loginUser.getUserNm());
processResult.setWrtDt(LocalDateTime.now());
mav.addObject("processResult", processResult);
return mav;
}
@PostMapping("/processResult/getProcessResult")
public ProcessResult getProcessResult(@AuthenticationPrincipal UserInfo loginUser, ProcessResult processResult){
processResult = processResultRepository.findByCdsKey(processResult.getCdsKey()).orElse(null);
processResult.setCrackdownStatus(crackdownStatusRepository.findByCdsKey(processResult.getCdsKey()).orElse(null));
processResult.setFishingBoat(fishingBoatRepository.findByCdsKey(processResult.getCdsKey()).orElse(null));
processResult.setWrtOrgan(loginUser.getOgCd());
processResult.setWrtUserNm(loginUser.getUserNm());
processResult.setWrtDt(LocalDateTime.now());
return processResult;
}
@PostMapping("/processResult/saveProcessResult")
public Integer saveProcessResult(@AuthenticationPrincipal UserInfo loginUser,
CrackdownStatus crackdownStatus,
FishingBoat fishingBoat,
ProcessResult processResult){
processResult.setWrtUserSeq(loginUser.getUserSeq());
processResult.setFishingBoat(fishingBoat);
processResult.setCrackdownStatus(crackdownStatus);
return processResultService.saveProcessResult(processResult);
}
}

View File

@ -0,0 +1,133 @@
package com.dbnt.faisp.main.faStatistics.crackdownsStatus;
import com.dbnt.faisp.main.authMgt.service.AuthMgtService;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.crackdownStatus.CrackdownStatus;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.FishingBoat;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.sailor.Sailor;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.sailor.SailorVersion;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.repository.*;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.service.SailorService;
import com.dbnt.faisp.main.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.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import java.time.LocalDateTime;
import java.util.List;
@RestController
@RequiredArgsConstructor
@RequestMapping("/faStatistics")
public class SailorController {
private final AuthMgtService authMgtService;
private final SailorService sailorService;
private final ViolationRepository violationRepository;
private final CrackdownStatusRepository crackdownStatusRepository;
private final FishingBoatRepository fishingBoatRepository;
private final SailorRepository sailorRepository;
@RequestMapping("/sailor")
public ModelAndView sailor(@AuthenticationPrincipal UserInfo loginUser, Sailor sailor) {
ModelAndView mav = new ModelAndView("faStatistics/sailor/sailor");
//메뉴권한 확인
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/faStatistics/sailor").get(0).getAccessAuth();
mav.addObject("accessAuth", accessAuth);
List<Sailor> sailorList = sailorService.selectSailorList(sailor);
for (Sailor s:sailorList) {
s.setFishingBoat(fishingBoatRepository.findByFbKey(s.getFbKey()).orElse(null));
s.setCrackdownStatus(crackdownStatusRepository.findByCdsKey(s.getFishingBoat().getCdsKey()).orElse(null));
s.setViolationList(violationRepository.findByFbKey(s.getFishingBoat().getFbKey()));
}
mav.addObject("sailorList", sailorList);
mav.addObject("searchParams", sailor);
return mav;
}
@GetMapping("/sailor/sailorViewModal")
public ModelAndView sailorViewModal(@AuthenticationPrincipal UserInfo loginUser, Sailor sailor){
ModelAndView mav = new ModelAndView("faStatistics/sailor/sailorViewModal");
sailor = sailorService.selectSailor(sailor.getSailorKey());
sailor.setFishingBoat(fishingBoatRepository.findByFbKey(sailor.getFbKey()).orElse(null));
sailor.setCrackdownStatus(crackdownStatusRepository.findByCdsKey(sailor.getFishingBoat().getCdsKey()).orElse(null));
sailor.setViolationList(violationRepository.findByFbKey(sailor.getFishingBoat().getFbKey()));
mav.addObject("sailor", sailor);
mav.addObject("userSeq",loginUser.getUserSeq());
//메뉴권한 확인
mav.addObject("accessAuth", authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/faStatistics/sailor").get(0).getAccessAuth());
return mav;
}
@GetMapping("/sailor/sailorHistoryViewModal")
public ModelAndView sailorHistoryViewModal(@AuthenticationPrincipal UserInfo loginUser, Sailor sailor){
ModelAndView mav = new ModelAndView("faStatistics/sailor/sailorHistoryViewModal");
List<SailorVersion> sailorVersionList = sailorService.selectSailorVersionList(sailor.getSailorKey());
mav.addObject("sailorVersionList", sailorVersionList);
mav.addObject("sailor", sailor);
return mav;
}
@GetMapping("/sailor/sailorHistoryDetail")
public ModelAndView sailorHistoryDetail(@AuthenticationPrincipal UserInfo loginUser, SailorVersion sailorVersion){
ModelAndView mav = new ModelAndView("faStatistics/sailor/sailorHistoryDetail");
Integer cdsKey = sailorVersion.getCdsKey();
Integer fbKey = sailorVersion.getFbKey();
sailorVersion = sailorService.selectSailorVersion(sailorVersion.getVersionNo(), sailorVersion.getSailorKey());
sailorVersion.setFishingBoat(fishingBoatRepository.findByFbKey(fbKey).orElse(null));
sailorVersion.setCrackdownStatus(crackdownStatusRepository.findByCdsKey(cdsKey).orElse(null));
mav.addObject("sailorVersion", sailorVersion);
return mav;
}
@GetMapping("/sailor/sailorEditModal")
public ModelAndView sailorEditModal(@AuthenticationPrincipal UserInfo loginUser, Sailor sailor){
ModelAndView mav = new ModelAndView("faStatistics/sailor/sailorEditModal");
sailor = sailorService.selectSailor(sailor.getSailorKey());
sailor.setFishingBoat(fishingBoatRepository.findByFbKey(sailor.getFbKey()).orElse(null));
sailor.setCrackdownStatus(crackdownStatusRepository.findByCdsKey(sailor.getFishingBoat().getCdsKey()).orElse(null));
sailor.setViolationList(violationRepository.findByFbKey(sailor.getFishingBoat().getFbKey()));
mav.addObject("sailor", sailor);
return mav;
}
@GetMapping("/sailor/sailorAddModal")
public ModelAndView sailorAddModal(@AuthenticationPrincipal UserInfo loginUser, Sailor sailor){
ModelAndView mav = new ModelAndView("faStatistics/sailor/sailorAddModal");
sailor.setFishingBoatList(fishingBoatRepository.findAll());
sailor.setWrtOrgan(loginUser.getOgCd());
sailor.setWrtPart(loginUser.getOfcCd());
sailor.setWrtUserGrd(loginUser.getGroupCd());
sailor.setWrtUserNm(loginUser.getUserNm());
sailor.setWrtDt(LocalDateTime.now());
mav.addObject("sailor", sailor);
return mav;
}
@PostMapping("/sailor/saveSailor")
public Integer saveSailor(@AuthenticationPrincipal UserInfo loginUser,
CrackdownStatus crackdownStatus,
FishingBoat fishingBoat,
Sailor sailor){
sailor.setWrtUserSeq(loginUser.getUserSeq());
sailor.setFishingBoat(fishingBoat);
sailor.setCrackdownStatus(crackdownStatus);
return sailorService.saveSailor(sailor);
}
}

View File

@ -0,0 +1,18 @@
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.mapper;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.crackdownStatus.CrackdownStatus;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.FishingBoat;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.FishingBoatVersion;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface CrackdownStatusMapper {
List<CrackdownStatus> selectCrackdownStatusList(CrackdownStatus crackdownStatus);
Integer selectCrackdownStatusListCnt(CrackdownStatus crackdownStatus);
List<CrackdownStatus> selectFishingBoatList(CrackdownStatus crackdownStatus);
Integer selectFishingBoatListCnt(CrackdownStatus crackdownStatus);
List<FishingBoatVersion> selectFishingBoatVersionList(Integer fbKey);
}

View File

@ -0,0 +1,12 @@
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.mapper;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.processResult.ProcessResult;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface ProcessResultMapper {
List<ProcessResult> selectProcessResultList(ProcessResult processResult);
Integer selectProcessResultListCnt(ProcessResult processResult);
}

View File

@ -0,0 +1,11 @@
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.mapper;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.sailor.Sailor;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface SailorMapper {
List<Sailor> selectSailorList(Sailor sailor);
}

View File

@ -0,0 +1,53 @@
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.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
@IdClass(CaptinPhotoFile.CaptinPhotoFileId.class)
@Table(name = "captin_photo_file")
public class CaptinPhotoFile extends FileInfo {
@Id
@Column(name = "sailor_key")
private Integer sailorKey;
@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 CaptinPhotoFileId implements Serializable {
private Integer sailorKey;
private Integer fileSeq;
}
}

View File

@ -0,0 +1,58 @@
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.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
@IdClass(CaptinPhotoVersion.CaptinPhotoVersionId.class)
@Table(name = "captin_photo_version")
public class CaptinPhotoVersion extends FileInfo {
@Id
@Column(name = "sailor_key")
private Integer sailorKey;
@Id
@Column(name = "file_seq")
private Integer fileSeq;
@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 = "save_path")
private String savePath;
@Embeddable
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class CaptinPhotoVersionId implements Serializable {
private Integer sailorKey;
private Integer fileSeq;
private Integer versionNo;
}
}

View File

@ -0,0 +1,219 @@
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.crackdownStatus;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.FishingBoat;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.FishingBoatVersion;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.Violation;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.processResult.ProcessResult;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.sailor.Sailor;
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 = "crackdown_status")
public class CrackdownStatus extends CrackdownStatusBaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "cds_key")
private Integer cdsKey;
@Transient
private List<Violation> violationList;
@Transient
private FishingBoat fishingBoat;
@Transient
private List<FishingBoatVersion> fishingBoatVersionList;
@Transient
private ProcessResult processResult;
@Transient
private List<Sailor> sailorList;
@Transient
private String crackdownPoliceEtc;
@Transient
private String crackdownBoatEtc;
@Transient
private Integer fbKey;
@Transient
private String boatNameKr;
@Transient
private String fisheryType;
@Transient
private String boatNnySung;
@Transient
private String boatMaterial;
@Transient
private String boatNnySi;
@Transient
private Double tonCnt;
@Transient
private String boat_material;
@Transient
private String violationStr;
@Transient
private String sailorNameKr;
@Transient
private String processStatus;
@Transient
private Integer restrictionCaptin;
@Transient
private Integer notRestrictionCaptin;
@Transient
private Integer restrictionMate;
@Transient
private Integer notRestrictionMate;
@Transient
private Integer restrictionWarden;
@Transient
private Integer notRestrictionWarden;
@Transient
private Integer restrictionSailor;
@Transient
private Integer notRestrictionSailor;
@Transient
private Integer restrictionTotal;
@Transient
private Integer notRestrictionTotal;
@Transient
private Integer unlicensedOperationTotal;
@Transient
private Integer specificImpossibilityTotal;
@Transient
private Integer eezTotal;
@Transient
private Integer invasionTerritorialWatersTotal;
@Transient
private List<Integer> violationDeleteKeyList;
@Transient
private List<Integer> sailorDeleteKeyList;
@Transient
private String year;
@Transient
private String month;
@Transient
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate napoDate;
@Transient
private String violation;
@Transient
private Integer tonStartCnt;
@Transient
private Integer tonEndCnt;
@Transient
private String catchFishSpecies;
@Transient
private String catchCnt;
@Transient
private String offenseFishSpecies;
@Transient
private String offenseCatchCnt;
@Transient
private String offenseIllegalWasteQuantity;
@Transient
private String offenseQuantity;
@Transient
private String offenseAmount;
@Transient
private String damboPayment;
@Transient
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate paymentPaymentDate;
@Transient
private Integer damboUnpaidAmount;
@Transient
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate consignmentStartDate;
@Transient
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate consignmentEndDate;
/*@Transient
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate evictionDt;*/
@Transient
private String isEvictionDt;
/*@Transient
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate returnDt;*/
@Transient
private String isReturnDt;
/*@Transient
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate confiscationDt;*/
@Transient
private String isConfiscationDt;
@Transient
private String isConsignmentStartDt;
@Transient
private String isDamboUnpaidAmount;
@Transient
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate boatDisposalDate;
@Transient
private String boatDisposalType;
@Transient
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate directHandoverDate;
@Transient
private String isDirectHandoverDt;
@Transient
private String handoverSeaPointLat;
@Transient
private String handoverSeaPointLon;
@Transient
private String handoverSeaPointDetail;
@Transient
private String handoverBoat;
@Transient
private String middleTakeoverBoat;
@Transient
private String captin;
@Transient
private String mate;
@Transient
private String warden;
@Transient
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate fieldIvsgtNapoDate;
@Transient
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate fieldIvsgtReleaseDate;
@Transient
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate pressurizedStartDate;
@Transient
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate pressurizedEndDate;
@Transient
private String distance;
@Transient
private String confiscationFrame;
@Transient
private String confiscationWidth;
@Transient
private String confiscationJo;
@Transient
private String confiscationGae;
@Transient
private String confiscationEtc;
}

View File

@ -0,0 +1,119 @@
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.crackdownStatus;
import com.dbnt.faisp.config.BaseModel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*;
import java.time.LocalDateTime;
@Getter
@Setter
@NoArgsConstructor
@MappedSuperclass
public class CrackdownStatusBaseEntity extends BaseModel {
@Column(name = "case_num")
private String caseNum;
@Column(name = "napo_dt")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
private LocalDateTime napoDt;
@Column(name = "napo_sea_point_lon")
private String napoSeaPointLon;
@Column(name = "napo_sea_point_lat")
private String napoSeaPointLat;
@Column(name = "napo_sea_point_detail")
private String napoSeaPointDetail;
@Column(name = "invasion_type")
private String invasionType;
@Column(name = "nll")
private String nll;
@Column(name = "case_agency")
private String caseAgency;
@Column(name = "case_police_officer")
private String casePoliceOfficer;
@Column(name = "crackdown_boat")
private String crackdownBoat;
@Column(name = "crackdown_police")
private String crackdownPolice;
@Column(name = "mmsi")
private String mmsi;
@Column(name = "field_ivsgt")
private String fieldIvsgt;
@Column(name = "obstr_exspd_cnt")
private Integer obstrExspdCnt;
@Column(name = "person_damage_cnt")
private Integer personDamageCnt;
@Column(name = "person_damage_amount")
private Integer personDamageAmount;
@Column(name = "person_damage_detail")
private String personDamageDetail;
@Column(name = "material_damage_cnt")
private Integer materialDamageCnt;
@Column(name = "material_damage_amount")
private Integer materialDamageAmount;
@Column(name = "material_damage_detail")
private String materialDamageDetail;
@Column(name = "field_ivsgt_napo_dt")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
private LocalDateTime fieldIvsgtNapoDt;
@Column(name = "field_ivsgt_release_dt")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
private LocalDateTime fieldIvsgtReleaseDt;
@Column(name = "field_ivsgt_time_taken")
private String fieldIvsgtTimeTaken;
@Column(name = "pressurized_start_dt")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
private LocalDateTime pressurizedStartDt;
@Column(name = "pressurized_end_dt")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
private LocalDateTime pressurizedEndDt;
@Column(name = "distance")
private String distance;
@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;
}

View File

@ -0,0 +1,36 @@
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.crackdownStatus;
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 = "crackdown_status_version")
@IdClass(CrackdownStatusVersion.CrackdownStatusVersionId.class)
public class CrackdownStatusVersion extends CrackdownStatusBaseEntity {
@Id
@Column(name = "cds_key")
private Integer cdsKey;
@Id
@Column(name = "version_no")
private Integer versionNo;
@Embeddable
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class CrackdownStatusVersionId implements Serializable {
private Integer cdsKey;
private Integer versionNo;
}
}

View File

@ -0,0 +1,44 @@
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat;
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 = "fishing_boat")
public class FishingBoat extends FishingBoatBaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "fb_key")
private Integer fbKey;
@Transient
private String year;
@Transient
private String caseAgency;
@Transient
private String crackdownPolice;
@Transient
private String crackdownBoat;
@Transient
private String boatNny;
@Transient
private String processStatus;
@Transient
private String violation;
@Transient
private String boatMaterialEtc;
@Transient
private String fisheryTypeEtc;
}

View File

@ -0,0 +1,91 @@
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat;
import com.dbnt.faisp.config.BaseModel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*;
import java.time.LocalDateTime;
@Getter
@Setter
@NoArgsConstructor
@MappedSuperclass
public class FishingBoatBaseEntity extends BaseModel {
@Column(name = "cds_key")
private Integer cdsKey;
@Column(name = "boat_name_kr")
private String boatNameKr;
@Column(name = "boat_name_cn")
private String boatNameCn;
@Column(name = "permit_num")
private String permitNum;
@Column(name = "nationality")
private String nationality;
@Column(name = "sailor_cnt")
private Integer sailorCnt=0;
@Column(name = "ton_cnt")
private Double tonCnt=0d;
@Column(name = "fishery_type")
private String fisheryType;
@Column(name = "boat_material")
private String boatMaterial;
@Column(name = "boat_nny_sung")
private String boatNnySung;
@Column(name = "boat_nny_si")
private String boatNnySi;
@Column(name = "offense_type")
private String offenseType;
@Column(name = "offense_weight")
private Double offenseWeight=0d;
@Column(name = "offense_quantity")
private Integer offenseQuantity=0;
@Column(name = "offense_amount")
private Integer offenseAmount=0;
@Column(name = "offense_illegal_waste_quantity")
private Integer offenseIllegalWasteQuantity=0;
@Column(name = "dambo_unpaid_amount")
private Integer damboUnpaidAmount=0;
@Column(name = "dambo_payment")
private Integer damboPayment=0;
@Column(name = "payment_payment_dt")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
private LocalDateTime paymentPaymentDt;
@Column(name = "confiscation_frame")
private String confiscationFrame;
@Column(name = "confiscation_width")
private String confiscationWidth;
@Column(name = "confiscation_jo")
private String confiscationJo;
@Column(name = "confiscation_gae")
private String confiscationGae;
@Column(name = "confiscation_etc")
private String confiscationEtc;
@Column(name = "catch_fish_species")
private String catchFishSpecies;
@Column(name = "catch_cnt")
private Integer catchCnt=0;
@Column(name = "offense_fish_species")
private String offenseFishSpecies;
@Column(name = "offense_catch_cnt")
private Integer offenseCatchCnt=0;
@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_user_nm")
private String wrtUserNm;
@Column(name = "wrt_user_grd")
private String wrtUserGrd;
@Column(name = "wrt_dt")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
private LocalDateTime wrtDt;
}

View File

@ -0,0 +1,39 @@
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat;
import lombok.*;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.*;
import java.io.Serializable;
import java.util.List;
@Getter
@Setter
@Entity
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@Table(name = "fishing_boat_version")
@IdClass(FishingBoatVersion.FishingBoatVersionId.class)
public class FishingBoatVersion extends FishingBoatBaseEntity {
@Id
@Column(name = "fb_key")
private Integer fbKey;
@Id
@Column(name = "version_no")
private Integer versionNo;
@Transient
private List<ViolationVersion> violationList;
@Embeddable
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class FishingBoatVersionId implements Serializable {
private Integer fbKey;
private Integer versionNo;
}
}

View File

@ -0,0 +1,40 @@
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat;
import com.dbnt.faisp.config.BaseModel;
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 = "violation")
@IdClass(Violation.ViolationId.class)
public class Violation extends BaseModel {
@Id
@Column(name = "violation_key")
private Integer violationKey;
@Id
@Column(name = "fb_key")
private Integer fbKey;
@Column(name = "violation")
private String violation;
@Transient
private String violationEtc;
@Embeddable
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class ViolationId implements Serializable{
private Integer violationKey;
private Integer fbKey;
}
}

View File

@ -0,0 +1,41 @@
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat;
import com.dbnt.faisp.config.BaseModel;
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 = "violation_version")
@IdClass(ViolationVersion.ViolationVersionId.class)
public class ViolationVersion extends BaseModel {
@Id
@Column(name = "violation_key")
private Integer violationKey;
@Id
@Column(name = "fb_key")
private Integer fbKey;
@Id
@Column(name = "version_no")
private Integer versionNo;
@Column(name = "violation")
private String violation;
@Embeddable
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class ViolationVersionId implements Serializable{
private Integer violationKey;
private Integer fbKey;
private Integer versionNo;
}
}

View File

@ -0,0 +1,64 @@
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.processResult;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.crackdownStatus.CrackdownStatus;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.FishingBoat;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.Violation;
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.LocalDateTime;
import java.util.List;
@Getter
@Setter
@Entity
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@Table(name = "process_result")
public class ProcessResult extends ProcessResultBaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "pr_key")
private Integer prKey;
@Column(name = "cds_key")
private Integer cdsKey;
@Transient
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDateTime updDt;
@Transient
private CrackdownStatus crackdownStatus;
@Transient
private List<Violation> violationList;
@Transient
private FishingBoat fishingBoat;
@Transient
private String boatNameKr;
@Transient
private Integer fbKey;
@Transient
private String processStatusEtc;
@Transient
private String executionDetailEtc;
@Transient
private List<CrackdownStatus> crackdownStatusList;
@Transient
private List<FishingBoat> fishingBoatList;
@Transient
private String caseNum;
@Transient
private String crackdownPolice;
@Transient
private String year;
@Transient
private String violation;
}

View File

@ -0,0 +1,123 @@
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.processResult;
import com.dbnt.faisp.config.BaseModel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*;
import java.time.LocalDate;
import java.time.LocalDateTime;
@Getter
@Setter
@MappedSuperclass
@NoArgsConstructor
public class ProcessResultBaseEntity extends BaseModel {
@Column(name = "process_status")
private String processStatus;
@Column(name = "pressurized_time_taken")
private String pressurizedTimeTaken;
@Column(name = "warrant_req_take_time")
private String warrantReqTakeTime;
@Column(name = "is_ivsgt_stop")
private String isIvsgtStop;
@Column(name = "eviction_dt")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate evictionDt;
@Column(name = "direct_handover_dt")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate directHandoverDt;
@Column(name = "handover_sea_point_lon")
private String handoverSeaPointLon;
@Column(name = "handover_sea_point_lat")
private String handoverSeaPointLat;
@Column(name = "handover_sea_point_detail")
private String handoverSeaPointDetail;
@Column(name = "handover_boat")
private String handoverBoat;
@Column(name = "middle_takeover_boat")
private String middleTakeoverBoat;
@Column(name = "consignment_start_dt")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate consignmentStartDt;
@Column(name = "consignment_end_dt")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate consignmentEndDt;
@Column(name = "confiscation_dt")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate confiscationDt;
@Column(name = "boat_disposal_dt")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate boatDisposalDt;
@Column(name = "boat_disposal_type")
private String boatDisposalType;
@Column(name = "return_dt")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate returnDt;
@Column(name = "exile_cnt")
private Integer exileCnt;
@Column(name = "exile_dt")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate exileDt;
@Column(name = "flight")
private String flight;
@Column(name = "immigration_office_name")
private String immigrationOfficeName;
@Column(name = "immigration_office_officer_name")
private String immigrationOfficeOfficerName;
@Column(name = "immigration_office_officer_contact")
private String immigrationOfficeOfficerContact;
@Column(name = "sentencing_court")
private String sentencingCourt;
@Column(name = "sentencing_detail")
private String sentencingDetail;
@Column(name = "execution_detail")
private String executionDetail;
@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;
}

View File

@ -0,0 +1,51 @@
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.processResult;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.FishingBoat;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.Violation;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.crackdownStatus.CrackdownStatus;
import lombok.*;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.*;
import java.io.Serializable;
import java.util.List;
@Getter
@Setter
@Entity
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@Table(name = "process_result_version")
@IdClass(ProcessResultVersion.ProcessResultVersionId.class)
public class ProcessResultVersion extends ProcessResultBaseEntity {
@Id
@Column(name = "pr_key")
private Integer prKey;
@Id
@Column(name = "version_no")
private Integer versionNo;
@Embeddable
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class ProcessResultVersionId implements Serializable {
private Integer prKey;
private Integer versionNo;
}
@Transient
private Integer cdsKey;
@Transient
private Integer fbKey;
@Transient
private CrackdownStatus crackdownStatus;
@Transient
private FishingBoat fishingBoat;
@Transient
private List<Violation> violationList;
}

View File

@ -0,0 +1,63 @@
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.sailor;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.CaptinPhotoFile;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.crackdownStatus.CrackdownStatus;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.FishingBoat;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.Violation;
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 = "sailor")
public class Sailor extends SailorBaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "sailor_key")
private Integer sailorKey;
@Column(name = "fb_key")
private Integer fbKey;
@Transient
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDateTime updDt;
@Transient
private Integer cdsKey;
@Transient
private CrackdownStatus crackdownStatus;
@Transient
private FishingBoat fishingBoat;
@Transient
private List<FishingBoat> fishingBoatList;
@Transient
private List<Violation> violationList;
@Transient
private String year;
@Transient
private String crackdownPolice;
@Transient
private String crackdownBoat;
@Transient
private String boatNameKr;
@Transient
private LocalDateTime napoDt;
@Transient
private List<CaptinPhotoFile> fileList;
}

View File

@ -0,0 +1,87 @@
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.sailor;
import com.dbnt.faisp.config.BaseModel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*;
import java.time.LocalDate;
import java.time.LocalDateTime;
@Getter
@Setter
@MappedSuperclass
@NoArgsConstructor
public class SailorBaseEntity extends BaseModel {
@Column(name = "sailor_name_kr")
private String sailorNameKr;
@Column(name = "sailor_name_cn")
private String sailorNameCn;
@Column(name = "sailor_name_pinyin")
private String sailorNamePinyin;
@Column(name = "sailor_contact")
private String sailorContact;
@Column(name = "birthdate")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate birthdate;
@Column(name = "residence")
private String residence;
@Column(name = "education")
private String education;
@Column(name = "position")
private String position;
@Column(name = "career")
private String career;
@Column(name = "similar_criminal_history")
private Integer similarCriminalHistory;
@Column(name = "heterogeneous_criminal_history")
private Integer heterogeneousCriminalHistory;
@Column(name = "arrest_history")
private Integer arrestHistory;
@Column(name = "criminal_history_detail")
private String criminalHistoryDetail;
@Column(name = "monthly_wages")
private String monthlyWages;
@Column(name = "is_restriction")
private String isRestriction;
@Column(name = "note")
private String note;
@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;
}

View File

@ -0,0 +1,58 @@
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.sailor;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.CaptinPhotoFile;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.CaptinPhotoVersion;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.crackdownStatus.CrackdownStatus;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.FishingBoat;
import lombok.*;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.*;
import java.io.Serializable;
import java.util.List;
@Getter
@Setter
@Entity
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@Table(name = "sailor_version")
@IdClass(SailorVersion.SailorVersionId.class)
public class SailorVersion extends SailorBaseEntity {
@Id
@Column(name = "version_no")
private Integer versionNo;
@Id
@Column(name = "sailor_key")
private Integer sailorKey;
@Embeddable
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class SailorVersionId implements Serializable {
private Integer versionNo;
private Integer sailorKey;
}
/*@Transient
private CrackdownStatusVersion crackdownStatusVersion;
@Transient
private FishingBoatVersion fishingBoatVersion;*/
@Transient
private Integer cdsKey;
@Transient
private Integer fbKey;
@Transient
private CrackdownStatus crackdownStatus;
@Transient
private FishingBoat fishingBoat;
@Transient
private List<CaptinPhotoVersion> fileList;
}

View File

@ -0,0 +1,11 @@
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.repository;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.CaptinPhotoFile;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface CaptionPhotoFileRepository extends JpaRepository<CaptinPhotoFile, CaptinPhotoFile.CaptinPhotoFileId> {
List<CaptinPhotoFile> findBySailorKeyOrderByFileSeqAsc(Integer sailorKey);
}

View File

@ -0,0 +1,8 @@
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.repository;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.CaptinPhotoVersion;
import org.springframework.data.jpa.repository.JpaRepository;
public interface CaptionPhotoVersionRepository extends JpaRepository<CaptinPhotoVersion, CaptinPhotoVersion.CaptinPhotoVersionId> {
}

View File

@ -0,0 +1,11 @@
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.repository;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.crackdownStatus.CrackdownStatus;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.Optional;
public interface CrackdownStatusRepository extends JpaRepository<CrackdownStatus, Integer> {
Optional<CrackdownStatus> findByCdsKey(Integer cdsKey);
Optional<CrackdownStatus> findTop1ByCaseNum(String caseNum);
}

View File

@ -0,0 +1,14 @@
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.repository;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.crackdownStatus.CrackdownStatusVersion;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
import java.util.Optional;
public interface CrackdownStatusVersionRepository extends JpaRepository<CrackdownStatusVersion, CrackdownStatusVersion.CrackdownStatusVersionId> {
Optional<CrackdownStatusVersion> findTopByCdsKeyOrderByVersionNoDesc(Integer cdsKey);
List<CrackdownStatusVersion> findByCdsKey(Integer cdsKey);
CrackdownStatusVersion findByVersionNoAndCdsKey(Integer versionNo, Integer cdsKey);
}

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