Commit 5f504cdcbfdd59049387c6e7f17bfe7fa640fd4a
0 parents
初始化
Showing
30 changed files
with
3451 additions
and
0 deletions
.gitignore
0 → 100644
| 1 | +++ a/.gitignore | ||
| 1 | +HELP.md | ||
| 2 | +target/ | ||
| 3 | +!.mvn/wrapper/maven-wrapper.jar | ||
| 4 | +!**/src/main/** | ||
| 5 | +!**/src/test/** | ||
| 6 | + | ||
| 7 | +### STS ### | ||
| 8 | +.apt_generated | ||
| 9 | +.classpath | ||
| 10 | +.factorypath | ||
| 11 | +.project | ||
| 12 | +.settings | ||
| 13 | +.springBeans | ||
| 14 | +.sts4-cache | ||
| 15 | + | ||
| 16 | +### IntelliJ IDEA ### | ||
| 17 | +.idea | ||
| 18 | +*.iws | ||
| 19 | +*.iml | ||
| 20 | +*.ipr | ||
| 21 | + | ||
| 22 | +### NetBeans ### | ||
| 23 | +/nbproject/private/ | ||
| 24 | +/nbbuild/ | ||
| 25 | +/dist/ | ||
| 26 | +/nbdist/ | ||
| 27 | +/.nb-gradle/ | ||
| 28 | +build/ | ||
| 29 | + | ||
| 30 | +### VS Code ### | ||
| 31 | +.vscode/ |
README.md
0 → 100644
average_speed.sql
0 → 100644
| 1 | +++ a/average_speed.sql | ||
| 1 | + | ||
| 2 | +SET FOREIGN_KEY_CHECKS=0; | ||
| 3 | + | ||
| 4 | +-- ---------------------------- | ||
| 5 | +-- Table structure for calc_average_speed | ||
| 6 | +-- ---------------------------- | ||
| 7 | +DROP TABLE IF EXISTS `calc_average_speed`; | ||
| 8 | +CREATE TABLE `calc_average_speed` ( | ||
| 9 | + `id` bigint(20) NOT NULL AUTO_INCREMENT, -- 主键Id | ||
| 10 | + `company_id` int(11) DEFAULT NULL, -- 公司编码 | ||
| 11 | + `branche_company_id` int(11) DEFAULT NULL, -- 分公司编码 | ||
| 12 | + `company_name` varchar(255) DEFAULT NULL, -- 公司名称 | ||
| 13 | + `branche_company_name` varchar(255) DEFAULT NULL, -- 分公司名称 | ||
| 14 | + `line_code` varchar(255) DEFAULT NULL, -- 线路编码 | ||
| 15 | + `line_name` varchar(255) DEFAULT NULL, -- 线路名称 | ||
| 16 | + `plan_speed` float DEFAULT NULL, | ||
| 17 | + `real_speed` float DEFAULT NULL, | ||
| 18 | + `rq` datetime DEFAULT NULL, -- 日期字符串 | ||
| 19 | + `rq_str` varchar(255) DEFAULT NULL, -- 日期 | ||
| 20 | + `create_date` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, | ||
| 21 | + PRIMARY KEY (`id`) | ||
| 22 | +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; | ||
| 23 | + | ||
| 24 | + | ||
| 25 | + |
mvnw
0 → 100644
| 1 | +++ a/mvnw | ||
| 1 | +#!/bin/sh | ||
| 2 | +# ---------------------------------------------------------------------------- | ||
| 3 | +# Licensed to the Apache Software Foundation (ASF) under one | ||
| 4 | +# or more contributor license agreements. See the NOTICE file | ||
| 5 | +# distributed with this work for additional information | ||
| 6 | +# regarding copyright ownership. The ASF licenses this file | ||
| 7 | +# to you under the Apache License, Version 2.0 (the | ||
| 8 | +# "License"); you may not use this file except in compliance | ||
| 9 | +# with the License. You may obtain a copy of the License at | ||
| 10 | +# | ||
| 11 | +# https://www.apache.org/licenses/LICENSE-2.0 | ||
| 12 | +# | ||
| 13 | +# Unless required by applicable law or agreed to in writing, | ||
| 14 | +# software distributed under the License is distributed on an | ||
| 15 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| 16 | +# KIND, either express or implied. See the License for the | ||
| 17 | +# specific language governing permissions and limitations | ||
| 18 | +# under the License. | ||
| 19 | +# ---------------------------------------------------------------------------- | ||
| 20 | + | ||
| 21 | +# ---------------------------------------------------------------------------- | ||
| 22 | +# Maven2 Start Up Batch script | ||
| 23 | +# | ||
| 24 | +# Required ENV vars: | ||
| 25 | +# ------------------ | ||
| 26 | +# JAVA_HOME - location of a JDK home dir | ||
| 27 | +# | ||
| 28 | +# Optional ENV vars | ||
| 29 | +# ----------------- | ||
| 30 | +# M2_HOME - location of maven2's installed home dir | ||
| 31 | +# MAVEN_OPTS - parameters passed to the Java VM when running Maven | ||
| 32 | +# e.g. to debug Maven itself, use | ||
| 33 | +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 | ||
| 34 | +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files | ||
| 35 | +# ---------------------------------------------------------------------------- | ||
| 36 | + | ||
| 37 | +if [ -z "$MAVEN_SKIP_RC" ] ; then | ||
| 38 | + | ||
| 39 | + if [ -f /etc/mavenrc ] ; then | ||
| 40 | + . /etc/mavenrc | ||
| 41 | + fi | ||
| 42 | + | ||
| 43 | + if [ -f "$HOME/.mavenrc" ] ; then | ||
| 44 | + . "$HOME/.mavenrc" | ||
| 45 | + fi | ||
| 46 | + | ||
| 47 | +fi | ||
| 48 | + | ||
| 49 | +# OS specific support. $var _must_ be set to either true or false. | ||
| 50 | +cygwin=false; | ||
| 51 | +darwin=false; | ||
| 52 | +mingw=false | ||
| 53 | +case "`uname`" in | ||
| 54 | + CYGWIN*) cygwin=true ;; | ||
| 55 | + MINGW*) mingw=true;; | ||
| 56 | + Darwin*) darwin=true | ||
| 57 | + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home | ||
| 58 | + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html | ||
| 59 | + if [ -z "$JAVA_HOME" ]; then | ||
| 60 | + if [ -x "/usr/libexec/java_home" ]; then | ||
| 61 | + export JAVA_HOME="`/usr/libexec/java_home`" | ||
| 62 | + else | ||
| 63 | + export JAVA_HOME="/Library/Java/Home" | ||
| 64 | + fi | ||
| 65 | + fi | ||
| 66 | + ;; | ||
| 67 | +esac | ||
| 68 | + | ||
| 69 | +if [ -z "$JAVA_HOME" ] ; then | ||
| 70 | + if [ -r /etc/gentoo-release ] ; then | ||
| 71 | + JAVA_HOME=`java-config --jre-home` | ||
| 72 | + fi | ||
| 73 | +fi | ||
| 74 | + | ||
| 75 | +if [ -z "$M2_HOME" ] ; then | ||
| 76 | + ## resolve links - $0 may be a link to maven's home | ||
| 77 | + PRG="$0" | ||
| 78 | + | ||
| 79 | + # need this for relative symlinks | ||
| 80 | + while [ -h "$PRG" ] ; do | ||
| 81 | + ls=`ls -ld "$PRG"` | ||
| 82 | + link=`expr "$ls" : '.*-> \(.*\)$'` | ||
| 83 | + if expr "$link" : '/.*' > /dev/null; then | ||
| 84 | + PRG="$link" | ||
| 85 | + else | ||
| 86 | + PRG="`dirname "$PRG"`/$link" | ||
| 87 | + fi | ||
| 88 | + done | ||
| 89 | + | ||
| 90 | + saveddir=`pwd` | ||
| 91 | + | ||
| 92 | + M2_HOME=`dirname "$PRG"`/.. | ||
| 93 | + | ||
| 94 | + # make it fully qualified | ||
| 95 | + M2_HOME=`cd "$M2_HOME" && pwd` | ||
| 96 | + | ||
| 97 | + cd "$saveddir" | ||
| 98 | + # echo Using m2 at $M2_HOME | ||
| 99 | +fi | ||
| 100 | + | ||
| 101 | +# For Cygwin, ensure paths are in UNIX format before anything is touched | ||
| 102 | +if $cygwin ; then | ||
| 103 | + [ -n "$M2_HOME" ] && | ||
| 104 | + M2_HOME=`cygpath --unix "$M2_HOME"` | ||
| 105 | + [ -n "$JAVA_HOME" ] && | ||
| 106 | + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` | ||
| 107 | + [ -n "$CLASSPATH" ] && | ||
| 108 | + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` | ||
| 109 | +fi | ||
| 110 | + | ||
| 111 | +# For Mingw, ensure paths are in UNIX format before anything is touched | ||
| 112 | +if $mingw ; then | ||
| 113 | + [ -n "$M2_HOME" ] && | ||
| 114 | + M2_HOME="`(cd "$M2_HOME"; pwd)`" | ||
| 115 | + [ -n "$JAVA_HOME" ] && | ||
| 116 | + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" | ||
| 117 | +fi | ||
| 118 | + | ||
| 119 | +if [ -z "$JAVA_HOME" ]; then | ||
| 120 | + javaExecutable="`which javac`" | ||
| 121 | + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then | ||
| 122 | + # readlink(1) is not available as standard on Solaris 10. | ||
| 123 | + readLink=`which readlink` | ||
| 124 | + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then | ||
| 125 | + if $darwin ; then | ||
| 126 | + javaHome="`dirname \"$javaExecutable\"`" | ||
| 127 | + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" | ||
| 128 | + else | ||
| 129 | + javaExecutable="`readlink -f \"$javaExecutable\"`" | ||
| 130 | + fi | ||
| 131 | + javaHome="`dirname \"$javaExecutable\"`" | ||
| 132 | + javaHome=`expr "$javaHome" : '\(.*\)/bin'` | ||
| 133 | + JAVA_HOME="$javaHome" | ||
| 134 | + export JAVA_HOME | ||
| 135 | + fi | ||
| 136 | + fi | ||
| 137 | +fi | ||
| 138 | + | ||
| 139 | +if [ -z "$JAVACMD" ] ; then | ||
| 140 | + if [ -n "$JAVA_HOME" ] ; then | ||
| 141 | + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then | ||
| 142 | + # IBM's JDK on AIX uses strange locations for the executables | ||
| 143 | + JAVACMD="$JAVA_HOME/jre/sh/java" | ||
| 144 | + else | ||
| 145 | + JAVACMD="$JAVA_HOME/bin/java" | ||
| 146 | + fi | ||
| 147 | + else | ||
| 148 | + JAVACMD="`which java`" | ||
| 149 | + fi | ||
| 150 | +fi | ||
| 151 | + | ||
| 152 | +if [ ! -x "$JAVACMD" ] ; then | ||
| 153 | + echo "Error: JAVA_HOME is not defined correctly." >&2 | ||
| 154 | + echo " We cannot execute $JAVACMD" >&2 | ||
| 155 | + exit 1 | ||
| 156 | +fi | ||
| 157 | + | ||
| 158 | +if [ -z "$JAVA_HOME" ] ; then | ||
| 159 | + echo "Warning: JAVA_HOME environment variable is not set." | ||
| 160 | +fi | ||
| 161 | + | ||
| 162 | +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher | ||
| 163 | + | ||
| 164 | +# traverses directory structure from process work directory to filesystem root | ||
| 165 | +# first directory with .mvn subdirectory is considered project base directory | ||
| 166 | +find_maven_basedir() { | ||
| 167 | + | ||
| 168 | + if [ -z "$1" ] | ||
| 169 | + then | ||
| 170 | + echo "Path not specified to find_maven_basedir" | ||
| 171 | + return 1 | ||
| 172 | + fi | ||
| 173 | + | ||
| 174 | + basedir="$1" | ||
| 175 | + wdir="$1" | ||
| 176 | + while [ "$wdir" != '/' ] ; do | ||
| 177 | + if [ -d "$wdir"/.mvn ] ; then | ||
| 178 | + basedir=$wdir | ||
| 179 | + break | ||
| 180 | + fi | ||
| 181 | + # workaround for JBEAP-8937 (on Solaris 10/Sparc) | ||
| 182 | + if [ -d "${wdir}" ]; then | ||
| 183 | + wdir=`cd "$wdir/.."; pwd` | ||
| 184 | + fi | ||
| 185 | + # end of workaround | ||
| 186 | + done | ||
| 187 | + echo "${basedir}" | ||
| 188 | +} | ||
| 189 | + | ||
| 190 | +# concatenates all lines of a file | ||
| 191 | +concat_lines() { | ||
| 192 | + if [ -f "$1" ]; then | ||
| 193 | + echo "$(tr -s '\n' ' ' < "$1")" | ||
| 194 | + fi | ||
| 195 | +} | ||
| 196 | + | ||
| 197 | +BASE_DIR=`find_maven_basedir "$(pwd)"` | ||
| 198 | +if [ -z "$BASE_DIR" ]; then | ||
| 199 | + exit 1; | ||
| 200 | +fi | ||
| 201 | + | ||
| 202 | +########################################################################################## | ||
| 203 | +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central | ||
| 204 | +# This allows using the maven wrapper in projects that prohibit checking in binary data. | ||
| 205 | +########################################################################################## | ||
| 206 | +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then | ||
| 207 | + if [ "$MVNW_VERBOSE" = true ]; then | ||
| 208 | + echo "Found .mvn/wrapper/maven-wrapper.jar" | ||
| 209 | + fi | ||
| 210 | +else | ||
| 211 | + if [ "$MVNW_VERBOSE" = true ]; then | ||
| 212 | + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." | ||
| 213 | + fi | ||
| 214 | + if [ -n "$MVNW_REPOURL" ]; then | ||
| 215 | + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar" | ||
| 216 | + else | ||
| 217 | + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar" | ||
| 218 | + fi | ||
| 219 | + while IFS="=" read key value; do | ||
| 220 | + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; | ||
| 221 | + esac | ||
| 222 | + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" | ||
| 223 | + if [ "$MVNW_VERBOSE" = true ]; then | ||
| 224 | + echo "Downloading from: $jarUrl" | ||
| 225 | + fi | ||
| 226 | + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" | ||
| 227 | + if $cygwin; then | ||
| 228 | + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` | ||
| 229 | + fi | ||
| 230 | + | ||
| 231 | + if command -v wget > /dev/null; then | ||
| 232 | + if [ "$MVNW_VERBOSE" = true ]; then | ||
| 233 | + echo "Found wget ... using wget" | ||
| 234 | + fi | ||
| 235 | + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then | ||
| 236 | + wget "$jarUrl" -O "$wrapperJarPath" | ||
| 237 | + else | ||
| 238 | + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" | ||
| 239 | + fi | ||
| 240 | + elif command -v curl > /dev/null; then | ||
| 241 | + if [ "$MVNW_VERBOSE" = true ]; then | ||
| 242 | + echo "Found curl ... using curl" | ||
| 243 | + fi | ||
| 244 | + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then | ||
| 245 | + curl -o "$wrapperJarPath" "$jarUrl" -f | ||
| 246 | + else | ||
| 247 | + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f | ||
| 248 | + fi | ||
| 249 | + | ||
| 250 | + else | ||
| 251 | + if [ "$MVNW_VERBOSE" = true ]; then | ||
| 252 | + echo "Falling back to using Java to download" | ||
| 253 | + fi | ||
| 254 | + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" | ||
| 255 | + # For Cygwin, switch paths to Windows format before running javac | ||
| 256 | + if $cygwin; then | ||
| 257 | + javaClass=`cygpath --path --windows "$javaClass"` | ||
| 258 | + fi | ||
| 259 | + if [ -e "$javaClass" ]; then | ||
| 260 | + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then | ||
| 261 | + if [ "$MVNW_VERBOSE" = true ]; then | ||
| 262 | + echo " - Compiling MavenWrapperDownloader.java ..." | ||
| 263 | + fi | ||
| 264 | + # Compiling the Java class | ||
| 265 | + ("$JAVA_HOME/bin/javac" "$javaClass") | ||
| 266 | + fi | ||
| 267 | + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then | ||
| 268 | + # Running the downloader | ||
| 269 | + if [ "$MVNW_VERBOSE" = true ]; then | ||
| 270 | + echo " - Running MavenWrapperDownloader.java ..." | ||
| 271 | + fi | ||
| 272 | + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") | ||
| 273 | + fi | ||
| 274 | + fi | ||
| 275 | + fi | ||
| 276 | +fi | ||
| 277 | +########################################################################################## | ||
| 278 | +# End of extension | ||
| 279 | +########################################################################################## | ||
| 280 | + | ||
| 281 | +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} | ||
| 282 | +if [ "$MVNW_VERBOSE" = true ]; then | ||
| 283 | + echo $MAVEN_PROJECTBASEDIR | ||
| 284 | +fi | ||
| 285 | +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" | ||
| 286 | + | ||
| 287 | +# For Cygwin, switch paths to Windows format before running java | ||
| 288 | +if $cygwin; then | ||
| 289 | + [ -n "$M2_HOME" ] && | ||
| 290 | + M2_HOME=`cygpath --path --windows "$M2_HOME"` | ||
| 291 | + [ -n "$JAVA_HOME" ] && | ||
| 292 | + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` | ||
| 293 | + [ -n "$CLASSPATH" ] && | ||
| 294 | + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` | ||
| 295 | + [ -n "$MAVEN_PROJECTBASEDIR" ] && | ||
| 296 | + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` | ||
| 297 | +fi | ||
| 298 | + | ||
| 299 | +# Provide a "standardized" way to retrieve the CLI args that will | ||
| 300 | +# work with both Windows and non-Windows executions. | ||
| 301 | +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" | ||
| 302 | +export MAVEN_CMD_LINE_ARGS | ||
| 303 | + | ||
| 304 | +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain | ||
| 305 | + | ||
| 306 | +exec "$JAVACMD" \ | ||
| 307 | + $MAVEN_OPTS \ | ||
| 308 | + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ | ||
| 309 | + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ | ||
| 310 | + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" |
mvnw.cmd
0 → 100644
| 1 | +++ a/mvnw.cmd | ||
| 1 | +@REM ---------------------------------------------------------------------------- | ||
| 2 | +@REM Licensed to the Apache Software Foundation (ASF) under one | ||
| 3 | +@REM or more contributor license agreements. See the NOTICE file | ||
| 4 | +@REM distributed with this work for additional information | ||
| 5 | +@REM regarding copyright ownership. The ASF licenses this file | ||
| 6 | +@REM to you under the Apache License, Version 2.0 (the | ||
| 7 | +@REM "License"); you may not use this file except in compliance | ||
| 8 | +@REM with the License. You may obtain a copy of the License at | ||
| 9 | +@REM | ||
| 10 | +@REM https://www.apache.org/licenses/LICENSE-2.0 | ||
| 11 | +@REM | ||
| 12 | +@REM Unless required by applicable law or agreed to in writing, | ||
| 13 | +@REM software distributed under the License is distributed on an | ||
| 14 | +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| 15 | +@REM KIND, either express or implied. See the License for the | ||
| 16 | +@REM specific language governing permissions and limitations | ||
| 17 | +@REM under the License. | ||
| 18 | +@REM ---------------------------------------------------------------------------- | ||
| 19 | + | ||
| 20 | +@REM ---------------------------------------------------------------------------- | ||
| 21 | +@REM Maven2 Start Up Batch script | ||
| 22 | +@REM | ||
| 23 | +@REM Required ENV vars: | ||
| 24 | +@REM JAVA_HOME - location of a JDK home dir | ||
| 25 | +@REM | ||
| 26 | +@REM Optional ENV vars | ||
| 27 | +@REM M2_HOME - location of maven2's installed home dir | ||
| 28 | +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands | ||
| 29 | +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending | ||
| 30 | +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven | ||
| 31 | +@REM e.g. to debug Maven itself, use | ||
| 32 | +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 | ||
| 33 | +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files | ||
| 34 | +@REM ---------------------------------------------------------------------------- | ||
| 35 | + | ||
| 36 | +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' | ||
| 37 | +@echo off | ||
| 38 | +@REM set title of command window | ||
| 39 | +title %0 | ||
| 40 | +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' | ||
| 41 | +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% | ||
| 42 | + | ||
| 43 | +@REM set %HOME% to equivalent of $HOME | ||
| 44 | +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") | ||
| 45 | + | ||
| 46 | +@REM Execute a user defined script before this one | ||
| 47 | +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre | ||
| 48 | +@REM check for pre script, once with legacy .bat ending and once with .cmd ending | ||
| 49 | +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" | ||
| 50 | +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" | ||
| 51 | +:skipRcPre | ||
| 52 | + | ||
| 53 | +@setlocal | ||
| 54 | + | ||
| 55 | +set ERROR_CODE=0 | ||
| 56 | + | ||
| 57 | +@REM To isolate internal variables from possible post scripts, we use another setlocal | ||
| 58 | +@setlocal | ||
| 59 | + | ||
| 60 | +@REM ==== START VALIDATION ==== | ||
| 61 | +if not "%JAVA_HOME%" == "" goto OkJHome | ||
| 62 | + | ||
| 63 | +echo. | ||
| 64 | +echo Error: JAVA_HOME not found in your environment. >&2 | ||
| 65 | +echo Please set the JAVA_HOME variable in your environment to match the >&2 | ||
| 66 | +echo location of your Java installation. >&2 | ||
| 67 | +echo. | ||
| 68 | +goto error | ||
| 69 | + | ||
| 70 | +:OkJHome | ||
| 71 | +if exist "%JAVA_HOME%\bin\java.exe" goto init | ||
| 72 | + | ||
| 73 | +echo. | ||
| 74 | +echo Error: JAVA_HOME is set to an invalid directory. >&2 | ||
| 75 | +echo JAVA_HOME = "%JAVA_HOME%" >&2 | ||
| 76 | +echo Please set the JAVA_HOME variable in your environment to match the >&2 | ||
| 77 | +echo location of your Java installation. >&2 | ||
| 78 | +echo. | ||
| 79 | +goto error | ||
| 80 | + | ||
| 81 | +@REM ==== END VALIDATION ==== | ||
| 82 | + | ||
| 83 | +:init | ||
| 84 | + | ||
| 85 | +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". | ||
| 86 | +@REM Fallback to current working directory if not found. | ||
| 87 | + | ||
| 88 | +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% | ||
| 89 | +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir | ||
| 90 | + | ||
| 91 | +set EXEC_DIR=%CD% | ||
| 92 | +set WDIR=%EXEC_DIR% | ||
| 93 | +:findBaseDir | ||
| 94 | +IF EXIST "%WDIR%"\.mvn goto baseDirFound | ||
| 95 | +cd .. | ||
| 96 | +IF "%WDIR%"=="%CD%" goto baseDirNotFound | ||
| 97 | +set WDIR=%CD% | ||
| 98 | +goto findBaseDir | ||
| 99 | + | ||
| 100 | +:baseDirFound | ||
| 101 | +set MAVEN_PROJECTBASEDIR=%WDIR% | ||
| 102 | +cd "%EXEC_DIR%" | ||
| 103 | +goto endDetectBaseDir | ||
| 104 | + | ||
| 105 | +:baseDirNotFound | ||
| 106 | +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% | ||
| 107 | +cd "%EXEC_DIR%" | ||
| 108 | + | ||
| 109 | +:endDetectBaseDir | ||
| 110 | + | ||
| 111 | +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig | ||
| 112 | + | ||
| 113 | +@setlocal EnableExtensions EnableDelayedExpansion | ||
| 114 | +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a | ||
| 115 | +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% | ||
| 116 | + | ||
| 117 | +:endReadAdditionalConfig | ||
| 118 | + | ||
| 119 | +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" | ||
| 120 | +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" | ||
| 121 | +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain | ||
| 122 | + | ||
| 123 | +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar" | ||
| 124 | + | ||
| 125 | +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( | ||
| 126 | + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B | ||
| 127 | +) | ||
| 128 | + | ||
| 129 | +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central | ||
| 130 | +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. | ||
| 131 | +if exist %WRAPPER_JAR% ( | ||
| 132 | + if "%MVNW_VERBOSE%" == "true" ( | ||
| 133 | + echo Found %WRAPPER_JAR% | ||
| 134 | + ) | ||
| 135 | +) else ( | ||
| 136 | + if not "%MVNW_REPOURL%" == "" ( | ||
| 137 | + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar" | ||
| 138 | + ) | ||
| 139 | + if "%MVNW_VERBOSE%" == "true" ( | ||
| 140 | + echo Couldn't find %WRAPPER_JAR%, downloading it ... | ||
| 141 | + echo Downloading from: %DOWNLOAD_URL% | ||
| 142 | + ) | ||
| 143 | + | ||
| 144 | + powershell -Command "&{"^ | ||
| 145 | + "$webclient = new-object System.Net.WebClient;"^ | ||
| 146 | + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ | ||
| 147 | + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ | ||
| 148 | + "}"^ | ||
| 149 | + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ | ||
| 150 | + "}" | ||
| 151 | + if "%MVNW_VERBOSE%" == "true" ( | ||
| 152 | + echo Finished downloading %WRAPPER_JAR% | ||
| 153 | + ) | ||
| 154 | +) | ||
| 155 | +@REM End of extension | ||
| 156 | + | ||
| 157 | +@REM Provide a "standardized" way to retrieve the CLI args that will | ||
| 158 | +@REM work with both Windows and non-Windows executions. | ||
| 159 | +set MAVEN_CMD_LINE_ARGS=%* | ||
| 160 | + | ||
| 161 | +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* | ||
| 162 | +if ERRORLEVEL 1 goto error | ||
| 163 | +goto end | ||
| 164 | + | ||
| 165 | +:error | ||
| 166 | +set ERROR_CODE=1 | ||
| 167 | + | ||
| 168 | +:end | ||
| 169 | +@endlocal & set ERROR_CODE=%ERROR_CODE% | ||
| 170 | + | ||
| 171 | +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost | ||
| 172 | +@REM check for post script, once with legacy .bat ending and once with .cmd ending | ||
| 173 | +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" | ||
| 174 | +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" | ||
| 175 | +:skipRcPost | ||
| 176 | + | ||
| 177 | +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' | ||
| 178 | +if "%MAVEN_BATCH_PAUSE%" == "on" pause | ||
| 179 | + | ||
| 180 | +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% | ||
| 181 | + | ||
| 182 | +exit /B %ERROR_CODE% |
pom.xml
0 → 100644
| 1 | +++ a/pom.xml | ||
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| 3 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| 4 | + <modelVersion>4.0.0</modelVersion> | ||
| 5 | + <parent> | ||
| 6 | + <groupId>org.springframework.boot</groupId> | ||
| 7 | + <artifactId>spring-boot-starter-parent</artifactId> | ||
| 8 | + <version>1.5.2.RELEASE</version> | ||
| 9 | + <relativePath/> <!-- lookup parent from repository --> | ||
| 10 | + </parent> | ||
| 11 | + <groupId>com</groupId> | ||
| 12 | + <artifactId>average_speed</artifactId> | ||
| 13 | + <version>0.0.1-SNAPSHOT</version> | ||
| 14 | + <name>average_speed</name> | ||
| 15 | + <description>Demo project for Spring Boot</description> | ||
| 16 | + | ||
| 17 | + <properties> | ||
| 18 | + <java.version>1.7</java.version> | ||
| 19 | + </properties> | ||
| 20 | + | ||
| 21 | + <dependencies> | ||
| 22 | + <dependency> | ||
| 23 | + <groupId>org.springframework.boot</groupId> | ||
| 24 | + <artifactId>spring-boot-starter</artifactId> | ||
| 25 | + </dependency> | ||
| 26 | + | ||
| 27 | + <dependency> | ||
| 28 | + <groupId>org.springframework.boot</groupId> | ||
| 29 | + <artifactId>spring-boot-starter-web</artifactId> | ||
| 30 | + </dependency> | ||
| 31 | + | ||
| 32 | + <dependency> | ||
| 33 | + <groupId>org.springframework.boot</groupId> | ||
| 34 | + <artifactId>spring-boot-starter-data-jpa</artifactId> | ||
| 35 | + </dependency> | ||
| 36 | + <dependency> | ||
| 37 | + <groupId>mysql</groupId> | ||
| 38 | + <artifactId>mysql-connector-java</artifactId> | ||
| 39 | + </dependency> | ||
| 40 | + | ||
| 41 | + <dependency> | ||
| 42 | + <groupId>com.alibaba</groupId> | ||
| 43 | + <artifactId>fastjson</artifactId> | ||
| 44 | + <version>1.2.4</version> | ||
| 45 | + </dependency> | ||
| 46 | + | ||
| 47 | + <dependency> | ||
| 48 | + <groupId>org.apache.httpcomponents</groupId> | ||
| 49 | + <artifactId>httpclient</artifactId> | ||
| 50 | + </dependency> | ||
| 51 | + | ||
| 52 | + <dependency> | ||
| 53 | + <groupId>joda-time</groupId> | ||
| 54 | + <artifactId>joda-time</artifactId> | ||
| 55 | + </dependency> | ||
| 56 | + <dependency> | ||
| 57 | + <groupId>c3p0</groupId> | ||
| 58 | + <artifactId>c3p0</artifactId> | ||
| 59 | + <version>0.9.1.2</version> | ||
| 60 | + </dependency> | ||
| 61 | + <dependency> | ||
| 62 | + <groupId>commons-dbcp</groupId> | ||
| 63 | + <artifactId>commons-dbcp</artifactId> | ||
| 64 | + </dependency> | ||
| 65 | + <dependency> | ||
| 66 | + <groupId>commons-lang</groupId> | ||
| 67 | + <artifactId>commons-lang</artifactId> | ||
| 68 | + <version>2.6</version> | ||
| 69 | + </dependency> | ||
| 70 | + <dependency> | ||
| 71 | + <groupId>org.apache.commons</groupId> | ||
| 72 | + <artifactId>commons-lang3</artifactId> | ||
| 73 | + <version>3.4</version> | ||
| 74 | + </dependency> | ||
| 75 | + <dependency> | ||
| 76 | + <groupId>commons-fileupload</groupId> | ||
| 77 | + <artifactId>commons-fileupload</artifactId> | ||
| 78 | + <version>1.2.2</version> | ||
| 79 | + </dependency> | ||
| 80 | + <dependency> | ||
| 81 | + <groupId>commons-io</groupId> | ||
| 82 | + <artifactId>commons-io</artifactId> | ||
| 83 | + <version>2.4</version> | ||
| 84 | + </dependency> | ||
| 85 | + <dependency> | ||
| 86 | + <groupId>com.fasterxml.jackson.jaxrs</groupId> | ||
| 87 | + <artifactId>jackson-jaxrs-json-provider</artifactId> | ||
| 88 | + <version>2.8.7</version> | ||
| 89 | + </dependency> | ||
| 90 | + <dependency> | ||
| 91 | + <groupId>log4j</groupId> | ||
| 92 | + <artifactId>log4j</artifactId> | ||
| 93 | + <version>1.2.17</version> | ||
| 94 | + </dependency> | ||
| 95 | + | ||
| 96 | + <dependency> | ||
| 97 | + <groupId>javax.servlet</groupId> | ||
| 98 | + <artifactId>javax.servlet-api</artifactId> | ||
| 99 | + <version>3.1.0</version> | ||
| 100 | + <scope>provided</scope> | ||
| 101 | + </dependency> | ||
| 102 | + </dependencies> | ||
| 103 | + | ||
| 104 | + <build> | ||
| 105 | + <plugins> | ||
| 106 | + <plugin> | ||
| 107 | + <groupId>org.springframework.boot</groupId> | ||
| 108 | + <artifactId>spring-boot-maven-plugin</artifactId> | ||
| 109 | + </plugin> | ||
| 110 | + </plugins> | ||
| 111 | + </build> | ||
| 112 | + | ||
| 113 | +</project> |
src/main/java/com/bsth/BsthApplication.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/BsthApplication.java | ||
| 1 | +package com.bsth; | ||
| 2 | + | ||
| 3 | +import org.springframework.boot.SpringApplication; | ||
| 4 | +import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
| 5 | +import org.springframework.boot.builder.SpringApplicationBuilder; | ||
| 6 | +import org.springframework.boot.web.support.SpringBootServletInitializer; | ||
| 7 | +//import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; | ||
| 8 | + | ||
| 9 | +@SpringBootApplication | ||
| 10 | +public class BsthApplication extends SpringBootServletInitializer { | ||
| 11 | + | ||
| 12 | + @Override | ||
| 13 | + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { | ||
| 14 | + return application.sources(BsthApplication.class); | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + public static void main(String[] args) { | ||
| 18 | + SpringApplication.run(BsthApplication.class, args); | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | +} |
src/main/java/com/bsth/StartCommand.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/StartCommand.java | ||
| 1 | +package com.bsth; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import com.bsth.thread.AverageSpeedThrad; | ||
| 5 | +import com.bsth.util.DateUtils; | ||
| 6 | +import org.slf4j.Logger; | ||
| 7 | +import org.slf4j.LoggerFactory; | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | +import org.springframework.boot.CommandLineRunner; | ||
| 10 | +import org.springframework.stereotype.Component; | ||
| 11 | + | ||
| 12 | +import java.util.Calendar; | ||
| 13 | +import java.util.Date; | ||
| 14 | +import java.util.concurrent.Executors; | ||
| 15 | +import java.util.concurrent.ScheduledExecutorService; | ||
| 16 | +import java.util.concurrent.TimeUnit; | ||
| 17 | + | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * 随应用启动运行 | ||
| 21 | + * | ||
| 22 | + */ | ||
| 23 | +@Component | ||
| 24 | +public class StartCommand implements CommandLineRunner { | ||
| 25 | + | ||
| 26 | + public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(2); | ||
| 27 | + | ||
| 28 | + Logger log = LoggerFactory.getLogger(this.getClass()); | ||
| 29 | + | ||
| 30 | + public static String RQ =""; | ||
| 31 | + | ||
| 32 | + private static long timeDiff; | ||
| 33 | + | ||
| 34 | + @Autowired | ||
| 35 | + AverageSpeedThrad averageSpeedThrad; | ||
| 36 | + | ||
| 37 | + static { | ||
| 38 | + Date date = new Date(); | ||
| 39 | + Calendar cal = Calendar.getInstance(); | ||
| 40 | + cal.setTime(date); | ||
| 41 | + int year = cal.get(Calendar.YEAR); | ||
| 42 | + int month = cal.get(Calendar.MONTH) + 1; | ||
| 43 | + RQ = year+"-"+(month<10?"0"+month:month); | ||
| 44 | + // 早上02:30 | ||
| 45 | + timeDiff = (DateUtils.getTimestamp() + 1000 * 60 * 150) - System.currentTimeMillis(); | ||
| 46 | + if (timeDiff < 0) | ||
| 47 | + timeDiff += (1000 * 60 * 60 * 24); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + @Override | ||
| 51 | + public void run(String... arg0){ | ||
| 52 | + | ||
| 53 | + try { | ||
| 54 | + log.info(":"+timeDiff / 1000 / 60 + "分钟后统计修正班次和公里报表"); | ||
| 55 | + mainServices.scheduleAtFixedRate(averageSpeedThrad, timeDiff / 1000, 60*60*24, TimeUnit.MINUTES);//timeDiff / 1000 | ||
| 56 | +// mainServices.scheduleAtFixedRate(averageSpeedThrad, 1, 60*60*24, TimeUnit.SECONDS);//timeDiff / 1000 | ||
| 57 | + } catch (Exception e) { | ||
| 58 | + e.printStackTrace(); | ||
| 59 | + } | ||
| 60 | + } | ||
| 61 | +} |
src/main/java/com/bsth/common/ResponseCode.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/common/ResponseCode.java | ||
| 1 | +package com.bsth.common; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * | ||
| 5 | + * @ClassName: ResponseCode | ||
| 6 | + * @Description: TODO(响应状态码) | ||
| 7 | + * @author PanZhao | ||
| 8 | + * @date 2016年3月18日 下午11:12:08 | ||
| 9 | + * | ||
| 10 | + */ | ||
| 11 | +public enum ResponseCode { | ||
| 12 | + | ||
| 13 | + SUCCESS("操作成功", 200), | ||
| 14 | + NO_PERMISSION("无资源访问权限", 403), | ||
| 15 | + NO_AUTHENTICATION("客户端未授权", 407), | ||
| 16 | + ERROR("服务器异常", 500); | ||
| 17 | + | ||
| 18 | + private String text; | ||
| 19 | + private int code; | ||
| 20 | + | ||
| 21 | + ResponseCode(String text, int code) { | ||
| 22 | + this.text = text; | ||
| 23 | + this.code = code; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + @Override | ||
| 27 | + public String toString() { | ||
| 28 | + return this.code + ""; | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + public String getText() { | ||
| 32 | + return this.text; | ||
| 33 | + } | ||
| 34 | +} |
src/main/java/com/bsth/entity/ChildTaskPlan.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/entity/ChildTaskPlan.java | ||
| 1 | +package com.bsth.entity; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.annotation.JsonIgnore; | ||
| 4 | + | ||
| 5 | +import javax.persistence.*; | ||
| 6 | +import java.util.Date; | ||
| 7 | + | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * | ||
| 11 | + * @ClassName: ChildTaskPlan | ||
| 12 | + * @Description: TODO(子任务) | ||
| 13 | + * @author PanZhao | ||
| 14 | + * @date 2016年6月20日 上午11:22:22 | ||
| 15 | + * | ||
| 16 | + */ | ||
| 17 | +@Entity | ||
| 18 | +@Table(name = "bsth_c_s_child_task") | ||
| 19 | +@NamedEntityGraphs({ | ||
| 20 | + @NamedEntityGraph(name = "childTaskPlan_schedule", attributeNodes = { | ||
| 21 | + @NamedAttributeNode("schedule") | ||
| 22 | + }) | ||
| 23 | +}) | ||
| 24 | +public class ChildTaskPlan { | ||
| 25 | + | ||
| 26 | + @Id | ||
| 27 | + @GeneratedValue | ||
| 28 | + private Long id; | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * 任务类型1 | ||
| 32 | + * 正常,临加 | ||
| 33 | + */ | ||
| 34 | + private String type1; | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * 任务类型2 | ||
| 38 | + */ | ||
| 39 | + private String type2; | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * 起点 | ||
| 43 | + */ | ||
| 44 | + private String startStation; | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * 起点站名称 | ||
| 48 | + */ | ||
| 49 | + private String startStationName; | ||
| 50 | + | ||
| 51 | + /** | ||
| 52 | + * 终点 | ||
| 53 | + */ | ||
| 54 | + private String endStation; | ||
| 55 | + | ||
| 56 | + /** | ||
| 57 | + * 终点站名称 | ||
| 58 | + */ | ||
| 59 | + private String endStationName; | ||
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * 里程类型 | ||
| 63 | + */ | ||
| 64 | + private String mileageType; | ||
| 65 | + | ||
| 66 | + /** | ||
| 67 | + * 里程 | ||
| 68 | + */ | ||
| 69 | + private Float mileage; | ||
| 70 | + | ||
| 71 | + /** | ||
| 72 | + * 开始时间 HH:mm | ||
| 73 | + */ | ||
| 74 | + private String startDate; | ||
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * 结束时间 HH:mm | ||
| 78 | + */ | ||
| 79 | + private String endDate; | ||
| 80 | + | ||
| 81 | + /** | ||
| 82 | + * 是否烂班 | ||
| 83 | + */ | ||
| 84 | + private boolean destroy; | ||
| 85 | + | ||
| 86 | + /** | ||
| 87 | + * 烂班原因 -烂班时,该字段仍有值并 =reason | ||
| 88 | + */ | ||
| 89 | + private String destroyReason; | ||
| 90 | + | ||
| 91 | + /** | ||
| 92 | + * 包括 烂班原因、进出场原因、换车原因 等 | ||
| 93 | + */ | ||
| 94 | + private String reason; | ||
| 95 | + | ||
| 96 | + /** | ||
| 97 | + * 车辆 如果为空,继承主任务 | ||
| 98 | + */ | ||
| 99 | + private String nbbm; | ||
| 100 | + | ||
| 101 | + /** | ||
| 102 | + * 为true 则无售票员, 否则继承主任务 | ||
| 103 | + */ | ||
| 104 | + private boolean noClerk; | ||
| 105 | + | ||
| 106 | + /** 创建日期 */ | ||
| 107 | + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | ||
| 108 | + private Date createDate; | ||
| 109 | + | ||
| 110 | + /** | ||
| 111 | + * 主排班计划 | ||
| 112 | + */ | ||
| 113 | + @JsonIgnore | ||
| 114 | + @ManyToOne(fetch = FetchType.LAZY) | ||
| 115 | + @JoinColumn(name = "schedule") | ||
| 116 | + private ScheduleRealInfo schedule; | ||
| 117 | + | ||
| 118 | + private String remarks; | ||
| 119 | + | ||
| 120 | + public Long getId() { | ||
| 121 | + return id; | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + public void setId(Long id) { | ||
| 125 | + this.id = id; | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + public String getType1() { | ||
| 129 | + return type1; | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + public void setType1(String type1) { | ||
| 133 | + this.type1 = type1; | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + public String getType2() { | ||
| 137 | + return type2; | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + public void setType2(String type2) { | ||
| 141 | + this.type2 = type2; | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + public String getStartStation() { | ||
| 145 | + return startStation; | ||
| 146 | + } | ||
| 147 | + | ||
| 148 | + public void setStartStation(String startStation) { | ||
| 149 | + this.startStation = startStation; | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + public String getEndStation() { | ||
| 153 | + return endStation; | ||
| 154 | + } | ||
| 155 | + | ||
| 156 | + public void setEndStation(String endStation) { | ||
| 157 | + this.endStation = endStation; | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + public String getMileageType() { | ||
| 161 | + return mileageType; | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + public void setMileageType(String mileageType) { | ||
| 165 | + this.mileageType = mileageType; | ||
| 166 | + } | ||
| 167 | + | ||
| 168 | + public Float getMileage() { | ||
| 169 | + return mileage; | ||
| 170 | + } | ||
| 171 | + | ||
| 172 | + public void setMileage(Float mileage) { | ||
| 173 | + this.mileage = mileage; | ||
| 174 | + } | ||
| 175 | + | ||
| 176 | + public String getStartDate() { | ||
| 177 | + return startDate; | ||
| 178 | + } | ||
| 179 | + | ||
| 180 | + public void setStartDate(String startDate) { | ||
| 181 | + this.startDate = startDate; | ||
| 182 | + } | ||
| 183 | + | ||
| 184 | + public String getEndDate() { | ||
| 185 | + return endDate; | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + public void setEndDate(String endDate) { | ||
| 189 | + this.endDate = endDate; | ||
| 190 | + } | ||
| 191 | + | ||
| 192 | + public boolean isDestroy() { | ||
| 193 | + return destroy; | ||
| 194 | + } | ||
| 195 | + | ||
| 196 | + public void setDestroy(boolean destroy) { | ||
| 197 | + this.destroy = destroy; | ||
| 198 | + } | ||
| 199 | + | ||
| 200 | + public String getDestroyReason() { | ||
| 201 | + return destroyReason; | ||
| 202 | + } | ||
| 203 | + | ||
| 204 | + public void setDestroyReason(String destroyReason) { | ||
| 205 | + this.destroyReason = destroyReason; | ||
| 206 | + } | ||
| 207 | + | ||
| 208 | + public ScheduleRealInfo getSchedule() { | ||
| 209 | + return schedule; | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | + public void setSchedule(ScheduleRealInfo schedule) { | ||
| 213 | + this.schedule = schedule; | ||
| 214 | + } | ||
| 215 | + | ||
| 216 | + public String getRemarks() { | ||
| 217 | + return remarks; | ||
| 218 | + } | ||
| 219 | + | ||
| 220 | + public void setRemarks(String remarks) { | ||
| 221 | + this.remarks = remarks; | ||
| 222 | + } | ||
| 223 | + | ||
| 224 | + public String getStartStationName() { | ||
| 225 | + return startStationName; | ||
| 226 | + } | ||
| 227 | + | ||
| 228 | + public void setStartStationName(String startStationName) { | ||
| 229 | + this.startStationName = startStationName; | ||
| 230 | + } | ||
| 231 | + | ||
| 232 | + public String getEndStationName() { | ||
| 233 | + return endStationName; | ||
| 234 | + } | ||
| 235 | + | ||
| 236 | + public void setEndStationName(String endStationName) { | ||
| 237 | + this.endStationName = endStationName; | ||
| 238 | + } | ||
| 239 | + | ||
| 240 | + @Override | ||
| 241 | + public int hashCode() { | ||
| 242 | + return ("cTask" + this.getId() + this.getSchedule().getId()).hashCode(); | ||
| 243 | + } | ||
| 244 | + | ||
| 245 | + @Override | ||
| 246 | + public boolean equals(Object obj) { | ||
| 247 | + return this.id.equals(((ChildTaskPlan)obj).getId()); | ||
| 248 | + } | ||
| 249 | + | ||
| 250 | + public Date getCreateDate() { | ||
| 251 | + return createDate; | ||
| 252 | + } | ||
| 253 | + | ||
| 254 | + public void setCreateDate(Date createDate) { | ||
| 255 | + this.createDate = createDate; | ||
| 256 | + } | ||
| 257 | + | ||
| 258 | + public String getReason() { | ||
| 259 | + return reason; | ||
| 260 | + } | ||
| 261 | + | ||
| 262 | + public void setReason(String reason) { | ||
| 263 | + this.reason = reason; | ||
| 264 | + } | ||
| 265 | + | ||
| 266 | + public String getNbbm() { | ||
| 267 | + return nbbm; | ||
| 268 | + } | ||
| 269 | + | ||
| 270 | + public void setNbbm(String nbbm) { | ||
| 271 | + this.nbbm = nbbm; | ||
| 272 | + } | ||
| 273 | + | ||
| 274 | + public boolean isNoClerk() { | ||
| 275 | + return noClerk; | ||
| 276 | + } | ||
| 277 | + | ||
| 278 | + public void setNoClerk(boolean noClerk) { | ||
| 279 | + this.noClerk = noClerk; | ||
| 280 | + } | ||
| 281 | +} |
src/main/java/com/bsth/entity/Equipment.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/entity/Equipment.java | ||
| 1 | +package com.bsth.entity; | ||
| 2 | +/** | ||
| 3 | + * @ClassName: Equipment.java | ||
| 4 | + * @Description: TODO(车辆自编号to设备号) | ||
| 5 | + * @author: YouRuiFeng | ||
| 6 | + * @date: 2017-8-30 下午7:36:07 | ||
| 7 | + * | ||
| 8 | + */ | ||
| 9 | +public class Equipment { | ||
| 10 | + | ||
| 11 | + private String inside_code; | ||
| 12 | + | ||
| 13 | + private String equipment_code; | ||
| 14 | + | ||
| 15 | + public String getInside_code() { | ||
| 16 | + return inside_code; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + public void setInside_code(String inside_code) { | ||
| 20 | + this.inside_code = inside_code; | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + public String getEquipment_code() { | ||
| 24 | + return equipment_code; | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + public void setEquipment_code(String equipment_code) { | ||
| 28 | + this.equipment_code = equipment_code; | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | +} |
src/main/java/com/bsth/entity/SchedulePlanInfo.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/entity/SchedulePlanInfo.java | ||
| 1 | +package com.bsth.entity; | ||
| 2 | + | ||
| 3 | +import javax.persistence.Column; | ||
| 4 | +import javax.persistence.Entity; | ||
| 5 | +import javax.persistence.GeneratedValue; | ||
| 6 | +import javax.persistence.Id; | ||
| 7 | +import javax.persistence.Table; | ||
| 8 | +import java.sql.PreparedStatement; | ||
| 9 | +import java.sql.SQLException; | ||
| 10 | +import java.sql.Types; | ||
| 11 | +import java.util.Date; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * 排班计划明细。 | ||
| 15 | + * 内部字段全冗余,无关联对象(外键关联关系), | ||
| 16 | + * 可以单独存在,其余表要关联此对象/表,必须使用中间对象/表。 | ||
| 17 | + */ | ||
| 18 | +//@Entity | ||
| 19 | +//@Table(name = "bsth_c_s_sp_info") | ||
| 20 | +public class SchedulePlanInfo { | ||
| 21 | + | ||
| 22 | + /** 主键Id */ | ||
| 23 | + @Id | ||
| 24 | + @GeneratedValue | ||
| 25 | + private Long id; | ||
| 26 | + | ||
| 27 | + /** 排班计划日期 */ | ||
| 28 | + @Column(nullable = false) | ||
| 29 | + private Date scheduleDate; | ||
| 30 | + | ||
| 31 | + /** 关联的公司名称 */ | ||
| 32 | + private String gsName; | ||
| 33 | + /** 关联的公司编码 */ | ||
| 34 | + private String gsBm; | ||
| 35 | + /** 关联的分公司名称 */ | ||
| 36 | + private String fgsName; | ||
| 37 | + /** 关联的分公司编码 */ | ||
| 38 | + private String fgsBm; | ||
| 39 | + /** 出场顺序号 */ | ||
| 40 | + private Integer ccno; | ||
| 41 | + | ||
| 42 | + /** 关联 bsth_c_line 主键,不做mapping */ | ||
| 43 | + @Column(nullable = false) | ||
| 44 | + private Integer xl; | ||
| 45 | + /** 线路名称 */ | ||
| 46 | + @Column(nullable = false) | ||
| 47 | + private String xlName; | ||
| 48 | + /** 线路编码 */ | ||
| 49 | + @Column(nullable = false) | ||
| 50 | + private String xlBm; | ||
| 51 | + | ||
| 52 | + /** 关联 bsth_c_s_gbi 主键,不做mapping */ | ||
| 53 | + @Column(nullable = false) | ||
| 54 | + private Long lp; | ||
| 55 | + /** 路牌名称 */ | ||
| 56 | + @Column(nullable = false) | ||
| 57 | + private String lpName; | ||
| 58 | + | ||
| 59 | + /** 关联 bsth_c_cars 主键,不做mapping */ | ||
| 60 | + @Column(nullable = false) | ||
| 61 | + private Integer cl; | ||
| 62 | + /** 车辆自编号 */ | ||
| 63 | + @Column(nullable = false) | ||
| 64 | + private String clZbh; | ||
| 65 | + | ||
| 66 | + /** 当分班的时候,驾驶员会不一样,具体根据规则,还有时刻表决定 */ | ||
| 67 | + /** 报道时间(格式 HH:mm) */ | ||
| 68 | + private String bdTime; | ||
| 69 | + /** 出场时间(格式 HH:mm) */ | ||
| 70 | + private String ccTime; | ||
| 71 | + /** 关联的驾驶员 bsth_c_personnel 主键,不做mapping */ | ||
| 72 | + @Column(nullable = false) | ||
| 73 | + private Integer j; | ||
| 74 | + /** 驾驶员工号 */ | ||
| 75 | + @Column(nullable = false) | ||
| 76 | + private String jGh; | ||
| 77 | + /** 驾驶员名字 */ | ||
| 78 | + @Column(nullable = false) | ||
| 79 | + private String jName; | ||
| 80 | + /** 关联的售票员 bsth_c_personnel 主键,不做mapping */ | ||
| 81 | + private Integer s; | ||
| 82 | + /** 售票员工号 */ | ||
| 83 | + private String sGh; | ||
| 84 | + /** 售票员名字 */ | ||
| 85 | + private String sName; | ||
| 86 | + | ||
| 87 | + // 冗余的时刻明细信息,不做mapping | ||
| 88 | + /** 线路方向(TODO:上下行,上行,下行,这个以后用枚举还是字典再议,现在先用文字) */ | ||
| 89 | + @Column(nullable = false) | ||
| 90 | + private String xlDir; | ||
| 91 | + /** 起点站id,根据班次类型,会关联 bsth_c_station,或 bsth_c_car_park,不做mapping */ | ||
| 92 | + // 这个字段以后不用了 | ||
| 93 | +// @Column(nullable = false) | ||
| 94 | +// private Integer qdz; | ||
| 95 | + /** 起点站code */ | ||
| 96 | + private String qdzCode; | ||
| 97 | + /** 起点站名字 */ | ||
| 98 | + @Column(nullable = false) | ||
| 99 | + private String qdzName; | ||
| 100 | + /** 终点站id,根据班次类型,会关联 bsth_c_station,或 bsth_c_car_park,不做mapping */ | ||
| 101 | + // 这个字段以后不用了 | ||
| 102 | +// @Column(nullable = false) | ||
| 103 | +// private Integer zdz; | ||
| 104 | + /** 终点站code */ | ||
| 105 | + private String zdzCode; | ||
| 106 | + /** 终点站名字 */ | ||
| 107 | + @Column(nullable = false) | ||
| 108 | + private String zdzName; | ||
| 109 | + | ||
| 110 | + /** 发车时间(格式 HH:mm) */ | ||
| 111 | + @Column(nullable = false) | ||
| 112 | + private String fcsj; | ||
| 113 | + /** 发车顺序号 */ | ||
| 114 | + @Column(nullable = false) | ||
| 115 | + private Integer fcno; | ||
| 116 | + /** 对应班次数 */ | ||
| 117 | + @Column(nullable = false) | ||
| 118 | + private Integer bcs; | ||
| 119 | + /** 计划里程 */ | ||
| 120 | + private Double jhlc; | ||
| 121 | + /** 班次历时 */ | ||
| 122 | + private Integer bcsj; | ||
| 123 | + | ||
| 124 | + /** 班次类型 字典type=ScheduleType */ | ||
| 125 | + @Column(nullable = false) | ||
| 126 | + private String bcType; | ||
| 127 | + | ||
| 128 | + // 重要的新增字段 | ||
| 129 | + /** 关联的时刻表id */ | ||
| 130 | + private Long ttInfo; | ||
| 131 | + /** 关联的时刻表名字 */ | ||
| 132 | + private String ttInfoName; | ||
| 133 | + | ||
| 134 | + /** 时刻表的明细备注 */ | ||
| 135 | + private String remark; | ||
| 136 | + | ||
| 137 | + //---------------- 修改时使用的字段 -----------------// | ||
| 138 | + /** 调整原因(在调度执勤日报页面中修改,选择营运状态) */ | ||
| 139 | + private Integer modifyReason; | ||
| 140 | + /** 调整的备注(在调度执勤日报页面中修改,与时刻表的班次备注区分开) */ | ||
| 141 | + private String modifyRemark; | ||
| 142 | + /** 调整的次数(在调度执勤日报页面,排班计划明细里,改的话都会增加) */ | ||
| 143 | + private Integer modifyCount; | ||
| 144 | + | ||
| 145 | + public void preparedStatementSet(PreparedStatement ps) throws SQLException { | ||
| 146 | + if (this.scheduleDate != null) ps.setDate(1, new java.sql.Date(this.scheduleDate.getTime())); else ps.setNull(1, Types.DATE); | ||
| 147 | + if (this.gsName != null) ps.setString(2, this.gsName); else ps.setNull(2, Types.VARCHAR); | ||
| 148 | + if (this.gsBm != null) ps.setString(3, this.gsBm); else ps.setNull(3, Types.VARCHAR); | ||
| 149 | + if (this.fgsName != null) ps.setString(4, this.fgsName); else ps.setNull(4, Types.VARCHAR); | ||
| 150 | + if (this.fgsBm != null) ps.setString(5, this.fgsBm); else ps.setNull(5, Types.VARCHAR); | ||
| 151 | + if (this.ccno != null) ps.setInt(6, this.ccno); else ps.setNull(6, Types.INTEGER); | ||
| 152 | + if (this.xl != null) ps.setInt(7, this.xl); else ps.setNull(7, Types.INTEGER); | ||
| 153 | + if (this.xlName != null) ps.setString(8, this.xlName); else ps.setNull(8, Types.VARCHAR); | ||
| 154 | + if (this.xlBm != null) ps.setString(9, this.xlBm); else ps.setNull(9, Types.VARCHAR); | ||
| 155 | + if (this.lp != null) ps.setLong(10, this.lp); else ps.setNull(10, Types.BIGINT); | ||
| 156 | + if (this.lpName != null) ps.setString(11, this.lpName); else ps.setNull(11, Types.VARCHAR); | ||
| 157 | + if (this.cl != null) ps.setInt(12, this.cl); else ps.setNull(12, Types.INTEGER); | ||
| 158 | + if (this.clZbh != null) ps.setString(13, this.clZbh); else ps.setNull(13, Types.VARCHAR); | ||
| 159 | + if (this.bdTime != null) ps.setString(14, this.bdTime); else ps.setNull(14, Types.VARCHAR); | ||
| 160 | + if (this.ccTime != null) ps.setString(15, this.ccTime); else ps.setNull(15, Types.VARCHAR); | ||
| 161 | + if (this.j != null) ps.setInt(16, this.j); else ps.setNull(16, Types.INTEGER); | ||
| 162 | + if (this.jGh != null) ps.setString(17, this.jGh); else ps.setNull(17, Types.VARCHAR); | ||
| 163 | + if (this.jName != null) ps.setString(18, this.jName); else ps.setNull(18, Types.VARCHAR); | ||
| 164 | + if (this.s != null) ps.setInt(19, this.s); else ps.setNull(19, Types.INTEGER); | ||
| 165 | + if (this.sGh != null) ps.setString(20, this.sGh); else ps.setNull(20, Types.VARCHAR); | ||
| 166 | + if (this.sName != null) ps.setString(21, this.sName); else ps.setNull(21, Types.VARCHAR); | ||
| 167 | + if (this.xlDir != null) ps.setString(22, this.xlDir); else ps.setNull(22, Types.VARCHAR); | ||
| 168 | + if (this.qdzCode != null) ps.setString(23, this.qdzCode); else ps.setNull(23, Types.VARCHAR); | ||
| 169 | + if (this.qdzName != null) ps.setString(24, this.qdzName); else ps.setNull(24, Types.VARCHAR); | ||
| 170 | + if (this.zdzCode != null) ps.setString(25, this.zdzCode); else ps.setNull(25, Types.VARCHAR); | ||
| 171 | + if (this.zdzName != null) ps.setString(26, this.zdzName); else ps.setNull(26, Types.VARCHAR); | ||
| 172 | + if (this.fcsj != null) ps.setString(27, this.fcsj); else ps.setNull(27, Types.VARCHAR); | ||
| 173 | + if (this.fcno != null) ps.setInt(28, this.fcno); else ps.setNull(28, Types.INTEGER); | ||
| 174 | + if (this.bcs != null) ps.setInt(29, this.bcs); else ps.setNull(29, Types.INTEGER); | ||
| 175 | + if (this.jhlc != null) ps.setDouble(30, this.jhlc); else ps.setNull(30, Types.DOUBLE); | ||
| 176 | + if (this.bcsj != null) ps.setInt(31, this.bcsj); else ps.setNull(31, Types.INTEGER); | ||
| 177 | + if (this.bcType != null) ps.setString(32, this.bcType); else ps.setNull(32, Types.VARCHAR); | ||
| 178 | + if (this.ttInfo != null) ps.setLong(33, this.ttInfo); else ps.setNull(33, Types.BIGINT); | ||
| 179 | + if (this.ttInfoName != null) ps.setString(34, this.ttInfoName); else ps.setNull(34, Types.VARCHAR); | ||
| 180 | + if (this.remark != null) ps.setString(35, this.remark); else ps.setNull(35, Types.VARCHAR); | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + public Long getId() { | ||
| 184 | + return id; | ||
| 185 | + } | ||
| 186 | + | ||
| 187 | + public void setId(Long id) { | ||
| 188 | + this.id = id; | ||
| 189 | + } | ||
| 190 | + | ||
| 191 | + public Date getScheduleDate() { | ||
| 192 | + return scheduleDate; | ||
| 193 | + } | ||
| 194 | + | ||
| 195 | + public void setScheduleDate(Date scheduleDate) { | ||
| 196 | + this.scheduleDate = scheduleDate; | ||
| 197 | + } | ||
| 198 | + | ||
| 199 | + public String getGsName() { | ||
| 200 | + return gsName; | ||
| 201 | + } | ||
| 202 | + | ||
| 203 | + public void setGsName(String gsName) { | ||
| 204 | + this.gsName = gsName; | ||
| 205 | + } | ||
| 206 | + | ||
| 207 | + public String getGsBm() { | ||
| 208 | + return gsBm; | ||
| 209 | + } | ||
| 210 | + | ||
| 211 | + public void setGsBm(String gsBm) { | ||
| 212 | + this.gsBm = gsBm; | ||
| 213 | + } | ||
| 214 | + | ||
| 215 | + public String getFgsName() { | ||
| 216 | + return fgsName; | ||
| 217 | + } | ||
| 218 | + | ||
| 219 | + public void setFgsName(String fgsName) { | ||
| 220 | + this.fgsName = fgsName; | ||
| 221 | + } | ||
| 222 | + | ||
| 223 | + public String getFgsBm() { | ||
| 224 | + return fgsBm; | ||
| 225 | + } | ||
| 226 | + | ||
| 227 | + public void setFgsBm(String fgsBm) { | ||
| 228 | + this.fgsBm = fgsBm; | ||
| 229 | + } | ||
| 230 | + | ||
| 231 | + public Integer getCcno() { | ||
| 232 | + return ccno; | ||
| 233 | + } | ||
| 234 | + | ||
| 235 | + public void setCcno(Integer ccno) { | ||
| 236 | + this.ccno = ccno; | ||
| 237 | + } | ||
| 238 | + | ||
| 239 | + public Integer getXl() { | ||
| 240 | + return xl; | ||
| 241 | + } | ||
| 242 | + | ||
| 243 | + public void setXl(Integer xl) { | ||
| 244 | + this.xl = xl; | ||
| 245 | + } | ||
| 246 | + | ||
| 247 | + public String getXlName() { | ||
| 248 | + return xlName; | ||
| 249 | + } | ||
| 250 | + | ||
| 251 | + public void setXlName(String xlName) { | ||
| 252 | + this.xlName = xlName; | ||
| 253 | + } | ||
| 254 | + | ||
| 255 | + public String getXlBm() { | ||
| 256 | + return xlBm; | ||
| 257 | + } | ||
| 258 | + | ||
| 259 | + public void setXlBm(String xlBm) { | ||
| 260 | + this.xlBm = xlBm; | ||
| 261 | + } | ||
| 262 | + | ||
| 263 | + public Long getLp() { | ||
| 264 | + return lp; | ||
| 265 | + } | ||
| 266 | + | ||
| 267 | + public void setLp(Long lp) { | ||
| 268 | + this.lp = lp; | ||
| 269 | + } | ||
| 270 | + | ||
| 271 | + public String getLpName() { | ||
| 272 | + return lpName; | ||
| 273 | + } | ||
| 274 | + | ||
| 275 | + public void setLpName(String lpName) { | ||
| 276 | + this.lpName = lpName; | ||
| 277 | + } | ||
| 278 | + | ||
| 279 | + public Integer getCl() { | ||
| 280 | + return cl; | ||
| 281 | + } | ||
| 282 | + | ||
| 283 | + public void setCl(Integer cl) { | ||
| 284 | + this.cl = cl; | ||
| 285 | + } | ||
| 286 | + | ||
| 287 | + public String getClZbh() { | ||
| 288 | + return clZbh; | ||
| 289 | + } | ||
| 290 | + | ||
| 291 | + public void setClZbh(String clZbh) { | ||
| 292 | + this.clZbh = clZbh; | ||
| 293 | + } | ||
| 294 | + | ||
| 295 | + public String getBdTime() { | ||
| 296 | + return bdTime; | ||
| 297 | + } | ||
| 298 | + | ||
| 299 | + public void setBdTime(String bdTime) { | ||
| 300 | + this.bdTime = bdTime; | ||
| 301 | + } | ||
| 302 | + | ||
| 303 | + public String getCcTime() { | ||
| 304 | + return ccTime; | ||
| 305 | + } | ||
| 306 | + | ||
| 307 | + public void setCcTime(String ccTime) { | ||
| 308 | + this.ccTime = ccTime; | ||
| 309 | + } | ||
| 310 | + | ||
| 311 | + public Integer getJ() { | ||
| 312 | + return j; | ||
| 313 | + } | ||
| 314 | + | ||
| 315 | + public void setJ(Integer j) { | ||
| 316 | + this.j = j; | ||
| 317 | + } | ||
| 318 | + | ||
| 319 | + public String getjGh() { | ||
| 320 | + return jGh; | ||
| 321 | + } | ||
| 322 | + | ||
| 323 | + public void setjGh(String jGh) { | ||
| 324 | + this.jGh = jGh; | ||
| 325 | + } | ||
| 326 | + | ||
| 327 | + public String getjName() { | ||
| 328 | + return jName; | ||
| 329 | + } | ||
| 330 | + | ||
| 331 | + public void setjName(String jName) { | ||
| 332 | + this.jName = jName; | ||
| 333 | + } | ||
| 334 | + | ||
| 335 | + public Integer getS() { | ||
| 336 | + return s; | ||
| 337 | + } | ||
| 338 | + | ||
| 339 | + public void setS(Integer s) { | ||
| 340 | + this.s = s; | ||
| 341 | + } | ||
| 342 | + | ||
| 343 | + public String getsGh() { | ||
| 344 | + return sGh; | ||
| 345 | + } | ||
| 346 | + | ||
| 347 | + public void setsGh(String sGh) { | ||
| 348 | + this.sGh = sGh; | ||
| 349 | + } | ||
| 350 | + | ||
| 351 | + public String getsName() { | ||
| 352 | + return sName; | ||
| 353 | + } | ||
| 354 | + | ||
| 355 | + public void setsName(String sName) { | ||
| 356 | + this.sName = sName; | ||
| 357 | + } | ||
| 358 | + | ||
| 359 | + public String getXlDir() { | ||
| 360 | + return xlDir; | ||
| 361 | + } | ||
| 362 | + | ||
| 363 | + public void setXlDir(String xlDir) { | ||
| 364 | + this.xlDir = xlDir; | ||
| 365 | + } | ||
| 366 | + | ||
| 367 | + public String getQdzCode() { | ||
| 368 | + return qdzCode; | ||
| 369 | + } | ||
| 370 | + | ||
| 371 | + public void setQdzCode(String qdzCode) { | ||
| 372 | + this.qdzCode = qdzCode; | ||
| 373 | + } | ||
| 374 | + | ||
| 375 | + public String getQdzName() { | ||
| 376 | + return qdzName; | ||
| 377 | + } | ||
| 378 | + | ||
| 379 | + public void setQdzName(String qdzName) { | ||
| 380 | + this.qdzName = qdzName; | ||
| 381 | + } | ||
| 382 | + | ||
| 383 | + public String getZdzCode() { | ||
| 384 | + return zdzCode; | ||
| 385 | + } | ||
| 386 | + | ||
| 387 | + public void setZdzCode(String zdzCode) { | ||
| 388 | + this.zdzCode = zdzCode; | ||
| 389 | + } | ||
| 390 | + | ||
| 391 | + public String getZdzName() { | ||
| 392 | + return zdzName; | ||
| 393 | + } | ||
| 394 | + | ||
| 395 | + public void setZdzName(String zdzName) { | ||
| 396 | + this.zdzName = zdzName; | ||
| 397 | + } | ||
| 398 | + | ||
| 399 | + public String getFcsj() { | ||
| 400 | + return fcsj; | ||
| 401 | + } | ||
| 402 | + | ||
| 403 | + public void setFcsj(String fcsj) { | ||
| 404 | + this.fcsj = fcsj; | ||
| 405 | + } | ||
| 406 | + | ||
| 407 | + public Integer getFcno() { | ||
| 408 | + return fcno; | ||
| 409 | + } | ||
| 410 | + | ||
| 411 | + public void setFcno(Integer fcno) { | ||
| 412 | + this.fcno = fcno; | ||
| 413 | + } | ||
| 414 | + | ||
| 415 | + public Integer getBcs() { | ||
| 416 | + return bcs; | ||
| 417 | + } | ||
| 418 | + | ||
| 419 | + public void setBcs(Integer bcs) { | ||
| 420 | + this.bcs = bcs; | ||
| 421 | + } | ||
| 422 | + | ||
| 423 | + public Double getJhlc() { | ||
| 424 | + return jhlc; | ||
| 425 | + } | ||
| 426 | + | ||
| 427 | + public void setJhlc(Double jhlc) { | ||
| 428 | + this.jhlc = jhlc; | ||
| 429 | + } | ||
| 430 | + | ||
| 431 | + public Integer getBcsj() { | ||
| 432 | + return bcsj; | ||
| 433 | + } | ||
| 434 | + | ||
| 435 | + public void setBcsj(Integer bcsj) { | ||
| 436 | + this.bcsj = bcsj; | ||
| 437 | + } | ||
| 438 | + | ||
| 439 | + public String getBcType() { | ||
| 440 | + return bcType; | ||
| 441 | + } | ||
| 442 | + | ||
| 443 | + public void setBcType(String bcType) { | ||
| 444 | + this.bcType = bcType; | ||
| 445 | + } | ||
| 446 | + | ||
| 447 | + public Long getTtInfo() { | ||
| 448 | + return ttInfo; | ||
| 449 | + } | ||
| 450 | + | ||
| 451 | + public void setTtInfo(Long ttInfo) { | ||
| 452 | + this.ttInfo = ttInfo; | ||
| 453 | + } | ||
| 454 | + | ||
| 455 | + public String getTtInfoName() { | ||
| 456 | + return ttInfoName; | ||
| 457 | + } | ||
| 458 | + | ||
| 459 | + public void setTtInfoName(String ttInfoName) { | ||
| 460 | + this.ttInfoName = ttInfoName; | ||
| 461 | + } | ||
| 462 | + | ||
| 463 | + public String getRemark() { | ||
| 464 | + return remark; | ||
| 465 | + } | ||
| 466 | + | ||
| 467 | + public void setRemark(String remark) { | ||
| 468 | + this.remark = remark; | ||
| 469 | + } | ||
| 470 | + | ||
| 471 | + public Integer getModifyReason() { | ||
| 472 | + return modifyReason; | ||
| 473 | + } | ||
| 474 | + | ||
| 475 | + public void setModifyReason(Integer modifyReason) { | ||
| 476 | + this.modifyReason = modifyReason; | ||
| 477 | + } | ||
| 478 | + | ||
| 479 | + public String getModifyRemark() { | ||
| 480 | + return modifyRemark; | ||
| 481 | + } | ||
| 482 | + | ||
| 483 | + public void setModifyRemark(String modifyRemark) { | ||
| 484 | + this.modifyRemark = modifyRemark; | ||
| 485 | + } | ||
| 486 | + | ||
| 487 | + public Integer getModifyCount() { | ||
| 488 | + return modifyCount; | ||
| 489 | + } | ||
| 490 | + | ||
| 491 | + public void setModifyCount(Integer modifyCount) { | ||
| 492 | + this.modifyCount = modifyCount; | ||
| 493 | + } | ||
| 494 | +} |
src/main/java/com/bsth/entity/ScheduleRealInfo.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/entity/ScheduleRealInfo.java | ||
| 1 | +package com.bsth.entity; | ||
| 2 | + | ||
| 3 | +import org.joda.time.format.DateTimeFormat; | ||
| 4 | +import org.joda.time.format.DateTimeFormatter; | ||
| 5 | + | ||
| 6 | +import javax.persistence.Entity; | ||
| 7 | +import javax.persistence.FetchType; | ||
| 8 | +import javax.persistence.Id; | ||
| 9 | +import javax.persistence.OneToMany; | ||
| 10 | +import javax.persistence.Table; | ||
| 11 | +import javax.persistence.Transient; | ||
| 12 | +import java.io.Serializable; | ||
| 13 | +import java.util.Date; | ||
| 14 | +import java.util.HashSet; | ||
| 15 | +import java.util.Set; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * 实际排班计划明细。 | ||
| 19 | + */ | ||
| 20 | +@Entity | ||
| 21 | +@Table(name = "bsth_c_s_sp_info_real") | ||
| 22 | +//@NamedEntityGraphs({ | ||
| 23 | +// @NamedEntityGraph(name = "scheduleRealInfo_cTasks", attributeNodes = { | ||
| 24 | +// @NamedAttributeNode("cTasks") | ||
| 25 | +// }) | ||
| 26 | +//}) | ||
| 27 | +public class ScheduleRealInfo implements Serializable{ | ||
| 28 | + | ||
| 29 | + | ||
| 30 | + /** 主键Id */ | ||
| 31 | + @Id | ||
| 32 | + private Long id; | ||
| 33 | + | ||
| 34 | + /** 计划ID */ | ||
| 35 | + private Long spId; | ||
| 36 | + | ||
| 37 | + /** 排班计划日期 */ | ||
| 38 | + private Date scheduleDate; | ||
| 39 | + private String scheduleDateStr; | ||
| 40 | + | ||
| 41 | + /** 真实执行时间 yyyy-MM-dd */ | ||
| 42 | + private String realExecDate; | ||
| 43 | + | ||
| 44 | + /** 线路名称 */ | ||
| 45 | + private String xlName; | ||
| 46 | + /** 线路编码 */ | ||
| 47 | + private String xlBm; | ||
| 48 | + | ||
| 49 | + /** 路牌名称 */ | ||
| 50 | + private String lpName; | ||
| 51 | + | ||
| 52 | + /** 立牌发车顺序 */ | ||
| 53 | + private String fcno; | ||
| 54 | + | ||
| 55 | + /** 停站时间 */ | ||
| 56 | + @Transient | ||
| 57 | + private Integer tzsjActual; | ||
| 58 | + /** 计划停站时间 */ | ||
| 59 | + @Transient | ||
| 60 | + private Integer tzsj; | ||
| 61 | + /** 相对停站时间 */ | ||
| 62 | + @Transient | ||
| 63 | + private Integer xdtzsj; | ||
| 64 | + | ||
| 65 | + /** 车辆自编号 */ | ||
| 66 | + private String clZbh; | ||
| 67 | + | ||
| 68 | + /** 设备终端号*/ | ||
| 69 | + @Transient | ||
| 70 | + private String equipment_code; | ||
| 71 | + | ||
| 72 | + /** 驾驶员工号 */ | ||
| 73 | + private String jGh; | ||
| 74 | + /** 驾驶员名字 */ | ||
| 75 | + private String jName; | ||
| 76 | + /** 售票员工号 */ | ||
| 77 | + private String sGh; | ||
| 78 | + /** 售票员名字 */ | ||
| 79 | + private String sName; | ||
| 80 | + | ||
| 81 | + /** 线路方向 */ | ||
| 82 | + private String xlDir; | ||
| 83 | + /** 起点站code*/ | ||
| 84 | + private String qdzCode; | ||
| 85 | + /** 起点站名字 */ | ||
| 86 | + private String qdzName; | ||
| 87 | + | ||
| 88 | + /** 终点站code*/ | ||
| 89 | + private String zdzCode; | ||
| 90 | + /** 终点站名字 */ | ||
| 91 | + private String zdzName; | ||
| 92 | + | ||
| 93 | + /** 计划发车时间(格式 HH:mm) */ | ||
| 94 | + private String fcsj; | ||
| 95 | + /** 计划发车时间戳*/ | ||
| 96 | + @Transient | ||
| 97 | + private Long fcsjT; | ||
| 98 | + | ||
| 99 | + /** 计划终点时间(格式 HH:mm) */ | ||
| 100 | + private String zdsj; | ||
| 101 | + /** 计划终点时间戳*/ | ||
| 102 | + @Transient | ||
| 103 | + private Long zdsjT; | ||
| 104 | + | ||
| 105 | + /** 计划里程 */ | ||
| 106 | + private Double jhlc; | ||
| 107 | + | ||
| 108 | + /** 原始计划里程 (原计调的数据) */ | ||
| 109 | + private Double jhlcOrig; | ||
| 110 | + | ||
| 111 | + /** 班次历时 */ | ||
| 112 | + private Integer bcsj; | ||
| 113 | + | ||
| 114 | + /** | ||
| 115 | + * 班次类型 TODO:正常班次、出场、进场、加油、区间班次、放空班次、放大站班次、两点间空驶 | ||
| 116 | + */ | ||
| 117 | + private String bcType; | ||
| 118 | + | ||
| 119 | + /** 实际发车时间*/ | ||
| 120 | + private String fcsjActual; | ||
| 121 | + /** 实际发车时间戳*/ | ||
| 122 | + @Transient | ||
| 123 | + private Long fcsjActualTime; | ||
| 124 | + /**实际终点时间 */ | ||
| 125 | + private String zdsjActual; | ||
| 126 | + /** 实际终点时间戳*/ | ||
| 127 | + @Transient | ||
| 128 | + private Long zdsjActualTime; | ||
| 129 | + | ||
| 130 | + /**班次状态 0 未执行 1 正在执行 2 已执行 -1 已烂班 */ | ||
| 131 | + private int status; | ||
| 132 | + | ||
| 133 | + private String adjustExps; | ||
| 134 | + | ||
| 135 | + /** 是否是临加班次 */ | ||
| 136 | + private boolean sflj; | ||
| 137 | + | ||
| 138 | + /** 备注*/ | ||
| 139 | + private String remarks; | ||
| 140 | + | ||
| 141 | + /**待发时间(格式 HH:mm) */ | ||
| 142 | + private String dfsj; | ||
| 143 | + | ||
| 144 | + //待发调试(是否自动调整) | ||
| 145 | + private boolean dfAuto; | ||
| 146 | + | ||
| 147 | + /**计划用时 */ | ||
| 148 | + @Transient | ||
| 149 | + private int jhTime; | ||
| 150 | + /**实际用时 */ | ||
| 151 | + @Transient | ||
| 152 | + private int sjTime; | ||
| 153 | + | ||
| 154 | + /**待发时间戳 */ | ||
| 155 | + @Transient | ||
| 156 | + private Long dfsjT; | ||
| 157 | + | ||
| 158 | + /** 指令下发状态 60: 已发送, 100: 设备确认收到, 200:驾驶员确认 0:失败 */ | ||
| 159 | + private Integer directiveState = -1; | ||
| 160 | +// | ||
| 161 | +// /** 子任务 */ | ||
| 162 | +// @OneToMany(fetch = FetchType.LAZY, mappedBy = "schedule") | ||
| 163 | +// private Set<ChildTaskPlan> cTasks = new HashSet<>(); | ||
| 164 | + | ||
| 165 | + /** 关联的公司名称 */ | ||
| 166 | + private String gsName; | ||
| 167 | + /** 关联的公司编码 */ | ||
| 168 | + private String gsBm; | ||
| 169 | + /** 关联的分公司名称 */ | ||
| 170 | + private String fgsName; | ||
| 171 | + /** 关联的分公司编码 */ | ||
| 172 | + private String fgsBm; | ||
| 173 | + | ||
| 174 | + /** | ||
| 175 | + * 漂移状态 | ||
| 176 | + * 1: 发车漂移 | ||
| 177 | + * 2:到站漂移 | ||
| 178 | + * 3:中途漂移 | ||
| 179 | + */ | ||
| 180 | + private int driftStatus = 0; | ||
| 181 | + | ||
| 182 | + | ||
| 183 | + //车牌设备号 | ||
| 184 | + @Transient | ||
| 185 | + private String equipmentCode; | ||
| 186 | + | ||
| 187 | + | ||
| 188 | + //班次类型 | ||
| 189 | + //平日假日 | ||
| 190 | + @Transient | ||
| 191 | + private String ttInfoName; | ||
| 192 | + | ||
| 193 | + | ||
| 194 | + public String getTtInfoName() { | ||
| 195 | + return ttInfoName; | ||
| 196 | + } | ||
| 197 | + public void setTtInfoName(String ttInfoName) { | ||
| 198 | + this.ttInfoName = ttInfoName; | ||
| 199 | + } | ||
| 200 | + | ||
| 201 | + public boolean isDfAuto() { | ||
| 202 | + return dfAuto; | ||
| 203 | + } | ||
| 204 | + | ||
| 205 | + public void setDfAuto(boolean dfAuto) { | ||
| 206 | + this.dfAuto = dfAuto; | ||
| 207 | + } | ||
| 208 | + | ||
| 209 | + public boolean isDestroy(){ | ||
| 210 | + return this.status == -1; | ||
| 211 | + } | ||
| 212 | + | ||
| 213 | + @Override | ||
| 214 | + public int hashCode() { | ||
| 215 | + return (this.id + this.scheduleDateStr + this.xlBm + this.fcsj).hashCode(); | ||
| 216 | + } | ||
| 217 | + | ||
| 218 | + @Override | ||
| 219 | + public boolean equals(Object obj) { | ||
| 220 | + return this.id.equals(((ScheduleRealInfo)obj).getId()); | ||
| 221 | + } | ||
| 222 | + | ||
| 223 | + public Long getId() { | ||
| 224 | + return id; | ||
| 225 | + } | ||
| 226 | + | ||
| 227 | + public void setId(Long id) { | ||
| 228 | + this.id = id; | ||
| 229 | + } | ||
| 230 | + | ||
| 231 | + public Long getSpId() { | ||
| 232 | + return spId; | ||
| 233 | + } | ||
| 234 | + | ||
| 235 | + public void setSpId(Long spId) { | ||
| 236 | + this.spId = spId; | ||
| 237 | + } | ||
| 238 | + | ||
| 239 | + public Date getScheduleDate() { | ||
| 240 | + return scheduleDate; | ||
| 241 | + } | ||
| 242 | + | ||
| 243 | + public void setScheduleDate(Date scheduleDate) { | ||
| 244 | + this.scheduleDate = scheduleDate; | ||
| 245 | + } | ||
| 246 | + | ||
| 247 | + public String getScheduleDateStr() { | ||
| 248 | + return scheduleDateStr; | ||
| 249 | + } | ||
| 250 | + | ||
| 251 | + public void setScheduleDateStr(String scheduleDateStr) { | ||
| 252 | + this.scheduleDateStr = scheduleDateStr; | ||
| 253 | + } | ||
| 254 | + | ||
| 255 | + public String getRealExecDate() { | ||
| 256 | + return realExecDate; | ||
| 257 | + } | ||
| 258 | + | ||
| 259 | + public void setRealExecDate(String realExecDate) { | ||
| 260 | + this.realExecDate = realExecDate; | ||
| 261 | + } | ||
| 262 | + | ||
| 263 | + public String getXlName() { | ||
| 264 | + return xlName; | ||
| 265 | + } | ||
| 266 | + | ||
| 267 | + public void setXlName(String xlName) { | ||
| 268 | + this.xlName = xlName; | ||
| 269 | + } | ||
| 270 | + | ||
| 271 | + public String getXlBm() { | ||
| 272 | + return xlBm; | ||
| 273 | + } | ||
| 274 | + | ||
| 275 | + public void setXlBm(String xlBm) { | ||
| 276 | + this.xlBm = xlBm; | ||
| 277 | + } | ||
| 278 | + | ||
| 279 | + public String getLpName() { | ||
| 280 | + return lpName; | ||
| 281 | + } | ||
| 282 | + | ||
| 283 | + public void setLpName(String lpName) { | ||
| 284 | + this.lpName = lpName; | ||
| 285 | + } | ||
| 286 | + | ||
| 287 | + public String getFcno() { | ||
| 288 | + return fcno; | ||
| 289 | + } | ||
| 290 | + | ||
| 291 | + public void setFcno(String fcno) { | ||
| 292 | + this.fcno = fcno; | ||
| 293 | + } | ||
| 294 | + | ||
| 295 | + public Integer getTzsjActual() { | ||
| 296 | + return tzsjActual; | ||
| 297 | + } | ||
| 298 | + | ||
| 299 | + public void setTzsjActual(Integer tzsjActual) { | ||
| 300 | + this.tzsjActual = tzsjActual; | ||
| 301 | + } | ||
| 302 | + | ||
| 303 | + public Integer getTzsj() { | ||
| 304 | + return tzsj; | ||
| 305 | + } | ||
| 306 | + | ||
| 307 | + public void setTzsj(Integer tzsj) { | ||
| 308 | + this.tzsj = tzsj; | ||
| 309 | + } | ||
| 310 | + | ||
| 311 | + public Integer getXdtzsj() { | ||
| 312 | + return xdtzsj; | ||
| 313 | + } | ||
| 314 | + | ||
| 315 | + public void setXdtzsj(Integer xdtzsj) { | ||
| 316 | + this.xdtzsj = xdtzsj; | ||
| 317 | + } | ||
| 318 | + | ||
| 319 | + public String getClZbh() { | ||
| 320 | + return clZbh; | ||
| 321 | + } | ||
| 322 | + | ||
| 323 | + public void setClZbh(String clZbh) { | ||
| 324 | + this.clZbh = clZbh; | ||
| 325 | + } | ||
| 326 | + | ||
| 327 | + public String getEquipment_code() { | ||
| 328 | + return equipment_code; | ||
| 329 | + } | ||
| 330 | + | ||
| 331 | + public void setEquipment_code(String equipment_code) { | ||
| 332 | + this.equipment_code = equipment_code; | ||
| 333 | + } | ||
| 334 | + | ||
| 335 | + public String getjGh() { | ||
| 336 | + return jGh; | ||
| 337 | + } | ||
| 338 | + | ||
| 339 | + public void setjGh(String jGh) { | ||
| 340 | + this.jGh = jGh; | ||
| 341 | + } | ||
| 342 | + | ||
| 343 | + public String getjName() { | ||
| 344 | + return jName; | ||
| 345 | + } | ||
| 346 | + | ||
| 347 | + public void setjName(String jName) { | ||
| 348 | + this.jName = jName; | ||
| 349 | + } | ||
| 350 | + | ||
| 351 | + public String getsGh() { | ||
| 352 | + return sGh; | ||
| 353 | + } | ||
| 354 | + | ||
| 355 | + public void setsGh(String sGh) { | ||
| 356 | + this.sGh = sGh; | ||
| 357 | + } | ||
| 358 | + | ||
| 359 | + public String getsName() { | ||
| 360 | + return sName; | ||
| 361 | + } | ||
| 362 | + | ||
| 363 | + public void setsName(String sName) { | ||
| 364 | + this.sName = sName; | ||
| 365 | + } | ||
| 366 | + | ||
| 367 | + public String getXlDir() { | ||
| 368 | + return xlDir; | ||
| 369 | + } | ||
| 370 | + | ||
| 371 | + public void setXlDir(String xlDir) { | ||
| 372 | + this.xlDir = xlDir; | ||
| 373 | + } | ||
| 374 | + | ||
| 375 | + public String getQdzCode() { | ||
| 376 | + return qdzCode; | ||
| 377 | + } | ||
| 378 | + | ||
| 379 | + public void setQdzCode(String qdzCode) { | ||
| 380 | + this.qdzCode = qdzCode; | ||
| 381 | + } | ||
| 382 | + | ||
| 383 | + public String getQdzName() { | ||
| 384 | + return qdzName; | ||
| 385 | + } | ||
| 386 | + | ||
| 387 | + public void setQdzName(String qdzName) { | ||
| 388 | + this.qdzName = qdzName; | ||
| 389 | + } | ||
| 390 | + | ||
| 391 | + public String getZdzCode() { | ||
| 392 | + return zdzCode; | ||
| 393 | + } | ||
| 394 | + | ||
| 395 | + public void setZdzCode(String zdzCode) { | ||
| 396 | + this.zdzCode = zdzCode; | ||
| 397 | + } | ||
| 398 | + | ||
| 399 | + public String getZdzName() { | ||
| 400 | + return zdzName; | ||
| 401 | + } | ||
| 402 | + | ||
| 403 | + public void setZdzName(String zdzName) { | ||
| 404 | + this.zdzName = zdzName; | ||
| 405 | + } | ||
| 406 | + | ||
| 407 | + public String getFcsj() { | ||
| 408 | + return fcsj; | ||
| 409 | + } | ||
| 410 | + | ||
| 411 | + public void setFcsj(String fcsj) { | ||
| 412 | + this.fcsj = fcsj; | ||
| 413 | + } | ||
| 414 | + | ||
| 415 | + public Long getFcsjT() { | ||
| 416 | + return fcsjT; | ||
| 417 | + } | ||
| 418 | + | ||
| 419 | + public void setFcsjT(Long fcsjT) { | ||
| 420 | + this.fcsjT = fcsjT; | ||
| 421 | + } | ||
| 422 | + | ||
| 423 | + public String getZdsj() { | ||
| 424 | + return zdsj; | ||
| 425 | + } | ||
| 426 | + | ||
| 427 | + public void setZdsj(String zdsj) { | ||
| 428 | + this.zdsj = zdsj; | ||
| 429 | + } | ||
| 430 | + | ||
| 431 | + public Long getZdsjT() { | ||
| 432 | + return zdsjT; | ||
| 433 | + } | ||
| 434 | + | ||
| 435 | + public void setZdsjT(Long zdsjT) { | ||
| 436 | + this.zdsjT = zdsjT; | ||
| 437 | + } | ||
| 438 | + | ||
| 439 | + public Double getJhlc() { | ||
| 440 | + return jhlc; | ||
| 441 | + } | ||
| 442 | + | ||
| 443 | + public void setJhlc(Double jhlc) { | ||
| 444 | + this.jhlc = jhlc; | ||
| 445 | + } | ||
| 446 | + | ||
| 447 | + public Integer getBcsj() { | ||
| 448 | + return bcsj; | ||
| 449 | + } | ||
| 450 | + | ||
| 451 | + public void setBcsj(Integer bcsj) { | ||
| 452 | + this.bcsj = bcsj; | ||
| 453 | + } | ||
| 454 | + | ||
| 455 | + public String getBcType() { | ||
| 456 | + return bcType; | ||
| 457 | + } | ||
| 458 | + | ||
| 459 | + public void setBcType(String bcType) { | ||
| 460 | + this.bcType = bcType; | ||
| 461 | + } | ||
| 462 | + | ||
| 463 | + public String getFcsjActual() { | ||
| 464 | + return fcsjActual; | ||
| 465 | + } | ||
| 466 | + | ||
| 467 | + public void setFcsjActual(String fcsjActual) { | ||
| 468 | + this.fcsjActual = fcsjActual; | ||
| 469 | + } | ||
| 470 | + | ||
| 471 | + public Long getFcsjActualTime() { | ||
| 472 | + return fcsjActualTime; | ||
| 473 | + } | ||
| 474 | + | ||
| 475 | + public void setFcsjActualTime(Long fcsjActualTime) { | ||
| 476 | + this.fcsjActualTime = fcsjActualTime; | ||
| 477 | + } | ||
| 478 | + | ||
| 479 | + public String getZdsjActual() { | ||
| 480 | + return zdsjActual; | ||
| 481 | + } | ||
| 482 | + | ||
| 483 | + public void setZdsjActual(String zdsjActual) { | ||
| 484 | + this.zdsjActual = zdsjActual; | ||
| 485 | + } | ||
| 486 | + | ||
| 487 | + public Long getZdsjActualTime() { | ||
| 488 | + return zdsjActualTime; | ||
| 489 | + } | ||
| 490 | + | ||
| 491 | + public void setZdsjActualTime(Long zdsjActualTime) { | ||
| 492 | + this.zdsjActualTime = zdsjActualTime; | ||
| 493 | + } | ||
| 494 | + | ||
| 495 | + public int getStatus() { | ||
| 496 | + return status; | ||
| 497 | + } | ||
| 498 | + | ||
| 499 | + public void setStatus(int status) { | ||
| 500 | + this.status = status; | ||
| 501 | + } | ||
| 502 | + | ||
| 503 | + public String getAdjustExps() { | ||
| 504 | + return adjustExps; | ||
| 505 | + } | ||
| 506 | + | ||
| 507 | + public void setAdjustExps(String adjustExps) { | ||
| 508 | + this.adjustExps = adjustExps; | ||
| 509 | + } | ||
| 510 | + | ||
| 511 | + public boolean isSflj() { | ||
| 512 | + return sflj; | ||
| 513 | + } | ||
| 514 | + | ||
| 515 | + public void setSflj(boolean sflj) { | ||
| 516 | + this.sflj = sflj; | ||
| 517 | + } | ||
| 518 | + | ||
| 519 | + public String getRemarks() { | ||
| 520 | + return remarks; | ||
| 521 | + } | ||
| 522 | + | ||
| 523 | + public void setRemarks(String remarks) { | ||
| 524 | + this.remarks = remarks; | ||
| 525 | + } | ||
| 526 | + | ||
| 527 | + public String getDfsj() { | ||
| 528 | + return dfsj; | ||
| 529 | + } | ||
| 530 | + | ||
| 531 | + public void setDfsj(String dfsj) { | ||
| 532 | + this.dfsj = dfsj; | ||
| 533 | + } | ||
| 534 | + | ||
| 535 | + public Long getDfsjT() { | ||
| 536 | + return dfsjT; | ||
| 537 | + } | ||
| 538 | + | ||
| 539 | + public void setDfsjT(Long dfsjT) { | ||
| 540 | + this.dfsjT = dfsjT; | ||
| 541 | + } | ||
| 542 | + | ||
| 543 | + public Integer getDirectiveState() { | ||
| 544 | + return directiveState; | ||
| 545 | + } | ||
| 546 | + | ||
| 547 | + public void setDirectiveState(Integer directiveState) { | ||
| 548 | + this.directiveState = directiveState; | ||
| 549 | + } | ||
| 550 | +// | ||
| 551 | +// public Set<ChildTaskPlan> getcTasks() { | ||
| 552 | +// return cTasks; | ||
| 553 | +// } | ||
| 554 | +// | ||
| 555 | +// public void setcTasks(Set<ChildTaskPlan> cTasks) { | ||
| 556 | +// this.cTasks = cTasks; | ||
| 557 | +// } | ||
| 558 | + | ||
| 559 | + public String getGsName() { | ||
| 560 | + return gsName; | ||
| 561 | + } | ||
| 562 | + | ||
| 563 | + public void setGsName(String gsName) { | ||
| 564 | + this.gsName = gsName; | ||
| 565 | + } | ||
| 566 | + | ||
| 567 | + public String getGsBm() { | ||
| 568 | + return gsBm; | ||
| 569 | + } | ||
| 570 | + | ||
| 571 | + public void setGsBm(String gsBm) { | ||
| 572 | + this.gsBm = gsBm; | ||
| 573 | + } | ||
| 574 | + | ||
| 575 | + public String getFgsName() { | ||
| 576 | + return fgsName; | ||
| 577 | + } | ||
| 578 | + | ||
| 579 | + public void setFgsName(String fgsName) { | ||
| 580 | + this.fgsName = fgsName; | ||
| 581 | + } | ||
| 582 | + | ||
| 583 | + public String getFgsBm() { | ||
| 584 | + return fgsBm; | ||
| 585 | + } | ||
| 586 | + | ||
| 587 | + public void setFgsBm(String fgsBm) { | ||
| 588 | + this.fgsBm = fgsBm; | ||
| 589 | + } | ||
| 590 | + | ||
| 591 | + public Double getJhlcOrig() { | ||
| 592 | + return jhlcOrig; | ||
| 593 | + } | ||
| 594 | + | ||
| 595 | + public void setJhlcOrig(Double jhlcOrig) { | ||
| 596 | + this.jhlcOrig = jhlcOrig; | ||
| 597 | + } | ||
| 598 | + /** | ||
| 599 | + * 换车营运标记 true 表示该主任务由 【中途换车子任务】 级联生成 | ||
| 600 | + */ | ||
| 601 | + private boolean ccService; | ||
| 602 | + | ||
| 603 | + @Transient | ||
| 604 | + private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm"); | ||
| 605 | + @Transient | ||
| 606 | + private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm"); | ||
| 607 | + | ||
| 608 | + /** | ||
| 609 | + * | ||
| 610 | + * @Title: setFcsjAll | ||
| 611 | + * @Description: TODO(设置计划发车时间) | ||
| 612 | + * @throws | ||
| 613 | + */ | ||
| 614 | + public void setFcsjAll(Long fcsjT){ | ||
| 615 | + this.fcsjT = fcsjT; | ||
| 616 | + this.fcsj = fmtHHmm.print(fcsjT); | ||
| 617 | + } | ||
| 618 | + | ||
| 619 | + public void setDfsjAll(Long dfsjT) { | ||
| 620 | + this.dfsjT = dfsjT; | ||
| 621 | + this.dfsj = fmtHHmm.print(this.dfsjT); | ||
| 622 | + } | ||
| 623 | + | ||
| 624 | + /** | ||
| 625 | + * | ||
| 626 | + * @Title: setFcsjActualAll | ||
| 627 | + * @Description: TODO(设置实际发车时间 时间戳) | ||
| 628 | + * @throws | ||
| 629 | + */ | ||
| 630 | + public void setFcsjActualAll(Long t){ | ||
| 631 | + this.fcsjActualTime = t; | ||
| 632 | + this.fcsjActual = fmtHHmm.print(t); | ||
| 633 | + } | ||
| 634 | + | ||
| 635 | + /** | ||
| 636 | + * | ||
| 637 | + * @Title: setFcsjActualAll | ||
| 638 | + * @Description: TODO(设置实际终点时间) | ||
| 639 | + * @throws | ||
| 640 | + */ | ||
| 641 | + public void setZdsjActualAll(Long t){ | ||
| 642 | + this.zdsjActualTime = t; | ||
| 643 | + this.zdsjActual = fmtHHmm.print(t); | ||
| 644 | + } | ||
| 645 | + | ||
| 646 | + public void setDfsjAll(String dfsj) { | ||
| 647 | + this.dfsjT = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + dfsj); | ||
| 648 | + this.dfsj = dfsj; | ||
| 649 | + } | ||
| 650 | + | ||
| 651 | + /** | ||
| 652 | + * | ||
| 653 | + * @Title: setFcsjActualAll | ||
| 654 | + * @Description: TODO(设置实际发车时间 字符串) | ||
| 655 | + * @throws | ||
| 656 | + */ | ||
| 657 | + public void setFcsjActualAll(String fcsjActual){ | ||
| 658 | + this.fcsjActualTime = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + fcsjActual); | ||
| 659 | + this.fcsjActual = fcsjActual; | ||
| 660 | + } | ||
| 661 | + | ||
| 662 | + /** | ||
| 663 | + * | ||
| 664 | + * @Title: setFcsjActualAll | ||
| 665 | + * @Description: TODO(设置实际终点时间) | ||
| 666 | + * @throws | ||
| 667 | + */ | ||
| 668 | + public void setZdsjActualAll(String zdsjActual){ | ||
| 669 | + this.zdsjActualTime = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + zdsjActual); | ||
| 670 | + this.zdsjActual = zdsjActual; | ||
| 671 | + } | ||
| 672 | + | ||
| 673 | + public int getDriftStatus() { | ||
| 674 | + return driftStatus; | ||
| 675 | + } | ||
| 676 | + | ||
| 677 | + public void setDriftStatus(int driftStatus) { | ||
| 678 | + this.driftStatus = driftStatus; | ||
| 679 | + } | ||
| 680 | + | ||
| 681 | + public int getJhTime() { | ||
| 682 | + return jhTime; | ||
| 683 | + } | ||
| 684 | + | ||
| 685 | + public void setJhTime(int jhTime) { | ||
| 686 | + this.jhTime = jhTime; | ||
| 687 | + } | ||
| 688 | + | ||
| 689 | + public int getSjTime() { | ||
| 690 | + return sjTime; | ||
| 691 | + } | ||
| 692 | + | ||
| 693 | + public void setSjTime(int sjTime) { | ||
| 694 | + this.sjTime = sjTime; | ||
| 695 | + } | ||
| 696 | + | ||
| 697 | + | ||
| 698 | + public String getEquipmentCode() { | ||
| 699 | + return equipmentCode; | ||
| 700 | + } | ||
| 701 | + | ||
| 702 | + public void setEquipmentCode(String equipmentCode) { | ||
| 703 | + this.equipmentCode = equipmentCode; | ||
| 704 | + } | ||
| 705 | + | ||
| 706 | + public boolean isCcService() { | ||
| 707 | + return ccService; | ||
| 708 | + } | ||
| 709 | + | ||
| 710 | + public void setCcService(boolean ccService) { | ||
| 711 | + this.ccService = ccService; | ||
| 712 | + } | ||
| 713 | + | ||
| 714 | +} |
src/main/java/com/bsth/entity/result/AverageSpeed.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/entity/result/AverageSpeed.java | ||
| 1 | +package com.bsth.entity.result; | ||
| 2 | + | ||
| 3 | +import javax.persistence.Id; | ||
| 4 | +import java.util.Date; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * @author YouRuiFeng | ||
| 8 | + * @Description: TODO() | ||
| 9 | + * @date 2021/3/5/005 16:47 | ||
| 10 | + */ | ||
| 11 | +//@Entity | ||
| 12 | +//@Table(name = "calc_average_speed") | ||
| 13 | +public class AverageSpeed { | ||
| 14 | + | ||
| 15 | + /** 主键Id */ | ||
| 16 | + @Id | ||
| 17 | + private Long id; | ||
| 18 | + /** 公司编码 */ | ||
| 19 | + private String companyId; | ||
| 20 | + /** 分公司编码 */ | ||
| 21 | + private String brancheCompanyId; | ||
| 22 | + /** 公司名称 */ | ||
| 23 | + private String companyName; | ||
| 24 | + /** 分公司名称 */ | ||
| 25 | + private String brancheCompanyName; | ||
| 26 | + /** 线路编码 */ | ||
| 27 | + private String lineCode; | ||
| 28 | + /** 线路名称 */ | ||
| 29 | + private String lineName; | ||
| 30 | + /** 计划车速 */ | ||
| 31 | + private Float planSpeed; | ||
| 32 | + /** 实际车速 */ | ||
| 33 | + private Float realSpeed; | ||
| 34 | + /** 日期 (班次日期) */ | ||
| 35 | + private Date rq; | ||
| 36 | + | ||
| 37 | + /** 日期字符串 (班次日期) */ | ||
| 38 | + private String rqStr; | ||
| 39 | + | ||
| 40 | + public Long getId() { | ||
| 41 | + return id; | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + public void setId(Long id) { | ||
| 45 | + this.id = id; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + public String getCompanyId() { | ||
| 49 | + return companyId; | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + public void setCompanyId(String companyId) { | ||
| 53 | + this.companyId = companyId; | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + public String getBrancheCompanyId() { | ||
| 57 | + return brancheCompanyId; | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + public void setBrancheCompanyId(String brancheCompanyId) { | ||
| 61 | + this.brancheCompanyId = brancheCompanyId; | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + public String getCompanyName() { | ||
| 65 | + return companyName; | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + public void setCompanyName(String companyName) { | ||
| 69 | + this.companyName = companyName; | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + public String getBrancheCompanyName() { | ||
| 73 | + return brancheCompanyName; | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + public void setBrancheCompanyName(String brancheCompanyName) { | ||
| 77 | + this.brancheCompanyName = brancheCompanyName; | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + public String getLineCode() { | ||
| 81 | + return lineCode; | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + public void setLineCode(String lineCode) { | ||
| 85 | + this.lineCode = lineCode; | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + public String getLineName() { | ||
| 89 | + return lineName; | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + public void setLineName(String lineName) { | ||
| 93 | + this.lineName = lineName; | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + public Float getPlanSpeed() { | ||
| 97 | + return planSpeed; | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + public void setPlanSpeed(Float planSpeed) { | ||
| 101 | + this.planSpeed = planSpeed; | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + public Float getRealSpeed() { | ||
| 105 | + return realSpeed; | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + public void setRealSpeed(Float realSpeed) { | ||
| 109 | + this.realSpeed = realSpeed; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + public Date getRq() { | ||
| 113 | + return rq; | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + public void setRq(Date rq) { | ||
| 117 | + this.rq = rq; | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + public String getRqStr() { | ||
| 121 | + return rqStr; | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + public void setRqStr(String rqStr) { | ||
| 125 | + this.rqStr = rqStr; | ||
| 126 | + } | ||
| 127 | +} |
src/main/java/com/bsth/handler/AverageSpeedHandler.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/handler/AverageSpeedHandler.java | ||
| 1 | +package com.bsth.handler; | ||
| 2 | + | ||
| 3 | +import com.bsth.StartCommand; | ||
| 4 | +import com.bsth.entity.result.AverageSpeed; | ||
| 5 | +import com.bsth.service.ScheduleRealInfoService; | ||
| 6 | +import com.bsth.util.DBUtils_jdsas; | ||
| 7 | +import com.bsth.util.DateUtils; | ||
| 8 | +import org.joda.time.DateTime; | ||
| 9 | +import org.slf4j.Logger; | ||
| 10 | +import org.slf4j.LoggerFactory; | ||
| 11 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 12 | +import org.springframework.jdbc.core.JdbcTemplate; | ||
| 13 | +import org.springframework.stereotype.Component; | ||
| 14 | + | ||
| 15 | +import java.sql.Connection; | ||
| 16 | +import java.sql.PreparedStatement; | ||
| 17 | +import java.sql.SQLException; | ||
| 18 | +import java.util.List; | ||
| 19 | + | ||
| 20 | + | ||
| 21 | +/** | ||
| 22 | + * @ClassName: MileageCalculationHandler.java | ||
| 23 | + * @Description: TODO(营运公里处理程序) | ||
| 24 | + * @author: YouRuiFeng | ||
| 25 | + * @date: 2017-8-14 下午2:06:22 | ||
| 26 | + * | ||
| 27 | + */ | ||
| 28 | +@Component | ||
| 29 | +public class AverageSpeedHandler { | ||
| 30 | + | ||
| 31 | + @Autowired | ||
| 32 | + ScheduleRealInfoService scheduleRealInfoService; | ||
| 33 | + | ||
| 34 | + @Autowired | ||
| 35 | + JdbcTemplate jdbcTemplate; | ||
| 36 | + | ||
| 37 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 38 | + | ||
| 39 | + public void calc() { | ||
| 40 | + try { | ||
| 41 | + DateTime dt = DateTime.now(); | ||
| 42 | + dt = dt.plusDays(-1);//凌晨两点计算前一天的 | ||
| 43 | + String rq = dt.toString("yyyy-MM"); | ||
| 44 | +// String rqs = "2021-"; | ||
| 45 | +// for(int i=1;i<3;i++){ | ||
| 46 | +// String rq = rqs+(i<10? "0"+i:i); | ||
| 47 | +// logger.info("开始计算报表: " + rq); | ||
| 48 | +// List<AverageSpeed> oMList = scheduleRealInfoService.averageSpeed(rq); | ||
| 49 | +// logger.info("报表计算完成: " + rq); | ||
| 50 | +// save(oMList); | ||
| 51 | +// logger.info("数据保存完成: " + rq); | ||
| 52 | +// } | ||
| 53 | + | ||
| 54 | +// String rq = "2017-04"; | ||
| 55 | + if(!rq.equals(StartCommand.RQ)){ | ||
| 56 | + | ||
| 57 | + logger.info("开始计算报表: " + rq); | ||
| 58 | + List<AverageSpeed> oMList = scheduleRealInfoService.averageSpeed(rq); | ||
| 59 | + logger.info("报表计算完成: " + rq); | ||
| 60 | + save(oMList); | ||
| 61 | + StartCommand.RQ = rq; | ||
| 62 | + logger.info("数据保存完成: " + rq); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + } catch (Exception e) { | ||
| 66 | + logger.error("", e); | ||
| 67 | + } | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + private void save(final List<AverageSpeed> list) { | ||
| 71 | + | ||
| 72 | + Connection conn = null; | ||
| 73 | + PreparedStatement ps = null; | ||
| 74 | +// ResultSet rs = null; | ||
| 75 | + try { | ||
| 76 | + conn = DBUtils_jdsas.getConnection(); | ||
| 77 | + conn.setAutoCommit(false); | ||
| 78 | + | ||
| 79 | + String sql = "insert into calc_average_speed(company_id, branche_company_id, company_name, branche_company_name, line_code, line_name, " + | ||
| 80 | + "plan_speed,real_speed,rq,rq_str,create_date) " + | ||
| 81 | + " VALUES(?,?,?,?,?,?,?,?,?,?,?)"; | ||
| 82 | + | ||
| 83 | + ps = conn.prepareStatement(sql); | ||
| 84 | + | ||
| 85 | + for (int i=0; i<list.size(); i++) { | ||
| 86 | + AverageSpeed averageSpeed = list.get(i); | ||
| 87 | + ps.setString(1, averageSpeed.getCompanyId()); | ||
| 88 | + ps.setString(2, averageSpeed.getBrancheCompanyId()); | ||
| 89 | + ps.setString(3, averageSpeed.getCompanyName()); | ||
| 90 | + ps.setString(4, averageSpeed.getBrancheCompanyName()); | ||
| 91 | + ps.setString(5, averageSpeed.getLineCode()); | ||
| 92 | + ps.setString(6, averageSpeed.getLineName()); | ||
| 93 | + ps.setFloat(7, averageSpeed.getPlanSpeed()); | ||
| 94 | + ps.setFloat(8, averageSpeed.getRealSpeed()); | ||
| 95 | + ps.setDate(9, new java.sql.Date(averageSpeed.getRq().getTime())); | ||
| 96 | + ps.setString(10, averageSpeed.getRqStr()); | ||
| 97 | + ps.setDate(11, new java.sql.Date(DateUtils.getTimestamp())); | ||
| 98 | + ps.addBatch(); | ||
| 99 | + // 1w条记录插入一次 | ||
| 100 | + if (i % 10000 == 0){ | ||
| 101 | + ps.executeBatch(); | ||
| 102 | + conn.commit(); | ||
| 103 | + } | ||
| 104 | + } | ||
| 105 | + // 最后插入不足1w条的数据 | ||
| 106 | + ps.executeBatch(); | ||
| 107 | + conn.commit(); | ||
| 108 | + } catch (Exception e) { | ||
| 109 | + e.printStackTrace(); | ||
| 110 | +// throw new RuntimeException(e); | ||
| 111 | + logger.error("", e); | ||
| 112 | + }finally{ | ||
| 113 | + if(ps!=null){ | ||
| 114 | + try { | ||
| 115 | + ps.close(); | ||
| 116 | + } catch (SQLException e) { | ||
| 117 | + e.printStackTrace(); | ||
| 118 | + logger.error("", e); | ||
| 119 | + } | ||
| 120 | + } | ||
| 121 | + if(conn!=null){ | ||
| 122 | + try { | ||
| 123 | + conn.close(); | ||
| 124 | + } catch (SQLException e) { | ||
| 125 | + e.printStackTrace(); | ||
| 126 | + logger.error("", e); | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | + } | ||
| 130 | + } | ||
| 131 | +} |
src/main/java/com/bsth/repository/ScheduleRealInfoRepository.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/repository/ScheduleRealInfoRepository.java | ||
| 1 | +package com.bsth.repository; | ||
| 2 | + | ||
| 3 | +import com.bsth.entity.ScheduleRealInfo; | ||
| 4 | +import org.springframework.data.jpa.repository.EntityGraph; | ||
| 5 | +import org.springframework.data.jpa.repository.Query; | ||
| 6 | +import org.springframework.data.repository.PagingAndSortingRepository; | ||
| 7 | +import org.springframework.stereotype.Repository; | ||
| 8 | + | ||
| 9 | +import java.util.List; | ||
| 10 | + | ||
| 11 | +@Repository | ||
| 12 | +public interface ScheduleRealInfoRepository extends PagingAndSortingRepository<ScheduleRealInfo, Long> { | ||
| 13 | + | ||
| 14 | + //按照时间段统计 | ||
| 15 | +// @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) | ||
| 16 | + @Query("select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr=?1 order by s.xlBm, s.lpName, s.fcno") | ||
| 17 | + List<ScheduleRealInfo> scheduleByDateAndLineTj(String scheduleDateStr); | ||
| 18 | + | ||
| 19 | +} |
src/main/java/com/bsth/service/ScheduleRealInfoService.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/service/ScheduleRealInfoService.java | ||
| 1 | +package com.bsth.service; | ||
| 2 | + | ||
| 3 | +import com.bsth.entity.result.AverageSpeed; | ||
| 4 | + | ||
| 5 | +import java.util.List; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | +* @ClassName: ScheduleRealInfoService.java | ||
| 9 | +* @Description: TODO() | ||
| 10 | +* @author: YouRuiFeng | ||
| 11 | +* @date: 2017-8-15 下午1:36:58 | ||
| 12 | +* | ||
| 13 | +*/ | ||
| 14 | +public interface ScheduleRealInfoService { | ||
| 15 | + | ||
| 16 | + List<AverageSpeed> averageSpeed(String DateStr); | ||
| 17 | + | ||
| 18 | +} |
src/main/java/com/bsth/service/impl/ScheduleRealInfoServiceImpl.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/service/impl/ScheduleRealInfoServiceImpl.java | ||
| 1 | +package com.bsth.service.impl; | ||
| 2 | + | ||
| 3 | +import com.bsth.entity.ScheduleRealInfo; | ||
| 4 | +import com.bsth.entity.result.AverageSpeed; | ||
| 5 | +import com.bsth.repository.ScheduleRealInfoRepository; | ||
| 6 | +import com.bsth.service.ScheduleRealInfoService; | ||
| 7 | +import com.bsth.util.DateUtils; | ||
| 8 | +import org.apache.commons.lang3.StringUtils; | ||
| 9 | +import org.slf4j.Logger; | ||
| 10 | +import org.slf4j.LoggerFactory; | ||
| 11 | +import org.springframework.beans.BeanUtils; | ||
| 12 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 13 | +import org.springframework.jdbc.core.JdbcTemplate; | ||
| 14 | +import org.springframework.jdbc.core.RowMapper; | ||
| 15 | +import org.springframework.stereotype.Service; | ||
| 16 | + | ||
| 17 | +import java.sql.ResultSet; | ||
| 18 | +import java.sql.SQLException; | ||
| 19 | +import java.text.DecimalFormat; | ||
| 20 | +import java.text.ParseException; | ||
| 21 | +import java.text.SimpleDateFormat; | ||
| 22 | +import java.util.ArrayList; | ||
| 23 | +import java.util.Date; | ||
| 24 | +import java.util.Iterator; | ||
| 25 | +import java.util.List; | ||
| 26 | +import java.util.Map; | ||
| 27 | +import java.util.TreeMap; | ||
| 28 | + | ||
| 29 | +@Service | ||
| 30 | +public class ScheduleRealInfoServiceImpl implements ScheduleRealInfoService { | ||
| 31 | + | ||
| 32 | + @Autowired | ||
| 33 | + ScheduleRealInfoRepository scheduleRealInfoRepository; | ||
| 34 | + | ||
| 35 | + // 用于计算的数字,只要是一个年月日就行那天不重要 | ||
| 36 | + private static final String DATEStr = "2000-01-01"; | ||
| 37 | + | ||
| 38 | + @Autowired | ||
| 39 | + JdbcTemplate jdbcTemplate; | ||
| 40 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 41 | + | ||
| 42 | + @Override | ||
| 43 | + public List<AverageSpeed> averageSpeed(String time){ | ||
| 44 | + | ||
| 45 | + String sql; | ||
| 46 | + sql = "SELECT * FROM bsth_c_s_sp_info_real WHERE bc_type in('normal','region') AND schedule_date BETWEEN '"+time+"-01' AND '"+time+"-31' ORDER BY fgs_bm, xl_bm, schedule_date"; | ||
| 47 | + List<ScheduleRealInfo> list = jdbcTemplate.query(sql, | ||
| 48 | + new RowMapper<ScheduleRealInfo>() { | ||
| 49 | + @Override | ||
| 50 | + public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 51 | + ScheduleRealInfo scheduleRealInfo = new ScheduleRealInfo(); | ||
| 52 | + scheduleRealInfo.setId(rs.getLong("id")); | ||
| 53 | + scheduleRealInfo.setScheduleDateStr(rs.getString("schedule_date_str")); | ||
| 54 | + scheduleRealInfo.setXlBm(rs.getString("xl_bm")); | ||
| 55 | + scheduleRealInfo.setXlDir(rs.getString("xl_dir")); | ||
| 56 | + scheduleRealInfo.setXlName(rs.getString("xl_name")); | ||
| 57 | + scheduleRealInfo.setGsBm(rs.getString("gs_bm")); | ||
| 58 | + scheduleRealInfo.setGsName(rs.getString("gs_name")); | ||
| 59 | + scheduleRealInfo.setFgsBm(rs.getString("fgs_bm")); | ||
| 60 | + scheduleRealInfo.setFgsName(rs.getString("fgs_name")); | ||
| 61 | + scheduleRealInfo.setFcsj(rs.getString("fcsj")); | ||
| 62 | + scheduleRealInfo.setFcsjActual(rs.getString("fcsj_actual")); | ||
| 63 | + scheduleRealInfo.setZdsj(rs.getString("zdsj")); | ||
| 64 | + scheduleRealInfo.setZdsjActual(rs.getString("zdsj_actual")); | ||
| 65 | + scheduleRealInfo.setJhlc(Double.valueOf(rs.getString("jhlc"))); | ||
| 66 | + scheduleRealInfo.setBcType(rs.getString("bc_type")); | ||
| 67 | + return scheduleRealInfo; | ||
| 68 | + } | ||
| 69 | + }); | ||
| 70 | + | ||
| 71 | + if (list.size()<1){ | ||
| 72 | + return null; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + // 左边固定列 | ||
| 76 | + TreeMap<String, ScheduleRealInfo> keyMap = new TreeMap<String, ScheduleRealInfo>(); | ||
| 77 | + | ||
| 78 | + | ||
| 79 | + // 报表纵向列数据生成 | ||
| 80 | + for (int i = 0; list.size() > i; i++) { | ||
| 81 | + ScheduleRealInfo sr = list.get(i); | ||
| 82 | + | ||
| 83 | + String key = sr.getFgsBm()+"/"+sr.getXlBm(); | ||
| 84 | + | ||
| 85 | + ScheduleRealInfo realInfo = this.initScheduleRealInfo(); | ||
| 86 | + | ||
| 87 | + if(keyMap.containsKey(key)){ | ||
| 88 | + realInfo = keyMap.get(key); | ||
| 89 | + | ||
| 90 | + this.summation(realInfo, sr); | ||
| 91 | + } else { | ||
| 92 | + // 深度拷贝对象 | ||
| 93 | + BeanUtils.copyProperties(sr,realInfo); | ||
| 94 | + realInfo.setJhTime(0); | ||
| 95 | + realInfo.setSjTime(0); | ||
| 96 | + realInfo.setJhlc(0d); | ||
| 97 | + this.summation(realInfo, sr); | ||
| 98 | + keyMap.put(key, realInfo); | ||
| 99 | + } | ||
| 100 | + } | ||
| 101 | + List<AverageSpeed> listAS = new ArrayList<>(); | ||
| 102 | + // 表头和数据 | ||
| 103 | + Iterator iter = keyMap.entrySet().iterator(); | ||
| 104 | + while (iter.hasNext()) { | ||
| 105 | + Map.Entry entry = (Map.Entry) iter.next(); | ||
| 106 | + // 获取value | ||
| 107 | + ScheduleRealInfo c = (ScheduleRealInfo) entry.getValue(); | ||
| 108 | + | ||
| 109 | + AverageSpeed as = new AverageSpeed(); | ||
| 110 | + | ||
| 111 | + as.setBrancheCompanyId(c.getFgsBm()); | ||
| 112 | + as.setBrancheCompanyName(c.getFgsName()); | ||
| 113 | + as.setCompanyId(c.getGsBm()); | ||
| 114 | + as.setCompanyName(c.getGsName()); | ||
| 115 | + as.setLineCode(c.getXlBm()); | ||
| 116 | + as.setLineName(c.getXlName()); | ||
| 117 | + as.setPlanSpeed(c.getJhTime()==0 ? 0f : (float)(c.getJhlc()*60/ c.getJhTime())); | ||
| 118 | + as.setRealSpeed(c.getSjTime()==0 ? 0f : (float)(c.getJhlc()*60/ c.getSjTime())); | ||
| 119 | + as.setRq(DateUtils.getDate(time+"-01")); | ||
| 120 | + as.setRqStr(time); | ||
| 121 | + listAS.add(as); | ||
| 122 | + } | ||
| 123 | + return listAS; | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + | ||
| 127 | + | ||
| 128 | + /* | ||
| 129 | + * 将时间戳转换为时间 | ||
| 130 | + */ | ||
| 131 | + public static String stampToDate(String s){ | ||
| 132 | + String res; | ||
| 133 | + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
| 134 | + long lt = new Long(s); | ||
| 135 | + Date date = new Date(lt); | ||
| 136 | + res = simpleDateFormat.format(date); | ||
| 137 | + return res; | ||
| 138 | + } | ||
| 139 | + public ScheduleRealInfo summation(ScheduleRealInfo sr1, ScheduleRealInfo sr2){ | ||
| 140 | + | ||
| 141 | + try { | ||
| 142 | + | ||
| 143 | + if(!StringUtils.isEmpty(sr2.getFcsjActual()) && !StringUtils.isEmpty(sr2.getZdsjActual())){ | ||
| 144 | + | ||
| 145 | + Long sjfcsj = Long.valueOf(DateUtils.dateToStamp(DATEStr + " " + sr2.getFcsjActual() + ":00")); | ||
| 146 | + Long sjzdsj = Long.valueOf(DateUtils.dateToStamp(DATEStr + " " + sr2.getZdsjActual() + ":00")); | ||
| 147 | + if(sjzdsj<=sjfcsj){ | ||
| 148 | + sjzdsj += 24*3600*1000; | ||
| 149 | + } | ||
| 150 | + int sjTime = (int)(sjzdsj-sjfcsj) / (60*1000); | ||
| 151 | + Long jhfcsj = Long.valueOf(DateUtils.dateToStamp(DATEStr + " " + sr2.getFcsj() + ":00")); | ||
| 152 | + Long jhzdsj = Long.valueOf(DateUtils.dateToStamp(DATEStr + " " + sr2.getZdsj() + ":00")); | ||
| 153 | + if(jhzdsj<=jhfcsj){ | ||
| 154 | + jhzdsj += 24*3600*1000; | ||
| 155 | + } | ||
| 156 | + int jhTime = (int)(jhzdsj-jhfcsj) / (60*1000); | ||
| 157 | + sr1.setJhlc(sr1.getJhlc()+sr2.getJhlc()); | ||
| 158 | + sr1.setJhTime(sr1.getJhTime()+jhTime); | ||
| 159 | + sr1.setSjTime(sr1.getSjTime()+sjTime); | ||
| 160 | + } | ||
| 161 | + }catch (ParseException e) { | ||
| 162 | + // TODO Auto-generated catch block | ||
| 163 | + e.printStackTrace(); | ||
| 164 | + logger.error(e.toString()); | ||
| 165 | + } | ||
| 166 | + return sr1; | ||
| 167 | + } | ||
| 168 | + public ScheduleRealInfo initScheduleRealInfo(){ | ||
| 169 | + ScheduleRealInfo realInfo = new ScheduleRealInfo(); | ||
| 170 | + realInfo.setJhlc(0d); | ||
| 171 | + realInfo.setSjTime(0); | ||
| 172 | + realInfo.setJhTime(0); | ||
| 173 | + return realInfo; | ||
| 174 | + } | ||
| 175 | +} |
src/main/java/com/bsth/thread/AverageSpeedThrad.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/thread/AverageSpeedThrad.java | ||
| 1 | +package com.bsth.thread; | ||
| 2 | + | ||
| 3 | +import com.bsth.handler.AverageSpeedHandler; | ||
| 4 | +import org.slf4j.Logger; | ||
| 5 | +import org.slf4j.LoggerFactory; | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.stereotype.Component; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * @ClassName: MileageCalculationThrad.java | ||
| 11 | + * @Description: TODO(平均车速计算线程) | ||
| 12 | + * @author: YouRuiFeng | ||
| 13 | + * | ||
| 14 | + */ | ||
| 15 | +@Component | ||
| 16 | +public class AverageSpeedThrad extends Thread { | ||
| 17 | + @Autowired | ||
| 18 | + AverageSpeedHandler averageSpeedHandler; | ||
| 19 | + | ||
| 20 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 21 | + | ||
| 22 | + @Override | ||
| 23 | + public void run() { | ||
| 24 | + try { | ||
| 25 | + averageSpeedHandler.calc(); | ||
| 26 | + } catch (Exception e) { | ||
| 27 | + logger.error("", e); | ||
| 28 | + } | ||
| 29 | + } | ||
| 30 | +} |
src/main/java/com/bsth/util/Arith.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/util/Arith.java | ||
| 1 | +package com.bsth.util; | ||
| 2 | + | ||
| 3 | +import java.math.BigDecimal; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * 进行BigDecimal对象的加减乘除,四舍五入等运算的工具类 | ||
| 7 | + * @author ameyume | ||
| 8 | + * | ||
| 9 | + */ | ||
| 10 | +public class Arith { | ||
| 11 | + | ||
| 12 | + /** | ||
| 13 | + * 由于Java的简单类型不能够精确的对浮点数进行运算,这个工具类提供精 | ||
| 14 | + * 确的浮点数运算,包括加减乘除和四舍五入。 | ||
| 15 | + */ | ||
| 16 | + //默认除法运算精度 | ||
| 17 | + private static final int DEF_DIV_SCALE = 10; | ||
| 18 | + | ||
| 19 | + //这个类不能实例化 | ||
| 20 | + private Arith(){ | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * 提供精确的加法运算。 | ||
| 25 | + * @param v1 被加数 | ||
| 26 | + * @param v2 加数 | ||
| 27 | + * @return 两个参数的和 | ||
| 28 | + */ | ||
| 29 | + public static double add(Object v1,Object v2){ | ||
| 30 | + BigDecimal b1 = new BigDecimal(String.valueOf(v1)); | ||
| 31 | + BigDecimal b2 = new BigDecimal(String.valueOf(v2)); | ||
| 32 | + return b1.add(b2).doubleValue(); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * 提供精确的减法运算。 | ||
| 37 | + * @param v1 被减数 | ||
| 38 | + * @param v2 减数 | ||
| 39 | + * @return 两个参数的差 | ||
| 40 | + */ | ||
| 41 | + public static double sub(Object v1,Object v2){ | ||
| 42 | + BigDecimal b1 = new BigDecimal(String.valueOf(v1)); | ||
| 43 | + BigDecimal b2 = new BigDecimal(String.valueOf(v2)); | ||
| 44 | + return b1.subtract(b2).doubleValue(); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 提供精确的乘法运算。 | ||
| 49 | + * @param v1 被乘数 | ||
| 50 | + * @param v2 乘数 | ||
| 51 | + * @return 两个参数的积 | ||
| 52 | + */ | ||
| 53 | + public static double mul(Object v1,Object v2){ | ||
| 54 | + BigDecimal b1 = new BigDecimal(String.valueOf(v1)); | ||
| 55 | + BigDecimal b2 = new BigDecimal(String.valueOf(v2)); | ||
| 56 | + return b1.multiply(b2).doubleValue(); | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + /** | ||
| 60 | + * 提供(相对)精确的除法运算,当发生除不尽的情况时,精确到 | ||
| 61 | + * 小数点以后10位,以后的数字四舍五入。 | ||
| 62 | + * @param v1 被除数 | ||
| 63 | + * @param v2 除数 | ||
| 64 | + * @return 两个参数的商 | ||
| 65 | + */ | ||
| 66 | + public static double div(Object v1,Object v2){ | ||
| 67 | + return div(v1,v2,DEF_DIV_SCALE); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + /** | ||
| 71 | + * 提供(相对)精确的除法运算。当发生除不尽的情况时,由scale参数指 | ||
| 72 | + * 定精度,以后的数字四舍五入。 | ||
| 73 | + * @param v1 被除数 | ||
| 74 | + * @param v2 除数 | ||
| 75 | + * @param scale 表示表示需要精确到小数点以后几位。 | ||
| 76 | + * @return 两个参数的商 | ||
| 77 | + */ | ||
| 78 | + public static double div(Object v1,Object v2,int scale){ | ||
| 79 | + if(scale<0){ | ||
| 80 | + throw new IllegalArgumentException( | ||
| 81 | + "The scale must be a positive integer or zero"); | ||
| 82 | + } | ||
| 83 | + BigDecimal b1 = new BigDecimal(String.valueOf(v1)); | ||
| 84 | + BigDecimal b2 = new BigDecimal(String.valueOf(v2)); | ||
| 85 | + return b1.divide(b2,scale,BigDecimal.ROUND_HALF_UP).doubleValue(); | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + /** | ||
| 89 | + * 提供精确的小数位四舍五入处理。 | ||
| 90 | + * @param v 需要四舍五入的数字 | ||
| 91 | + * @param scale 小数点后保留几位 | ||
| 92 | + * @return 四舍五入后的结果 | ||
| 93 | + */ | ||
| 94 | + public static double round(Object v,int scale){ | ||
| 95 | + if(scale<0){ | ||
| 96 | + throw new IllegalArgumentException( | ||
| 97 | + "The scale must be a positive integer or zero"); | ||
| 98 | + } | ||
| 99 | + BigDecimal b = new BigDecimal(String.valueOf(v)); | ||
| 100 | + BigDecimal one = new BigDecimal("1"); | ||
| 101 | + return b.divide(one,scale,BigDecimal.ROUND_HALF_UP).doubleValue(); | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + /** | ||
| 105 | + * 提供精确的类型转换(Float) | ||
| 106 | + * @param v 需要被转换的数字 | ||
| 107 | + * @return 返回转换结果 | ||
| 108 | + */ | ||
| 109 | + public static float convertsToFloat(double v){ | ||
| 110 | + BigDecimal b = new BigDecimal(v); | ||
| 111 | + return b.floatValue(); | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + /** | ||
| 115 | + * 提供精确的类型转换(Int)不进行四舍五入 | ||
| 116 | + * @param v 需要被转换的数字 | ||
| 117 | + * @return 返回转换结果 | ||
| 118 | + */ | ||
| 119 | + public static int convertsToInt(double v){ | ||
| 120 | + BigDecimal b = new BigDecimal(v); | ||
| 121 | + return b.intValue(); | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + /** | ||
| 125 | + * 提供精确的类型转换(Long) | ||
| 126 | + * @param v 需要被转换的数字 | ||
| 127 | + * @return 返回转换结果 | ||
| 128 | + */ | ||
| 129 | + public static long convertsToLong(double v){ | ||
| 130 | + BigDecimal b = new BigDecimal(v); | ||
| 131 | + return b.longValue(); | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + /** | ||
| 135 | + * 返回两个数中大的一个值 | ||
| 136 | + * @param v1 需要被对比的第一个数 | ||
| 137 | + * @param v2 需要被对比的第二个数 | ||
| 138 | + * @return 返回两个数中大的一个值 | ||
| 139 | + */ | ||
| 140 | + public static double returnMax(double v1,double v2){ | ||
| 141 | + BigDecimal b1 = new BigDecimal(v1); | ||
| 142 | + BigDecimal b2 = new BigDecimal(v2); | ||
| 143 | + return b1.max(b2).doubleValue(); | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + /** | ||
| 147 | + * 返回两个数中小的一个值 | ||
| 148 | + * @param v1 需要被对比的第一个数 | ||
| 149 | + * @param v2 需要被对比的第二个数 | ||
| 150 | + * @return 返回两个数中小的一个值 | ||
| 151 | + */ | ||
| 152 | + public static double returnMin(double v1,double v2){ | ||
| 153 | + BigDecimal b1 = new BigDecimal(v1); | ||
| 154 | + BigDecimal b2 = new BigDecimal(v2); | ||
| 155 | + return b1.min(b2).doubleValue(); | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + /** | ||
| 159 | + * 精确对比两个数字 | ||
| 160 | + * @param v1 需要被对比的第一个数 | ||
| 161 | + * @param v2 需要被对比的第二个数 | ||
| 162 | + * @return 如果两个数一样则返回0,如果第一个数比第二个数大则返回1,反之返回-1 | ||
| 163 | + */ | ||
| 164 | + public static int compareTo(double v1,double v2){ | ||
| 165 | + BigDecimal b1 = new BigDecimal(v1); | ||
| 166 | + BigDecimal b2 = new BigDecimal(v2); | ||
| 167 | + return b1.compareTo(b2); | ||
| 168 | + } | ||
| 169 | + | ||
| 170 | +} | ||
| 0 | \ No newline at end of file | 171 | \ No newline at end of file |
src/main/java/com/bsth/util/ConfigUtil.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/util/ConfigUtil.java | ||
| 1 | +package com.bsth.util; | ||
| 2 | + | ||
| 3 | +public class ConfigUtil { | ||
| 4 | + | ||
| 5 | + static Tools tools; | ||
| 6 | + | ||
| 7 | + static{ | ||
| 8 | + tools = new Tools("application.properties"); | ||
| 9 | + String active = tools.getValue("spring.profiles.active"); | ||
| 10 | + tools = new Tools("application-"+active+".properties"); | ||
| 11 | + } | ||
| 12 | + | ||
| 13 | + public static String get(String key){ | ||
| 14 | + return tools.getValue(key); | ||
| 15 | + } | ||
| 16 | +} |
src/main/java/com/bsth/util/DBUtils_jdsas.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/util/DBUtils_jdsas.java | ||
| 1 | +package com.bsth.util; | ||
| 2 | + | ||
| 3 | +import com.mchange.v2.c3p0.DataSources; | ||
| 4 | +import org.apache.log4j.Logger; | ||
| 5 | +import org.springframework.stereotype.Component; | ||
| 6 | + | ||
| 7 | +import javax.sql.DataSource; | ||
| 8 | +import java.io.FileNotFoundException; | ||
| 9 | +import java.io.IOException; | ||
| 10 | +import java.sql.Connection; | ||
| 11 | +import java.sql.ResultSet; | ||
| 12 | +import java.sql.SQLException; | ||
| 13 | +import java.sql.Statement; | ||
| 14 | +import java.util.HashMap; | ||
| 15 | +import java.util.Map; | ||
| 16 | +import java.util.Properties; | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * jdsas库连接池 | ||
| 20 | + * @author yrf | ||
| 21 | + * | ||
| 22 | + */ | ||
| 23 | +//@Component | ||
| 24 | +public class DBUtils_jdsas { | ||
| 25 | + | ||
| 26 | + private static String url = null; | ||
| 27 | + | ||
| 28 | + private static String username = null; | ||
| 29 | + | ||
| 30 | + private static String pwd = null; | ||
| 31 | + | ||
| 32 | + private static DataSource ds_pooled; | ||
| 33 | + | ||
| 34 | + static Logger logger = Logger.getLogger(DBUtils_jdsas.class); | ||
| 35 | + | ||
| 36 | + static { | ||
| 37 | + Properties env = new Properties(); | ||
| 38 | + | ||
| 39 | + try { | ||
| 40 | + env.load(DBUtils_jdsas.class.getClassLoader().getResourceAsStream("jdsas-jdbc.properties")); | ||
| 41 | + // 1. 加载驱动类 | ||
| 42 | + Class.forName(env.getProperty("jdsas.mysql.driver")); | ||
| 43 | + | ||
| 44 | + url = env.getProperty("jdsas.mysql.url"); | ||
| 45 | + username = env.getProperty("jdsas.mysql.username"); | ||
| 46 | + pwd = env.getProperty("jdsas.mysql.password"); | ||
| 47 | + | ||
| 48 | + // 设置连接数据库的配置信息 | ||
| 49 | + DataSource ds_unpooled = DataSources.unpooledDataSource(url, | ||
| 50 | + username, pwd); | ||
| 51 | + | ||
| 52 | + Map<String, Object> pool_conf = new HashMap<String, Object>(); | ||
| 53 | + // 设置最大连接数 | ||
| 54 | + pool_conf.put("maxPoolSize", 10); | ||
| 55 | + | ||
| 56 | + pool_conf.put("testConnectionOnCheckout", false); | ||
| 57 | + //异步检测连接的有效性 | ||
| 58 | + pool_conf.put("testConnectionOnCheckin", true); | ||
| 59 | + //30秒检测一次 | ||
| 60 | + pool_conf.put("idleConnectionTestPeriod", 30); | ||
| 61 | + ds_pooled = DataSources.pooledDataSource(ds_unpooled, pool_conf); | ||
| 62 | + } catch (FileNotFoundException e) { | ||
| 63 | + logger.error(e.toString()); | ||
| 64 | + e.printStackTrace(); | ||
| 65 | + } catch (IOException e) { | ||
| 66 | + logger.error(e.toString()); | ||
| 67 | + e.printStackTrace(); | ||
| 68 | + } catch (ClassNotFoundException e) { | ||
| 69 | + logger.error(e.toString()); | ||
| 70 | + e.printStackTrace(); | ||
| 71 | + } catch (SQLException e) { | ||
| 72 | + logger.error(e.toString()); | ||
| 73 | + e.printStackTrace(); | ||
| 74 | + } | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + /** | ||
| 78 | + * 获取连接对象 | ||
| 79 | + */ | ||
| 80 | + public static Connection getConnection() throws SQLException { | ||
| 81 | + return ds_pooled.getConnection(); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + /** | ||
| 85 | + * 释放连接池资源 | ||
| 86 | + */ | ||
| 87 | + public static void clearup() { | ||
| 88 | + if (ds_pooled != null) { | ||
| 89 | + try { | ||
| 90 | + DataSources.destroy(ds_pooled); | ||
| 91 | + } catch (SQLException e) { | ||
| 92 | + logger.error(e.toString()); | ||
| 93 | + e.printStackTrace(); | ||
| 94 | + } | ||
| 95 | + } | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + /** | ||
| 99 | + * 资源关闭 | ||
| 100 | + * | ||
| 101 | + * @param rs | ||
| 102 | + * @param stmt | ||
| 103 | + * @param conn | ||
| 104 | + */ | ||
| 105 | + public static void close(ResultSet rs, Statement stmt, Connection conn) { | ||
| 106 | + if (rs != null) { | ||
| 107 | + try { | ||
| 108 | + rs.close(); | ||
| 109 | + } catch (SQLException e) { | ||
| 110 | + logger.error(e.toString()); | ||
| 111 | + e.printStackTrace(); | ||
| 112 | + } | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + if (stmt != null) { | ||
| 116 | + try { | ||
| 117 | + stmt.close(); | ||
| 118 | + } catch (SQLException e) { | ||
| 119 | + logger.error(e.toString()); | ||
| 120 | + e.printStackTrace(); | ||
| 121 | + } | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + if (conn != null) { | ||
| 125 | + try { | ||
| 126 | + conn.close(); | ||
| 127 | + } catch (SQLException e) { | ||
| 128 | + logger.error(e.toString()); | ||
| 129 | + e.printStackTrace(); | ||
| 130 | + } | ||
| 131 | + } | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + public static DataSource getDataSource(){ | ||
| 135 | + return ds_pooled; | ||
| 136 | + } | ||
| 137 | +} |
src/main/java/com/bsth/util/DateUtils.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/util/DateUtils.java | ||
| 1 | +package com.bsth.util; | ||
| 2 | + | ||
| 3 | +import java.text.ParseException; | ||
| 4 | +import java.text.SimpleDateFormat; | ||
| 5 | +import java.util.Calendar; | ||
| 6 | +import java.util.Date; | ||
| 7 | + | ||
| 8 | +public class DateUtils { | ||
| 9 | + | ||
| 10 | + // 获得当天0点时间 | ||
| 11 | + public static int getTimesmorning() { | ||
| 12 | + Calendar cal = Calendar.getInstance(); | ||
| 13 | + cal.set(Calendar.HOUR_OF_DAY, 0); | ||
| 14 | + cal.set(Calendar.SECOND, 0); | ||
| 15 | + cal.set(Calendar.MINUTE, 0); | ||
| 16 | + cal.set(Calendar.MILLISECOND, 0); | ||
| 17 | + return (int) (cal.getTimeInMillis() / 1000); | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + // 获得当天0点毫秒时间戳 | ||
| 21 | + public static long getTimestamp() { | ||
| 22 | + Calendar cal = Calendar.getInstance(); | ||
| 23 | + cal.set(Calendar.HOUR_OF_DAY, 0); | ||
| 24 | + cal.set(Calendar.SECOND, 0); | ||
| 25 | + cal.set(Calendar.MINUTE, 0); | ||
| 26 | + cal.set(Calendar.MILLISECOND, 0); | ||
| 27 | + return cal.getTimeInMillis(); | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + public static Long getTimesmorning(Calendar cal) { | ||
| 31 | + cal.set(Calendar.HOUR_OF_DAY, 0); | ||
| 32 | + cal.set(Calendar.SECOND, 0); | ||
| 33 | + cal.set(Calendar.MINUTE, 0); | ||
| 34 | + cal.set(Calendar.MILLISECOND, 0); | ||
| 35 | + return cal.getTimeInMillis() / 1000; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + // 获得当天24点时间 | ||
| 39 | + public static int getTimesnight() { | ||
| 40 | + Calendar cal = Calendar.getInstance(); | ||
| 41 | + cal.set(Calendar.HOUR_OF_DAY, 24); | ||
| 42 | + cal.set(Calendar.SECOND, 0); | ||
| 43 | + cal.set(Calendar.MINUTE, 0); | ||
| 44 | + cal.set(Calendar.MILLISECOND, 0); | ||
| 45 | + return (int) (cal.getTimeInMillis() / 1000); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + // 获得当天24点时间 毫秒 | ||
| 49 | + public static Long getTimesnight2() { | ||
| 50 | + Calendar cal = Calendar.getInstance(); | ||
| 51 | + cal.set(Calendar.HOUR_OF_DAY, 24); | ||
| 52 | + cal.set(Calendar.SECOND, 0); | ||
| 53 | + cal.set(Calendar.MINUTE, 0); | ||
| 54 | + cal.set(Calendar.MILLISECOND, 0); | ||
| 55 | + return cal.getTimeInMillis(); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + public static Long getTimesnight(Calendar cal) { | ||
| 59 | + cal.set(Calendar.HOUR_OF_DAY, 24); | ||
| 60 | + cal.set(Calendar.SECOND, 0); | ||
| 61 | + cal.set(Calendar.MINUTE, 0); | ||
| 62 | + cal.set(Calendar.MILLISECOND, 0); | ||
| 63 | + return cal.getTimeInMillis(); | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + // 获得本周一0点时间 | ||
| 67 | + public static int getTimesWeekmorning() { | ||
| 68 | + Calendar cal = Calendar.getInstance(); | ||
| 69 | + cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONDAY), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0); | ||
| 70 | + cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); | ||
| 71 | + return (int) (cal.getTimeInMillis() / 1000); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + // 获得本周日24点时间 | ||
| 75 | + public static int getTimesWeeknight() { | ||
| 76 | + Calendar cal = Calendar.getInstance(); | ||
| 77 | + cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONDAY), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0); | ||
| 78 | + cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); | ||
| 79 | + return (int) ((cal.getTime().getTime() + (7 * 24 * 60 * 60 * 1000)) / 1000); | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + // 获得本月第一天0点时间 | ||
| 83 | + public static int getTimesMonthmorning() { | ||
| 84 | + Calendar cal = Calendar.getInstance(); | ||
| 85 | + cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONDAY), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0); | ||
| 86 | + cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH)); | ||
| 87 | + return (int) (cal.getTimeInMillis() / 1000); | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + // 获得本月最后一天24点时间 | ||
| 91 | + public static int getTimesMonthnight() { | ||
| 92 | + Calendar cal = Calendar.getInstance(); | ||
| 93 | + cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONDAY), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0); | ||
| 94 | + cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH)); | ||
| 95 | + cal.set(Calendar.HOUR_OF_DAY, 24); | ||
| 96 | + return (int) (cal.getTimeInMillis() / 1000); | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + private static SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm") | ||
| 100 | + ,sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd") | ||
| 101 | + ,sdfHHmm = new SimpleDateFormat("HH:mm"); | ||
| 102 | + public static long getTimesByHHmm(String str) throws ParseException{ | ||
| 103 | + Date d = sdfyyyyMMddHHmm.parse(sdfyyyyMMdd.format(new Date()) + str); | ||
| 104 | + return d.getTime(); | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + public static Date getDate(String date){ | ||
| 108 | + Date date1 = null; | ||
| 109 | + try { | ||
| 110 | + date1 = sdfyyyyMMdd.parse(date); | ||
| 111 | + } catch (ParseException e) { | ||
| 112 | + e.printStackTrace(); | ||
| 113 | + } | ||
| 114 | + return date1; | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + public static String plusDay(String old, int day){ | ||
| 118 | + Calendar cal = null; | ||
| 119 | + try { | ||
| 120 | + Date date = sdfyyyyMMdd.parse(old); | ||
| 121 | + cal = Calendar.getInstance(); | ||
| 122 | + cal.setTime(date); | ||
| 123 | + cal.add(Calendar.DATE, day); | ||
| 124 | + } catch (ParseException e) { | ||
| 125 | + e.printStackTrace(); | ||
| 126 | + } | ||
| 127 | + return sdfyyyyMMdd.format(cal.getTime()); | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + public static String subtractDay(String old, int day){ | ||
| 131 | + Calendar cal = null; | ||
| 132 | + try { | ||
| 133 | + Date date = sdfyyyyMMdd.parse(old); | ||
| 134 | + cal = Calendar.getInstance(); | ||
| 135 | + cal.setTime(date); | ||
| 136 | + cal.set(Calendar.DATE, cal.get(Calendar.DATE) - day); | ||
| 137 | + } catch (ParseException e) { | ||
| 138 | + e.printStackTrace(); | ||
| 139 | + } | ||
| 140 | + return sdfyyyyMMdd.format(cal.getTime()); | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + public static int calcHHmmDiff(String fcsj, String zdsj) throws ParseException { | ||
| 144 | + return (int) (sdfHHmm.parse(zdsj).getTime() - sdfHHmm.parse(fcsj).getTime()); | ||
| 145 | + } | ||
| 146 | + /* | ||
| 147 | + * 将时间转换为时间戳 | ||
| 148 | + */ | ||
| 149 | + public static String dateToStamp(String s) throws ParseException{ | ||
| 150 | + String res; | ||
| 151 | + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
| 152 | + Date date = simpleDateFormat.parse(s); | ||
| 153 | + long ts = date.getTime(); | ||
| 154 | + res = String.valueOf(ts); | ||
| 155 | + return res; | ||
| 156 | + } | ||
| 157 | +} |
src/main/java/com/bsth/util/Tools.java
0 → 100644
| 1 | +++ a/src/main/java/com/bsth/util/Tools.java | ||
| 1 | +package com.bsth.util; | ||
| 2 | + | ||
| 3 | +import java.io.IOException; | ||
| 4 | +import java.util.Properties; | ||
| 5 | + | ||
| 6 | +public class Tools { | ||
| 7 | + private static Properties p = new Properties(); | ||
| 8 | + private static String f; | ||
| 9 | + public Tools(String file){ | ||
| 10 | + f = file; | ||
| 11 | + try { | ||
| 12 | + p.load(Tools.class.getClassLoader().getResourceAsStream(f)); | ||
| 13 | + } catch (IOException e) { | ||
| 14 | + e.printStackTrace(); | ||
| 15 | + } | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * 根据key得到value的值 | ||
| 20 | + */ | ||
| 21 | + public String getValue(String key) | ||
| 22 | + { | ||
| 23 | + return p.getProperty(key); | ||
| 24 | + } | ||
| 25 | +} |
src/main/resources/application-dev.properties
0 → 100644
| 1 | +++ a/src/main/resources/application-dev.properties | ||
| 1 | +server.port=9999 | ||
| 2 | +management.port= 9009 | ||
| 3 | +management.address= 127.0.0.1 | ||
| 4 | + | ||
| 5 | +spring.jpa.hibernate.ddl-auto= none | ||
| 6 | +spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy | ||
| 7 | +#DATABASE | ||
| 8 | +spring.jpa.database= MYSQL | ||
| 9 | +spring.jpa.show-sql= false | ||
| 10 | +#spring.datasource.driver-class-name= com.mysql.cj.jdbc.Driver | ||
| 11 | +spring.datasource.driver-class-name= com.mysql.jdbc.Driver | ||
| 12 | +spring.datasource.url= jdbc:mysql://localhost:3306/jdsas?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC | ||
| 13 | +spring.datasource.username= root | ||
| 14 | +spring.datasource.password= root | ||
| 15 | +#DATASOURCE | ||
| 16 | +spring.datasource.max-active=100 | ||
| 17 | +spring.datasource.max-idle=8 | ||
| 18 | +spring.datasource.min-idle=8 | ||
| 19 | +spring.datasource.initial-size=5 | ||
| 20 | + | ||
| 21 | +spring.datasource.test-on-borrow=true | ||
| 22 | +spring.datasource.test-on-connect=true | ||
| 23 | +spring.datasource.test-on-return=true | ||
| 24 | +spring.datasource.test-while-idle=true | ||
| 25 | +spring.datasource.validation-query=select 1 | ||
| 26 | + |
src/main/resources/application-prod.properties
0 → 100644
| 1 | +++ a/src/main/resources/application-prod.properties | ||
| 1 | +server.port=9770 | ||
| 2 | +management.port= 9771 | ||
| 3 | +management.address= 127.0.0.1 | ||
| 4 | + | ||
| 5 | +spring.jpa.hibernate.ddl-auto= none | ||
| 6 | +spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy | ||
| 7 | +#DATABASE | ||
| 8 | +spring.jpa.database= MYSQL | ||
| 9 | +spring.jpa.show-sql= true | ||
| 10 | +spring.datasource.driver-class-name= com.mysql.jdbc.Driver | ||
| 11 | +spring.datasource.url= jdbc:mysql://192.168.160.222:3306/control?useUnicode=true&characterEncoding=utf-8&useSSL=false | ||
| 12 | +spring.datasource.username= root | ||
| 13 | +spring.datasource.password= root2jsp | ||
| 14 | +#DATASOURCE | ||
| 15 | +spring.datasource.max-active=100 | ||
| 16 | +spring.datasource.max-idle=8 | ||
| 17 | +spring.datasource.min-idle=8 | ||
| 18 | +spring.datasource.initial-size=5 | ||
| 19 | + | ||
| 20 | +spring.datasource.test-on-borrow=true | ||
| 21 | +spring.datasource.test-on-connect=true | ||
| 22 | +spring.datasource.test-on-return=true | ||
| 23 | +spring.datasource.test-while-idle=true | ||
| 24 | +spring.datasource.validation-query=select 1 | ||
| 25 | + | ||
| 26 | + |
src/main/resources/application.properties
0 → 100644
src/main/resources/banner.txt
0 → 100644
| 1 | +++ a/src/main/resources/banner.txt | ||
| 1 | + ____ _____ _______ _ _ | ||
| 2 | + | _ \ / ____| |__ __| | | | | | ||
| 3 | + | |_) | | (___ | | | |__| | | ||
| 4 | + | _ < \___ \ | | | __ | | ||
| 5 | + | |_) | ____) | | | | | | | | ||
| 6 | + |____/ |_____/ |_| |_| |_| | ||
| 7 | + | ||
| 8 | +Running Spring Boot ${spring-boot.version} | ||
| 0 | \ No newline at end of file | 9 | \ No newline at end of file |
src/main/resources/jdsas-jdbc.properties
0 → 100644
| 1 | +++ a/src/main/resources/jdsas-jdbc.properties | ||
| 1 | +#jdsas.mysql.driver= com.mysql.jdbc.Driver | ||
| 2 | +#jdsas.mysql.url= jdbc:mysql://localhost:3306/jdsas?useUnicode=true&characterEncoding=utf-8&useSSL=false | ||
| 3 | +#jdsas.mysql.username= root | ||
| 4 | +#jdsas.mysql.password= root | ||
| 5 | + | ||
| 6 | +jdsas.mysql.driver= com.mysql.jdbc.Driver | ||
| 7 | +jdsas.mysql.url= jdbc:mysql://192.168.160.179:3306/jdsas?useUnicode=true&characterEncoding=utf-8 | ||
| 8 | +jdsas.mysql.username= root | ||
| 9 | +jdsas.mysql.password= root2jsp |
src/main/resources/logback.xml
0 → 100644
| 1 | +++ a/src/main/resources/logback.xml | ||
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<!-- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/2002/xmlspec/dtd/2.10/xmlspec.dtd"> --> | ||
| 3 | +<configuration> | ||
| 4 | + | ||
| 5 | + <!-- <property resource="application.properties" /> --> | ||
| 6 | + <property name="LOG_BASE" value="E:/calc_log" /> | ||
| 7 | + <!-- 控制台输出 --> | ||
| 8 | + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||
| 9 | + | ||
| 10 | + <layout class="ch.qos.logback.classic.PatternLayout"> | ||
| 11 | + <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 --> | ||
| 12 | + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%file:%line] %-5level-%msg%n | ||
| 13 | + </pattern> | ||
| 14 | + </layout> | ||
| 15 | + </appender> | ||
| 16 | + | ||
| 17 | + <!-- 主日志文件 --> | ||
| 18 | + <appender name="FILE" | ||
| 19 | + class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
| 20 | + <file>${LOG_BASE}/calc_log.log</file> | ||
| 21 | + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | ||
| 22 | + <fileNamePattern>${LOG_BASE}/calc_log-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | ||
| 23 | + <timeBasedFileNamingAndTriggeringPolicy | ||
| 24 | + class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | ||
| 25 | + <maxFileSize>100MB</maxFileSize> | ||
| 26 | + </timeBasedFileNamingAndTriggeringPolicy> | ||
| 27 | + </rollingPolicy> | ||
| 28 | + <encoder> | ||
| 29 | + <pattern>%msg%n</pattern> | ||
| 30 | + </encoder> | ||
| 31 | + | ||
| 32 | + <layout class="ch.qos.logback.classic.PatternLayout"> | ||
| 33 | + <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 --> | ||
| 34 | + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%file:%line] %-5level-%msg%n | ||
| 35 | + </pattern> | ||
| 36 | + </layout> | ||
| 37 | + </appender> | ||
| 38 | + | ||
| 39 | + | ||
| 40 | + <!-- 日志输出级别 --> | ||
| 41 | + <root level="info"> | ||
| 42 | + <appender-ref ref="STDOUT" /> | ||
| 43 | + <appender-ref ref="FILE" /> | ||
| 44 | + </root> | ||
| 45 | +</configuration> | ||
| 0 | \ No newline at end of file | 46 | \ No newline at end of file |