first commit

This commit is contained in:
2026-03-16 15:45:51 +09:00
commit c98c10b65e
104 changed files with 43232 additions and 0 deletions

28
.gitignore vendored Normal file
View File

@@ -0,0 +1,28 @@
HELP.md
target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea/
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
### VS Code ###
.vscode/

117
.mvn/wrapper/MavenWrapperDownloader.java vendored Normal file
View File

@@ -0,0 +1,117 @@
/*
* Copyright 2007-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
*/
import java.net.*;
import java.io.*;
import java.nio.channels.*;
import java.util.Properties;
public class MavenWrapperDownloader {
private static final String WRAPPER_VERSION = "0.5.6";
/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";
/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";
/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
public static void main(String args[]) {
System.out.println("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
if(mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
if(mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
// Ignore ...
}
}
}
System.out.println("- Downloading from: " + url);
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
if(!outputFile.getParentFile().exists()) {
if(!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
try {
downloadFileFromURL(url, outputFile);
System.out.println("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
e.printStackTrace();
System.exit(1);
}
}
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
String username = System.getenv("MVNW_USERNAME");
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
}
URL website = new URL(urlString);
ReadableByteChannel rbc;
rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(destination);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
}
}

BIN
.mvn/wrapper/maven-wrapper.jar vendored Normal file

Binary file not shown.

2
.mvn/wrapper/maven-wrapper.properties vendored Normal file
View File

@@ -0,0 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar

310
mvnw vendored Normal file
View File

@@ -0,0 +1,310 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Maven Start Up Batch script
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ] ; then
if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
if [ -z "$JAVA_HOME" ]; then
if [ -x "/usr/libexec/java_home" ]; then
export JAVA_HOME="`/usr/libexec/java_home`"
else
export JAVA_HOME="/Library/Java/Home"
fi
fi
;;
esac
if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
JAVA_HOME=`java-config --jre-home`
fi
fi
if [ -z "$M2_HOME" ] ; then
## resolve links - $0 may be a link to maven's home
PRG="$0"
# need this for relative symlinks
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
saveddir=`pwd`
M2_HOME=`dirname "$PRG"`/..
# make it fully qualified
M2_HOME=`cd "$M2_HOME" && pwd`
cd "$saveddir"
# echo Using m2 at $M2_HOME
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --unix "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# For Mingw, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$M2_HOME" ] &&
M2_HOME="`(cd "$M2_HOME"; pwd)`"
[ -n "$JAVA_HOME" ] &&
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
fi
if [ -z "$JAVA_HOME" ]; then
javaExecutable="`which javac`"
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
if $darwin ; then
javaHome="`dirname \"$javaExecutable\"`"
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
else
javaExecutable="`readlink -f \"$javaExecutable\"`"
fi
javaHome="`dirname \"$javaExecutable\"`"
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi
if [ -z "$JAVACMD" ] ; then
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
else
JAVACMD="`which java`"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi
if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
if [ -z "$1" ]
then
echo "Path not specified to find_maven_basedir"
return 1
fi
basedir="$1"
wdir="$1"
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
if [ -d "${wdir}" ]; then
wdir=`cd "$wdir/.."; pwd`
fi
# end of workaround
done
echo "${basedir}"
}
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
echo "$(tr -s '\n' ' ' < "$1")"
fi
}
BASE_DIR=`find_maven_basedir "$(pwd)"`
if [ -z "$BASE_DIR" ]; then
exit 1;
fi
##########################################################################################
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
# This allows using the maven wrapper in projects that prohibit checking in binary data.
##########################################################################################
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found .mvn/wrapper/maven-wrapper.jar"
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
fi
if [ -n "$MVNW_REPOURL" ]; then
jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
else
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
fi
while IFS="=" read key value; do
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
esac
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
if [ "$MVNW_VERBOSE" = true ]; then
echo "Downloading from: $jarUrl"
fi
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
if $cygwin; then
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
fi
if command -v wget > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found wget ... using wget"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
wget "$jarUrl" -O "$wrapperJarPath"
else
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
fi
elif command -v curl > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found curl ... using curl"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
curl -o "$wrapperJarPath" "$jarUrl" -f
else
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Falling back to using Java to download"
fi
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
# For Cygwin, switch paths to Windows format before running javac
if $cygwin; then
javaClass=`cygpath --path --windows "$javaClass"`
fi
if [ -e "$javaClass" ]; then
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Compiling MavenWrapperDownloader.java ..."
fi
# Compiling the Java class
("$JAVA_HOME/bin/javac" "$javaClass")
fi
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
# Running the downloader
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Running MavenWrapperDownloader.java ..."
fi
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
fi
fi
fi
fi
##########################################################################################
# End of extension
##########################################################################################
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
if [ "$MVNW_VERBOSE" = true ]; then
echo $MAVEN_PROJECTBASEDIR
fi
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --path --windows "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi
# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
export MAVEN_CMD_LINE_ARGS
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
exec "$JAVACMD" \
$MAVEN_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

182
mvnw.cmd vendored Normal file
View File

@@ -0,0 +1,182 @@
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. 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,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
if "%MVNW_VERBOSE%" == "true" (
echo Found %WRAPPER_JAR%
)
) else (
if not "%MVNW_REPOURL%" == "" (
SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
)
if "%MVNW_VERBOSE%" == "true" (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %DOWNLOAD_URL%
)
powershell -Command "&{"^
"$webclient = new-object System.Net.WebClient;"^
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
"}"^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
"}"
if "%MVNW_VERBOSE%" == "true" (
echo Finished downloading %WRAPPER_JAR%
)
)
@REM End of extension
@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
exit /B %ERROR_CODE%

138
pom.xml Normal file
View File

@@ -0,0 +1,138 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>kr.co</groupId>
<artifactId>kr</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>kr</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<version>2.2.2.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis-spring -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>2.0.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc -->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>7.4.1.jre8</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.2.2.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<!-- VO, DTO 의 getter setter toString 자동 생성 -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.36</version>
<scope>provided</scope>
</dependency>
<!-- log4jdbc -->
<dependency>
<groupId>org.bgee.log4jdbc-log4j2</groupId>
<artifactId>log4jdbc-log4j2-jdbc4.1</artifactId>
<version>1.16</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.0.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.3.5.RELEASE</version>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,19 @@
package kr.co.kr;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
@SpringBootApplication
public class KrApplication extends ServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application){
return application.sources(KrApplication.class);
}
public static void main(String[] args) {
SpringApplication.run(KrApplication.class, args);
}
}

View File

@@ -0,0 +1,23 @@
package kr.co.kr;
import javax.servlet.http.HttpSessionListener;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import kr.co.kr.config.SessionListener;
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(KrApplication.class);
}
@Bean
public HttpSessionListener httpSessionListener(){
return new SessionListener();
}
}

View File

@@ -0,0 +1,36 @@
package kr.co.kr.config;
import java.io.IOException;
import java.net.URLEncoder;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.authentication.AuthenticationCredentialsNotFoundException;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.InternalAuthenticationServiceException;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
public class CustomAuthFailureHandler extends SimpleUrlAuthenticationFailureHandler {
@Override
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response,
AuthenticationException exception) throws IOException, ServletException {
String errorMessage;
if (exception instanceof BadCredentialsException) {
errorMessage = "아이디 또는 비밀번호가 맞지 않습니다. 다시 확인해 주세요.";
} else if (exception instanceof InternalAuthenticationServiceException) {
errorMessage = "내부적으로 발생한 시스템 문제로 인해 요청을 처리할 수 없습니다. 관리자에게 문의하세요.";
} else if (exception instanceof UsernameNotFoundException) {
errorMessage = "계정이 존재하지 않습니다. 회원가입 진행 후 로그인 해주세요.";
} else if (exception instanceof AuthenticationCredentialsNotFoundException) {
errorMessage = "인증 요청이 거부되었습니다. 관리자에게 문의하세요.";
} else {
errorMessage = "알 수 없는 이유로 로그인에 실패하였습니다 관리자에게 문의하세요.";
}
setDefaultFailureUrl("/login?error=true&exception="+URLEncoder.encode(errorMessage, "UTF-8"));
super.onAuthenticationFailure(request, response, exception);
}
}

View File

@@ -0,0 +1,35 @@
package kr.co.kr.config;
import javax.sql.DataSource;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration
@MapperScan(basePackages="kr.co.kr.dao")
@EnableTransactionManagement
public class DataBaseConfig {
@Bean
public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception {
final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
sessionFactory.setDataSource(dataSource);
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
sessionFactory.setMapperLocations(resolver.getResources("mapper/*.xml"));
return sessionFactory.getObject();
}
@Bean
public SqlSessionTemplate sqlSessionTemplate(SqlSessionFactory sqlSessionFactory) throws Exception {
final SqlSessionTemplate sqlSessionTemplate = new SqlSessionTemplate(sqlSessionFactory);
return sqlSessionTemplate;
}
}

View File

@@ -0,0 +1,91 @@
package kr.co.kr.config;
import org.springframework.context.annotation.Bean;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
/* 로그인 실패 핸들러 의존성 주입 */
@Bean
public AuthenticationFailureHandler customFailureHandler(){
return new CustomAuthFailureHandler();
}
@Override
protected void configure(HttpSecurity http) throws Exception {
// http.authorizeRequests().antMatchers("/**").permitAll();
// http.authorizeRequests()
// .antMatchers("/**").hasRole("ADMIN")
// .antMatchers("/").permitAll() // 넓은 범위의 URL을 아래에 배치한다.
// .anyRequest().authenticated()
// .and()
// .formLogin().loginPage("/login").failureUrl("/login?error").permitAll()
// .defaultSuccessUrl("/main")
// .and()
// .logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
// .addLogoutHandler(new TaskImplementingLogoutHandler()).permitAll().logoutSuccessUrl("/");
// 로그아웃 기본 url은 (/logout)
// 새로 설정하려면 .logoutUrl("url") 사용
http.authorizeRequests()
.antMatchers("/login","/resources/**").permitAll() // 넓은 범위의 URL을 아래에 배치한다.
.antMatchers("/**").hasRole("ADMIN")
.anyRequest().authenticated()
.and()
.formLogin().loginPage("/login").failureHandler(customFailureHandler()).defaultSuccessUrl("/")
// formLogin: 다른 옵션 설정이 없는 경우 시큐리티가 제공하는 기본 로그인 form 페이지 사용
.and()
.logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
.logoutSuccessUrl("/login")
.and()
.csrf().disable();
// 로그아웃 기본 url은 (/logout)
// 새로 설정하려면 .logoutUrl("url") 사용
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication()
.withUser("admin")
.password(passwordEncoder().encode("it#51304"))
.roles("ADMIN");
auth.inMemoryAuthentication()
.withUser("test")
.password(passwordEncoder().encode("test"))
.roles("ADMIN");
auth.inMemoryAuthentication()
.withUser("shwon@kric.com")
.password(passwordEncoder().encode("shwon4810@"))
.roles("ADMIN");
auth.inMemoryAuthentication()
.withUser("user3415")
.password(passwordEncoder().encode("kri#3415"))
.roles("ADMIN");
}
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring()
.antMatchers("/favicon.ico", "/css/**", "/image/**", "/js/**");
}
// passwordEncoder() 추가
@Bean
public BCryptPasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
}

View File

@@ -0,0 +1,19 @@
package kr.co.kr.config;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
import org.springframework.beans.factory.annotation.Value;
public class SessionListener implements HttpSessionListener{
@Value("${server.servlet.session.timeout}")
private int sessionTime;
public void sessionCreated(HttpSessionEvent se){
se.getSession().setMaxInactiveInterval(sessionTime);
}
public void sessionDestroyed(HttpSessionEvent se){
}
}

View File

@@ -0,0 +1,18 @@
package kr.co.kr.config;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.logout.LogoutHandler;
public class TaskImplementingLogoutHandler implements LogoutHandler {
Logger logger = LoggerFactory.getLogger(TaskImplementingLogoutHandler.class);
@Override
public void logout(HttpServletRequest req, HttpServletResponse res,
Authentication authentication) {
logger.info("로그아웃 되었습니다.");
}
}

View File

@@ -0,0 +1,183 @@
package kr.co.kr.controller;
import kr.co.kr.dao.AnalysisDao;
import kr.co.kr.module.ExcelCreateModule;
import kr.co.kr.vo.AnalysisVo;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.Principal;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.InputStreamResource;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping("/analysis")
public class AnalysisController{
@Autowired
AnalysisDao analDao;
HashMap<String, Object> resMap = new HashMap<String, Object>();
private static final Logger logger = LoggerFactory.getLogger(AnalysisController.class);
@RequestMapping(value = {"", "/"}, method = { RequestMethod.GET , RequestMethod.POST})
public String analysis(HttpServletRequest request, HttpServletResponse response, Model model, Locale Locale)
throws Exception{
return "contents/analysis";
}
@ResponseBody
@RequestMapping(value = "/getArea", method = RequestMethod.POST)
public List<AnalysisVo> getArea() throws Exception{
List<AnalysisVo> areaList = analDao.getArea();
return areaList;
}
@ResponseBody
@RequestMapping(value = "/getTimeBand", method = RequestMethod.POST)
public List<AnalysisVo> getTimeBand() throws Exception{
List<AnalysisVo> timeBandList = analDao.getTimeBand();
return timeBandList;
}
@ResponseBody
@RequestMapping(value = "/getOption", method = RequestMethod.POST)
public List<List<AnalysisVo>> getOption() throws Exception{
List<List<AnalysisVo>> optionList = analDao.getOption();
return optionList;
}
@ResponseBody
@RequestMapping(value = "/getWeight", method = RequestMethod.POST)
public List<AnalysisVo> getWeight() throws Exception{
List<AnalysisVo> weightList = analDao.getWeight();
return weightList;
}
@ResponseBody
@RequestMapping(value = "/getOutputData", method = RequestMethod.POST)
public List<List<AnalysisVo>> getOutputData(@RequestBody AnalysisVo vo) throws Exception{
resMap.put("time", vo.getSearch_time());
resMap.put("time_band", vo.getTime_band());
List<AnalysisVo> areaList = analDao.getArea();
List<AnalysisVo> weightList = analDao.getWeight();
List<List<AnalysisVo>> optionList = analDao.getOption();
List<List<AnalysisVo>> getOutputData = analDao.getOutputData(vo);
resMap.put("area", areaList);
resMap.put("weight", weightList);
resMap.put("option", optionList);
resMap.put("output", getOutputData);
return getOutputData;
}
@ResponseBody
@RequestMapping(value = "/optionSave", method = RequestMethod.POST)
public void optionSave(@RequestBody AnalysisVo vo) throws Exception{
analDao.optionSave(vo);
}
@ResponseBody
@RequestMapping(value = "/getLastReport", method = RequestMethod.POST)
public List<AnalysisVo> getLastReport(@RequestBody AnalysisVo vo) throws Exception{
List<AnalysisVo> lastReport = analDao.getLastReport(vo);
List<List<AnalysisVo>> tmpOutputData = (List<List<AnalysisVo>>) resMap.get("output");
tmpOutputData.set(3, lastReport);
resMap.replace("output", tmpOutputData);
return lastReport;
}
@ResponseBody
@RequestMapping(value = "/getTimeReport", method = RequestMethod.POST)
public List<AnalysisVo> getTimeReport(@RequestBody AnalysisVo vo) throws Exception{
List<AnalysisVo> timeReport = analDao.getTimeReport(vo);
List<List<AnalysisVo>> tmpOutputData = (List<List<AnalysisVo>>) resMap.get("output");
tmpOutputData.set(5, timeReport);
resMap.replace("output", tmpOutputData);
return timeReport;
}
@ResponseBody
@RequestMapping(value = "/excelDownload", method = {RequestMethod.POST, RequestMethod.GET})
public ResponseEntity<Resource> excelDownload(HttpServletRequest request) throws IOException {
logger.info(System.getProperty("user.dir"));
StringBuffer urlPath = request.getRequestURL();
String url = urlPath.substring(urlPath.indexOf("//") + 2);
String server;
if(url.substring(0,8).equals("10.10.10")){server="real";}
else{server="local";}
ExcelCreateModule ecm = new ExcelCreateModule();
String fileName = ecm.createExcel(resMap, server);
Path path;
if(server.equals("local")){
path =Paths.get("C:/Users/Administrator/Desktop/선거_test/excel_path/" + fileName + ".xlsx");
}else{
path =Paths.get("C:/Users/Administrator/Desktop/선거_test/excel_path/" + fileName + ".xlsx");
}
String contentType = Files.probeContentType(path);
HttpHeaders headers = new HttpHeaders();
headers.add(HttpHeaders.CONTENT_TYPE, contentType);
headers.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + ".xlsx");
Resource resource = new InputStreamResource(Files.newInputStream(path));
return new ResponseEntity<>(resource, headers, HttpStatus.OK);
}
@ResponseBody
@RequestMapping(value = "/insertHtml", method = RequestMethod.POST)
public void insertHtml(@RequestBody AnalysisVo vo, Principal principal) throws Exception{
vo.setInsert_user(principal.getName());
analDao.insertHtml(vo);
}
@ResponseBody
@RequestMapping(value = "/historyDate", method = RequestMethod.POST)
public List<AnalysisVo> historyDate() throws Exception{
List<AnalysisVo> historyDate = analDao.historyDate();
return historyDate;
}
@ResponseBody
@RequestMapping(value = "/historyHtml", method = RequestMethod.POST)
public List<AnalysisVo> historyHtml(@RequestBody AnalysisVo vo) throws Exception{
List<AnalysisVo> historyHtml = analDao.historyHtml(vo);
return historyHtml;
}
@ResponseBody
@RequestMapping(value = "/deleteHistory", method = RequestMethod.POST)
public void deleteHistory(@RequestBody AnalysisVo vo) throws Exception{
analDao.deleteHistory(vo);
}
}

View File

@@ -0,0 +1,60 @@
package kr.co.kr.controller;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import kr.co.kr.dao.MainDao;
import kr.co.kr.module.MethodModule;
import kr.co.kr.vo.MainVo;
@Controller
@RequestMapping("/")
public class MainController{
@Autowired
MainDao mainDao;
MethodModule func = new MethodModule();
@RequestMapping(value = "/" , method = { RequestMethod.GET , RequestMethod.POST})
// @ResponseBody
public String main(HttpServletRequest request, HttpServletResponse response, Model model, Locale Locale)
throws Exception{
MainVo vo = mainDao.getCount();
System.out.println(vo);
model.addAttribute("mv", vo);
return "contents/main";
}
@RequestMapping(value = "/login", method = { RequestMethod.GET , RequestMethod.POST})
public String login(@RequestParam(value = "error", required = false)String error,
@RequestParam(value = "exception", required = false)String exception, Model model, Locale Locale) throws Exception{
model.addAttribute("error", error);
model.addAttribute("exception", exception);
return "login";
}
@RequestMapping(value = "/history" , method = { RequestMethod.GET , RequestMethod.POST})
// @ResponseBody
public String history(HttpServletRequest request, HttpServletResponse response, Model model, Locale Locale)
throws Exception{
return "contents/history";
}
}

View File

@@ -0,0 +1,86 @@
package kr.co.kr.controller;
import java.util.List;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import kr.co.kr.dao.AnalysisDao;
import kr.co.kr.module.MethodModule;
import kr.co.kr.vo.AnalysisVo;
@Controller
@RequestMapping("/percentage")
public class PercentageController{
@Autowired
AnalysisDao analDao;
MethodModule func = new MethodModule();
@RequestMapping(value = {"", "/"}, method = { RequestMethod.GET , RequestMethod.POST})
public String percentage(HttpServletRequest request, HttpServletResponse response, Model model, Locale Locale)
throws Exception{
return "contents/percentage";
}
@ResponseBody
@RequestMapping(value = "/getOutputFinalData", method = RequestMethod.POST)
public List<AnalysisVo> getOutputFinalData(@RequestBody AnalysisVo vo) throws Exception{
//데이터의 존재유무 확인
if(analDao.getOutputFinalDataCnt(vo) == 0){
analDao.putOutputFinalData(vo);
}
List<AnalysisVo> getOutputFinalData = analDao.getOutputFinalData(vo);
return getOutputFinalData;
}
@ResponseBody
@RequestMapping(value="/editOutputFinalData", method=RequestMethod.POST)
public void editOutputFinalData(@RequestBody AnalysisVo vo) throws Exception {
analDao.editOutputFinalData(vo);
}
@ResponseBody
@RequestMapping(value = "/dataInitialization", method = RequestMethod.POST)
public void dataInitialization(@RequestBody AnalysisVo vo) throws Exception{
analDao.dataInitialization(vo);
analDao.putOutputFinalData(vo);
}
@ResponseBody
@RequestMapping(value = "/optionCompare", method = RequestMethod.POST)
public List<AnalysisVo> optionCompare(@RequestBody AnalysisVo vo) throws Exception{
List<AnalysisVo> optionCompare = analDao.optionCompare(vo);
return optionCompare;
}
@ResponseBody
@RequestMapping(value = "/editOptionCommitFinalData", method = RequestMethod.POST)
public void editOptionCommitFinalData(@RequestBody AnalysisVo vo) throws Exception{
analDao.editOptionCommitFinalData(vo);
}
@ResponseBody
@RequestMapping(value = "/editOptionRollback", method = RequestMethod.POST)
public void editOptionRollback(@RequestBody AnalysisVo vo) throws Exception{
analDao.editOptionRollback(vo);
}
}

View File

@@ -0,0 +1,106 @@
package kr.co.kr.controller;
import java.lang.reflect.Array;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import kr.co.kr.dao.TransmissionDao;
import kr.co.kr.module.MethodModule;
import kr.co.kr.vo.TransmissionVo;
@Controller
@RequestMapping("/transmission")
public class TransmissionController{
@Autowired
TransmissionDao tranDao;
MethodModule func = new MethodModule();
@RequestMapping(value = {"", "/"}, method = { RequestMethod.GET , RequestMethod.POST})
public String transmission(HttpServletRequest request, HttpServletResponse response, Model model, Locale Locale)
throws Exception{
return "contents/transmission";
}
@ResponseBody
@RequestMapping(value = "/TranFile_1", method = RequestMethod.POST)
public List<TransmissionVo> TranFile_1() throws Exception{
/* 후보자별 득표율 */
HashMap<String, Object> map = new HashMap<String, Object>();
List<String> candArray = new ArrayList<>(Arrays.asList("01","02","03","06","07","08","09","10","11"));
map.put("candArray",candArray);
List<TransmissionVo> TranDataList = tranDao.TranFile_1(map);
return TranDataList;
}
@ResponseBody
@RequestMapping(value = "/TranFile_2", method = RequestMethod.POST)
public List<TransmissionVo> TranFile_2() throws Exception{
/* 비례정당 득표율 */
HashMap<String, Object> map = new HashMap<String, Object>();
List<String> partyArray = new ArrayList<>(Arrays.asList("01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41"));
map.put("partyArray",partyArray);
List<TransmissionVo> TranDataList = tranDao.TranFile_2(map);
return TranDataList;
}
@ResponseBody
@RequestMapping(value = "/TranFile_3", method = RequestMethod.POST)
public List<TransmissionVo> TranFile_3() throws Exception{
/* 무응답률 */
HashMap<String, Object> map = new HashMap<String, Object>();
List<TransmissionVo> TranDataList = tranDao.TranFile_3(map);
return TranDataList;
}
@ResponseBody
@RequestMapping(value = "/TranFile_4", method = RequestMethod.POST)
public List<TransmissionVo> TranFile_4() throws Exception{
/* 무응답률 */
HashMap<String, Object> map = new HashMap<String, Object>();
List<TransmissionVo> TranDataList = tranDao.TranFile_4(map);
return TranDataList;
}
@ResponseBody
@RequestMapping(value = "/TranFile_5", method = RequestMethod.POST)
public List<TransmissionVo> TranFile_5() throws Exception{
/* 무응답률 */
HashMap<String, Object> map = new HashMap<String, Object>();
List<TransmissionVo> TranDataList = tranDao.TranFile_5(map);
return TranDataList;
}
@ResponseBody
@RequestMapping(value = "/TranFile_6", method = RequestMethod.POST)
public List<TransmissionVo> TranFile_6() throws Exception{
/* 무응답률 */
HashMap<String, Object> map = new HashMap<String, Object>();
List<TransmissionVo> TranDataList = tranDao.TranFile_6(map);
return TranDataList;
}
@ResponseBody
@RequestMapping(value = "/TranFile_10", method = RequestMethod.POST)
public List<TransmissionVo> TranFile_10() throws Exception{
/* 무응답률 */
HashMap<String, Object> map = new HashMap<String, Object>();
List<TransmissionVo> TranDataList = tranDao.TranFile_10(map);
return TranDataList;
}
}

View File

@@ -0,0 +1,32 @@
package kr.co.kr.controller.common;
import javax.servlet.RequestDispatcher;
import javax.servlet.http.HttpServletRequest;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class ErrorPageController implements ErrorController{
@RequestMapping("/error")
public String handleError(HttpServletRequest request){
Object status = request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE);
if(status != null){
Integer statusCode = Integer.valueOf(status.toString());
if(statusCode == HttpStatus.NOT_FOUND.value()){
return "error/404";
}else if(statusCode == HttpStatus.INTERNAL_SERVER_ERROR.value()){
return "error/500";
}
}
return "error/404";
}
@Override
public String getErrorPath(){
return "/error";
}
}

View File

@@ -0,0 +1,31 @@
package kr.co.kr.dao;
import java.util.List;
import kr.co.kr.vo.AnalysisVo;
public interface AnalysisDao{
public List<AnalysisVo> getArea() throws Exception;
public List<AnalysisVo> getTimeBand() throws Exception;
public List<List<AnalysisVo>> getOutputData(AnalysisVo vo) throws Exception;
public List<AnalysisVo> getLastReport() throws Exception;
public List<AnalysisVo> getWeight() throws Exception;
public List<List<AnalysisVo>> getOption() throws Exception;
public void optionSave(AnalysisVo vo) throws Exception;
public int getOutputFinalDataCnt(AnalysisVo vo) throws Exception;
public void putOutputFinalData(AnalysisVo vo) throws Exception;
public List<AnalysisVo> getOutputFinalData(AnalysisVo vo) throws Exception;
public void editOutputFinalData(AnalysisVo vo) throws Exception;
public void dataInitialization(AnalysisVo vo) throws Exception;
public List<AnalysisVo> optionCompare(AnalysisVo vo) throws Exception;
public void editOptionCommitFinalData(AnalysisVo vo) throws Exception;
public void editOptionRollback(AnalysisVo vo) throws Exception;
public List<List<AnalysisVo>> getTransmissionData() throws Exception;
public List<AnalysisVo> getLastReport(AnalysisVo vo);
public List<AnalysisVo> getTimeReport(AnalysisVo vo) throws Exception;
public void insertHtml(AnalysisVo vo);
public List<AnalysisVo> historyDate() throws Exception;
public List<AnalysisVo> historyHtml(AnalysisVo vo) throws Exception;
public void deleteHistory(AnalysisVo vo);
}

View File

@@ -0,0 +1,8 @@
package kr.co.kr.dao;
import kr.co.kr.vo.MainVo;
public interface MainDao{
public MainVo getCount() throws Exception;
}

View File

@@ -0,0 +1,18 @@
package kr.co.kr.dao;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import kr.co.kr.vo.TransmissionVo;
public interface TransmissionDao{
public List<TransmissionVo> TranFile_1(HashMap<String, Object> map) throws Exception;
public List<TransmissionVo> TranFile_2(HashMap<String, Object> map) throws Exception;
public List<TransmissionVo> TranFile_3(HashMap<String, Object> map) throws Exception;
public List<TransmissionVo> TranFile_4(HashMap<String, Object> map) throws Exception;
public List<TransmissionVo> TranFile_5(HashMap<String, Object> map) throws Exception;
public List<TransmissionVo> TranFile_6(HashMap<String, Object> map) throws Exception;
public List<TransmissionVo> TranFile_10(HashMap<String, Object> map) throws Exception;
}

View File

@@ -0,0 +1,599 @@
package kr.co.kr.module;
import java.util.ArrayList;
import java.util.Comparator;
import java.awt.Color;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.microsoft.sqlserver.jdbc.StringUtils;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFDataFormat;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import kr.co.kr.vo.AnalysisVo;
public class ExcelCreateModule {
private Workbook workbook = new XSSFWorkbook();
CellStyle styleCaption = workbook.createCellStyle();
CellStyle styleContents = workbook.createCellStyle();
CellStyle styleContents2str = workbook.createCellStyle();
CellStyle styleContents2rate = workbook.createCellStyle();
CellStyle styleContentHeader = workbook.createCellStyle();
CellStyle styleContentsTDash = workbook.createCellStyle();
CellStyle styleContentsSubSum = workbook.createCellStyle();
CellStyle styleContentsSubSumTDash = workbook.createCellStyle();
CellStyle styleContentsTotSum = workbook.createCellStyle();
CellStyle styleContentsTotSumTDash = workbook.createCellStyle();
CellStyle styleFooter = workbook.createCellStyle();
private Sheet sheet = null;
int rowN = 0;
ObjectMapper mapper = new ObjectMapper();
public String createExcel(HashMap<String, Object> paramResMap,String server) throws IOException {
String areaRangeLabel = "전체선거구";
Font defaultFont = workbook.createFont();
defaultFont.setFontHeightInPoints((short)9);
defaultFont.setFontName("굴림");
XSSFDataFormat df = (XSSFDataFormat) workbook.createDataFormat();
styleCaption.setFont(defaultFont);
styleContents.setAlignment(HorizontalAlignment.LEFT);
styleCaption.setVerticalAlignment(VerticalAlignment.CENTER);
styleContents.setAlignment(HorizontalAlignment.CENTER);
styleContents.setVerticalAlignment(VerticalAlignment.CENTER);
styleContents.setBorderTop(BorderStyle.THIN);
styleContents.setBorderLeft(BorderStyle.THIN);
styleContents.setBorderRight(BorderStyle.THIN);
styleContents.setFont(defaultFont);
styleContents2str.cloneStyleFrom(styleContents);
styleContents2str.setBorderBottom(BorderStyle.THIN);
styleContents2rate.cloneStyleFrom(styleContents);
styleContents2rate.setBorderBottom(BorderStyle.THIN);
styleContents2rate.setDataFormat(df.getFormat("0.0%"));
styleContentHeader.cloneStyleFrom(styleContents);
styleContentHeader.setWrapText(true);
styleContentHeader.setFillForegroundColor(IndexedColors.LIGHT_TURQUOISE.getIndex());
styleContentHeader.setFillPattern(FillPatternType.SOLID_FOREGROUND);
styleContentsTDash.cloneStyleFrom(styleContents);
styleContentsTDash.setBorderTop(BorderStyle.DOTTED);
styleContentsTDash.setBorderBottom(BorderStyle.THIN);
styleContentsTDash.setDataFormat(df.getFormat("0.0%"));
styleContentsSubSum.cloneStyleFrom(styleContents);
styleContentsSubSumTDash.cloneStyleFrom(styleContentsTDash);
styleContentsSubSum.setFillForegroundColor(IndexedColors.LEMON_CHIFFON.getIndex());
styleContentsSubSum.setFillPattern(FillPatternType.SOLID_FOREGROUND);
styleContentsSubSumTDash.setFillForegroundColor(IndexedColors.LEMON_CHIFFON.getIndex());
styleContentsSubSumTDash.setFillPattern(FillPatternType.SOLID_FOREGROUND);
styleContentsTotSum.cloneStyleFrom(styleContents);
styleContentsTotSumTDash.cloneStyleFrom(styleContentsTDash);
styleContentsTotSum.setFillForegroundColor(IndexedColors.TAN.getIndex());
styleContentsTotSum.setFillPattern(FillPatternType.SOLID_FOREGROUND);
styleContentsTotSumTDash.setFillForegroundColor(IndexedColors.TAN.getIndex());
styleContentsTotSumTDash.setFillPattern(FillPatternType.SOLID_FOREGROUND);
styleFooter.cloneStyleFrom(styleContents2str);
styleFooter.setFillForegroundColor(IndexedColors.LEMON_CHIFFON.getIndex());
styleFooter.setFillPattern(FillPatternType.SOLID_FOREGROUND);
String time_band = (String) paramResMap.get("time_band");
List<AnalysisVo> areaList = (List<AnalysisVo>) paramResMap.get("area");
List<AnalysisVo> weightList = (List<AnalysisVo>) paramResMap.get("weight");
List<List<AnalysisVo>> optionList = (List<List<AnalysisVo>>) paramResMap.get("option");
List<List<AnalysisVo>> outputList = (List<List<AnalysisVo>>) paramResMap.get("output");
if (outputList == null || outputList.size() < 4) return "outputList_empty";
if (areaList == null || areaList.isEmpty()) return "areaList_empty";
if (weightList == null || weightList.isEmpty()) return "weightList_empty";
if (optionList == null || optionList.size() < 2) return "optionList_empty";
List<Map<String, String>> candList = new ArrayList<Map<String, String>>();
List<String> tmpList = new ArrayList<String>(); //중복제거용
for(AnalysisVo av : outputList.get(0)){
Map<String, String> tmpMap = new HashMap<String, String>();
tmpMap.put("area_cd", av.getArea_cd());
tmpMap.put("cand_party_cd", av.getCand_party_cd());
tmpMap.put("cand_nm", StringUtils.isEmpty(av.getCand_nm()) ? "" : av.getCand_nm());
tmpMap.put("party_nm", av.getParty_nm());
tmpList.add(mapper.writeValueAsString(tmpMap));
}
for(String tmpStr : MethodModule.deDup1((ArrayList<String>) tmpList)){
candList.add(mapper.readValue(tmpStr, Map.class));
}
if(candList.stream().filter(obj -> obj.get("cand_party_cd").equals("999")).collect(Collectors.toList()).size() == 1){
areaList.retainAll(areaList.stream().filter(obj -> obj.getArea_cd().equals(outputList.get(2).get(0).getArea_cd())).collect(Collectors.toList()));
areaRangeLabel = areaList.get(0).getArea_cd() + "-" + areaList.get(0).getArea_nm();
} // 개별 선거구 선택 시
for(AnalysisVo av : areaList){
createSheet(av.getArea_nm() + "(" + av.getArea_cd() + ")");
sheet = (XSSFSheet) workbook.getSheet(av.getArea_nm() + "(" + av.getArea_cd() + ")");
rowN = 0;
Cell topCell = sheet.createRow(rowN).createCell(0);
topCell.setCellValue("코드 및 선거구명 : " + av.getArea_cd() + " " + av.getSido_nm() + " " + av.getArea_nm());
topCell.setCellStyle(styleCaption);
report_1(outputList.get(0).stream().filter(obj -> obj.getArea_cd().equals(av.getArea_cd())).collect(Collectors.toList()), /* 해당 선거구 보고서1 data */
candList.stream().filter(obj -> obj.get("area_cd").equals(av.getArea_cd())).collect(Collectors.toList())); /* 해당 선거구 후보 목록 */
report_2(outputList.get(1).stream().filter(obj -> obj.getArea_cd().equals(av.getArea_cd())).collect(Collectors.toList()), /* 해당 선거구 보고서2 data */
candList.stream().filter(obj -> obj.get("area_cd").equals(av.getArea_cd())).collect(Collectors.toList())); /* 해당 선거구 후보 목록 */
report_3(outputList.get(2).stream().filter(obj -> obj.getArea_cd().equals(av.getArea_cd())).collect(Collectors.toList()), /* 해당 선거구 보고서3 data */
candList.stream().filter(obj -> obj.get("area_cd").equals(av.getArea_cd())).collect(Collectors.toList()), /* 해당 선거구 후보 목록 */
weightList.stream().filter(obj -> obj.getArea_cd().equals(av.getArea_cd())).collect(Collectors.toList()), /* 해당 선거구 가중치 data */
time_band); /* 입력시간대 */
report_4(outputList.get(3).stream().filter(obj -> obj.getArea_cd().equals(av.getArea_cd())).collect(Collectors.toList()), /* 해당 선거구 보고서4 data */
candList.stream().filter(obj -> obj.get("area_cd").equals(av.getArea_cd())).collect(Collectors.toList()), /* 해당 선거구 후보 목록 */
optionList.get(0), optionList.get(1).stream().filter(obj -> obj.getArea_cd().equals(av.getArea_cd())).collect(Collectors.toList())); /* 옵션 List */
}
String candParty = outputList.get(3).get(0).getCand_party().equals("CAND") ? "지역구" : "비례대표";
String outputFileName = candParty + "_" + areaRangeLabel + "_" + paramResMap.get("time");
FileOutputStream fileOut;
if(server.equals("local")){
fileOut = new FileOutputStream("src/main/webapp/resources/excel/" + outputFileName + ".xlsx");
}else{
fileOut = new FileOutputStream("C:/Users/Administrator/Desktop/_test/excel_path/" + outputFileName + ".xlsx");
}
workbook.write(fileOut);
fileOut.close();
workbook.close();
return outputFileName;
}
private static float safeParseFloat(String v) {
if (v == null) return 0f;
v = v.trim();
// 숫자만 남기고 나머지 제거 (예: "58.1", " 58.1%", "\"58.1\"")
if (!v.matches("^-?\\d+(\\.\\d+)?$")) return 0f;
return Float.parseFloat(v);
}
private void createSheet(String shtNm) {
workbook.createSheet(shtNm);
}
private void report_1(List<AnalysisVo> dataList, List<Map<String, String>> candList) {
rowN++;
Cell reportTopCell = sheet.createRow(rowN).createCell(0);
reportTopCell.setCellValue("보고서 1 : 투표구별 자료");
reportTopCell.setCellStyle(styleCaption);
List<String> clusterList = MethodModule.deDup1((ArrayList<String>) dataList.stream().map(vo -> vo.getCluster()).collect(Collectors.toList()));
rowN++;
Row headerRow = sheet.createRow(rowN);
headerRow.setHeightInPoints(23);
headerRow.createCell(0).setCellValue("투표구코드");
headerRow.getCell(0).setCellStyle(styleContentHeader);
headerRow.createCell(1).setCellValue("투표구명");
headerRow.getCell(1).setCellStyle(styleContentHeader);
int cpCellN = 0;
candList.sort(Comparator.comparing(m -> Integer.parseInt(m.get("cand_party_cd"))));
for(Map<String, String> areaCand : candList){
String headerStr = areaCand.get("cand_nm").equals("무응답") ? areaCand.get("cand_nm") : areaCand.get("party_nm") + "\r\n" + areaCand.get("cand_nm");
headerRow.createCell(cpCellN + 2).setCellValue(headerStr);
headerRow.getCell(cpCellN + 2).setCellStyle(styleContentHeader);
cpCellN++;
}
headerRow.createCell(cpCellN + 2).setCellValue("계");
headerRow.getCell(cpCellN + 2).setCellStyle(styleContentHeader);
int maxCellN = cpCellN + 2; // 끝 Cell Number
for(int i=0; i<=maxCellN; i++){
sheet.setColumnWidth(i, (short)4000);
}
for(String cluster : clusterList){
List<AnalysisVo> clusterDataList = dataList.stream().filter(vo -> vo.getCluster().equals(cluster)).collect(Collectors.toList());
List<String> subAreaList = MethodModule.deDup1((ArrayList<String>) clusterDataList.stream().map(vo -> vo.getSubarea_cd()).collect(Collectors.toList()));
for(String subareaCd : subAreaList){
List<AnalysisVo> subareaDataList = clusterDataList.stream().filter(vo -> vo.getSubarea_cd().equals(subareaCd)).collect(Collectors.toList());
rowN++;
Row contentsCntRow = sheet.createRow(rowN);
contentsCntRow.createCell(0).setCellValue(subareaCd);
contentsCntRow.getCell(0).setCellStyle(styleContents);
contentsCntRow.createCell(1).setCellValue(subareaDataList.get(0).getSubarea_nm());
contentsCntRow.getCell(1).setCellStyle(styleContents);
cpCellN = 0;
int tmpSumColCnt = 0;
for(Map<String, String> areaCand : candList){
int pollCnt = Integer.parseInt(subareaDataList.stream().filter(vo -> vo.getCand_party_cd().equals(areaCand.get("cand_party_cd"))).collect(Collectors.toList()).get(0).getCnt());
contentsCntRow.createCell(cpCellN + 2).setCellValue(pollCnt);
tmpSumColCnt += pollCnt;
contentsCntRow.getCell(cpCellN + 2).setCellStyle(styleContents);
cpCellN++;
}
contentsCntRow.createCell(cpCellN + 2).setCellValue(tmpSumColCnt);
contentsCntRow.getCell(cpCellN + 2).setCellStyle(styleContents);
rowN++;
Row contentsRateRow = sheet.createRow(rowN);
contentsRateRow.createCell(0).setCellValue("");
contentsRateRow.getCell(0).setCellStyle(styleContentsTDash);
contentsRateRow.createCell(1).setCellValue("");
contentsRateRow.getCell(1).setCellStyle(styleContentsTDash);
cpCellN = 0;
float tmpSumColRate = 0;
for(Map<String, String> areaCand : candList){
int pollCnt = Integer.parseInt(subareaDataList.stream().filter(vo -> vo.getCand_party_cd().equals(areaCand.get("cand_party_cd"))).collect(Collectors.toList()).get(0).getCnt());
float pollRate = (float) (Math.round(((float) pollCnt / (float) tmpSumColCnt) * 1000.0) / 1000.0);
contentsRateRow.createCell(cpCellN + 2).setCellValue(pollRate);
tmpSumColRate += pollRate;
contentsRateRow.getCell(cpCellN + 2).setCellStyle(styleContentsTDash);
cpCellN++;
}
contentsRateRow.createCell(cpCellN + 2).setCellValue(tmpSumColRate);
contentsRateRow.getCell(cpCellN + 2).setCellStyle(styleContentsTDash);
}
rowN++;
Row contentsSumCntRow = sheet.createRow(rowN);
contentsSumCntRow.createCell(0).setCellValue(cluster + "층계");
contentsSumCntRow.getCell(0).setCellStyle(styleContentsSubSum);
contentsSumCntRow.createCell(1).setCellValue("");
contentsSumCntRow.getCell(1).setCellStyle(styleContentsSubSum);
cpCellN = 0;
int tmpSubSumColCnt = 0;
for(Map<String, String> areaCand : candList){
int pollCnt = clusterDataList.stream().filter(vo -> vo.getCand_party_cd().equals(areaCand.get("cand_party_cd"))).mapToInt(vo -> Integer.parseInt(vo.getCnt())).sum();
contentsSumCntRow.createCell(cpCellN + 2).setCellValue(pollCnt);
tmpSubSumColCnt += pollCnt;
contentsSumCntRow.getCell(cpCellN + 2).setCellStyle(styleContentsSubSum);
cpCellN++;
}
contentsSumCntRow.createCell(cpCellN + 2).setCellValue(tmpSubSumColCnt);
contentsSumCntRow.getCell(cpCellN + 2).setCellStyle(styleContentsSubSum);
rowN++;
Row contentsSumRateRow = sheet.createRow(rowN);
contentsSumRateRow.createCell(0).setCellValue("");
contentsSumRateRow.getCell(0).setCellStyle(styleContentsSubSumTDash);
contentsSumRateRow.createCell(1).setCellValue("");
contentsSumRateRow.getCell(1).setCellStyle(styleContentsSubSumTDash);
cpCellN = 0;
float tmpSubSumColRate = 0;
for(Map<String, String> areaCand : candList){
int pollCnt = clusterDataList.stream().filter(vo -> vo.getCand_party_cd().equals(areaCand.get("cand_party_cd"))).mapToInt(vo -> Integer.parseInt(vo.getCnt())).sum();
float pollRate = (float) (Math.round(((float) pollCnt / (float) tmpSubSumColCnt) * 1000.0) / 1000.0);
contentsSumRateRow.createCell(cpCellN + 2).setCellValue(pollRate);
tmpSubSumColRate += pollRate;
contentsSumRateRow.getCell(cpCellN + 2).setCellStyle(styleContentsSubSumTDash);
cpCellN++;
}
contentsSumRateRow.createCell(cpCellN + 2).setCellValue(tmpSubSumColRate);
contentsSumRateRow.getCell(cpCellN + 2).setCellStyle(styleContentsSubSumTDash);
}
rowN++;
Row totalSumCntRow = sheet.createRow(rowN);
totalSumCntRow.createCell(0).setCellValue("총계");
totalSumCntRow.getCell(0).setCellStyle(styleContentsTotSum);
totalSumCntRow.createCell(1).setCellValue("");
totalSumCntRow.getCell(1).setCellStyle(styleContentsTotSum);
cpCellN = 0;
int tmpTotSumColCnt = 0;
for(Map<String, String> areaCand : candList){
int pollCnt = dataList.stream().filter(vo -> vo.getCand_party_cd().equals(areaCand.get("cand_party_cd"))).mapToInt(vo -> Integer.parseInt(vo.getCnt())).sum();
totalSumCntRow.createCell(cpCellN + 2).setCellValue(pollCnt);
tmpTotSumColCnt += pollCnt;
totalSumCntRow.getCell(cpCellN + 2).setCellStyle(styleContentsTotSum);
cpCellN++;
}
totalSumCntRow.createCell(cpCellN + 2).setCellValue(tmpTotSumColCnt);
totalSumCntRow.getCell(cpCellN + 2).setCellStyle(styleContentsTotSum);
rowN++;
Row totalSumRateRow = sheet.createRow(rowN);
totalSumRateRow.createCell(0).setCellValue("");
totalSumRateRow.getCell(0).setCellStyle(styleContentsTotSumTDash);
totalSumRateRow.createCell(1).setCellValue("");
totalSumRateRow.getCell(1).setCellStyle(styleContentsTotSumTDash);
cpCellN = 0;
float tmpTotSumColRate = 0;
for(Map<String, String> areaCand : candList){
int pollCnt = dataList.stream().filter(vo -> vo.getCand_party_cd().equals(areaCand.get("cand_party_cd"))).mapToInt(vo -> Integer.parseInt(vo.getCnt())).sum();
float pollRate = (float) (Math.round(((float) pollCnt / (float) tmpTotSumColCnt) * 1000.0) / 1000.0);
totalSumRateRow.createCell(cpCellN + 2).setCellValue(pollRate);
tmpTotSumColRate += pollRate;
totalSumRateRow.getCell(cpCellN + 2).setCellStyle(styleContentsTotSumTDash);
cpCellN++;
}
totalSumRateRow.createCell(cpCellN + 2).setCellValue(tmpTotSumColRate);
totalSumRateRow.getCell(cpCellN + 2).setCellStyle(styleContentsTotSumTDash);
}
private void report_2(List<AnalysisVo> dataList, List<Map<String, String>> candList){
rowN++;
rowN++;
Cell reportTopCell = sheet.createRow(rowN).createCell(0);
reportTopCell.setCellValue("보고서 2 : 계층별 자료(득표율)");
reportTopCell.setCellStyle(styleCaption);
List<String> clusterList = MethodModule.deDup1((ArrayList<String>) dataList.stream().map(vo -> vo.getCluster()).collect(Collectors.toList()));
rowN++;
Row headerRow = sheet.createRow(rowN);
headerRow.setHeightInPoints(23);
headerRow.createCell(0).setCellValue("구분");
headerRow.getCell(0).setCellStyle(styleContentHeader);
headerRow.createCell(1).setCellValue("응답자수");
headerRow.getCell(1).setCellStyle(styleContentHeader);
int cpCellN = 0;
candList.sort(Comparator.comparing(m -> Integer.parseInt(m.get("cand_party_cd"))));
for(Map<String, String> areaCand : candList){
String headerStr = areaCand.get("cand_nm").equals("무응답") ? areaCand.get("cand_nm") : areaCand.get("party_nm") + "\r\n" + areaCand.get("cand_nm");
headerRow.createCell(cpCellN + 2).setCellValue(headerStr);
headerRow.getCell(cpCellN + 2).setCellStyle(styleContentHeader);
cpCellN++;
}
headerRow.createCell(cpCellN + 2).setCellValue("계");
headerRow.getCell(cpCellN + 2).setCellStyle(styleContentHeader);
int maxCellN = cpCellN + 2; // 끝 Cell Number
for(int i=0; i<=maxCellN; i++){
sheet.setColumnWidth(i, (short)4000);
}
for(String cluster : clusterList){
List<AnalysisVo> clusterDataList = dataList.stream().filter(vo -> vo.getCluster().equals(cluster)).collect(Collectors.toList());
List<String> sectList = MethodModule.deDup1((ArrayList<String>) clusterDataList.stream().map(vo -> vo.getSect()).collect(Collectors.toList()));
for(String sect : sectList){
List<AnalysisVo> sectDataList = clusterDataList.stream().filter(vo -> vo.getSect().equals(sect)).collect(Collectors.toList());
rowN++;
Row contentsCntRow = sheet.createRow(rowN);
contentsCntRow.createCell(0).setCellValue(sect.substring(3));
contentsCntRow.getCell(0).setCellStyle(styleContents2str);
contentsCntRow.createCell(1).setCellValue("(" + sectDataList.get(0).getSum_cnt().split("\\.")[0] + ")");
contentsCntRow.getCell(1).setCellStyle(styleContents2str);
cpCellN = 0;
float tmpSumColRate = 0;
for(Map<String, String> areaCand : candList){
float pollRate = 0;
if(sectDataList.stream().filter(vo -> vo.getCand_party_cd().equals(areaCand.get("cand_party_cd"))).collect(Collectors.toList()).size() > 0){
pollRate = (float) (Math.round(safeParseFloat(sectDataList.stream().filter(vo -> vo.getCand_party_cd().equals(areaCand.get("cand_party_cd"))).collect(Collectors.toList()).get(0).getRate()) * 10.0) / 1000.0);
}
contentsCntRow.createCell(cpCellN + 2).setCellValue(pollRate);
tmpSumColRate += pollRate;
contentsCntRow.getCell(cpCellN + 2).setCellStyle(styleContents2rate);
cpCellN++;
}
contentsCntRow.createCell(cpCellN + 2).setCellValue(tmpSumColRate);
contentsCntRow.getCell(cpCellN + 2).setCellStyle(styleContents2rate);
if("00|02|09".indexOf(sect.substring(0, 2)) > -1){
rowN++;
}
}
rowN++;
Row clusterRow = sheet.createRow(rowN);
for(int i=0; i<=maxCellN; i++){
if(i == 0){
clusterRow.createCell(i).setCellValue(cluster + "층");
clusterRow.getCell(i).setCellStyle(styleFooter);
}else{
clusterRow.createCell(i).setCellStyle(styleFooter);
}
}
sheet.addMergedRegion(new CellRangeAddress(rowN, rowN, 0, maxCellN));
}
}
private void report_3(List<AnalysisVo> dataList, List<Map<String, String>> candList, List<AnalysisVo> weightList, String time_band) {
rowN++;
rowN++;
Cell reportTopCell = sheet.createRow(rowN).createCell(0);
reportTopCell.setCellValue("보고서 3 : 사전, 당일 투표 등");
reportTopCell.setCellStyle(styleCaption);
rowN++;
Row headerRow = sheet.createRow(rowN);
headerRow.setHeightInPoints(23);
headerRow.createCell(0).setCellValue("구분");
headerRow.getCell(0).setCellStyle(styleContentHeader);
headerRow.createCell(1).setCellValue("가중치값");
headerRow.getCell(1).setCellStyle(styleContentHeader);
int cpCellN = 0;
candList.sort(Comparator.comparing(m -> Integer.parseInt(m.get("cand_party_cd"))));
for(Map<String, String> areaCand : candList){
String headerStr = areaCand.get("cand_nm").equals("무응답") ? areaCand.get("cand_nm") : areaCand.get("party_nm") + "\r\n" + areaCand.get("cand_nm");
headerRow.createCell(cpCellN + 2).setCellValue(headerStr);
headerRow.getCell(cpCellN + 2).setCellStyle(styleContentHeader);
cpCellN++;
}
headerRow.createCell(cpCellN + 2).setCellValue("계");
headerRow.getCell(cpCellN + 2).setCellStyle(styleContentHeader);
rowN++;
Row contentsPreRow = sheet.createRow(rowN);
contentsPreRow.createCell(0).setCellValue("사전투표");
contentsPreRow.getCell(0).setCellStyle(styleContents2str);
contentsPreRow.createCell(1).setCellValue(weightList.get(0).getPoll_pre());
contentsPreRow.getCell(1).setCellStyle(styleContents2str);
cpCellN = 0;
float tmpSumColRate = 0;
for(Map<String, String> areaCand : candList){
if(!areaCand.get("cand_party_cd").equals("999")){
float pollRate = (float) (Math.round(safeParseFloat(dataList.stream().filter(vo -> vo.getCand_party_cd().equals(areaCand.get("cand_party_cd"))).collect(Collectors.toList()).get(0).getPre_rate()) * 10.0) / 1000.0);
contentsPreRow.createCell(cpCellN + 2).setCellValue(pollRate);
tmpSumColRate += pollRate;
contentsPreRow.getCell(cpCellN + 2).setCellStyle(styleContents2rate);
}else{
contentsPreRow.createCell(cpCellN + 2).setCellValue("");
contentsPreRow.getCell(cpCellN + 2).setCellStyle(styleContents2str);
}
cpCellN++;
}
contentsPreRow.createCell(cpCellN + 2).setCellValue(tmpSumColRate);
contentsPreRow.getCell(cpCellN + 2).setCellStyle(styleContents2rate);
rowN++;
Row contents5pRow = sheet.createRow(rowN);
if(!time_band.equals("8")){
contents5pRow.createCell(0).setCellValue("5시이전");
}else{
contents5pRow.createCell(0).setCellValue("당일투표");
}
contents5pRow.getCell(0).setCellStyle(styleContents2str);
if(!time_band.equals("8")){
contents5pRow.createCell(1).setCellValue(weightList.get(0).getPoll_5p());
}else{
contents5pRow.createCell(1).setCellValue(String.valueOf(safeParseFloat(weightList.get(0).getPoll_5p()) + safeParseFloat(weightList.get(0).getPoll_5n())));
}
contents5pRow.getCell(1).setCellStyle(styleContents2str);
cpCellN = 0;
tmpSumColRate = 0;
for(Map<String, String> areaCand : candList){
float pollRate = (float) (Math.round(safeParseFloat(dataList.stream().filter(vo -> vo.getCand_party_cd().equals(areaCand.get("cand_party_cd"))).collect(Collectors.toList()).get(0).getP5p_rate()) * 10.0) / 1000.0);
contents5pRow.createCell(cpCellN + 2).setCellValue(pollRate);
tmpSumColRate += pollRate;
contents5pRow.getCell(cpCellN + 2).setCellStyle(styleContents2rate);
cpCellN++;
}
contents5pRow.createCell(cpCellN + 2).setCellValue(tmpSumColRate);
contents5pRow.getCell(cpCellN + 2).setCellStyle(styleContents2rate);
if(!time_band.equals("8")){
rowN++;
Row contents5nRow = sheet.createRow(rowN);
contents5nRow.createCell(0).setCellValue("5시이후");
contents5nRow.getCell(0).setCellStyle(styleContents2str);
contents5nRow.createCell(1).setCellValue(weightList.get(0).getPoll_5n());
contents5nRow.getCell(1).setCellStyle(styleContents2str);
cpCellN = 0;
tmpSumColRate = 0;
for(Map<String, String> areaCand : candList){
if(!areaCand.get("cand_party_cd").equals("999")){
float pollRate = (float) (Math.round(safeParseFloat(dataList.stream().filter(vo -> vo.getCand_party_cd().equals(areaCand.get("cand_party_cd"))).collect(Collectors.toList()).get(0).getP5n_rate()) * 10.0) / 1000.0);
contents5nRow.createCell(cpCellN + 2).setCellValue(pollRate);
tmpSumColRate += pollRate;
contents5nRow.getCell(cpCellN + 2).setCellStyle(styleContents2rate);
}else{
contents5nRow.createCell(cpCellN + 2).setCellValue("");
contents5nRow.getCell(cpCellN + 2).setCellStyle(styleContents2str);
}
cpCellN++;
}
contents5nRow.createCell(cpCellN + 2).setCellValue(tmpSumColRate);
contents5nRow.getCell(cpCellN + 2).setCellStyle(styleContents2rate);
}
}
private void report_4(List<AnalysisVo> dataList, List<Map<String, String>> candList, List<AnalysisVo> optionList, List<AnalysisVo> optionSelList) {
rowN++;
rowN++;
Cell reportTopCell = sheet.createRow(rowN).createCell(0);
reportTopCell.setCellValue("보고서 4 : 옵션별");
reportTopCell.setCellStyle(styleCaption);
rowN++;
Row headerRow = sheet.createRow(rowN);
headerRow.setHeightInPoints(23);
headerRow.createCell(0).setCellValue("구분");
headerRow.getCell(0).setCellStyle(styleContentHeader);
headerRow.createCell(1).setCellValue("선택옵션");
headerRow.getCell(1).setCellStyle(styleContentHeader);
int cpCellN = 0;
candList.sort(Comparator.comparing(m -> Integer.parseInt(m.get("cand_party_cd"))));
for(Map<String, String> areaCand : candList){
String headerStr = areaCand.get("cand_nm").equals("무응답") ? areaCand.get("cand_nm") : areaCand.get("party_nm") + "\r\n" + areaCand.get("cand_nm");
if(areaCand.get("cand_party_cd").equals("999")){
headerStr = "";
}
headerRow.createCell(cpCellN + 2).setCellValue(headerStr);
headerRow.getCell(cpCellN + 2).setCellStyle(styleContentHeader);
cpCellN++;
}
headerRow.createCell(cpCellN + 2).setCellValue("계");
headerRow.getCell(cpCellN + 2).setCellStyle(styleContentHeader);
optionList.sort(Comparator.comparing(m -> Integer.parseInt(m.getOption_cd())));
for(AnalysisVo option : optionList){
List<AnalysisVo> optionDataList = dataList.stream().filter(vo -> vo.getOption_cd().equals(option.getOption_cd())).collect(Collectors.toList());
rowN++;
Row contentsCntRow = sheet.createRow(rowN);
contentsCntRow.createCell(0).setCellValue(option.getOption_nm());
contentsCntRow.getCell(0).setCellStyle(styleContents2str);
boolean selOptionChk = optionDataList.get(0).getCand_party().equals("CAND") ?
option.getOption_cd().equals(optionSelList.get(0).getCand_option_cd()) :
option.getOption_cd().equals(optionSelList.get(0).getParty_option_cd());
contentsCntRow.createCell(1).setCellValue(selOptionChk ? "√" : "");
contentsCntRow.getCell(1).setCellStyle(styleContents2str);
cpCellN = 0;
float tmpSumColRate = 0;
for(Map<String, String> areaCand : candList){
if(!areaCand.get("cand_party_cd").equals("999")){
float pollRate = (float) (Math.round(safeParseFloat(optionDataList.stream().filter(vo -> vo.getCand_party_cd().equals(areaCand.get("cand_party_cd"))).collect(Collectors.toList()).get(0).getVote_rate()) * 10.0) / 1000.0);
contentsCntRow.createCell(cpCellN + 2).setCellValue(pollRate);
tmpSumColRate += pollRate;
contentsCntRow.getCell(cpCellN + 2).setCellStyle(styleContents2rate);
}else{
contentsCntRow.createCell(cpCellN + 2).setCellValue("");
contentsCntRow.getCell(cpCellN + 2).setCellStyle(styleContents2str);
}
cpCellN++;
}
contentsCntRow.createCell(cpCellN + 2).setCellValue(tmpSumColRate);
contentsCntRow.getCell(cpCellN + 2).setCellStyle(styleContents2rate);
}
}
}

View File

@@ -0,0 +1,101 @@
package kr.co.kr.module;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
public class MethodModule {
/* 모듈 */
public static int len(String res){
int length = 0;
for(int i = 0; i < 1000; i++){
if(i == 0){
if(res.substring(0).equals("")){
break;
}else{
length += 1;
}
}else{
if(res.substring(i).equals("")){
break;
}else{
length += 1;
}
}
}
return length;
}
// Excel Cell 주소값 불러오기
public static String getCellAddress(int cellIdx, int rowIdx){
String cellAddress = "";
if(((cellIdx+1)+65) > 90 && ((cellIdx+1)+65) < 116){ // Cell의 위치가 AA 이상일 때,
cellAddress = "A" + String.valueOf((char)(((cellIdx+1)+65)-26)) + (rowIdx+1);
}else if(((cellIdx+1)+65) > 115 && ((cellIdx+1)+65) < 141){ // Cell의 위치가 BA 이상일 때,
cellAddress = "B" + String.valueOf((char)(((cellIdx+1)+65)-52)) + (rowIdx+1);
}else if(((cellIdx+1)+65) > 140 && ((cellIdx+1)+65) < 166){ // Cell의 위치가 CA 이상일 때,
cellAddress = "C" + String.valueOf((char)(((cellIdx+1)+65)-78)) + (rowIdx+1);
}else{ // Cell 위치가 AA 미만일 때,
cellAddress = String.valueOf((char)((cellIdx+1)+65)) + (rowIdx+1);
}
return cellAddress;
}
// Excel Cell 주소값 불러오기 ( $ 사용 유무 )
public static String getCellAddress(int cellIdx, int rowIdx, boolean cellLock, boolean rowLock){
String cellAddress = "";
String cLock = cellLock ? "$" : "";
String rLock = rowLock ? "$" : "";
if(((cellIdx+1)+65) > 90 && ((cellIdx+1)+65) < 116){ // Cell의 위치가 AA 이상일 때,
cellAddress = cLock + "A" + String.valueOf((char)(((cellIdx+1)+65)-26)) + rLock + (rowIdx+1);
}else if(((cellIdx+1)+65) > 115 && ((cellIdx+1)+65) < 141){ // Cell의 위치가 BA 이상일 때,
cellAddress = cLock + "B" + String.valueOf((char)(((cellIdx+1)+65)-52)) + rLock + (rowIdx+1);
}else if(((cellIdx+1)+65) > 140 && ((cellIdx+1)+65) < 166){ // Cell의 위치가 CA 이상일 때,
cellAddress = cLock + "C" + String.valueOf((char)(((cellIdx+1)+65)-78)) + rLock + (rowIdx+1);
}else{ // Cell 위치가 AA 미만일 때,
cellAddress = cLock + String.valueOf((char)((cellIdx+1)+65)) + rLock + (rowIdx+1);
}
return cellAddress;
}
//중복제거 메소드
public static List<HashMap<Object, Object>> distinctArray(List<HashMap<Object, Object>> target, Object key){ //key는 제거할 해쉬맵 대상
if(target != null){
target = target.stream().filter(distinctByKey(o-> o.get(key))).collect(Collectors.toList());
}
return target;
}
//중복 제거를 위한 함수형 클래스
public static <T> Predicate<T> distinctByKey(Function<? super T,Object> keyExtractor) {
Map<Object,Boolean> seen = new ConcurrentHashMap<>();
return t -> seen.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null;
}
public static ArrayList<String> deDup1(ArrayList<String> list) {
ArrayList<String> result = new ArrayList<>();
HashSet<String> set = new HashSet<>();
for (String item : list) {
if (!set.contains(item)) {
result.add(item);
set.add(item);
}
}
return result;
}
public static ArrayList<String> deDup2(ArrayList<String> list) {
HashSet<String> set = new HashSet<>(list);
ArrayList<String> result = new ArrayList<>(set);
return result;
}
}

View File

@@ -0,0 +1,63 @@
package kr.co.kr.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import lombok.*;
@Getter @Setter
@ToString
@JsonInclude(Include.NON_NULL)
public class AnalysisVo{
private String sido_cd;
private String sido_nm;
private String area_cd;
private String area_nm;
private String time_band;
private String start_time;
private String cluster;
private String cluster_nm;
private String cluster_cnt;
private String subarea_cd;
private String subarea_nm;
private String gender;
private String age;
private String cand_party_cd;
private String cand_nm;
private String party_nm;
private String cnt;
private String f_cand_party; // 국회의원 (CAND) or 비례대표 (PARTY)
private String f_local; //전체(ALL) or 개별선거구(CHOICE)
private String vote_rate;
private String sect;
private String sum_cnt;
private String calc_ratio;
private String rate;
private String p5p_rate;
private String pre_rate;
private String p5n_rate;
private String cand_party;
private String option_cd;
private String option_nm;
private String poll_pre;
private String poll_5p;
private String poll_5n;
private String vote_cd;
private String pre_option_cd;
private String pre_option_nm;
private String cand_option_cd;
private String party_option_cd;
private String edu_option_cd;
private String final_option_cd;
private String search_time;
private String party_yn;
private String id;
private String search_req;
private String html_str;
private String insert_user;
private String insert_date;
private String update_date;
}

View File

@@ -0,0 +1,11 @@
package kr.co.kr.vo;
import lombok.*;
@Getter @Setter
@ToString
public class MainVo{
private String cnt;
}

View File

@@ -0,0 +1,79 @@
package kr.co.kr.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import lombok.*;
@Getter @Setter
@ToString
@JsonInclude(Include.NON_NULL)
public class TransmissionVo{
private String area_cd;
private String area_cd_K;
private String area_cd_M;
private String area_cd_S;
private String vote_type;
private String cand_party_cd;
private String vote_rate;
private String cand_result;
private String rnum;
private String company_code;
private String cand_party_cd_K;
private String cand_party_cd_M;
private String cand_party_cd_S;
private String cand_count;
private String area_result;
private String poll_cnt;
private String err_limit;
private String json_data;
private String area_nm;
private String poll_type;
private String sect_10;
private String sect_20;
private String sect_01;
private String sect_02;
private String sect_03;
private String sect_04;
private String sect_07;
private String sect_05;
private String sect_06;
private String sect_11;
private String sect_12;
private String sect_13;
private String sect_14;
private String sect_17;
private String sect_15;
private String sect_16;
private String sect_21;
private String sect_22;
private String sect_23;
private String sect_24;
private String sect_27;
private String sect_25;
private String sect_26;
private String sect_91;
private String sect_92;
private String sect_93;
private String sect_94;
private String sect_95;
private String sect_96;
private String sect_97;
private String sect_98;
private String pre_rate;
private String dd_rate;
private String party_01;
private String party_02;
private String party_03;
private String party_99;
}

View File

@@ -0,0 +1,63 @@
package kr.co.kr.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter @Setter
@ToString
@JsonInclude(Include.NON_NULL)
public class TransmissionVo_2022 {
private String area_nm;
private String poll_type;
private String area_cd;
private String area_cd_K;
private String area_cd_M;
private String area_cd_S;
private String cand_party_cd;
private String vote_rate;
private String rnum;
private String err_limit;
private String poll_cnt;
private String area_result;
private String cand_result;
private String sect_10;
private String sect_20;
private String sect_01;
private String sect_02;
private String sect_03;
private String sect_04;
private String sect_07;
private String sect_05;
private String sect_06;
private String sect_11;
private String sect_12;
private String sect_13;
private String sect_14;
private String sect_17;
private String sect_15;
private String sect_16;
private String sect_21;
private String sect_22;
private String sect_23;
private String sect_24;
private String sect_27;
private String sect_25;
private String sect_26;
private String sect_91;
private String sect_92;
private String sect_93;
private String sect_94;
private String sect_95;
private String sect_96;
private String sect_97;
private String sect_98;
private String pre_rate;
private String dd_rate;
private String party_01;
private String party_02;
private String party_03;
private String party_99;
}

View File

@@ -0,0 +1,35 @@
# Server Port
server.port = 8898
server.address=0.0.0.0
# prefix : 접두사
# suffix : 접미사
# # # URL을 입력 시 Default로 적용
spring.mvc.view.prefix=/WEB-INF/jsp/
spring.mvc.view.suffix=.jsp
# DB 연결 정보
# spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
# spring.datasource.url=jdbc:sqlserver://10.10.11.7:20022
spring.datasource.driverClassName=net.sf.log4jdbc.sql.jdbcapi.DriverSpy
spring.datasource.url=jdbc:log4jdbc:sqlserver://10.10.11.7:20022
spring.datasource.username=kon
spring.datasource.password=kon#51304
# spring.datasource.username=2020poll
# spring.datasource.password=krco#51304
# application.properties
# 콘솔 창에 출력되는 로깅 메세지를 색으로 구분해서 출력
spring.output.ansi.enabled=always
server.servlet.session.timeout=28800
# logging.level.{패키지 경로}를 통해 로깅 레벨을 결정할 수 있음
logging.level.com.tutorial.springboot=INFO
# liveReload 기능
spring.devtools.restart.enabled=true
spring.devtools.livereload.enabled=false
spring.freemarker.cache=false
spring.devtools.restart.exclude=resources/excel/**

View File

@@ -0,0 +1,3 @@
log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator
# log4jdbc.dump.sql.maxlinelength=0
# (maxlinelength는 sql문을 최대 몇 라인까지 출력할 것인가를 결정한다. 0으로 하면 제한 없이 실행된 그대로 출력이 되고, 설정하지 않으면 그냥 한줄로 쭉 출력된다.)

View File

@@ -0,0 +1,26 @@
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyyMMdd HH:mm:ss.SSS} [%thread] %-3level %logger{5} - %msg %n</pattern>
</encoder>
</appender>
<logger name="jdbc" level="DEBUG"/>
<logger name="jdbc.sqlonly" level="DEBUG"/>
<logger name="jdbc.sqltiming" level="OFF"/>
<logger name="jdbc.audit" level="OFF"/>
<logger name="jdbc.resultset" level="OFF"/>
<logger name="jdbc.resultsettable" level="OFF"/>
<logger name="jdbc.connection" level="OFF"/>
<!--
- jdbc.sqlonly : SQL문만을 로그로 남기며, PreparedStatement일 경우 관련된 argument 값으로 대체된 SQL문이 보여진다.
- jdbc.sqltiming : SQL문과 해당 SQL을 실행시키는데 수행된 시간 정보(milliseconds)를 포함한다.
- jdbc.audit : ResultSet을 제외한 모든 JDBC 호출 정보를 로그로 남긴다. 많은 양의 로그가 생성되므로 특별히 JDBC 문제를 추적해야 할 필요가 있는 경우를 제외하고는 사용을 권장하지 않는다.
- jdbc.resultset : ResultSet을 포함한 모든 JDBC 호출 정보를 로그로 남기므로 매우 방대한 양의 로그가 생성된다.
- jdbc.resultsettable : SQL 결과 조회된 데이터의 table을 로그로 남긴다.
-->
<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
</configuration>

View File

@@ -0,0 +1,982 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="kr.co.kr.dao.AnalysisDao">
<resultMap id="AnalysisVo" type="kr.co.kr.vo.AnalysisVo"></resultMap>
<resultMap id="AnalysisVo1" type="kr.co.kr.vo.AnalysisVo"></resultMap>
<resultMap id="AnalysisVo2" type="kr.co.kr.vo.AnalysisVo"></resultMap>
<resultMap id="AnalysisVo3" type="kr.co.kr.vo.AnalysisVo"></resultMap>
<resultMap id="AnalysisVo4" type="kr.co.kr.vo.AnalysisVo"></resultMap>
<resultMap id="AnalysisVo5" type="kr.co.kr.vo.AnalysisVo"></resultMap>
<select id="getArea" resultMap="AnalysisVo">
SELECT SD.sido_cd, SD.sido_nm,
AR.area_cd, AR.area_nm
FROM exitpoll_2022le.dbo.F_sido SD LEFT JOIN exitpoll_2022le.dbo.F_area AR
ON SD.sido_cd = AR.sido_cd
WHERE AR.company = 'KRI'
ORDER BY SD.sido_cd, AR.area_cd
</select>
<select id="getTimeBand" resultMap="AnalysisVo">
SELECT * FROM exitpoll_2022le.dbo.F_TIME WHERE time_band > '0'
</select>
<select id="getWeight" resultMap="AnalysisVo">
SELECT area_cd, cluster, poll_pre, poll_5p, poll_5n
FROM exitpoll_2022le.dbo.F_weight
</select>
<select id="getOption" resultMap="AnalysisVo1,AnalysisVo2">
SELECT vote_cd, option_cd, option_nm
FROM exitpoll_2022le.dbo.F_option
ORDER BY vote_cd, option_cd
SELECT area_cd, vote_cd, cand_option_cd, party_option_cd, edu_option_cd
FROM exitpoll_2022le.dbo.F_output_option
ORDER BY area_cd, vote_cd
</select>
<update id="optionSave">
UPDATE exitpoll_2022le.dbo.F_output_option
<if test="f_cand_party == 'CAND'">
set cand_option_cd = #{option_cd}
</if>
<if test="f_cand_party == 'PARTY'">
set party_option_cd = #{option_cd}
</if>
<if test="f_cand_party == 'EDU'">
set edu_option_cd = #{option_cd}
</if>
WHERE area_cd = #{area_cd} AND vote_cd = #{vote_cd}
</update>
<select id="getOutputData" resultMap="AnalysisVo1,AnalysisVo2,AnalysisVo3,AnalysisVo4,AnalysisVo,AnalysisVo5">
SET NOCOUNT ON
-- @@@@@ 1. 테이블 F_TMP_EXPOLL을 Drop한다
DROP TABLE IF EXISTS exitpoll_2022le.dbo.F_TMP_EXPOLL
-- @@@@@ 2. F_EXITPOLL에서 선택된 차수 보다 작거나 같은 Data를 F_TMP_EXPOLL에 넣는다
SELECT a.* INTO exitpoll_2022le.dbo.F_TMP_EXPOLL
FROM exitpoll_2022le.dbo.F_EXITPOLL a
left join exitpoll_2022le.dbo.F_cand c on a.area_cd=c.area_cd and a.cand_cd=c.cand_cd and c.quit = 0
WHERE #{time_band} >= a.time_band AND a.time_band != '0' and c.cand_cd is not null
<!-- and a.party_cd not in ('01','02') and (a.cand_cd = '00' or c.cand_cd is not null) -->
<!-- and reg_date <![CDATA[<=]]> '2024-04-10 16:54:59.999' -->
DROP TABLE IF EXISTS exitpoll_2022le.dbo.TMP_EXIT_POLL
DROP TABLE IF EXISTS exitpoll_2022le.dbo.TMP_GENDER_AGE
DROP TABLE IF EXISTS exitpoll_2022le.dbo.TMP_GENDER_AGE_RATE
DROP TABLE IF EXISTS exitpoll_2022le.dbo.TMP_GENDER_AGE_SUM
DROP TABLE IF EXISTS exitpoll_2022le.dbo.TMP_CLUSTER_POLL
DROP TABLE IF EXISTS exitpoll_2022le.dbo.TMP_CLUSTER_GA_SUM
DROP TABLE IF EXISTS exitpoll_2022le.dbo.TMP_CLUSTER_DATA
DROP TABLE IF EXISTS exitpoll_2022le.dbo.TMP_WEIGHT_GA
DROP TABLE IF EXISTS exitpoll_2022le.dbo.TMP_PRE_P5N_CNT
DROP TABLE IF EXISTS exitpoll_2022le.dbo.TMP_PRE_P5N_RATIO;
-- @@@@@ F_TMP_EXPOLL 기준으로 지역 X 투표소 X 성 X 연령 X 후보(정당)의 count값을 임시 테이블 TMP_EXIT_POLL에 넣는다
SELECT B.area_cd, B.subarea_cd,
B.gender, B.age, cand_party,
ISNULL(T.cand_party_cd, B.cand_party_cd) AS cand_party_cd, ISNULL(T.cnt, 0) AS cnt
INTO exitpoll_2022le.dbo.TMP_EXIT_POLL
FROM
(
SELECT A.area_cd, GA.gender, GA.age, SA.subarea_cd, CP.cand_party, CP.cand_party_cd
FROM exitpoll_2022le.dbo.F_area A LEFT JOIN exitpoll_2022le.dbo.F_subarea SA
ON A.area_cd = SA.area_cd LEFT JOIN (
SELECT 'CAND' AS cand_party, area_cd, cand_cd AS cand_party_cd
FROM exitpoll_2022le.dbo.F_cand UNION ALL
SELECT 'PARTY' AS cand_party, '0000' AS area_cd, party_cd AS cand_party_cd
FROM exitpoll_2022le.dbo.F_party WHERE party_yn = '1' UNION ALL
SELECT 'EDU' AS cand_party, area_cd, edu_cd AS cand_party_cd
FROM exitpoll_2022le.dbo.F_edu WHERE quit = '0' UNION ALL
SELECT 'CAND' AS cand_party, '0000' AS area_cd, '00' AS cand_party_cd UNION ALL
SELECT 'PARTY' AS cand_party, '0000' AS area_cd, '00' AS cand_party_cd UNION ALL
SELECT 'EDU' AS cand_party, '0000' AS area_cd, '00' AS cand_party_cd
) CP ON (A.area_cd = CP.area_cd OR CP.area_cd = '0000') AND
CP.cand_party =
<if test="f_cand_party == 'CAND'">
'CAND'
</if>
<if test="f_cand_party == 'PARTY'">
'PARTY'
</if>
<if test="f_cand_party == 'EDU'">
'EDU'
</if>
LEFT JOIN
(
SELECT CONVERT(varchar(1), number % 3) AS gender, CONVERT(varchar(1), number / 3) AS age
FROM master..spt_values
WHERE type = 'P' and 21 > number
) GA ON 1=1
WHERE A.company = 'KRI'
<if test="f_local == 'CHOICE'">
AND A.area_cd = #{area_cd}
</if>
) B LEFT JOIN
(
SELECT area_cd, subarea_cd, gender, age,
<if test="f_cand_party == 'CAND'">
cand_cd
</if>
<if test="f_cand_party == 'PARTY'">
party_cd
</if>
<if test="f_cand_party == 'EDU'">
edu_cd
</if>
AS cand_party_cd, count(*) AS cnt
FROM exitpoll_2022le.dbo.F_TMP_EXPOLL
WHERE 1=1
<if test="f_local == 'CHOICE'">
AND area_cd = #{area_cd}
</if>
GROUP BY area_cd, subarea_cd, gender, age,
<if test="f_cand_party == 'CAND'">
cand_cd
</if>
<if test="f_cand_party == 'PARTY'">
party_cd
</if>
<if test="f_cand_party == 'EDU'">
edu_cd
</if>
) T ON B.area_cd = T.area_cd AND B.subarea_cd = T.subarea_cd
AND B.cand_party_cd = T.cand_party_cd
AND B.gender = T.gender AND B.age = T.age
<if test="f_local == 'CHOICE'">
WHERE B.area_cd = #{area_cd}
</if>
-- @@@@@ 4. TMP_EXIT_POLL 기준으로 지역 X 투표소 X 성 X 연령 X 후보(정당)의 sum(count)값을 임시 테이블 TMP_GENDER_AGE에 넣는다
-- 선거구 X 층 - 계층별 집계 자료
-- DROP TABLE TMP_GENDER_AGE
SELECT TEP.area_cd, cluster, cluster_nm, gender, age, TEP.cand_party, TEP.cand_party_cd, SUM(cnt) AS cnt
INTO exitpoll_2022le.dbo.TMP_GENDER_AGE
FROM
exitpoll_2022le.dbo.TMP_EXIT_POLL TEP LEFT JOIN exitpoll_2022le.dbo.F_subarea SA
ON TEP.area_cd = SA.area_cd AND TEP.subarea_cd = SA.subarea_cd
<if test="f_cand_party == 'CAND'">
LEFT JOIN exitpoll_2022le.dbo.F_cand C ON TEP.area_cd = C.area_cd AND TEP.cand_party_cd = C.cand_cd
</if>
<if test="f_cand_party == 'EDU'">
LEFT JOIN exitpoll_2022le.dbo.F_edu E ON TEP.area_cd = E.area_cd AND TEP.cand_party_cd = E.edu_cd AND E.quit = '0'
</if>
LEFT JOIN exitpoll_2022le.dbo.F_party P ON
<if test="f_cand_party == 'CAND'"> C.party_cd </if>
<if test="f_cand_party == 'PARTY'"> TEP.cand_party_cd </if>
<if test="f_cand_party == 'EDU'"> '99' </if>
= P.party_cd
WHERE (TEP.cand_party_cd = '00' OR P.party_nm IS NOT NULL)
GROUP BY TEP.area_cd, cluster, cluster_nm, gender, age, TEP.cand_party, TEP.cand_party_cd
-- @@@@@ 5. TMP_GENDER_AGE 기준으로 지역 X 층 X 후보(정당) sum(count)를 임시 테이블 TMP_GENDER_AGE_SUM 에 넣는다
-- 선거구 X 층 - 계층 응답자 집계합 (계층 무응답자 배분용)
-- DROP TABLE TMP_GENDER_AGE_SUM
SELECT area_cd, cluster, cluster_nm, cand_party_cd, SUM(cnt) AS cnt
INTO exitpoll_2022le.dbo.TMP_GENDER_AGE_SUM
FROM exitpoll_2022le.dbo.TMP_GENDER_AGE
WHERE gender != '0' AND age != '0'
GROUP BY area_cd, cluster, cluster_nm, cand_party_cd
-- @@@@@ 6. TMP_GENDER_AGE와 TMP_GENDER_AGE_RATE을 사용하여 지역 X 층 X 성 X 연령 X 후보(정당)의 %값을 만들어 TMP_GENDER_AGE_RATE에 넣는다
-- 선거구 X 층 - 계층 응답자 득표율 (계층 무응답자 배분용)
-- DROP TABLE TMP_GENDER_AGE_RATE
SELECT GA.area_cd, GA.cluster, GA.cluster_nm, gender, age, GA.cand_party_cd,
CASE SGA.cnt WHEN 0 THEN 0.0 ELSE GA.cnt * 1.0 / SGA.cnt END AS vote_rate
INTO exitpoll_2022le.dbo.TMP_GENDER_AGE_RATE
FROM exitpoll_2022le.dbo.TMP_GENDER_AGE GA LEFT JOIN exitpoll_2022le.dbo.TMP_GENDER_AGE_SUM SGA
ON GA.area_cd = SGA.area_cd AND GA.cluster = SGA.cluster AND GA.cand_party_cd = SGA.cand_party_cd
WHERE gender != '0' AND age != '0'
-- @@@@@ 7. TMP_GENDER_AGE와 TMP_GENDER_AGE_RATE를 사용하여 성/연령 응답값이 있는 케이스들과 그렇지 않은 케이스들의 통합 테이블 TMP_CLUSTER_POLL을 만든다,
-- 성/연령 응답값이 둘다 없으면 해당 층의 해당 후보(정당)의 지지도를 곱한다, 성이 있으면 성 별 후보(정당) 지지도를 곱한다, 연령이 있으면 연령 별 후보(정당) 지지도를 곱한다
-- 선거구 X 층 - 계층 무응답자 배분 후 득표수
SELECT area_cd, cluster, cluster_nm, gender, age, cand_party, cand_party_cd, sum(cnt) AS cnt
INTO exitpoll_2022le.dbo.TMP_CLUSTER_POLL
FROM
(
/* 성/연령 응답자 */
SELECT area_cd, cluster, cluster_nm, gender, age, cand_party, cand_party_cd, cnt
FROM exitpoll_2022le.dbo.TMP_GENDER_AGE
WHERE gender != '0' AND age != '0'
/* 성/연령 무응답자 배분 */ UNION ALL
SELECT GA.area_cd, GA.cluster, GA.cluster_nm, GAR.gender, GAR.age, cand_party, GA.cand_party_cd, (GA.cnt * vote_rate) AS calc_cnt
FROM exitpoll_2022le.dbo.TMP_GENDER_AGE GA LEFT JOIN exitpoll_2022le.dbo.TMP_GENDER_AGE_RATE GAR
ON GA.area_cd = GAR.area_cd AND GA.cluster = GAR.cluster AND GA.cand_party_cd = GAR.cand_party_cd
WHERE GA.gender = '0' AND GA.age = '0'
/* 성 무응답자 배분 */ UNION ALL
SELECT GA.area_cd, GA.cluster, GA.cluster_nm, GAR.gender, GA.age, cand_party, GA.cand_party_cd, (GA.cnt * SUM(vote_rate)) AS calc_cnt
FROM exitpoll_2022le.dbo.TMP_GENDER_AGE GA LEFT JOIN exitpoll_2022le.dbo.TMP_GENDER_AGE_RATE GAR
ON GA.area_cd = GAR.area_cd AND GA.cluster = GAR.cluster AND GA.cand_party_cd = GAR.cand_party_cd
WHERE GA.gender = '0' AND GA.age != '0'
GROUP BY GA.area_cd, GA.cluster, GA.cluster_nm, GAR.gender, GA.age, cand_party, GA.cand_party_cd, GA.cnt
/* 연령 무응답자 배분 */ UNION ALL
SELECT GA.area_cd, GA.cluster, GA.cluster_nm, GA.gender, GAR.age, cand_party, GA.cand_party_cd, (GA.cnt * SUM(vote_rate)) AS calc_cnt
FROM exitpoll_2022le.dbo.TMP_GENDER_AGE GA LEFT JOIN exitpoll_2022le.dbo.TMP_GENDER_AGE_RATE GAR
ON GA.area_cd = GAR.area_cd AND GA.cluster = GAR.cluster AND GA.cand_party_cd = GAR.cand_party_cd
WHERE GA.gender != '0' AND GA.age = '0'
GROUP BY GA.area_cd, GA.cluster, GA.cluster_nm, GA.gender, GAR.age, cand_party, GA.cand_party_cd, GA.cnt
) T
GROUP BY area_cd, cluster, cluster_nm, gender, age, cand_party, cand_party_cd
-- @@@@@ 8. TMP_CLUSTER_POLL를 기준으로 지역 X 층 X 성 X 연령의 sum(count)를 임시 테이블 TMP_CLUSTER_GA_SUM에 넣는다
-- 선거구 X 층 - 계층 응답자 집계합 (계층별 득표율 구하기 위함)
SELECT area_cd, cluster, cluster_nm, gender, age, sum(cnt) AS cnt
INTO exitpoll_2022le.dbo.TMP_CLUSTER_GA_SUM
FROM exitpoll_2022le.dbo.TMP_CLUSTER_POLL
GROUP BY area_cd, cluster, cluster_nm, gender, age
-- @@@@@ 9. TMP_CLUSTER_GA_SUM, TMP_CLUSTER_POLL을 사용하여 지역 X 층 X 계층 X 후보(정당) 득표수, 계층별 득표수 합을 TMP_CLUSTER_DATA에 넣는다
-- 보고서 2 계층별 자료
-- 선거구 X 층 - 계층별 득표수, 계층별 득표수 합, 계층별 득표율
SELECT area_cd, cluster, cluster_nm, sect, cand_party, cand_party_cd, sum_cnt, cnt
INTO exitpoll_2022le.dbo.TMP_CLUSTER_DATA
FROM
(
/* 해당 층의 전체 득표수, 후보(정당)별 득표수 */
SELECT CGS.area_cd, CGS.cluster, CGS.cluster_nm,
'00_전체' AS sect,
cand_party, CP.cand_party_cd, CP.cnt, CGS.cnt AS sum_cnt
FROM
(
SELECT area_cd, cluster, cluster_nm, sum(cnt) AS cnt
FROM exitpoll_2022le.dbo.TMP_CLUSTER_GA_SUM
GROUP BY area_cd, cluster, cluster_nm
) CGS LEFT JOIN
(
SELECT area_cd, cluster, cluster_nm, cand_party, cand_party_cd, sum(cnt) AS cnt
FROM exitpoll_2022le.dbo.TMP_CLUSTER_POLL
GROUP BY area_cd, cluster, cluster_nm, cand_party, cand_party_cd
) CP
ON CGS.area_cd = CP.area_cd AND CGS.cluster = CP.cluster
/* 해당 층의 성 계층 득표수, 후보(정당)별 득표수 */ UNION ALL
SELECT CGS.area_cd, CGS.cluster, CGS.cluster_nm,
CASE CGS.gender WHEN '1' THEN '10_남자' WHEN '2' THEN '20_여자' END AS sect,
cand_party, CP.cand_party_cd, CP.cnt, CGS.cnt AS sum_cnt
FROM
(
SELECT area_cd, cluster, cluster_nm, gender, sum(cnt) AS cnt
FROM exitpoll_2022le.dbo.TMP_CLUSTER_GA_SUM
GROUP BY area_cd, cluster, cluster_nm, gender
) CGS LEFT JOIN
(
SELECT area_cd, cluster, cluster_nm, gender, cand_party, cand_party_cd, sum(cnt) AS cnt
FROM exitpoll_2022le.dbo.TMP_CLUSTER_POLL
GROUP BY area_cd, cluster, cluster_nm, gender, cand_party, cand_party_cd
) CP
ON CGS.area_cd = CP.area_cd AND CGS.cluster = CP.cluster AND CGS.gender = CP.gender
/* 해당 층의 연령 계층 득표수, 후보(정당)별 득표수 */ UNION ALL
SELECT CGS.area_cd, CGS.cluster, CGS.cluster_nm,
CASE CGS.age WHEN '1' THEN '01_20대'
WHEN '2' THEN '02_30대'
WHEN '3' THEN '03_40대'
WHEN '4' THEN '04_50대'
WHEN '5' THEN '05_60대'
WHEN '6' THEN '06_70세이상'
END AS sect,
cand_party, CP.cand_party_cd, CP.cnt, CGS.cnt AS sum_cnt
FROM
(
SELECT area_cd, cluster, cluster_nm, age, sum(cnt) AS cnt
FROM exitpoll_2022le.dbo.TMP_CLUSTER_GA_SUM
GROUP BY area_cd, cluster, cluster_nm, age
) CGS LEFT JOIN
(
SELECT area_cd, cluster, cluster_nm, age, cand_party, cand_party_cd, sum(cnt) AS cnt
FROM exitpoll_2022le.dbo.TMP_CLUSTER_POLL
GROUP BY area_cd, cluster, cluster_nm, age, cand_party, cand_party_cd
) CP
ON CGS.area_cd = CP.area_cd AND CGS.cluster = CP.cluster AND CGS.age = CP.age
/* 해당 층의 성/연령 계층 득표수, 후보(정당)별 득표수 */ UNION ALL
SELECT CGS.area_cd, CGS.cluster, CGS.cluster_nm,
CASE CGS.gender
WHEN '1' THEN
CASE CGS.age WHEN '1' THEN '11_20대 남'
WHEN '2' THEN '12_30대 남'
WHEN '3' THEN '13_40대 남'
WHEN '4' THEN '14_50대 남'
WHEN '5' THEN '15_60대 남'
WHEN '6' THEN '16_70세이상 남' END
WHEN '2' THEN
CASE CGS.age WHEN '1' THEN '21_20대 여'
WHEN '2' THEN '22_30대 여'
WHEN '3' THEN '23_40대 여'
WHEN '4' THEN '24_50대 여'
WHEN '5' THEN '25_60대 여'
WHEN '6' THEN '26_70세이상 여' END
END AS sect,
cand_party, CP.cand_party_cd, CP.cnt, CGS.cnt AS sum_cnt
FROM
(
SELECT area_cd, cluster, cluster_nm, gender, age, sum(cnt) AS cnt
FROM exitpoll_2022le.dbo.TMP_CLUSTER_GA_SUM
GROUP BY area_cd, cluster, cluster_nm, gender, age
) CGS LEFT JOIN
(
SELECT area_cd, cluster, cluster_nm, gender, age, cand_party, cand_party_cd, sum(cnt) AS cnt
FROM exitpoll_2022le.dbo.TMP_CLUSTER_POLL
GROUP BY area_cd, cluster, cluster_nm, gender, age, cand_party, cand_party_cd
) CP
ON CGS.area_cd = CP.area_cd AND CGS.cluster = CP.cluster AND CGS.gender = CP.gender AND CGS.age = CP.age
) T
-- @@@@@ 10. F_weight테이블로 부터 증 X 계층별 - 사전투표, 5시이후 가중치를 정리하여 TMP_WEIGHT_GA에 넣는다
-- sect = 11_20대 남, 12_30대 남, 13_40대 남, 14_50대 남, 16_70세 이상 남
-- sect = 21_20대 여, 22_30대 여, 23_40대 여, 24_50대 여, 26_70세 이상 여
-- 선거구 X 계층별 - 사전투표, 5시이후 가중치
SELECT area_cd, cluster,
RIGHT('0' + CONVERT(varchar(2),
CONVERT(integer, SUBSTRING(pre_ga, 5, 1)) +
CASE RIGHT(pre_ga, 1)
WHEN 'm' THEN 9
WHEN 'w' THEN 19 END), 2) AS sect,
CONVERT(NUMERIC(12, 10), pre_ratio) AS pre_ratio,
CONVERT(NUMERIC(12, 10), p5n_ratio) AS p5n_ratio
INTO exitpoll_2022le.dbo.TMP_WEIGHT_GA
FROM
(
SELECT area_cd, cluster,
-- 사전투표 20대 남 ~ 70 남 가중치
pre_20_m, pre_30_m, pre_40_m, pre_50_m, pre_60_m, pre_70_m,
-- 사전투표 20대 여 ~ 70 여 가중치
pre_20_w, pre_30_w, pre_40_w, pre_50_w, pre_60_w, pre_70_w,
-- 5시이후 20대 남 ~ 70 남 가중치
p5n_20_m, p5n_30_m, p5n_40_m, p5n_50_m, p5n_60_m, p5n_70_m,
-- 5시이후 20대 여 ~ 70 여 가중치
p5n_20_w, p5n_30_w, p5n_40_w, p5n_50_w, p5n_60_w, p5n_70_w
FROM exitpoll_2022le.dbo.F_weight
) T
UNPIVOT
(
pre_ratio FOR pre_ga IN (
pre_20_m, pre_30_m, pre_40_m, pre_50_m, pre_60_m, pre_70_m,
pre_20_w, pre_30_w, pre_40_w, pre_50_w, pre_60_w, pre_70_w
)
) U1
UNPIVOT
(
p5n_ratio FOR p5n_ga IN (
p5n_20_m, p5n_30_m, p5n_40_m, p5n_50_m, p5n_60_m, p5n_70_m,
p5n_20_w, p5n_30_w, p5n_40_w, p5n_50_w, p5n_60_w, p5n_70_w
)
) U2
WHERE RIGHT(pre_ga, 4) = RIGHT(p5n_ga, 4)
-- @@@@@ 11. TMP_WEIGHT_GA의 가중치를 TMP_CLUSTER_DATA의 득표율을 기준으로 선거구 X 층 X 계층의 사전, 5시 이후 가중치 계산해 TMP_PRE_P5N_RATIO에 넣는다
-- 사전, 5시 이후 가중치 계산
------------!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!with java, it's not working well need to be fixed
SELECT A.area_cd, A.cluster, A.sect,
CASE A.cnt WHEN 0 THEN 0.0 ELSE WGA.pre_ratio / (A.cnt / B.sum_cnt) END AS pre_ratio,
CASE A.cnt WHEN 0 THEN 0.0 ELSE WGA.p5n_ratio / (A.cnt / B.sum_cnt) END AS p5n_ratio
INTO exitpoll_2022le.dbo.TMP_PRE_P5N_RATIO
FROM
(
SELECT area_cd, cluster, LEFT(sect, 2) AS sect, SUM(cnt) AS cnt
FROM exitpoll_2022le.dbo.TMP_CLUSTER_DATA
WHERE (LEFT(sect, 2) BETWEEN '11' AND '16' OR LEFT(sect, 2) BETWEEN '21' AND '26') AND cand_party_cd != '00'
GROUP BY area_cd, cluster, LEFT(sect, 2)
) A LEFT JOIN (
SELECT area_cd, cluster, SUM(cnt) AS sum_cnt
FROM exitpoll_2022le.dbo.TMP_CLUSTER_DATA
WHERE LEFT(sect, 2) = '00' AND cand_party_cd != '00'
GROUP BY area_cd, cluster
) B ON A.area_cd = B.area_cd AND A.cluster = B.cluster LEFT JOIN exitpoll_2022le.dbo.TMP_WEIGHT_GA WGA
ON A.area_cd = WGA.area_cd AND A.cluster = WGA.cluster AND A.sect = WGA.sect
-- @@@@@ 12. TMP_CLUSTER_DATA의 득표수에 계산된 TMP_PRE_P5N_RATIO의 가중치를 적용해서 TMP_PRE_P5N_CNT에 넣는다
-- 성연령별 가중치 적용 (사전, 5시 이후)
SELECT A.area_cd, A.cluster, A.cand_party, A.cand_party_cd, A.sect, A.sect_str, sum_cnt, n_cnt, cnt,
(sum_cnt-n_cnt) * pre_ratio AS pre_sum, cnt * pre_ratio AS pre_cnt,
(sum_cnt-n_cnt) * p5n_ratio AS p5n_sum, cnt * p5n_ratio AS p5n_cnt
INTO exitpoll_2022le.dbo.TMP_PRE_P5N_CNT
FROM
(
SELECT area_cd, cluster, cand_party, LEFT(sect, 2) AS sect, sect AS sect_str, cand_party_cd, sum_cnt, cnt
FROM exitpoll_2022le.dbo.TMP_CLUSTER_DATA
WHERE (LEFT(sect, 2) BETWEEN '11' AND '16' OR LEFT(sect, 2) BETWEEN '21' AND '26') AND cand_party_cd != '00'
) A LEFT JOIN exitpoll_2022le.dbo.TMP_PRE_P5N_RATIO B ON A.area_cd = B.area_cd AND A.cluster = B.cluster AND A.sect = B.sect
LEFT JOIN
(
SELECT area_cd, cluster, LEFT(sect, 2) AS sect, sect AS sect_str, cnt AS n_cnt
FROM exitpoll_2022le.dbo.TMP_CLUSTER_DATA
WHERE (LEFT(sect, 2) BETWEEN '11' AND '16' OR LEFT(sect, 2) BETWEEN '21' AND '26') AND cand_party_cd = '00'
) C ON A.area_cd = C.area_cd AND A.cluster = C.cluster AND A.sect = C.sect
-- @@@@@ 13. TMP_OUTPUT_DDAY 초기화
DELETE FROM exitpoll_2022le.dbo.TMP_OUTPUT_DDAY
WHERE cand_party = #{f_cand_party}
<if test="f_local == 'CHOICE'">
AND area_cd = #{area_cd}
</if>
-- @@@@@ 14. TMP_PRE_P5N_CNT을 사용하여 층 X 후보(정당) X 옵션 별 count를 계산하여 TMP_OUTPUT_DDAY에 넣는다
INSERT INTO exitpoll_2022le.dbo.TMP_OUTPUT_DDAY
/*
당일 옵션
01 성연령 보정
02 거절자 제외
03 열세자 95%(성/연령)
04 열세자 90%(성/연령)
05 열세자 85%(성/연령)
06 열세자 80%(성/연령)
*/
SELECT area_cd, cluster, cand_party, sect, cand_party_cd, option_cd, sum_cnt, case when cnt <![CDATA[<]]> 0 then 0 else cnt end as cnt
FROM
(
-- 01. 후보(정당) 무응답 제외 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
SELECT area_cd, cluster, cand_party, sect, cand_party_cd, '01' AS option_cd, sum_cnt - n_cnt AS sum_cnt, cnt
FROM exitpoll_2022le.dbo.TMP_PRE_P5N_CNT
UNION ALL
-- 01.성연령 보정 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
SELECT area_cd, cluster, cand_party, sect, cand_party_cd, '02' AS option_cd, sum_cnt,
CASE cnt WHEN 0 THEN 0 ELSE n_cnt * cnt / (sum_cnt - n_cnt) + cnt END AS cnt
FROM exitpoll_2022le.dbo.TMP_PRE_P5N_CNT
UNION ALL
-- 계층 별(성/연령)
-- 03.열세자 95%(성/연령) @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-- 04.열세자 90%(성/연령) @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-- 05.열세자 85%(성/연령) @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-- 06.열세자 80%(성/연령) @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
SELECT T.area_cd, T.cluster, T.cand_party, T.sect, T.cand_party_cd, option_cd, sum_cnt,
cnt + CASE sum_cnt - n_cnt WHEN 0 THEN 0 ELSE
CASE WHEN max_cnt IS NULL THEN
cnt / (sum_cnt - n_cnt) * n_cnt
WHEN max_cnt = cnt THEN
cnt / (sum_cnt - n_cnt) * n_cnt * weight
ELSE
CASE WHEN (sum_cnt - n_cnt) - max_cnt = 0 THEN (n_cnt - (max_cnt / (sum_cnt - n_cnt) * n_cnt * weight)) ELSE (n_cnt - (max_cnt / (sum_cnt - n_cnt) * n_cnt * weight)) * cnt / (sum_cnt - n_cnt - max_cnt) END
END
END AS cnt
FROM exitpoll_2022le.dbo.TMP_PRE_P5N_CNT T LEFT JOIN (
SELECT area_cd, cluster, cand_party, sect, cnt AS max_cnt FROM (
SELECT area_cd, cluster, cand_party, sect, cnt,
RANK() OVER(PARTITION BY area_cd, cluster, cand_party, sect ORDER BY cnt DESC) AS rnk
FROM exitpoll_2022le.dbo.TMP_PRE_P5N_CNT
) MX
WHERE rnk = 1
GROUP BY area_cd, cluster, cand_party, sect, cnt HAVING sum(rnk) = 1
) MC ON T.area_cd = MC.area_cd AND T.cand_party = MC.cand_party AND T.cluster = MC.cluster AND T.sect = MC.sect LEFT JOIN
(
SELECT 0.95 AS weight, '03' AS option_cd UNION ALL
SELECT 0.90 AS weight, '04' AS option_cd UNION ALL
SELECT 0.85 AS weight, '05' AS option_cd UNION ALL
SELECT 0.80 AS weight, '06' AS option_cd UNION ALL
SELECT 1.05 AS weight, '11' AS option_cd UNION ALL
SELECT 1.10 AS weight, '12' AS option_cd UNION ALL
SELECT 1.15 AS weight, '13' AS option_cd UNION ALL
SELECT 1.20 AS weight, '14' AS option_cd
) W ON 1=1
UNION ALL
-- 계층(성/연령) 통합
-- 07.열세자 95% @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-- 08.열세자 90% @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-- 09.열세자 85% @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-- 10.열세자 80% @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
SELECT T.area_cd, T.cluster, T.cand_party, '00' AS sect, T.cand_party_cd, option_cd, sum_cnt,
cnt + CASE cnt WHEN 0 THEN 0 ELSE
CASE WHEN max_cnt = cnt THEN
max_cnt / (sum_cnt - n_cnt) * n_cnt * weight
ELSE
(n_cnt - (max_cnt / (sum_cnt - n_cnt) * n_cnt * weight)) * cnt / (sum_cnt - n_cnt - max_cnt)
END
END AS cnt
FROM (
SELECT area_cd, cluster, cand_party, cand_party_cd, sum(sum_cnt) AS sum_cnt, sum(n_cnt) AS n_cnt, sum(cnt) AS cnt
FROM exitpoll_2022le.dbo.TMP_PRE_P5N_CNT
GROUP BY area_cd, cluster, cand_party, cand_party_cd
) T LEFT JOIN (
SELECT area_cd, cluster, cand_party, cnt AS max_cnt FROM (
SELECT area_cd, cluster, cand_party, sum(cnt) AS cnt,
RANK() OVER(PARTITION BY area_cd, cluster, cand_party ORDER BY sum(cnt) DESC) AS rnk
FROM exitpoll_2022le.dbo.TMP_PRE_P5N_CNT
GROUP BY area_cd, cluster, cand_party, cand_party_cd
) MX
WHERE rnk = 1
GROUP BY area_cd, cluster, cand_party, cnt HAVING sum(rnk) = 1
) MC ON T.area_cd = MC.area_cd AND T.cand_party = MC.cand_party AND T.cluster = MC.cluster LEFT JOIN
(
SELECT 0.95 AS weight, '07' AS option_cd UNION ALL
SELECT 0.90 AS weight, '08' AS option_cd UNION ALL
SELECT 0.85 AS weight, '09' AS option_cd UNION ALL
SELECT 0.80 AS weight, '10' AS option_cd UNION ALL
SELECT 1.05 AS weight, '15' AS option_cd UNION ALL
SELECT 1.10 AS weight, '16' AS option_cd UNION ALL
SELECT 1.15 AS weight, '17' AS option_cd UNION ALL
SELECT 1.20 AS weight, '18' AS option_cd
) W ON 1=1
) DO
<if test="f_local == 'CHOICE'">
WHERE area_cd = #{area_cd}
</if>
-- @@@@@ 15. TMP_OUTPUT_PRE 초기화
DELETE FROM exitpoll_2022le.dbo.TMP_OUTPUT_PRE
WHERE cand_party = #{f_cand_party}
<if test="f_local == 'CHOICE'">
AND area_cd = #{area_cd}
</if>
-- @@@@@ 14. TMP_PRE_P5N_CNT을 사용하여 층 X 후보(정당) X 사전 조사 옵션 별 count를 계산하여 TMP_OUTPUT_PRE에 넣는다
INSERT INTO exitpoll_2022le.dbo.TMP_OUTPUT_PRE
-- 선거구 - 후보별 사전투표율 옵션 1~9
/*
01 전화조사 판별(선관위 성by연령 반영)_DCO
02 전화조사 판별(전체)_DCO
03 전화조사 성by연령 repercent(선관위 성by연령 반영)_DCO
04 출구조사 0% (출구조사 사용, 선관위 성by연령 구성비)_이전과 동일
05 출구조사 1% (출구조사 사용, 특정후보 1% 추가, 나머지 타후보 비율배분)
06 출구조사 2% (출구조사 사용, 특정후보 2% 추가, 나머지 타후보 비율배분)
07 출구조사 3% (출구조사 사용, 특정후보 3% 추가, 나머지 타후보 비율배분)
08 출구조사 5% (출구조사 사용, 특정후보 5% 추가, 나머지 타후보 비율배분)
09 출구조사 7% (출구조사 사용, 특정후보 7% 추가, 나머지 타후보 비율배분)
10 출구조사 9% (출구조사 사용, 특정후보 9% 추가, 나머지 타후보 비율배분)
11 출구조사 11% (출구조사 사용, 특정후보 11% 추가, 나머지 타후보 비율배분)
12 출구조사 13% (출구조사 사용, 특정후보 13% 추가, 나머지 타후보 비율배분)
*/
SELECT area_cd, cand_party, cand_party_cd, option_cd, vote_rate
FROM (
SELECT area_cd, cand_party, option_cd, cand_party_cd, vote_rate FROM exitpoll_2022le.dbo.F_PRE WHERE cand_party = #{f_cand_party} UNION ALL
SELECT TPP.area_cd, cand_party, option_cd, TPP.cand_party_cd, CASE SUM(pre_cnt) WHEN 0 THEN 0.0 ELSE
SUM(pre_cnt) / SUM(pre_sum) * 100
+ CASE WHEN TPC.sel_pre_cnt IS NULL THEN weight_rate ELSE -1 * SUM(pre_cnt) / (SUM(pre_sum) - TPC.sel_pre_cnt) * weight_rate END END AS vote_rate
FROM exitpoll_2022le.dbo.TMP_PRE_P5N_CNT TPP LEFT JOIN (
SELECT FPC.area_cd, FPC.cand_party_cd, SUM(pre_cnt) AS sel_pre_cnt
FROM exitpoll_2022le.dbo.F_PRE_CAND FPC JOIN exitpoll_2022le.dbo.TMP_PRE_P5N_CNT TPPC
ON FPC.area_cd = TPPC.area_cd AND FPC.cand_party = #{f_cand_party} AND FPC.cand_party_cd = TPPC.cand_party_cd
GROUP BY FPC.area_cd, FPC.cand_party_cd
) TPC
ON TPP.area_cd = TPC.area_cd AND TPP.cand_party_cd != TPC.cand_party_cd LEFT JOIN
(
SELECT number + CASE WHEN number > 3 THEN number - 3 ELSE 0 END AS weight_rate, FORMAT(number+4, '00') AS option_cd
FROM master..spt_values
WHERE type = 'P' and 9 > number
) OPT ON 1=1
GROUP BY TPP.area_cd, cand_party, option_cd, weight_rate, TPP.cand_party_cd, TPC.sel_pre_cnt
) T
<if test="f_local == 'CHOICE'">
WHERE area_cd = #{area_cd}
</if>
-- @@@@@ 16. F_output 초기화
-- 최종 예측치
DELETE FROM exitpoll_2022le.dbo.F_output
WHERE cand_party = #{f_cand_party}
<if test="f_local == 'CHOICE'">
AND area_cd = #{area_cd}
</if>
-- @@@@@ 17. 층 X 후보(정당) X 옵션 별로 사전조사 득표율 * 사전조사 웨이팅, 당일조사 득표율 * 당일조사 웨이팅을 합하여 F_output에 넣는다
-- poll_pre 사전 조사 웨이팅 , poll_5p 5시이전 웨이팅 , poll_5n 5시 이후 웨이팅(0)
INSERT INTO exitpoll_2022le.dbo.F_output
SELECT DD.area_cd, DD.cand_party, PR.option_cd AS pre_option_cd, DD.option_cd, DD.cand_party_cd,
ISNULL(SUM(
cluster_weight * (
PR.vote_rate * poll_pre +
<if test="time_band == 8">
DD.vote_rate * (CONVERT(NUMERIC(12, 10), poll_5p) + CONVERT(NUMERIC(12, 10), poll_5n))
</if>
<if test="time_band != 8">
DD.vote_rate * poll_5p +
PN.vote_rate * poll_5n
</if>
)
), 0) AS vote_rate
FROM
(
SELECT area_cd, cluster, cand_party, cand_party_cd, option_cd, CASE sum(cnt) WHEN 0 THEN 0.0 ELSE sum(cnt) / sum(sum_cnt) * 100 END AS vote_rate
FROM exitpoll_2022le.dbo.TMP_OUTPUT_DDAY
WHERE cand_party = #{f_cand_party}
GROUP BY area_cd, cluster, cand_party, cand_party_cd, option_cd
) DD LEFT JOIN exitpoll_2022le.dbo.TMP_OUTPUT_PRE PR
ON DD.area_cd = PR.area_cd AND DD.cand_party = PR.cand_party AND DD.cand_party_cd = PR.cand_party_cd LEFT JOIN
(
SELECT area_cd, cand_party, cand_party_cd,
CASE SUM(p5n_cnt) WHEN 0 THEN 0.0 ELSE SUM(p5n_cnt) / SUM(p5n_sum) * 100 END AS vote_rate
FROM exitpoll_2022le.dbo.TMP_PRE_P5N_CNT
GROUP BY area_cd, cand_party, cand_party_cd
) PN ON DD.area_cd = PN.area_cd AND DD.cand_party = PN.cand_party AND DD.cand_party_cd = PN.cand_party_cd
LEFT JOIN exitpoll_2022le.dbo.F_weight W ON DD.area_cd = W.area_cd AND DD.cluster = W.cluster
<if test="f_local == 'CHOICE'">
WHERE DD.area_cd = #{area_cd}
</if>
GROUP BY DD.area_cd, DD.cand_party, PR.option_cd, DD.option_cd, DD.cand_party_cd
union all
<!-- 비례정당을 위한 사전 옵션 및 가중치 적용 안된 데이터들 - 박준성 -->
select DD.area_cd, DD.cand_party, '00' AS pre_option_cd, DD.option_cd, DD.cand_party_cd,
ISNULL(SUM(
cluster_weight * (
<if test="time_band == 8">
DD.vote_rate * (CONVERT(NUMERIC(12, 10), new_5p) + CONVERT(NUMERIC(12, 10), new_5n))
</if>
<if test="time_band != 8">
DD.vote_rate * new_5p +
PN.vote_rate * new_5n
</if>
)
), 0) AS vote_rate
from
(
SELECT area_cd, cluster, cand_party, cand_party_cd, option_cd, CASE sum(cnt) WHEN 0 THEN 0.0 ELSE sum(cnt) / sum(sum_cnt) * 100 END AS vote_rate
FROM exitpoll_2022le.dbo.TMP_OUTPUT_DDAY
WHERE cand_party = #{f_cand_party}
GROUP BY area_cd, cluster, cand_party, cand_party_cd, option_cd
) DD LEFT JOIN
(
SELECT area_cd, cand_party, cand_party_cd,
CASE SUM(p5n_cnt) WHEN 0 THEN 0.0 ELSE SUM(p5n_cnt) / SUM(p5n_sum) * 100 END AS vote_rate
FROM exitpoll_2022le.dbo.TMP_PRE_P5N_CNT
GROUP BY area_cd, cand_party, cand_party_cd
) PN ON DD.area_cd = PN.area_cd AND DD.cand_party = PN.cand_party AND DD.cand_party_cd = PN.cand_party_cd
LEFT JOIN exitpoll_2022le.dbo.F_weight W ON DD.area_cd = W.area_cd AND DD.cluster = W.cluster
<if test="f_local == 'CHOICE'">
WHERE DD.area_cd = #{area_cd}
</if>
GROUP BY DD.area_cd, DD.cand_party, DD.option_cd, DD.cand_party_cd
<!-- 비례정당을 위한 사전 옵션 및 가중치 적용 안된 데이터들 - 박준성 -->
<if test="f_cand_party == 'CAND'">
union all
SELECT area_cd, 'CAND', option_cd, '00',cand_party_cd,vote_rate
FROM exitpoll_2022le.dbo.TMP_OUTPUT_PRE
WHERE cand_party = 'CAND'
<if test="f_local == 'CHOICE'">
and area_cd = #{area_cd}
</if>
</if>
DELETE exitpoll_2022le.dbo.F_output_time WHERE cand_party = #{f_cand_party} and time_band = #{time_band}
<if test="f_local == 'CHOICE'">
and area_cd = #{area_cd}
</if>
INSERT INTO exitpoll_2022le.dbo.F_output_time
SELECT #{time_band} as time_band, area_cd, cand_party, pre_option_cd, option_cd, cand_party_cd,vote_rate
FROM exitpoll_2022le.dbo.F_output
WHERE cand_party = #{f_cand_party}
<if test="f_local == 'CHOICE'">
and area_cd = #{area_cd}
</if>
SET NOCOUNT OFF
<!-- 보고서 1 투표구별 자료 -->
SELECT TEP.area_cd, cluster, cluster_nm, TEP.subarea_cd, subarea_nm,
CASE TEP.cand_party_cd WHEN '00' THEN '999' ELSE TEP.cand_party_cd END as cand_party_cd,
<if test="f_cand_party == 'CAND'"> ISNULL(CASE WHEN C.quit = '1' then C.cand_nm + ' (사퇴)' else C.cand_nm end, '무응답') AS cand_nm, </if>
<if test="f_cand_party == 'PARTY'"> ISNULL(p.party_nm, '무응답') AS cand_nm, </if>
<if test="f_cand_party == 'EDU'"> ISNULL(E.edu_nm, '무응답') AS cand_nm, </if>
ISNULL(P.party_nm, '무응답') AS party_nm, SUM(cnt) AS cnt
FROM
exitpoll_2022le.dbo.TMP_EXIT_POLL TEP LEFT JOIN exitpoll_2022le.dbo.F_subarea SA
ON TEP.area_cd = SA.area_cd AND TEP.subarea_cd = SA.subarea_cd
<if test="f_cand_party == 'CAND'">
LEFT JOIN exitpoll_2022le.dbo.F_cand C ON TEP.area_cd = C.area_cd AND TEP.cand_party_cd = C.cand_cd
</if>
<if test="f_cand_party == 'EDU'">
LEFT JOIN exitpoll_2022le.dbo.F_Edu E ON TEP.area_cd = E.area_cd AND TEP.cand_party_cd = E.edu_cd AND E.quit = '0'
</if>
LEFT JOIN exitpoll_2022le.dbo.F_party P ON
<if test="f_cand_party == 'CAND'"> C.party_cd </if>
<if test="f_cand_party == 'PARTY'"> TEP.cand_party_cd </if>
<if test="f_cand_party == 'EDU'"> '99' </if>
= P.party_cd
WHERE (TEP.cand_party_cd = '00' OR P.party_nm IS NOT NULL)
GROUP BY TEP.area_cd, cluster, cluster_nm, TEP.subarea_cd, subarea_nm,
TEP.cand_party_cd, P.party_nm
<if test="f_cand_party == 'CAND'"> ,C.cand_nm, C.quit </if>
<if test="f_cand_party == 'EDU'"> ,E.edu_nm </if>
ORDER BY TEP.area_cd, SA.cluster, TEP.subarea_cd, CASE TEP.cand_party_cd WHEN '00' THEN '999' ELSE TEP.cand_party_cd END
<!-- 보고서 1 -->
<!-- 보고서 2 -->
SELECT area_cd, cluster, cluster_nm, sect, cand_party_cd, ROUND(sum(sum_cnt), 0) AS sum_cnt,
CASE WHEN sum(sum_cnt) = 0 THEN 0 ELSE ROUND(sum(cnt) / sum(sum_cnt) * 100.00, 1) END AS rate
FROM
(
SELECT area_cd, cluster, cluster_nm,
CASE sect
WHEN '10_남자' THEN '001_남자'
WHEN '20_여자' THEN '002_여자'
ELSE sect END as sect,
CASE cand_party_cd WHEN '00' THEN '999' ELSE cand_party_cd END as cand_party_cd,
sum_cnt, cnt
FROM exitpoll_2022le.dbo.TMP_CLUSTER_DATA
) T
GROUP BY area_cd, cluster, cluster_nm, sect, cand_party_cd
ORDER BY area_cd, cluster, sect, cand_party_cd
<!-- 보고서 2 -->
<!-- 보고서 3-->
SELECT P5P.area_cd, P5P.cand_party_cd, p5p_rate, pre_rate, p5n_rate
FROM
(
SELECT area_cd, cand_party_cd, ROUND(CASE sum(cnt) WHEN 0 THEN 0.0 ELSE sum(cnt) / sum(sum_cnt) * 100 END, 1) AS p5p_rate,
ROUND(CASE SUM(p5n_cnt) WHEN 0 THEN 0.0 ELSE SUM(p5n_cnt) / SUM(p5n_sum) * 100 END, 1) AS p5n_rate
FROM exitpoll_2022le.dbo.TMP_PRE_P5N_CNT
GROUP BY area_cd, cand_party_cd
UNION ALL
SELECT area_cd, '999', ROUND(CASE sum(n_cnt) WHEN 0 THEN 0.0 ELSE sum(n_cnt) / sum(sum_cnt) * 100 END, 1), NULL
FROM exitpoll_2022le.dbo.TMP_PRE_P5N_CNT
GROUP BY area_cd
) P5P LEFT JOIN (
SELECT area_cd, cand_party_cd,
JSON_QUERY('[' + STRING_AGG('{"option_cd":"' + option_cd + '","vote_rate":"' + FORMAT(ROUND(vote_rate, 1), '#0.0') + '"}', ',') + ']') AS pre_rate
FROM exitpoll_2022le.dbo.TMP_OUTPUT_PRE
WHERE cand_party = #{f_cand_party}
GROUP BY area_cd, cand_party_cd
) PRE ON P5P.area_cd = PRE.area_cd AND P5P.cand_party_cd = PRE.cand_party_cd
ORDER BY P5P.area_cd, P5P.cand_party_cd
<!-- 보고서 3-->
<!-- 보고서 4 -->
<!-- 최종 선택된 옵션과 옵션 기준 득표율 (chk = '1' 선택, chk = '0' 미선택) -->
SELECT OP.area_cd, OP.cand_party, OP.option_cd, OP.cand_party_cd,
ROUND(vote_rate, 1) as vote_rate, CASE WHEN OO.area_cd IS NULL THEN '0' ELSE '1' END AS chk
FROM exitpoll_2022le.dbo.F_output OP
LEFT JOIN exitpoll_2022le.dbo.F_output_option OO
ON OP.area_cd = OO.area_cd AND OO.vote_cd = '2' AND OP.option_cd =
<if test="f_cand_party == 'CAND'"> OO.cand_option_cd </if>
<if test="f_cand_party == 'PARTY'"> OO.party_option_cd </if>
<if test="f_cand_party == 'EDU'"> OO.edu_option_cd </if>
JOIN exitpoll_2022le.dbo.F_output_option POO
ON OP.area_cd = POO.area_cd AND POO.vote_cd = '1' AND OP.pre_option_cd =
<if test="f_cand_party == 'CAND'"> POO.cand_option_cd </if>
<if test="f_cand_party == 'PARTY'"> POO.party_option_cd </if>
<if test="f_cand_party == 'EDU'"> POO.edu_option_cd </if>
WHERE cand_party = #{f_cand_party}
ORDER BY OP.area_cd, OP.option_cd, OP.cand_party_cd
<!-- 보고서 4 -->
<!-- 당일 옵션 ++++ 보고서 3 뒤에 붙이기 -->
SELECT area_cd, cand_party, cand_party_cd, option_cd, FORMAT(SUM(cls_rate * cluster_weight), '#0.0') AS vote_rate
FROM
(
SELECT DD.area_cd, DD.cand_party, DD.cand_party_cd, DD.option_cd, WE.cluster, WE.cluster_weight, CASE SUM(cnt) WHEN 0 THEN 0.0 ELSE SUM(cnt) / SUM(sum_cnt) * 100 END AS cls_rate
FROM exitpoll_2022le.dbo.TMP_OUTPUT_DDAY DD LEFT JOIN exitpoll_2022le.dbo.F_Weight WE ON DD.area_cd = WE.area_cd AND DD.cluster = WE.cluster
WHERE DD.cand_party = #{f_cand_party}
GROUP BY DD.area_cd, DD.cand_party, DD.cand_party_cd, DD.option_cd, WE.cluster, WE.cluster_weight
) T
GROUP BY area_cd, cand_party, cand_party_cd, option_cd
<!-- 당일 옵션 -->
<!-- 보고서 5 -->
SELECT time_band
,OT.area_cd
,OT.cand_party
,OT.pre_option_cd
,OT.option_cd
,OT.cand_party_cd
,OT.vote_rate
FROM exitpoll_2022le.dbo.F_output_time OT
JOIN exitpoll_2022le.dbo.F_output_option OO ON OT.area_cd = OO.area_cd AND OO.vote_cd = '2' AND OT.option_cd =
<if test="f_cand_party == 'CAND'"> OO.cand_option_cd </if>
<if test="f_cand_party == 'PARTY'"> OO.party_option_cd </if>
<if test="f_cand_party == 'EDU'"> OO.edu_option_cd </if>
JOIN exitpoll_2022le.dbo.F_output_option POO ON OT.area_cd = POO.area_cd AND POO.vote_cd = '1' AND OT.pre_option_cd =
<if test="f_cand_party == 'CAND'"> POO.cand_option_cd </if>
<if test="f_cand_party == 'PARTY'"> POO.party_option_cd </if>
<if test="f_cand_party == 'EDU'"> POO.edu_option_cd </if>
where OT.cand_party = #{f_cand_party}
ORDER BY OT.area_cd, OT.option_cd, OT.cand_party_cd
<!-- 보고서 5 -->
</select>
<select id="getLastReport" resultMap="AnalysisVo">
<!-- 보고서 4 -->
<!-- 최종 선택된 옵션과 옵션 기준 득표율 (chk = '1' 선택, chk = '0' 미선택) -->
SELECT OP.area_cd, OP.cand_party, OP.option_cd, OP.cand_party_cd,
ROUND(vote_rate, 1) as vote_rate, CASE WHEN OO.area_cd IS NULL THEN '0' ELSE '1' END AS chk
FROM exitpoll_2022le.dbo.F_output OP
LEFT JOIN exitpoll_2022le.dbo.F_output_option OO
ON OP.area_cd = OO.area_cd AND OO.vote_cd = '2' AND OP.option_cd =
<if test="f_cand_party == 'CAND'"> OO.cand_option_cd </if>
<if test="f_cand_party == 'PARTY'"> OO.party_option_cd </if>
<if test="f_cand_party == 'EDU'"> OO.edu_option_cd </if>
JOIN exitpoll_2022le.dbo.F_output_option POO
ON OP.area_cd = POO.area_cd AND POO.vote_cd = '1' AND OP.pre_option_cd =
<if test="f_cand_party == 'CAND'"> POO.cand_option_cd </if>
<if test="f_cand_party == 'PARTY'"> POO.party_option_cd </if>
<if test="f_cand_party == 'EDU'"> POO.edu_option_cd </if>
WHERE cand_party = #{f_cand_party}
ORDER BY OP.area_cd, OP.option_cd, OP.cand_party_cd
<!-- 보고서 4 -->
</select>
<select id="getTimeReport" resultMap="AnalysisVo">
<!-- 보고서 5 -->
SELECT time_band
,OT.area_cd
,OT.cand_party
,OT.pre_option_cd
,OT.option_cd
,OT.cand_party_cd
,OT.vote_rate
FROM exitpoll_2022le.dbo.F_output_time OT
JOIN exitpoll_2022le.dbo.F_output_option OO ON OT.area_cd = OO.area_cd AND OO.vote_cd = '2' AND OT.option_cd =
<if test="f_cand_party == 'CAND'"> OO.cand_option_cd </if>
<if test="f_cand_party == 'PARTY'"> OO.party_option_cd </if>
<if test="f_cand_party == 'EDU'"> OO.edu_option_cd </if>
JOIN exitpoll_2022le.dbo.F_output_option POO ON OT.area_cd = POO.area_cd AND POO.vote_cd = '1' AND OT.pre_option_cd =
<if test="f_cand_party == 'CAND'"> POO.cand_option_cd </if>
<if test="f_cand_party == 'PARTY'"> POO.party_option_cd </if>
<if test="f_cand_party == 'EDU'"> POO.edu_option_cd </if>
where OT.cand_party = #{f_cand_party}
ORDER BY OT.area_cd, OT.option_cd, OT.cand_party_cd
<!-- 보고서 5 -->
</select>
<select id="getOutputFinalDataCnt" resultType="integer">
SELECT count(*) as cnt FROM exitpoll_2022le.dbo.F_output_final
WHERE CAND_PARTY = #{f_cand_party}
</select>
<insert id="putOutputFinalData">
INSERT INTO exitpoll_2022le.dbo.F_output_final
SELECT OP.area_cd, OP.cand_party, OP.pre_option_cd, OP.option_cd,
CASE OP.cand_party_cd WHEN '00' THEN '999' ELSE OP.cand_party_cd END as cand_party_cd,
vote_rate
FROM exitpoll_2022le.dbo.F_output OP
JOIN exitpoll_2022le.dbo.F_output_option OO
ON OP.area_cd = OO.area_cd AND OO.vote_cd = '2' AND OP.option_cd =
<if test="f_cand_party == 'CAND'"> OO.cand_option_cd </if>
<if test="f_cand_party == 'PARTY'"> OO.party_option_cd </if>
<if test="f_cand_party == 'EDU'"> OO.edu_option_cd </if>
JOIN exitpoll_2022le.dbo.F_output_option POO
ON OP.area_cd = POO.area_cd AND POO.vote_cd = '1' AND OP.pre_option_cd =
<if test="f_cand_party == 'CAND'"> POO.cand_option_cd </if>
<if test="f_cand_party == 'PARTY'"> '00' </if> <!-- 비례정당은 사전 옵션 사용 X -->
<if test="f_cand_party == 'EDU'"> POO.edu_option_cd </if>
WHERE cand_party = #{f_cand_party}
ORDER BY OP.area_cd, OP.option_cd, CASE OP.cand_party_cd WHEN '00' THEN '999' ELSE OP.cand_party_cd END
</insert>
<select id="getOutputFinalData" resultMap="AnalysisVo">
<if test="f_cand_party == 'PARTY'">
SELECT B.*, A.PARTY_NM FROM
(
SELECT PARTY_CD, PARTY_NM FROM exitpoll_2022le.dbo.F_PARTY WHERE PARTY_YN = '1'
) A
LEFT JOIN
(
</if>
SELECT OPF.area_cd, AR.area_nm, OPF.cand_party, OPF.pre_option_cd
<if test="f_cand_party == 'PARTY'"> <!-- 비례정당은 사전 옵션 사용 X -->
, 'X' AS pre_option_nm
</if>
<if test="f_cand_party != 'PARTY'"> <!-- 비례정당은 사전 옵션 사용 X -->
, O1.option_nm AS pre_option_nm
</if>
, OPF.option_cd, O2.option_nm, OPF.cand_party_cd, OPF.vote_rate
FROM exitpoll_2022le.dbo.F_output_final OPF
INNER JOIN exitpoll_2022le.dbo.F_area AR
ON OPF.area_cd = AR.area_cd
<if test="f_cand_party != 'PARTY'"> <!-- 비례정당은 사전 옵션 사용 X -->
INNER JOIN exitpoll_2022le.dbo.F_option O1
ON OPF.pre_option_cd = O1.option_cd AND O1.vote_cd = '1'
</if>
INNER JOIN exitpoll_2022le.dbo.F_option O2
ON OPF.option_cd = O2.option_cd AND O2.vote_cd = '2'
WHERE OPF.CAND_PARTY = #{f_cand_party}
<if test="f_cand_party == 'PARTY'">
) B ON A.PARTY_CD = B.CAND_PARTY_CD
</if>
</select>
<update id="editOutputFinalData">
UPDATE exitpoll_2022le.dbo.F_output_final
SET vote_rate = #{vote_rate}
WHERE AREA_CD = #{area_cd}
AND cand_party = #{f_cand_party}
AND cand_party_cd = #{cand_party_cd}
</update>
<delete id="dataInitialization">
DELETE exitpoll_2022le.dbo.F_output_final
WHERE cand_party = #{f_cand_party}
</delete>
<select id="optionCompare" resultMap="AnalysisVo">
SELECT OPF.area_cd, OO.vote_cd, CASE WHEN OO.vote_cd = '1' THEN OPF.pre_option_cd ELSE OPF.option_cd END option_cd,
<if test="f_cand_party == 'CAND'"> OO.cand_option_cd as final_option_cd </if>
<if test="f_cand_party == 'PARTY'"> OO.party_option_cd as final_option_cd </if>
<if test="f_cand_party == 'EDU'"> OO.edu_option_cd as final_option_cd </if>
FROM exitpoll_2022le.dbo.F_output_final OPF
INNER JOIN exitpoll_2022le.dbo.F_output_option OO
ON OPF.area_cd = OO.area_cd
WHERE OPF.cand_party = #{f_cand_party}
GROUP BY OPF.AREA_CD, OO.vote_cd, OPF.pre_option_cd, OPF.option_cd,
<if test="f_cand_party == 'CAND'"> OO.CAND_OPTION_CD </if>
<if test="f_cand_party == 'PARTY'"> OO.party_option_cd </if>
<if test="f_cand_party == 'EDU'"> OO.edu_option_cd </if>
</select>
<update id="editOptionCommitFinalData">
UPDATE exitpoll_2022le.dbo.F_output_final
SET
<if test="vote_cd == 1">
pre_option_cd = B.pre_option_cd,
</if>
<if test="vote_cd == 2">
option_cd = B.option_cd,
</if>
vote_rate = B.vote_rate
FROM exitpoll_2022le.dbo.F_output_final A
LEFT JOIN exitpoll_2022le.dbo.F_output B
ON A.area_cd = B.area_cd
AND A.cand_party = B.cand_party
AND A.cand_party_cd = B.cand_party_cd
WHERE A.area_cd = #{area_cd}
AND A.cand_party = #{f_cand_party}
<if test="vote_cd == 1">
AND B.pre_option_cd = #{option_cd}
</if>
<if test="vote_cd == 2">
AND B.option_cd = #{option_cd}
</if>
</update>
<update id="editOptionRollback">
UPDATE exitpoll_2022le.dbo.F_output_option
<if test="f_cand_party == 'CAND'"> SET cand_option_cd = #{option_cd} </if>
<if test="f_cand_party == 'PARTY'"> SET party_option_cd = #{option_cd} </if>
<if test="f_cand_party == 'EDU'"> SET edu_option_cd = #{option_cd} </if>
WHERE area_cd = #{area_cd}
AND vote_cd = #{vote_cd}
</update>
<insert id="insertHtml">
INSERT INTO exitpoll_2022le.dbo.F_HTML(search_req, html_str, insert_user) VALUES (#{search_req}, #{html_str}, #{insert_user});
</insert>
<select id="historyDate" resultMap="AnalysisVo">
SELECT id, search_req, CONVERT(varchar(19), insert_date, 120) as insert_date
FROM exitpoll_2022le.dbo.F_HTML
WHERE flag = '1'
ORDER BY insert_date DESC
</select>
<select id="historyHtml" resultMap="AnalysisVo">
SELECT html_str FROM exitpoll_2022le.dbo.F_HTML WHERE id = #{id}
</select>
<update id="deleteHistory">
UPDATE exitpoll_2022le.dbo.F_HTML
SET flag = '0', update_date = getdate()
WHERE id = #{id}
</update>
</mapper>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="kr.co.kr.dao.MainDao">
<select id="getCount" resultType="kr.co.kr.vo.MainVo">
SELECT 1 as cnt
</select>
</mapper>

View File

@@ -0,0 +1,532 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="kr.co.kr.dao.TransmissionDao">
<resultMap id="TransmissionVo" type="kr.co.kr.vo.TransmissionVo"></resultMap>
<select id="TranFile_1" resultMap="TransmissionVo">
<!-- 지역구 -->
<![CDATA[
WITH CLAS AS (
SELECT A.area_cd, A.cand_party, sect, A.cand_party_cd, sect_rate + clas_rate AS sect_rate, dd_rate
FROM
(
SELECT ST.area_cd, cand_party, sect, cand_party_cd, CONVERT(NUMERIC(4,1), SUM(case when sum_cnt = 0 then 0 else cnt / sum_cnt * 100 * W.cluster_weight end)) AS sect_rate
FROM
(
SELECT area_cd, cluster, cand_party, sect, cand_party_cd, sum_cnt, cnt
FROM exitpoll_2022le.dbo.TMP_OUTPUT_DDAY
WHERE option_cd = '07' and sect = '00'
) ST LEFT JOIN exitpoll_2022le.dbo.F_Weight W ON ST.area_cd = W.area_cd AND ST.cluster = W.cluster
GROUP BY ST.area_cd, cand_party, sect, cand_party_cd
) A LEFT JOIN (
SELECT area_cd, cand_party, cand_party_cd, vote_rate - CONVERT(NUMERIC(4,1), SUM(cls_rate * cluster_weight)) AS clas_rate, SUM(cls_rate * cluster_weight) AS dd_rate
FROM
(
SELECT O.area_cd, O.cand_party, O.cand_party_cd, O.vote_rate, WE.cluster, WE.cluster_weight, case when ISNULL(SUM(sum_cnt), 0) = 0 then 0 else ISNULL(SUM(cnt), 0) / ISNULL(SUM(sum_cnt), 0) * 100 end
AS cls_rate
FROM exitpoll_2022le.dbo.F_output_final O LEFT JOIN exitpoll_2022le.dbo.TMP_OUTPUT_DDAY DD
ON O.area_cd = DD.area_cd AND O.cand_party = DD.cand_party AND O.option_cd = DD.option_cd AND O.cand_party_cd = DD.cand_party_cd
LEFT JOIN exitpoll_2022le.dbo.F_Weight WE ON DD.area_cd = WE.area_cd AND DD.cluster = WE.cluster
GROUP BY O.area_cd, O.cand_party, O.cand_party_cd, O.vote_rate, WE.cluster, WE.cluster_weight
) SW
GROUP BY area_cd, cand_party, cand_party_cd, vote_rate
) B ON A.area_cd = B.area_cd AND A.cand_party = B.cand_party AND A.cand_party_cd = B.cand_party_cd
)
-- cand_party_cd - 후보코드
-- area_result - 선거구 예측코드
-- rnum - 후보순위
-- vote_rate - 후보 득표율
-- cand_result - 후보 예측코드
select out_a.area_cd, out_a.area_cd_K, out_a.area_cd_M, out_a.area_cd_S
, (select count(1) from exitpoll_2022le.dbo.f_cand c where c.area_cd=out_a.area_cd and c.quit = 0) as [cand_count]
, out_a.area_result, out_a.poll_cnt, out_a.err_limit, out_a.cand_party_cd
, CASE WHEN out_c.quit = 0 THEN out_a.cand_result else 0 end as cand_result
, CASE WHEN out_c.quit = 0 THEN out_a.rnum else 0 end as rnum
, FORMAT(out_a.vote_rate/100,'0.0000') as vote_rate
,'2' as company_code
from (
SELECT FOF.area_cd, area_cd_K, area_cd_M, area_cd_S, FOF.cand_party_cd, CONVERT(NUMERIC(5,2), vote_rate) AS vote_rate,
ROW_NUMBER() OVER(PARTITION BY FOF.area_cd, FOF.cand_party ORDER BY CONVERT(NUMERIC(5,2), vote_rate) DESC) AS rnum,
FORMAT(PE.err_limit, '0.0') AS err_limit, FORMAT(PE.poll_cnt, '00000') AS poll_cnt,
CASE WHEN rank_1 - rank_2 > PE.err_limit * 2 THEN 1
WHEN rank_1 - rank_2 <= PE.err_limit * 2 AND rank_1 - rank_3 <= PE.err_limit * 2 THEN 3
ELSE 2 END AS area_result,
CASE WHEN rank_1 - rank_2 > PE.err_limit * 2 THEN
CASE ROW_NUMBER() OVER(PARTITION BY FOF.area_cd, FOF.cand_party ORDER BY CONVERT(NUMERIC(5,2), vote_rate) DESC) WHEN 1 THEN 1 ELSE 0 END
WHEN rank_1 - rank_3 <= PE.err_limit * 2 THEN
CASE WHEN ROW_NUMBER() OVER(PARTITION BY FOF.area_cd, FOF.cand_party ORDER BY CONVERT(NUMERIC(5,2), vote_rate) DESC) <= 3 THEN 3 ELSE 0 END
WHEN rank_1 - rank_2 <= PE.err_limit * 2 THEN
CASE WHEN ROW_NUMBER() OVER(PARTITION BY FOF.area_cd, FOF.cand_party ORDER BY CONVERT(NUMERIC(5,2), vote_rate) DESC) <= 2 THEN 2 ELSE 0 END
END AS cand_result
FROM exitpoll_2022le.dbo.F_output_final FOF LEFT JOIN exitpoll_2022le.dbo.F_area FA ON FOF.area_cd = FA.area_cd
LEFT JOIN (
SELECT EP.area_cd, 'CAND' AS cand_party, count(C.area_cd) AS poll_cnt,
CASE WHEN ROUND(SQRT(2.5/count(C.area_cd)) * 100, 1) > 7.4 THEN 7.4 ELSE ROUND(SQRT(2.5/count(C.area_cd)) * 100, 1) END AS err_limit
FROM exitpoll_2022le.dbo.F_TMP_EXPOLL EP LEFT JOIN exitpoll_2022le.dbo.F_Cand C ON EP.area_cd = C.area_cd AND EP.cand_cd = C.cand_cd
GROUP BY EP.area_cd
) PE ON FA.area_cd = PE.area_cd AND FOF.cand_party = PE.cand_party LEFT JOIN (
SELECT area_cd, cand_party,
[1] AS rank_1, [2] AS rank_2, [3] AS rank_3
FROM (
SELECT ROW_NUMBER() OVER(PARTITION BY area_cd, cand_party ORDER BY CONVERT(NUMERIC(5,2), vote_rate) DESC) AS ran,
area_cd, cand_party, CONVERT(NUMERIC(5,2), vote_rate) AS vote_rate
FROM exitpoll_2022le.dbo.F_output_final
) T
PIVOT
(
MAX(vote_rate) FOR ran IN ( [1], [2], [3])
) U
) RK ON FOF.area_cd = RK.area_cd AND FOF.cand_party = RK.cand_party LEFT JOIN
(
SELECT SP.area_cd, SP.cand_party, SP.cand_party_cd, dd_rate
FROM
(
SELECT CA.area_cd, CA.cand_party, CA.sect, CA.cand_party_cd,
CASE WHEN CA.sect_rate < 0 THEN '00.0' ELSE
FORMAT(CA.sect_rate + (ISNULL(CB.minus_sect_rate, 0) * sect_rate / 100) + (CC.med_rate * sect_rate / 100), '00.0')
END AS sect_rate, CA.dd_rate
FROM CLAS CA LEFT JOIN (
SELECT area_cd, cand_party, sect, sum(sect_rate) AS minus_sect_rate FROM CLAS WHERE sect_rate < 0
GROUP BY area_cd, cand_party, sect
) CB ON CA.area_cd = CB.area_cd AND CA.cand_party = CB.cand_party AND CA.sect = CB.sect LEFT JOIN (
SELECT area_cd, cand_party, sect, 100 - sum(sect_rate) AS med_rate FROM CLAS
GROUP BY area_cd, cand_party, sect
) CC ON CA.area_cd = CC.area_cd AND CA.cand_party = CC.cand_party AND CA.sect = CC.sect
) SP
) SEC ON FOF.area_cd = SEC.area_cd AND FOF.cand_party = SEC.cand_party AND FOF.cand_party_cd = SEC.cand_party_cd LEFT JOIN
(
SELECT area_cd, cand_party, cand_party_cd, vote_rate AS pre_rate
FROM exitpoll_2022le.dbo.TMP_OUTPUT_PRE A
WHERE option_cd = (SELECT TOP 1 pre_option_cd FROM exitpoll_2022le.dbo.F_output_final WHERE area_cd = A.area_cd AND cand_party = A.cand_party)
) PRE ON FOF.area_cd = PRE.area_cd AND FOF.cand_party = PRE.cand_party AND FOF.cand_party_cd = PRE.cand_party_cd
where FOF.cand_party = 'CAND'
)out_a
inner join exitpoll_2022le.dbo.f_cand out_c on out_a.area_cd = out_c.area_cd and out_a.cand_party_cd = out_c.cand_cd
order by area_cd,cand_party_cd
]]>
</select>
<select id="TranFile_2" resultMap="TransmissionVo">
<!-- 비례정당 -->
SELECT FOF.area_cd
, FOF.cand_party_cd
, party_cd_K AS cand_party_cd_K, party_cd_M AS cand_party_cd_M, party_cd_S AS cand_party_cd_S
, cast(vote_rate as float)/100 AS vote_rate, '2' as company_code
FROM exitpoll_2022le.dbo.F_output_final FOF
inner join exitpoll_2022le.dbo.F_party FP on FOF.cand_party_cd=FP.party_cd
where FOF.cand_party = 'PARTY'
ORDER BY FOF.area_cd, FOF.cand_party_cd
</select>
<select id="TranFile_10" resultMap="TransmissionVo">
<!-- 사전투표 득표율 vs. 당일투표 득표율 -->
select area_cd, area_cd_K, area_cd_M, area_cd_S, vote_type, cand_party_cd, vote_rate, company_code
from (
SELECT F.area_cd,
A.area_cd_K,
a.area_cd_M,
a.area_cd_S,
'1' as vote_type,
F.cand_party_cd,
format(cast(F.vote_rate as float)/100,'0.000') as vote_rate,
'2' as company_code
FROM exitpoll_2022le.dbo.F_output F
inner join exitpoll_2022le.dbo.F_output_option FO on F.area_cd=FO.area_cd and F.pre_option_cd=FO.cand_option_cd
AND FO.vote_cd = '1'
LEFT JOIN exitpoll_2022le.dbo.F_area A ON F.area_cd = A.area_cd
WHERE F.cand_party = 'CAND' AND F.option_cd='00'
union all
SELECT F.area_cd,
A.area_cd_K,
a.area_cd_M,
a.area_cd_S,
'2' as vote_type,
F.cand_party_cd,
format(cast(F.vote_rate as float)/100,'0.000') as vote_rate,
'2' as company_code
FROM exitpoll_2022le.dbo.F_output F
inner join exitpoll_2022le.dbo.F_output_option FO on F.area_cd=FO.area_cd and F.option_cd=FO.cand_option_cd AND
FO.vote_cd = '2'
LEFT JOIN exitpoll_2022le.dbo.F_area A ON F.area_cd = A.area_cd
WHERE F.cand_party = 'CAND' AND F.pre_option_cd='00'
) out_a
<!-- where area_cd in ('0104','0116','0134','0147','0208','0211','0403','0408','0914','0930','0936','0945','0949','0959','1102','1108','1602','1605') -->
order by area_cd,vote_type,cand_party_cd
</select>
<select id="TranFile_3" resultMap="TransmissionVo">
<!-- 지방선거 후보자별 득표율 -->
<![CDATA[
WITH CLAS AS (
SELECT A.area_cd, A.cand_party, sect, A.cand_party_cd, sect_rate + clas_rate AS sect_rate, dd_rate
FROM
(
SELECT ST.area_cd, cand_party, sect, cand_party_cd, CONVERT(NUMERIC(4,1), SUM(case when sum_cnt = 0 then 0 else cnt / sum_cnt * 100 * W.cluster_weight end)) AS sect_rate
FROM
(
SELECT area_cd, cluster, cand_party, sect, cand_party_cd, sum_cnt, cnt
FROM exitpoll_2022le.dbo.TMP_OUTPUT_DDAY
WHERE option_cd = '02' UNION ALL
SELECT area_cd, cluster, cand_party, LEFT(sect, 1) + '7' AS sect, cand_party_cd, SUM(sum_cnt) AS sum_cnt, SUM(cnt) AS cnt
FROM exitpoll_2022le.dbo.TMP_OUTPUT_DDAY
WHERE sect IN ('15','16','25','26') AND option_cd = '02'
GROUP BY area_cd, cluster, cand_party, LEFT(sect, 1) + '7', cand_party_cd UNION ALL
SELECT area_cd, cluster, cand_party, LEFT(sect, 1) + '0' AS sect, cand_party_cd, SUM(sum_cnt) AS sum_cnt, SUM(cnt) AS cnt
FROM exitpoll_2022le.dbo.TMP_OUTPUT_DDAY
WHERE option_cd = '02'
GROUP BY area_cd, cluster, cand_party, LEFT(sect, 1) + '0', cand_party_cd UNION ALL
SELECT area_cd, cluster, cand_party, '0' + RIGHT(sect, 1) AS sect, cand_party_cd, SUM(sum_cnt) AS sum_cnt, SUM(cnt) AS cnt
FROM exitpoll_2022le.dbo.TMP_OUTPUT_DDAY
WHERE option_cd = '02'
GROUP BY area_cd, cluster, cand_party, '0' + RIGHT(sect, 1), cand_party_cd UNION ALL
SELECT area_cd, cluster, cand_party, '07' AS sect, cand_party_cd, SUM(sum_cnt) AS sum_cnt, SUM(cnt) AS cnt
FROM exitpoll_2022le.dbo.TMP_OUTPUT_DDAY
WHERE sect IN ('15','16','25','26') AND option_cd = '02'
GROUP BY area_cd, cluster, cand_party, cand_party_cd
) ST LEFT JOIN exitpoll_2022le.dbo.F_Weight W ON ST.area_cd = W.area_cd AND ST.cluster = W.cluster
GROUP BY ST.area_cd, cand_party, sect, cand_party_cd
UNION ALL
SELECT area_cd, cand_party, '9'+cluster, cand_party_cd, CONVERT(NUMERIC(4,1), case when ISNULL(SUM(sum_cnt), 0) = 0 then 0 else ISNULL(SUM(cnt), 0) / ISNULL(SUM(sum_cnt), 0) * 100 end
) AS sect_rate
FROM exitpoll_2022le.dbo.TMP_OUTPUT_DDAY WHERE option_cd = '02'
GROUP BY area_cd, cand_party, '9'+cluster, cand_party_cd
) A LEFT JOIN (
SELECT area_cd, cand_party, cand_party_cd, vote_rate - CONVERT(NUMERIC(4,1), SUM(cls_rate * cluster_weight)) AS clas_rate, SUM(cls_rate * cluster_weight) AS dd_rate
FROM
(
SELECT O.area_cd, O.cand_party, O.cand_party_cd, O.vote_rate, WE.cluster, WE.cluster_weight, case when ISNULL(SUM(sum_cnt), 0) = 0 then 0 else ISNULL(SUM(cnt), 0) / ISNULL(SUM(sum_cnt), 0) * 100 end
AS cls_rate
FROM exitpoll_2022le.dbo.F_output_final O LEFT JOIN exitpoll_2022le.dbo.TMP_OUTPUT_DDAY DD
ON O.area_cd = DD.area_cd AND O.cand_party = DD.cand_party AND O.option_cd = DD.option_cd AND O.cand_party_cd = DD.cand_party_cd
LEFT JOIN exitpoll_2022le.dbo.F_Weight WE ON DD.area_cd = WE.area_cd AND DD.cluster = WE.cluster
GROUP BY O.area_cd, O.cand_party, O.cand_party_cd, O.vote_rate, WE.cluster, WE.cluster_weight
) SW
GROUP BY area_cd, cand_party, cand_party_cd, vote_rate
) B ON A.area_cd = B.area_cd AND A.cand_party = B.cand_party AND A.cand_party_cd = B.cand_party_cd
)
SELECT CASE WHEN FOF.cand_party='CAND' THEN '1' ELSE '2' END AS poll_type,
FOF.area_cd, area_cd_K, area_cd_M, area_cd_S, FOF.cand_party_cd, FORMAT(CONVERT(NUMERIC(4,1), vote_rate), '00.0') AS vote_rate,
FORMAT(ROW_NUMBER() OVER(PARTITION BY FOF.area_cd, FOF.cand_party ORDER BY CONVERT(NUMERIC(4,1), vote_rate) DESC), '00') AS rnum,
FORMAT(isnull(case when PE.err_limit >=7.5 then 7.4 else PE.err_limit end,0), '0.0') AS err_limit, FORMAT(isnull(PE.poll_cnt,0), '00000') AS poll_cnt,
CASE WHEN rank_1 - rank_2 > PE.err_limit * 2 THEN 1
WHEN rank_1 - rank_2 <= PE.err_limit * 2 AND rank_1 - rank_3 <= PE.err_limit * 2 THEN 3
ELSE 2 END AS area_result,
isnull(CASE WHEN rank_1 - rank_2 > PE.err_limit * 2 THEN
CASE ROW_NUMBER() OVER(PARTITION BY FOF.area_cd, FOF.cand_party ORDER BY CONVERT(NUMERIC(4,1), vote_rate) DESC) WHEN 1 THEN 1 ELSE 0 END
WHEN rank_1 - rank_5 <= PE.err_limit * 2 THEN
CASE WHEN ROW_NUMBER() OVER(PARTITION BY FOF.area_cd, FOF.cand_party ORDER BY CONVERT(NUMERIC(4,1), vote_rate) DESC) <= 5 THEN 3 ELSE 0 END
WHEN rank_1 - rank_4 <= PE.err_limit * 2 THEN
CASE WHEN ROW_NUMBER() OVER(PARTITION BY FOF.area_cd, FOF.cand_party ORDER BY CONVERT(NUMERIC(4,1), vote_rate) DESC) <= 4 THEN 3 ELSE 0 END
WHEN rank_1 - rank_3 <= PE.err_limit * 2 THEN
CASE WHEN ROW_NUMBER() OVER(PARTITION BY FOF.area_cd, FOF.cand_party ORDER BY CONVERT(NUMERIC(4,1), vote_rate) DESC) <= 3 THEN 3 ELSE 0 END
WHEN rank_1 - rank_2 <= PE.err_limit * 2 THEN
CASE WHEN ROW_NUMBER() OVER(PARTITION BY FOF.area_cd, FOF.cand_party ORDER BY CONVERT(NUMERIC(4,1), vote_rate) DESC) <= 2 THEN 2 ELSE 0 END
END,0) AS cand_result,
[10] as sect_10, [20] as sect_20, [01] as sect_01, [02] as sect_02, [03] as sect_03, [04] as sect_04, [07] as sect_07, [05] as sect_05, [06] as sect_06,
[11] as sect_11, [12] as sect_12, [13] as sect_13, [14] as sect_14, [17] as sect_17, [15] as sect_15, [16] as sect_16,
[21] as sect_21, [22] as sect_22, [23] as sect_23, [24] as sect_24, [27] as sect_27, [25] as sect_25, [26] as sect_26,
[91] as sect_91, [92] as sect_92, [93] as sect_93, [94] as sect_94, [95] as sect_95, [96] as sect_96, [97] as sect_97, [98] as sect_98,
FORMAT(pre_rate, '00.0') AS pre_rate,
FORMAT(dd_rate, '00.0') AS dd_rate
FROM exitpoll_2022le.dbo.F_output_final FOF LEFT JOIN exitpoll_2022le.dbo.F_area FA ON FOF.area_cd = FA.area_cd
LEFT JOIN (
SELECT EP.area_cd, 'CAND' AS cand_party, count(C.area_cd) AS poll_cnt, ROUND(SQRT(2.5/count(C.area_cd)) * 100, 1) AS err_limit
FROM exitpoll_2022le.dbo.F_TMP_EXPOLL EP LEFT JOIN exitpoll_2022le.dbo.F_Cand C ON EP.area_cd = C.area_cd AND EP.cand_cd = C.cand_cd AND C.quit = '0'
WHERE EP.area_cd != '0901'
GROUP BY EP.area_cd
UNION ALL
SELECT EP.area_cd, 'EDU' AS cand_party, count(E.area_cd) AS poll_cnt, ROUND(SQRT(2.5/count(E.area_cd)) * 100, 1) AS err_limit
FROM exitpoll_2022le.dbo.F_TMP_EXPOLL EP LEFT JOIN exitpoll_2022le.dbo.F_edu E ON EP.area_cd = E.area_cd AND EP.edu_cd = E.edu_cd AND E.quit = '0'
WHERE EP.area_cd != '0901'
GROUP BY EP.area_cd
) PE ON FA.area_cd = PE.area_cd AND FOF.cand_party = PE.cand_party LEFT JOIN (
SELECT area_cd, cand_party,
[1] AS rank_1, [2] AS rank_2, [3] AS rank_3, [4] AS rank_4, [5] AS rank_5
FROM (
SELECT ROW_NUMBER() OVER(PARTITION BY area_cd, cand_party ORDER BY CONVERT(NUMERIC(4,1), vote_rate) DESC) AS ran,
area_cd, cand_party, CONVERT(NUMERIC(4,1), vote_rate) AS vote_rate
FROM exitpoll_2022le.dbo.F_output_final
WHERE area_cd != '0901'
) T
PIVOT
(
MAX(vote_rate) FOR ran IN ( [1], [2], [3], [4], [5])
) U
) RK ON FOF.area_cd = RK.area_cd AND FOF.cand_party = RK.cand_party LEFT JOIN
(
SELECT U.area_cd, U.cand_party, U.cand_party_cd, dd_rate,
[10], [20], [01], [02], [03], [04], [07], [05], [06],
[11], [12], [13], [14], [17], [15], [16],
[21], [22], [23], [24], [27], [25], [26],
ISNULL([91], '00.0') as [91],
ISNULL([92], '00.0') as [92],
ISNULL([93], '00.0') as [93],
ISNULL([94], '00.0') as [94],
ISNULL([95], '00.0') as [95],
ISNULL([96], '00.0') as [96],
ISNULL([97], '00.0') as [97],
ISNULL([98], '00.0') as [98]
FROM
(
SELECT CA.area_cd, CA.cand_party, CA.sect, CA.cand_party_cd,
CASE WHEN CA.sect_rate < 0 THEN '00.0' ELSE
FORMAT(CA.sect_rate + (ISNULL(CB.minus_sect_rate, 0) * sect_rate / 100) + (CC.med_rate * sect_rate / 100), '00.0')
END AS sect_rate, CA.dd_rate
FROM CLAS CA LEFT JOIN (
SELECT area_cd, cand_party, sect, sum(sect_rate) AS minus_sect_rate FROM CLAS WHERE sect_rate < 0
GROUP BY area_cd, cand_party, sect
) CB ON CA.area_cd = CB.area_cd AND CA.cand_party = CB.cand_party AND CA.sect = CB.sect LEFT JOIN (
SELECT area_cd, cand_party, sect, 100 - sum(sect_rate) AS med_rate FROM CLAS
GROUP BY area_cd, cand_party, sect
) CC ON CA.area_cd = CC.area_cd AND CA.cand_party = CC.cand_party AND CA.sect = CC.sect
) SP
PIVOT
(
MAX(sect_rate) FOR sect IN (
[10], [20], [01], [02], [03], [04], [07], [05], [06],
[11], [12], [13], [14], [17], [15], [16],
[21], [22], [23], [24], [27], [25], [26],
[91], [92], [93], [94], [95], [96], [97], [98]
)
) U
WHERE U.area_cd != '0901'
) SEC ON FOF.area_cd = SEC.area_cd AND FOF.cand_party = SEC.cand_party AND FOF.cand_party_cd = SEC.cand_party_cd LEFT JOIN
(
SELECT area_cd, cand_party, cand_party_cd, vote_rate AS pre_rate
FROM exitpoll_2022le.dbo.TMP_OUTPUT_PRE A
WHERE option_cd = (SELECT TOP 1 pre_option_cd FROM exitpoll_2022le.dbo.F_output_final WHERE area_cd = A.area_cd AND cand_party = A.cand_party)
) PRE ON FOF.area_cd = PRE.area_cd AND FOF.cand_party = PRE.cand_party AND FOF.cand_party_cd = PRE.cand_party_cd
WHERE FOF.area_cd != '0901'
]]>
</select>
<select id="TranFile_4" resultMap="TransmissionVo">
<!-- 재보궐 후보자별 득표율 -->
<![CDATA[
WITH CLAS AS (
SELECT A.area_cd, A.cand_party, sect, A.cand_party_cd, sect_rate + clas_rate AS sect_rate, dd_rate
FROM
(
SELECT ST.area_cd, cand_party, sect, cand_party_cd, CONVERT(NUMERIC(4,1), SUM(case when sum_cnt = 0 then 0 else cnt / sum_cnt * 100 * W.cluster_weight end)) AS sect_rate
FROM
(
SELECT area_cd, cluster, cand_party, sect, cand_party_cd, sum_cnt, cnt
FROM exitpoll_2022le.dbo.TMP_OUTPUT_DDAY
WHERE option_cd = '02' UNION ALL
SELECT area_cd, cluster, cand_party, LEFT(sect, 1) + '7' AS sect, cand_party_cd, SUM(sum_cnt) AS sum_cnt, SUM(cnt) AS cnt
FROM exitpoll_2022le.dbo.TMP_OUTPUT_DDAY
WHERE sect IN ('15','16','25','26') AND option_cd = '02'
GROUP BY area_cd, cluster, cand_party, LEFT(sect, 1) + '7', cand_party_cd UNION ALL
SELECT area_cd, cluster, cand_party, LEFT(sect, 1) + '0' AS sect, cand_party_cd, SUM(sum_cnt) AS sum_cnt, SUM(cnt) AS cnt
FROM exitpoll_2022le.dbo.TMP_OUTPUT_DDAY
WHERE option_cd = '02'
GROUP BY area_cd, cluster, cand_party, LEFT(sect, 1) + '0', cand_party_cd UNION ALL
SELECT area_cd, cluster, cand_party, '0' + RIGHT(sect, 1) AS sect, cand_party_cd, SUM(sum_cnt) AS sum_cnt, SUM(cnt) AS cnt
FROM exitpoll_2022le.dbo.TMP_OUTPUT_DDAY
WHERE option_cd = '02'
GROUP BY area_cd, cluster, cand_party, '0' + RIGHT(sect, 1), cand_party_cd UNION ALL
SELECT area_cd, cluster, cand_party, '07' AS sect, cand_party_cd, SUM(sum_cnt) AS sum_cnt, SUM(cnt) AS cnt
FROM exitpoll_2022le.dbo.TMP_OUTPUT_DDAY
WHERE sect IN ('15','16','25','26') AND option_cd = '02'
GROUP BY area_cd, cluster, cand_party, cand_party_cd
) ST LEFT JOIN exitpoll_2022le.dbo.F_Weight W ON ST.area_cd = W.area_cd AND ST.cluster = W.cluster
GROUP BY ST.area_cd, cand_party, sect, cand_party_cd
UNION ALL
SELECT area_cd, cand_party, '9'+cluster, cand_party_cd, CONVERT(NUMERIC(4,1), case when SUM(sum_cnt) = 0 then 0.0 else SUM(cnt) / SUM(sum_cnt) * 100 end) AS sect_rate
FROM exitpoll_2022le.dbo.TMP_OUTPUT_DDAY WHERE option_cd = '02'
GROUP BY area_cd, cand_party, '9'+cluster, cand_party_cd
) A LEFT JOIN (
SELECT area_cd, cand_party, cand_party_cd, vote_rate - CONVERT(NUMERIC(4,1), SUM(cls_rate * cluster_weight)) AS clas_rate, SUM(cls_rate * cluster_weight) AS dd_rate
FROM
(
SELECT O.area_cd, O.cand_party, O.cand_party_cd, O.vote_rate, WE.cluster, WE.cluster_weight, SUM(cnt) / SUM(sum_cnt) * 100 AS cls_rate
FROM exitpoll_2022le.dbo.F_output_final O LEFT JOIN exitpoll_2022le.dbo.TMP_OUTPUT_DDAY DD
ON O.area_cd = DD.area_cd AND O.cand_party = DD.cand_party AND O.option_cd = DD.option_cd AND O.cand_party_cd = DD.cand_party_cd
LEFT JOIN exitpoll_2022le.dbo.F_Weight WE ON DD.area_cd = WE.area_cd AND DD.cluster = WE.cluster
GROUP BY O.area_cd, O.cand_party, O.cand_party_cd, O.vote_rate, WE.cluster, WE.cluster_weight
) SW
GROUP BY area_cd, cand_party, cand_party_cd, vote_rate
) B ON A.area_cd = B.area_cd AND A.cand_party = B.cand_party AND A.cand_party_cd = B.cand_party_cd
)
SELECT '3' AS poll_type,
FOF.area_cd, area_cd_K, area_cd_M, area_cd_S, FOF.cand_party_cd, FORMAT(CONVERT(NUMERIC(4,1), vote_rate), '00.0') AS vote_rate,
FORMAT(ROW_NUMBER() OVER(PARTITION BY FOF.area_cd, FOF.cand_party ORDER BY CONVERT(NUMERIC(4,1), vote_rate) DESC), '00') AS rnum,
FORMAT(case when PE.err_limit >=7.5 then 7.4 else PE.err_limit end, '0.0') AS err_limit, FORMAT(PE.poll_cnt, '0000') AS poll_cnt,
CASE WHEN rank_1 - rank_2 > PE.err_limit * 2 THEN 1
WHEN rank_1 - rank_2 <= PE.err_limit * 2 AND rank_1 - rank_3 <= PE.err_limit * 2 THEN 3
ELSE 2 END AS area_result,
CASE WHEN rank_1 - rank_2 > PE.err_limit * 2 THEN
CASE ROW_NUMBER() OVER(PARTITION BY FOF.area_cd, FOF.cand_party ORDER BY CONVERT(NUMERIC(4,1), vote_rate) DESC) WHEN 1 THEN 1 ELSE 0 END
WHEN rank_1 - rank_5 <= PE.err_limit * 2 THEN
CASE WHEN ROW_NUMBER() OVER(PARTITION BY FOF.area_cd, FOF.cand_party ORDER BY CONVERT(NUMERIC(4,1), vote_rate) DESC) <= 5 THEN 3 ELSE 0 END
WHEN rank_1 - rank_4 <= PE.err_limit * 2 THEN
CASE WHEN ROW_NUMBER() OVER(PARTITION BY FOF.area_cd, FOF.cand_party ORDER BY CONVERT(NUMERIC(4,1), vote_rate) DESC) <= 4 THEN 3 ELSE 0 END
WHEN rank_1 - rank_3 <= PE.err_limit * 2 THEN
CASE WHEN ROW_NUMBER() OVER(PARTITION BY FOF.area_cd, FOF.cand_party ORDER BY CONVERT(NUMERIC(4,1), vote_rate) DESC) <= 3 THEN 3 ELSE 0 END
WHEN rank_1 - rank_2 <= PE.err_limit * 2 THEN
CASE WHEN ROW_NUMBER() OVER(PARTITION BY FOF.area_cd, FOF.cand_party ORDER BY CONVERT(NUMERIC(4,1), vote_rate) DESC) <= 2 THEN 2 ELSE 0 END
END AS cand_result,
[10] as sect_10, [20] as sect_20, [01] as sect_01, [02] as sect_02, [03] as sect_03, [04] as sect_04, [07] as sect_07, [05] as sect_05, [06] as sect_06,
FORMAT(pre_rate, '00.0') AS pre_rate,
FORMAT(dd_rate, '00.0') AS dd_rate
FROM exitpoll_2022le.dbo.F_output_final FOF LEFT JOIN exitpoll_2022le.dbo.F_area FA ON FOF.area_cd = FA.area_cd
LEFT JOIN (
SELECT EP.area_cd, 'CAND' AS cand_party, count(C.area_cd) AS poll_cnt, ROUND(SQRT(2.5/count(C.area_cd)) * 100, 1) AS err_limit
FROM exitpoll_2022le.dbo.F_TMP_EXPOLL EP LEFT JOIN exitpoll_2022le.dbo.F_Cand C ON EP.area_cd = C.area_cd AND EP.cand_cd = C.cand_cd AND C.quit = '0'
WHERE EP.area_cd = '0901'
GROUP BY EP.area_cd
) PE ON FA.area_cd = PE.area_cd AND FOF.cand_party = PE.cand_party LEFT JOIN (
SELECT area_cd, cand_party,
[1] AS rank_1, [2] AS rank_2, [3] AS rank_3, [4] AS rank_4, [5] AS rank_5
FROM (
SELECT ROW_NUMBER() OVER(PARTITION BY area_cd, cand_party ORDER BY CONVERT(NUMERIC(4,1), vote_rate) DESC) AS ran,
area_cd, cand_party, CONVERT(NUMERIC(4,1), vote_rate) AS vote_rate
FROM exitpoll_2022le.dbo.F_output_final
WHERE area_cd = '0901'
) T
PIVOT
(
MAX(vote_rate) FOR ran IN ( [1], [2], [3], [4], [5])
) U
) RK ON FOF.area_cd = RK.area_cd AND FOF.cand_party = RK.cand_party LEFT JOIN
(
SELECT U.area_cd, U.cand_party, U.cand_party_cd, dd_rate,
[10], [20], [01], [02], [03], [04], [07], [05], [06],
[11], [12], [13], [14], [17], [15], [16],
[21], [22], [23], [24], [27], [25], [26],
ISNULL([91], '00.0') as [91],
ISNULL([92], '00.0') as [92],
ISNULL([93], '00.0') as [93],
ISNULL([94], '00.0') as [94],
ISNULL([95], '00.0') as [95],
ISNULL([96], '00.0') as [96],
ISNULL([97], '00.0') as [97],
ISNULL([98], '00.0') as [98]
FROM
(
SELECT CA.area_cd, CA.cand_party, CA.sect, CA.cand_party_cd,
CASE WHEN CA.sect_rate < 0 THEN '00.0' ELSE
FORMAT(CA.sect_rate + (ISNULL(CB.minus_sect_rate, 0) * sect_rate / 100) + (CC.med_rate * sect_rate / 100), '00.0')
END AS sect_rate, CA.dd_rate
FROM CLAS CA LEFT JOIN (
SELECT area_cd, cand_party, sect, sum(sect_rate) AS minus_sect_rate FROM CLAS WHERE sect_rate < 0
GROUP BY area_cd, cand_party, sect
) CB ON CA.area_cd = CB.area_cd AND CA.cand_party = CB.cand_party AND CA.sect = CB.sect LEFT JOIN (
SELECT area_cd, cand_party, sect, 100 - sum(sect_rate) AS med_rate FROM CLAS
GROUP BY area_cd, cand_party, sect
) CC ON CA.area_cd = CC.area_cd AND CA.cand_party = CC.cand_party AND CA.sect = CC.sect
) SP
PIVOT
(
MAX(sect_rate) FOR sect IN (
[10], [20], [01], [02], [03], [04], [07], [05], [06],
[11], [12], [13], [14], [17], [15], [16],
[21], [22], [23], [24], [27], [25], [26],
[91], [92], [93], [94], [95], [96], [97], [98]
)
) U
WHERE U.area_cd = '0901'
) SEC ON FOF.area_cd = SEC.area_cd AND FOF.cand_party = SEC.cand_party AND FOF.cand_party_cd = SEC.cand_party_cd LEFT JOIN
(
SELECT area_cd, cand_party, cand_party_cd, vote_rate AS pre_rate
FROM exitpoll_2022le.dbo.TMP_OUTPUT_PRE A
WHERE option_cd = (SELECT TOP 1 pre_option_cd FROM exitpoll_2022le.dbo.F_output_final WHERE area_cd = A.area_cd AND cand_party = A.cand_party)
) PRE ON FOF.area_cd = PRE.area_cd AND FOF.cand_party = PRE.cand_party AND FOF.cand_party_cd = PRE.cand_party_cd
WHERE FOF.area_cd = '0901'
]]>
</select>
<select id="TranFile_5" resultMap="TransmissionVo">
<!-- 전국 성/연령 응답자수 -->
SET NOCOUNT ON
IF OBJECT_ID('tempdb..#TMP_EXIT_POLL') IS NOT NULL DROP TABLE #TMP_EXIT_POLL;
--DROP TABLE #TMP_EXIT_POLL
SELECT B.area_cd, B.subarea_cd,
B.gender, B.age, cand_party,
ISNULL(T.cand_party_cd, B.cand_party_cd) AS cand_party_cd, ISNULL(T.cnt, 0) AS cnt
INTO #TMP_EXIT_POLL
FROM
(
SELECT A.area_cd, GA.gender, GA.age, SA.subarea_cd, CP.cand_party, CP.cand_party_cd
FROM exitpoll_2022le.dbo.F_area A LEFT JOIN exitpoll_2022le.dbo.F_subarea SA
ON A.area_cd = SA.area_cd LEFT JOIN (
SELECT 'CAND' AS cand_party, area_cd, cand_cd AS cand_party_cd
FROM exitpoll_2022le.dbo.F_cand WHERE quit = '0' UNION ALL
SELECT 'PARTY' AS cand_party, '0000' AS area_cd, party_cd AS cand_party_cd
FROM exitpoll_2022le.dbo.F_party WHERE party_yn = '1' UNION ALL
SELECT 'EDU' AS cand_party, area_cd, edu_cd AS cand_party_cd
FROM exitpoll_2022le.dbo.F_edu WHERE quit = '0' UNION ALL
SELECT 'CAND' AS cand_party, '0000' AS area_cd, '00' AS cand_party_cd UNION ALL
SELECT 'PARTY' AS cand_party, '0000' AS area_cd, '00' AS cand_party_cd UNION ALL
SELECT 'EDU' AS cand_party, '0000' AS area_cd, '00' AS cand_party_cd
) CP ON (A.area_cd = CP.area_cd OR CP.area_cd = '0000') AND
CP.cand_party =
'CAND'
LEFT JOIN
(
SELECT CONVERT(varchar(1), number % 3) AS gender, CONVERT(varchar(1), number / 3) AS age
FROM master..spt_values
WHERE type = 'P' and 21 > number
) GA ON 1=1
WHERE A.company = 'KRI'
) B LEFT JOIN
(
SELECT area_cd, subarea_cd, gender, age,
cand_cd
AS cand_party_cd, count(*) AS cnt
FROM exitpoll_2022le.dbo.F_TMP_EXPOLL
WHERE 1=1
GROUP BY area_cd, subarea_cd, gender, age,
cand_cd
) T ON B.area_cd = T.area_cd AND B.subarea_cd = T.subarea_cd
AND B.cand_party_cd = T.cand_party_cd
AND B.gender = T.gender AND B.age = T.age
SET NOCOUNT OFF
SELECT area_nm,
[11] as sect_11, [12] as sect_12, [13] as sect_13, [14] as sect_14, [15] as sect_15, [16] as sect_16,
[21] as sect_21, [22] as sect_22, [23] as sect_23, [24] as sect_24, [25] as sect_25, [26] as sect_26
FROM
(
SELECT TXP.area_cd, A.area_nm, gender + age AS sect, SUM(cnt) AS cnt
FROM #TMP_EXIT_POLL TXP LEFT JOIN exitpoll_2022le.dbo.F_area A ON TXP.area_cd = A.area_cd
WHERE TXP.area_cd != '0901' AND gender != '0' AND age != '0'
GROUP BY TXP.area_cd, A.area_nm, gender, age
) T
PIVOT
(
MAX(cnt) FOR sect IN (
[11], [12], [13], [14], [15], [16],
[21], [22], [23], [24], [25], [26]
)
) P
ORDER BY area_cd
</select>
<select id="TranFile_6" resultMap="TransmissionVo">
<!-- 전국 정당 득표율 -->
SELECT area_nm, ISNULL([01], '') AS party_01, ISNULL([02], '') AS party_02, ISNULL([03], '') AS party_03, ISNULL([99], '') AS party_99
FROM
(
SELECT F.area_cd, A.area_nm, CASE WHEN party_cd IN ('01', '02', '03') THEN party_cd ELSE '99' END party_cd, FORMAT(SUM(CONVERT(NUMERIC(4,1), vote_rate)), '00.0') AS vote_rate
FROM exitpoll_2022le.dbo.F_output_final F LEFT JOIN exitpoll_2022le.dbo.F_area A ON F.area_cd = A.area_cd
LEFT JOIN exitpoll_2022le.dbo.F_cand C ON F.area_cd = C.area_cd AND F.cand_party_cd = C.cand_cd
WHERE LEN(F.area_cd) = 2 AND F.cand_party = 'CAND'
GROUP BY F.area_cd, A.area_nm, CASE WHEN party_cd IN ('01', '02', '03') THEN party_cd ELSE '99' END
) T
PIVOT
(
MAX(vote_rate) FOR party_cd IN (
[01], [02], [03], [99]
)
) P
ORDER BY area_cd
</select>
</mapper>

View File

@@ -0,0 +1,374 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="kr.co.kr.dao.TransmissionDao">
<resultMap id="TransmissionVo" type="kr.co.kr.vo.TransmissionVo"></resultMap>
<select id="TranFile_1" resultMap="TransmissionVo">
<!-- 지방선거 후보자별 득표율 -->
<![CDATA[
WITH CLAS AS (
SELECT A.area_cd, A.cand_party, sect, A.cand_party_cd, sect_rate + clas_rate AS sect_rate, dd_rate
FROM
(
SELECT ST.area_cd, cand_party, sect, cand_party_cd, CONVERT(NUMERIC(4,1), SUM(case when sum_cnt = 0 then 0 else cnt / sum_cnt * 100 * W.cluster_weight end)) AS sect_rate
FROM
(
SELECT area_cd, cluster, cand_party, sect, cand_party_cd, sum_cnt, cnt
FROM exitpoll.dbo.TMP_OUTPUT_DDAY
WHERE option_cd = '02' UNION ALL
SELECT area_cd, cluster, cand_party, LEFT(sect, 1) + '7' AS sect, cand_party_cd, SUM(sum_cnt) AS sum_cnt, SUM(cnt) AS cnt
FROM exitpoll.dbo.TMP_OUTPUT_DDAY
WHERE sect IN ('15','16','25','26') AND option_cd = '02'
GROUP BY area_cd, cluster, cand_party, LEFT(sect, 1) + '7', cand_party_cd UNION ALL
SELECT area_cd, cluster, cand_party, LEFT(sect, 1) + '0' AS sect, cand_party_cd, SUM(sum_cnt) AS sum_cnt, SUM(cnt) AS cnt
FROM exitpoll.dbo.TMP_OUTPUT_DDAY
WHERE option_cd = '02'
GROUP BY area_cd, cluster, cand_party, LEFT(sect, 1) + '0', cand_party_cd UNION ALL
SELECT area_cd, cluster, cand_party, '0' + RIGHT(sect, 1) AS sect, cand_party_cd, SUM(sum_cnt) AS sum_cnt, SUM(cnt) AS cnt
FROM exitpoll.dbo.TMP_OUTPUT_DDAY
WHERE option_cd = '02'
GROUP BY area_cd, cluster, cand_party, '0' + RIGHT(sect, 1), cand_party_cd UNION ALL
SELECT area_cd, cluster, cand_party, '07' AS sect, cand_party_cd, SUM(sum_cnt) AS sum_cnt, SUM(cnt) AS cnt
FROM exitpoll.dbo.TMP_OUTPUT_DDAY
WHERE sect IN ('15','16','25','26') AND option_cd = '02'
GROUP BY area_cd, cluster, cand_party, cand_party_cd
) ST LEFT JOIN exitpoll.dbo.F_Weight W ON ST.area_cd = W.area_cd AND ST.cluster = W.cluster
GROUP BY ST.area_cd, cand_party, sect, cand_party_cd
UNION ALL
SELECT area_cd, cand_party, '9'+cluster, cand_party_cd, CONVERT(NUMERIC(4,1), case when SUM(sum_cnt) = 0 then 0 else SUM(cnt) / SUM(sum_cnt) * 100 end) AS sect_rate
FROM exitpoll.dbo.TMP_OUTPUT_DDAY WHERE option_cd = '02'
GROUP BY area_cd, cand_party, '9'+cluster, cand_party_cd
) A LEFT JOIN (
SELECT area_cd, cand_party, cand_party_cd, vote_rate - CONVERT(NUMERIC(4,1), SUM(cls_rate * cluster_weight)) AS clas_rate, SUM(cls_rate * cluster_weight) AS dd_rate
FROM
(
SELECT O.area_cd, O.cand_party, O.cand_party_cd, O.vote_rate, WE.cluster, WE.cluster_weight, case when SUM(sum_cnt) = 0 then 0 else SUM(cnt) / SUM(sum_cnt) * 100 end AS cls_rate
FROM exitpoll.dbo.F_output_final O LEFT JOIN exitpoll.dbo.TMP_OUTPUT_DDAY DD
ON O.area_cd = DD.area_cd AND O.cand_party = DD.cand_party AND O.option_cd = DD.option_cd AND O.cand_party_cd = DD.cand_party_cd
LEFT JOIN exitpoll.dbo.F_Weight WE ON DD.area_cd = WE.area_cd AND DD.cluster = WE.cluster
GROUP BY O.area_cd, O.cand_party, O.cand_party_cd, O.vote_rate, WE.cluster, WE.cluster_weight
) SW
GROUP BY area_cd, cand_party, cand_party_cd, vote_rate
) B ON A.area_cd = B.area_cd AND A.cand_party = B.cand_party AND A.cand_party_cd = B.cand_party_cd
)
SELECT CASE WHEN FOF.cand_party='CAND' THEN '1' ELSE '2' END AS poll_type,
FOF.area_cd, area_cd_K, area_cd_M, area_cd_S, FOF.cand_party_cd, FORMAT(CONVERT(NUMERIC(4,1), vote_rate), '00.0') AS vote_rate,
FORMAT(ROW_NUMBER() OVER(PARTITION BY FOF.area_cd, FOF.cand_party ORDER BY CONVERT(NUMERIC(4,1), vote_rate) DESC), '00') AS rnum,
FORMAT(isnull(case when PE.err_limit >=7.5 then 7.4 else PE.err_limit end,0), '0.0') AS err_limit, FORMAT(isnull(PE.poll_cnt,0), '00000') AS poll_cnt,
CASE WHEN rank_1 - rank_2 > PE.err_limit * 2 THEN 1
WHEN rank_1 - rank_2 <= PE.err_limit * 2 AND rank_1 - rank_3 <= PE.err_limit * 2 THEN 3
ELSE 2 END AS area_result,
isnull(CASE WHEN rank_1 - rank_2 > PE.err_limit * 2 THEN
CASE ROW_NUMBER() OVER(PARTITION BY FOF.area_cd, FOF.cand_party ORDER BY CONVERT(NUMERIC(4,1), vote_rate) DESC) WHEN 1 THEN 1 ELSE 0 END
WHEN rank_1 - rank_5 <= PE.err_limit * 2 THEN
CASE WHEN ROW_NUMBER() OVER(PARTITION BY FOF.area_cd, FOF.cand_party ORDER BY CONVERT(NUMERIC(4,1), vote_rate) DESC) <= 5 THEN 3 ELSE 0 END
WHEN rank_1 - rank_4 <= PE.err_limit * 2 THEN
CASE WHEN ROW_NUMBER() OVER(PARTITION BY FOF.area_cd, FOF.cand_party ORDER BY CONVERT(NUMERIC(4,1), vote_rate) DESC) <= 4 THEN 3 ELSE 0 END
WHEN rank_1 - rank_3 <= PE.err_limit * 2 THEN
CASE WHEN ROW_NUMBER() OVER(PARTITION BY FOF.area_cd, FOF.cand_party ORDER BY CONVERT(NUMERIC(4,1), vote_rate) DESC) <= 3 THEN 3 ELSE 0 END
WHEN rank_1 - rank_2 <= PE.err_limit * 2 THEN
CASE WHEN ROW_NUMBER() OVER(PARTITION BY FOF.area_cd, FOF.cand_party ORDER BY CONVERT(NUMERIC(4,1), vote_rate) DESC) <= 2 THEN 2 ELSE 0 END
END,0) AS cand_result,
[10] as sect_10, [20] as sect_20, [01] as sect_01, [02] as sect_02, [03] as sect_03, [04] as sect_04, [07] as sect_07, [05] as sect_05, [06] as sect_06,
[11] as sect_11, [12] as sect_12, [13] as sect_13, [14] as sect_14, [17] as sect_17, [15] as sect_15, [16] as sect_16,
[21] as sect_21, [22] as sect_22, [23] as sect_23, [24] as sect_24, [27] as sect_27, [25] as sect_25, [26] as sect_26,
[91] as sect_91, [92] as sect_92, [93] as sect_93, [94] as sect_94, [95] as sect_95, [96] as sect_96, [97] as sect_97, [98] as sect_98,
FORMAT(pre_rate, '00.0') AS pre_rate,
FORMAT(dd_rate, '00.0') AS dd_rate
FROM exitpoll.dbo.F_output_final FOF LEFT JOIN exitpoll.dbo.F_area FA ON FOF.area_cd = FA.area_cd
LEFT JOIN (
SELECT EP.area_cd, 'CAND' AS cand_party, count(C.area_cd) AS poll_cnt, ROUND(SQRT(2.5/count(C.area_cd)) * 100, 1) AS err_limit
FROM exitpoll.dbo.F_TMP_EXPOLL EP LEFT JOIN exitpoll.dbo.F_Cand C ON EP.area_cd = C.area_cd AND EP.cand_cd = C.cand_cd AND C.quit = '0'
WHERE EP.area_cd != '0901'
GROUP BY EP.area_cd
UNION ALL
SELECT EP.area_cd, 'EDU' AS cand_party, count(E.area_cd) AS poll_cnt, ROUND(SQRT(2.5/count(E.area_cd)) * 100, 1) AS err_limit
FROM exitpoll.dbo.F_TMP_EXPOLL EP LEFT JOIN exitpoll.dbo.F_edu E ON EP.area_cd = E.area_cd AND EP.edu_cd = E.edu_cd AND E.quit = '0'
WHERE EP.area_cd != '0901'
GROUP BY EP.area_cd
) PE ON FA.area_cd = PE.area_cd AND FOF.cand_party = PE.cand_party LEFT JOIN (
SELECT area_cd, cand_party,
[1] AS rank_1, [2] AS rank_2, [3] AS rank_3, [4] AS rank_4, [5] AS rank_5
FROM (
SELECT ROW_NUMBER() OVER(PARTITION BY area_cd, cand_party ORDER BY CONVERT(NUMERIC(4,1), vote_rate) DESC) AS ran,
area_cd, cand_party, CONVERT(NUMERIC(4,1), vote_rate) AS vote_rate
FROM exitpoll.dbo.F_output_final
WHERE area_cd != '0901'
) T
PIVOT
(
MAX(vote_rate) FOR ran IN ( [1], [2], [3], [4], [5])
) U
) RK ON FOF.area_cd = RK.area_cd AND FOF.cand_party = RK.cand_party LEFT JOIN
(
SELECT U.area_cd, U.cand_party, U.cand_party_cd, dd_rate,
[10], [20], [01], [02], [03], [04], [07], [05], [06],
[11], [12], [13], [14], [17], [15], [16],
[21], [22], [23], [24], [27], [25], [26],
ISNULL([91], '00.0') as [91],
ISNULL([92], '00.0') as [92],
ISNULL([93], '00.0') as [93],
ISNULL([94], '00.0') as [94],
ISNULL([95], '00.0') as [95],
ISNULL([96], '00.0') as [96],
ISNULL([97], '00.0') as [97],
ISNULL([98], '00.0') as [98]
FROM
(
SELECT CA.area_cd, CA.cand_party, CA.sect, CA.cand_party_cd,
CASE WHEN CA.sect_rate < 0 THEN '00.0' ELSE
FORMAT(CA.sect_rate + (ISNULL(CB.minus_sect_rate, 0) * sect_rate / 100) + (CC.med_rate * sect_rate / 100), '00.0')
END AS sect_rate, CA.dd_rate
FROM CLAS CA LEFT JOIN (
SELECT area_cd, cand_party, sect, sum(sect_rate) AS minus_sect_rate FROM CLAS WHERE sect_rate < 0
GROUP BY area_cd, cand_party, sect
) CB ON CA.area_cd = CB.area_cd AND CA.cand_party = CB.cand_party AND CA.sect = CB.sect LEFT JOIN (
SELECT area_cd, cand_party, sect, 100 - sum(sect_rate) AS med_rate FROM CLAS
GROUP BY area_cd, cand_party, sect
) CC ON CA.area_cd = CC.area_cd AND CA.cand_party = CC.cand_party AND CA.sect = CC.sect
) SP
PIVOT
(
MAX(sect_rate) FOR sect IN (
[10], [20], [01], [02], [03], [04], [07], [05], [06],
[11], [12], [13], [14], [17], [15], [16],
[21], [22], [23], [24], [27], [25], [26],
[91], [92], [93], [94], [95], [96], [97], [98]
)
) U
WHERE U.area_cd != '0901'
) SEC ON FOF.area_cd = SEC.area_cd AND FOF.cand_party = SEC.cand_party AND FOF.cand_party_cd = SEC.cand_party_cd LEFT JOIN
(
SELECT area_cd, cand_party, cand_party_cd, vote_rate AS pre_rate
FROM exitpoll.dbo.TMP_OUTPUT_PRE A
WHERE option_cd = (SELECT TOP 1 pre_option_cd FROM exitpoll.dbo.F_output_final WHERE area_cd = A.area_cd AND cand_party = A.cand_party)
) PRE ON FOF.area_cd = PRE.area_cd AND FOF.cand_party = PRE.cand_party AND FOF.cand_party_cd = PRE.cand_party_cd
WHERE FOF.area_cd != '0901'
]]>
</select>
<select id="TranFile_2" resultMap="TransmissionVo">
<!-- 재보궐 후보자별 득표율 -->
<![CDATA[
WITH CLAS AS (
SELECT A.area_cd, A.cand_party, sect, A.cand_party_cd, sect_rate + clas_rate AS sect_rate, dd_rate
FROM
(
SELECT ST.area_cd, cand_party, sect, cand_party_cd, CONVERT(NUMERIC(4,1), SUM(case when sum_cnt = 0 then 0 else cnt / sum_cnt * 100 * W.cluster_weight end)) AS sect_rate
FROM
(
SELECT area_cd, cluster, cand_party, sect, cand_party_cd, sum_cnt, cnt
FROM exitpoll.dbo.TMP_OUTPUT_DDAY
WHERE option_cd = '02' UNION ALL
SELECT area_cd, cluster, cand_party, LEFT(sect, 1) + '7' AS sect, cand_party_cd, SUM(sum_cnt) AS sum_cnt, SUM(cnt) AS cnt
FROM exitpoll.dbo.TMP_OUTPUT_DDAY
WHERE sect IN ('15','16','25','26') AND option_cd = '02'
GROUP BY area_cd, cluster, cand_party, LEFT(sect, 1) + '7', cand_party_cd UNION ALL
SELECT area_cd, cluster, cand_party, LEFT(sect, 1) + '0' AS sect, cand_party_cd, SUM(sum_cnt) AS sum_cnt, SUM(cnt) AS cnt
FROM exitpoll.dbo.TMP_OUTPUT_DDAY
WHERE option_cd = '02'
GROUP BY area_cd, cluster, cand_party, LEFT(sect, 1) + '0', cand_party_cd UNION ALL
SELECT area_cd, cluster, cand_party, '0' + RIGHT(sect, 1) AS sect, cand_party_cd, SUM(sum_cnt) AS sum_cnt, SUM(cnt) AS cnt
FROM exitpoll.dbo.TMP_OUTPUT_DDAY
WHERE option_cd = '02'
GROUP BY area_cd, cluster, cand_party, '0' + RIGHT(sect, 1), cand_party_cd UNION ALL
SELECT area_cd, cluster, cand_party, '07' AS sect, cand_party_cd, SUM(sum_cnt) AS sum_cnt, SUM(cnt) AS cnt
FROM exitpoll.dbo.TMP_OUTPUT_DDAY
WHERE sect IN ('15','16','25','26') AND option_cd = '02'
GROUP BY area_cd, cluster, cand_party, cand_party_cd
) ST LEFT JOIN exitpoll.dbo.F_Weight W ON ST.area_cd = W.area_cd AND ST.cluster = W.cluster
GROUP BY ST.area_cd, cand_party, sect, cand_party_cd
UNION ALL
SELECT area_cd, cand_party, '9'+cluster, cand_party_cd, CONVERT(NUMERIC(4,1), case when SUM(sum_cnt) = 0 then 0.0 else SUM(cnt) / SUM(sum_cnt) * 100 end) AS sect_rate
FROM exitpoll.dbo.TMP_OUTPUT_DDAY WHERE option_cd = '02'
GROUP BY area_cd, cand_party, '9'+cluster, cand_party_cd
) A LEFT JOIN (
SELECT area_cd, cand_party, cand_party_cd, vote_rate - CONVERT(NUMERIC(4,1), SUM(cls_rate * cluster_weight)) AS clas_rate, SUM(cls_rate * cluster_weight) AS dd_rate
FROM
(
SELECT O.area_cd, O.cand_party, O.cand_party_cd, O.vote_rate, WE.cluster, WE.cluster_weight, SUM(cnt) / SUM(sum_cnt) * 100 AS cls_rate
FROM exitpoll.dbo.F_output_final O LEFT JOIN exitpoll.dbo.TMP_OUTPUT_DDAY DD
ON O.area_cd = DD.area_cd AND O.cand_party = DD.cand_party AND O.option_cd = DD.option_cd AND O.cand_party_cd = DD.cand_party_cd
LEFT JOIN exitpoll.dbo.F_Weight WE ON DD.area_cd = WE.area_cd AND DD.cluster = WE.cluster
GROUP BY O.area_cd, O.cand_party, O.cand_party_cd, O.vote_rate, WE.cluster, WE.cluster_weight
) SW
GROUP BY area_cd, cand_party, cand_party_cd, vote_rate
) B ON A.area_cd = B.area_cd AND A.cand_party = B.cand_party AND A.cand_party_cd = B.cand_party_cd
)
SELECT '3' AS poll_type,
FOF.area_cd, area_cd_K, area_cd_M, area_cd_S, FOF.cand_party_cd, FORMAT(CONVERT(NUMERIC(4,1), vote_rate), '00.0') AS vote_rate,
FORMAT(ROW_NUMBER() OVER(PARTITION BY FOF.area_cd, FOF.cand_party ORDER BY CONVERT(NUMERIC(4,1), vote_rate) DESC), '00') AS rnum,
FORMAT(case when PE.err_limit >=7.5 then 7.4 else PE.err_limit end, '0.0') AS err_limit, FORMAT(PE.poll_cnt, '0000') AS poll_cnt,
CASE WHEN rank_1 - rank_2 > PE.err_limit * 2 THEN 1
WHEN rank_1 - rank_2 <= PE.err_limit * 2 AND rank_1 - rank_3 <= PE.err_limit * 2 THEN 3
ELSE 2 END AS area_result,
CASE WHEN rank_1 - rank_2 > PE.err_limit * 2 THEN
CASE ROW_NUMBER() OVER(PARTITION BY FOF.area_cd, FOF.cand_party ORDER BY CONVERT(NUMERIC(4,1), vote_rate) DESC) WHEN 1 THEN 1 ELSE 0 END
WHEN rank_1 - rank_5 <= PE.err_limit * 2 THEN
CASE WHEN ROW_NUMBER() OVER(PARTITION BY FOF.area_cd, FOF.cand_party ORDER BY CONVERT(NUMERIC(4,1), vote_rate) DESC) <= 5 THEN 3 ELSE 0 END
WHEN rank_1 - rank_4 <= PE.err_limit * 2 THEN
CASE WHEN ROW_NUMBER() OVER(PARTITION BY FOF.area_cd, FOF.cand_party ORDER BY CONVERT(NUMERIC(4,1), vote_rate) DESC) <= 4 THEN 3 ELSE 0 END
WHEN rank_1 - rank_3 <= PE.err_limit * 2 THEN
CASE WHEN ROW_NUMBER() OVER(PARTITION BY FOF.area_cd, FOF.cand_party ORDER BY CONVERT(NUMERIC(4,1), vote_rate) DESC) <= 3 THEN 3 ELSE 0 END
WHEN rank_1 - rank_2 <= PE.err_limit * 2 THEN
CASE WHEN ROW_NUMBER() OVER(PARTITION BY FOF.area_cd, FOF.cand_party ORDER BY CONVERT(NUMERIC(4,1), vote_rate) DESC) <= 2 THEN 2 ELSE 0 END
END AS cand_result,
[10] as sect_10, [20] as sect_20, [01] as sect_01, [02] as sect_02, [03] as sect_03, [04] as sect_04, [07] as sect_07, [05] as sect_05, [06] as sect_06,
FORMAT(pre_rate, '00.0') AS pre_rate,
FORMAT(dd_rate, '00.0') AS dd_rate
FROM exitpoll.dbo.F_output_final FOF LEFT JOIN exitpoll.dbo.F_area FA ON FOF.area_cd = FA.area_cd
LEFT JOIN (
SELECT EP.area_cd, 'CAND' AS cand_party, count(C.area_cd) AS poll_cnt, ROUND(SQRT(2.5/count(C.area_cd)) * 100, 1) AS err_limit
FROM exitpoll.dbo.F_TMP_EXPOLL EP LEFT JOIN exitpoll.dbo.F_Cand C ON EP.area_cd = C.area_cd AND EP.cand_cd = C.cand_cd AND C.quit = '0'
WHERE EP.area_cd = '0901'
GROUP BY EP.area_cd
) PE ON FA.area_cd = PE.area_cd AND FOF.cand_party = PE.cand_party LEFT JOIN (
SELECT area_cd, cand_party,
[1] AS rank_1, [2] AS rank_2, [3] AS rank_3, [4] AS rank_4, [5] AS rank_5
FROM (
SELECT ROW_NUMBER() OVER(PARTITION BY area_cd, cand_party ORDER BY CONVERT(NUMERIC(4,1), vote_rate) DESC) AS ran,
area_cd, cand_party, CONVERT(NUMERIC(4,1), vote_rate) AS vote_rate
FROM exitpoll.dbo.F_output_final
WHERE area_cd = '0901'
) T
PIVOT
(
MAX(vote_rate) FOR ran IN ( [1], [2], [3], [4], [5])
) U
) RK ON FOF.area_cd = RK.area_cd AND FOF.cand_party = RK.cand_party LEFT JOIN
(
SELECT U.area_cd, U.cand_party, U.cand_party_cd, dd_rate,
[10], [20], [01], [02], [03], [04], [07], [05], [06],
[11], [12], [13], [14], [17], [15], [16],
[21], [22], [23], [24], [27], [25], [26],
ISNULL([91], '00.0') as [91],
ISNULL([92], '00.0') as [92],
ISNULL([93], '00.0') as [93],
ISNULL([94], '00.0') as [94],
ISNULL([95], '00.0') as [95],
ISNULL([96], '00.0') as [96],
ISNULL([97], '00.0') as [97],
ISNULL([98], '00.0') as [98]
FROM
(
SELECT CA.area_cd, CA.cand_party, CA.sect, CA.cand_party_cd,
CASE WHEN CA.sect_rate < 0 THEN '00.0' ELSE
FORMAT(CA.sect_rate + (ISNULL(CB.minus_sect_rate, 0) * sect_rate / 100) + (CC.med_rate * sect_rate / 100), '00.0')
END AS sect_rate, CA.dd_rate
FROM CLAS CA LEFT JOIN (
SELECT area_cd, cand_party, sect, sum(sect_rate) AS minus_sect_rate FROM CLAS WHERE sect_rate < 0
GROUP BY area_cd, cand_party, sect
) CB ON CA.area_cd = CB.area_cd AND CA.cand_party = CB.cand_party AND CA.sect = CB.sect LEFT JOIN (
SELECT area_cd, cand_party, sect, 100 - sum(sect_rate) AS med_rate FROM CLAS
GROUP BY area_cd, cand_party, sect
) CC ON CA.area_cd = CC.area_cd AND CA.cand_party = CC.cand_party AND CA.sect = CC.sect
) SP
PIVOT
(
MAX(sect_rate) FOR sect IN (
[10], [20], [01], [02], [03], [04], [07], [05], [06],
[11], [12], [13], [14], [17], [15], [16],
[21], [22], [23], [24], [27], [25], [26],
[91], [92], [93], [94], [95], [96], [97], [98]
)
) U
WHERE U.area_cd = '0901'
) SEC ON FOF.area_cd = SEC.area_cd AND FOF.cand_party = SEC.cand_party AND FOF.cand_party_cd = SEC.cand_party_cd LEFT JOIN
(
SELECT area_cd, cand_party, cand_party_cd, vote_rate AS pre_rate
FROM exitpoll.dbo.TMP_OUTPUT_PRE A
WHERE option_cd = (SELECT TOP 1 pre_option_cd FROM exitpoll.dbo.F_output_final WHERE area_cd = A.area_cd AND cand_party = A.cand_party)
) PRE ON FOF.area_cd = PRE.area_cd AND FOF.cand_party = PRE.cand_party AND FOF.cand_party_cd = PRE.cand_party_cd
WHERE FOF.area_cd = '0901'
]]>
</select>
<select id="TranFile_3" resultMap="TransmissionVo">
<!-- 전국 성/연령 응답자수 -->
SET NOCOUNT ON
--DROP TABLE #TMP_EXIT_POLL
SELECT B.area_cd, B.subarea_cd,
B.gender, B.age, cand_party,
ISNULL(T.cand_party_cd, B.cand_party_cd) AS cand_party_cd, ISNULL(T.cnt, 0) AS cnt
INTO #TMP_EXIT_POLL
FROM
(
SELECT A.area_cd, GA.gender, GA.age, SA.subarea_cd, CP.cand_party, CP.cand_party_cd
FROM exitpoll.dbo.F_area A LEFT JOIN exitpoll.dbo.F_subarea SA
ON A.area_cd = SA.area_cd LEFT JOIN (
SELECT 'CAND' AS cand_party, area_cd, cand_cd AS cand_party_cd
FROM exitpoll.dbo.F_cand WHERE quit = '0' UNION ALL
SELECT 'PARTY' AS cand_party, '0000' AS area_cd, party_cd AS cand_party_cd
FROM exitpoll.dbo.F_party WHERE party_yn = '1' UNION ALL
SELECT 'EDU' AS cand_party, area_cd, edu_cd AS cand_party_cd
FROM exitpoll.dbo.F_edu WHERE quit = '0' UNION ALL
SELECT 'CAND' AS cand_party, '0000' AS area_cd, '00' AS cand_party_cd UNION ALL
SELECT 'PARTY' AS cand_party, '0000' AS area_cd, '00' AS cand_party_cd UNION ALL
SELECT 'EDU' AS cand_party, '0000' AS area_cd, '00' AS cand_party_cd
) CP ON (A.area_cd = CP.area_cd OR CP.area_cd = '0000') AND
CP.cand_party =
'CAND'
LEFT JOIN
(
SELECT CONVERT(varchar(1), number % 3) AS gender, CONVERT(varchar(1), number / 3) AS age
FROM master..spt_values
WHERE type = 'P' and 21 > number
) GA ON 1=1
WHERE A.company = 'KRI'
) B LEFT JOIN
(
SELECT area_cd, subarea_cd, gender, age,
cand_cd
AS cand_party_cd, count(*) AS cnt
FROM exitpoll.dbo.F_TMP_EXPOLL
WHERE 1=1
GROUP BY area_cd, subarea_cd, gender, age,
cand_cd
) T ON B.area_cd = T.area_cd AND B.subarea_cd = T.subarea_cd
AND B.cand_party_cd = T.cand_party_cd
AND B.gender = T.gender AND B.age = T.age
SET NOCOUNT OFF
SELECT area_nm,
[11] as sect_11, [12] as sect_12, [13] as sect_13, [14] as sect_14, [15] as sect_15, [16] as sect_16,
[21] as sect_21, [22] as sect_22, [23] as sect_23, [24] as sect_24, [25] as sect_25, [26] as sect_26
FROM
(
SELECT TXP.area_cd, A.area_nm, gender + age AS sect, SUM(cnt) AS cnt
FROM #TMP_EXIT_POLL TXP LEFT JOIN exitpoll.dbo.F_area A ON TXP.area_cd = A.area_cd
WHERE TXP.area_cd != '0901' AND gender != '0' AND age != '0'
GROUP BY TXP.area_cd, A.area_nm, gender, age
) T
PIVOT
(
MAX(cnt) FOR sect IN (
[11], [12], [13], [14], [15], [16],
[21], [22], [23], [24], [25], [26]
)
) P
ORDER BY area_cd
</select>
<select id="TranFile_4" resultMap="TransmissionVo">
<!-- 전국 정당 득표율 -->
SELECT area_nm, ISNULL([01], '') AS party_01, ISNULL([02], '') AS party_02, ISNULL([03], '') AS party_03, ISNULL([99], '') AS party_99
FROM
(
SELECT F.area_cd, A.area_nm, CASE WHEN party_cd IN ('01', '02', '03') THEN party_cd ELSE '99' END party_cd, FORMAT(SUM(CONVERT(NUMERIC(4,1), vote_rate)), '00.0') AS vote_rate
FROM exitpoll.dbo.F_output_final F LEFT JOIN exitpoll.dbo.F_area A ON F.area_cd = A.area_cd
LEFT JOIN exitpoll.dbo.F_cand C ON F.area_cd = C.area_cd AND F.cand_party_cd = C.cand_cd
WHERE LEN(F.area_cd) = 2 AND F.cand_party = 'CAND'
GROUP BY F.area_cd, A.area_nm, CASE WHEN party_cd IN ('01', '02', '03') THEN party_cd ELSE '99' END
) T
PIVOT
(
MAX(vote_rate) FOR party_cd IN (
[01], [02], [03], [99]
)
) P
ORDER BY area_cd
</select>
</mapper>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,60 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
</body>
<script src="//code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="/resources/js/custom.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.9.1/underscore-min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/xlsx/0.14.3/xlsx.full.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/FileSaver.js/1.3.8/FileSaver.min.js"></script>
<c:set var="pagePath" value="${requestScope['javax.servlet.forward.servlet_path']}" />
<c:set var="pageMenuName" value="${fn:split(pagePath, '/')[0]}" />
<script>
$(function(){
$("ul.leftMenu > li > a[href='/${pageMenuName}']").addClass("active");
printClock();
});
function printClock() {
var clock = document.getElementById("clock"); //출력할 장소
var currentDate = new Date(); //현재시간
var calendar = currentDate.getFullYear() + "-" + (currentDate.getMonth()+1) + "-" + currentDate.getDate() // 현재 날짜
var amPm = 'AM'; // 초기값 AM
var currentHours = addZeros(currentDate.getHours(),2);
var currentMinute = addZeros(currentDate.getMinutes(),2);
var currentSeconds = addZeros(currentDate.getSeconds(),2);
if(currentHours >= 12){ // 시간이 12보다 클 때 PM으로 세팅, 12를 빼줌
amPm = 'PM';
if(currentHours > 12){
currentHours = addZeros(currentHours - 12, 2);
}
}
clock.innerHTML = amPm + " " + currentHours+":"+currentMinute+":"+currentSeconds; //날짜를 출력해 줌
setTimeout("printClock()",1000); // 1초마다 printClock() 함수 호출
}
function getNowDate(){
var currentDate = new Date();
return currentDate.getFullYear() + "" + (currentDate.getMonth()+1) + "" + currentDate.getDate() + "" +
addZeros(currentDate.getHours(),2) + addZeros(currentDate.getMinutes(),2) + addZeros(currentDate.getSeconds(),2);
}
function addZeros(num, digit) { // 자릿수 맞춰주기
var zero = '';
num = num.toString();
if (num.length < digit) {
for (i = 0; i < digit - num.length; i++) {
zero += '0';
}
}
return zero + num;
}
</script>
</html>

View File

@@ -0,0 +1,38 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!Doctype html>
<html lang="ko">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>KRi 선거 예측치 산출</title>
<!-- Bootstrap Core CSS -->
<!-- <link href="/resources/css/bootstrap.css" rel="stylesheet"> -->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<!-- Reset CSS -->
<link href="/resources/css/reset.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="/resources/css/custom.css" rel="stylesheet">
</head>
<body>
<div class="top">
<a href="/analysis"><span class="top-span">KRi 선거 예측치 산출</span></a>
<a href="/logout"><span class="glyphicon glyphicon-log-out" style="display:block;width:50px;color:#ffffff;float:right;line-height:45px;margin-right:20px;font-size:20px;"></span></a>
<span style="width:100px; height:50px; line-height:50px; color:#ffffff;font-size:15px;float:right; margin-right:20px;" id="clock"></span>
</div>
<div class="wrapper" id="wrapper">
<nav class="navigation">
<ul class="leftMenu">
<li><a href="/analysis">Data Output</a></li>
<li><a href="/percentage">Data Optimizing</a></li>
<li><a href="/transmission">Data Transmission</a></li>
<li></li>
<li><a href="/history">Output History</a></li>
</ul>
</nav>
</div>

View File

@@ -0,0 +1,866 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!--------------------------------------- Header Start --------------------------------------->
<jsp:include page="../common/header.jsp" flush="true" />
<link href="/resources/css/analysis.css" rel="stylesheet">
<!---------------------------------------- Header End ---------------------------------------->
<!-- ---- -->
<div id="loadingDiv"></div>
<div class="contentsBody">
<div class="analysis">
<div class="analysis_option">
<div class="analysis_option_area" style="height:70px;">
<form name="frmOutput">
<div class="btn-group btn-group-toggle" data-toggle="buttons">
<label class="btn btn-primary active">
<input type="radio" name="chk_area" id="chk_area_all" value="ALL" autocomplete="off"
checked> 전체
</label>
<label class="btn btn-primary">
<input type="radio" name="chk_area" id="chk_area_choice" value="CHOICE" autocomplete="off">
개별 지역
</label>
</div>
<div class="btn-group btn-group-toggle" data-toggle="buttons">
<label class="btn btn-default active">
<input type="radio" name="chk_cand_party" id="chk_cand" value="CAND" autocomplete="off" checked>
<!--시·도지사-->
지역구
</label>
<label class="btn btn-default">
<input type="radio" name="chk_cand_party" id="chk_party" value="PARTY" autocomplete="off">
비례대표
</label>
<label class="btn btn-default">
<input type="radio" name="chk_cand_party" id="chk_edu" value="EDU" autocomplete="off">
교육감
</label>
</div>
<span class="span_option" style="visibility: hidden;">지역 :
<select class="form-control" id="sel_local" style="width:120px;font-size:15px;display:inline-block;vertical-align: middle;height:35px;" disabled>
</select>
</span>
<span class="span_option" style="visibility: hidden;">선거구 :
<select class="form-control" id="sel_area" style="width:200px;font-size:15px;display:inline-block;vertical-align: middle;height:35px;" disabled>
</select>
</span>
<span class="span_option">시간 :
<select class="form-control" id="sel_timeband" style="width:140px;font-size:15px;display:inline-block;vertical-align: middle;height:35px;">
</select>
</span>
<input class="btn btn-success" type="button" id="bt_output"
style="font-size: 13px;height:35px;vertical-align: middle;" value="OUTPUT 출력" onclick="getExitPollData();">
<a href="javascript: alert('OUTPUT 출력 후 이용해주세요.');" id="a_excelImg" style="text-decoration: none;">
<img id="excelImg" src="/resources/image/excel_icon_gray.png" style="width:35px;">
</a>
<span class="span_option" style="margin-left:15px;">보고서 ON/OFF :
<div class="option_chkbox_div">
<input type="checkbox" class="option_chkbox" id="option_chkbox1" checked>
<input type="checkbox" class="option_chkbox" id="option_chkbox2" checked>
<input type="checkbox" class="option_chkbox" id="option_chkbox3" checked>
<input type="checkbox" class="option_chkbox" id="option_chkbox4" checked>
<input type="checkbox" class="option_chkbox" id="option_chkbox5" checked>
</div>
</span>
</form>
</div>
</div>
<div class="analysis_output"></div>
</div>
</div>
<!-- ---- -->
<!--------------------------------------- Footer Start --------------------------------------->
<jsp:include page="../common/footer.jsp" flush="true" />
<!---------------------------------------- Footer End ---------------------------------------->
<style>
/* .contentsBody .active{
box-shadow:1px 1px 6px #111116 inset;
} */
.highcharts-figure, .highcharts-data-table table {
min-width: 310px;
max-width: 800px;
margin: 1em auto;
}
#container {
height: 400px;
}
.highcharts-data-table table {
font-family: Verdana, sans-serif;
border-collapse: collapse;
border: 1px solid #EBEBEB;
margin: 10px auto;
text-align: center;
width: 100%;
max-width: 500px;
}
.highcharts-data-table caption {
padding: 1em 0;
font-size: 1.2em;
color: #555;
}
.highcharts-data-table th {
font-weight: 600;
padding: 0.5em;
}
.highcharts-data-table td, .highcharts-data-table th, .highcharts-data-table caption {
padding: 0.5em;
}
.highcharts-data-table thead tr, .highcharts-data-table tr:nth-child(even) {
background: #f8f8f8;
}
.highcharts-data-table tr:hover {
background: #f1f7ff;
}
</style>
<script>
var timeList = new Array();
var areaList = new Array();
var candList = new Array();
var weightList = new Array();
var optionList = new Array();
var preOptionList = new Array();
var optionAreaList = new Array();
var preOptionAreaList = new Array();
$(function(){
getTimeBand();
getLocal();
$("#sel_local").on("change", function(){
getArea();
});
getWeight();
$("input[name=chk_area]").on("change", function(){
if( $("input[name=chk_area]:checked").val() == "ALL" ){
$("#sel_local, #sel_area").prop("disabled", true);
$(".span_option:nth-child(3), .span_option:nth-child(4)").css("visibility","hidden");
$("#chk_area_all").parent("label").addClass("active");
$("#chk_area_choice").parent("label").removeClass("active");
}else{
$("#sel_local, #sel_area").prop("disabled", false);
$(".span_option:nth-child(3), .span_option:nth-child(4)").css("visibility","visible");
//$(".span_option:nth-child(3)").css("visibility","visible"); // 선거구는 보여줄 필요 없음 (지방선거)
$("#chk_area_choice").parent("label").addClass("active");
$("#chk_area_all").parent("label").removeClass("active");
}
});
$("input[name=chk_cand_party]").on("change", function(){
$("input[name=chk_cand_party]").parent().removeClass("active");
$(this).parent().addClass("active");
});
$("#option_chkbox1").on("change",function(){
if( $("#option_chkbox1").is(":checked") == true ){ $(".report_1").css("display","block"); }
else{ $(".report_1").css("display","none") }
})
$("#option_chkbox2").on("change",function(){
if( $("#option_chkbox2").is(":checked") == true ){ $(".report_2").css("display","block"); }
else{ $(".report_2").css("display","none") }
})
$("#option_chkbox3").on("change",function(){
if( $("#option_chkbox3").is(":checked") == true ){ $(".report_3").css("display","block"); }
else{ $(".report_3").css("display","none") }
})
$("#option_chkbox4").on("change",function(){
if( $("#option_chkbox4").is(":checked") == true ){ $(".report_4").css("display","block"); }
else{ $(".report_4").css("display","none") }
})
$("#option_chkbox5").on("change",function(){
if( $("#option_chkbox5").is(":checked") == true ){ $(".report_5").css("display","block"); }
else{ $(".report_5").css("display","none") }
})
});
function getTimeBand(){
$.ajax({
type : "POST",
url : "/analysis/getTimeBand",
contentType : "application/json",
success : function(data, status, xhr){
timeList = data;
$.each(data, function(idx, item){
$("#sel_timeband").append("<option value='"+data[idx].time_band+"'>["+data[idx].time_band+"차] "+data[idx].start_time+"</option>");
});
}
});
}
function getLocal(){
$.ajax({
type : "POST",
url : "/analysis/getArea",
contentType : "application/json",
async: false,
success : function(data, status, xhr){
areaList = data;
}
});
var area = _.uniq(areaList, 'sido_cd');
$("#sel_local").append("<option value='00'>선택</option>");
$("#sel_area").append("<option value='0000'>선택</option>");
$.each(area, function(idx, item){
$("#sel_local").append("<option value='"+ item.sido_cd +"'>["+ item.sido_cd +"] "+ item.sido_nm +"</option>");
});
}
function getArea(){
$("#sel_area option").remove();
var subArea = $.grep(areaList, function(item, idx){ return item.sido_cd === $("#sel_local option:selected").val(); });
$.each(subArea, function(idx, item){
$("#sel_area").append("<option value='"+ item.area_cd +"'>["+ item.area_cd +"] "+ item.area_nm +"</option>");
});
}
function getWeight(){
$.ajax({
type : "POST",
url : "/analysis/getWeight",
contentType : "application/json",
success : function(data, status, xhr){
weightList = data;
}
});
}
function getOption(){
$.ajax({
type : "POST",
url : "/analysis/getOption",
contentType : "application/json",
async: false,
data: JSON.stringify(),
success : function(data, status, xhr){
preOptionList = $.grep(data[0], function(o){ return o.vote_cd == "1"; });
optionList = $.grep(data[0], function(o){ return o.vote_cd == "2"; });
preOptionAreaList = $.grep(data[1], function(o){ return o.vote_cd == "1"; });
optionAreaList = $.grep(data[1], function(o){ return o.vote_cd == "2"; });
}
});
}
function outputDownloadExcel(){
$(location).attr("href", "/analysis/excelDownload");
}
function getExitPollData(){
console.log("function called");
var sel_local = $("input[name=chk_area]:checked").val();
var sel_area_cd = $("#sel_area option:selected").val();
var sel_time_band = $("#sel_timeband option:selected").val();
var tableDiv = $(".analysis_output");
if(sel_local.toUpperCase() == "CHOICE" && sel_area_cd == "0000"){
alert("지역을 선택해주세요.");
return;
}
var param = {
"f_cand_party" : $("input[name=chk_cand_party]:checked").val(),
"f_local" : sel_local,
"area_cd" : sel_area_cd,
"time_band" : sel_time_band,
"search_time" : getNowDate()
};
console.log("param : " + JSON.stringify(param));
$(tableDiv).html("");
$.ajax({
type : "POST",
url : "/analysis/getOutputData",
data: JSON.stringify(param),
contentType : "application/json",
beforeSend : function(){
$("#loadingDiv").show();
},
success : function(data, status, xhr){
console.log("sucess_calling");
getOption();
var report_1 = data[0];
console.log("report_1 : " + JSON.stringify(report_1));
var report_2 = data[1];
console.log("report_2 : " + JSON.stringify(report_2));
var report_3 = data[2];
console.log("report_3 : " + JSON.stringify(report_3));
var report_4 = data[3];
console.log("report_4 : " + JSON.stringify(report_4));
var report_3_dd = data[4];
var report_5 = data[5];
candList = _.uniq(
report_1.map(
function(obj){ return { "area_cd" : obj.area_cd, "cand_party_cd" : obj.cand_party_cd, "cand_nm" : obj.cand_nm, "party_nm" : obj.party_nm} }
), function(elem) { return [elem.area_cd, elem.cand_party_cd, elem.cand_nm, elem.party_nm].join() }
);
$.each($.grep(areaList, function(obj, idx){ return param.f_local == "ALL" || (param.f_local == "CHOICE" && obj.area_cd == param.area_cd); }), function(i, obj){
//obj.area_cd, obj.area_nm
if($("input[name=chk_cand_party]:checked").val() == "EDU" && obj.area_cd.length != 2){
return true;
}
$(tableDiv).append("<div class='areaDiv table-responsive' id='area_" + obj.area_cd + "'>");
drawReport_1(obj.area_cd, obj.area_nm, report_1);
drawReport_2(obj.area_cd, obj.area_nm, report_2);
drawReport_3(obj.area_cd, obj.area_nm, report_3, report_3_dd);
drawReport_4(obj.area_cd, obj.area_nm, report_4);
drawReport_5(obj.area_cd, obj.area_nm, report_5);
});
$("#loadingDiv").hide();
console.log("sucess loading removed");
insertHtml();
}
});
$("#excelImg").attr("src", "/resources/image/excel_icon.png")
$("#a_excelImg").attr("href", "javascript:outputDownloadExcel();");
}
function insertHtml(){
var tmpOutput = $(".analysis_output").clone();
$(tmpOutput).find("table[id^=report_]").show();
var searchReq = {
"area" : $("input[name=chk_area]:checked").parent().text().trim() + ($("input[name=chk_area]:checked").val() != "ALL" ? (" - " + $("#sel_local option:selected").text().trim()) : ""),
"cand_party" : $("input[name=chk_cand_party]:checked").parent().text().trim(),
"time_band" : $("#sel_timeband option:selected").text().trim()
};
$.ajax({
type : "POST",
url : "/analysis/insertHtml",
data: JSON.stringify({"html_str": $(tmpOutput).html(), "search_req": JSON.stringify(searchReq) }),
contentType : "application/json",
success : function(data, status, xhr){
}
});
$(tmpOutput).remove();
}
function optionChoice(area_cd, option_cd, vote_cd){
var f_cand_party = $("input[name=chk_cand_party]:checked").val();
param = {
"area_cd" : area_cd,
"option_cd" : option_cd,
"f_cand_party" : f_cand_party,
"vote_cd" : vote_cd
}
$.ajax({
type : "POST",
url : "/analysis/optionSave",
data: JSON.stringify(param),
contentType : "application/json",
success:function(data, status, xhr){
if(vote_cd == "1") getLastReport(param);
getTimeReport(param);
}
})
}
function getLastReport(param){
$.ajax({
type : "POST",
url : "/analysis/getLastReport",
data: JSON.stringify(param),
contentType : "application/json",
success:function(data, status, xhr){
var tmpAreaObj = $.grep(areaList, function(obj, idx){ return obj.area_cd == param.area_cd; })[0];
drawReport_4(param.area_cd, tmpAreaObj.area_nm, data);
}
})
}
function getTimeReport(param){
$.ajax({
type : "POST",
url : "/analysis/getTimeReport",
data: JSON.stringify(param),
contentType : "application/json",
success:function(data, status, xhr){
var tmpAreaObj = $.grep(areaList, function(obj, idx){ return obj.area_cd == param.area_cd; })[0];
drawReport_5(param.area_cd, tmpAreaObj.area_nm, data);
}
})
}
function isEmpty(value){
if(value == null || value.length == 0){
return "";
}else{
return value;
}
}
function drawReport_1(area_cd, area_nm, dataList){
var f_cand_party = $("input[name=chk_cand_party]:checked").val();
var tbObj = $("<table class='table table-bordered table-output report_1' id='report_1_" + area_cd + "'>").appendTo("#area_" + area_cd);
if($("#option_chkbox1").is(":checked") == false){
$(tbObj).css("display", "none");
}
var areaData = $.grep(dataList, function(obj, idx){ return obj.area_cd == area_cd; });
var clusterList = $.unique($.map(areaData, function(obj){ return obj.cluster; }));
var areaCandList = $.unique($.map($.grep(candList, function(o, i){ return o.area_cd == area_cd; }).sort(), function(obj){
return { nm : obj.cand_nm == "무응답" ? obj.cand_nm : (f_cand_party != "PARTY" && f_cand_party != "EDU" ? obj.party_nm + "<br>" : "") + isEmpty(obj.cand_nm), cd : obj.cand_party_cd };
}));
var tbHtml = "<caption>" + area_cd + " : " + area_nm + " - 보고서 1</caption><tbody>";
tbHtml += "<tr class='bg-info'>";
tbHtml += "<th class='w130'>투표구코드</th>";
tbHtml += "<th class='w130'>투표구명</th>";
$.each(areaCandList, function(i, cand){
tbHtml += "<th class='w130 align-middle'>" + cand.nm + "</th>";
})
tbHtml += "<th class='w130'>계</th></tr>";
//층 개수대로 each
var area_cnt = 0;
var area_rate = 0;
var area_sum_cnt = 0;
var sumCandList = new Array();
var cluster_rate = 0;
var cluster_sum_rate = 0;
$.each(clusterList, function(i, o){
var subareaList = _.uniq(
$.grep(areaData, function(obj, idx){ return obj.cluster == o; }).map(
function(obj){ return { "subarea_cd" : obj.subarea_cd, "subarea_nm" : obj.subarea_nm } }
), function(elem) { return [elem.subarea_cd, elem.subarea_nm].join() }
);
//층별 투표수 개수만큼
$.each(subareaList, function(index, objec){
var subarea_cnt = 0;
var subarea_rate = 0;
tbHtml += "<tr class='dott-border'>";
tbHtml += "<td>" + objec.subarea_cd + "</td>";
tbHtml += "<td>" + objec.subarea_nm + "</td>";
subarea_cnt = 0;
$.each($.grep(areaData, function(obj , idx){ return obj.cluster == o && obj.subarea_cd == objec.subarea_cd; }), function(idx, obj){
tbHtml += "<td>" + obj.cnt + "</td>";
subarea_cnt += parseInt(obj.cnt);
});
tbHtml += "<td>" + subarea_cnt + "</td>";
tbHtml += "</tr>"
tbHtml += "<tr class='weight-border'>"
tbHtml += "<td></td><td></td>";
subarea_rate = 0;
$.each($.grep(areaData, function(obj , idx){ return obj.cluster == o && obj.subarea_cd == objec.subarea_cd; }), function(idx, obj){
if(subarea_cnt == "0"){
tbHtml += "<td>" + "0.0%" + "</td>";
}else{
tbHtml += "<td>" + (parseFloat(obj.cnt) / parseFloat(subarea_cnt) * 100).toFixed(1) + "%</td>";
}
subarea_rate += parseFloat((parseFloat(obj.cnt) / parseFloat(subarea_cnt) * 100).toFixed(1));
});
if(subarea_rate == "0"){
tbHtml += "<td>" + "0.0%" + "</td>";
}else{
tbHtml += "<td>" + subarea_rate.toFixed(1) + "%</td>";
}
tbHtml += "</tr>";
});
//층별, 후보별 Sum 값
tbHtml += "<tr class='active'>";
tbHtml += "<td>" + o + "층계</td><td></td>";
$.each(areaCandList , function(idx, obj){
var clusterCandSum = $.map($.grep(areaData, function(objec, index){ return objec.cluster == o && objec.cand_party_cd == obj.cd;}),function(ob){ return ob.cnt}).reduce((a, b) => parseInt(a) + parseInt(b), 0);
tbHtml += "<td>" + clusterCandSum + "</td>";
});
var clusterSum = $.map($.grep(areaData, function(objec, index){ return objec.cluster == o;}),function(ob){ return ob.cnt}).reduce((a, b) => parseInt(a) + parseInt(b), 0);
tbHtml += "<td>" + clusterSum + "</td></tr>";
tbHtml += "<tr class='active'>";
tbHtml += "<td></td><td></td>";
var clusterRateSum = 0;
$.each(areaCandList , function(idx, obj){
var clusterCandSum = $.map($.grep(areaData, function(objec, index){ return objec.cluster == o && objec.cand_party_cd == obj.cd;}),function(ob){ return ob.cnt}).reduce((a, b) => parseInt(a) + parseInt(b), 0);
if(clusterSum == 0){ tbHtml += "<td>" + "0.0%" + "</td>"; }
else{
tbHtml += "<td>" + (parseFloat( clusterCandSum / clusterSum) * 100).toFixed(1) + "%</td>";
clusterRateSum += ((parseFloat( clusterCandSum / clusterSum) * 100).toFixed(1) * 1);
}
});
$.map($.grep(areaData, function(objec, index){ return objec.cluster == o;}),function(ob){ return ob.cnt;}).reduce((a, b) => parseInt(a) + parseInt(b), 0);
tbHtml += "<td>" + clusterRateSum.toFixed(1) + "%</td></tr>";
});
tbHtml += "<tr class='warning'>";
tbHtml += "<td>총계</td><td></td>";
$.each(areaCandList , function(idx, obj){
var areaCandSum = $.map($.grep(areaData, function(objec, index){ return objec.cand_party_cd == obj.cd;}),function(ob){ return ob.cnt}).reduce((a, b) => parseInt(a) + parseInt(b), 0);
tbHtml += "<td>" + areaCandSum + "</td>";
});
var areaSum = $.map(areaData,function(ob){ return ob.cnt}).reduce((a, b) => parseInt(a) + parseInt(b), 0);
tbHtml += "<td>" + areaSum + "</td></tr>";
tbHtml += "<tr class='warning'>";
tbHtml += "<td></td><td></td>";
var areaRateSum = 0;
$.each(areaCandList , function(idx, obj){
var areaCandSum = $.map($.grep(areaData, function(objec, index){ return objec.cand_party_cd == obj.cd;}),function(ob){ return ob.cnt}).reduce((a, b) => parseInt(a) + parseInt(b), 0);
if(areaSum == 0){ tbHtml += "<td>" + "0.0%" + "</td>"; }
else{
tbHtml += "<td>" + (parseFloat( areaCandSum / areaSum) * 100).toFixed(1) + "%</td>";
areaRateSum += ((parseFloat( areaCandSum / areaSum) * 100).toFixed(1) * 1);
}
});
var areaSum = $.map(areaData,function(ob){ return ob.cnt}).reduce((a, b) => parseInt(a) + parseInt(b), 0);
if(areaSum == 0){ tbHtml += "<td>" + "0.0%" + "</td>"; }
else{ tbHtml += "<td>" + areaRateSum.toFixed(1) + "%</td>";}
$(tbObj).html(tbHtml);
}
function drawReport_2(area_cd, area_nm, dataList){
var f_cand_party = $("input[name=chk_cand_party]:checked").val();
var tbObj = $("<table class='table table-bordered table-output report_2' id='report_2_" + area_cd + "'>").appendTo("#area_" + area_cd);
if($("#option_chkbox2").is(":checked") == false){
$(tbObj).css("display", "none");
}
var areaData = $.grep(dataList, function(obj, idx){ return obj.area_cd == area_cd; });
var clusterList = $.unique($.map(areaData, function(obj){ return obj.cluster; }).sort(function(a, b){ return a - b;}));
var areaCandList = $.unique($.map($.grep(candList, function(o, i){ return o.area_cd == area_cd; }).sort(), function(obj){
return { nm : obj.cand_nm == "무응답" ? obj.cand_nm : (f_cand_party != "PARTY" && f_cand_party != "EDU" ? obj.party_nm + "<br>" : "") + isEmpty(obj.cand_nm), cd : obj.cand_party_cd };
}));
var tbHtml = "<caption>" + area_cd + " : " + area_nm + " - 보고서 2</caption><tbody>";
tbHtml += "<tr class='bg-danger''>";
tbHtml += "<th class='w130'>구분</th>";
tbHtml += "<th class='w130'>응답자수</th>";
$.each(areaCandList, function(i, cand){
tbHtml += "<th class='w130'>" + cand.nm + "</th>";
})
tbHtml += "<th class='w130'>계</th></tr>";
//층 개수대로 each
$.each(clusterList, function(i, o){
var sectList = _.uniq(
$.grep(areaData, function(obj, idx){ return obj.cluster == o; }).map(
function(obj){ return { "sect" : obj.sect, "sum_cnt" : obj.sum_cnt } }
), function(elem) { return [elem.sect, elem.sum_cnt].join() }
);
//층별 투표수 개수만큼
$.each(sectList, function(index, objec){
var sect_rate_sum = 0;
tbHtml += "<tr " + ("|00|002|06|26|".indexOf("|"+objec.sect.split("_")[0]+"|") > -1 ? " class='weight-border' " : "") + ">";
tbHtml += "<td>" + (objec.sect).substring((objec.sect).indexOf("_") + 1) + "</td>";
tbHtml += "<td>" + parseInt(objec.sum_cnt) + "</td>";
$.each(areaCandList, function(i, cand){
var sect_rate = 0;
var sectData = $.grep(areaData, function(obj , idx){ return obj.sect == objec.sect && obj.cluster == o && obj.cand_party_cd == cand.cd; });
if(sectData.length > 0){
sect_rate = parseFloat(sectData[0].rate).toFixed(1);
}
if(sect_rate == 0){
tbHtml += "<td>" + "0.0%" + "</td>";
}else{
tbHtml += "<td>" + sect_rate + "%</td>";
}
sect_rate_sum += parseFloat(sect_rate);
});
if(sect_rate_sum == 0){ tbHtml += "<td>" + "0.0%" + "</td>";}
else{tbHtml += "<td>" + (sect_rate_sum).toFixed(1) + "%</td>";}
tbHtml += "</tr>";
});
//층별, 후보별 Sum 값
tbHtml += "<tr class='active'>";
tbHtml += "<td colspan='"+ (areaCandList.length + 3) +"'>" + (i + 1) + "층</td>";
tbHtml += "</tr>";
});
$(tbObj).html(tbHtml);
}
function drawReport_3(area_cd, area_nm, dataList, ddData){
var f_cand_party = $("input[name=chk_cand_party]:checked").val();
var sel_time_band = $("#sel_timeband option:selected").val();
var tbObj = $("<table class='table table-bordered table-output report_3' id='report_3_" + area_cd + "'>").appendTo("#area_" + area_cd);
if($("#option_chkbox3").is(":checked") == false){
$(tbObj).css("display", "none");
}
var areaData = $.grep(dataList, function(obj, idx){ return obj.area_cd == area_cd; });
var ddAreaData = $.grep(ddData, function(obj, idx){ return obj.area_cd == area_cd; });
var preOptionArea = $.grep(preOptionAreaList , function(obj, idx){ return obj.area_cd == area_cd; });
var areaCandList = $.unique($.map($.grep(candList, function(o, i){ return o.area_cd == area_cd; }).sort(), function(obj){
return { nm : obj.cand_nm == "무응답" ? obj.cand_nm : (f_cand_party != "PARTY" && f_cand_party != "EDU" ? obj.party_nm + "<br>" : "") + isEmpty(obj.cand_nm), cd : obj.cand_party_cd };
}));
var areaWeight = $.grep(weightList, function(o, i){ return o.area_cd == area_cd;});
var moment = [
{"type":"사전투표", "weight":areaWeight[0].poll_pre},
{"type":"5시이전", "weight":areaWeight[0].poll_5p},
{"type":"5시이후", "weight":areaWeight[0].poll_5n}
]
var f_moment = JSON.parse(JSON.stringify(moment));
var tmpOptionList = preOptionList;
var tbHtml = "<caption>" + area_cd + " : " + area_nm + " - 보고서 3</caption><tbody>";
tbHtml += "<tr class='bg-success'>";
tbHtml += "<th class='w130' colspan='3'>구분</th>";
tbHtml += "<th class='w130'>가중치값</th>";
$.each(areaCandList, function(i, o){
tbHtml += "<th class='w130'>" + o.nm + "</th>";
});
tbHtml += "<th class='w130'>계</th></tr>";
//사전 투표
$.each(tmpOptionList, function(i, o){
var sum = 0;
tbHtml += "<tr>";
if(i == 0){
tbHtml += "<td rowspan='" + tmpOptionList.length + "'>" + "사 전 투 표 옵 션".replaceAll(" ", "<br>") + "</td>";
}
tbHtml += "<td>" + o.option_nm + "</td>";
tbHtml += "<td>";
tbHtml += "<input type='radio' name='radio_pre_option_" + area_cd + "' id='radio_pre_option_" + area_cd + "_" + o.option_cd + "' value='" + o.option_cd + "' ";
if(f_cand_party == "PARTY"){
tbHtml += " style='width:25px;height:25px;' disabled='disabled' ";
}
else{
tbHtml += " style='width:25px;height:25px;' onclick='javascript:optionChoice(\"" + area_cd + "\",\"" + o.option_cd + "\", \"1\")' ";
}
if( o.option_cd == preOptionArea[0][f_cand_party.toLowerCase()+"_option_cd"] ){
tbHtml += "checked";
}
tbHtml += ">";
tbHtml += "</td>";
if(i == 0){
tbHtml += "<td rowspan='" + (tmpOptionList.length + (sel_time_band == "8" ? 1 : 2)) + "'>";
tbHtml += "사전투표 가중치<br>" + $.map(areaWeight, function(wo){ return wo.cluster + "층: " + wo.poll_pre; }).join("<br>");
tbHtml += "<br>&nbsp;<br>";
if(sel_time_band == "8"){
tbHtml += "당일투표 가중치<br>" + $.map(areaWeight, function(wo){ return wo.cluster + "층: " + (+wo.poll_5p + +wo.poll_5n).toFixed(10); }).join("<br>");
}else{
tbHtml += "5시이전 가중치<br>" + $.map(areaWeight, function(wo){ return wo.cluster + "층: " + wo.poll_5p; }).join("<br>");
tbHtml += "<br>&nbsp;<br>";
tbHtml += "5시이후 가중치<br>" + $.map(areaWeight, function(wo){ return wo.cluster + "층: " + wo.poll_5n; }).join("<br>");
}
tbHtml += "</td>";
}
/* $.each(areaData.sort(function(a, b){return parseInt(a.cand_party_cd) - parseInt(b.cand_party_cd);}), function(index, objec){
tbHtml += "<td>";
if(objec.pre_rate != undefined){
var tmpPreRate = JSON.parse(objec.pre_rate).filter(function(optVr){ return optVr.option_cd == o.option_cd })[0].vote_rate;
if(parseFloat(tmpPreRate) >= 0 && objec.cand_party_cd != 999){
sum += parseFloat(parseFloat(tmpPreRate).toFixed(1));
tbHtml += parseFloat(tmpPreRate).toFixed(1) + "%";
}
}
tbHtml += "</td>";
}); */
$.each(areaData.sort(function(a, b){
return parseInt(a.cand_party_cd) - parseInt(b.cand_party_cd);
}), function(index, objec){
tbHtml += "<td>";
if(objec.pre_rate != undefined){
var parsedRate = JSON.parse(objec.pre_rate);
var found = parsedRate.find(function(optVr){ return optVr.option_cd == o.option_cd });
if(found && parseFloat(found.vote_rate) >= 0 && objec.cand_party_cd != 999){
sum += parseFloat(parseFloat(found.vote_rate).toFixed(1));
tbHtml += parseFloat(found.vote_rate).toFixed(1) + "%";
}
}
tbHtml += "</td>";
});
tbHtml += "<td>"+ sum.toFixed(1) +"%</td>";
tbHtml += "</tr>";
});
//5시 이전
if(sel_time_band == "8"){
tbHtml += "<tr><td colspan='3'>당일투표</td>";
//tbHtml += "<td>" + (+f_moment[1].weight + +f_moment[2].weight).toFixed(10) + "</td>";
sum = 0;
$.each(areaData.sort(function(a, b){ return parseInt(a.cand_party_cd) - parseInt(b.cand_party_cd); }), function(idx, obj){
tbHtml += "<td>";
if(parseFloat(obj.p5p_rate) >= 0){
sum += parseFloat(parseFloat(obj.p5p_rate).toFixed(1));
tbHtml += parseFloat(obj.p5p_rate).toFixed(1) +"%";
};
tbHtml += "</td>";
});
tbHtml += "<td>" + sum.toFixed(1) + "%</td></tr>";
}else{
tbHtml += "<tr><td colspan='3'>" + f_moment[1].type + "</td>";
//tbHtml += "<td>" + f_moment[1].weight + "</td>";
sum = 0;
$.each(areaData.sort(function(a, b){ return parseInt(a.cand_party_cd) - parseInt(b.cand_party_cd); }), function(idx, obj){
tbHtml += "<td>";
if(parseFloat(obj.p5p_rate) >= 0){
sum += parseFloat(parseFloat(obj.p5p_rate).toFixed(1));
tbHtml += parseFloat(obj.p5p_rate).toFixed(1) +"%";
};
tbHtml += "</td>";
});
tbHtml += "<td>" + sum.toFixed(1) + "%</td></tr>";
}
//5시 이후
if(sel_time_band != "8"){
tbHtml += "<tr><td colspan='3'>" + f_moment[2].type + "</td>";
//tbHtml += "<td>" + f_moment[2].weight + "</td>";
sum = 0;
$.each(areaData.sort(function(a, b){ return parseInt(a.cand_party_cd) - parseInt(b.cand_party_cd); }), function(idx, obj){
tbHtml += "<td>";
if(parseFloat(obj.p5n_rate) >= 0 && obj.cand_party_cd != 999){
sum += parseFloat(parseFloat(obj.p5n_rate).toFixed(1));
tbHtml += parseFloat(obj.p5n_rate).toFixed(1) + "%";
};
tbHtml += "</td>";
});
tbHtml += "<td>" + sum.toFixed(1) + "%</td></tr>";
}
tbHtml += "</tbody>";
$(tbObj).html(tbHtml);
tbHtml = "";
tbHtml += "<tr><td style='border-left: none;border-right: none;' colspan='" + (4 + areaCandList.length) + "'>&nbsp;</td></tr>";
tbHtml += "<tr class='bg-warning'><th colspan='" + (4 + areaCandList.length) + "'>" + (sel_time_band != "8" ? "5시이전" : "당일투표") + " 옵션별 예측치</th></tr>";
var tmpDdOptionList = optionList;
if(false && $("input[name=chk_cand_party]:checked").val().toUpperCase() == "PARTY"){ //박준성 모든 옵션 보이게 막음
tmpDdOptionList = $.grep(tmpDdOptionList, function(o, i){ return o.option_cd == "01" });
}
tbHtml += "<tr class='bg-warning'>";
tbHtml += "<th colspan='4'>구분</th>";
$.each(areaCandList, function(i, o){
if(o.nm != "무응답"){
tbHtml += "<th class='w130'>" + o.nm + "</th>";
}
});
tbHtml += "<th class='w130'>계</th></tr>";
$.each(tmpDdOptionList, function(i, o){
var sum = 0;
tbHtml += "<tr>";
tbHtml += "<td colspan='4'>" + o.option_nm + "</td>";
$.each($.grep(ddAreaData, function(obj, idx){ return obj.option_cd == o.option_cd ; }).sort(function(a, b){return parseInt(a.cand_party_cd) - parseInt(b.cand_party_cd);}), function(index, objec){
sum += parseFloat(objec.vote_rate);
return tbHtml += "<td>" + parseFloat(objec.vote_rate).toFixed(1) + "%</td>";
});
tbHtml += "<td>"+ sum.toFixed(1) +"%</td>";
tbHtml += "</tr>";
});
$(tbObj).find("tbody").append(tbHtml);
}
function drawReport_4(area_cd, area_nm, dataList){
$("#report_4_" + area_cd).remove();
var f_cand_party = $("input[name=chk_cand_party]:checked").val();
var tbObj = $("<table class='table table-bordered table-output report_4' id='report_4_" + area_cd + "'>").appendTo("#area_" + area_cd);
if($("#option_chkbox4").is(":checked") == false){
$(tbObj).css("display", "none");
}
var areaData = $.grep(dataList, function(obj, idx){ return obj.area_cd == area_cd; });
var optionArea = $.grep(optionAreaList , function(obj, idx){ return obj.area_cd == area_cd; });
var areaCandList = $.unique($.map($.grep(candList, function(o, i){ return o.area_cd == area_cd && o.party_nm != "무응답" && o.cand_nm != "무응답"; }).sort(function(a, b) {
return parseInt(a.cand_party_cd) - parseInt(b.cand_party_cd);
}), function(obj){
return { "cand_party_cd" : obj.cand_party_cd , "cand_nm" : (f_cand_party != "PARTY" && f_cand_party != "EDU" ? obj.party_nm + "<br>" : "") + isEmpty(obj.cand_nm) } ;
}));
var tmpOptionList = optionList;
if(false && $("input[name=chk_cand_party]:checked").val().toUpperCase() == "PARTY"){ //박준성 모든 옵션 보이게 막음
tmpOptionList = $.grep(tmpOptionList, function(o, i){ return o.option_cd == "01" });
}
var tbHtml = "<caption>" + area_cd + " : " + area_nm + " - 보고서 4</caption><tbody>";
tbHtml += "<tr class='bg-primary'>";
tbHtml += "<th class='w130'>구분</th>";
tbHtml += "<th class='w130'>옵션선택</th>";
$.each(areaCandList, function(i, o){
tbHtml += "<th class='w130'>" + o.cand_nm + "</th>";
});
tbHtml += "<th class='w130'>계</th></tr>";
$.each(tmpOptionList, function(i, o){
var sum = 0;
tbHtml += "<tr>";
tbHtml += "<td>" + o.option_nm + "</td>";
tbHtml += "<td>";
tbHtml += "<input type='radio' name='radio_option_" + area_cd + "' id='radio_option_" + area_cd + "_" + o.option_cd + "' value='" + o.option_cd + "' ";
if(f_cand_party == "PARTY"){
tbHtml += " style='width:25px;height:25px;' disabled='disabled' ";
}
else{
tbHtml += " style='width:25px;height:25px;' onclick='javascript:optionChoice(\"" + area_cd + "\",\"" + o.option_cd + "\", \"2\")' ";
}
if( o.option_cd == optionArea[0][f_cand_party.toLowerCase()+"_option_cd"] ){
tbHtml += "checked";
}
tbHtml += ">";
tbHtml += "</td>";
$.each($.grep(areaData, function(obj, idx){ return obj.option_cd == o.option_cd ; }).sort(function(a, b){return parseInt(a.cand_party_cd) - parseInt(b.cand_party_cd);}), function(index, objec){
sum += parseFloat(objec.vote_rate);
return tbHtml += "<td>" + parseFloat(objec.vote_rate).toFixed(1) + "%</td>";
});
tbHtml += "<td>"+ sum.toFixed(1) +"%</td>";
tbHtml += "</tr>";
});
tbHtml += "</tbody>";
$(tbObj).html(tbHtml);
}
function drawReport_5(area_cd, area_nm, dataList) {
$("#report_5_" + area_cd).remove();
var f_cand_party = $("input[name=chk_cand_party]:checked").val();
var tbObj = $("<table class='table table-bordered table-output report_5' id='report_5_" + area_cd + "'>").appendTo("#area_" + area_cd);
if($("#option_chkbox5").is(":checked") == false){
$(tbObj).css("display", "none");
}
var areaData = $.grep(dataList, function(obj, idx){ return obj.area_cd == area_cd; });
var areaCandList = $.unique($.map($.grep(candList, function(o, i){ return o.area_cd == area_cd && o.party_nm != "무응답" && o.cand_nm != "무응답"; }).sort(function(a, b) {
return parseInt(a.cand_party_cd) - parseInt(b.cand_party_cd);
}), function(obj){
return { "cand_party_cd" : obj.cand_party_cd , "cand_nm" : (f_cand_party != "PARTY" && f_cand_party != "EDU" ? obj.party_nm + "<br>" : "") + isEmpty(obj.cand_nm) } ;
}));
var tbHtml = "<caption>" + area_cd + " : " + area_nm + " - 보고서 5</caption><tbody>";
tbHtml += "<tr style='background-color:#FFB2D9;color:#FFFFFF'>";
tbHtml += "<th class='w130'>차수</th>";
tbHtml += "<th class='w130'>시간</th>";
$.each(areaCandList, function(i, o){
tbHtml += "<th class='w130'>" + o.cand_nm + "</th>";
});
tbHtml += "<th class='w130'>계</th></tr>";
$.each(timeList, function(i, o){
if(i > 5) return false;
var sum = 0;
tbHtml += "<tr>";
tbHtml += "<td>"+o.time_band+"차</td>";
tbHtml += "<td>"+o.start_time+"</td>";
if($.grep(areaData, function(obj, idx){ return obj.time_band == o.time_band;}).length > 0){
$.each($.grep(areaData, function(obj, idx){ return obj.time_band == o.time_band;}).sort(function(a, b){return parseInt(a.cand_party_cd) - parseInt(b.cand_party_cd);}), function(index, objec){
sum += parseFloat(objec.vote_rate);
return tbHtml += "<td>" + parseFloat(objec.vote_rate).toFixed(1) + "%</td>";
});
}
else{
$.each(areaCandList, function(i, o){
tbHtml += "<td>0.0%</td>";
});
}
tbHtml += "<td>"+ sum.toFixed(1) +"%</td>";
tbHtml += "</tr>";
});
tbHtml += "</tbody>";
$(tbObj).html(tbHtml);
}
</script>

View File

@@ -0,0 +1,154 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!--------------------------------------- Header Start --------------------------------------->
<jsp:include page="../common/header.jsp" flush="true" />
<!---------------------------------------- Header End ---------------------------------------->
<!-- ---- -->
<div id="loadingDiv"></div>
<div class="contentsBody">
<div class="history" style="width:100%;height:100%;">
<div class="history_option">
<div class="history_option_area" style="height:70px;">
<span class="span_option">조회시간 :
<select class="form-control" id="history_date" style="width:740px;font-size:15px;display:inline-block;vertical-align: middle;height:35px;">
</select>
<input class="btn btn-danger" type="button" id="bt_delete"
style="font-size: 13px;height:35px;vertical-align: middle;display:none;" value="선택한 History 삭제" />
</span>
<span class="span_option" style="margin-left:15px;">보고서 ON/OFF :
<div class="option_chkbox_div">
<input type="checkbox" class="option_chkbox" id="option_chkbox1" checked>
<input type="checkbox" class="option_chkbox" id="option_chkbox2" checked>
<input type="checkbox" class="option_chkbox" id="option_chkbox3" checked>
<input type="checkbox" class="option_chkbox" id="option_chkbox4" checked>
<input type="checkbox" class="option_chkbox" id="option_chkbox5" checked>
</div>
</span>
</div>
</div>
<div class="history_output"></div>
</div>
</div>
<!--------------------------------------- Footer Start --------------------------------------->
<jsp:include page="../common/footer.jsp" flush="true" />
<!---------------------------------------- Footer End ---------------------------------------->
<script>
$(function(){
$.ajax({
method:"POST",
url:"/analysis/historyDate",
contentType : "application/json",
success : function(data, status, xhr){
var tmpHtml = "";
tmpHtml += "<option value=''>선택</option>";
$.each(data, function(i, o){
var tmpSearchReq = JSON.parse(o.search_req);
var tmpBlank = "                                 ";
tmpHtml += "<option value='"+ o.id +"'>" + left("#"+ tmpSearchReq.area + tmpBlank, 20) + left("#"+ tmpSearchReq.cand_party + tmpBlank, 10) + left("#"+ tmpSearchReq.time_band + tmpBlank, 14) + " -- "+ o.insert_date + "</span></option>";
});
$("#history_date").html(tmpHtml);
}
});
$("#history_date").on("change", function(){
var selID = $(this).children("option:selected").val();
if(selID != ""){
$("#bt_delete").show();
$.ajax({
method:"POST",
url:"/analysis/historyHtml",
data:JSON.stringify({"id":selID}),
contentType : "application/json",
success : function(data, status, xhr){
$(".history_output").html(data[0].html_str);
$(".history_output").find("input[type=radio]:not(:checked)").prop("disabled", true);
$(".option_chkbox").trigger("change");
}
});
}else{
$("#bt_delete").hide();
$(".history_output").html("");
}
});
$("#bt_delete").on("click", function(){
var selID = $("#history_date").children("option:selected").val();
$.ajax({
method:"POST",
url:"/analysis/deleteHistory",
data:JSON.stringify({"id":selID}),
contentType : "application/json",
success : function(data, status, xhr){
$("#history_date option[value='" + selID + "']").remove();
$(".history_output").html("");
$("#bt_delete").hide();
alert("해당 History가 삭제되었습니다.");
}
});
});
$("#option_chkbox1").on("change",function(){
if( $("#option_chkbox1").is(":checked") == true ){ $(".report_1").css("display","block"); }
else{ $(".report_1").css("display","none") }
})
$("#option_chkbox2").on("change",function(){
if( $("#option_chkbox2").is(":checked") == true ){ $(".report_2").css("display","block"); }
else{ $(".report_2").css("display","none") }
})
$("#option_chkbox3").on("change",function(){
if( $("#option_chkbox3").is(":checked") == true ){ $(".report_3").css("display","block"); }
else{ $(".report_3").css("display","none") }
})
$("#option_chkbox4").on("change",function(){
if( $("#option_chkbox4").is(":checked") == true ){ $(".report_4").css("display","block"); }
else{ $(".report_4").css("display","none") }
})
$("#option_chkbox5").on("change",function(){
if( $("#option_chkbox5").is(":checked") == true ){ $(".report_5").css("display","block"); }
else{ $(".report_5").css("display","none") }
})
});
function left(s, c) {
return s.substr(0, c);
}
function s2ab(s) {
var buf = new ArrayBuffer(s.length); //convert s to arrayBuffer
var view = new Uint8Array(buf); //create uint8array as viewer
for (var i=0; i<s.length; i++) view[i] = s.charCodeAt(i) & 0xFF; //convert to octet
return buf;
}
function exportExcel(JSONData, ReportTitle, sheetName){
var arrData = typeof JSONData != 'object' ? JSON.parse(JSONData) : JSONData;
var workBook = XLSX.utils.book_new();
var excelHandler = {
getExcelFileName : function(){
return ReportTitle + '.xlsx';
},
getSheetName : function(){
return sheetName || 'Sheet1';
},
getExcelData : function(){
return arrData;
},
getWorksheet : function(){
return XLSX.utils.json_to_sheet(this.getExcelData());
}
}
// step 2. 시트 만들기
var newWorksheet = excelHandler.getWorksheet();
// step 3. workbook에 새로만든 워크시트에 이름을 주고 붙인다.
XLSX.utils.book_append_sheet(workBook, newWorksheet, excelHandler.getSheetName());
var wbout = XLSX.write(workBook, {bookType:'xlsx', type: 'binary'});
saveAs(new Blob([s2ab(wbout)],{type:"application/octet-stream"}), excelHandler.getExcelFileName());
}
</script>

View File

@@ -0,0 +1,22 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!--------------------------------------- Header Start --------------------------------------->
<jsp:include page="../common/header.jsp" flush="true" />
<!---------------------------------------- Header End ---------------------------------------->
<div class="contentsBody">
<div class="main">
<div></div>
</div>
</div>
<!--------------------------------------- Footer Start --------------------------------------->
<jsp:include page="../common/footer.jsp" flush="true" />
<!---------------------------------------- Footer End ---------------------------------------->
<style>
.contentsBody{
background:url('/resources/image/bgnew1.png') no-repeat -150px;
}
</style>

View File

@@ -0,0 +1,365 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!--------------------------------------- Header Start --------------------------------------->
<jsp:include page="../common/header.jsp" flush="true" />
<!---------------------------------------- Header End ---------------------------------------->
<!-- ---- -->
<div class="contentsBody">
<div class="percentage">
<div class="percentage_option">
<div class="percentage_option_area" style="height:70px;">
<form name="frmOutputFinal">
<div class="btn-group btn-group-toggle" data-toggle="buttons">
<label class="btn btn-default active">
<input type="radio" name="chk_cand_party" id="chk_cand" value="CAND" autocomplete="off" checked>
<!--시·도지사-->
지역구
</label>
<label class="btn btn-default">
<input type="radio" name="chk_cand_party" id="chk_party" value="PARTY" autocomplete="off">
비례대표
</label>
<label class="btn btn-default">
<input type="radio" name="chk_cand_party" id="chk_edu" value="EDU" autocomplete="off">
교육감
</label>
</div>
<input class="btn btn-info" type="button" id="bt_search"
style="font-size: 13px;height:35px;vertical-align:top;" value="조회" onclick="getOutputFinalData();">
<input class="btn btn-info" type="button" id="bt_format"
style="font-size: 13px;height:35px;vertical-align:top;" value="데이터초기화" onclick="dataInitialization();">
<input class="btn btn-primary" type="button" id="bt_autoFormat"
style="font-size: 13px;height:35px;vertical-align: middle;" value="자동 100% 맞추기" onclick="autoFormatData();"
data-toggle="tooltip" title="99.8 미만 100.2 초과 데이터를 자동조정합니다.">
</form>
</div>
</div>
<div class="percentage_output"></div>
</div>
</div>
<!--------------------------------------- Footer Start --------------------------------------->
<jsp:include page="../common/footer.jsp" flush="true" />
<!---------------------------------------- Footer End ---------------------------------------->
<style>
.table-output th:nth-child(n + 4){
padding: 5px 14px !important;
line-height: 13px;
}
</style>
<script>
/* @@@@@ 오차범위 지정 @@@@ */
var FINAL_MAX_VALUE = 100.2;
var FINAL_MIN_VALUE = 99.8;
//var optionList = new Array();
$(function(){
$("input[name=chk_cand_party]").on("change", function(){
$("input[name=chk_cand_party]").parent().removeClass("active");
$(this).parent().addClass("active");
});
});
function optionCompare(cand_party){
var param = {
"f_cand_party" : cand_party
};
var optionList = new Array();
$.ajax({
method:"POST",
url:"/percentage/optionCompare",
contentType : "application/json",
data: JSON.stringify(param),
async:false,
success : function(data, status, xhr){
optionList = data;
}
});
return optionList;
}
function editOptionCommitFinalData(area_cd, vote_cd, option_cd, cand_party){
var param = {
"area_cd" : area_cd,
"vote_cd" : vote_cd,
"option_cd" : option_cd,
"f_cand_party" : cand_party
};
$.ajax({
method:"POST",
url:"/percentage/editOptionCommitFinalData",
contentType : "application/json",
data: JSON.stringify(param),
async:false,
success : function(data, status, xhr){
}
});
}
function editOptionRollback(area_cd, vote_cd, option_cd, cand_party){
var param = {
"area_cd" : area_cd,
"vote_cd" : vote_cd,
"option_cd" : option_cd,
"f_cand_party" : cand_party
};
$.ajax({
method:"POST",
url:"/percentage/editOptionRollback",
contentType : "application/json",
data: JSON.stringify(param),
async:false,
success : function(data, status, xhr){
}
});
}
function getOutputFinalData(){
var param = {
"f_cand_party" : $("input[name=chk_cand_party]:checked").val()
};
var tableDiv = $(".percentage_output");
tableDiv.html("");
//변경옵션이 있는지 체크
var optionList = optionCompare(param.f_cand_party);
var changedList = $.grep(optionList , function(o, i){
return o.option_cd != o.final_option_cd;
});
if(changedList.length > 0){
//변경옵션이 있는 경우
//변경여부 체크
var editConfirm = confirm("변경 된 옵션이 존재합니다.\n\n변경 된 옵션으로 데이터 반영은 '확인' \n기존옵션으로 유지는 '취소' 를 누르세요");
if (editConfirm) {
$.each(changedList, function(i, o){
//옵션이 변경 된 데이터만 수정
editOptionCommitFinalData(o.area_cd, o.vote_cd, o.final_option_cd, param.f_cand_party);
});
} else {
$.each(changedList, function(i, o){
//F_OUTPUT_OPTION을 F_OUTPUT_FINAL의 옵션으로 변경
editOptionRollback(o.area_cd, o.vote_cd, o.option_cd, param.f_cand_party);
});
}
}
$.ajax({
method:"POST",
url:"/percentage/getOutputFinalData",
contentType : "application/json",
data: JSON.stringify(param),
async : false,
success : function(data, status, xhr){
$(tableDiv).append("<div class='finalDiv table-responsive' style='overflow-x:visible;' id='finalDiv'>");
var areaList = _.uniq($.map( data.sort(function(a, b){ return a.area_cd - b.area_cd;}) ,function(obj){
return { "area_cd" : obj.area_cd , "area_nm" : obj.area_nm , "pre_option_nm" : obj.pre_option_nm, "option_nm" : obj.option_nm }; }), "area_cd");
var maxCandLength = 0;
var colIndex = 0;
$.each(areaList, function(i , o){
var areaCandLength = Object.keys( $.map($.grep(data, function(obj, idx){ return obj.area_cd == o.area_cd; }), function(obj){ return obj.area_cd; } ) ).length;
if( maxCandLength <= areaCandLength){ maxCandLength = areaCandLength; }
});
var tbObj = $("<table class='table table-bordered table-output final_report' id='final_report'>").appendTo("#finalDiv");
var tbHtml = "<tbody>";
tbHtml += "<tr class='info'>";
tbHtml += "<th class='w100'>선거구코드</th>";
tbHtml += "<th class='w170'>선거구명</th>";
tbHtml += "<th class='w50'>사전옵션</th>";
tbHtml += "<th class='w100'>당일옵션</th>";
if(data[0].party_nm != "" && data[0].party_nm != null){
$.each(uniq(data, ["cand_party_cd", "party_nm"]), function(idx, obj){
tbHtml += "<th class='w50'>" + obj.party_nm + "</th>";
});
}else{
for(var i = 1 ; i <= maxCandLength ; i ++){
tbHtml += "<th class='w50'>후보" + i + "</th>"; }
}
tbHtml += "<th class='w50'>계</th>";
tbHtml += "</tr>";
$.each(areaList, function(i, o){
tbHtml += "<tr>";
tbHtml += "<td class='w120'>" + o.area_cd + "</td>";
tbHtml += "<td class='w170'>" + o.area_nm + "</td>";
tbHtml += "<td class='w50'>" + o.pre_option_nm + "</td>";
tbHtml += "<td class='w100'>" + o.option_nm + "</td>";
colIndex = 0;
$.each($.grep(data, function(obj, idx){ return obj.area_cd == o.area_cd ; }).sort(function(a, b){return a.cand_party_cd - b.cand_party_cd;}),function(idx, obj){
tbHtml += "<td class='w50'><input class='w40 input-type";
$.each($.grep(data, function(item, cnt){ return item.area_cd == o.area_cd ; }).sort(function(a, b){return a.cand_party_cd - b.cand_party_cd;}),function(cnt, item){
if( (obj.cand_party_cd != item.cand_party_cd) && (parseFloat(obj.vote_rate) == parseFloat(item.vote_rate)) && parseFloat(obj.vote_rate) >= 3.0){
tbHtml += " bg-blue ";
}
});
tbHtml += " type='text' value='" + parseFloat(obj.vote_rate).toFixed(1) + "' ";
tbHtml += " onblur='voteRateEdit(\"" + obj.area_cd + "\",\"" + obj.cand_party + "\",\"" + obj.cand_party_cd + "\" , this.value);'></td>";
colIndex += 1;
});
for(var j = colIndex ; j < maxCandLength ; j ++){
tbHtml += "<td class='w50' style='background-color:#eee;'></td>";
}
sum = $.map($.grep(data, function(obj, idx){ return obj.area_cd == o.area_cd ; }),function(obj){ return parseFloat(obj.vote_rate); }).reduce(function(a, b){
return a + b; });
tbHtml += "<td";
if(sum.toFixed(1) < FINAL_MIN_VALUE || sum.toFixed(1) > FINAL_MAX_VALUE){
tbHtml += " style='background-color:red;'";
}
tbHtml += ">" + sum.toFixed(1) + "%</td>";
tbHtml += "</tr>";
});
$(tbObj).html(tbHtml);
}
});
}
function autoFormatData(){
/*
1. 최종데이터를 JSON 형식으로 불러온다
2. 각 선거구별 합계가 100%가 맞는지 체크
3. 100%가 맞지 않을 경우 100.2% 초과 시 1등에게서 빼고, 99.8% 미만 시 2등에게 더해준다.
4. 결과 재출력
*/
var param = {
"f_cand_party" : $("input[name=chk_cand_party]:checked").val()
};
$.ajax({
method:"POST",
url:"/percentage/getOutputFinalData",
contentType : "application/json",
data: JSON.stringify(param),
success : function(data, status, xhr){
var areaList = _.uniq($.map( data.sort(function(a, b){ return a.area_cd - b.area_cd;}) ,function(obj){
return { "area_cd" : obj.area_cd , "area_nm" : obj.area_nm , "option_nm" : obj.option_nm }; }), "area_cd");
var tmpList;
var tmpRate;
var sum;
$.each(areaList, function(i, o){
//선거구별 합계
sum = $.map($.grep(data, function(obj, idx){ return obj.area_cd == o.area_cd ; }),function(obj){ return obj.vote_rate; }).reduce(function(a, b){
return parseFloat(a) + parseFloat(b); });
if(sum.toFixed(1) < parseFloat(FINAL_MIN_VALUE)){
// 99.8 미만 - 2위에 더해줌
tmpList = $.grep(data, function(obj, idx){ return obj.area_cd == o.area_cd ;}).sort(function(a, b){
return parseFloat(b.vote_rate) - parseFloat(a.vote_rate);
});
tmpRate = (parseFloat(100.0) - sum.toFixed(1)) + parseFloat(tmpList[1].vote_rate);
voteRateEdit(tmpList[1].area_cd, tmpList[1].cand_party, tmpList[1].cand_party_cd, tmpRate.toFixed(1));
}
if(sum.toFixed(1) > parseFloat(FINAL_MAX_VALUE) ){
// 100.2 초과 - 1위에서 뺌
tmpList = $.grep(data, function(obj, idx){ return obj.area_cd == o.area_cd ;}).sort(function(a, b){
return parseFloat(b.vote_rate) - parseFloat(a.vote_rate);
});
tmpRate = parseFloat(tmpList[0].vote_rate) - (sum.toFixed(1) - parseFloat(100.0));
voteRateEdit(tmpList[0].area_cd, tmpList[0].cand_party,tmpList[0].cand_party_cd, tmpRate.toFixed(1));
}
});
getOutputFinalData();
}
});
}
function voteRateEdit(area_cd, cand_party, cand_party_cd, vote_rate){
var param = {
"area_cd" : area_cd, //선거구번호 ex)0102, 1407
"f_cand_party" : cand_party, //지역구 및 정당 ex) CAND , PARTY
"cand_party_cd" : cand_party_cd, //후보코드 ex)01, 02, 03
"vote_rate" : vote_rate //득표율
}
$.ajax({
method:"POST",
url:"/percentage/editOutputFinalData",
contentType : "application/json",
data: JSON.stringify(param),
async:false,
success : function(data, status, xhr){
getOutputFinalData();
//getOutputFinalData();
}
});
}
function dataInitialization(){
var param = {
"f_cand_party" : $("input[name=chk_cand_party]:checked").val()
};
$.ajax({
method:"POST",
url:"/percentage/dataInitialization",
contentType : "application/json",
data: JSON.stringify(param),
success : function(data, status, xhr){
getOutputFinalData();
}
});
}
function uniq(arr, item){
var retArr = [];
if(Array.isArray(item) == true){
retArr = $.unique($.map(arr, function(obj){
var tmpArr = [];
for(var i=0; i<item.length; i++){
tmpArr.push(obj[item[i]]);
}
return tmpArr.join("|");
}).sort());
retArr = $.map(retArr, function(obj){
var tmpObj = {};
var tmpVal = obj.split("|");
for(var i=0; i<item.length; i++){
tmpObj[item[i]] = tmpVal[i];
}
return tmpObj;
});
return retArr;
}else{
retArr = $.unique($.map(arr, function(obj){ return obj[item]; }).sort());
}
return retArr;
}
function groupBySum(jsonArr, groupArr, sumArr_opt){
var sumArr = sumArr_opt || [];
var newJsonArr = uniq(jsonArr, groupArr);
$.each(newJsonArr, function(i, obj){
$.each(sumArr, function(idx, sumCol){
obj[sumCol] = 0;
});
obj["groupByCount"] = 0;
});
$.each(newJsonArr, function(idx, obj){
$.each($.grep(jsonArr, function(o, i){
var nStr = "";
var pStr = "";
$.each(groupArr, function(ix, groupCol){
nStr += obj[groupCol] + "|";
pStr += o[groupCol] + "|";
});
return nStr == pStr;
}), function(i, o){
$.each(sumArr, function(ix, sumCol){
obj[sumCol] += +o[sumCol];
});
obj["groupByCount"]++;
});
});
return newJsonArr;
}
</script>

View File

@@ -0,0 +1,680 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!--------------------------------------- Header Start --------------------------------------->
<jsp:include page="../common/header.jsp" flush="true" />
<!---------------------------------------- Header End ---------------------------------------->
<!-- ---- -->
<div id="loadingDiv"></div>
<div class="contentsBody">
<div class="transmission" style="width:100%;height:100%;">
<div class="transmission_option">
<div class="transmission_option_area" style="height:70px;">
<button class="btn btn-primary" type="button" id="bt_TranFile_1" style="font-size: 13px;vertical-align:top;" onclick="TranFile_1();">
<!--선거구별 후보자 득표율<br>수기 조정<br>(file1)-->
선거구별 후보자 득표율<br>확인<br>(file1)
</button>
<button class="btn btn-success" type="button" id="bt_TranFile_1_down" style="font-size: 13px;vertical-align:top;display:none;" onclick="TranFile_1_down();">
선거구별 후보자 득표율<br>Excel Down<br>(file1_kri.csv)
</button>
<button class="btn btn-primary" type="button" id="bt_TranFile_2" style="font-size: 13px;vertical-align:top;" onclick="TranFile_2();">
<!--선거구별 비례대표 득표율<br>수기 조정<br>(file2)-->
선거구별 비례대표 득표율<br>확인<br>(file2)
</button>
<button class="btn btn-success" type="button" id="bt_TranFile_2_down" style="font-size: 13px;vertical-align:top;display:none;" onclick="TranFile_2_down();">
비례대표 득표율<br>Excel Down<br>(file2_kri.csv)
</button>
<button class="btn btn-primary" type="button" id="bt_TranFile_3" style="font-size: 13px;vertical-align:top;" onclick="TranFile_3();">
<!--지방선거 후보자별 득표율 <br>수기 조정<br>(file2)-->
지방선거 후보자별 득표율 <br>확인<br>(file3)
</button>
<button class="btn btn-success" type="button" id="bt_TranFile_3_down" style="font-size: 13px;vertical-align:top;display:none;" onclick="TranFile_3_down();">
지방선거 후보자별 득표율<br>Excel Down<br>(file3_kri.csv)
</button>
<button class="btn btn-primary" type="button" id="bt_TranFile_4" style="font-size: 13px;vertical-align:top;" onclick="TranFile_4();">
<!--지방선거 후보자별 득표율 <br>수기 조정<br>(file2)-->
재보궐 후보자별 득표율 <br>확인<br>(file4)
</button>
<button class="btn btn-success" type="button" id="bt_TranFile_4_down" style="font-size: 13px;vertical-align:top;display:none;" onclick="TranFile_4_down();">
재보궐 후보자별 득표율<br>Excel Down<br>(file4_kri.csv)
</button>
<button class="btn btn-primary" type="button" id="bt_TranFile_5" style="font-size: 13px;vertical-align:top;" onclick="TranFile_5();">
<!--지방선거 후보자별 득표율 <br>수기 조정<br>(file2)-->
전국 성/연령 응답자수 <br>확인<br>(file5)
</button>
<button class="btn btn-success" type="button" id="bt_TranFile_5_down" style="font-size: 13px;vertical-align:top;display:none;" onclick="TranFile_5_down();">
전국 성/연령 응답자수<br>Excel Down<br>(file5_kri.csv)
</button>
<button class="btn btn-primary" type="button" id="bt_TranFile_6" style="font-size: 13px;vertical-align:top;" onclick="TranFile_6();">
<!--지방선거 후보자별 득표율 <br>수기 조정<br>(file2)-->
재보궐 후보자별 득표율 <br>확인<br>(file6)
</button>
<button class="btn btn-success" type="button" id="bt_TranFile_6_down" style="font-size: 13px;vertical-align:top;display:none;" onclick="TranFile_6_down();">
재보궐 후보자별 득표율<br>Excel Down<br>(file6_kri.csv)
</button>
<button class="btn btn-primary" type="button" id="bt_TranFile_10" style="font-size: 13px;vertical-align:top;margin-left:20px;" onclick="TranFile_10();">
사전투표 득표율 vs. 당일투표 득표율<br>확인<br>(file100)
</button>
<button class="btn btn-success" type="button" id="bt_TranFile_10_down" style="font-size: 13px;vertical-align:top;margin-left:20px;display:none;" onclick="TranFile_10_down();">
사전투표 득표율 vs. 당일투표 득표율<br>Excel Down<br>(file100_kri.csv)
</button>
<!--
<button class="btn btn-success" type="button" id="bt_TranFile_3" style="font-size: 13px;vertical-align:top;margin-left:20px;" onclick="TranFile_3();">
전국 성/연령 응답자수<br>Excel Down<br>(file33_3.xlsx)
</button>
<button class="btn btn-success" type="button" id="bt_TranFile_4" style="font-size: 13px;vertical-align:top;" onclick="TranFile_4();">
전국 정당 득표율<br>Excel Down<br>(file44_3.xlsx)
</button>
-->
</div>
</div>
<div class="transmission_output"></div>
</div>
</div>
<!--------------------------------------- Footer Start --------------------------------------->
<jsp:include page="../common/footer.jsp" flush="true" />
<!---------------------------------------- Footer End ---------------------------------------->
<script>
var tmpDataList = [];
$(function(){
$(document).on("input", "td[contenteditable='true']", function(){
var thisData = $(this).data();
$.grep(tmpDataList, function(obj){ return obj["분류코드"] +"|"+ obj["지역코드"] == thisData.cdv && obj["후보기호"] == thisData.cd; })[0][thisData.keys] = $(this).text();
var tr = $(this).parent();
var tmpVal = $("td[contenteditable='true'][data-keys='"+thisData.keys+"'][data-cdv='"+thisData.cdv+"']").toArray().map(function(o){ return Number($(o).text()); }).reduce(function(a,b){ return a+b; });
$(".sumTd[data-keys='"+thisData.keys+"'][data-cdv='"+thisData.cdv+"']").text(tmpVal.toFixed(1));
var vote_rate = Number(tr.children("td[contenteditable='true'][data-keys='후보득표율'][data-cdv='"+thisData.cdv+"']").text());
var m_rate = Number(tr.children("td[contenteditable='true'][data-keys='남자'][data-cdv='"+thisData.cdv+"']").text());
var w_rate = Number(tr.children("td[contenteditable='true'][data-keys='여자'][data-cdv='"+thisData.cdv+"']").text());
if(m_rate >= vote_rate && vote_rate >= w_rate || w_rate >= vote_rate && vote_rate >= m_rate){
tr.children("td[contenteditable='true'][data-keys='남자'][data-cdv='"+thisData.cdv+"']").removeClass("errTd");
tr.children("td[contenteditable='true'][data-keys='여자'][data-cdv='"+thisData.cdv+"']").removeClass("errTd");
}else{
tr.children("td[contenteditable='true'][data-keys='남자'][data-cdv='"+thisData.cdv+"']").addClass("errTd");
tr.children("td[contenteditable='true'][data-keys='여자'][data-cdv='"+thisData.cdv+"']").addClass("errTd");
}
});
});
function compareRate(){
if(tmpDataList.length > 0){
var keys = Object.keys(tmpDataList[0]);
var tmpHtml = "<table class='table table-bordered'>";
tmpHtml += "<tr>";
$.each(keys, function(i, o){
tmpHtml += "<th>" + o + "</th>";
});
tmpHtml += "</tr>";
var codeDiv = "";
$.each(tmpDataList, function(i, o){
if(codeDiv == "" || codeDiv != o["분류코드"] +"|"+ o["지역코드"]){
if(codeDiv != ""){
tmpHtml += "<tr>";
$.each(keys, function(idx, k){
tmpHtml += "<td class='tdLine'></td>";
});
tmpHtml += "</tr>";
tmpHtml += "<tr>";
$.each(keys, function(idx, k){
if(",후보득표율,남자,여자,20대,30대,40대,50대,60대이상,60대,70대이상,남자20대,남자30대,남자40대,남자50대,남자60대이상,남자60대,남자70대이상,여자20대,여자30대,여자40대,여자50대,여자60대이상,여자60대,여자70대이상,1층,2층,3층,4층,5층,6층,7층,8층,사전투표득표율,당일투표득표율,".indexOf(","+k+",") > -1){
var tmpVal = $.grep(tmpDataList, function(obj){ return obj["분류코드"] +"|"+ obj["지역코드"] == codeDiv; }).map(function(d){ return Number(d[k]); }).reduce(function(a,b){ return a+b; });
tmpHtml += "<td data-cdv='" + codeDiv + "' data-keys='" + k + "' class='sumTd " + ((99.8 > tmpVal || 100.2 < tmpVal) && tmpVal != 0 ? "errTd" : "") + "''>" + tmpVal.toFixed(1) + "</td>";
}else{
tmpHtml += "<td></td>";
}
});
tmpHtml += "</tr>";
tmpHtml += "<tr>";
$.each(keys, function(idx, k){
tmpHtml += "<td class='tdLine'></td>";
});
tmpHtml += "</tr>";
}
codeDiv = o["분류코드"] +"|"+ o["지역코드"];
}
tmpHtml += "<tr>";
$.each(keys, function(idx, k){
if(",남자,여자,20대,30대,40대,50대,60대이상,60대,70대이상,남자20대,남자30대,남자40대,남자50대,남자60대이상,남자60대,남자70대이상,여자20대,여자30대,여자40대,여자50대,여자60대이상,여자60대,여자70대이상,1층,2층,3층,4층,5층,6층,7층,8층,사전투표득표율,당일투표득표율,".indexOf(","+k+",") > -1){
if(",남자,여자,".indexOf(","+k+",") > -1){
if(Number(o["남자"]) >= Number(o["후보득표율"]) && Number(o["후보득표율"]) >= Number(o["여자"]) ||
Number(o["여자"]) >= Number(o["후보득표율"]) && Number(o["후보득표율"]) >= Number(o["남자"])){
tmpHtml += "<td contenteditable='true' data-cdv='" + codeDiv + "' data-keys='" + k + "' data-cd='" + o["후보기호"] + "'>" + o[k] + "</td>";
}else{
tmpHtml += "<td class='errTd' contenteditable='true' data-cdv='" + codeDiv + "' data-keys='" + k + "' data-cd='" + o["후보기호"] + "'>" + o[k] + "</td>";
}
}else{
tmpHtml += "<td contenteditable='true' data-cdv='" + codeDiv + "' data-keys='" + k + "' data-cd='" + o["후보기호"] + "'>" + o[k] + "</td>";
}
}else{
tmpHtml += "<td>" + o[k] + "</td>";
}
});
tmpHtml += "</tr>";
});
tmpHtml += "<tr>";
$.each(keys, function(idx, k){
tmpHtml += "<td class='tdLine'></td>";
});
tmpHtml += "<tr>";
$.each(keys, function(idx, k){
if(",후보득표율,남자,여자,20대,30대,40대,50대,60대이상,60대,70대이상,남자20대,남자30대,남자40대,남자50대,남자60대이상,남자60대,남자70대이상,여자20대,여자30대,여자40대,여자50대,여자60대이상,여자60대,여자70대이상,1층,2층,3층,4층,5층,6층,7층,8층,사전투표득표율,당일투표득표율,".indexOf(","+k+",") > -1){
var tmpVal = $.grep(tmpDataList, function(obj){ return obj["분류코드"] +"|"+ obj["지역코드"] == codeDiv; }).map(function(d){ return Number(d[k]); }).reduce(function(a,b){ return a+b; });
tmpHtml += "<td data-cdv='" + codeDiv + "' data-keys='" + k + "' class='sumTd " + ((99.8 > tmpVal || 100.2 < tmpVal) && tmpVal != 0 ? "errTd" : "") + "''>" + tmpVal.toFixed(1) + "</td>";
}else{
tmpHtml += "<td></td>";
}
});
tmpHtml += "</tr>";
$.each(keys, function(idx, k){
tmpHtml += "<td class='tdLine'></td>";
});
tmpHtml += "</tr>";
$(".transmission_output").html(tmpHtml);
}
}
function TranFile_1(){
// console.log(["01","02","03","04","05","06","07","08","09"])
// return false;
// 지역구 자료
$.ajax({
method:"POST",
url:"/transmission/TranFile_1",
contentType : "application/json",
beforeSend : function(){
$("#loadingDiv").show();
},
success: function(data, status, xhr){
var dataList = $.map(data,function(obj){
var returnObj = {
"선거구 코드":obj.area_cd,
"KBS 선거구 코드":obj.area_cd_K,
"MBC 선거구 코드":obj.area_cd_M,
"SBS 선거구 코드":obj.area_cd_S,
"후보자 수":obj.cand_count,
"선거구 예측코드":obj.area_result,
"조사표본 수":obj.poll_cnt,
"오차한계":obj.err_limit,
"후보자 득표율":obj.vote_rate,
"예측 코드":obj.cand_result,
"순위 코드":obj.rnum,
"후보자 코드":obj.cand_party_cd,
"조사회사 코드":obj.company_code
}
return returnObj
});
tmpDataList = dataList;
compareRate();
$("#bt_TranFile_1_down").show();
$("#bt_TranFile_1").hide();
$("#bt_TranFile_2_down").hide();
$("#bt_TranFile_2").show();
$("#bt_TranFile_3_down").hide();
$("#bt_TranFile_3").show();
$("#bt_TranFile_4_down").hide();
$("#bt_TranFile_4").show();
$("#bt_TranFile_5_down").hide();
$("#bt_TranFile_5").show();
$("#bt_TranFile_6_down").hide();
$("#bt_TranFile_6").show();
$("#bt_TranFile_10_down").hide();
$("#bt_TranFile_10").show();
$("#loadingDiv").hide();
}
});
}
function TranFile_2(){
// 비례정당 자료
$.ajax({
method:"POST",
url:"/transmission/TranFile_2",
contentType : "application/json",
beforeSend : function(){
$("#loadingDiv").show();
},
success: function(data, status, xhr){
var dataList = $.map(data,function(obj){
var returnObj = {
"선거구코드":obj.area_cd,
"정당코드":obj.cand_party_cd,
"KBS 정당코드":obj.cand_party_cd_K,
"MBC 정당코드":obj.cand_party_cd_M,
"SBS 정당코드":obj.cand_party_cd_S,
"정당득표율":obj.vote_rate,
"조사회사코드":obj.company_code
}
return returnObj
});
// exportExcel(dataList, "file22_3", "file22");
tmpDataList = dataList;
compareRate();
$("#bt_TranFile_1_down").hide();
$("#bt_TranFile_1").show();
$("#bt_TranFile_2_down").show();
$("#bt_TranFile_2").hide();
$("#bt_TranFile_3_down").hide();
$("#bt_TranFile_3").show();
$("#bt_TranFile_4_down").hide();
$("#bt_TranFile_4").show();
$("#bt_TranFile_5_down").hide();
$("#bt_TranFile_5").show();
$("#bt_TranFile_6_down").hide();
$("#bt_TranFile_6").show();
$("#bt_TranFile_10_down").hide();
$("#bt_TranFile_10").show();
$("#loadingDiv").hide();
}
});
}
function TranFile_10(){
//전국 연령별/성연령별 투표율
$.ajax({
method:"POST",
url:"/transmission/TranFile_10",
contentType : "application/json",
beforeSend : function(){
$("#loadingDiv").show();
},
success: function(data, status, xhr){
var dataList = $.map(data,function(obj){
var returnObj = {
"선거구 코드":obj.area_cd,
"KBS 선거구코드":obj.area_cd_K,
"MBC 선거구코드":obj.area_cd_M,
"SBS 선거구코드":obj.area_cd_S,
"사전/당일 여부":obj.vote_type,
"후보자 코드":obj.cand_party_cd,
"후보자득표율":obj.vote_rate,
"조사회사코드":obj.company_code
}
return returnObj
});
//JSONtoCsvConverter(dataList, "file100_kri", true);
//exportExcel(dataList, "file100_kri", "file100");
tmpDataList = dataList;
compareRate();
$("#bt_TranFile_1_down").hide();
$("#bt_TranFile_1").show();
$("#bt_TranFile_2_down").hide();
$("#bt_TranFile_2").show();
$("#bt_TranFile_3_down").hide();
$("#bt_TranFile_3").show();
$("#bt_TranFile_4_down").hide();
$("#bt_TranFile_4").show();
$("#bt_TranFile_5_down").hide();
$("#bt_TranFile_5").show();
$("#bt_TranFile_6_down").hide();
$("#bt_TranFile_6").show();
$("#bt_TranFile_10_down").show();
$("#bt_TranFile_10").hide();
$("#loadingDiv").hide();
}
});
}
function TranFile_1_down(){
JSONtoCsvConverter(tmpDataList, "file1_kri", true);
}
function TranFile_2_down(){
//exportExcel(tmpDataList, "file22_3", "file22");
JSONtoCsvConverter(tmpDataList, "file2_kri", true);
}
function TranFile_3_down(){
//exportExcel(tmpDataList, "file22_3", "file22");
JSONtoCsvConverter(tmpDataList, "file3_kri", true);
}
function TranFile_4_down(){
//exportExcel(tmpDataList, "file22_3", "file22");
JSONtoCsvConverter(tmpDataList, "file3_kri", true);
}
function TranFile_5_down(){
//exportExcel(tmpDataList, "file22_3", "file22");
JSONtoCsvConverter(tmpDataList, "file3_kri", true);
}
function TranFile_6_down(){
//exportExcel(tmpDataList, "file22_3", "file22");
JSONtoCsvConverter(tmpDataList, "file3_kri", true);
}
function TranFile_10_down(){
//exportExcel(tmpDataList, "file22_3", "file22");
JSONtoCsvConverter(tmpDataList, "file100_kri", true);
}
function TranFile_3(){
// 시도지사/교육감 후보자별 득표율
$.ajax({
method:"POST",
url:"/transmission/TranFile_3",
contentType : "application/json",
beforeSend : function(){
$("#loadingDiv").show();
},
success: function(data, status, xhr){
var dataList = $.map(data,function(obj){
return {
"분류코드":obj.poll_type,
"지역코드":obj.area_cd,
"kbs지역코드":obj.area_cd_K,
"mbc지역코드":obj.area_cd_M,
"sbs지역코드":obj.area_cd_S,
"후보기호":obj.cand_party_cd,
"후보득표율":obj.vote_rate,
"순위":obj.rnum,
"오차한계":obj.err_limit,
"선거구조사표본수":obj.poll_cnt,
"선거구예측코드":obj.area_result,
"후보예측코드":obj.cand_result,
"남자":obj.sect_10,
"여자":obj.sect_20,
"20대":obj.sect_01,
"30대":obj.sect_02,
"40대":obj.sect_03,
"50대":obj.sect_04,
"60대이상":obj.sect_07,
"60대":obj.sect_05,
"70대이상":obj.sect_06,
"남자20대":obj.sect_11,
"남자30대":obj.sect_12,
"남자40대":obj.sect_13,
"남자50대":obj.sect_14,
"남자60대이상":obj.sect_17,
"남자60대":obj.sect_15,
"남자70대이상":obj.sect_16,
"여자20대":obj.sect_21,
"여자30대":obj.sect_22,
"여자40대":obj.sect_23,
"여자50대":obj.sect_24,
"여자60대이상":obj.sect_27,
"여자60대":obj.sect_25,
"여자70대이상":obj.sect_26,
"1층":obj.sect_91,
"2층":obj.sect_92,
"3층":obj.sect_93,
"4층":obj.sect_94,
"5층":obj.sect_95,
"6층":obj.sect_96,
"7층":obj.sect_97,
"8층":obj.sect_98,
"사전투표득표율":obj.pre_rate,
"당일투표득표율":obj.dd_rate
}
});
// exportExcel(dataList, "file11_3", "file11");
tmpDataList = dataList;
compareRate();
$("#bt_TranFile_1_down").hide();
$("#bt_TranFile_1").show();
$("#bt_TranFile_2_down").hide();
$("#bt_TranFile_2").show();
$("#bt_TranFile_3_down").show();
$("#bt_TranFile_3").hide();
$("#bt_TranFile_4_down").hide();
$("#bt_TranFile_4").show();
$("#bt_TranFile_5_down").hide();
$("#bt_TranFile_5").show();
$("#bt_TranFile_6_down").hide();
$("#bt_TranFile_6").show();
$("#bt_TranFile_10_down").hide();
$("#bt_TranFile_10").show();
$("#loadingDiv").hide();
}
});
}
function TranFile_4(){
// 재보궐 후보자 득표율
$.ajax({
method:"POST",
url:"/transmission/TranFile_4",
contentType : "application/json",
beforeSend : function(){
$("#loadingDiv").show();
},
success: function(data, status, xhr){
var dataList = $.map(data,function(obj){
return {
"분류코드":obj.poll_type,
"재보궐선거구코드":obj.area_cd,
"kbs지역코드":obj.area_cd_K,
"mbc지역코드":obj.area_cd_M,
"sbs지역코드":obj.area_cd_S,
"후보기호":obj.cand_party_cd,
"후보득표율":obj.vote_rate,
"순위":obj.rnum,
"오차한계":obj.err_limit,
"선거구조사표본수":obj.poll_cnt,
"선거구예측코드":obj.area_result,
"후보예측코드":obj.cand_result,
"남자":obj.sect_10,
"여자":obj.sect_20,
"20대":obj.sect_01,
"30대":obj.sect_02,
"40대":obj.sect_03,
"50대":obj.sect_04,
"60대이상":obj.sect_07,
"60대":obj.sect_05,
"70대이상":obj.sect_06,
"사전투표득표율":obj.pre_rate,
"당일투표득표율":obj.dd_rate
}
});
// exportExcel(dataList, "file22_3", "file22");
tmpDataList = dataList;
compareRate();
$("#bt_TranFile_1_down").hide();
$("#bt_TranFile_1").show();
$("#bt_TranFile_2_down").hide();
$("#bt_TranFile_2").show();
$("#bt_TranFile_3_down").hide();
$("#bt_TranFile_3").show();
$("#bt_TranFile_4_down").show();
$("#bt_TranFile_4").hide();
$("#bt_TranFile_5_down").hide();
$("#bt_TranFile_5").show();
$("#bt_TranFile_6_down").hide();
$("#bt_TranFile_6").show();
$("#bt_TranFile_10_down").hide();
$("#bt_TranFile_10").show();
$("#loadingDiv").hide();
}
});
}
function TranFile_5(){
//전국 연령별/성연령별 투표율
$.ajax({
method:"POST",
url:"/transmission/TranFile_5",
contentType : "application/json",
beforeSend : function(){
$("#loadingDiv").show();
},
success: function(data, status, xhr){
var dataList = data.map(function(obj,idx){
return {
"시도":obj.area_cd,
"남20대이하":obj.sect_11,
"남30대":obj.sect_12,
"남40대":obj.sect_13,
"남50대":obj.sect_14,
"남60대":obj.sect_15,
"남70대이상":obj.sect_16,
"여20대이하":obj.sect_21,
"여30대":obj.sect_22,
"여40대":obj.sect_23,
"여50대":obj.sect_24,
"여60대":obj.sect_25,
"여70대이상":obj.sect_26
}
});
// exportExcel(dataList, "file22_3", "file22");
tmpDataList = dataList;
compareRate();
$("#bt_TranFile_1_down").hide();
$("#bt_TranFile_1").show();
$("#bt_TranFile_2_down").hide();
$("#bt_TranFile_2").show();
$("#bt_TranFile_3_down").hide();
$("#bt_TranFile_3").show();
$("#bt_TranFile_4_down").hide();
$("#bt_TranFile_4").show();
$("#bt_TranFile_5_down").show();
$("#bt_TranFile_5").hide();
$("#bt_TranFile_6_down").hide();
$("#bt_TranFile_6").show();
$("#bt_TranFile_10_down").hide();
$("#bt_TranFile_10").show();
$("#loadingDiv").hide();
}
});
}
function TranFile_6(){
//전국 연령별/성연령별 투표율
$.ajax({
method:"POST",
url:"/transmission/TranFile_6",
contentType : "application/json",
beforeSend : function(){
$("#loadingDiv").show();
},
success: function(data, status, xhr){
var dataList = data.map(function(obj,idx){
return {
"시도":obj.area_nm,
"더불어민주당":obj.party_01,
"국민의힘":obj.party_02,
"정의당":obj.party_03,
"기타후보":obj.party_99
}
});
// exportExcel(dataList, "file22_3", "file22");
tmpDataList = dataList;
compareRate();
$("#bt_TranFile_1_down").hide();
$("#bt_TranFile_1").show();
$("#bt_TranFile_2_down").hide();
$("#bt_TranFile_2").show();
$("#bt_TranFile_3_down").hide();
$("#bt_TranFile_3").show();
$("#bt_TranFile_4_down").hide();
$("#bt_TranFile_4").show();
$("#bt_TranFile_5_down").hide();
$("#bt_TranFile_5").show();
$("#bt_TranFile_6_down").show();
$("#bt_TranFile_6").hide();
$("#bt_TranFile_10_down").hide();
$("#bt_TranFile_10").show();
$("#loadingDiv").hide();
}
});
}
// JSONtoCsvConverter(dataList, "file#_kri", false);
function JSONtoCsvConverter(JSONData, ReportTitle, columnLabel) {
var arrData = typeof JSONData != 'object' ? JSON.parse(JSONData) : JSONData;
var cellData = '';
//CSV += ReportTitle + '\r\n';
if (columnLabel) {
var row = "";
for (var index in arrData[0]) {
row += index + ',';
}
row = row.slice(0, -1);
cellData += row + '\r\n';
}
for (var i = 0; i < arrData.length; i++) {
var row = "";
for (var index in arrData[i]) {
row += arrData[i][index] + ',';
}
row = row.slice(0, -1);
cellData += row + '\r\n';
}
if (cellData == '') {
alert("Invalid data");
return;
}
var fileName = ReportTitle
var uri = 'data:text/csv;charset=UTF-8,\uFEFF' + encodeURI(cellData);
var link = document.createElement("a");
link.href = uri;
link.style = "visibility:hidden";
link.download = fileName + ".csv";
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
function s2ab(s) {
var buf = new ArrayBuffer(s.length); //convert s to arrayBuffer
var view = new Uint8Array(buf); //create uint8array as viewer
for (var i=0; i<s.length; i++) view[i] = s.charCodeAt(i) & 0xFF; //convert to octet
return buf;
}
function exportExcel(JSONData, ReportTitle, sheetName){
var arrData = typeof JSONData != 'object' ? JSON.parse(JSONData) : JSONData;
var workBook = XLSX.utils.book_new();
var excelHandler = {
getExcelFileName : function(){
return ReportTitle + '.xlsx';
},
getSheetName : function(){
return sheetName || 'Sheet1';
},
getExcelData : function(){
return arrData;
},
getWorksheet : function(){
return XLSX.utils.json_to_sheet(this.getExcelData());
}
}
// step 2. 시트 만들기
var newWorksheet = excelHandler.getWorksheet();
// step 3. workbook에 새로만든 워크시트에 이름을 주고 붙인다.
XLSX.utils.book_append_sheet(workBook, newWorksheet, excelHandler.getSheetName());
var wbout = XLSX.write(workBook, {bookType:'xlsx', type: 'binary'});
saveAs(new Blob([s2ab(wbout)],{type:"application/octet-stream"}), excelHandler.getExcelFileName());
}
</script>

View File

@@ -0,0 +1,79 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<div class="error-wall load-error">
<div class="error-container">
<h1>404</h1>
<h3>페이지를 찾을 수 없습니다.</h3>
<p>새로고침을 하거나 이전 페이지로 돌아가시기 바랍니다.</p>
<p>문제가 해결 되기를 원한다면 이메일을 보내세요.<br><br>KRi DCO 김동석 책임 : <a href="mailto:dskim@kric.com">dskim@kric.com</a></p>
</div>
</div>
<style>
@import url("../../../resources/css/font/S-Core-Dream/s-core-dream.css");
body{
padding:0;
margin:0;
}
.error-wall{
width: 100%;
height: 100%;
position: fixed;
text-align: center;
}
.load-error{
background-color: #ffc072;
}
.matinence{
background-color: #a473b1
}
.missing-page{
background-color: #00bbc6
}
.error-container{
display: block;
width: 100%;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
-webkit-transform: translate(-50%,-50%);
-moz-transform: translate(-50%,-50%);
}
h1{
color: #fff;
font-size: 120px;
font-family: 's-core-dream-black', sans-serif;
margin: 0;
}
h3{
color: #464444;
font-size: 44px;
font-family: 's-core-dream-medium', sans-serif;
margin: 0;
}
p{
font-size: 1.29em;
}
p:first-of-type{
color: #464444;
font-family: 's-core-dream-medium', sans-serif;
}
p:nth-of-type(2){
color: #464444;
font-family: 's-core-dream-bold', sans-serif;
}
a{
color:#464444;
}
</style>

View File

@@ -0,0 +1,78 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<div class="error-wall matinence">
<div class="error-container">
<h1>500</h1>
<h3>내부 서버 오류</h3>
<p>새로고침을 하거나 이전 페이지로 돌아가시기 바랍니다.</p>
<p>문제가 해결 되기를 원한다면 이메일을 보내세요.<br><br>KRi DCO 김동석 책임 : <a href="mailto:dskim@kric.com">dskim@kric.com</a></p>
</div>
</div>
<style>
@import url("../../../resources/css/font/S-Core-Dream/s-core-dream.css");
body{
padding:0;
margin:0;
}
.error-wall{
width: 100%;
height: 100%;
position: fixed;
text-align: center;
}
.load-error{
background-color: #ffc072;
}
.matinence{
background-color: #a473b1
}
.missing-page{
background-color: #00bbc6
}
.error-container{
display: block;
width: 100%;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
-webkit-transform: translate(-50%,-50%);
-moz-transform: translate(-50%,-50%);
}
h1{
color: #fff;
font-size: 120px;
font-family: 's-core-dream-black', sans-serif;
margin: 0;
}
h3{
color: #252424;
font-size: 44px;
font-family: 's-core-dream-medium', sans-serif;
margin: 0;
}
p{
font-size: 1.29em;
}
p:first-of-type{
color: #252424;
font-family: 's-core-dream-medium', sans-serif;
}
p:nth-of-type(2){
color: #252424;
font-family: 's-core-dream-bold', sans-serif;
}
a{
color:#252424;
}
</style>

View File

@@ -0,0 +1,69 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!Doctype html>
<html lang="ko">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="UTF-8">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<!-- Reset CSS -->
<link href="/resources/css/reset.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="/resources/css/custom.css" rel="stylesheet">
<title>로그인 페이지</title>
</head>
<body>
<div class="container">
<div class="containerDiv">
<form action="/login" method="post">
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}" />
<img src="/resources/image/KRI logo.png" alt="" style="width:250px;">
<div class="loginDiv"><span style="font-size:18px;">출구조사 예측</span></div>
<div class="loginDiv"><input type="text" name="username" placeholder="계정을 입력하세요" autocomplete="off"></div>
<div class="loginDiv"><input type="password" name="password" placeholder="비밀번호" autocomplete="off"></div>
<c:if test="${error eq 'true'}" >
<div class="loginDiv">
<p id="valid" class="alert alert-danger">${exception}</p>
</div>
</c:if>
<div class="loginDiv"><button class="btn btn-primary" type="submit">로그인</button></div>
</form>
</div>
</div>
</body>
</html>
<style>
body{
background-color: #edf0fe85;
}
.containerDiv{
width:50%;
height:500px;
padding:50px;
margin:0 auto;
margin-top:200px;
border:1px solid #aaa;
background-color: #ffffff;
text-align: center;
}
.loginDiv{
width:100%;
height:40px;
text-align: center;
margin-top:30px;
}
.loginDiv input,.loginDiv button{
text-align: center;
width:250px;
height:40px;
font-size:15px;
}
.loginDiv input{
border:1px solid #eee;
}
</style>

View File

@@ -0,0 +1,8 @@
@charset "utf-8";
/* * @ Analysis CSS * ------------------------------- */
.analysis{
width:100%;
height:100%;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,304 @@
@charset "utf-8";
@import url("font/S-Core-Dream/s-core-dream.css");
/*
font-family: 's-core-dream-thin';
font-family: 's-core-dream-extralight';
font-family: 's-core-dream-light';
font-family: 's-core-dream-regular';
font-family: 's-core-dream-medium';
font-family: 's-core-dream-bold';
font-family: 's-core-dream-extrabold';
font-family: 's-core-dream-heavy';
font-family: 's-core-dream-black';
*/
body{
background-color:#ffffff;
font-family:'s-core-dream-regular';
}
.top{
background-color:#484644;
width:100%;
height:50px;
padding-left:40px;
position:fixed;
}
.top-span{
margin-left:10px;
color:#ffffff;
display: inline-block;
font-family: 's-core-dream-light' !important;
font-size: 1.8em;
line-height:50px;
}
.wrapper {
width: 250px;
min-height:1080px;
height: 100%;
overflow: hidden;
display:inline-block;
position:fixed;
left:0;
top:50px;
}
.navigation{
background-color: rgb(28, 28, 28);
font-size: 14px;
overflow: hidden;
height: 100%;
}
.leftMenu{
margin:0;
padding:0;
list-style: none;
}
.leftMenu li{
font-size:16px;
color:#ffffff;
text-align: center;
height:60px;
}
.leftMenu .on{
background-color:rgb(77, 77, 77);
}
.leftMenu li:hover{
background-color:rgb(77, 77, 77);
}
.leftMenu li a{
font-size:16px;
color:#ffffff;
text-decoration:none;
display:inline-block;
width:100%;
height:100%;
line-height: 60px;
font-family:"s-core-dream-medium" !important;
}
.leftMenu > li > a.active{
background-color:#172F59;
}
.contentsBody{
position: absolute;
left: 250px;
top: 50px;
padding: 10px;
width: calc(100% - 250px);
height: calc(100% - 50px);
}
.analysis_output, .history_output, .transmission_output{
margin-left:20px;
overflow: scroll;
height: calc(100% - 80px);
}
.percentage{
width:100%;
height:100%;
}
.percentage_output{
margin-left:20px;
overflow: scroll;
height: calc(100% - 80px);
}
#loadingDiv{
background: url(/resources/image/loadingBar.gif) no-repeat center;
background-size: 120px;
width: 100%;
height: 100%;
background-color: rgba(255,255,255,0.4);
position: absolute;
z-index: 5001;
display:none;
}
.span_option{
font-size:15px;
margin-right:5px;
margin-left:5px;
vertical-align: middle;
}
.table-output{
table-layout: fixed;
font-size:9pt;
font-family:'Gulim' !important;
}
.table-output > caption{
font-size:15px;
padding:5px;
font-weight: bold;
border:1px solid #eee;
}
/* output 테이블*/
.table-output th, .table-output td{
height:18px;
padding:1px !important;
text-align:center !important;
vertical-align: middle !important;
height:auto;
}
.table-output th{
letter-spacing: -2px;
}
.w40{
width:40px !important;
}
.w50{
width:50px !important;
}
.w100{
width:100px !important;
}
.w120{
width:120px !important;
}
.w130{
width:130px !important;
}
.w150{
width:150px !important;
}
.w170{
width:170px !important;
}
.w200{
width:200px !important;
}
.areaDiv{
overflow:auto;
width: max-content;
}
.input-type{
text-align:center;
}
.dotted-border, .dotted-border > td{
border-bottom:1px dotted #ddd;
}
.weight-border, .weight-border > td{
border-bottom:2px solid #ddd;
}
.report_1, .report_2, .report_3, .report_4, .report_5{
width: auto;
border:none;
}
caption{
padding:7px;
}
.label_checkbox{
font-size:15px;
}
.option_chkbox_div{
display: inline-block;
width: 350px;
height: 35px;
margin-left: 5px;
vertical-align: middle;
}
input[type="checkbox"] {
cursor: pointer;
position: relative;
height: 15px;
width: 33px;
}
input[type="checkbox"]:before {
background-color: #95a5a6;
border-radius: 10px;
content: "";
display: block;
height: 20px;
transition: all 0.8s ease;
width: 33px;
}
input[type="checkbox"]:after {
background-color: #ecf0f1;
border-radius: 50%;
content: "";
display: block;
height: 14px;
left: 5px;
margin-top: -5px;
position: absolute;
top: 50%;
transition: all 0.5s ease;
width: 14px;
}
input[type="checkbox"]:checked:before {
background-color: #286090;
}
input[type="checkbox"]:checked:after {
background-color: #fff;
left: 15px;
}
.option_chkbox_div input[type="checkbox"]{
margin-right: 20px;
}
.option_chkbox_div input[type="checkbox"]:before{
height: 26px;
border-radius: 25px;
width: 50px;
}
.option_chkbox_div input[type="checkbox"]:after{
height: 20px;
width: 20px;
left: 3px;
padding-left: 5px;
font-family: 's-core-dream-medium';
color:#a0a0a0;
}
.option_chkbox_div input[type="checkbox"]:checked:after{
left: 27px;
color:#000;
}
.option_chkbox_div input[type="checkbox"]:nth-child(1):after{
content:"1";
}
.option_chkbox_div input[type="checkbox"]:nth-child(2):after{
content:"2";
}
.option_chkbox_div input[type="checkbox"]:nth-child(3):after{
content:"3";
}
.option_chkbox_div input[type="checkbox"]:nth-child(4):after{
content:"4";
}
.option_chkbox_div input[type="checkbox"]:nth-child(5):after{
content:"5";
}
.transmission_div{
margin-bottom:15px;
line-height:35px;
}
.bg-blue{
background-color:#286090;
color:#ffffff;
}
.transmission_output .table th,.transmission_output .table td{
padding:1px;
text-align:center;
}
.transmission_output .table td.errTd{
background:#ff9999;
}
.transmission_output .table td.tdLine{
background:#99ff99;
}

View File

@@ -0,0 +1,495 @@
[0903/090130.487:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.487:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.487:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.487:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.488:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.488:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.488:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.488:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.488:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.488:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.489:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.489:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.489:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.489:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.489:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.489:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.489:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.489:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.489:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.489:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.489:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.489:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.489:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.489:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.489:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.490:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.490:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.490:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.490:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.490:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.490:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.490:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.490:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.490:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.490:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.490:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.490:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.490:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.490:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.490:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.490:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.490:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.490:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.491:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090130.491:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.388:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.388:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.388:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.388:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.388:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.388:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.388:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.389:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.389:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.389:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.389:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.389:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.389:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.389:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.389:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.389:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.389:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.389:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.389:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.389:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.390:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.390:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.390:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.390:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.390:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.390:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.390:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.390:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.390:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.390:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.390:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.390:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.390:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.390:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.390:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.390:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.390:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.390:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.390:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.390:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.391:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.391:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.391:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.391:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/090213.391:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.956:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.956:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.956:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.956:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.956:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.956:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.956:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.956:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.957:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.957:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.957:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.957:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.957:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.957:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.957:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.957:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.957:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.957:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.957:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.957:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.957:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.957:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.957:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.957:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.957:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.958:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.958:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.958:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.958:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.958:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.958:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.958:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.958:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.958:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.958:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.958:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.958:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.958:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.958:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.958:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.959:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.959:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.959:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.959:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134455.959:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.840:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.840:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.840:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.840:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.840:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.841:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.841:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.841:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.841:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.841:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.841:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.841:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.841:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.841:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.841:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.841:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.841:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.841:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.841:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.841:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.841:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.841:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.842:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.842:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.842:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.842:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.842:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.842:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.842:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.842:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.842:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.842:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.842:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.842:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.842:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.842:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.842:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.842:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.842:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.843:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.843:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.843:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.843:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.843:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134506.843:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.627:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.628:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.628:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.628:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.628:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.628:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.628:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.628:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.628:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.628:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.629:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.629:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.629:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.629:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.629:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.629:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.629:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.629:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.629:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.629:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.629:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.629:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.629:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.629:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.629:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.629:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.630:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.630:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.630:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.630:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.630:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.630:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.630:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.630:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.630:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.630:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.630:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.630:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.630:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.630:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.630:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.630:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.630:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.630:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134517.631:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.946:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.946:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.946:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.946:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.946:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.946:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.947:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.947:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.947:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.947:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.947:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.947:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.947:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.947:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.947:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.947:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.947:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.947:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.947:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.947:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.947:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.947:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.947:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.947:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.947:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.948:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.948:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.948:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.948:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.948:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.948:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.948:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.948:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.948:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.948:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.948:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.948:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.948:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.948:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.948:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.948:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.948:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.948:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.949:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134530.949:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.243:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.244:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.244:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.244:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.244:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.244:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.244:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.244:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.244:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.244:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.244:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.245:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.245:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.245:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.245:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.245:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.245:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.245:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.245:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.245:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.245:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.245:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.245:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.245:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.245:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.245:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.245:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.245:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.245:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.245:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.246:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.246:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.246:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.246:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.246:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.246:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.246:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.246:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.264:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.264:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.264:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.264:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.264:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.264:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134538.264:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.862:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.863:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.863:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.863:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.863:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.863:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.863:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.863:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.863:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.863:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.863:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.863:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.863:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.863:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.864:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.864:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.864:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.864:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.864:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.864:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.864:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.864:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.864:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.864:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.864:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.864:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.865:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.865:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.865:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.865:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.865:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.865:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.865:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.865:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.865:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.865:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.865:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.865:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.866:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.866:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.866:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.866:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.866:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.866:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134546.866:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.005:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.005:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.005:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.005:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.005:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.005:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.006:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.006:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.006:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.006:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.006:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.006:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.006:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.006:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.006:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.006:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.006:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.006:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.006:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.006:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.007:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.007:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.007:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.007:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.007:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.007:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.007:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.007:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.007:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.007:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.007:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.007:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.008:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.008:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.008:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.008:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.008:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.008:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.008:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.008:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.008:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.008:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.008:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.008:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134554.008:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.654:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.654:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.654:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.654:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.654:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.655:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.655:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.655:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.655:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.655:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.655:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.655:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.655:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.655:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.655:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.655:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.655:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.655:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.655:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.655:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.655:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.656:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.656:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.656:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.656:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.656:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.656:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.656:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.656:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.656:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.656:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.656:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.656:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.656:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.656:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.656:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.656:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.656:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.656:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.656:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.656:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.657:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.657:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.657:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134607.657:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.316:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.316:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.316:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.317:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.317:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.317:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.317:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.317:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.317:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.317:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.317:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.317:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.318:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.318:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.318:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.318:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.318:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.318:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.318:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.318:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.318:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.318:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.318:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.318:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.318:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.318:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.318:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.318:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.318:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.318:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.318:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.318:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.319:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.319:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.319:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.319:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.319:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.319:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.319:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.319:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.319:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.319:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.319:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.319:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0903/134615.319:ERROR:crash_report_database_win.cc(469)] failed to stat report

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,63 @@
@font-face {
font-family: 's-core-dream-thin';
src: url('scdream1-webfont.woff2') format('woff2'),
url('scdream1-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 's-core-dream-extralight';
src: url('scdream2-webfont.woff2') format('woff2'),
url('scdream2-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 's-core-dream-light';
src: url('scdream3-webfont.woff2') format('woff2'),
url('scdream3-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 's-core-dream-regular';
src: url('scdream4-webfont.woff2') format('woff2'),
url('scdream4-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 's-core-dream-medium';
src: url('scdream5-webfont.woff2') format('woff2'),
url('scdream5-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 's-core-dream-bold';
src: url('scdream6-webfont.woff2') format('woff2'),
url('scdream6-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 's-core-dream-extrabold';
src: url('scdream7-webfont.woff2') format('woff2'),
url('scdream7-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 's-core-dream-heavy';
src: url('scdream8-webfont.woff2') format('woff2'),
url('scdream8-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 's-core-dream-black';
src: url('scdream9-webfont.woff2') format('woff2'),
url('scdream9-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,129 @@
/*Notes about grid:
Columns: 12
Grid Width: 825px
Column Width: 55px
Gutter Width: 15px
-------------------------------*/
.section {margin-bottom: 18px;
}
.section:after {content: ".";display: block;height: 0;clear: both;visibility: hidden;}
.section {*zoom: 1;}
.section .firstcolumn,
.section .firstcol {margin-left: 0;}
/* Border on left hand side of a column. */
.border {
padding-left: 7px;
margin-left: 7px;
border-left: 1px solid #eee;
}
/* Border with more whitespace, spans one column. */
.colborder {
padding-left: 42px;
margin-left: 42px;
border-left: 1px solid #eee;
}
/* The Grid Classes */
.grid1, .grid1_2cols, .grid1_3cols, .grid1_4cols, .grid2, .grid2_3cols, .grid2_4cols, .grid3, .grid3_2cols, .grid3_4cols, .grid4, .grid4_3cols, .grid5, .grid5_2cols, .grid5_3cols, .grid5_4cols, .grid6, .grid6_4cols, .grid7, .grid7_2cols, .grid7_3cols, .grid7_4cols, .grid8, .grid8_3cols, .grid9, .grid9_2cols, .grid9_4cols, .grid10, .grid10_3cols, .grid10_4cols, .grid11, .grid11_2cols, .grid11_3cols, .grid11_4cols, .grid12
{margin-left: 15px;float: left;display: inline; overflow: hidden;}
.width1, .grid1, .span-1 {width: 55px;}
.width1_2cols,.grid1_2cols {width: 20px;}
.width1_3cols,.grid1_3cols {width: 8px;}
.width1_4cols,.grid1_4cols {width: 2px;}
.input_width1 {width: 49px;}
.width2, .grid2, .span-2 {width: 125px;}
.width2_3cols,.grid2_3cols {width: 31px;}
.width2_4cols,.grid2_4cols {width: 20px;}
.input_width2 {width: 119px;}
.width3, .grid3, .span-3 {width: 195px;}
.width3_2cols,.grid3_2cols {width: 90px;}
.width3_4cols,.grid3_4cols {width: 37px;}
.input_width3 {width: 189px;}
.width4, .grid4, .span-4 {width: 265px;}
.width4_3cols,.grid4_3cols {width: 78px;}
.input_width4 {width: 259px;}
.width5, .grid5, .span-5 {width: 335px;}
.width5_2cols,.grid5_2cols {width: 160px;}
.width5_3cols,.grid5_3cols {width: 101px;}
.width5_4cols,.grid5_4cols {width: 72px;}
.input_width5 {width: 329px;}
.width6, .grid6, .span-6 {width: 405px;}
.width6_4cols,.grid6_4cols {width: 90px;}
.input_width6 {width: 399px;}
.width7, .grid7, .span-7 {width: 475px;}
.width7_2cols,.grid7_2cols {width: 230px;}
.width7_3cols,.grid7_3cols {width: 148px;}
.width7_4cols,.grid7_4cols {width: 107px;}
.input_width7 {width: 469px;}
.width8, .grid8, .span-8 {width: 545px;}
.width8_3cols,.grid8_3cols {width: 171px;}
.input_width8 {width: 539px;}
.width9, .grid9, .span-9 {width: 615px;}
.width9_2cols,.grid9_2cols {width: 300px;}
.width9_4cols,.grid9_4cols {width: 142px;}
.input_width9 {width: 609px;}
.width10, .grid10, .span-10 {width: 685px;}
.width10_3cols,.grid10_3cols {width: 218px;}
.width10_4cols,.grid10_4cols {width: 160px;}
.input_width10 {width: 679px;}
.width11, .grid11, .span-11 {width: 755px;}
.width11_2cols,.grid11_2cols {width: 370px;}
.width11_3cols,.grid11_3cols {width: 241px;}
.width11_4cols,.grid11_4cols {width: 177px;}
.input_width11 {width: 749px;}
.width12, .grid12, .span-12 {width: 825px;}
.input_width12 {width: 819px;}
/* Subdivided grid spaces */
.emptycols_left1, .prepend-1 {padding-left: 70px;}
.emptycols_right1, .append-1 {padding-right: 70px;}
.emptycols_left2, .prepend-2 {padding-left: 140px;}
.emptycols_right2, .append-2 {padding-right: 140px;}
.emptycols_left3, .prepend-3 {padding-left: 210px;}
.emptycols_right3, .append-3 {padding-right: 210px;}
.emptycols_left4, .prepend-4 {padding-left: 280px;}
.emptycols_right4, .append-4 {padding-right: 280px;}
.emptycols_left5, .prepend-5 {padding-left: 350px;}
.emptycols_right5, .append-5 {padding-right: 350px;}
.emptycols_left6, .prepend-6 {padding-left: 420px;}
.emptycols_right6, .append-6 {padding-right: 420px;}
.emptycols_left7, .prepend-7 {padding-left: 490px;}
.emptycols_right7, .append-7 {padding-right: 490px;}
.emptycols_left8, .prepend-8 {padding-left: 560px;}
.emptycols_right8, .append-8 {padding-right: 560px;}
.emptycols_left9, .prepend-9 {padding-left: 630px;}
.emptycols_right9, .append-9 {padding-right: 630px;}
.emptycols_left10, .prepend-10 {padding-left: 700px;}
.emptycols_right10, .append-10 {padding-right: 700px;}
.emptycols_left11, .prepend-11 {padding-left: 770px;}
.emptycols_right11, .append-11 {padding-right: 770px;}
.pull-1 {margin-left: -70px;}
.push-1 {margin-right: -70px;margin-left: 18px;float: right;}
.pull-2 {margin-left: -140px;}
.push-2 {margin-right: -140px;margin-left: 18px;float: right;}
.pull-3 {margin-left: -210px;}
.push-3 {margin-right: -210px;margin-left: 18px;float: right;}
.pull-4 {margin-left: -280px;}
.push-4 {margin-right: -280px;margin-left: 18px;float: right;}

View File

@@ -0,0 +1,396 @@
@import url('grid_12-825-55-15.css');
/*
CSS Reset by Eric Meyer - Released under Public Domain
http://meyerweb.com/eric/tools/css/reset/
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center, dl, dt, dd, ol, ul, li,
fieldset, form, label, legend, table,
caption, tbody, tfoot, thead, tr, th, td
{margin: 0;padding: 0;border: 0;outline: 0;
font-size: 100%;vertical-align: baseline;
background: transparent;}
body {line-height: 1;}
ol, ul {list-style: none;}
blockquote, q {quotes: none;}
blockquote:before, blockquote:after,
q:before, q:after {content: ''; content: none;}
:focus {outline: 0;}
ins {text-decoration: none;}
del {text-decoration: line-through;}
table {border-collapse: collapse;border-spacing: 0;}
body {
color: #000;
background-color: #dcdcdc;
}
a {
text-decoration: none;
color: #1883ba;
}
h1{
font-size: 32px;
font-weight: normal;
font-style: normal;
margin-bottom: 18px;
}
h2{
font-size: 18px;
}
#container {
width: 865px;
margin: 0px auto;
}
#header {
padding: 20px;
font-size: 36px;
background-color: #000;
color: #fff;
}
#header span {
color: #666;
}
#main_content {
background-color: #fff;
padding: 60px 20px 20px;
}
#footer p {
margin: 0;
padding-top: 10px;
padding-bottom: 50px;
color: #333;
font: 10px Arial, sans-serif;
}
.tabs {
width: 100%;
height: 31px;
background-color: #444;
}
.tabs li {
float: left;
margin: 0;
overflow: hidden;
background-color: #444;
}
.tabs li a {
display: block;
color: #fff;
text-decoration: none;
font: bold 11px/11px 'Arial';
text-transform: uppercase;
padding: 10px 15px;
border-right: 1px solid #fff;
}
.tabs li a:hover {
background-color: #00b3ff;
}
.tabs li.active a {
color: #000;
background-color: #fff;
}
div.huge {
font-size: 300px;
line-height: 1em;
padding: 0;
letter-spacing: -.02em;
overflow: hidden;
}
div.glyph_range {
font-size: 72px;
line-height: 1.1em;
}
.size10{ font-size: 10px; }
.size11{ font-size: 11px; }
.size12{ font-size: 12px; }
.size13{ font-size: 13px; }
.size14{ font-size: 14px; }
.size16{ font-size: 16px; }
.size18{ font-size: 18px; }
.size20{ font-size: 20px; }
.size24{ font-size: 24px; }
.size30{ font-size: 30px; }
.size36{ font-size: 36px; }
.size48{ font-size: 48px; }
.size60{ font-size: 60px; }
.size72{ font-size: 72px; }
.size90{ font-size: 90px; }
.psample_row1 { height: 120px;}
.psample_row1 { height: 120px;}
.psample_row2 { height: 160px;}
.psample_row3 { height: 160px;}
.psample_row4 { height: 160px;}
.psample {
overflow: hidden;
position: relative;
}
.psample p {
line-height: 1.3em;
display: block;
overflow: hidden;
margin: 0;
}
.psample span {
margin-right: .5em;
}
.white_blend {
width: 100%;
height: 61px;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAVkAAAA9CAYAAAAH4BojAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAO1JREFUeNrs3TsKgFAMRUE/eer+NxztxMYuEWQG3ECKwwUF58ycAKixOAGAyAKILAAiCyCyACILgMgCiCyAyAIgsgAiCyCyAIgsgMgCiCwAIgsgsgAiC4DIAogsACIL0CWuZ3UGgLrIhjMA1EV2OAOAJQtgyQLwjOzmDAAiCyCyAIgsQFtkd2cAEFkAkQVAZAHaIns4A4AlC2DJAiCyACILILIAiCzAV5H1dQGAJQsgsgCILIDIAvwisl58AViyAJYsACILILIAIgvAe2T9EhxAZAFEFgCRBeiL7HAGgLrIhjMAWLIAliwAt1OAAQDwygTBulLIlQAAAABJRU5ErkJggg==);
position: absolute;
bottom: 0;
}
.black_blend {
width: 100%;
height: 61px;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAVkAAAA9CAYAAAAH4BojAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAPJJREFUeNrs3TEKhTAQRVGjibr/9QoxhY2N3Ywo50A28IrLwP9g6b1PAMSYTQAgsgAiC4DIAogsgMgCILIAIgsgsgCILIDIAogsACILILIAIguAyAKILIDIAiCyACILgMgCZCnjLWYAiFGvB0BQZJsZAFyyAC5ZAO6RXc0AILIAIguAyAKkRXYzA4DIAogsACILkBbZ3QwALlkAlywAIgsgsgAiC4DIArwVWf8uAHDJAogsACILILIAv4isH74AXLIALlkARBZAZAFEFoDnyPokOIDIAogsACILkBfZZgaAuMhWMwC4ZAE+p4x3mAEgxinAAJ+XBbPWGkwAAAAAAElFTkSuQmCC);
position: absolute;
bottom: 0;
}
.fullreverse {
background: #000 !important;
color: #fff !important;
margin-left: -20px;
padding-left: 20px;
margin-right: -20px;
padding-right: 20px;
padding: 20px;
margin-bottom:0;
}
.sample_table td {
padding-top: 3px;
padding-bottom:5px;
padding-left: 5px;
vertical-align: middle;
line-height: 1.2em;
}
.sample_table td:first-child {
background-color: #eee;
text-align: right;
padding-right: 5px;
padding-left: 0;
padding: 5px;
font: 11px/12px "Courier New", Courier, mono;
}
code {
white-space: pre;
background-color: #eee;
display: block;
padding: 10px;
margin-bottom: 18px;
overflow: auto;
}
.bottom,.last {margin-bottom:0 !important; padding-bottom:0 !important;}
.box {
padding: 18px;
margin-bottom: 18px;
background: #eee;
}
.reverse,.reversed { background: #000 !important;color: #fff !important; border: none !important;}
#bodycomparison {
position: relative;
overflow: hidden;
font-size: 72px;
height: 90px;
white-space: nowrap;
}
#bodycomparison div{
font-size: 72px;
line-height: 90px;
display: inline;
margin: 0 15px 0 0;
padding: 0;
}
#bodycomparison div span{
font: 10px Arial;
position: absolute;
left: 0;
}
#xheight {
float: none;
position: absolute;
color: #d9f3ff;
font-size: 72px;
line-height: 90px;
}
.fontbody {
position: relative;
}
.arialbody{
font-family: Arial;
position: relative;
}
.verdanabody{
font-family: Verdana;
position: relative;
}
.georgiabody{
font-family: Georgia;
position: relative;
}
/* @group Layout page
*/
#layout h1 {
font-size: 36px;
line-height: 42px;
font-weight: normal;
font-style: normal;
}
#layout h2 {
font-size: 24px;
line-height: 23px;
font-weight: normal;
font-style: normal;
}
#layout h3 {
font-size: 22px;
line-height: 1.4em;
margin-top: 1em;
font-weight: normal;
font-style: normal;
}
#layout p.byline {
font-size: 12px;
margin-top: 18px;
line-height: 12px;
margin-bottom: 0;
}
#layout p {
font-size: 14px;
line-height: 21px;
margin-bottom: .5em;
}
#layout p.large{
font-size: 18px;
line-height: 26px;
}
#layout .sidebar p{
font-size: 12px;
line-height: 1.4em;
}
#layout p.caption {
font-size: 10px;
margin-top: -16px;
margin-bottom: 18px;
}
/* @end */
/* @group Glyphs */
#glyph_chart div{
background-color: #d9f3ff;
color: black;
float: left;
font-size: 36px;
height: 1.2em;
line-height: 1.2em;
margin-bottom: 1px;
margin-right: 1px;
text-align: center;
width: 1.2em;
position: relative;
padding: .6em .2em .2em;
}
#glyph_chart div p {
position: absolute;
left: 0;
top: 0;
display: block;
text-align: center;
font: bold 9px Arial, sans-serif;
background-color: #3a768f;
width: 100%;
color: #fff;
padding: 2px 0;
}
#glyphs h1 {
font-family: Arial, sans-serif;
}
/* @end */
/* @group Installing */
#installing {
font: 13px Arial, sans-serif;
}
#installing p,
#glyphs p{
line-height: 1.2em;
margin-bottom: 18px;
font: 13px Arial, sans-serif;
}
#installing h3{
font-size: 15px;
margin-top: 18px;
}
/* @end */
#rendering h1 {
font-family: Arial, sans-serif;
}
.render_table td {
font: 11px "Courier New", Courier, mono;
vertical-align: middle;
}

View File

@@ -0,0 +1,108 @@
/*! Generated by Font Squirrel (https://www.fontsquirrel.com) on September 2, 2019 */
@font-face {
font-family: 's-core_dream1_thin';
src: url('scdream1-webfont.woff2') format('woff2'),
url('scdream1-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 's-core_dream2_extralight';
src: url('scdream2-webfont.woff2') format('woff2'),
url('scdream2-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 's-core_dream3_light';
src: url('scdream3-webfont.woff2') format('woff2'),
url('scdream3-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 's-core_dream4_regular';
src: url('scdream4-webfont.woff2') format('woff2'),
url('scdream4-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 's-core_dream5_medium';
src: url('scdream5-webfont.woff2') format('woff2'),
url('scdream5-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 's-core_dream6_bold';
src: url('scdream6-webfont.woff2') format('woff2'),
url('scdream6-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 's-core_dream7_extrabold';
src: url('scdream7-webfont.woff2') format('woff2'),
url('scdream7-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 's-core_dream8_heavy';
src: url('scdream8-webfont.woff2') format('woff2'),
url('scdream8-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 's-core_dream9_black';
src: url('scdream9-webfont.woff2') format('woff2'),
url('scdream9-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}

View File

@@ -0,0 +1,7 @@
@charset "utf-8";
/* * @ Main CSS * ------------------------------- */
.main{
}

View File

@@ -0,0 +1,125 @@
@charset "utf-8";
/* * @ RESET CSS * ------------------------------- */
html,
body,
div,
p,
span,
strong,
b,
em,
iframe,
pre,
h1,
h2,
h3,
h4,
h5,
h6,
img,
dl,
dt,
dd,
fieldset,
form,
legend,
label,
table,
caption,
thead,
tbody,
tfoot,
tr,
th,
td,
ul,
ol,
li,
a,
input,
select,
textarea {
margin: 0;
padding: 0;
border: 0 none;
}
body {
font-family: MalgunGothic, '맑은 고딕', '돋움', Dotum, AppleGothic, Sans-serif, Arial;
font-size: 12px;
line-height: 1;
color: #333;
}
ul,
ol,
li {
list-style: none;
}
em,
address {
font-style: normal;
}
img {
border: 0 none;
font-size: 0;
line-height: 0;
}
sup {
position: relative;
top: 2px;
font-size: 11px;
line-height: 100%;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
caption {
overflow: hidden;
}
th,
td {
vertical-align: middle;
/* white-space: nowrap */
}
a {
color: #333;
text-decoration: none;
line-height: 1;
}
a:hover,
a:focus,
a:active {
text-decoration: underline;
}
a:visited {
color: #333;
}
*,
html {
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
}
*,
*:before,
*:after {
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 779 B

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