diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..549e00a --- /dev/null +++ b/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/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/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..c1dd12f Binary files /dev/null and b/.mvn/wrapper/maven-wrapper.jar differ diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..d8bc321 --- /dev/null +++ b/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.3/apache-maven-3.8.3-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar diff --git a/mvnw b/mvnw new file mode 100644 index 0000000..8a8fb22 --- /dev/null +++ b/mvnw @@ -0,0 +1,316 @@ +#!/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 /usr/local/etc/mavenrc ] ; then + . /usr/local/etc/mavenrc + fi + + 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="`\\unset -f command; \\command -v 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/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.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" || rm -f "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$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 \ + $MAVEN_DEBUG_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" \ + "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/mvnw.cmd b/mvnw.cmd new file mode 100644 index 0000000..1d8ab01 --- /dev/null +++ b/mvnw.cmd @@ -0,0 +1,188 @@ +@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 "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* +if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\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/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + +FOR /F "usebackq 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%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.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 "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" +if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\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% + +cmd /C exit /B %ERROR_CODE% diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..2458a4b --- /dev/null +++ b/pom.xml @@ -0,0 +1,171 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.6.2 + + + com.xkrs + WordAndExcel + 0.0.1-SNAPSHOT + WordAndExcel + Demo project for Spring Boot + + + 5.19 + 6.1.5.Final + 5.4.20.Final + UTF-8 + UTF-8 + 11 + 11 + 11 + 1.2.76 + 2.10.5 + 2.10.5 + 4.5.2 + 4.4.3 + + + + + org.springframework.boot + spring-boot-starter-aop + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-devtools + true + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-webflux + + + org.springframework.boot + spring-boot-starter + + + org.springframework.boot + spring-boot-starter-logging + + + + + + org.springframework.boot + spring-boot-starter-log4j2 + + + org.apache.commons + commons-pool2 + + + + mysql + mysql-connector-java + + + nl.basjes.parse.useragent + yauaa + ${yauaa.version} + + + org.hibernate.validator + hibernate-validator + ${hibernate-validator.version} + + + org.hibernate + hibernate-spatial + ${hibernate-spatial.version} + + + com.alibaba + fastjson + ${fastjson.version} + + + + + io.springfox + springfox-swagger-ui + ${springfox-swagger-ui.version} + + + + io.springfox + springfox-swagger2 + ${springfox-swagger2.version} + + + + net.sf.json-lib + json-lib + 2.4 + jdk15 + + + org.apache.httpcomponents + httpclient + ${httpclient.version} + + + cn.hutool + hutool-all + ${hutool-all.version} + + + + + + net.sf.jxls + jxls-core + 1.0.3 + + + + + org.apache.tomcat + servlet-api + 6.0.35 + + + + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/src/main/java/com/xkrs/WordAndExcelApplication.java b/src/main/java/com/xkrs/WordAndExcelApplication.java new file mode 100644 index 0000000..a11963d --- /dev/null +++ b/src/main/java/com/xkrs/WordAndExcelApplication.java @@ -0,0 +1,13 @@ +package com.xkrs; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class WordAndExcelApplication { + + public static void main(String[] args) { + SpringApplication.run(WordAndExcelApplication.class, args); + } + +} diff --git a/src/main/java/com/xkrs/config/CorsConfig.java b/src/main/java/com/xkrs/config/CorsConfig.java new file mode 100644 index 0000000..4ddeebe --- /dev/null +++ b/src/main/java/com/xkrs/config/CorsConfig.java @@ -0,0 +1,23 @@ +package com.xkrs.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +import javax.annotation.Resource; + +/** + * 系统跨域配置 + * @author tajochen + */ +@Configuration +public class CorsConfig implements WebMvcConfigurer { + + @Resource + private CorsInterceptor corsInterceptor; + + @Override + public void addInterceptors(InterceptorRegistry registry) { + registry.addInterceptor(corsInterceptor); + } +} diff --git a/src/main/java/com/xkrs/config/CorsInterceptor.java b/src/main/java/com/xkrs/config/CorsInterceptor.java new file mode 100644 index 0000000..03b7d22 --- /dev/null +++ b/src/main/java/com/xkrs/config/CorsInterceptor.java @@ -0,0 +1,29 @@ +package com.xkrs.config; + +import org.springframework.stereotype.Component; +import org.springframework.web.servlet.HandlerInterceptor; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * 跨域处理 + * @author tajochen + */ +@Component +public class CorsInterceptor implements HandlerInterceptor { + + @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { + + //添加跨域CORS + response.setHeader("Access-Control-Allow-Origin", "*"); + response.setHeader("Access-Control-Allow-Credentials", "false"); + response.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS"); + response.setHeader("Access-Control-Allow-Headers", "Content-Type , Authorization," + + "Accept,Origin,X-Requested-With"); + response.setHeader("Access-Control-Max-Age", "216000"); + response.setHeader("Content-Type","application/json;charset=UTF-8"); + return true; + } +} + diff --git a/src/main/java/com/xkrs/config/MvcConfig.java b/src/main/java/com/xkrs/config/MvcConfig.java new file mode 100644 index 0000000..b83b8e4 --- /dev/null +++ b/src/main/java/com/xkrs/config/MvcConfig.java @@ -0,0 +1,37 @@ +package com.xkrs.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.TaskScheduler; +import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +/** + * WebMVC配置 + * @author Tajochen + */ +@Configuration +public class MvcConfig implements WebMvcConfigurer { + + /** + * 放行跨域请求 + */ + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOrigins("*") + .allowedMethods("*") + .allowedHeaders("*"); + } + + /** + * 定时任务线程池更改,防止多个任务并行 + */ + @Bean + public TaskScheduler taskScheduler() { + final ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler(); + scheduler.setPoolSize(5); + return scheduler; + } +} diff --git a/src/main/java/com/xkrs/controller/DataDictController.java b/src/main/java/com/xkrs/controller/DataDictController.java new file mode 100644 index 0000000..341d2cd --- /dev/null +++ b/src/main/java/com/xkrs/controller/DataDictController.java @@ -0,0 +1,95 @@ +package com.xkrs.controller; + +import com.xkrs.dao.DataDictDao; +import com.xkrs.encapsulation.PromptMessageEnum; +import com.xkrs.model.entity.DataDict; +import com.xkrs.model.qo.DataDictQo; +import com.xkrs.model.qo.DataDictUpdateQo; +import com.xkrs.service.DataDictService; +import com.xkrs.util.DataDictQuery; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.transaction.Transactional; +import java.util.List; +import java.util.Locale; +import java.util.Optional; + +import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; + +/** + * @Author: XinYi Song + * @Date: 2022/1/19 10:54 + */ +@RestController +public class DataDictController { + + @Resource + private DataDictService dataDictService; + + @Resource + private DataDictDao dataDictDao; + + @Resource + private DataDictQuery dataDictQuery; + + /** + * 添加字典变量数据 + * + * @param dataDictQo + * @return + */ + @PostMapping("/insertDataDict") + public String insertDataDict(@RequestBody DataDictQo dataDictQo) { + return dataDictService.insertDataDict(dataDictQo); + } + + /** + * 动态多条件查询字典信息 + * + * @param inspectionItemName + * @param inspectionItemCode + * @return + */ + @GetMapping("/selectDataDict") + public String selectDataDict(@RequestParam("inspectionItemName") String inspectionItemName, + @RequestParam("inspectionItemCode") String inspectionItemCode) { + Locale locale = LocaleContextHolder.getLocale(); + List dataDict = dataDictQuery.selectDataDict(inspectionItemName, inspectionItemCode); + if (dataDict == null || dataDict.size() == 0) { + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有该型号类型的字典信息!", locale); + } + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, dataDict, locale); + } + + /** + * 根据id查询字典信息,用于数据回显,方便进行修改操作 + * + * @param id + * @return + */ + @GetMapping("/selectDataDictById") + public String selectDataDictById(@RequestParam("id") Integer id) { + Locale locale = LocaleContextHolder.getLocale(); + Optional byId = dataDictDao.findById(id); + if (byId.isEmpty()) { + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有该型号类型的字典信息!", locale); + } + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, byId.get(), locale); + } + + /** + * 根据id修改字典信息 + * + * @param dataDictUpdateQo + * @return + */ + @PostMapping("/updateDict") + @Transactional(rollbackOn = Exception.class) + public String updateDict(@RequestBody DataDictUpdateQo dataDictUpdateQo) { + Locale locale = LocaleContextHolder.getLocale(); + dataDictDao.updateDict(dataDictUpdateQo.getId(), dataDictUpdateQo.getInspectionItemName()); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功!", locale); + } +} diff --git a/src/main/java/com/xkrs/controller/DataSourceController.java b/src/main/java/com/xkrs/controller/DataSourceController.java new file mode 100644 index 0000000..2963a15 --- /dev/null +++ b/src/main/java/com/xkrs/controller/DataSourceController.java @@ -0,0 +1,85 @@ +package com.xkrs.controller; + +import com.xkrs.dao.DataSourceDao; +import com.xkrs.encapsulation.PromptMessageEnum; +import com.xkrs.model.entity.DataSource; +import com.xkrs.model.qo.DataSourceQo; +import com.xkrs.service.DataSourceService; +import com.xkrs.util.DataSourceQuery; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Locale; + +import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; + +/** + * @Author: XinYi Song + * @Date: 2022/1/19 17:05 + */ +@RestController +public class DataSourceController { + + @Resource + private DataSourceService dataSourceService; + + @Resource + private DataSourceQuery dataSourceQuery; + + @Resource + private DataSourceDao dataSourceDao; + + /** + * 添加测量数据 + * + * @param dataSourceQo + * @return + */ + @PostMapping("/insertDataSource") + public String insertDataSource(@RequestBody DataSourceQo dataSourceQo) { + return dataSourceService.insertDataSource(dataSourceQo); + } + + /** + * 查询某一产品的测量信息 + * + * @param lotNo 批次号 + * @param machineNo 机器号 + * @param materialNo 物料号 + * @param modelNo 模具号 + * @param machineTypeNo 机种号 + * @param craftItemName 工艺项目名称 + * @return + */ + @GetMapping("/selectDataSource") + public String selectDataSource(@RequestParam(required = false, value = "lotNo") String lotNo, + @RequestParam(required = false, value = "machineNo") String machineNo, + @RequestParam(required = false, value = "materialNo") String materialNo, + @RequestParam(required = false, value = "modelNo") String modelNo, + @RequestParam(required = false, value = "machineTypeNo") String machineTypeNo, + @RequestParam(required = false, value = "craftItemName") String craftItemName) { + Locale locale = LocaleContextHolder.getLocale(); + List dataSources = dataSourceQuery.selectDataSource(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName); + if (dataSources == null || dataSources.size() == 0) { + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的测量信息!", locale); + } + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, dataSources, locale); + } + + /** + * 查询全部的测量信息 + * + * @return + */ + @GetMapping("/selectAllSource") + public String selectAllSource() { + Locale locale = LocaleContextHolder.getLocale(); + List dataSources = dataSourceDao.findAll(); + if (dataSources.size() == 0) { + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的测量信息!", locale); + } + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, dataSources, locale); + } +} diff --git a/src/main/java/com/xkrs/controller/FileController.java b/src/main/java/com/xkrs/controller/FileController.java new file mode 100644 index 0000000..cd82dc6 --- /dev/null +++ b/src/main/java/com/xkrs/controller/FileController.java @@ -0,0 +1,82 @@ +package com.xkrs.controller; + +import com.xkrs.dao.FileDao; +import com.xkrs.encapsulation.PromptMessageEnum; +import com.xkrs.model.qo.FileQo; +import com.xkrs.service.FileService; +import com.xkrs.util.ExcelUploadUtil; +import org.apache.poi.openxml4j.exceptions.InvalidFormatException; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.transaction.Transactional; +import java.io.IOException; +import java.util.Locale; + +import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; + +/** + * @Author: XinYi Song + * @Date: 2022/1/20 16:01 + */ +@RestController +public class FileController { + + @Resource + private FileService fileService; + + @Resource + private FileDao fileDao; + + /** + * 上传模板信息 + * + * @param fileQo + * @param fileExcel + * @return + * @throws IOException + */ + @PostMapping("/insertFileExcel") + public String insertFileExcel(FileQo fileQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException { + return fileService.insertFileExcel(fileQo, fileExcel); + } + + /** + * 修改上传的模板信息 + * + * @param fileQo + * @param fileExcel + * @return + * @throws IOException + */ + @PostMapping("/updateFileUploadPath") + @Transactional(rollbackOn = Exception.class) + public String updateFileUploadPath(FileQo fileQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException { + String lotNo = fileQo.getLotNo(); + String machineNo = fileQo.getMachineNo(); + String materialNo = fileQo.getMaterialNo(); + String modelNo = fileQo.getModelNo(); + String machineTypeNo = fileQo.getMachineTypeNo(); + String craftItemName = fileQo.getCraftItemName(); + Locale locale = LocaleContextHolder.getLocale(); + String file = ExcelUploadUtil.memoryFile(fileExcel, 1); + fileDao.updateFileUploadPath(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName, file); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功!", locale); + } + + /** + * 导出excel + * + * @param fileQo + * @return + */ + @PostMapping("/exportExcel") + public String exportExcel(@RequestBody FileQo fileQo) throws IOException, InvalidFormatException { + return fileService.exportExcel(fileQo); + } +} diff --git a/src/main/java/com/xkrs/controller/PictureController.java b/src/main/java/com/xkrs/controller/PictureController.java new file mode 100644 index 0000000..98302a2 --- /dev/null +++ b/src/main/java/com/xkrs/controller/PictureController.java @@ -0,0 +1,60 @@ +package com.xkrs.controller; + +import com.xkrs.encapsulation.PromptMessageEnum; +import com.xkrs.model.entity.PictureEntity; +import com.xkrs.model.qo.PictureQo; +import com.xkrs.service.PictureService; +import com.xkrs.util.PictureQuery; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.List; +import java.util.Locale; + +import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; + +/** + * @Author: XinYi Song + * @Date: 2022/1/20 16:01 + */ +@RestController +public class PictureController { + + @Resource + private PictureService pictureService; + + @Resource + private PictureQuery pictureQuery; + + /** + * 上传图片 + */ + @PostMapping("/insertPicture") + public String insertPicture(PictureQo pictureQo, @RequestParam("filePicture") MultipartFile filePicture) throws IOException { + return pictureService.insertPicture(pictureQo, filePicture); + } + + /** + * 查询图片 + */ + @GetMapping("/selectPicture") + public String selectPicture(@RequestParam(required = false, value = "lotNo") String lotNo, + @RequestParam(required = false, value = "machineNo") String machineNo, + @RequestParam(required = false, value = "materialNo") String materialNo, + @RequestParam(required = false, value = "modelNo") String modelNo, + @RequestParam(required = false, value = "machineTypeNo") String machineTypeNo, + @RequestParam(required = false, value = "craftItemName") String craftItemName) { + Locale locale = LocaleContextHolder.getLocale(); + List pictureEntities = pictureQuery.selectPicture(lotNo, machineNo, materialNo, modelNo, machineTypeNo,craftItemName); + if (pictureEntities.isEmpty()) { + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该图片!", locale); + } + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, pictureEntities, locale); + } +} diff --git a/src/main/java/com/xkrs/controller/SpecController.java b/src/main/java/com/xkrs/controller/SpecController.java new file mode 100644 index 0000000..645eefd --- /dev/null +++ b/src/main/java/com/xkrs/controller/SpecController.java @@ -0,0 +1,55 @@ +package com.xkrs.controller; + +import com.xkrs.encapsulation.PromptMessageEnum; +import com.xkrs.model.entity.SpecEntity; +import com.xkrs.model.qo.SpecQo; +import com.xkrs.service.SpecService; +import com.xkrs.util.SpecQuery; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Locale; + +import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; + +/** + * @Author: XinYi Song + * @Date: 2022/1/20 16:01 + */ +@RestController +public class SpecController { + + @Resource + private SpecService specService; + + @Resource + private SpecQuery specQuery; + + /** + * 添加规格数据 + * + * @param specQo + */ + @PostMapping("/insertSpec") + public String insertSpec(@RequestBody SpecQo specQo) { + return specService.insertSpec(specQo); + } + + /** + * 查询规格信息 + */ + @GetMapping("/selectSpec") + public String selectSpec(@RequestParam(required = false, value = "machineTypeNo") String machineTypeNo, + @RequestParam(required = false, value = "inspectionItemCode") String inspectionItemCode, + @RequestParam(required = false, value = "craftItemName") String craftItemName) { + Locale locale = LocaleContextHolder.getLocale(); + List specEntities = specQuery.selectSpec(machineTypeNo, inspectionItemCode, craftItemName); + if (specEntities.isEmpty()) { + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该规格信息!", locale); + } + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, specEntities, locale); + } + +} diff --git a/src/main/java/com/xkrs/dao/DataDictDao.java b/src/main/java/com/xkrs/dao/DataDictDao.java new file mode 100644 index 0000000..f59496a --- /dev/null +++ b/src/main/java/com/xkrs/dao/DataDictDao.java @@ -0,0 +1,42 @@ +package com.xkrs.dao; + +import com.xkrs.model.entity.DataDict; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.Optional; + +/** + * @Author: XinYi Song + * @Date: 2022/1/19 10:03 + */ +@Component +public interface DataDictDao extends JpaRepository, JpaSpecificationExecutor { + + /** + * 通过质检项代码查询字典表的数据 + * @param inspectionItemCode + * @return + */ + Optional findByInspectionItemCode(String inspectionItemCode); + + /** + * 根据id查询字典信息 + * @param id + * @return + */ + Optional findById(Integer id); + + /** + * 根据id修改字典的信息 + * @param id + * @param inspectionItemName + */ + @Modifying(clearAutomatically=true) + @Query(value = "UPDATE qc_inspection_item_dict SET inspection_item_name = ?2 where id = ?1",nativeQuery = true) + void updateDict(Integer id, String inspectionItemName); +} diff --git a/src/main/java/com/xkrs/dao/DataSourceDao.java b/src/main/java/com/xkrs/dao/DataSourceDao.java new file mode 100644 index 0000000..23032d3 --- /dev/null +++ b/src/main/java/com/xkrs/dao/DataSourceDao.java @@ -0,0 +1,19 @@ +package com.xkrs.dao; + +import com.xkrs.model.entity.DataSource; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.Optional; + +/** + * @Author: XinYi Song + * @Date: 2022/1/19 16:41 + */ +@Component +public interface DataSourceDao extends JpaRepository, JpaSpecificationExecutor { + +} diff --git a/src/main/java/com/xkrs/dao/FileDao.java b/src/main/java/com/xkrs/dao/FileDao.java new file mode 100644 index 0000000..eef603f --- /dev/null +++ b/src/main/java/com/xkrs/dao/FileDao.java @@ -0,0 +1,64 @@ +package com.xkrs.dao; + +import com.xkrs.model.entity.FileEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.stereotype.Component; + +import java.util.Optional; + +/** + * @Author: XinYi Song + * @Date: 2022/1/20 15:23 + */ +@Component +public interface FileDao extends JpaRepository, JpaSpecificationExecutor { + + /** + * 查询文件信息 + * + * @param lotNo 批次号 + * @param machineNo 机器号 + * @param materialNo 物料号 + * @param modelNo 模具号 + * @param machineTypeNo 机种号 + * @param craftItemName 工艺项目名称 + * @return + */ + @Query(value = "SELECT * FROM qc_inspection_file WHERE lot_no = ? AND machine_no = ? AND material_no = ? AND model_no = ? AND machine_type_no = ? AND craft_item_name = ? ", nativeQuery = true) + Optional selectFile(String lotNo, String machineNo, String materialNo, String modelNo, String machineTypeNo, String craftItemName); + + /** + * 修改模板上传信息 + * + * @param lotNo 批次号 + * @param machineNo 机器号 + * @param materialNo 物料号 + * @param modelNo 模具号 + * @param machineTypeNo 机种号 + * @param craftItemName 工艺项目名称 + * @param fileUploadPath 模板路径 + */ + @Modifying(clearAutomatically = true) + @Query(value = "UPDATE qc_inspection_file SET file_upload_path = ?7 WHERE lot_no = ?1 AND machine_no = ?2 AND material_no = ?3 AND model_no = ?4 AND machine_type_no = ?5 AND craft_item_name = ?6 ", nativeQuery = true) + void updateFileUploadPath(String lotNo, String machineNo, String materialNo, String modelNo, String machineTypeNo, String craftItemName, String fileUploadPath); + + /** + * 修改文件下载信息 + * + * @param lotNo 批次号 + * @param machineNo 机器号 + * @param materialNo 物料号 + * @param modelNo 模具号 + * @param machineTypeNo 机种号 + * @param craftItemName 工艺项目名称 + * @param fileDownloadPath 文件下载路径 + */ + @Modifying(clearAutomatically = true) + @Query(value = "UPDATE qc_inspection_file SET file_download_path = ?7 WHERE lot_no = ?1 AND machine_no = ?2 AND material_no = ?3 AND model_no = ?4 AND machine_type_no = ?5 AND craft_item_name = ?6 ", nativeQuery = true) + void updateFileDownloadPath(String lotNo, String machineNo, String materialNo, String modelNo, String machineTypeNo, String craftItemName, String fileDownloadPath); + + +} diff --git a/src/main/java/com/xkrs/dao/PictureDao.java b/src/main/java/com/xkrs/dao/PictureDao.java new file mode 100644 index 0000000..7102728 --- /dev/null +++ b/src/main/java/com/xkrs/dao/PictureDao.java @@ -0,0 +1,32 @@ +package com.xkrs.dao; + +import com.xkrs.model.entity.PictureEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; +import org.springframework.stereotype.Component; + +import java.util.Optional; + +/** + * @Author: XinYi Song + * @Date: 2022/1/19 16:41 + */ +@Component +public interface PictureDao extends JpaRepository, JpaSpecificationExecutor { + + /** + * 查询图片信息 + * + * @param lotNo 批次号 + * @param machineNo 机器号 + * @param materialNo 物料号 + * @param modelNo 模具号 + * @param machineTypeNo 机种号 + * @param craftItemName 工艺项目名称 + * @return + */ + @Query(value = "SELECT * FROM qc_inspection_picture WHERE lot_no = ? AND machine_no = ? AND material_no = ? AND model_no = ? AND machine_type_no = ? AND craft_item_name = ? ", nativeQuery = true) + Optional selectPicture(String lotNo, String machineNo, String materialNo, String modelNo, String machineTypeNo, String craftItemName); + +} diff --git a/src/main/java/com/xkrs/dao/SpecDao.java b/src/main/java/com/xkrs/dao/SpecDao.java new file mode 100644 index 0000000..a81f3a0 --- /dev/null +++ b/src/main/java/com/xkrs/dao/SpecDao.java @@ -0,0 +1,18 @@ +package com.xkrs.dao; + +import com.xkrs.model.entity.SpecEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.Optional; + +/** + * @Author: XinYi Song + * @Date: 2022/1/19 16:41 + */ +@Component +public interface SpecDao extends JpaRepository, JpaSpecificationExecutor { + +} diff --git a/src/main/java/com/xkrs/encapsulation/EncapsulationObejct.java b/src/main/java/com/xkrs/encapsulation/EncapsulationObejct.java new file mode 100644 index 0000000..3822e1a --- /dev/null +++ b/src/main/java/com/xkrs/encapsulation/EncapsulationObejct.java @@ -0,0 +1,59 @@ +package com.xkrs.encapsulation; + +import java.io.Serializable; + +/** + * 输出信息对象 + * @author tajochen + * @param + */ +public class EncapsulationObejct implements Serializable { + + /** + * 状态码 + */ + int status; + + /** + * 提示信息 + */ + String msg; + + /** + * 数据 + */ + T data; + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public T getData() { + return data; + } + + public void setData(T data) { + this.data = data; + } + + @Override + public String toString() { + return "EncapsulationObejct{" + + "status=" + status + + ", msg='" + msg + '\'' + + ", data=" + data + + '}'; + } +} diff --git a/src/main/java/com/xkrs/encapsulation/OutputEncapsulation.java b/src/main/java/com/xkrs/encapsulation/OutputEncapsulation.java new file mode 100644 index 0000000..641e53f --- /dev/null +++ b/src/main/java/com/xkrs/encapsulation/OutputEncapsulation.java @@ -0,0 +1,96 @@ +package com.xkrs.encapsulation; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.MessageSource; +import org.springframework.context.support.ResourceBundleMessageSource; +import org.springframework.stereotype.Component; +import org.springframework.validation.FieldError; + +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.Properties; + +/** + * 输出信息封装 + * @author tajochen + */ +@Component +public class OutputEncapsulation { + + private static final Logger logger = LoggerFactory.getLogger(OutputEncapsulation.class); + + /** + * 读取多国语言文件 + * @return + */ + public static MessageSource messageSource() { + Properties properties = new Properties(); + // 使用ClassLoader加载properties配置文件生成对应的输入流 + InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream("application.properties"); + // 使用properties对象加载输入流 + try { + properties.load(in); + } catch (IOException e) { + e.printStackTrace(); + } + ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource(); + messageSource.setBasename("i18n/messages"); + messageSource.setDefaultEncoding("UTF-8"); + return messageSource; + } + + /** + * 封装输出数据 + * @param promptMessageEnum + * @param obj + * @return + */ + public static String outputEncapsulationObject(PromptMessageEnum promptMessageEnum, Object obj, Locale locale) { + + EncapsulationObejct encapsulationObejct = new EncapsulationObejct(); + encapsulationObejct.setStatus(promptMessageEnum.getCode()); + encapsulationObejct.setMsg(messageSource().getMessage(promptMessageEnum.getText(),null,locale)); + encapsulationObejct.setData(obj); + + ObjectMapper objectMapper = new ObjectMapper(); + // 忽略无法转换的对象 + objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS,false); + // 忽略json字符串中不识别的属性 + objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + // 解决jackson无法反序列化LocalDateTime的问题,引入jsr310标准 + JavaTimeModule javaTimeModule = new JavaTimeModule(); + objectMapper.registerModule(javaTimeModule); + objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + String strByEo = ""; + try { + strByEo = objectMapper.writeValueAsString(encapsulationObejct); + } catch (JsonProcessingException e) { + e.printStackTrace(); + logger.warn(e.toString()); + } + return strByEo; + } + + /** + * 输出请求值检验错误信息 + * @param fieldErrors + * @return + */ + public static String outputEncapsulationErrorList(List fieldErrors, Locale locale){ + List errorMsg = new ArrayList<>(); + for (FieldError fieldError : fieldErrors) { + String errMessage = fieldError.getDefaultMessage().subSequence(1,fieldError.getDefaultMessage().length()-1).toString(); + errorMsg.add(messageSource().getMessage(errMessage,null,locale)); + } + return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,errorMsg,locale); + } +} diff --git a/src/main/java/com/xkrs/encapsulation/PromptMessageEnum.java b/src/main/java/com/xkrs/encapsulation/PromptMessageEnum.java new file mode 100644 index 0000000..79275a4 --- /dev/null +++ b/src/main/java/com/xkrs/encapsulation/PromptMessageEnum.java @@ -0,0 +1,65 @@ +package com.xkrs.encapsulation; + +/** + * 提示信息枚举 + * @author tajochen + */ +public enum PromptMessageEnum{ + + // 执行成功 + SUCCESS(0, "sys.message.success"), + + + // 用户权限错误或非法操作: 1001-1999 + USER_NOT_LOGGED(1001, "sys.message.user.not_logged_in"), + USER_LOGIN_ERROR(1002, "sys.message.user.login_error"), + USER_ACCOUNT_FORBIDDEN(1003, "sys.message.user.account_forbidden"), + USER_ACCOUNT_NOT_ACTIVATED(1004, "sys.message.user.account_not_activated"), + USER_HAS_OVERTIME(1005, "sys.message.user.overtime"), + USER_NO_PERMISSION(1006,"sys.message.user.no_permission"), + USER_ALREADY_LOGGED(1007, "sys.message.user.already_logged"), + + // 请求参数错误或非法:2001-2999 + PARAM_NULL(2001, "sys.message.param.null"), + PARAM_ILLEGAL(2002, "sys.message.param.illegal"), + + // 数据返回错误:3001-3999 + DATA_NONE(3001, "sys.message.data.none"), + + DATA_WRONG(3002, "sys.message.data.wrong"), + DATA_EXIT(3003,"sys.message.exit"), + + // 操作失败:4001-4999 + PROCESS_FAIL(4001,"sys.message.process.fail"), + PROCESS_OVERTIME(4002,"sys.message.process.overtime"), + FILE_EXISTS(4003,"sys.message.file.exists"), + FILE_WRITE_ERROR(4004,"sys.message.file.write.error"), + FILE_READ_ERROR(4005,"sys.message.file.read.error"), + + // 系统内部错误或异常:5001-5999 + SYSTEM_INNER_ERROR(5001,"sys.message.system.inner_error"), + SYSTEM_ABNORMAL(5002,"sys.message.system.abnormal"), + SYSTEM_BUSY(5003,"sys.message.system.busy"), + SYSTEM_MAINTAIN(5004,"sys.message.system.maintain"), + + // 数据库错误:6001-6999 + DATABASE_ERROR(6001,"sys.message.database.error"); + + private int code; + + private String text; + + private PromptMessageEnum(int code,String text) { + this.code = code; + this.text = text; + } + + public String getText() { + return this.text; + } + + public int getCode() { + return this.code; + } + +} diff --git a/src/main/java/com/xkrs/model/entity/DataDict.java b/src/main/java/com/xkrs/model/entity/DataDict.java new file mode 100644 index 0000000..7c94805 --- /dev/null +++ b/src/main/java/com/xkrs/model/entity/DataDict.java @@ -0,0 +1,68 @@ +package com.xkrs.model.entity; + +import javax.persistence.*; + +/** + * @Author: XinYi Song + * @Date: 2022/1/19 9:26 + */ +@Entity +@Table(name = "qc_inspection_item_dict") +public class DataDict { + + /** + * 索引 + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "qc_inspection_item_dict_seq_gen") + @SequenceGenerator(name = "qc_inspection_item_dict_seq_gen", sequenceName = "qc_inspection_item_dict_id_seq", allocationSize = 1) + private Integer id; + + /** + * 质检项代码 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String inspectionItemCode; + + /** + * 质检项名称 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String inspectionItemName; + + public DataDict() { + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getInspectionItemCode() { + return inspectionItemCode; + } + + public void setInspectionItemCode(String inspectionItemCode) { + this.inspectionItemCode = inspectionItemCode; + } + + public String getInspectionItemName() { + return inspectionItemName; + } + + public void setInspectionItemName(String inspectionItemName) { + this.inspectionItemName = inspectionItemName; + } + + @Override + public String toString() { + return "DataDict{" + + "id=" + id + + ", inspectionItemCode='" + inspectionItemCode + '\'' + + ", inspectionItemName='" + inspectionItemName + '\'' + + '}'; + } +} diff --git a/src/main/java/com/xkrs/model/entity/DataSource.java b/src/main/java/com/xkrs/model/entity/DataSource.java new file mode 100644 index 0000000..8b17eb0 --- /dev/null +++ b/src/main/java/com/xkrs/model/entity/DataSource.java @@ -0,0 +1,148 @@ +package com.xkrs.model.entity; + +import javax.persistence.*; + +/** + * @Author: XinYi Song + * @Date: 2022/1/19 14:08 + */ +@Entity +@Table(name = "qc_inspection_data_source") +public class DataSource { + + /** + * 主键id + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "qc_inspection_data_source_seq_gen") + @SequenceGenerator(name = "qc_inspection_data_source_seq_gen", sequenceName = "qc_inspection_data_source_id_seq", allocationSize = 1) + private Integer id; + + /** + * 批次号 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String lotNo; + + /** + * 机器号 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String machineNo; + + /** + * 物料号 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String materialNo; + + /** + * 模具号 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String modelNo; + + /** + * 机种号 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String machineTypeNo; + + /** + * 检验项代码 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String inspectionItemCode; + + /** + * 工艺项目名称 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String craftItemName; + + /** + * 检验数值 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String inspectValue; + + public DataSource() { + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getLotNo() { + return lotNo; + } + + public void setLotNo(String lotNo) { + this.lotNo = lotNo; + } + + public String getMachineNo() { + return machineNo; + } + + public void setMachineNo(String machineNo) { + this.machineNo = machineNo; + } + + public String getMaterialNo() { + return materialNo; + } + + public void setMaterialNo(String materialNo) { + this.materialNo = materialNo; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getMachineTypeNo() { + return machineTypeNo; + } + + public void setMachineTypeNo(String machineTypeNo) { + this.machineTypeNo = machineTypeNo; + } + + public String getInspectionItemCode() { + return inspectionItemCode; + } + + public void setInspectionItemCode(String inspectionItemCode) { + this.inspectionItemCode = inspectionItemCode; + } + + public String getCraftItemName() { + return craftItemName; + } + + public void setCraftItemName(String craftItemName) { + this.craftItemName = craftItemName; + } + + public String getInspectValue() { + return inspectValue; + } + + public void setInspectValue(String inspectValue) { + this.inspectValue = inspectValue; + } + + @Override + public String toString() { + return "DataSource{" + "id=" + id + ", lotNo='" + lotNo + '\'' + ", machineNo='" + machineNo + '\'' + ", materialNo='" + materialNo + '\'' + ", modelNo='" + modelNo + '\'' + ", machineTypeNo='" + machineTypeNo + '\'' + ", inspectionItemCode='" + inspectionItemCode + '\'' + ", craftItemName='" + craftItemName + '\'' + ", inspectValue='" + inspectValue + '\'' + '}'; + } +} diff --git a/src/main/java/com/xkrs/model/entity/FileEntity.java b/src/main/java/com/xkrs/model/entity/FileEntity.java new file mode 100644 index 0000000..d2965f3 --- /dev/null +++ b/src/main/java/com/xkrs/model/entity/FileEntity.java @@ -0,0 +1,158 @@ +package com.xkrs.model.entity; + +import javax.persistence.*; + +/** + * @Author: XinYi Song + * @Date: 2022/1/20 15:01 + */ +@Entity +@Table(name = "qc_inspection_file") +public class FileEntity { + /** + * 主键id + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "qc_inspection_file_seq_gen") + @SequenceGenerator(name = "qc_inspection_file_seq_gen", sequenceName = "qc_inspection_file_id_seq", allocationSize = 1) + private Integer id; + + /** + * 批次号 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String lotNo; + + /** + * 机器号 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String machineNo; + + /** + * 物料号 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String materialNo; + + /** + * 模具号 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String modelNo; + + /** + * 机种号 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String machineTypeNo; + + /** + * 工艺项目名称 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String craftItemName; + + + /** + * 上传模板的路径 + */ + @Column(length = 2048, columnDefinition = "varchar(2048)") + private String fileUploadPath; + + /** + * 下载路径 + */ + @Column(length = 2048, columnDefinition = "varchar(2048)") + private String fileDownloadPath; + + public FileEntity() { + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getLotNo() { + return lotNo; + } + + public void setLotNo(String lotNo) { + this.lotNo = lotNo; + } + + public String getMachineNo() { + return machineNo; + } + + public void setMachineNo(String machineNo) { + this.machineNo = machineNo; + } + + public String getMaterialNo() { + return materialNo; + } + + public void setMaterialNo(String materialNo) { + this.materialNo = materialNo; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getMachineTypeNo() { + return machineTypeNo; + } + + public void setMachineTypeNo(String machineTypeNo) { + this.machineTypeNo = machineTypeNo; + } + + public String getCraftItemName() { + return craftItemName; + } + + public void setCraftItemName(String craftItemName) { + this.craftItemName = craftItemName; + } + + public String getFileUploadPath() { + return fileUploadPath; + } + + public void setFileUploadPath(String fileUploadPath) { + this.fileUploadPath = fileUploadPath; + } + + public String getFileDownloadPath() { + return fileDownloadPath; + } + + public void setFileDownloadPath(String fileDownloadPath) { + this.fileDownloadPath = fileDownloadPath; + } + + @Override + public String toString() { + return "FileEntity{" + + "id=" + id + + ", lotNo='" + lotNo + '\'' + + ", machineNo='" + machineNo + '\'' + + ", materialNo='" + materialNo + '\'' + + ", modelNo='" + modelNo + '\'' + + ", machineTypeNo='" + machineTypeNo + '\'' + + ", craftItemName='" + craftItemName + '\'' + + ", fileUploadPath='" + fileUploadPath + '\'' + + ", fileDownloadPath='" + fileDownloadPath + '\'' + + '}'; + } +} diff --git a/src/main/java/com/xkrs/model/entity/PictureEntity.java b/src/main/java/com/xkrs/model/entity/PictureEntity.java new file mode 100644 index 0000000..9c1c866 --- /dev/null +++ b/src/main/java/com/xkrs/model/entity/PictureEntity.java @@ -0,0 +1,138 @@ +package com.xkrs.model.entity; + +import javax.persistence.*; + +@Entity +@Table(name = "qc_inspection_picture") +public class PictureEntity { + /** + * 主键id + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "qc_inspection_picture_seq_gen") + @SequenceGenerator(name = "qc_inspection_picture_seq_gen", sequenceName = "qc_inspection_picture_id_seq", allocationSize = 1) + private Integer id; + + /** + * 批次号 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String lotNo; + + /** + * 机器号 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String machineNo; + + /** + * 物料号 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String materialNo; + + /** + * 模具号 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String modelNo; + + /** + * 机种号 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String machineTypeNo; + + /** + * 工艺项目名称 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String craftItemName; + + /** + * 图片路径 + */ + @Column(length = 2048, columnDefinition = "varchar(2048)") + private String picturePath; + + public PictureEntity() { + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getLotNo() { + return lotNo; + } + + public void setLotNo(String lotNo) { + this.lotNo = lotNo; + } + + public String getMachineNo() { + return machineNo; + } + + public void setMachineNo(String machineNo) { + this.machineNo = machineNo; + } + + public String getMaterialNo() { + return materialNo; + } + + public void setMaterialNo(String materialNo) { + this.materialNo = materialNo; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getMachineTypeNo() { + return machineTypeNo; + } + + public void setMachineTypeNo(String machineTypeNo) { + this.machineTypeNo = machineTypeNo; + } + + public String getCraftItemName() { + return craftItemName; + } + + public void setCraftItemName(String craftItemName) { + this.craftItemName = craftItemName; + } + + public String getPicturePath() { + return picturePath; + } + + public void setPicturePath(String picturePath) { + this.picturePath = picturePath; + } + + @Override + public String toString() { + return "PictureEntity{" + + "id=" + id + + ", lotNo='" + lotNo + '\'' + + ", machineNo='" + machineNo + '\'' + + ", materialNo='" + materialNo + '\'' + + ", modelNo='" + modelNo + '\'' + + ", machineTypeNo='" + machineTypeNo + '\'' + + ", craftItemName='" + craftItemName + '\'' + + ", picturePath='" + picturePath + '\'' + + '}'; + } +} diff --git a/src/main/java/com/xkrs/model/entity/SpecEntity.java b/src/main/java/com/xkrs/model/entity/SpecEntity.java new file mode 100644 index 0000000..d6bf18d --- /dev/null +++ b/src/main/java/com/xkrs/model/entity/SpecEntity.java @@ -0,0 +1,183 @@ +package com.xkrs.model.entity; + +import javax.persistence.*; + +@Entity +@Table(name = "qc_inspection_spec") +public class SpecEntity { + /** + * 主键id + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "qc_inspection_spec_seq_gen") + @SequenceGenerator(name = "qc_inspection_spec_seq_gen", sequenceName = "qc_inspection_spec_id_seq", allocationSize = 1) + private Integer id; + + /** + * 机种号 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String machineTypeNo; + + /** + * 检验项代码 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String inspectionItemCode; + + /** + * 工艺项目名称 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String craftItemName; + + /** + * 最大值 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String max; + + /** + * 平均值 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String mean; + + /** + * 最小值 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String min; + + /** + * 单位 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String unit; + + /** + * 检验方法 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String inspectionMethod; + + /** + * 检验标准 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String inspectionStandard; + + /** + * 备注 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String remark; + + public SpecEntity() { + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getMachineTypeNo() { + return machineTypeNo; + } + + public void setMachineTypeNo(String machineTypeNo) { + this.machineTypeNo = machineTypeNo; + } + + public String getInspectionItemCode() { + return inspectionItemCode; + } + + public void setInspectionItemCode(String inspectionItemCode) { + this.inspectionItemCode = inspectionItemCode; + } + + public String getCraftItemName() { + return craftItemName; + } + + public void setCraftItemName(String craftItemName) { + this.craftItemName = craftItemName; + } + + public String getMax() { + return max; + } + + public void setMax(String max) { + this.max = max; + } + + public String getMean() { + return mean; + } + + public void setMean(String mean) { + this.mean = mean; + } + + public String getMin() { + return min; + } + + public void setMin(String min) { + this.min = min; + } + + public String getUnit() { + return unit; + } + + public void setUnit(String unit) { + this.unit = unit; + } + + public String getInspectionMethod() { + return inspectionMethod; + } + + public void setInspectionMethod(String inspectionMethod) { + this.inspectionMethod = inspectionMethod; + } + + public String getInspectionStandard() { + return inspectionStandard; + } + + public void setInspectionStandard(String inspectionStandard) { + this.inspectionStandard = inspectionStandard; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + @Override + public String toString() { + return "SpecEntity{" + + "id=" + id + + ", machineTypeNo='" + machineTypeNo + '\'' + + ", inspectionItemCode='" + inspectionItemCode + '\'' + + ", craftItemName='" + craftItemName + '\'' + + ", max='" + max + '\'' + + ", mean='" + mean + '\'' + + ", min='" + min + '\'' + + ", unit='" + unit + '\'' + + ", inspectionMethod='" + inspectionMethod + '\'' + + ", inspectionStandard='" + inspectionStandard + '\'' + + ", remark='" + remark + '\'' + + '}'; + } +} diff --git a/src/main/java/com/xkrs/model/qo/DataDictQo.java b/src/main/java/com/xkrs/model/qo/DataDictQo.java new file mode 100644 index 0000000..b3b2c67 --- /dev/null +++ b/src/main/java/com/xkrs/model/qo/DataDictQo.java @@ -0,0 +1,43 @@ +package com.xkrs.model.qo; + +import com.xkrs.model.validation.DataDictQoInsert; + +import javax.validation.constraints.NotBlank; + +/** + * @Author: XinYi Song + * @Date: 2022/1/19 10:14 + */ +public class DataDictQo { + + /** + * 质检项代码 + */ + @NotBlank(message = "{DataDict.inspectionItemCode.blank}", groups = {DataDictQoInsert.class}) + private String inspectionItemCode; + + /** + * 质检项名称 + */ + @NotBlank(message = "{DataDict.inspectionItemName.blank}", groups = {DataDictQoInsert.class}) + private String inspectionItemName; + + public DataDictQo() { + } + + public String getInspectionItemCode() { + return inspectionItemCode; + } + + public void setInspectionItemCode(String inspectionItemCode) { + this.inspectionItemCode = inspectionItemCode; + } + + public String getInspectionItemName() { + return inspectionItemName; + } + + public void setInspectionItemName(String inspectionItemName) { + this.inspectionItemName = inspectionItemName; + } +} diff --git a/src/main/java/com/xkrs/model/qo/DataDictUpdateQo.java b/src/main/java/com/xkrs/model/qo/DataDictUpdateQo.java new file mode 100644 index 0000000..a81276b --- /dev/null +++ b/src/main/java/com/xkrs/model/qo/DataDictUpdateQo.java @@ -0,0 +1,40 @@ +package com.xkrs.model.qo; + +import com.xkrs.model.validation.DataDictUpdateQoUpdate; + +import javax.validation.constraints.NotBlank; + +/** + * @Author: XinYi Song + * @Date: 2022/1/20 11:23 + */ +public class DataDictUpdateQo { + + @NotBlank(message = "{DataDict.id.blank}", groups = {DataDictUpdateQoUpdate.class}) + private Integer id; + + /** + * 质检项名称 + */ + @NotBlank(message = "{DataDict.inspectionItemName.blank}", groups = {DataDictUpdateQoUpdate.class}) + private String inspectionItemName; + + public DataDictUpdateQo() { + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getInspectionItemName() { + return inspectionItemName; + } + + public void setInspectionItemName(String inspectionItemName) { + this.inspectionItemName = inspectionItemName; + } +} diff --git a/src/main/java/com/xkrs/model/qo/DataSourceQo.java b/src/main/java/com/xkrs/model/qo/DataSourceQo.java new file mode 100644 index 0000000..69727ed --- /dev/null +++ b/src/main/java/com/xkrs/model/qo/DataSourceQo.java @@ -0,0 +1,128 @@ +package com.xkrs.model.qo; + +import com.xkrs.model.validation.DataSourceQoInsert; + +import javax.validation.constraints.NotBlank; + +/** + * @Author: XinYi Song + * @Date: 2022/1/19 16:37 + */ +public class DataSourceQo { + + /** + * 批次号 + */ + @NotBlank(message = "{DataSource.lotNo.blank}", groups = {DataSourceQoInsert.class}) + private String lotNo; + + /** + * 机器号 + */ + @NotBlank(message = "{DataSource.machineNo.blank}", groups = {DataSourceQoInsert.class}) + private String machineNo; + + /** + * 物料号 + */ + @NotBlank(message = "{DataSource.materialNo.blank}", groups = {DataSourceQoInsert.class}) + private String materialNo; + + /** + * 模具号 + */ + @NotBlank(message = "{DataSource.modelNo.blank}", groups = {DataSourceQoInsert.class}) + private String modelNo; + + /** + * 机种号 + */ + @NotBlank(message = "{DataSource.machineTypeNo.blank}", groups = {DataSourceQoInsert.class}) + private String machineTypeNo; + + /** + * 检验项代码 + */ + @NotBlank(message = "{DataSource.inspectionItemCode.blank}", groups = {DataSourceQoInsert.class}) + private String inspectionItemCode; + + /** + * 工艺项目名称 + */ + @NotBlank(message = "{DataSource.craftItemName.blank}", groups = {DataSourceQoInsert.class}) + private String craftItemName; + + /** + * 检验数值 + */ + @NotBlank(message = "{DataSource.inspectValue.blank}", groups = {DataSourceQoInsert.class}) + private String inspectValue; + + public DataSourceQo() { + } + + public String getLotNo() { + return lotNo; + } + + public void setLotNo(String lotNo) { + this.lotNo = lotNo; + } + + public String getMachineNo() { + return machineNo; + } + + public void setMachineNo(String machineNo) { + this.machineNo = machineNo; + } + + public String getMaterialNo() { + return materialNo; + } + + public void setMaterialNo(String materialNo) { + this.materialNo = materialNo; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getMachineTypeNo() { + return machineTypeNo; + } + + public void setMachineTypeNo(String machineTypeNo) { + this.machineTypeNo = machineTypeNo; + } + + public String getInspectionItemCode() { + return inspectionItemCode; + } + + public void setInspectionItemCode(String inspectionItemCode) { + this.inspectionItemCode = inspectionItemCode; + } + + public String getCraftItemName() { + return craftItemName; + } + + public void setCraftItemName(String craftItemName) { + this.craftItemName = craftItemName; + } + + public String getInspectValue() { + return inspectValue; + } + + public void setInspectValue(String inspectValue) { + this.inspectValue = inspectValue; + } + +} diff --git a/src/main/java/com/xkrs/model/qo/FileQo.java b/src/main/java/com/xkrs/model/qo/FileQo.java new file mode 100644 index 0000000..08acc61 --- /dev/null +++ b/src/main/java/com/xkrs/model/qo/FileQo.java @@ -0,0 +1,99 @@ +package com.xkrs.model.qo; + +import com.xkrs.model.validation.FileQoInsert; + +import javax.validation.constraints.NotBlank; + +/** + * @Author: XinYi Song + * @Date: 2022/1/20 15:26 + */ +public class FileQo { + + /** + * 批次号 + */ + @NotBlank(message = "{FileEntity.lotNo.blank}", groups = {FileQoInsert.class}) + private String lotNo; + + /** + * 机器号 + */ + @NotBlank(message = "{FileEntity.machineNo.blank}", groups = {FileQoInsert.class}) + private String machineNo; + + /** + * 物料号 + */ + @NotBlank(message = "{FileEntity.materialNo.blank}", groups = {FileQoInsert.class}) + private String materialNo; + + /** + * 模具号 + */ + @NotBlank(message = "{FileEntity.modelNo.blank}", groups = {FileQoInsert.class}) + private String modelNo; + + /** + * 机种号 + */ + @NotBlank(message = "{FileEntity.machineTypeNo.blank}", groups = {FileQoInsert.class}) + private String machineTypeNo; + + /** + * 工艺项目名称 + */ + @NotBlank(message = "{FileEntity.craftItemName.blank}", groups = {FileQoInsert.class}) + private String craftItemName; + + public FileQo() { + } + + public String getLotNo() { + return lotNo; + } + + public void setLotNo(String lotNo) { + this.lotNo = lotNo; + } + + public String getMachineNo() { + return machineNo; + } + + public void setMachineNo(String machineNo) { + this.machineNo = machineNo; + } + + public String getMaterialNo() { + return materialNo; + } + + public void setMaterialNo(String materialNo) { + this.materialNo = materialNo; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getMachineTypeNo() { + return machineTypeNo; + } + + public void setMachineTypeNo(String machineTypeNo) { + this.machineTypeNo = machineTypeNo; + } + + public String getCraftItemName() { + return craftItemName; + } + + public void setCraftItemName(String craftItemName) { + this.craftItemName = craftItemName; + } +} diff --git a/src/main/java/com/xkrs/model/qo/PictureQo.java b/src/main/java/com/xkrs/model/qo/PictureQo.java new file mode 100644 index 0000000..c8efaa7 --- /dev/null +++ b/src/main/java/com/xkrs/model/qo/PictureQo.java @@ -0,0 +1,95 @@ +package com.xkrs.model.qo; + +import com.xkrs.model.validation.PictureQoInsert; + +import javax.validation.constraints.NotBlank; + +public class PictureQo { + + /** + * 批次号 + */ + @NotBlank(message = "{PictureEntity.lotNo.blank}", groups = {PictureQoInsert.class}) + private String lotNo; + + /** + * 机器号 + */ + @NotBlank(message = "{PictureEntity.machineNo.blank}", groups = {PictureQoInsert.class}) + private String machineNo; + + /** + * 物料号 + */ + @NotBlank(message = "{PictureEntity.materialNo.blank}", groups = {PictureQoInsert.class}) + private String materialNo; + + /** + * 模具号 + */ + @NotBlank(message = "{PictureEntity.modelNo.blank}", groups = {PictureQoInsert.class}) + private String modelNo; + + /** + * 机种号 + */ + @NotBlank(message = "{PictureEntity.machineTypeNo.blank}", groups = {PictureQoInsert.class}) + private String machineTypeNo; + + /** + * 工艺项目名称 + */ + @NotBlank(message = "{PictureEntity.craftItemName.blank}", groups = {PictureQoInsert.class}) + private String craftItemName; + + public PictureQo() { + } + + public String getLotNo() { + return lotNo; + } + + public void setLotNo(String lotNo) { + this.lotNo = lotNo; + } + + public String getMachineNo() { + return machineNo; + } + + public void setMachineNo(String machineNo) { + this.machineNo = machineNo; + } + + public String getMaterialNo() { + return materialNo; + } + + public void setMaterialNo(String materialNo) { + this.materialNo = materialNo; + } + + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getMachineTypeNo() { + return machineTypeNo; + } + + public void setMachineTypeNo(String machineTypeNo) { + this.machineTypeNo = machineTypeNo; + } + + public String getCraftItemName() { + return craftItemName; + } + + public void setCraftItemName(String craftItemName) { + this.craftItemName = craftItemName; + } +} diff --git a/src/main/java/com/xkrs/model/qo/SpecQo.java b/src/main/java/com/xkrs/model/qo/SpecQo.java new file mode 100644 index 0000000..fe4ebdd --- /dev/null +++ b/src/main/java/com/xkrs/model/qo/SpecQo.java @@ -0,0 +1,150 @@ +package com.xkrs.model.qo; + +import com.xkrs.model.validation.SpecQoInsert; + +import javax.validation.constraints.NotBlank; + +public class SpecQo { + + /** + * 机种号 + */ + @NotBlank(message = "{SpecEntity.machineTypeNo.blank}", groups = {SpecQoInsert.class}) + private String machineTypeNo; + + /** + * 检验项代码 + */ + @NotBlank(message = "{SpecEntity.inspectionItemCode.blank}", groups = {SpecQoInsert.class}) + private String inspectionItemCode; + + /** + * 工艺项目名称 + */ + @NotBlank(message = "{SpecEntity.craftItemName.blank}", groups = {SpecQoInsert.class}) + private String craftItemName; + + /** + * 最大值 + */ + @NotBlank(message = "{SpecEntity.max.blank}", groups = {SpecQoInsert.class}) + private String max; + + /** + * 平均值 + */ + @NotBlank(message = "{SpecEntity.mean.blank}", groups = {SpecQoInsert.class}) + private String mean; + + /** + * 最小值 + */ + @NotBlank(message = "{SpecEntity.min.blank}", groups = {SpecQoInsert.class}) + private String min; + + /** + * 单位 + */ + @NotBlank(message = "{SpecEntity.unit.blank}", groups = {SpecQoInsert.class}) + private String unit; + + /** + * 检验方法 + */ + @NotBlank(message = "{SpecEntity.inspectionMethod.blank}", groups = {SpecQoInsert.class}) + private String inspectionMethod; + + /** + * 检验标准 + */ + @NotBlank(message = "{SpecEntity.inspectionStandard.blank}", groups = {SpecQoInsert.class}) + private String inspectionStandard; + + /** + * 备注 + */ + private String remark; + + public SpecQo() { + } + + public String getMachineTypeNo() { + return machineTypeNo; + } + + public void setMachineTypeNo(String machineTypeNo) { + this.machineTypeNo = machineTypeNo; + } + + public String getInspectionItemCode() { + return inspectionItemCode; + } + + public void setInspectionItemCode(String inspectionItemCode) { + this.inspectionItemCode = inspectionItemCode; + } + + public String getCraftItemName() { + return craftItemName; + } + + public void setCraftItemName(String craftItemName) { + this.craftItemName = craftItemName; + } + + public String getMax() { + return max; + } + + public void setMax(String max) { + this.max = max; + } + + public String getMean() { + return mean; + } + + public void setMean(String mean) { + this.mean = mean; + } + + public String getMin() { + return min; + } + + public void setMin(String min) { + this.min = min; + } + + public String getUnit() { + return unit; + } + + public void setUnit(String unit) { + this.unit = unit; + } + + public String getInspectionMethod() { + return inspectionMethod; + } + + public void setInspectionMethod(String inspectionMethod) { + this.inspectionMethod = inspectionMethod; + } + + public String getInspectionStandard() { + return inspectionStandard; + } + + public void setInspectionStandard(String inspectionStandard) { + this.inspectionStandard = inspectionStandard; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } +} diff --git a/src/main/java/com/xkrs/model/validation/DataDictQoInsert.java b/src/main/java/com/xkrs/model/validation/DataDictQoInsert.java new file mode 100644 index 0000000..e6cfc40 --- /dev/null +++ b/src/main/java/com/xkrs/model/validation/DataDictQoInsert.java @@ -0,0 +1,8 @@ +package com.xkrs.model.validation; + +/** + * @Author: XinYi Song + * @Date: 2022/1/19 10:22 + */ +public interface DataDictQoInsert { +} diff --git a/src/main/java/com/xkrs/model/validation/DataDictUpdateQoUpdate.java b/src/main/java/com/xkrs/model/validation/DataDictUpdateQoUpdate.java new file mode 100644 index 0000000..c24b6e2 --- /dev/null +++ b/src/main/java/com/xkrs/model/validation/DataDictUpdateQoUpdate.java @@ -0,0 +1,8 @@ +package com.xkrs.model.validation; + +/** + * @Author: XinYi Song + * @Date: 2022/1/20 11:23 + */ +public interface DataDictUpdateQoUpdate { +} diff --git a/src/main/java/com/xkrs/model/validation/DataSourceQoInsert.java b/src/main/java/com/xkrs/model/validation/DataSourceQoInsert.java new file mode 100644 index 0000000..e15cd7d --- /dev/null +++ b/src/main/java/com/xkrs/model/validation/DataSourceQoInsert.java @@ -0,0 +1,8 @@ +package com.xkrs.model.validation; + +/** + * @Author: XinYi Song + * @Date: 2022/1/19 16:39 + */ +public interface DataSourceQoInsert { +} diff --git a/src/main/java/com/xkrs/model/validation/FileQoInsert.java b/src/main/java/com/xkrs/model/validation/FileQoInsert.java new file mode 100644 index 0000000..ec99981 --- /dev/null +++ b/src/main/java/com/xkrs/model/validation/FileQoInsert.java @@ -0,0 +1,8 @@ +package com.xkrs.model.validation; + +/** + * @Author: XinYi Song + * @Date: 2022/1/20 15:26 + */ +public interface FileQoInsert { +} diff --git a/src/main/java/com/xkrs/model/validation/FileUpdateQoUpdate.java b/src/main/java/com/xkrs/model/validation/FileUpdateQoUpdate.java new file mode 100644 index 0000000..912133c --- /dev/null +++ b/src/main/java/com/xkrs/model/validation/FileUpdateQoUpdate.java @@ -0,0 +1,8 @@ +package com.xkrs.model.validation; + +/** + * @Author: XinYi Song + * @Date: 2022/1/20 16:21 + */ +public interface FileUpdateQoUpdate { +} diff --git a/src/main/java/com/xkrs/model/validation/PictureQoInsert.java b/src/main/java/com/xkrs/model/validation/PictureQoInsert.java new file mode 100644 index 0000000..7036491 --- /dev/null +++ b/src/main/java/com/xkrs/model/validation/PictureQoInsert.java @@ -0,0 +1,8 @@ +package com.xkrs.model.validation; + +/** + * @Author: XinYi Song + * @Date: 2022/1/20 15:26 + */ +public interface PictureQoInsert { +} diff --git a/src/main/java/com/xkrs/model/validation/SpecQoInsert.java b/src/main/java/com/xkrs/model/validation/SpecQoInsert.java new file mode 100644 index 0000000..93f09aa --- /dev/null +++ b/src/main/java/com/xkrs/model/validation/SpecQoInsert.java @@ -0,0 +1,8 @@ +package com.xkrs.model.validation; + +/** + * @Author: XinYi Song + * @Date: 2022/1/19 10:22 + */ +public interface SpecQoInsert { +} diff --git a/src/main/java/com/xkrs/service/DataDictService.java b/src/main/java/com/xkrs/service/DataDictService.java new file mode 100644 index 0000000..b233e12 --- /dev/null +++ b/src/main/java/com/xkrs/service/DataDictService.java @@ -0,0 +1,18 @@ +package com.xkrs.service; + +import com.xkrs.model.entity.DataDict; +import com.xkrs.model.qo.DataDictQo; + +/** + * @Author: XinYi Song + * @Date: 2022/1/19 10:10 + */ +public interface DataDictService { + + /** + * 添加字典数据 + * @param dataDictQo + * @return + */ + String insertDataDict(DataDictQo dataDictQo); +} diff --git a/src/main/java/com/xkrs/service/DataSourceService.java b/src/main/java/com/xkrs/service/DataSourceService.java new file mode 100644 index 0000000..d5aa9fe --- /dev/null +++ b/src/main/java/com/xkrs/service/DataSourceService.java @@ -0,0 +1,17 @@ +package com.xkrs.service; + +import com.xkrs.model.qo.DataSourceQo; + +/** + * @Author: XinYi Song + * @Date: 2022/1/19 16:42 + */ +public interface DataSourceService { + + /** + * 添加测量数据 + * @param dataSourceQo + * @return + */ + String insertDataSource(DataSourceQo dataSourceQo); +} diff --git a/src/main/java/com/xkrs/service/FileService.java b/src/main/java/com/xkrs/service/FileService.java new file mode 100644 index 0000000..367f056 --- /dev/null +++ b/src/main/java/com/xkrs/service/FileService.java @@ -0,0 +1,29 @@ +package com.xkrs.service; + +import com.xkrs.model.qo.FileQo; +import org.apache.poi.openxml4j.exceptions.InvalidFormatException; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * @Author: XinYi Song + * @Date: 2022/1/20 15:24 + */ +public interface FileService { + + /** + * 添加模板信息 + * @param fileQo + * @return + */ + String insertFileExcel(FileQo fileQo,MultipartFile fileExcel) throws IOException; + + /** + * 导出excel + * @param fileQo + * @return + */ + String exportExcel(FileQo fileQo) throws IOException, InvalidFormatException; +} diff --git a/src/main/java/com/xkrs/service/PictureService.java b/src/main/java/com/xkrs/service/PictureService.java new file mode 100644 index 0000000..50386e7 --- /dev/null +++ b/src/main/java/com/xkrs/service/PictureService.java @@ -0,0 +1,19 @@ +package com.xkrs.service; + +import com.xkrs.model.qo.PictureQo; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; + +/** + * @Author: XinYi Song + * @Date: 2022/1/20 15:24 + */ +public interface PictureService { + + /** + * 添加图片 + */ + String insertPicture(PictureQo pictureQo, MultipartFile pictureFile)throws IOException; + +} diff --git a/src/main/java/com/xkrs/service/SpecService.java b/src/main/java/com/xkrs/service/SpecService.java new file mode 100644 index 0000000..d215ea4 --- /dev/null +++ b/src/main/java/com/xkrs/service/SpecService.java @@ -0,0 +1,19 @@ +package com.xkrs.service; + +import com.xkrs.model.qo.SpecQo; + +/** + * @Author: XinYi Song + * @Date: 2022/1/20 15:24 + */ +public interface SpecService { + + /** + * 添加规格数据 + * + * @param specQo + * @return + */ + String insertSpec(SpecQo specQo); + +} diff --git a/src/main/java/com/xkrs/service/impl/DataDictServiceImpl.java b/src/main/java/com/xkrs/service/impl/DataDictServiceImpl.java new file mode 100644 index 0000000..4fa2227 --- /dev/null +++ b/src/main/java/com/xkrs/service/impl/DataDictServiceImpl.java @@ -0,0 +1,46 @@ +package com.xkrs.service.impl; + +import com.xkrs.dao.DataDictDao; +import com.xkrs.encapsulation.PromptMessageEnum; +import com.xkrs.model.entity.DataDict; +import com.xkrs.model.qo.DataDictQo; +import com.xkrs.service.DataDictService; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Locale; +import java.util.Optional; + +import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; + +/** + * @Author: XinYi Song + * @Date: 2022/1/19 10:28 + */ +@Service +public class DataDictServiceImpl implements DataDictService { + + @Resource + private DataDictDao dataDictDao; + + /** + * 添加字典数据 + * + * @param dataDictQo + * @return + */ + @Override + public String insertDataDict(DataDictQo dataDictQo) { + Locale locale = LocaleContextHolder.getLocale(); + Optional byInspectionItemCode = dataDictDao.findByInspectionItemCode(dataDictQo.getInspectionItemCode()); + if (byInspectionItemCode.isPresent()) { + return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "该产品变量已存在,请勿重复添加!", locale); + } + DataDict dataDict = new DataDict(); + dataDict.setInspectionItemName(dataDictQo.getInspectionItemName()); + dataDict.setInspectionItemCode(dataDictQo.getInspectionItemCode()); + dataDictDao.save(dataDict); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale); + } +} diff --git a/src/main/java/com/xkrs/service/impl/DataSourceServiceImpl.java b/src/main/java/com/xkrs/service/impl/DataSourceServiceImpl.java new file mode 100644 index 0000000..4b2d1ca --- /dev/null +++ b/src/main/java/com/xkrs/service/impl/DataSourceServiceImpl.java @@ -0,0 +1,57 @@ +package com.xkrs.service.impl; + +import com.xkrs.dao.DataDictDao; +import com.xkrs.dao.DataSourceDao; +import com.xkrs.encapsulation.PromptMessageEnum; +import com.xkrs.model.entity.DataDict; +import com.xkrs.model.entity.DataSource; +import com.xkrs.model.qo.DataSourceQo; +import com.xkrs.service.DataSourceService; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Locale; +import java.util.Optional; + +import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; + +/** + * @Author: XinYi Song + * @Date: 2022/1/19 16:43 + */ +@Service +public class DataSourceServiceImpl implements DataSourceService { + + @Resource + private DataSourceDao dataSourceDao; + + @Resource + private DataDictDao dataDictDao; + + /** + * 添加测量数据 + * + * @param dataSourceQo + * @return + */ + @Override + public String insertDataSource(DataSourceQo dataSourceQo) { + Locale locale = LocaleContextHolder.getLocale(); + Optional byInspectionItemCode = dataDictDao.findByInspectionItemCode(dataSourceQo.getInspectionItemCode()); + if (byInspectionItemCode.isEmpty()) { + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该字典类型!", locale); + } + DataSource dataSource = new DataSource(); + dataSource.setLotNo(dataSourceQo.getLotNo()); + dataSource.setMachineNo(dataSourceQo.getMachineNo()); + dataSource.setMaterialNo(dataSourceQo.getMaterialNo()); + dataSource.setModelNo(dataSourceQo.getModelNo()); + dataSource.setMachineTypeNo(dataSourceQo.getMachineTypeNo()); + dataSource.setCraftItemName(dataSourceQo.getCraftItemName()); + dataSource.setInspectionItemCode(dataSourceQo.getInspectionItemCode()); + dataSource.setInspectValue(dataSourceQo.getInspectValue()); + dataSourceDao.save(dataSource); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale); + } +} diff --git a/src/main/java/com/xkrs/service/impl/FileServiceImpl.java b/src/main/java/com/xkrs/service/impl/FileServiceImpl.java new file mode 100644 index 0000000..5488a3a --- /dev/null +++ b/src/main/java/com/xkrs/service/impl/FileServiceImpl.java @@ -0,0 +1,104 @@ +package com.xkrs.service.impl; + +import com.xkrs.dao.FileDao; +import com.xkrs.encapsulation.PromptMessageEnum; +import com.xkrs.model.entity.DataSource; +import com.xkrs.model.entity.FileEntity; +import com.xkrs.model.qo.FileQo; +import com.xkrs.service.FileService; +import com.xkrs.util.DataSourceQuery; +import com.xkrs.util.ExcelUploadUtil; +import com.xkrs.util.ExportExcel; +import org.apache.poi.openxml4j.exceptions.InvalidFormatException; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.transaction.Transactional; +import java.io.IOException; +import java.util.*; + +import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; + +/** + * @Author: XinYi Song + * @Date: 2022/1/20 15:24 + */ +@Service +public class FileServiceImpl implements FileService { + + @Resource + private FileDao fileDao; + + @Resource + private DataSourceQuery dataSourceQuery; + + /** + * 添加模板信息 + * + * @param fileQo + * @return + */ + @Override + public String insertFileExcel(FileQo fileQo, MultipartFile fileExcel) throws IOException { + String lotNo = fileQo.getLotNo(); + String machineNo = fileQo.getMachineNo(); + String materialNo = fileQo.getMaterialNo(); + String modelNo = fileQo.getModelNo(); + String machineTypeNo = fileQo.getMachineTypeNo(); + String craftItemName = fileQo.getCraftItemName(); + Locale locale = LocaleContextHolder.getLocale(); + Optional fileEntity = fileDao.selectFile(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName); + if (fileEntity.isPresent()) { + return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "已存在该产品的模板!", locale); + } + if (fileExcel == null) { + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "模板不能为空!", locale); + } + String file = ExcelUploadUtil.memoryFile(fileExcel, 1); + FileEntity fileEntity1 = new FileEntity(); + fileEntity1.setLotNo(fileQo.getLotNo()); + fileEntity1.setMachineNo(fileQo.getMachineNo()); + fileEntity1.setMaterialNo(fileQo.getMaterialNo()); + fileEntity1.setModelNo(fileQo.getModelNo()); + fileEntity1.setMachineTypeNo(fileQo.getMachineTypeNo()); + fileEntity1.setFileUploadPath(file); + fileDao.save(fileEntity1); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale); + } + + /** + * 导出excel + * + * @param fileQo + * @return + */ + @Transactional(rollbackOn = Exception.class) + @Override + public String exportExcel(FileQo fileQo) throws IOException, InvalidFormatException { + String lotNo = fileQo.getLotNo(); + String machineNo = fileQo.getMachineNo(); + String materialNo = fileQo.getMaterialNo(); + String modelNo = fileQo.getModelNo(); + String machineTypeNo = fileQo.getMachineTypeNo(); + String craftItemName = fileQo.getCraftItemName(); + Locale locale = LocaleContextHolder.getLocale(); + Optional fileEntity = fileDao.selectFile(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName); + if (fileEntity.isEmpty()) { + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的模板,请添加!", locale); + } + String fileUploadPath = fileEntity.get().getFileUploadPath(); + List dataSources = dataSourceQuery.selectDataSource(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName); + if (dataSources == null || dataSources.size() == 0) { + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的信息!", locale); + } + Map map = new HashMap<>(); + for (DataSource dataSource : dataSources) { + map.put(dataSource.getInspectionItemCode(), dataSource.getInspectValue()); + } + String fill = ExportExcel.exportToProveExcel(map, fileUploadPath); + fileDao.updateFileDownloadPath(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName, fill); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, fill, locale); + } +} diff --git a/src/main/java/com/xkrs/service/impl/PictureServiceImpl.java b/src/main/java/com/xkrs/service/impl/PictureServiceImpl.java new file mode 100644 index 0000000..7e162ba --- /dev/null +++ b/src/main/java/com/xkrs/service/impl/PictureServiceImpl.java @@ -0,0 +1,51 @@ +package com.xkrs.service.impl; + +import com.xkrs.dao.PictureDao; +import com.xkrs.encapsulation.PromptMessageEnum; +import com.xkrs.model.entity.PictureEntity; +import com.xkrs.model.qo.PictureQo; +import com.xkrs.service.PictureService; +import com.xkrs.util.ExcelUploadUtil; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.Locale; +import java.util.Optional; + +import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; + +@Service +public class PictureServiceImpl implements PictureService { + + @Resource + private PictureDao pictureDao; + + @Override + public String insertPicture(PictureQo pictureQo, MultipartFile pictureFile) throws IOException { + Locale locale = LocaleContextHolder.getLocale(); + String lotNo = pictureQo.getLotNo(); + String machineNo = pictureQo.getMachineNo(); + String materialNo = pictureQo.getMaterialNo(); + String modelNo = pictureQo.getModelNo(); + String machineTypeNo = pictureQo.getMachineTypeNo(); + String craftItemName = pictureQo.getCraftItemName(); + Optional pictureEntity2 = pictureDao.selectPicture(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName); + if (pictureEntity2.isPresent()) { + return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "请勿重复添加!", locale); + } + String file = ExcelUploadUtil.memoryFile(pictureFile, 2); + PictureEntity pictureEntity1 = new PictureEntity(); + pictureEntity1.setLotNo(lotNo); + pictureEntity1.setMachineNo(machineNo); + pictureEntity1.setMaterialNo(materialNo); + pictureEntity1.setModelNo(modelNo); + pictureEntity1.setMachineTypeNo(machineTypeNo); + pictureEntity1.setCraftItemName(craftItemName); + pictureEntity1.setPicturePath(file); + pictureDao.save(pictureEntity1); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale); + } +} diff --git a/src/main/java/com/xkrs/service/impl/SpecServiceImpl.java b/src/main/java/com/xkrs/service/impl/SpecServiceImpl.java new file mode 100644 index 0000000..ccac25e --- /dev/null +++ b/src/main/java/com/xkrs/service/impl/SpecServiceImpl.java @@ -0,0 +1,48 @@ +package com.xkrs.service.impl; + +import com.xkrs.dao.SpecDao; +import com.xkrs.encapsulation.PromptMessageEnum; +import com.xkrs.model.entity.SpecEntity; +import com.xkrs.model.qo.SpecQo; +import com.xkrs.service.SpecService; +import com.xkrs.util.SpecQuery; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Locale; + +import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; + +@Service +public class SpecServiceImpl implements SpecService { + + @Resource + private SpecQuery specQuery; + + @Resource + private SpecDao specDao; + + @Override + public String insertSpec(SpecQo specQo) { + Locale locale = LocaleContextHolder.getLocale(); + List specEntities = specQuery.selectSpec(specQo.getMachineTypeNo(), specQo.getInspectionItemCode(),specQo.getCraftItemName()); + if (!specEntities.isEmpty()) { + return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "已存在该测量规格!", locale); + } + SpecEntity specEntity1 = new SpecEntity(); + specEntity1.setMachineTypeNo(specQo.getMachineTypeNo()); + specEntity1.setInspectionItemCode(specQo.getInspectionItemCode()); + specEntity1.setCraftItemName(specQo.getCraftItemName()); + specEntity1.setMax(specQo.getMax()); + specEntity1.setMean(specQo.getMean()); + specEntity1.setMin(specQo.getMin()); + specEntity1.setUnit(specQo.getUnit()); + specEntity1.setInspectionMethod(specQo.getInspectionMethod()); + specEntity1.setInspectionStandard(specQo.getInspectionStandard()); + specEntity1.setRemark(specQo.getRemark()); + specDao.save(specEntity1); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale); + } +} diff --git a/src/main/java/com/xkrs/util/DataDictQuery.java b/src/main/java/com/xkrs/util/DataDictQuery.java new file mode 100644 index 0000000..5d8e4a5 --- /dev/null +++ b/src/main/java/com/xkrs/util/DataDictQuery.java @@ -0,0 +1,42 @@ +package com.xkrs.util; + +import com.xkrs.dao.DataDictDao; +import com.xkrs.model.entity.DataDict; +import org.springframework.data.jpa.domain.Specification; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import javax.persistence.criteria.Predicate; +import java.util.ArrayList; +import java.util.List; + +/** + * @Author: XinYi Song + * @Date: 2022/1/19 13:56 + */ +@Component +public class DataDictQuery { + + @Resource + private DataDictDao dataDictDao; + + /** + * 动态多条件查询字典信息 + * + * @return + */ + public List selectDataDict(String inspectionItemName, String inspectionItemCode) { + Specification specification = (root, criteriaQuery, criteriaBuilder) -> { + List list = new ArrayList<>(); + if (inspectionItemName != null && !"".equals(inspectionItemName)) { + list.add(criteriaBuilder.equal(root.get("inspectionItemName").as(String.class), inspectionItemName)); + } + if (inspectionItemCode != null && !"".equals(inspectionItemCode)) { + list.add(criteriaBuilder.equal(root.get("inspectionItemCode").as(String.class), inspectionItemCode)); + } + Predicate[] predicates = new Predicate[list.size()]; + return criteriaBuilder.and(list.toArray(predicates)); + }; + return dataDictDao.findAll(specification); + } +} diff --git a/src/main/java/com/xkrs/util/DataSourceQuery.java b/src/main/java/com/xkrs/util/DataSourceQuery.java new file mode 100644 index 0000000..18f5e4c --- /dev/null +++ b/src/main/java/com/xkrs/util/DataSourceQuery.java @@ -0,0 +1,55 @@ +package com.xkrs.util; + +import com.xkrs.dao.DataSourceDao; +import com.xkrs.model.entity.DataSource; +import org.apache.http.util.TextUtils; +import org.springframework.data.jpa.domain.Specification; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import javax.persistence.criteria.Predicate; +import java.util.ArrayList; +import java.util.List; + +/** + * @Author: XinYi Song + * @Date: 2022/1/19 13:56 + */ +@Component +public class DataSourceQuery { + + @Resource + private DataSourceDao dataSourceDao; + + /** + * 动态多条件查询采集数据信息 + * + * @return + */ + public List selectDataSource(String lotNo, String machineNo, String materialNo, String modelNo, String machineTypeNo, String craftItemName) { + Specification specification = (root, criteriaQuery, criteriaBuilder) -> { + List list = new ArrayList<>(); + if (!TextUtils.isEmpty(lotNo)) { + list.add(criteriaBuilder.equal(root.get("lotNo").as(String.class), lotNo)); + } + if (!TextUtils.isEmpty(machineNo)) { + list.add(criteriaBuilder.equal(root.get("machineNo").as(String.class), machineNo)); + } + if (!TextUtils.isEmpty(materialNo)) { + list.add(criteriaBuilder.equal(root.get("materialNo").as(String.class), materialNo)); + } + if (!TextUtils.isEmpty(modelNo)) { + list.add(criteriaBuilder.equal(root.get("modelNo").as(String.class), modelNo)); + } + if (!TextUtils.isEmpty(machineTypeNo)) { + list.add(criteriaBuilder.equal(root.get("machineTypeNo").as(String.class), machineTypeNo)); + } + if (!TextUtils.isEmpty(craftItemName)) { + list.add(criteriaBuilder.equal(root.get("craftItemName").as(String.class), craftItemName)); + } + Predicate[] predicates = new Predicate[list.size()]; + return criteriaBuilder.and(list.toArray(predicates)); + }; + return dataSourceDao.findAll(specification); + } +} diff --git a/src/main/java/com/xkrs/util/ExcelUploadUtil.java b/src/main/java/com/xkrs/util/ExcelUploadUtil.java new file mode 100644 index 0000000..c6f94a2 --- /dev/null +++ b/src/main/java/com/xkrs/util/ExcelUploadUtil.java @@ -0,0 +1,188 @@ +package com.xkrs.util; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.multipart.MultipartFile; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.UUID; + +/** + * @author XinYi Song + */ +public class ExcelUploadUtil { + + public static Logger log = LoggerFactory.getLogger(ExcelUploadUtil.class); + + /** + * 上传单张图片 + * + * @param fileInput + * @return + * @throws IOException + */ + public static String memoryFile(MultipartFile fileInput, int subDirType) throws IOException { + String subDir = subDirType == 1 ? "excel/" : "picture/"; + //获取原始文件名 + String originalFilename = fileInput.getOriginalFilename(); + if (originalFilename != null && !"".equals(originalFilename)) { + //找到 . 的位置 + int index = originalFilename.lastIndexOf("."); + //根据 . 的位置进行分割,拿到文件后缀名 + String suffix = originalFilename.substring(index); + //uuid生成新的文件名 + String newName = UUID.randomUUID().toString() + suffix; +// File file = new File("/Users/liuchengqian/Desktop/DaJiang/" + subDir); + File file = new File("/home/sxy/server/industrial_measurement/" + subDir); + if (!file.exists()) { + file.mkdirs(); + } +// String path = "/Users/liuchengqian/Desktop/DaJiang/" + subDir + newName; + String path = "/home/sxy/server/industrial_measurement/" + subDir + newName; + //实现上传 + fileInput.transferTo(new File(path)); + return "http://118.24.27.47:2088/" + subDir + newName; + } + return null; + } + + /** + * 以文件形式,批量上传图片 + * @param files + * @return + * @throws IOException + */ + /*public static List uploadImage(MultipartFile[] files, String fireCode) throws IOException { + //String uploadPath = "http://139.199.98.175:2099/forestTaskImage/"; + String uploadPath = "http://118.24.27.47:2088/"; + String newName = ""; + String oldName = ""; + List fireTaskPhotos = new ArrayList<>(); + for(MultipartFile file : files){ + //获取file图片名称 + oldName = file.getOriginalFilename(); + //找到 . 的位置 + int index = oldName.lastIndexOf("."); + //根据 . 的位置进行分割,拿到文件后缀名 + String suffix = oldName.substring(index); + //uuid生成新的文件名 + newName = UUID.randomUUID().toString() + suffix; + //将图片保存到本地/usr/etc/images/Folder + File file1 = new File("/home/sxy/server/fire_point/firePointImage/"); + //File file1 = new File("E:/file/work/image/"); + if (!file1.exists()) { + file1.mkdirs(); + } + String path = "/home/sxy/server/fire_point/firePointImage/" + newName; + //String path = "E:/file/work/image/" + newName; + String uploadPaths = "/firePointImage/" + newName; + //实现上传 + file.transferTo(new File(path)); + FireTaskPhoto fireTaskPhoto = new FireTaskPhoto(); + fireTaskPhoto.setPhotoFireCode(fireCode); + fireTaskPhoto.setTaskPhoto(uploadPaths); + + fireTaskPhotos.add(fireTaskPhoto); + } + return fireTaskPhotos; + }*/ + + + /** + * 删除本地或服务器储存的图片 + * + * @param path + * @return + */ + public static String delFile(String path) { + String resultInfo = null; + int lastIndexOf = path.lastIndexOf("/"); + String imgPath = path.substring(lastIndexOf + 1, path.length()); + System.out.println(imgPath); + imgPath = "/usr/local/etc/images/" + imgPath; +// img_path = "/usr/etc/images/Folder/" + img_path; + File file = new File(imgPath); + if (file.exists()) { + if (file.delete()) { + resultInfo = "删除成功!"; + } else { + resultInfo = "删除失败!"; + } + } else { + resultInfo = "文件不存在"; + } + return resultInfo; + } + + /** + * 通过图片路径解析 ,上传保存 + * + * @param listImgSrc + * @return + */ + public static List downloadImage(List listImgSrc) { + try { + List list = new ArrayList(); + //开始时间 + Date beginDate = new Date(); + for (String url : listImgSrc) { + //开始时间 + Date beginDate2 = new Date(); + String imageName = url.substring(url.lastIndexOf("/") + 1, url.length()); + URL uri = new URL(url); + InputStream in = uri.openStream(); + //String pathUpload = "E:/img/" + imageName; + String pathUpload = "/home/web/wf-fire-service/wfimage/" + imageName; + FileOutputStream fo = new FileOutputStream(new File(pathUpload)); + byte[] buf = new byte[1024]; + int length = 0; + log.info("-------开始下载:" + url); + while ((length = in.read(buf, 0, buf.length)) != -1) { + fo.write(buf, 0, length); + } + in.close(); + fo.close(); + list.add(imageName); + log.info(imageName + "------下载完成"); + //结束时间 + Date overDate2 = new Date(); + double time = overDate2.getTime() - beginDate2.getTime(); + log.info("-----耗时:" + time / 1000 + "s"); + } + Date overDate = new Date(); + double time = overDate.getTime() - beginDate.getTime(); + log.info("======总耗时:" + time / 1000 + "s"); + return list; + } catch (Exception e) { + log.info("++++++下载失败"); + } + return null; + } + + /** + * 删除本地文件夹图片 + * + * @param url + */ + public static void deleteImage(String url) { + File file = new File(url); + //判断file是否是文件目录 若是返回TRUE + if (file.isDirectory()) { + //name存储file文件夹中的文件名 + String[] name = file.list(); + for (int i = 0; i < name.length; i++) { + //此时就可得到文件夹中的文件 + File f = new File(url, name[i]); + //删除文件 + f.delete(); + } + } + } +} diff --git a/src/main/java/com/xkrs/util/ExportExcel.java b/src/main/java/com/xkrs/util/ExportExcel.java new file mode 100644 index 0000000..0fbf2a7 --- /dev/null +++ b/src/main/java/com/xkrs/util/ExportExcel.java @@ -0,0 +1,68 @@ +package com.xkrs.util; + +import net.sf.jxls.transformer.XLSTransformer; +import org.apache.poi.openxml4j.exceptions.InvalidFormatException; +import java.io.*; +import java.util.Map; + +/** + * @Author: XinYi Song + * @Date: 2022/1/17 8:56 + */ +public class ExportExcel { + + /** + * 最简单的填充 + * + * @since 2.1.1 + */ + /*public static String simpleFill(Map map,String templateFileName) { + + + String s = System.currentTimeMillis() + ".xlsx"; + // 方案2 根据Map填充 + String fileName = "/usr/local/excel/" + s; + //String fileName = "E:\\shoptest\\" + s; + // 这里 会填充到第一个sheet, 然后文件流会自动关闭 + + ExcelWriterBuilder write = EasyExcel.write(fileName); + + ExcelWriterBuilder excelWriterBuilder = write.withTemplate(templateFileName); + + ExcelWriter build = excelWriterBuilder.build(); + WriteSheet writeSheet = EasyExcel.writerSheet().build(); + + build.fill(map,writeSheet); + build.finish(); + + //EasyExcel.write(fileName).withTemplate(templateFileName).sheet().doFill(map); + return "http://118.24.27.47:2088/excel/"+s; + //return "http://192.168.2.139/"+s; + }*/ + + + public static String exportToProveExcel(Map dataMap, String srcFilePath) throws IOException, InvalidFormatException { + String s = System.currentTimeMillis() + ".xlsx"; + //String path = "E:/shop/"+s; + String path = "/home/sxy/server/industrial_measurement/excel/" + s; + + // 开始转换。利用 transformer 转到Excel + XLSTransformer transformer = new XLSTransformer(); + // 参数:srcFilePath:模板源文件 cMap:需要导出的数据 destFile.getAbsolutePath():下载的目标文件 + transformer.transformXLS(srcFilePath, dataMap, path); + //return "http://192.168.2.139/"+s; + return "http://118.24.27.47:2088/excel/"+s; + } + + /*public static void main(String[] args) throws IOException, InvalidFormatException { + // 模板注意 用{} 来表示你要用的变量 如果本来就有"{","}" 特殊字符 用"\{","\}"代替 + String templateFileName = TestFileUtil.getPath() + "templates" + File.separator + "test.xlsx"; + Map map = new HashMap(); + map.put("name", "张三"); + map.put("sex", "男"); + //simpleFill(map,templateFileName); + HttpServletResponse response = null; + String s = exportToProveExcel(map); + System.out.println(s); + }*/ +} diff --git a/src/main/java/com/xkrs/util/PictureQuery.java b/src/main/java/com/xkrs/util/PictureQuery.java new file mode 100644 index 0000000..cd7ab46 --- /dev/null +++ b/src/main/java/com/xkrs/util/PictureQuery.java @@ -0,0 +1,55 @@ +package com.xkrs.util; + +import com.xkrs.dao.PictureDao; +import com.xkrs.model.entity.PictureEntity; +import org.apache.http.util.TextUtils; +import org.springframework.data.jpa.domain.Specification; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import javax.persistence.criteria.Predicate; +import java.util.ArrayList; +import java.util.List; + +/** + * @Author: XinYi Song + * @Date: 2022/1/19 13:56 + */ +@Component +public class PictureQuery { + + @Resource + private PictureDao pictureDao; + + /** + * 动态多条件查询图片信息 + * + * @return + */ + public List selectPicture(String lotNo, String machineNo, String materialNo, String modelNo, String machineTypeNo, String craftItemName) { + Specification specification = (root, criteriaQuery, criteriaBuilder) -> { + List list = new ArrayList<>(); + if (!TextUtils.isEmpty(lotNo)) { + list.add(criteriaBuilder.equal(root.get("lotNo").as(String.class), lotNo)); + } + if (!TextUtils.isEmpty(machineNo)) { + list.add(criteriaBuilder.equal(root.get("machineNo").as(String.class), machineNo)); + } + if (!TextUtils.isEmpty(materialNo)) { + list.add(criteriaBuilder.equal(root.get("materialNo").as(String.class), materialNo)); + } + if (!TextUtils.isEmpty(modelNo)) { + list.add(criteriaBuilder.equal(root.get("modelNo").as(String.class), modelNo)); + } + if (!TextUtils.isEmpty(machineTypeNo)) { + list.add(criteriaBuilder.equal(root.get("machineTypeNo").as(String.class), machineTypeNo)); + } + if (!TextUtils.isEmpty(craftItemName)) { + list.add(criteriaBuilder.equal(root.get("craftItemName").as(String.class), craftItemName)); + } + Predicate[] predicates = new Predicate[list.size()]; + return criteriaBuilder.and(list.toArray(predicates)); + }; + return pictureDao.findAll(specification); + } +} diff --git a/src/main/java/com/xkrs/util/SpecQuery.java b/src/main/java/com/xkrs/util/SpecQuery.java new file mode 100644 index 0000000..d744a90 --- /dev/null +++ b/src/main/java/com/xkrs/util/SpecQuery.java @@ -0,0 +1,46 @@ +package com.xkrs.util; + +import com.xkrs.dao.SpecDao; +import com.xkrs.model.entity.SpecEntity; +import org.apache.http.util.TextUtils; +import org.springframework.data.jpa.domain.Specification; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import javax.persistence.criteria.Predicate; +import java.util.ArrayList; +import java.util.List; + +/** + * @Author: XinYi Song + * @Date: 2022/1/19 13:56 + */ +@Component +public class SpecQuery { + + @Resource + private SpecDao specDao; + + /** + * 动态多条件查询规格信息 + * + * @return + */ + public List selectSpec(String machineTypeNo, String inspectionItemCode, String craftItemName) { + Specification specification = (root, criteriaQuery, criteriaBuilder) -> { + List list = new ArrayList<>(); + if (!TextUtils.isEmpty(machineTypeNo)) { + list.add(criteriaBuilder.equal(root.get("machineTypeNo").as(String.class), machineTypeNo)); + } + if (!TextUtils.isEmpty(inspectionItemCode)) { + list.add(criteriaBuilder.equal(root.get("inspectionItemCode").as(String.class), inspectionItemCode)); + } + if (!TextUtils.isEmpty(craftItemName)) { + list.add(criteriaBuilder.equal(root.get("craftItemName").as(String.class), craftItemName)); + } + Predicate[] predicates = new Predicate[list.size()]; + return criteriaBuilder.and(list.toArray(predicates)); + }; + return specDao.findAll(specification); + } +} diff --git a/src/main/java/com/xkrs/util/TestFileUtil.java b/src/main/java/com/xkrs/util/TestFileUtil.java new file mode 100644 index 0000000..f564dc8 --- /dev/null +++ b/src/main/java/com/xkrs/util/TestFileUtil.java @@ -0,0 +1,38 @@ +package com.xkrs.util; + +import java.io.File; +import java.io.InputStream; + +/** + * @Author: XinYi Song + * @Date: 2022/1/17 9:29 + */ +public class TestFileUtil { + public static InputStream getResourcesFileInputStream(String fileName) { + return Thread.currentThread().getContextClassLoader().getResourceAsStream("" + fileName); + } + + public static String getPath() { + return TestFileUtil.class.getResource("/").getPath(); + } + + public static File createNewFile(String pathName) { + File file = new File(getPath() + pathName); + if (file.exists()) { + file.delete(); + } else { + if (!file.getParentFile().exists()) { + file.getParentFile().mkdirs(); + } + } + return file; + } + + public static File readFile(String pathName) { + return new File(getPath() + pathName); + } + + public static File readUserHomeFile(String pathName) { + return new File(System.getProperty("user.home") + File.separator + pathName); + } +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..211d463 --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1,54 @@ +server.port = 6810 + +## 数据源配置 +#spring.datasource.url = jdbc:postgresql://localhost:5432/data_model +#spring.datasource.userName = postgres +#spring.datasource.password = 123456 +#spring.datasource.driverClassName = org.postgresql.Driver + +spring.datasource.url = jdbc:mysql://118.24.27.47:3306/data_model?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai +spring.datasource.userName = sxy +spring.datasource.password = sxy123 +spring.datasource.driverClassName = com.mysql.cj.jdbc.Driver + +server.tomcat.uri-encoding=UTF-8 + +# jackson 配置 +spring.jackson.serialization.write-date-keys-as-timestamps=false + +## Hikari连接池设置 +spring.datasource.hikari.auto-commit = true +spring.datasource.hikari.maximum-pool-size = 100 +spring.datasource.hikari.idle-timeout = 10000 +spring.datasource.hikari.minimum-idle = 5 +spring.datasource.hikari.validation-timeout = 3000 + +## Spring Data JPA 配置 +spring.jpa.database = mysql +spring.jpa.database-platform = org.hibernate.dialect.MySQL5InnoDBDialect +spring.jpa.show-sql = false +# 指定 ddl mode (none, validate, create, create-drop, update) +spring.jpa.hibernate.ddl-auto = update +# 命名策略 +spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy +#spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQL95Dialect +#spring.jpa.properties.hibernate.dialect = org.hibernate.spatial.dialect.postgis.PostgisDialect +spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults = false + +## Devtools配置 +spring.devtools.livereload.enabled = true + +## 多国语言配置 +spring.messages.basename = i18n/messages +spring.messages.encoding = UTF-8 + +# 上传文件配置 +spring.servlet.multipart.enabled=true +# 最大文件大小 +spring.servlet.multipart.max-file-size = 100MB +# 最大请求大小 +spring.servlet.multipart.max-request-size = 100MB + +spring.main.allow-bean-definition-overriding = true + + diff --git a/src/main/resources/i18n/messages.properties b/src/main/resources/i18n/messages.properties new file mode 100644 index 0000000..8cfedc5 --- /dev/null +++ b/src/main/resources/i18n/messages.properties @@ -0,0 +1,162 @@ +sys.message.success = 成功 +sys.message.null = 暂时还没有数据 +sys.message.exit = 已存在相关内容,请勿重复操作 +sys.message.user.not_logged_in = 用户未登录 +sys.message.user.login_error = 用户登陆失败 +sys.message.user.account_forbidden = 用户已被禁止 +sys.message.user.account_not_activated = 用户未激活 +sys.message.user.overtime = 用户登录超时 +sys.message.user.no_permission = 用户权限不足 +sys.message.user.already_logged = 用户已经登录 +sys.message.param.null = 参数为空 +sys.message.param.illegal = 参数非法 +sys.message.data.none = 数据为空 +sys.message.data.wrong = 数据错误 +sys.message.process.fail = 处理失败 +sys.message.process.overtime = 处理超时 +sys.message.system.inner_error = 系统内部错误 +sys.message.system.abnormal = 系统异常 +sys.message.system.busy = 系统正忙,请稍后 +sys.message.system.maintain = 系统维护中 +sys.message.database.error = 数据库错误 +sys.message.file.exists = 文件已存在 +sys.message.file.write.error = 文件写入失败 +sys.message.file.read.error = 文件读取失败 + +SysUser.id.blank = 用户id不能为空 +SysUser.userName.blank = 用户名不能为空 +SysUser.userName.length.illegal = 用户名长度不合法 +SysUser.userName.format.illegal = 用户名格式不合法 +SysUser.nickName.length.illegal = 用户昵称长度不合法 +SysUser.userCode.length.illegal = 用户编码长度不合法 +SysUser.userCode.format.illegal = 用户编码含有非法字符 +SysUser.password.blank = 用户密码不能为空 +SysUser.password.length.illegal = 用户密码长度不合法 +SysUser.password.format.illegal = 用户密码格式不合法 +SysUser.sex.num.null = 用户性别数字不能为空 +SysUser.sex.num.illegal = 用户性别数字不合法 +SysUser.telephone.format.illegal = 用户手机号码不合法 +SysUser.email.length.illegal = 用户邮箱长度不合法 +SysUser.email.format.illegal = 用户邮箱格式不合法 +SysUser.admCode.illegal = 用户行政区划代码不合法 +SysUser.address.length.illegal = 用户详细地址长度不合法 +SysUser.birthday.format.illegal = 用户出生日期必须是 yyyy-MM-dd +SysUser.personalSignature.length.illegal = 用户个性签名长度非法 +SysUser.portraitId.illegal = 用户头像id非法 +SysUser.statusCode.null = 用户当前状态编码为空 +SysUser.statusCode.illegal = 用户当前状态编码非法 +SysUser.deleteFlag.null = 用户删除标记不能是空 + +TrajectoryRecord.id.null = id 不能为空 +TrajectoryRecord.startTimeTs.null = startTimeTs 不能为空 + +SatelliteFirePoint.id.null = id 不能为空 +SatelliteFirePoint.fireCode.null = fireCode 不能为空 +SatelliteFirePoint.fireCode.length.illegal = fireCode 长度过长 +SatelliteFirePoint.countyCode.null = countyCode 不能为空 +SatelliteFirePoint.countyCode.length.illegal = countyCode 长度过长 +SatelliteFirePoint.countyName.null = countyName 不能为空 +SatelliteFirePoint.countyName.length.illegal = countyName 长度过长 +SatelliteFirePoint.satelliteType.null = satelliteType 不能为空 +SatelliteFirePoint.fireStatus.null = fireStatus 不能为空 +SatelliteFirePoint.verifyStatus.null = verifyStatus 不能为空 +SatelliteFirePoint.satelliteTimeTs.null = satelliteTimeTs 不能为空 + +PictureFirePoint.id.null = id 不能为空 +PictureFirePoint.fireCode.null = fireCode 不能为空 +PictureFirePoint.fireCode.length.illegal = fireCode 长度过长 +PictureFirePoint.pictureName.length.illegal = pictureName 长度过长 +PictureFirePoint.picturePath.null = picturePath 不能为空 +PictureFirePoint.picturePath.length.illegal = picturePath 长度过长 +PictureFirePoint.memo.length.illegal = memo 长度过长 +PictureFirePoint.size.length.illegal = size 长度过长 +PictureFirePoint.md5.null = md5 不能为空 +PictureFirePoint.md5.length.illegal = md5 长度过长 +PictureFirePoint.shootTimeTs.null = shootTimeTs 不能为空 + +PersonInvestigator.id.null = id 不能为空 +PersonInvestigator.name.null = name 不能为空 +PersonInvestigator.name.length.illegal = name 长度过长 +PersonInvestigator.code.length.illegal = code 长度过长 +PersonInvestigator.telephone.null = telephone 不能为空 +PersonInvestigator.telephone.format.illegal = telephone 格式非法 +PersonInvestigator.sex.null = sex 不能为空 +PersonInvestigator.sex.format.illegal = sex 格式非法 +PersonInvestigator.idCard.length.illegal = idCard 长度过长 +PersonInvestigator.memo.length.illegal = memo 长度过长 +PersonInvestigator.linkUserName.null = linkUserName 不能为空 +PersonInvestigator.linkUserName.format.illegal = linkUserName 格式非法 +PersonInvestigator.password.null = password 不能为空 +PersonInvestigator.password.format.illegal = password 格式非法 +InvestigateFirePoint.verifyTimeTs.null = verifyTimeTs 不能为空 + +InvestigateFirePoint.id.null = id 不能为空 +InvestigateFirePoint.fireCode.null = fireCode 不能为空 +InvestigateFirePoint.fireCode.length.illegal = fireCode 长度过长 +InvestigateFirePoint.countyCode.null = countyCode 不能为空 +InvestigateFirePoint.countyCode.length.illegal = countyCode 长度过长 +InvestigateFirePoint.countyName.null = countyName 不能为空 +InvestigateFirePoint.countyName.length.illegal = countyName 长度过长 +InvestigateFirePoint.address.null = address 不能为空 +InvestigateFirePoint.fireArea.null = fireArea 不能为空 +InvestigateFirePoint.verifyType.null = verifyType 不能为空 +InvestigateFirePoint.satelliteType.null = satelliteType 不能为空 +InvestigateFirePoint.satelliteType.length.illegal = satelliteType 长度过长 + +FileDocument.id.null = id 不能为空 +FileDocument.name.null = name 不能为空 +FileDocument.name.length.illegal = name 长度过长 +FileDocument.category.length.illegal = category 长度过长 +FileDocument.filePath.null = filePath 不能为空 +FileDocument.filePath.length.illegal = filePath 长度过长 +FileDocument.size.length.illegal = size 长度过长 +FileDocument.md5.null = md5 不能为空 +FileDocument.md5.length.illegal = md5 长度过长 +FileDocument.memo.length.illegal = memo 长度过长 +FileDocument.checkingToken.length.illegal = checkingToken 长度过长 + +AppFile.id.null = id 不能为空 +AppFile.name.null = name 不能为空 +AppFile.name.length.illegal = name 长度过长 +AppFile.appPath.null = appPath 不能为空 +AppFile.appPath.length.illegal = appPath 长度过长 +AppFile.versionNumber.null = versionNumber 不能为空 +AppFile.versionNumber.length.illegal = versionNumber 长度过长 +AppFile.versionNumber.format.illegal = versionNumber 格式不合法 +AppFile.size.null = size 不能为空 +AppFile.size.length.illegal = size 长度过长 +AppFile.md5.null = md5 不能为空 +AppFile.md5.length.illegal = md5 长度过长 +AppFile.memo.length.illegal = memo 长度过长 + +RealFirePoint.id.null = id 不能为空 +RealFirePoint.fireCode.null = fireCode 不能为空 +RealFirePoint.fireCode.length.illegal = fireCode 不合法 +RealFirePoint.countyCode.null = countyCode 不能为空 +RealFirePoint.countyCode.length.illegal = countyCode 不合法 +RealFirePoint.countyName.null = countyName 不能为空 +RealFirePoint.countyName.length.illegal = countyName 不合法 +RealFirePoint.address.null = address 不能为空 +RealFirePoint.address.length.illegal = address 不合法 +RealFirePoint.fireArea.null = fireArea 不能为空 +RealFirePoint.verifyTimeTs.null = verifyTimeTs 不能为空 +RealFirePoint.verifyType.null = verifyType 不能为空 + +InvestigationTeam.id.null = id 不能为空 +InvestigationTeam.teamName.null = teamName 不能为空 +InvestigationTeam.teamName.length.illegal = teamName 长度过长 +InvestigationTeam.memo.length.illegal = memo 长度过长 +InvestigationTeam.userName.null = userName 不能为空 +InvestigationTeam.userName.length.illegal = userName 长度过长 +InvestigationTeam.userRealName.null = userRealName 不能为空 +InvestigationTeam.userRealName.length.illegal = userRealName 长度过长 + +RelTeamInvestigator.id.null = id 不能为空 +RelTeamInvestigator.teamCode.null = teamCode 不能为空 +RelTeamInvestigator.teamCode.length.illegal = teamCode 长度过长 +RelTeamInvestigator.userName.null = userName 不能为空 +RelTeamInvestigator.userName.length.illegal = userName 长度过长 +RelTeamInvestigator.teamDeputy.null = teamDeputy 不能为空 +RelTeamInvestigator.memo.length.illegal = memo 长度过长 +RelTeamInvestigator.userRealName.null = userRealName 不能为空 +RelTeamInvestigator.userRealName.length.illegal = userRealName 长度过长 diff --git a/src/main/resources/i18n/messages_en_US.properties b/src/main/resources/i18n/messages_en_US.properties new file mode 100644 index 0000000..9b23e85 --- /dev/null +++ b/src/main/resources/i18n/messages_en_US.properties @@ -0,0 +1,162 @@ +sys.message.success = success +sys.message.null = null +sys.message.exit = data already exists +sys.message.user.not_logged_in = user not logged in +sys.message.user.login_error = user login failed +sys.message.user.account_forbidden = this account is forbidden +sys.message.user.account_not_activated = this account not activated +sys.message.user.overtime = user login timeout +sys.message.user.no_permission = user permission denied +sys.message.user.already_logged = user already logged +sys.message.param.null = parameter is null +sys.message.param.illegal = parameter is illegal +sys.message.data.none = data is none +sys.message.data.wrong = data is wrong +sys.message.process.fail = process fail +sys.message.process.overtime = process overtime +sys.message.system.inner_error = system inner error +sys.message.system.abnormal = system abnormal +sys.message.system.busy = system is busy +sys.message.system.maintain = system maintenance +sys.message.database.error = database error +sys.message.file.exists = file exists +sys.message.file.write.error = file write error +sys.message.file.read.error = file read error + +SysUser.id.blank = user id can't be blank +SysUser.userName.blank = user name can't be blank +SysUser.userName.length.illegal = user name length illegal +SysUser.userName.format.illegal = user name format illegal +SysUser.nickName.length.illegal = user nickname length illegal +SysUser.userCode.length.illegal = user code length illegal +SysUser.userCode.format.illegal = user code cantains illegal character +SysUser.password.blank = user password can't be blank +SysUser.password.length.illegal = user password length illegal +SysUser.password.format.illegal = user password format illegal +SysUser.sex.num.null = user sex num can't be blank +SysUser.sex.num.illegal = user sex num illegal +SysUser.telephone.format.illegal = user telephone format illegal +SysUser.email.length.illegal = user email length illegal +SysUser.email.format.illegal = user email format illegal +SysUser.admCode.illegal = user administrative area code illegal +SysUser.address.length.illegal = user address length illegal +SysUser.birthday.format.illegal = user birthday must be yyyy-MM-dd +SysUser.personalSignature.length.illegal = user personal signature length illegal +SysUser.portraitId.illegal = user portrait id illegal +SysUser.statusCode.null = user current status code can't be blank +SysUser.statusCode.illegal = user current status code illegal +SysUser.deleteFlag.null = user delete flag can't be null + +TrajectoryRecord.id.null = id can't be null +TrajectoryRecord.startTimeTs.null = startTimeTs can't be null + +SatelliteFirePoint.id.null = id can't be blank +SatelliteFirePoint.fireCode.null = fireCode can't be blank +SatelliteFirePoint.fireCode.length.illegal = fireCode length illegal +SatelliteFirePoint.countyCode.null = countyCode can't be blank +SatelliteFirePoint.countyCode.length.illegal = countyCode length illegal +SatelliteFirePoint.countyName.null = countyName can't be blank +SatelliteFirePoint.countyName.length.illegal = countyName length illegal +SatelliteFirePoint.satelliteType.null = satelliteType can't be blank +SatelliteFirePoint.fireStatus.null = fireStatus can't be blank +SatelliteFirePoint.verifyStatus.null = verifyStatus can't be blank +SatelliteFirePoint.satelliteTimeTs.null = satelliteTimeTs can't be blank + +PictureFirePoint.id.null = id can't be blank +PictureFirePoint.fireCode.null = fireCode can't be blank +PictureFirePoint.fireCode.length.illegal = fireCode length illegal +PictureFirePoint.pictureName.length.illegal = pictureName length illegal +PictureFirePoint.picturePath.null = picturePath can't be blank +PictureFirePoint.picturePath.length.illegal = picturePath length illegal +PictureFirePoint.memo.length.illegal = memo length illegal +PictureFirePoint.size.length.illegal = size length illegal +PictureFirePoint.md5.null = md5 can't be blank +PictureFirePoint.md5.length.illegal = md5 length illegal +PictureFirePoint.shootTimeTs.null = shootTimeTs can't be blank + +PersonInvestigator.id.null = id can't be blank +PersonInvestigator.name.null = name can't be blank +PersonInvestigator.name.length.illegal = name length illegal +PersonInvestigator.code.length.illegal = code length illegal +PersonInvestigator.telephone.null = telephone can't be blank +PersonInvestigator.telephone.format.illegal = telephone format illegal +PersonInvestigator.sex.null = sex format can't be blank +PersonInvestigator.sex.format.illegal = sex format illegal +PersonInvestigator.idCard.length.illegal = idCard length illegal +PersonInvestigator.memo.length.illegal = memo length illegal +PersonInvestigator.linkUserName.null = linkUserName can't be blank +PersonInvestigator.linkUserName.format.illegal = linkUserName format illegal +PersonInvestigator.password.null = password can't be blank +PersonInvestigator.password.format.illegal = password format +InvestigateFirePoint.verifyTimeTs.null = verifyTimeTs can't be blank + +InvestigateFirePoint.id.null = id can't be blank +InvestigateFirePoint.fireCode.null = fireCode can't be blank +InvestigateFirePoint.fireCode.length.illegal = fireCode length illegal +InvestigateFirePoint.countyCode.null = countyCode can't be blank +InvestigateFirePoint.countyCode.length.illegal = countyCode length illegal +InvestigateFirePoint.countyName.null = countyName can't be blank +InvestigateFirePoint.countyName.length.illegal = countyName length illegal +InvestigateFirePoint.address.null = address can't be blank +InvestigateFirePoint.fireArea.null = fireArea can't be blank +InvestigateFirePoint.verifyType.null = verifyType can't be blank +InvestigateFirePoint.satelliteType.null = satelliteType can't be blank +InvestigateFirePoint.satelliteType.length.illegal = satelliteType length illegal + +FileDocument.id.null = id can't be blank +FileDocument.name.null = name can't be blank +FileDocument.name.length.illegal = name length illegal +FileDocument.category.length.illegal = category length illegal +FileDocument.filePath.null = filePath can't be blank +FileDocument.filePath.length.illegal = filePath length illegal +FileDocument.size.length.illegal = size length illegal +FileDocument.md5.null = md5 can't be blank +FileDocument.md5.length.illegal = md5 length illegal +FileDocument.memo.length.illegal = memo length illegal +FileDocument.checkingToken.length.illegal = checkingToken length illegal + +AppFile.id.null = id can't be blank +AppFile.name.null = name can't be blank +AppFile.name.length.illegal = name length illegal +AppFile.appPath.null = appPath can't be blank +AppFile.appPath.length.illegal = appPath length illegal +AppFile.versionNumber.null = versionNumber can't be blank +AppFile.versionNumber.length.illegal = versionNumber length illegal +AppFile.versionNumber.format.illegal = versionNumber illegal +AppFile.size.null = size can't be blank +AppFile.size.length.illegal = size length illegal +AppFile.md5.null = md5 can't be blank +AppFile.md5.length.illegal = md5 length illegal +AppFile.memo.length.illegal = memo length illegal + +RealFirePoint.id.null = id can't be blank +RealFirePoint.fireCode.null = fireCode can't be blank +RealFirePoint.fireCode.length.illegal = fireCode illegal +RealFirePoint.countyCode.null = countyCode can't be blank +RealFirePoint.countyCode.length.illegal = countyCode +RealFirePoint.countyName.null = countyName can't be blank +RealFirePoint.countyName.length.illegal = countyName illegal +RealFirePoint.address.null = address can't be blank +RealFirePoint.address.length.illegal = address illegal +RealFirePoint.fireArea.null = fireArea can't be blank +RealFirePoint.verifyTimeTs.null = verifyTimeTs can't be blank +RealFirePoint.verifyType.null = verifyType can't be blank + +InvestigationTeam.id.null = id can't be blank +InvestigationTeam.teamName.null = teamName can't be blank +InvestigationTeam.teamName.length.illegal = teamName length illegal +InvestigationTeam.memo.length.illegal = memo length illegal +InvestigationTeam.userName.null = userName can't be blank +InvestigationTeam.userName.length.illegal = userName length illegal +InvestigationTeam.userRealName.null = userRealName can't be blank +InvestigationTeam.userRealName.length.illegal = userRealName length illegal + +RelTeamInvestigator.id.null = id can't be blank +RelTeamInvestigator.teamCode.null = teamCode can't be blank +RelTeamInvestigator.teamCode.length.illegal = teamCode length illegal +RelTeamInvestigator.userName.null = userName can't be blank +RelTeamInvestigator.userName.length.illegal = userName length illegal +RelTeamInvestigator.teamDeputy.null = teamDeputy can't be blank +RelTeamInvestigator.memo.length.illegal = memo length illegal +RelTeamInvestigator.userRealName.null = userRealName can't be blank +RelTeamInvestigator.userRealName.length.illegal = userRealName length illegal diff --git a/src/main/resources/i18n/messages_zh_CN.properties b/src/main/resources/i18n/messages_zh_CN.properties new file mode 100644 index 0000000..8cfedc5 --- /dev/null +++ b/src/main/resources/i18n/messages_zh_CN.properties @@ -0,0 +1,162 @@ +sys.message.success = 成功 +sys.message.null = 暂时还没有数据 +sys.message.exit = 已存在相关内容,请勿重复操作 +sys.message.user.not_logged_in = 用户未登录 +sys.message.user.login_error = 用户登陆失败 +sys.message.user.account_forbidden = 用户已被禁止 +sys.message.user.account_not_activated = 用户未激活 +sys.message.user.overtime = 用户登录超时 +sys.message.user.no_permission = 用户权限不足 +sys.message.user.already_logged = 用户已经登录 +sys.message.param.null = 参数为空 +sys.message.param.illegal = 参数非法 +sys.message.data.none = 数据为空 +sys.message.data.wrong = 数据错误 +sys.message.process.fail = 处理失败 +sys.message.process.overtime = 处理超时 +sys.message.system.inner_error = 系统内部错误 +sys.message.system.abnormal = 系统异常 +sys.message.system.busy = 系统正忙,请稍后 +sys.message.system.maintain = 系统维护中 +sys.message.database.error = 数据库错误 +sys.message.file.exists = 文件已存在 +sys.message.file.write.error = 文件写入失败 +sys.message.file.read.error = 文件读取失败 + +SysUser.id.blank = 用户id不能为空 +SysUser.userName.blank = 用户名不能为空 +SysUser.userName.length.illegal = 用户名长度不合法 +SysUser.userName.format.illegal = 用户名格式不合法 +SysUser.nickName.length.illegal = 用户昵称长度不合法 +SysUser.userCode.length.illegal = 用户编码长度不合法 +SysUser.userCode.format.illegal = 用户编码含有非法字符 +SysUser.password.blank = 用户密码不能为空 +SysUser.password.length.illegal = 用户密码长度不合法 +SysUser.password.format.illegal = 用户密码格式不合法 +SysUser.sex.num.null = 用户性别数字不能为空 +SysUser.sex.num.illegal = 用户性别数字不合法 +SysUser.telephone.format.illegal = 用户手机号码不合法 +SysUser.email.length.illegal = 用户邮箱长度不合法 +SysUser.email.format.illegal = 用户邮箱格式不合法 +SysUser.admCode.illegal = 用户行政区划代码不合法 +SysUser.address.length.illegal = 用户详细地址长度不合法 +SysUser.birthday.format.illegal = 用户出生日期必须是 yyyy-MM-dd +SysUser.personalSignature.length.illegal = 用户个性签名长度非法 +SysUser.portraitId.illegal = 用户头像id非法 +SysUser.statusCode.null = 用户当前状态编码为空 +SysUser.statusCode.illegal = 用户当前状态编码非法 +SysUser.deleteFlag.null = 用户删除标记不能是空 + +TrajectoryRecord.id.null = id 不能为空 +TrajectoryRecord.startTimeTs.null = startTimeTs 不能为空 + +SatelliteFirePoint.id.null = id 不能为空 +SatelliteFirePoint.fireCode.null = fireCode 不能为空 +SatelliteFirePoint.fireCode.length.illegal = fireCode 长度过长 +SatelliteFirePoint.countyCode.null = countyCode 不能为空 +SatelliteFirePoint.countyCode.length.illegal = countyCode 长度过长 +SatelliteFirePoint.countyName.null = countyName 不能为空 +SatelliteFirePoint.countyName.length.illegal = countyName 长度过长 +SatelliteFirePoint.satelliteType.null = satelliteType 不能为空 +SatelliteFirePoint.fireStatus.null = fireStatus 不能为空 +SatelliteFirePoint.verifyStatus.null = verifyStatus 不能为空 +SatelliteFirePoint.satelliteTimeTs.null = satelliteTimeTs 不能为空 + +PictureFirePoint.id.null = id 不能为空 +PictureFirePoint.fireCode.null = fireCode 不能为空 +PictureFirePoint.fireCode.length.illegal = fireCode 长度过长 +PictureFirePoint.pictureName.length.illegal = pictureName 长度过长 +PictureFirePoint.picturePath.null = picturePath 不能为空 +PictureFirePoint.picturePath.length.illegal = picturePath 长度过长 +PictureFirePoint.memo.length.illegal = memo 长度过长 +PictureFirePoint.size.length.illegal = size 长度过长 +PictureFirePoint.md5.null = md5 不能为空 +PictureFirePoint.md5.length.illegal = md5 长度过长 +PictureFirePoint.shootTimeTs.null = shootTimeTs 不能为空 + +PersonInvestigator.id.null = id 不能为空 +PersonInvestigator.name.null = name 不能为空 +PersonInvestigator.name.length.illegal = name 长度过长 +PersonInvestigator.code.length.illegal = code 长度过长 +PersonInvestigator.telephone.null = telephone 不能为空 +PersonInvestigator.telephone.format.illegal = telephone 格式非法 +PersonInvestigator.sex.null = sex 不能为空 +PersonInvestigator.sex.format.illegal = sex 格式非法 +PersonInvestigator.idCard.length.illegal = idCard 长度过长 +PersonInvestigator.memo.length.illegal = memo 长度过长 +PersonInvestigator.linkUserName.null = linkUserName 不能为空 +PersonInvestigator.linkUserName.format.illegal = linkUserName 格式非法 +PersonInvestigator.password.null = password 不能为空 +PersonInvestigator.password.format.illegal = password 格式非法 +InvestigateFirePoint.verifyTimeTs.null = verifyTimeTs 不能为空 + +InvestigateFirePoint.id.null = id 不能为空 +InvestigateFirePoint.fireCode.null = fireCode 不能为空 +InvestigateFirePoint.fireCode.length.illegal = fireCode 长度过长 +InvestigateFirePoint.countyCode.null = countyCode 不能为空 +InvestigateFirePoint.countyCode.length.illegal = countyCode 长度过长 +InvestigateFirePoint.countyName.null = countyName 不能为空 +InvestigateFirePoint.countyName.length.illegal = countyName 长度过长 +InvestigateFirePoint.address.null = address 不能为空 +InvestigateFirePoint.fireArea.null = fireArea 不能为空 +InvestigateFirePoint.verifyType.null = verifyType 不能为空 +InvestigateFirePoint.satelliteType.null = satelliteType 不能为空 +InvestigateFirePoint.satelliteType.length.illegal = satelliteType 长度过长 + +FileDocument.id.null = id 不能为空 +FileDocument.name.null = name 不能为空 +FileDocument.name.length.illegal = name 长度过长 +FileDocument.category.length.illegal = category 长度过长 +FileDocument.filePath.null = filePath 不能为空 +FileDocument.filePath.length.illegal = filePath 长度过长 +FileDocument.size.length.illegal = size 长度过长 +FileDocument.md5.null = md5 不能为空 +FileDocument.md5.length.illegal = md5 长度过长 +FileDocument.memo.length.illegal = memo 长度过长 +FileDocument.checkingToken.length.illegal = checkingToken 长度过长 + +AppFile.id.null = id 不能为空 +AppFile.name.null = name 不能为空 +AppFile.name.length.illegal = name 长度过长 +AppFile.appPath.null = appPath 不能为空 +AppFile.appPath.length.illegal = appPath 长度过长 +AppFile.versionNumber.null = versionNumber 不能为空 +AppFile.versionNumber.length.illegal = versionNumber 长度过长 +AppFile.versionNumber.format.illegal = versionNumber 格式不合法 +AppFile.size.null = size 不能为空 +AppFile.size.length.illegal = size 长度过长 +AppFile.md5.null = md5 不能为空 +AppFile.md5.length.illegal = md5 长度过长 +AppFile.memo.length.illegal = memo 长度过长 + +RealFirePoint.id.null = id 不能为空 +RealFirePoint.fireCode.null = fireCode 不能为空 +RealFirePoint.fireCode.length.illegal = fireCode 不合法 +RealFirePoint.countyCode.null = countyCode 不能为空 +RealFirePoint.countyCode.length.illegal = countyCode 不合法 +RealFirePoint.countyName.null = countyName 不能为空 +RealFirePoint.countyName.length.illegal = countyName 不合法 +RealFirePoint.address.null = address 不能为空 +RealFirePoint.address.length.illegal = address 不合法 +RealFirePoint.fireArea.null = fireArea 不能为空 +RealFirePoint.verifyTimeTs.null = verifyTimeTs 不能为空 +RealFirePoint.verifyType.null = verifyType 不能为空 + +InvestigationTeam.id.null = id 不能为空 +InvestigationTeam.teamName.null = teamName 不能为空 +InvestigationTeam.teamName.length.illegal = teamName 长度过长 +InvestigationTeam.memo.length.illegal = memo 长度过长 +InvestigationTeam.userName.null = userName 不能为空 +InvestigationTeam.userName.length.illegal = userName 长度过长 +InvestigationTeam.userRealName.null = userRealName 不能为空 +InvestigationTeam.userRealName.length.illegal = userRealName 长度过长 + +RelTeamInvestigator.id.null = id 不能为空 +RelTeamInvestigator.teamCode.null = teamCode 不能为空 +RelTeamInvestigator.teamCode.length.illegal = teamCode 长度过长 +RelTeamInvestigator.userName.null = userName 不能为空 +RelTeamInvestigator.userName.length.illegal = userName 长度过长 +RelTeamInvestigator.teamDeputy.null = teamDeputy 不能为空 +RelTeamInvestigator.memo.length.illegal = memo 长度过长 +RelTeamInvestigator.userRealName.null = userRealName 不能为空 +RelTeamInvestigator.userRealName.length.illegal = userRealName 长度过长 diff --git a/src/main/resources/templates/a.xlsx b/src/main/resources/templates/a.xlsx new file mode 100644 index 0000000..7d41989 Binary files /dev/null and b/src/main/resources/templates/a.xlsx differ diff --git a/src/main/resources/templates/test.xlsx b/src/main/resources/templates/test.xlsx new file mode 100644 index 0000000..6fa30ec Binary files /dev/null and b/src/main/resources/templates/test.xlsx differ