Commit ee15398c authored by realize1020's avatar realize1020

初始化京能服务端

parents
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="com.gx.obe.service" />
</profile>
</annotationProcessing>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="svn" />
</component>
</project>
\ No newline at end of file
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.gx.obe.service</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.springframework.ide.eclipse.boot.validation.springbootbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
#!/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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Maven2 Start Up Batch script
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ] ; then
if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
if [ -z "$JAVA_HOME" ]; then
if [ -x "/usr/libexec/java_home" ]; then
export JAVA_HOME="`/usr/libexec/java_home`"
else
export JAVA_HOME="/Library/Java/Home"
fi
fi
;;
esac
if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
JAVA_HOME=`java-config --jre-home`
fi
fi
if [ -z "$M2_HOME" ] ; then
## resolve links - $0 may be a link to maven's home
PRG="$0"
# need this for relative symlinks
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
saveddir=`pwd`
M2_HOME=`dirname "$PRG"`/..
# make it fully qualified
M2_HOME=`cd "$M2_HOME" && pwd`
cd "$saveddir"
# echo Using m2 at $M2_HOME
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --unix "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# For Migwn, 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)`"
# TODO classpath?
fi
if [ -z "$JAVA_HOME" ]; then
javaExecutable="`which javac`"
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
if $darwin ; then
javaHome="`dirname \"$javaExecutable\"`"
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
else
javaExecutable="`readlink -f \"$javaExecutable\"`"
fi
javaHome="`dirname \"$javaExecutable\"`"
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="`which java`"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi
if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
if [ -z "$1" ]
then
echo "Path not specified to find_maven_basedir"
return 1
fi
basedir="$1"
wdir="$1"
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
if [ -d "${wdir}" ]; then
wdir=`cd "$wdir/.."; pwd`
fi
# end of workaround
done
echo "${basedir}"
}
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
echo "$(tr -s '\n' ' ' < "$1")"
fi
}
BASE_DIR=`find_maven_basedir "$(pwd)"`
if [ -z "$BASE_DIR" ]; then
exit 1;
fi
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
echo $MAVEN_PROJECTBASEDIR
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
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
exec "$JAVACMD" \
$MAVEN_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
@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 http://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 Maven2 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 key stroke 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 enable echoing my setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
exit /B %ERROR_CODE%
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.gx.obe.service</groupId>
<artifactId>com.gx.obe.service</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<name>com.gx.obe.service</name>
<description>com.gx.obe.service</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<!-- lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<!-- Springboot-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions><!-- 去掉springboot默认配置 -->
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.74</version>
</dependency>
<dependency>
<groupId>com.gx.kpb</groupId>
<artifactId>Utils</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
<scope>provided</scope>
</dependency>
<!-- 阿里巴巴druid数据库连接池 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.10</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.13</version>
</dependency>
<!-- mysql驱动 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- mybatisplus-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.1.0</version>
</dependency>
<!-- 模板引擎 -->
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.7</version>
</dependency>
<!--swagger-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.1</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.1</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.21</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.5.21</version>
</dependency>
<!--log4j
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<scope>compile</scope>
</dependency>
-->
<!--spring data jpa-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<!-- 引入log4j2依赖 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
<!--spring切面aop依赖-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20180813</version>
</dependency>
<!-- optional=true, 依赖不会传递, 该项目依赖devtools; 之后依赖boot项目的项目如果想要使用devtools, 需要重新引入 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<!-- https://mvnrepository.com/artifact/com.auth0/java-jwt -->
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.10.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.jcraft/jsch -->
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.55</version>
</dependency>
<!-- 扫码解密工具包 -->
<dependency>
<groupId>com.zzapp</groupId>
<artifactId>common_secretkey</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>com.gxcx.procurementcloud_master.v2.common.common_signature.SADK</groupId>
<artifactId>timestampAPI</artifactId>
<version>4.2.1.0</version>
</dependency>
<dependency>
<groupId>com.gxcx.procurementcloud_master.v2.common.common_signature.SADK</groupId>
<artifactId>SADK</artifactId>
<version>3.6.1.0</version>
</dependency>
<dependency>
<groupId>com.gxcx.procurementcloud_master.v2.common.common_signature.SADK</groupId>
<artifactId>SealSADK7</artifactId>
<version>5.3.9.3</version>
</dependency>
<dependency>
<groupId>com.gxcx.procurementcloud_master.v2.common.common_signature.SADK</groupId>
<artifactId>cryptokit.jni</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.gxcx.procurementcloud_master.v2.common.common_signature.SADK</groupId>
<artifactId>DeviceTLS</artifactId>
<version>3.3.1.0</version>
</dependency>
<dependency>
<groupId>com.gxcx.procurementcloud_master.v2.common.common_signature.SADK</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>com.gxcx.procurementcloud_master.v2.common.common_signature.SADK</groupId>
<artifactId>icu4j</artifactId>
<version>60.2</version>
</dependency>
<dependency>
<groupId>com.gxcx.procurementcloud_master.v2.common.common_signature.SADK</groupId>
<artifactId>icu4j-charset</artifactId>
<version>60.2</version>
</dependency>
<dependency>
<groupId>com.gxcx.procurementcloud_master.v2.common.common_signature.SADK</groupId>
<artifactId>logback-cfca-jdk</artifactId>
<version>4.2.1.0</version>
</dependency>
<dependency>
<groupId>com.gxcx.procurementcloud_master.v2.common.common_signature.SADK</groupId>
<artifactId>PKCS11JNI</artifactId>
<version>3.2.0.3</version>
</dependency>
<dependency>
<groupId>com.gxcx.procurementcloud_master.v2.common.common_signature.SADK</groupId>
<artifactId>sdf.jni</artifactId>
<version>3.2.0.3</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<repositories>
<repository>
<id>nexus</id>
<name>Team Nexus Repository</name>
<url>http://oldsvn.e-bidding.org:8081/nexus/content/groups/public/</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!--如果没有该配置,devtools不会生效 -->
<fork>true</fork>
</configuration>
</plugin>
<!--
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
-->
</plugins>
</build>
</project>
Manifest-Version: 1.0
Main-Class: com.gx.obe.server.ServiceApplication
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.gx.obe.server.common.log.AutoConfiguration
\ No newline at end of file
package com.gx.obe.server;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @Title: ServiceApplication.java
* @Package com.gx.obe.server
* @Description: 服务启动
* @author: XiaoMaPro
* @date: 2019年4月22日 下午6:37:49
* @version V1.0
* @Copyright: 2018 - 2019 www.myspro.com Inc. All rights reserved.
*
*/
@SpringBootApplication
//@MapperScan("com.gx.obe.server.*.dao")
public class ServiceApplication {
public static void main(String[] args) {
SpringApplication.run(ServiceApplication.class, args);
}
// @Bean
// public ObjectMapper objectMapper() {
// return new ObjectMapper().disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
// }
}
\ No newline at end of file
package com.gx.obe.server.common.agent;
import com.gx.obe.server.common.json.JsonUtil;
import com.gx.obe.server.common.vo.ProjectTypeVo;
import com.gx.obe.server.management.dictionary.entity.ProjectTemplate;
import com.gx.obe.server.management.dictionary.service.ProjectTemplateService;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author chenxw
* @Description: 项目模板代理
*/
public class ProjectTemplateAgent {
private Stream<ProjectTemplate> projectTemplateStream;
private ProjectTemplateAgent(ProjectTemplateService PTS) {
projectTemplateStream = Optional.of(PTS).map(ProjectTemplateService::getAllList).map(List::stream).orElse(null);
}
/**
* @return
* @Description: 初始化
* @author chenxw
*/
public static ProjectTemplateAgent init(ProjectTemplateService PTS) {
return new ProjectTemplateAgent(PTS);
}
/**
* @param function
* @param predicate
* @return
* @Description: 添加过滤器
* @author chenxw
*/
public <T> ProjectTemplateAgent filterType(Function<ProjectTypeVo, T> function, Predicate<T> predicate) {
return filterType(t -> predicate.test(function.apply(t)));
}
/**
* @param predicate
* @return
* @Description: 添加过滤器
* @author chenxw
*/
public ProjectTemplateAgent filterType(Predicate<ProjectTypeVo> predicate) {
return filter(t -> predicate.test(getProjectType(t.getProjectType())));
}
/**
* @param function
* @param predicate
* @return
* @Description: 添加过滤器
* @author chenxw
*/
public <T> ProjectTemplateAgent filter(Function<ProjectTemplate, T> function, Predicate<T> predicate) {
return filter(t -> predicate.test(function.apply(t)));
}
/**
* @param predicate
* @return
* @Description: 添加过滤器
* @author chenxw
*/
public ProjectTemplateAgent filter(Predicate<ProjectTemplate> predicate) {
projectTemplateStream = Optional.ofNullable(projectTemplateStream).map(s -> s.filter(predicate)).orElse(null);
return this;
}
/**
* @return
* @Description: 获取过滤后的数据
* @author chenxw
*/
public List<ProjectTemplate> get() {
return Optional.ofNullable(projectTemplateStream).map(s -> s.collect(Collectors.toList())).orElseGet(ArrayList::new);
}
/**
* @param projectType
* @return
* @Description: json转对象
* @author chenxw
*/
public static ProjectTypeVo getProjectType(String projectType) {
return JsonUtil.strToObject(projectType, ProjectTypeVo.class);
}
}
package com.gx.obe.server.common.base;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import com.baomidou.mybatisplus.extension.service.IService;
import io.swagger.annotations.ApiOperation;
/**
* @Title: BaseController.java
* @Package com.gx.obe.server.common.base
* @Description: TODO
* @author: XiaoMaPro
* @date: 2019年5月6日
* @version V1.0
* @Copyright: 2018 - 2019 www.myspro.com Inc. All rights reserved.
*
*/
public abstract class BaseController<S extends IService<T>,T>{
@Autowired
private S baseService;
protected S getBaseService() {
return baseService;
}
@ApiOperation(value="添加", notes="")
@PostMapping("/insert")
public boolean save(@RequestBody T entity){
return baseService.save(entity);
}
@ApiOperation(value="删除", notes="")
@GetMapping("/deleteById")
public Boolean removeById(String id){
return baseService.removeById(id);
}
@ApiOperation(value="查询", notes="")
@GetMapping("/getById")
public T getById(String id) {
return baseService.getById(id);
}
}
\ No newline at end of file
package com.gx.obe.server.common.cache;
public class CacheData {
private volatile static GroupCacheFactory factory;
public static GroupCacheFactory getGroupCacheFactory() {
if (factory == null) {
synchronized (CacheData.class) {
if (factory == null) {
factory = new GroupCacheFactory();
}
}
}
return factory;
}
}
package com.gx.obe.server.common.cache;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Description: 缓存对象
* @author mazc
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class CacheEntity implements Serializable {
private static final long serialVersionUID = 2082223810638865724L;
/**
* key
*/
private String key;
/**
* 数据
*/
private Object value;
/**
* 缓存的时候存的时间戳
*/
private Long timestamp;//
/**
* 默认长期有效
*/
private int seconds = 0;
/**
* 组容器
*/
private Group group;
/**
* 获取剩余时间
*
* @return
*/
public int ttl() {
if (this.seconds == 0) {
return this.seconds;
}
return this.seconds - getTime();
}
/**
* 获取当前时间和元素的相差时间
* @return
*/
private int getTime() {
if (this.seconds == 0) {
return this.seconds;
}
Long current = System.currentTimeMillis();
Long value = current - this.timestamp;
return (int) (value / 1000) + 1;
}
/**
* 是否到期
*
* @return
*/
public boolean isExpire() {
if (this.seconds == 0) {
return true;
}
if (getTime() > this.seconds) {
// 失效了就移除
group.delete(key);
return false;
}
return true;
}
}
package com.gx.obe.server.common.cache;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ArrayBlockingQueue;
public class Group {
private ArrayBlockingQueue<CacheEntity> queue;// 缓存队列
private Integer capacity;
public Group(int capacity) {
queue = new ArrayBlockingQueue<CacheEntity>(capacity);
this.capacity = capacity;
}
/**
* 放入队列
*
* @param object
* @param second
*/
public void push(String key, Object object, int second) {
queue.offer(new CacheEntity(key, object, System.currentTimeMillis(), second, this));
}
/**
* 放入队列
*
* @param object
*/
public void push(String key, Object object) {
push(key, object, 0);
}
/**
* 返回有效的缓存实体
*
* @param key
* @return
*/
private CacheEntity find(String key) {
synchronized (queue) {
Iterator<CacheEntity> iterator = queue.iterator();
while (iterator.hasNext()) {
CacheEntity entity = iterator.next();
if (key.equals(entity.getKey())) {
return entity;
}
}
return null;
}
}
/**
* 删除
*
* @param key
*/
public void delete(String key) {
synchronized (queue) {
CacheEntity entity = find(key);
if (entity != null) {
queue.remove(entity);
}
}
}
/**
* 获取数据
*
* @param key
* @return
*/
public Object getValue(String key) {
CacheEntity entity = find(key);
if (entity != null && entity.isExpire()) {
return entity.getValue();
}
return null;
}
/**
* 获取所有有效的数据
*
* @return
*/
private List<CacheEntity> getCacheEntitys() {
List<CacheEntity> keys = new ArrayList<CacheEntity>();
Iterator<CacheEntity> iterator = queue.iterator();
while (iterator.hasNext()) {
CacheEntity cacheEntity = iterator.next();
if (cacheEntity.isExpire()) {
keys.add(cacheEntity);
}
}
return keys;
}
/**
* 查看元素存活时间,-1 失效,0 长期有效
*
* @param key
* @return
*/
public int ttl(String key) {
CacheEntity entity = find(key);
if (entity != null) {
return entity.ttl();
}
return -1;
}
/**
* 设置元素存活时间
*
* @param key
* @param second
*/
public void expire(String key, int second) {
CacheEntity entity = find(key);
if (entity != null) {
entity.setTimestamp(System.currentTimeMillis());
entity.setSeconds(second);
}
}
/**
* 查看是否存在
*
* @param key
* @return
*/
public boolean exist(String key) {
return find(key) != null;
}
/**
* 组是否为空
*
* @return
*/
public boolean isEmpty() {
return queue.isEmpty();
}
/**
* 获取有效数据数量
*
* @return
*/
public int size() {
return getCacheEntitys().size();
}
/**
* 获取容数量
*
* @return
*/
public Integer getCapacity() {
return capacity;
}
}
package com.gx.obe.server.common.cache;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* @Description: 缓存
* @author mazc
*/
public class GroupCacheFactory {
// 数据容器
private Map<String, Group> cacheMap;
public GroupCacheFactory() {
cacheMap = new LinkedHashMap<String, Group>();
}
/**
* 如过存在返回组对象,不存在就创建
*
*/
public Group group(String key, int capacity) {
//加同步,否则可能引起线程问题
synchronized (cacheMap) {
Group group = cacheMap.get(key);
if (group == null) {
group = new Group(capacity);
cacheMap.put(key, group);
}
return group;
}
}
/**
* 默认容量1000
*
* @param key
* @return
*/
public Group group(String key) {
return this.group(key, 1000);
}
}
package com.gx.obe.server.common.entity;
import java.lang.reflect.Field;
import java.util.Arrays;
/**
* @Description: 反射工具类
* @author mazc
* @param <T>
*/
public class ReflecUtils {
/**
* @Description: 利用java的泛型与反射动态更新
* @author mazc
* @param object
* @param attributes
* @param a
* @return
* @throws InstantiationException
* @throws IllegalAccessException
* @throws SecurityException
*/
public static <T> T reflexT( T object ,String [] attributes ,Class<T> a ) {
if(null == attributes) {
return object;
}
T ruleEntity = null;
try {
ruleEntity = a.newInstance();
} catch (Exception e1) {
System.out.println(e1.getMessage());
return null;
}
for(String str : attributes){
Field getField = null;
try {
getField = object.getClass().getDeclaredField(str);
getField.setAccessible(true);
Class<? extends Object> c = ruleEntity.getClass();
Field setField = c.getDeclaredField(str);
setField.setAccessible(true);
setField.set(ruleEntity, getField.get(object));
} catch (NoSuchFieldException e) {
System.out.println(e.getMessage());
continue;
} catch (IllegalArgumentException e) {
System.out.println(e.getMessage());
continue;
} catch (IllegalAccessException e) {
System.out.println(e.getMessage());
continue;
}
}
return ruleEntity;
}
public static <T> T reflex(T object, String[] attributes, Class<T> a) {
String[] strings = Arrays.copyOf(attributes, attributes.length + 1);
strings[strings.length - 1] = "id";
return reflexT(object, strings, a);
}
/**
* @Description: 忽视
* @author chenxw
* @param object
* @param attributes
*/
public static <T> void ignore(T object, String[] attributes) {
if (null == attributes) {
return;
}
for (String str : attributes) {
try {
Field getField = object.getClass().getDeclaredField(str);
getField.setAccessible(true);
getField.set(object, null);
} catch (NoSuchFieldException e) {
System.out.println(e.getMessage());
continue;
} catch (IllegalArgumentException e) {
System.out.println(e.getMessage());
continue;
} catch (IllegalAccessException e) {
System.out.println(e.getMessage());
continue;
}
}
}
}
package com.gx.obe.server.common.enumeration;
import java.io.File;
public class BidFile extends File {
/**
*
*/
private static final long serialVersionUID = 1L;
public static final String PRIVATE_BID_FILE = "private_bid_file";
public BidFile(String pathname) {
super(pathname);
}
public BidFile(File file) {
super(file.getAbsolutePath());
}
}
package com.gx.obe.server.common.enumeration;
/**
* @Description:
* @author mazc
*/
public class BidPriceEnum {
/**
* 是否报价项[01:报价项;00或其他:非报价项]
*/
public static final String IS_PRICE_ITEM = "01";
/**
* 分项报价类型
*/
public static final String JOIN_TOTAL = "01";//加入总价
public static final String NOT_JOIN_TOTAL = "00";// 不加入总价
/**
* 投标保证金
*/
public static final String ITEM_CODE_BID_DEPOSIT = "bidDeposit";// 不加入总价
public static final String CUR_CODE = "CNY";
public static final String EDIT_FLOAT = "01";
public static final String EDIT_ADD_SUB = "02";
public static final String DEVIATE_CALUSE = "DeviateCaluse";
public static String getEditTypeString(String editType) {
if (EDIT_ADD_SUB.equals(editType)) return "增减型";
if (EDIT_FLOAT.equals(editType)) return "浮动型";
return "";
}
/**
* 是否完成报价[01:完成报价 00 未完成]
*/
public static final String PRICE_STATUS_OK = "01";
public static final String PRICE_STATUS_UNDONE = "00";
}
package com.gx.obe.server.common.enumeration;
import java.io.Serializable;
import com.gx.obe.server.common.utils.StringUtils;
/**
* @Description: 公用的枚举类型
* @author guoyr
*/
public class CommonEnum implements Serializable{
/**
*/
private static final long serialVersionUID = 1L;
/**
* 是否
*/
public static final String YES = "01";
public static final String NO = "00";
/**
* 是否叶子结点 0:非叶子结点;1:叶子结点
*/
public static final String LEAF = "1";
public static final String NO_LEAF = "0";
/**
* 保存状态 未保存:00,保存:01,提交:02
*/
public static final String SAVE_TEMP = "00";
public static final String SAVE_SAVE = "01";
public static final String SAVE_SUBMIT = "02";
public static final String SAVE_OPERATOR_INPUT = "03";
/**
* 使用状态(00:临时; 01:正式;02:删除;03:停止使用;05:归档项目)
*/
public static final String TEMP_STATUS = "00";
public static final String REAL_STATUS = "01";
public static final String DELETE_STATUS = "02";
public static final String UNABLE_STATUS = "03";
public static final String ARCHIVE_STATUS = "05";
public static final String getUseStatusCN(String str) {
String useStatusCN = "临时";
if(null == str || "".equals(str) || str.equals(TEMP_STATUS)){
useStatusCN ="临时";
}else if(str.equals(REAL_STATUS)){
useStatusCN ="正式";
}else if(str.equals(DELETE_STATUS)){
useStatusCN ="已删除";
}else if(str.equals(UNABLE_STATUS)){
useStatusCN ="已停用";
}else if(str.equals(ARCHIVE_STATUS)){
useStatusCN ="已归档";
}
return useStatusCN ;
}
/**
* 默认状态(00:非默认状态;01:默认状态)
*/
public static final String IS_DEFAULT = "01";
public static final String NOT_DEFAULT = "00";
public static final String getDefaultStatusCN(String str) {
String defaultStatusCN = "非默认状态";
if(null == str || "".equals(str) || str.equals(NOT_DEFAULT)){
defaultStatusCN = "非默认状态";
}else if(str.equals(IS_DEFAULT)){
defaultStatusCN = "默认状态";
}
return defaultStatusCN ;
}
/**
* 进度状态[00:未开始;01:进行中;02:完成;03:回退;04:停止;11:专家审核;12:经理审核]
*/
public static final String NOT_START="00";
public static final String IN_PROGRESS="01";
public static final String COMPLETE="02";
public static final String RE_OPERATOR="03";
public static final String STOP="04";
public static final String IN_EXPERT_REVIEW="11";
public static final String IN_MANAGER_REVIEW="12";
public static final String FAILE="04";
public static final String START="05";
public static final String STOPPED="06";
public static final String getStatusCN(String str){
String type = "未开始";
if(StringUtils.isNotEmpty(str)){
if(str.equals(COMPLETE)){
type = "完成";
}else if(str.equals(IN_PROGRESS)){
type = "进行中";
}else if(str.equals(RE_OPERATOR)){
type = "重新操作";
}else if(str.equals(FAILE)){
type = "失败";
}
}
return type;
}
/**
* @Description: 比较两个进度
* @author guoyr
* @author guoyr
* @author guoyr
* @author guoyr
* @param sourceStatus
* @param targetStatus
* @return
*/
public static int complateStatus(String sourceStatus, String targetStatus){
if(StringUtils.isNotEmpty(sourceStatus) && StringUtils.isNotEmpty(targetStatus)){
return sourceStatus.compareTo(targetStatus);
}else if(StringUtils.isNotEmpty(sourceStatus) && StringUtils.isEmpty(targetStatus)){
return 1;
}else if(StringUtils.isEmpty(sourceStatus) && StringUtils.isNotEmpty(targetStatus)){
return -1;
} else {
return 0;
}
}
/**
* 金额单位[00:元;01:万元]
*/
public static final String YUAN="00";
public static final String WAN_YUAN="01";
public static final String PRICE_PERENT="02";
public static final String getPriceUintCN(String str){
String type = "元";
if(StringUtils.isNotEmpty(str)){
if(str.equals(WAN_YUAN)){
type = "万元";
}else if(str.equals(PRICE_PERENT)){
type = "%";
}
}
return type;
}
/**
* 直播组件类型
*/
public static final String LIVING_COM_GXCX = "00";//国信创新直播组件
public static final String LIVING_COM_FLX = "01";//飞利信直播组件
public static final String LIVING_COM_OTHER = "02";//其他直播
public static final String LIVING_COM_RTMP = "04";//百度推流RTMP推流
public static final String LIVING_COM_HTTP = "05";//百度推流HTTP推流
public static final String LIVING_COM = "06";//百度推流
}
package com.gx.obe.server.common.enumeration;
public enum CompareStatus {
/**
* 标记变更数据
*/
CHANGE,
/**
* 标记没有变更
*/
NO_CHANGE,
}
package com.gx.obe.server.common.enumeration;
/**
* @Description:
* @author guoyr
*/
public class DictEnum {
public static final String FEATURE = "FEATURE"; //"特征码检查";// "FEATURE"),
public static final String CLEAN_TENDER ="CLEAN_TENDER";// "清标项";//CLEAN_TENDER"),
public static final String BUSSINES_TENDER = "BUSSINES_TENDER";// "商务标类型";//BUSSINES_TENDER"),
public static final String EXTRA_TABLE = "OTHER_ITEM";//"其他项目";//OTHER_ITEM"),
public static final String MATERIAL_SUMMARY = "GLJ_ITEM";//"工料机汇总";//GLJ_ITEM");
/**
* 评标办法
*/
public static final String DIC_EVAL_METHOD = "EVAL_METHOD";
/**
* 项目类型
*/
public static final String TENDER_TYPE = "TENDER_TYPE";
/**
* 采购方式
*/
public static final String TENDER_METHOD = "TENDER_METHOD";
/**
* 评审方式
*/
public static final String DIC_EVAL_WAY = "EVAL_WAY";
/**
* CA类型
*/
public static final String DIC_CA_TYPE = "CA_TYPE";
/**
* 签章类型
*/
public static final String SIGNATURE_TYPE = "SIGNATURE_TYPE";
/**
* 手写签章类型
*/
public static final String HAND_SIGNATURE_TYPE = "HAND_SIGNATURE_TYPE";
/**
* PDF加载控件
*/
public static final String PDF_READER = "PDF_READER";
/**
* 手写签字控件
*/
public static final String HAND_SIGN = "HAND_SIGN";
/**
* 产品终端类型
*/
public static final String DIC_TERMINAL_TYPE = "TERMINAL_TYPE";
/**
* 用户角色类型
*/
public static final String DIC_USER_ROLE_TYPE = "USER_ROLE_TYPE";
/**
* 交易系统类型
*/
public static final String DIC_TRADING_SYSTEM_TYPE = "TRADING_SYSTEM_TYPE";
/**
* 项目类型
*/
public static final String DIC_TENDER_TYPE = "TENDER_TYPE";
/**
* 币种
*/
public static final String DIC_CURRENCY = "CURRENCY";
/**
* 奖项分项
*/
public static final String AWARD_NAME = "AWARD_NAME";
// private String name;
// private String value;
// DictEnum(String name, String value){
// this.name = name;
// this.value = value;
// }
// public String getName() {
// return name;
// }
// public String getValue() {
// return value;
// }
// public String toString() {
// return this.value;
// }
// public static void main(String[] arges){
// System.out.println(DictEnum.CLEAN_TENDER.getName() + ":"+ DictEnum.CLEAN_TENDER.getValue());
// }
}
package com.gx.obe.server.common.enumeration;
import com.gx.obe.server.common.utils.StringUtils;
/**
* @Description:
* @author guoyr
*/
public class EngineerConstants {
/**
* 工程项目类型(01:工程项目;02:单项工程;03:单位工程;04:分部分项;05:措施项目;06:其他项目)
*/
public static final String GCXM = "01";
public static final String DXGC = "02";
public static final String DWGC = "03";
public static final String FBFX = "04";
public static final String CSXM = "05";
public static final String QTXM = "06";
public static final String CSXM_DJ = "00";
public static final String CSXM_ZJ = "01";
/**
* 工程项目专业(01:建筑;02:装饰;03:安装;04:市政;05:园林)
*/
public static final String SPECIALTY_BUILD = "01";
public static final String SPECIALTY_DECORATE = "02";
public static final String SPECIALTY_INSTALL = "03";
public static final String SPECIALTY_MUNICIPAL = "04";
public static final String SPECIALTY_GARDEN = "05";
/**
* 分部分项枚举(01:分部;02:清单;03:定额;04:费用)
*/
public static final String FBGC = "01";
/**
* 分部分项枚举(01:措施;02:清单;03:定额;04:费用)
*/
public static final String CSGC = "01";
// public static final String DJCS = "05";
// public static final String ZJCS = "06";
public static final String QD = "02";
public static final String DE = "03";
public static final String FY = "04";
/**
* 暂估价(01:材料暂估价;02:专业工程暂估价;03:工程设备暂估单价)
*/
public static final String ZGJ_ROOT = "00";
public static final String ZGJ_CL = "01";
public static final String ZGJ_ZYGC = "02";
public static final String ZGDJ_GCSB = "03";
/**
* 计日工(01:人工费;02:材料费;03:机械费)
*/
public static final String JRG_ROOT = "00";
public static final String JRG_RGFY = "01";
public static final String JRG_CLFY = "02";
public static final String JRG_JXFY = "03";
public static String getDayWorksCn(String str){
String jrgCN = "";
if(StringUtils.isEmpty(str) || StringUtils.equals(JRG_ROOT, str)){
jrgCN = "";
}else if(StringUtils.equals(JRG_RGFY, str)){
jrgCN = "人工";
}else if(StringUtils.equals(JRG_CLFY, str)){
jrgCN = "材料";
}else if(StringUtils.equals(JRG_JXFY, str)){
jrgCN = "机械";
}
return jrgCN;
}
/**
* 总承包服务费(01:发包人分包专业工程;02:发包人供应材料)
*/
public static final String FBR_ROOT = "00";
public static final String FBR_FBZYGC = "01";
public static final String FBR_GYCL = "02";
/**
* 规费税金(01:规费;02:税金)
*/
public static final String GFXM = "01";
public static final String SJXM = "02";
/**
* 工料机汇总(00:其他;01:人工;02:材料;03:机械;04:主材;05:设备)
*/
public static final String RCJHZ_QT = "00";
public static final String RCJHZ_RG = "01";
public static final String RCJHZ_CL = "02";
public static final String RCJHZ_JX = "03";
public static final String RCJHZ_ZC = "04";
public static final String RCJHZ_SB = "05";
/**
* 00:规费;01安全文明施工费
*/
public static final String RATE_GF = "00";
public static final String RATE_AQWMSGF = "01";
}
package com.gx.obe.server.common.enumeration;
import com.gx.obe.server.common.utils.StringUtils;
public class EvaluationFactorEnum {
/**
* 指标评审类型 [00:符合性评审 01:打分评审 02:价格 03:清单]
*/
public static final String AUDIT_COMPLIANCE = "00";
public static final String AUDIT_SCORE = "01";
public static final String AUDIT_PRICE = "02";
public static final String AUDIT_BILL = "03";
public static final String AUDIT_CREDIT = "04";
/**
* 评标类型[00:默认为商务技术;01:商务标;02:技术标;03:经济标;04:综合信用]
*/
public static final String EVAL_BID_DETAIL = "00";
public static final String EVAL_BID_BUS = "01";
public static final String EVAL_BID_TEC = "02";
public static final String EVAL_BID_PRICE = "03";
public static final String EVAL_BID_CREDIT = "04";
public static String getEvalBidTypeCN(String evalBidType) {
if (null == evalBidType || evalBidType.length() == 0) {
return "";
}
if (evalBidType.equals(EVAL_BID_BUS)) {
return "商务";
}
if (evalBidType.equals(EVAL_BID_TEC)) {
return "技术";
}
if (evalBidType.equals(EVAL_BID_PRICE)) {
return "经济";
}
if (evalBidType.equals(EVAL_BID_CREDIT)) {
return "综合信用";
}
if (evalBidType.equals(EVAL_BID_DETAIL)) {
return "";
}
return "";
}
/**
* @Description: 获得评标分组
* @author guoyr
* @param evalBid
* @param index
* @return
*/
public static final String[] getEvalGroup(String evalGroup){
if(null != evalGroup && evalGroup.length() > 0){
String[] evalGroupArray = evalGroup.toString().split("_");
if(evalGroupArray.length == 2){
return getEvalGroup(evalGroupArray[0], Integer.parseInt(evalGroupArray[1]));
}
}
return new String[]{null, ""};
}
/**
* @Description: 获得评标分组
* @author wangxiang
* @param evalGroup
* @return
*/
public static final String getEvalGroupName(String evalGroup){
if(null != evalGroup && evalGroup.length() > 0){
String[] evalGroupArray = evalGroup.toString().split("_");
if(evalGroupArray.length == 2){
if(null != evalGroupArray[0] && evalGroupArray[0].equals(EvaluationFactorEnum.EVAL_BID_BUS)){
return "B"+Integer.parseInt(evalGroupArray[1]);
}else if(null != evalGroupArray[0] && evalGroupArray[0].equals(EvaluationFactorEnum.EVAL_BID_TEC)){
return "T"+Integer.parseInt(evalGroupArray[1]);
}
}
}
return "G";
}
/**
* @Description: 获得评标分组
* @author guoyr
* @param evalBid
* @param index
* @return
*/
public static final String[] getEvalGroup(String evalBid, int index){
if(null != evalBid && evalBid.equals(EvaluationFactorEnum.EVAL_BID_BUS)){
return new String[]{EvaluationFactorEnum.EVAL_BID_BUS+"_" + index, "商务" + index + "单元"};
}else if(null != evalBid && evalBid.equals(EvaluationFactorEnum.EVAL_BID_TEC)){
return new String[]{EvaluationFactorEnum.EVAL_BID_TEC+"_" + index, "技术" + index + "单元"};
}else {
return new String[]{EvaluationFactorEnum.EVAL_BID_DETAIL+"_" + index, "评审" + index + "单元"};
}
}
/**
* 指标类型[00:默认指标;01:基础指标;02:浮动指标;10:工程量清单指标:11:清价总价;12:分部分项;13:措施项]
*/
public static final String FACTOR_DEFAULT = "00";
public static final String FACTOR_BASE = "01";
public static final String FACTOR_FLOAT = "02";
public static final String FACTOR_BILL = "10";
public static final String FACTOR_TOTAL_PRICE = "11";
public static final String FACTOR_ITEMIZE = "12";
public static final String FACTOR_MEASURE = "13";
public static final String TYPE_PRICE_CHECK = "21";
public static final String TYPE_TOTAL_PRICE = "22";
public static final String TYPE_ITEMIZE_PRICE = "23";
public static final String TYPE_ITEMIZE_PROJECT = "24";
public static final String TYPE_MEASURE = "25";
public static final String TYPE_OTHER = "26";
public static final String TYPE_MATERIAL_PRICE = "27";
public static final String BZ_TYPE_TOTAL_PRICE = "31";
public static final String BZ_TYPE_MAIN_PROJECT = "32";
/**
* 检查类型[00:不是客观项;01:客观项检查;02:预警检查]
*/
public static final String OBJECTIVE_NO = "00";
public static final String OBJECTIVE_YES = "01";
public static final String OBJECTIVE_WARING = "02";
/**
* 打分方式[01:主观直接打分;02:客观范围打分;03:通过性评审;04:智能评审]
*/
public static final String SCORE_TYPE_DIRECT = "01";
public static final String SCORE_TYPE_OBJECTIVE = "02";
public static final String SCORE_TYPE_PASS = "03";
public static final String SCORE_TYPE_AI = "04";
public static final String SCORE_TYPE_PASS_PARENT = "-1";
public static final String getScoreTypeCN(String str) {
String scoreTypeCN = "";
if (StringUtils.isEmpty(str) || str.equals(SCORE_TYPE_DIRECT)) {
scoreTypeCN = "主观直接打分";
} else if (str.equals(SCORE_TYPE_OBJECTIVE)) {
scoreTypeCN = "客观范围打分";
} else if (str.equals(SCORE_TYPE_PASS)) {
scoreTypeCN = "通过性评审";
}
return scoreTypeCN;
}
/**
* 条款类型[01:星号条款;02:偏离性条款]
*/
public static final String CLAUSE_TYPE_STAR = "01";
public static final String CLAUSE_TYPE_DEVIATE = "02";
/**
* 符合性评审状态[01:符合;02:不符合]
*/
public static final String CONFORM = "01";
public static final String UNCONFORM = "02";
}
package com.gx.obe.server.common.enumeration;
import com.gx.obe.server.common.utils.StringUtils;
public class ExpertEnum {
/**
* 用于价格评审或推荐操作
*/
public static final String COMMON_EXPERT = "COMMON_EXPERT";
/**
* 评标专家类型[0:成员;1:组长;02:备选专家]
*/
public static final String LEADER_NO = "0";
public static final String LEADER_YES = "1";
public static final String MONITOR = "00";
public static final String WORKER = "01";
public static final String getIsLeaderCN(String str) {
String expertTypeCN = "专家";
if (StringUtils.isNotEmpty(str)) {
if (str.equals(LEADER_YES)) {
expertTypeCN = "组长";
}
}
return expertTypeCN;
}
/**
* 评标专家类型[01:专家;02:招标代表;11:商务组长:12技术组长]
*/
public static final String EXPERT = "01";
public static final String BIDDING = "02";
public static final String EXPERT_BUS_LEADER = "11";
public static final String EXPERT_TEC_LEADER = "12";
public static final String getExpertTypeCN(String expertType, String isLeader) {
String expertTypeCN = "专家";
if (EXPERT_BUS_LEADER.equals(expertType)) {
expertTypeCN = "商务组长";
}else if (EXPERT_TEC_LEADER.equals(expertType)) {
expertTypeCN = "技术组长";
} else if (BIDDING.equals(expertType)) {
expertTypeCN = "招标代表";
} else {
if(ExpertEnum.LEADER_YES.equals(isLeader)){
expertTypeCN = "组长";
}else {
expertTypeCN = "专家";
}
}
return expertTypeCN;
}
/**
* 专家评审类型[1:商务专家;2:技术专家;3:经济专家]
*
*/
public static final int EXPERT_BUS = 1 << 1;
public static final int EXPERT_TEC = 1 << 2;
public static final int EXPERT_PRICE = 1 << 3;
public static final String getEvalBidTypeCN(int evalBidType) {
StringBuffer evaluationTypeCN = new StringBuffer();
if ((evalBidType & EXPERT_BUS) != 0) {
evaluationTypeCN.append("商务");
}
if ((evalBidType & EXPERT_TEC) != 0) {
if (evaluationTypeCN.length() != 0) {
evaluationTypeCN.append(",");
}
evaluationTypeCN.append("技术");
}
if ((evalBidType & EXPERT_PRICE) != 0) {
if (evaluationTypeCN.length() != 0) {
evaluationTypeCN.append(",");
}
evaluationTypeCN.append("经济");
}
return evaluationTypeCN.toString();
}
public static final String SIGN = "01";
public static final String AVOID = "02";
public static final String ALL = "03";
public static final String getSignTypeCN(String str) {
String expertTypeCN = "未签到";
if (StringUtils.isNotEmpty(str)) {
if (str.equals(SIGN)) {
expertTypeCN = "已签到";
} else if (str.equals(AVOID)) {
expertTypeCN = "已回避";
}
}
return expertTypeCN;
}
/**
* 签署类型(01:已签署;02:未签署)
*/
public static final String PROMISE_YES = "01";
public static final String PROMISE_NO = "02";
}
package com.gx.obe.server.common.enumeration;
import com.gx.obe.server.common.utils.StringUtils;
public class SupplierEnum {
/**
* 开标状态01:开标成功,02:开标失败 ;01 :开标成功后重新报价
*/
public static final String OPENBID_SUCCESS = "01";
public static final String OPENBID_FIALE = "02";
/**
* 废标状态00:未废标,01:已废标
*/
public static final String REVOKE_NO = "00";
public static final String REVOKE_YES = "01";
/**
* 签到类型【00:本地签到;01:远程签到】
*/
public static final String SIGN_LOCAL = "00";
public static final String SIGN_REMOTE = "01";
public static final String SIGN_BY_MANAGER = "02";
public static final String getSignTypeCN(String str){
String signTypeStr = "未签到";
if(StringUtils.isNotEmpty(str)){
if(str.equals(SIGN_REMOTE)){
signTypeStr = "远程签到";
}else if(str.equals(SIGN_LOCAL)){
signTypeStr = "现场签到";
}else if(str.equals(SIGN_REMOTE)){
signTypeStr = "项目经理辅助签到";
}
}
return signTypeStr;
}
}
package com.gx.obe.server.common.enumeration;
public class UserEnum {
/**
* 角色[00:临时;01:项目经理:02:专评;03:监督人;04:工作人员]
*/
public static final String ROLE_TYPE_EVALUATION_MANAGER = "EVALUATION_MANAGER";
public static final String ROLE_TYPE_OPENING_MANAGER = "OPENING_MANAGER";
public static final String ROLE_TYPE_EXPERT = "EXPERT";
public static final String ROLE_TYPE_EVALUATION_MONITOR = "EVALUATION_MONITOR";
public static final String ROLE_TYPE_EVALUATOIN_WORKER = "EVALUATOIN_WORKER";
public static final String ROLE_TYPE_SYSTEM_MANAGER = "SYSTEM_MANAGER";
public static final String ROLE_SUPER_MANAGER = "SUPER_MANAGER";
/**
* 用户来源[00:本地 01:远程]
*/
public static final String USER_SOURCE_LOCAL = "00";
public static final String USER_SOURCE_REMOTE = "01";
}
package com.gx.obe.server.common.json;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.apache.commons.beanutils.ConvertUtils;
public class ConvertUtil {
public static<T> T getValue(String value,String fieldName,Class<T> clazz){
if (value == null) { // 如果获取参数值为null,则返回null
return null;
} else if (!value.equals("")) { // 如果获取参数值不为"",则通过convertGt方法进行类型转换后返回结果
return convertGt(value, clazz);
} else if (clazz.getName().equals(String.class.getName())) { // 如果获取参数值为""
return convertGt(value, clazz);
} else {// 如果获取参数值为"",并且clazz不是是String类型,则返回null
return null;
}
}
/**
* @param <T>
* @param value
* @param clazz
* @return
*/
@SuppressWarnings("unchecked")
public static <T> T convertGt(String value, Class<T> clazz) {
if (value == null) { // 如果值为null,则返回null
return null;
// 如果value值为"",而且要转为的类型不是string类型,那么就统一返回null,也就是空字符串不能转成任何其他类型的实体,只能返回null
} else if (value.equals("")
&& !clazz.getName().equals(String.class.getName())) {
return null;
} else if (Date.class.getName().equalsIgnoreCase(clazz.getName())) { // 增加对从String类型到Date
return (T) convertSTD(value);
}
return (T) ConvertUtils.convert(value, clazz);
}
//日期类型的转换
private static SimpleDateFormat simpleDateFormate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public static Date convertSTD(String date){
try {
return simpleDateFormate.parse(date);
} catch (ParseException e) {
try {
Date datetemp = new Date(Long.valueOf(date));
return simpleDateFormate.parse(simpleDateFormate.format(datetemp));
} catch (ParseException e1) {
e1.printStackTrace();
}
}
return null;
}
public static String convertDTS(Date date){
return simpleDateFormate.format(date);
}
}
package com.gx.obe.server.common.json;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @Description: 实体工具类
* @author mazc
*/
public class EntityUtill {
/**
* @Description: map 转对象
* @author mazc
* @param <T>
* @param param
* @param clazz
* @return
*/
@SuppressWarnings("unchecked")
public static <T> T toBean(Map<String,Object> param , Class<?> clazz){
Object value = null;
@SuppressWarnings("rawtypes")
Class[] paramTypes = new Class[1];
Object obj = null;
try {
//创建实例
obj = clazz.newInstance();
Field[] f = clazz.getDeclaredFields();
List<Field[]> flist = new ArrayList<Field[]>();
flist.add(f);
Class<?> superClazz = clazz.getSuperclass();
while(superClazz != null){
f = superClazz.getFields();
flist.add(f);
superClazz = superClazz.getSuperclass();
}
for (Field[] fields : flist) {
for (Field field : fields) {
String fieldName = field.getName();
value = param.get(fieldName);
if(value != null){
paramTypes[0] = field.getType();
Method method = null;
//调用相应对象的set方法
StringBuffer methodName = new StringBuffer("set");
methodName.append(fieldName.substring(0, 1).toUpperCase());
methodName.append(fieldName.substring(1, fieldName.length()));
method = clazz.getMethod(methodName.toString(), paramTypes);
method.invoke(obj, ConvertUtil.getValue(value.toString(), fieldName, paramTypes[0]));
}
}
}
} catch (InstantiationException e) {
System.out.println(e.getMessage());
System.out.println("实例化 JavaBean 失败");
} catch (IllegalAccessException e) {
System.out.println(e.getMessage());
System.out.println("分析类属性失败");
} catch (SecurityException e) {
System.out.println(e.getMessage());
} catch (NoSuchMethodException e) {
System.out.println(e.getMessage());
} catch (IllegalArgumentException e) {
System.out.println(e.getMessage());
System.out.println("映射错误");
} catch (InvocationTargetException e) {
System.out.println(e.getMessage());
}
return (T)obj;
}
}
package com.gx.obe.server.common.json;
import java.text.SimpleDateFormat;
import java.util.Date;
import net.sf.json.JsonConfig;
import net.sf.json.processors.JsonValueProcessor;
public class JsonDateValueProcessor implements JsonValueProcessor{
private String datePattern = "yyyy-MM-dd HH:mm:ss";//默认样式,可以在构造方法中修改
public JsonDateValueProcessor() {
super();
}
public JsonDateValueProcessor(String datePattern) {
super();
this.datePattern = datePattern;
}
public Object processArrayValue(Object value, JsonConfig jsonConfig) {
try {
if(value instanceof Date){
SimpleDateFormat sdf = new SimpleDateFormat(datePattern);
Date date = (Date)value;
return sdf.format(date);
}
return value == null ? null : value.toString();
} catch (Exception e) {
return null;
}
}
public Object processObjectValue(String key, Object value, JsonConfig jsonConfig) {
return processArrayValue(value, jsonConfig);
}
public String getDatePattern() {
return datePattern;
}
public void setDatePattern(String datePattern) {
this.datePattern = datePattern;
}
}
package com.gx.obe.server.common.json;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import net.sf.ezmorph.object.DateMorpher;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import net.sf.json.JsonConfig;
import net.sf.json.util.JSONUtils;
import net.sf.json.util.PropertyFilter;
public class JsonUtil {
/**
* @Title: strToObject
* @Description: String 转换成 对象
* @param: @param <T>
* @param: @param str
* @param: @param clazz
* @param: @return
* @return: T
* @throws
*/
public static<T> T strToObject(String str,Class<T> clazz){
if(str == null || str.isEmpty()) {
return null;
}
JsonConfig jsonConfig = new JsonConfig();
jsonConfig.setJsonPropertyFilter(new PropertyFilter() {
@Override
public boolean apply(Object source, String key, Object value) {
return false; // 返回false表示该属性会转化,true表示不转化
}
});
JSONUtils.getMorpherRegistry().registerMorpher(new DateMorpher(new String[] { "yyyy-MM-dd HH:mm:ss","yyyy-MM-dd" }));
JSONObject jsonObject = JSONObject.fromObject(str,jsonConfig);
return (T) JSONObject.toBean(jsonObject, clazz);
}
/**
* @Title: objectToStr
* @Description: 将对象转换成字符串
* @param: @param <T>
* @param: @param t
* @param: @return
* @return: String
* @throws
*/
public static<T> String objectToStr(T t){
JsonConfig jsonConfig = new JsonConfig();
jsonConfig.registerJsonValueProcessor(Date.class, new JsonDateValueProcessor());
jsonConfig.setJsonPropertyFilter(new PropertyFilter() {
@Override
public boolean apply(Object source, String key, Object value) {
return false; // 返回false表示该属性会转化,true表示不转化
}
});
JSONObject jsonObject = JSONObject.fromObject(t,jsonConfig);
return jsonObject.toString();
}
/**
* @Title: strToList
* @Description: String转换List对象集合
* @param: @param <T>
* @param: @param str
* @param: @param clazz
* @param: @return
* @return: List<T>
* @throws
*/
@SuppressWarnings({ "unchecked" })
public static <T> List<T> strToList(String str, Class<T> clazz) {
if(str == null || str.isEmpty()) {
return new ArrayList<>();
}
JSONUtils.getMorpherRegistry().registerMorpher(new DateMorpher(new String[] { "yyyy-MM-dd HH:mm:ss","yyyy-MM-dd" }));
JSONArray json = JSONArray.fromObject(str);
JSONObject object = null;
T t = null;
List<T> list = new ArrayList<>();
for (int i = 0; i < json.size(); i++) {
object = JSONObject.fromObject(json.get(i));
t = (T) JSONObject.toBean(object, clazz);
list.add(t);
}
return list;
}
/**
* @Title: strToObject
* @Description: 为json的返回值中的对象转换
* @param: @param <T>
* @param: @param result
* @param: @param clazz
* @param: @param classMap
* @param: @return
* @return: T
* @throws
*/
@SuppressWarnings("unchecked")
public static<T> T strToObject(String result,Class<T> clazz,Map<String, Class<?>> classMap){
JSONUtils.getMorpherRegistry().registerMorpher(new DateMorpher(new String[] { "yyyy-MM-dd HH:mm:ss","yyyy-MM-dd"}));
JSONObject jsonObj = JSONObject.fromObject(result);
return (T) JSONObject.toBean(jsonObj,clazz, classMap);
}
@SuppressWarnings("unchecked")
public static <T> List<T> StrToCollection(String result,Class<T> clazz){
JSONUtils.getMorpherRegistry().registerMorpher(new DateMorpher(new String[] { "yyyy-MM-dd HH:mm:ss","yyyy-MM-dd" }));
JSONArray jsonArray = JSONArray.fromObject(result);
return (List<T>)JSONArray.toCollection(jsonArray,clazz);
}
@SuppressWarnings("unchecked")
public static Map<String,String> strToMap(String result){
JSONObject jasonObject = JSONObject.fromObject(result);
return (Map<String, String>)jasonObject;
}
public static String obejctListToStr(List<?> list) {
JSONArray listArray = JSONArray.fromObject(list);
return listArray.toString();
}
public static String obejctListToStr(String obj1 ,String obj2) {
JSONObject jsonObj1 = JSONObject.fromObject(obj1);
JSONObject jsonObj2 = JSONObject.fromObject(obj2);
JSONObject jsonThree = new JSONObject();
jsonThree.putAll(jsonObj1);
jsonThree.putAll(jsonObj2);
return jsonThree.toString();
}
}
\ No newline at end of file
package com.gx.obe.server.common.json;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonNode;
import java.io.IOException;
/**
* @Title: StringDeserializer.java
* @Package com.gx.obe.server
* @Description: String 自定义序列化对象
* @author: XiaoMaPro
* @date: 2019年5月9日
* @version V1.0
* @Copyright: 2018 - 2019 www.myspro.com Inc. All rights reserved.
*
*/
public class StringDeserializer extends JsonDeserializer<String> {
@Override
public String deserialize(JsonParser jsonParser, DeserializationContext context) throws IOException, JsonProcessingException {
JsonNode node = jsonParser.readValueAsTree();
if (node.asText().isEmpty()) {
return null;
}
return node.asText();
}
}
\ No newline at end of file
package com.gx.obe.server.common.log;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import com.gx.obe.server.management.log.service.SysLogService;
import lombok.AllArgsConstructor;
/**
* @Description: 自动配置的加载
* @author mazc
*/
@EnableAsync
@Configuration
@AllArgsConstructor
@ConditionalOnWebApplication
public class AutoConfiguration {
private final SysLogService remoteLogService;
@Bean
public LogListener logListener() {
return new LogListener(remoteLogService);
}
@Bean
public LogAspect logAspect(ApplicationEventPublisher publisher) {
return new LogAspect(publisher);
}
}
package com.gx.obe.server.common.log;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.context.ApplicationEventPublisher;
import com.gx.obe.server.common.json.JsonUtil;
import com.gx.obe.server.common.utils.StringUtils;
import com.gx.obe.server.management.evaluation.service.impl.BidPriceResultServiceImpl;
import com.gx.obe.server.management.log.entity.SysLog;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
@Aspect
@AllArgsConstructor
public class LogAspect {
// private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(LogAspect.class);
private final ApplicationEventPublisher publisher;
@SneakyThrows
@Around("@annotation(sysLogAnnotation)")
public Object around(ProceedingJoinPoint point,SysLogAnnotation sysLogAnnotation) {
// String strClassName = point.getTarget().getClass().getName();
// String strMethodName = point.getSignature().getName();
// LOG.debug("[类名]:{},[方法]:{}", strClassName, strMethodName);
SysLog logVo = LogUtils.getSysLog();
logVo.setLevel(sysLogAnnotation.level());
logVo.setTitle(sysLogAnnotation.detail());
Long startTime = System.currentTimeMillis();
Object obj = null;
try {
obj = point.proceed();
} catch (Exception e) {
logVo.setException(e.toString());
}
logVo.setReturnValue(StringUtils.toString(obj));
Long endTime = System.currentTimeMillis();
logVo.setTime(endTime - startTime);
publisher.publishEvent(new LogEvent(logVo));
return obj;
}
}
package com.gx.obe.server.common.log;
import com.gx.obe.server.management.log.entity.SysLog;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class LogEvent {
private final SysLog sysLog;
}
package com.gx.obe.server.common.log;
import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order;
import org.springframework.scheduling.annotation.Async;
import com.gx.obe.server.management.log.entity.SysLog;
import com.gx.obe.server.management.log.service.SysLogService;
import lombok.AllArgsConstructor;
@AllArgsConstructor
public class LogListener {
private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(LogListener.class);
private final SysLogService remoteLogService;
@Async
@Order
@EventListener(LogEvent.class)
public void saveSysLog(LogEvent event) {
SysLog sysLog = event.getSysLog();
try {
remoteLogService.saveLog(sysLog);
} catch (Exception e) {
LOG.error(sysLog.toString());
}
}
@Async
@Order
@EventListener(SysLog.class)
public void saveSysLog(SysLog sysLog) {
try {
remoteLogService.saveLog(sysLog);
} catch (Exception e) {
LOG.error(sysLog.toString());
}
}
}
package com.gx.obe.server.common.log;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Map;
import java.util.Objects;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import com.gx.obe.server.common.utils.HttpHelper;
import com.gx.obe.server.common.utils.IpUtil;
import com.gx.obe.server.common.utils.NowTimeUtils;
import com.gx.obe.server.common.utils.StringUtils;
import com.gx.obe.server.common.utils.URLUtil;
import com.gx.obe.server.management.log.entity.SysLog;
import lombok.experimental.UtilityClass;
import net.sf.json.JSONObject;
@UtilityClass
public class LogUtils {
public SysLog getSysLog() {
HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
SysLog sysLog = new SysLog();
String username = (String) request.getHeader("createUser");
if(StringUtils.isEmpty(username)) {
username = (String) request.getHeader("userName");
}
sysLog.setCreateUser(username);
sysLog.setCreateTime(NowTimeUtils.getNowDate());
sysLog.setRemoteAddr(IpUtil.getIpAddr(request));
sysLog.setRequestUri(URLUtil.getPath(request.getRequestURI()));
sysLog.setMethod(request.getMethod());
Map<String, String[]> map = request.getParameterMap();
if(null != map && map.size() > 0) {
JSONObject jsonObject = JSONObject.fromObject(map);
sysLog.setParams(jsonObject.toString());
}else {
String wholeStr = "";
try {
wholeStr = HttpHelper.getBodyString(request);
} catch (IOException e) {
e.printStackTrace();
}
sysLog.setParams(wholeStr);
}
return sysLog;
}
}
package com.gx.obe.server.common.log;
/**
* @Description: 操作类型
* @author mazc
*/
public enum OperationType {
/**
* 操作类型
*/
UNKNOWN("unknown"),
DELETE("delete"),
SELECT("select"),
UPDATE("update"),
INSERT("insert");
private String value;
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
OperationType(String s) {
this.value = s;
}
}
\ No newline at end of file
package com.gx.obe.server.common.log;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface SysLogAnnotation {
/**
* 描述
*
* @return {String}
*/
String detail();
/**
* 日志等级:自己定
*/
int level() default 0;
/**
* 操作类型:select,insert,update,delete
*/
OperationType operationType() default OperationType.UNKNOWN;
}
package com.gx.obe.server.common.redis;
public interface RedisConstants {
/**
* 中数智慧企业信息 Key
*/
String REDIS_BIDATA_ENTINFO = "redis_bidata_entinfo_";
/**
* 多节点关联
*/
String REDIS_BIDATA_MUTI_NODES = "redis_bidata_muti_nodes_";
/**
* 多节点订单状态
*/
String REDIS_BIDATA_MUTI_NODES_ORDER_STATUS = "redis_bidata_muti_nodes_order_status_";
/**
* 多节点订单内容
*/
String REDIS_BIDATA_MUTI_NODES_ORDER_FILE_CONTENT = "redis_bidata_muti_nodes_order_file_content";
}
package com.gx.obe.server.common.sftp;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.concurrent.TimeUnit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import com.jcraft.jsch.ChannelSftp;
import com.jcraft.jsch.SftpException;
@Component
public class SFTPClientUtils {
private static Logger LOGGER = LoggerFactory.getLogger(SFTPClientUtils.class);
/**
* 下载文件。
*
* @param directory 下载目录
* @param downloadFile 下载的文件
* @param saveFileFolder 存在本地的路径
*/
public synchronized static boolean download(String downloadFile, String saveFileFolder) {
Path target = Paths.get(saveFileFolder);
if (Files.notExists(target)) {
try {
Files.createDirectories(target.getParent());
} catch (IOException e) {
return false;
}
}
boolean result = false;
Integer i = 0;
String directory = SftpConfiguration.ROOT;
while (!result) {
ChannelSftp sftp = SFTPConnectionFactory.getInstance().makeConnection();
if (!StringUtils.isEmpty(directory)) {
try {
sftp.cd(directory);
} catch (SftpException e) {
LOGGER.error("sftp文件下载,目录不存在,错误信息" + e.getMessage());
}
}
File file = new File(saveFileFolder + "\\" + downloadFile);
FileOutputStream fileOutputStream = null;
try {
fileOutputStream = new FileOutputStream(file);
} catch (FileNotFoundException e1) {
LOGGER.error("sftp文件下载失败,本地目录不存在" + e1.getMessage());
}
try {
sftp.get(downloadFile, fileOutputStream);
if (i > 0) {
LOGGER.info("sftp文件重试下载成功,sftp地址:" + directory + ",本地文件地址:" + saveFileFolder);
} else {
LOGGER.info("sftp文件下载成功,sftp地址:" + directory + ",本地文件地址:" + saveFileFolder);
}
result = true;
} catch (SftpException e1) {
i++;
LOGGER.error("sftp文件下载失败,重试中。。。第" + i + "次,错误信息" + e1.getMessage());
if (i > 3) {
LOGGER.error("ftp文件下载失败,超过重试次数结束重试,错误信息" + e1.getMessage());
return result;
}
try {
TimeUnit.MILLISECONDS.sleep(15000);
} catch (Exception e2) {
e2.printStackTrace();
}
} finally {
try {
if (fileOutputStream != null) {
fileOutputStream.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
return result;
}
/**
* 删除文件
*
* @param directory 要删除文件所在目录
* @param deleteFile 要删除的文件
*/
public synchronized static boolean delete(String directory, String deleteFile) {
boolean result = false;
ChannelSftp sftp = SFTPConnectionFactory.getInstance().makeConnection();
try {
sftp.cd(directory);
sftp.rm(deleteFile);
} catch (SftpException e) {
e.printStackTrace();
}
result = true;
return result;
}
}
package com.gx.obe.server.common.sftp;
import java.util.Properties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import com.jcraft.jsch.Channel;
import com.jcraft.jsch.ChannelSftp;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.Session;
@Component
public class SFTPConnectionFactory {
private static Logger LOGGER = LoggerFactory.getLogger(SFTPConnectionFactory.class);
private static final SFTPConnectionFactory factory = new SFTPConnectionFactory();
private ChannelSftp client;
private Session session;
private SFTPConnectionFactory() {
}
public static SFTPConnectionFactory getInstance() {
return factory;
}
synchronized public ChannelSftp makeConnection() {
if (client == null || session == null || !client.isConnected() || !session.isConnected()) {
try {
JSch jsch = new JSch();
session = jsch.getSession(SftpConfiguration.USERNAME, SftpConfiguration.HOST, SftpConfiguration.PORT);
if (SftpConfiguration.PASSWORD != null) {
session.setPassword(SftpConfiguration.PASSWORD);
}
Properties config = new Properties();
config.put("StrictHostKeyChecking",SftpConfiguration.SESSIONSTRICTHOSTKEYCHECKING);
session.setConfig(config);
session.connect();
Channel channel = session.openChannel(SftpConfiguration.PROTOCOL);
channel.connect();
client = (ChannelSftp) channel;
LOGGER.info("sftp服务器连接成功");
} catch (JSchException e) {
LOGGER.error("sftp登录失败,检测登录ip,端口号,用户名密码是否正确,错误信息为" + e.getMessage());
}
}
return client;
}
/**
*     * 关闭连接 server     
*/
public void logout() {
if (client != null) {
if (client.isConnected()) {
client.disconnect();
}
}
if (session != null) {
if (session.isConnected()) {
session.disconnect();
}
}
}
}
package com.gx.obe.server.common.sftp;
public interface SftpConfiguration {
String UID = "8DWJGTN9";
String SECURITYKEY = "HWKXW0jSk7rZjPtvjYHAyNhRH7lQW1ib6bJD6padLmafHcjItQ3UtcgTUuKHRtu8";
String HOST = "sftp.bidata.com.cn";
Integer PORT = 20022;
String PROTOCOL = "sftp";
String USERNAME = "8DWJGTN9";
String PASSWORD = "MGYzNTEwMmYwYzA0";
String ROOT = "/data/RELATION";
String SESSIONSTRICTHOSTKEYCHECKING = "no";
Integer SESSIONCONNECTTIMEOUT = 15000;
Integer CHANNELCONNECTEDTIMEOUT = 15000;
}
\ No newline at end of file
package com.gx.obe.server.common.test;
import java.io.Serializable;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Map;
/**
* @Title: RequestBodyEntity
* @Package com.gx.obe.server.controllers.details
* @Description: 标准返回对象结构体
* @author: XiaoMaPro
* @date: 2019年4月25日 下午1:46:02
* @version V1.0
* @Copyright: 2018 - 2019 www.myspro.com Inc. All rights reserved.
*
*/
public class RequestBody<T> implements Serializable{
private static final long serialVersionUID = 1L;
private static final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private T entity;
private List<T> entityList;
private List<Object> list;
private Map<String, Object> params;
public RequestBody() {
super();
}
public T getEntity() {
return entity;
}
public void setEntity(T entity) {
this.entity = entity;
}
public List<Object> getList() {
return list;
}
public void setList(List<Object> list) {
this.list = list;
}
public List<T> getEntityList() {
return entityList;
}
public void setEntityList(List<T> entityList) {
this.entityList = entityList;
}
public Map<String, Object> getParams() {
return params;
}
public void setParams(Map<String, Object> params) {
this.params = params;
}
public Object getParam(String key){
if(null != params){
return params.get(key);
}
return null;
}
public RequestBody(T data) {
super();
this.entity = data;
}
public RequestBody(T data, List<Object> list) {
super();
this.entity = data;
this.list = list;
}
public RequestBody(Throwable e) {
super();
}
public String getParamsString(String key, String defaultValue) {
if (null == params || null == params.get(key)) {
return defaultValue;
}
Object paramValue = params.get(key);
if (paramValue instanceof String) {
return (String) paramValue;
} else {
return paramValue.toString();
}
}
public boolean getParamsBoolean(String key) {
return getParamsBoolean(key, false);
}
public boolean getParamsBoolean(String key, boolean defaultValue) {
if(null == params || null == params.get(key)){
return defaultValue;
}
Object paramValue = params.get(key);
if(paramValue instanceof Boolean){
return (Boolean) paramValue;
}else {
if(paramValue.toString().equals("1")){
return true;
}else {
return false;
}
}
}
public Integer getParamsInteger(String key) {
return getParamsInteger(key, 0);
}
public Integer getParamsInteger(String key ,Integer defaultValue) {
if(null == params || null == params.get(key)){
return defaultValue;
}
Object paramValue = params.get(key);
try {
if(paramValue instanceof Integer){
return (Integer) paramValue;
}else {
return Integer.valueOf(paramValue.toString());
}
} catch (Exception e) {
return Integer.valueOf(0);
}
}
public Double getParamsDouble(String key) {
return getParamsDouble(key,0.0);
}
public Double getParamsDouble(String key,Double defaultValue) {
if(null == params || null == params.get(key)){
return defaultValue;
}
Object paramValue = params.get(key);
try {
if(paramValue instanceof Integer){
return (Double) paramValue;
}else {
return Double.valueOf(paramValue.toString());
}
} catch (Exception e) {
return Double.valueOf(0);
}
}
public BigDecimal getParamsBigDecimal(String key) {
return getParamsBigDecimal(key ,BigDecimal.ZERO);
}
public BigDecimal getParamsBigDecimal(String key , BigDecimal defaultValue) {
if(null == params || null == params.get(key)){
return defaultValue;
}
try {
Object paramValue = params.get(key);
if(paramValue instanceof BigDecimal){
return (BigDecimal) paramValue;
}else {
return (BigDecimal)new BigDecimal(paramValue.toString());
}
} catch (Exception e) {
return BigDecimal.ZERO;
}
}
}
//package com.gx.obe.server.common.test;
//
//import java.util.ArrayList;
//import java.util.List;
//
//import com.google.gson.Gson;
//import com.google.gson.reflect.TypeToken;
//import com.gx.obe.http.json.JsonUtil;
//import com.gx.obe.http.jsons.JSONObject;
//import com.gx.obe.http.jsons.JSONObjectSerializer;
//import com.gx.obe.http.jsons.JSONUtil;
//import com.gx.obe.http.util.TypeReference;
//import com.gx.obe.server.common.vo.RequestBodyEntity;
//
//public class TestJson {
//
// public static void main(String[] args) {
// RequestBodyEntity<RequestBody<User>> a = new RequestBodyEntity<RequestBody<User>>();
// RequestBody<User> bod = new RequestBody<User>();
// List<User> list = new ArrayList<User>();
// User user1 = new User();
// user1.setName("132");
// user1.setPassword("132165");
// User user2 = new User();
// user2.setName("12313");
// user2.setPassword("1321adfg65");
//
// list.add(user2);
// list.add(user1);
//
// bod.setEntityList(list);
// a.setEntity(bod);
//
// String string = JsonUtil.jsonObjectToStr(a);
//
// System.out.println(string);
// JSONUtil.putSerializer(RequestBodyEntity.class, new JSONObjectSerializer<RequestBodyEntity>() {
// @Override
// public void serialize(JSONObject json, RequestBodyEntity bean) {
//
// }});
//// RequestBodyEntity<RequestBody<User>> aa = new Gson().fromJson(string, new TypeToken<RequestBodyEntity<RequestBody<User>>>() {}.getType());
//// RequestBodyEntity<RequestBody<User>> aa = new Gson().fromJson(string, TypeToken.getParameterized(RequestBodyEntity.class, TypeToken.getParameterized(RequestBody.class, User.class).getType()).getType());
// RequestBodyEntity<RequestBody<User>> aa = JSONUtil.toBean(string, new TypeReference<RequestBodyEntity<RequestBody<User>>>() {}.getType(), false);
//
//// RequestBodyEntity<RequestBody<User>> aa = JsonUtil.jsonToBean(string, new RequestBodyEntity<RequestBody<User>>() {
//// private static final long serialVersionUID = 1L;}.getClass());
//
// System.out.println(aa);
// }
//
//}
package com.gx.obe.server.common.utils;
public class ExceptionUtil {
public static void equal (int i, int j) {
if (i != j)
throw new RuntimeException();
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment