diff --git a/sql/jsh_erp(后续更新参考这个更新).sql b/docs/jsh_erp(后续更新参考这个更新).sql similarity index 100% rename from sql/jsh_erp(后续更新参考这个更新).sql rename to docs/jsh_erp(后续更新参考这个更新).sql diff --git a/sql/jsh_erp(第一次建库请使用这个).sql b/docs/jsh_erp(第一次建库请使用这个).sql similarity index 100% rename from sql/jsh_erp(第一次建库请使用这个).sql rename to docs/jsh_erp(第一次建库请使用这个).sql diff --git a/sql/华夏ERP数据库设计汇总.xlsx b/docs/华夏ERP数据库设计汇总.xlsx similarity index 100% rename from sql/华夏ERP数据库设计汇总.xlsx rename to docs/华夏ERP数据库设计汇总.xlsx diff --git a/pom.xml b/pom.xml index cde80653..36c0386d 100644 --- a/pom.xml +++ b/pom.xml @@ -110,65 +110,50 @@ - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - jshERP2.0 - org.apache.maven.plugins - maven-assembly-plugin - 2.4 + org.springframework.boot + spring-boot-maven-plugin + 2.0.3.RELEASE - make-assembly + build-info + generate-sources + + build-info + + + + repackage + package + + repackage + + + com.jsh.erp.ErpApplication + JAR + + + + + + org.apache.maven.plugins + maven-assembly-plugin + 2.5.1 + + + make-zip package single - false - false - ./bin - src/main/assembly/package.xml + src/main/assembly/assembly.xml + ./dist diff --git a/src/main/assembly/assembly.xml b/src/main/assembly/assembly.xml new file mode 100644 index 00000000..eadda257 --- /dev/null +++ b/src/main/assembly/assembly.xml @@ -0,0 +1,71 @@ + + + + bin + + + zip + + + true + + + + erp_web + /erp_web + + + ${project.basedir}/target + + *.jar + + /lib + + + ${project.basedir}/src/main/resources + + *.properties + *.yml + *.yaml + *.xml + + /config + + + ${project.basedir}/src/main/bin + /bin + + run-manage.sh + + unix + + + ${project.basedir}/src/main/bin/ + / + + start.bat + restart.sh + start.sh + stop.sh + status.sh + + + + docs + /docs + + + ${project.basedir} + + *.md + *.txt + + / + + + \ No newline at end of file diff --git a/src/main/assembly/package.xml b/src/main/assembly/package.xml deleted file mode 100644 index d191bf29..00000000 --- a/src/main/assembly/package.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - package - - zip - - false - - - - - - - - - src/main/conf - / - - - erp_web - /erp_web - - - - - src/main/resources/application.properties - /conf - - - src/main/resources/logback-spring.xml - /conf - - - - - lib - runtime - - - \ No newline at end of file diff --git a/src/main/bin/restart.sh b/src/main/bin/restart.sh new file mode 100644 index 00000000..70c0be15 --- /dev/null +++ b/src/main/bin/restart.sh @@ -0,0 +1 @@ +./bin/run-manage.sh restart \ No newline at end of file diff --git a/src/main/bin/run-manage.sh b/src/main/bin/run-manage.sh new file mode 100644 index 00000000..ca2609d5 --- /dev/null +++ b/src/main/bin/run-manage.sh @@ -0,0 +1,163 @@ +FILE_PATH= +SERVER_NAME=jshERP +readonly APP_HOME=${FILE_PATH:-$(dirname $(cd `dirname $0`; pwd))} + +#readonly JAVA_HOME="" + +readonly CONFIG_HOME="$APP_HOME/config/" +readonly LIB_HOME="$APP_HOME/lib" +readonly LOGS_HOME="$APP_HOME/logs" + +readonly PID_FILE="$LOGS_HOME/application.pid" +readonly APP_MAIN_CLASS="jshERP2.0.jar" +readonly LOG_CONFIG="$CONFIG_HOME/logback-spring.xml" + +readonly JAVA_RUN="-Dlogs.home=$LOGS_HOME -Dlogging.config=$LOG_CONFIG -Dspring.config.location=file:$CONFIG_HOME -Dspring.pid.file=$PID_FILE -Dspring.pid.fail-on-write-error=true" +readonly JAVA_OPTS="-server -Xms128m -Xmx376m -XX:PermSize=128M -XX:MaxPermSize=256M $JAVA_RUN" + +readonly JAVA="java" + +PID=0 + + +if [ ! -x "$LOGS_HOME" ] +then + mkdir $LOGS_HOME +fi +chmod +x -R "$JAVA_HOME/bin/" + +functions="/etc/functions.sh" +if test -f $functions ; then + . $functions +else + success() + { + echo " SUCCESS! $@" + } + failure() + { + echo " ERROR! $@" + } + warning() + { + echo "WARNING! $@" + } +fi + +function install(){ + + if [[ ! -n $FILE_PATH ]];then + sed -i "s#FILE_PATH=#FILE_PATH=$APP_HOME#" $APP_HOME/$0 + + if [[ -e /usr/sbin/$SERVER_NAME || -L /usr/sbin/$SERVER_NAME ]];then + + rm -rf /usr/sbin/$SERVER_NAME && ln -s $APP_HOME/$0 /usr/sbin/$SERVER_NAME + + fi + fi +} + +function checkpid() { + PID=$(ps -ef | grep $APP_MAIN_CLASS | grep -v 'grep' | awk '{print int($2)}') + if [[ -n "$PID" ]] + then + return 0 + else + return 1 + fi +} + +function start() { + checkpid + if [[ $? -eq 0 ]] + then + warning "[$APP_MAIN_CLASS]: already started! (PID=$PID)" + else + echo -n "[$APP_MAIN_CLASS]: Starting ..." + JAVA_CMD="nohup $JAVA $JAVA_OPTS -jar $LIB_HOME/$APP_MAIN_CLASS > /dev/null 2>&1 &" + # echo "Exec cmmand : $JAVA_CMD" + sh -c "$JAVA_CMD" + sleep 3 + checkpid + if [[ $? -eq 0 ]] + then + success "(PID=$PID) " + else + failure " " + fi + fi +} + +function stop() { + checkpid + if [[ $? -eq 0 ]]; + then + echo -n "[$APP_MAIN_CLASS]: Shutting down ...(PID=$PID) " + kill -9 $PID + if [[ $? -eq 0 ]]; + then + echo 0 > $PID_FILE + success " " + else + failure " " + fi + else + warning "[$APP_MAIN_CLASS]: is not running ..." + fi +} + +function status() { + checkpid + if [[ $? -eq 0 ]] + then + success "[$APP_MAIN_CLASS]: is running! (PID=$PID)" + return 0 + else + failure "[$APP_MAIN_CLASS]: is not running" + return 1 + fi +} + +function info() { + echo "System Information:" + echo + echo "****************************" + echo `head -n 1 /etc/issue` + echo `uname -a` + echo + echo "JAVA_HOME=$JAVA_HOME" + echo + echo "JAVA Environment Information:" + echo `$JAVA -version` + echo + echo "APP_HOME=$APP_HOME" + echo "APP_MAIN_CLASS=$APP_MAIN_CLASS" + echo + echo "****************************" +} + +case "$1" in + 'start') + start + ;; + 'stop') + stop + ;; + 'restart') + stop + start + ;; + 'status') + status + ;; + 'info') + info + ;; + 'install') + install + ;; + *) + echo "Usage: $0 {help|start|stop|restart|status|info|install}" + ;; +esac +exit 0 diff --git a/src/main/bin/start.bat b/src/main/bin/start.bat new file mode 100644 index 00000000..374a8f27 --- /dev/null +++ b/src/main/bin/start.bat @@ -0,0 +1,6 @@ +@echo off + +title jshERP + +java -Xms1000m -Xmx2000m -jar .\lib\jshERP2.0.jar +pause over \ No newline at end of file diff --git a/src/main/bin/start.sh b/src/main/bin/start.sh new file mode 100644 index 00000000..d0bf0677 --- /dev/null +++ b/src/main/bin/start.sh @@ -0,0 +1 @@ +./bin/run-manage.sh start \ No newline at end of file diff --git a/src/main/bin/status.sh b/src/main/bin/status.sh new file mode 100644 index 00000000..46d65372 --- /dev/null +++ b/src/main/bin/status.sh @@ -0,0 +1 @@ +./bin/run-manage.sh status \ No newline at end of file diff --git a/src/main/bin/stop.sh b/src/main/bin/stop.sh new file mode 100644 index 00000000..8f3414e7 --- /dev/null +++ b/src/main/bin/stop.sh @@ -0,0 +1 @@ +./bin/run-manage.sh stop \ No newline at end of file diff --git a/src/main/conf/start.bat b/src/main/conf/start.bat deleted file mode 100644 index 8cc02bfa..00000000 --- a/src/main/conf/start.bat +++ /dev/null @@ -1,6 +0,0 @@ -@echo off - -title jshERP - -java -Xms1000m -Xmx2000m -cp .\conf;.\lib\*; -XX:+CreateMinidumpOnCrash com.jsh.erp.ErpApplication -pause over \ No newline at end of file diff --git a/src/main/conf/start.sh b/src/main/conf/start.sh deleted file mode 100644 index 351ba1c0..00000000 --- a/src/main/conf/start.sh +++ /dev/null @@ -1 +0,0 @@ -nohup java -XX:+CreateMinidumpOnCrash -cp ./conf:./lib/*: com.jsh.erp.ErpApplication > /dev/null 2>&1 & \ No newline at end of file diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index 716fe85a..7c1675f8 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -1,197 +1,34 @@ - - - - - - - - - - logback - - - - - - - - - - - - - - - - - debug - - - ${CONSOLE_LOG_PATTERN} - - UTF-8 - - - - - - - - - - ${log.path}/log_debug.log - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - UTF-8 - - - - - ${log.path}/debug/log-debug-%d{yyyy-MM-dd}.%i.log - - 100MB - - - 15 - - - - debug - ACCEPT - DENY - - - - - - - ${log.path}/log_info.log - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - UTF-8 - - - - - ${log.path}/info/log-info-%d{yyyy-MM-dd}.%i.log - - 100MB - - - 15 - - - - info - ACCEPT - DENY - - - - - - - ${log.path}/log_warn.log - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - UTF-8 - - - - ${log.path}/warn/log-warn-%d{yyyy-MM-dd}.%i.log - - 100MB - - - 15 - - - - warn - ACCEPT - DENY - - - - - - - - ${log.path}/log_error.log - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - UTF-8 - - - - ${log.path}/error/log-error-%d{yyyy-MM-dd}.%i.log - - 100MB - - - 15 - - - - ERROR - ACCEPT - DENY - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + ${LOG_PATTERN} + + + + + ${LOG_FILE}.log + + ${LOG_PATTERN} + + + ${LOG_FILE}.%d{yyyy-MM-dd}.%i.log + 10 + 1GB + + 100MB + + + + + + + + + + + + \ No newline at end of file