2024-05-30 朱宝民 添加微信和手机App两个子模块
11个文件已修改
26个文件已添加
1个文件已删除
| | |
| | | Integer deleteIntakeId(@Param("controllerId") Long controllerId); |
| | | |
| | | /** |
| | | * 根据取水口ID获取阀控器地址 |
| | | * @param intakeId 取水口ID |
| | | * @return 阀控器地址 |
| | | * 根据取水口ID获取阀控器对象 |
| | | * @param intakeId |
| | | * @return |
| | | */ |
| | | String getRtuAddrByIntakeId(Long intakeId); |
| | | PrController getControllerByIntakeId(Long intakeId); |
| | | |
| | | /** |
| | | * 根据RTU地址获取阀控器对象 |
| | | * @param rtuAddr |
| | | * @return |
| | | */ |
| | | PrController getControllerByRtuAddr(String rtuAddr); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; |
| | | import com.dy.common.po.BaseEntity; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.*; |
| | |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class RmCommandHistory implements BaseEntity { |
| | | public class RmCommandHistory { |
| | | public static final long serialVersionUID = 202401151517005L; |
| | | |
| | | /** |
| | |
| | | private String commandName; |
| | | |
| | | /** |
| | | * 取水口ID |
| | | */ |
| | | @NotNull(message = "取水口ID不能为空") |
| | | private Long intakeId; |
| | | |
| | | /** |
| | | * 阀控器地址 |
| | | */ |
| | | @NotBlank(message = "阀控器地址不能为空") |
| | | private String rtuaddr; |
| | | private String rtuAddr; |
| | | |
| | | /** |
| | | * 通讯协议 |
| | |
| | | webPort: 8086 |
| | | actutorPort: 9086 |
| | | idSuffix: 8 |
| | | |
| | | wechat: |
| | | webPort: 8087 |
| | | actutorPort: 9087 |
| | | idSuffix: 9 |
| | | app: |
| | | webPort: 8088 |
| | | actutorPort: 9088 |
| | | idSuffix: 10 |
| | | #项目编号 |
| | | #projectCode: |
| | | # ym: 100 |
| | |
| | | SELECT COUNT(*) AS recordCount FROM pr_controller WHERE rtuAddr = (SELECT rtuAddr FROM pr_controller_tramp WHERE id = ${controllerId}) AND intakeId IS NOT NULL |
| | | </select> |
| | | |
| | | <!--根据取水口ID获取阀控器地址--> |
| | | <select id="getRtuAddrByIntakeId" resultType="java.lang.String"> |
| | | SELECT rtuAddr FROM pr_controller WHERE deleted = 0 AND intakeId = #{intakeId} LIMIT 0,1 |
| | | <!--根据取水口ID获取阀控器对象--> |
| | | <select id="getControllerByIntakeId" resultType="com.dy.pipIrrGlobal.pojoPr.PrController"> |
| | | SELECT * FROM pr_controller WHERE deleted = 0 AND intakeId = #{intakeId} LIMIT 0,1 |
| | | </select> |
| | | |
| | | <!--根据RTU地址获取阀控器对象--> |
| | | <select id="getControllerByRtuAddr" resultType="com.dy.pipIrrGlobal.pojoPr.PrController"> |
| | | SELECT * FROM pr_controller WHERE deleted = 0 AND rtuAddr = #{rtuAddr} LIMIT 0,1 |
| | | </select> |
| | | </mapper> |
| | |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="command_code" jdbcType="VARCHAR" property="commandCode" /> |
| | | <result column="command_name" jdbcType="VARCHAR" property="commandName" /> |
| | | <result column="rtuAddr" jdbcType="VARCHAR" property="rtuaddr" /> |
| | | <result column="intake_id" jdbcType="BIGINT" property="intakeId" /> |
| | | <result column="rtu_addr" jdbcType="VARCHAR" property="rtuAddr" /> |
| | | <result column="protocol" jdbcType="VARCHAR" property="protocol" /> |
| | | <result column="param" property="param" jdbcType="JAVA_OBJECT" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" /> |
| | | <result column="send_time" jdbcType="TIMESTAMP" property="sendTime" /> |
| | |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, command_code, command_name, rtuAddr, protocol, param, send_time, `operator`, |
| | | id, command_code, command_name, intake_id, rtu_addr, protocol, param, send_time, `operator`, |
| | | `result`, result_time, result_text |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory"> |
| | | <!--@mbg.generated--> |
| | | insert into rm_command_history (id, command_code, command_name, |
| | | rtuAddr, protocol, param, |
| | | intake_id, rtu_addr, protocol, param, |
| | | send_time, `operator`, `result`, |
| | | result_time, result_text) |
| | | values (#{id,jdbcType=BIGINT}, #{commandCode,jdbcType=VARCHAR}, #{commandName,jdbcType=VARCHAR}, |
| | | #{rtuaddr,jdbcType=VARCHAR}, #{protocol,jdbcType=VARCHAR}, #{param,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, |
| | | values (#{id,jdbcType=BIGINT}, #{commandCode,jdbcType=VARCHAR}, #{commandName,jdbcType=VARCHAR}, #{intakeId,jdbcType=BIGINT}, |
| | | #{rtuAddr,jdbcType=VARCHAR}, #{protocol,jdbcType=VARCHAR}, #{param,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, |
| | | #{sendTime,jdbcType=TIMESTAMP}, #{operator,jdbcType=BIGINT}, #{result,jdbcType=TINYINT}, |
| | | #{resultTime,jdbcType=TIMESTAMP}, #{resultText,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}) |
| | | </insert> |
| | |
| | | <if test="commandName != null"> |
| | | command_name, |
| | | </if> |
| | | <if test="rtuaddr != null"> |
| | | rtuAddr, |
| | | <if test="intakeId != null"> |
| | | intake_id, |
| | | </if> |
| | | <if test="rtuAddr != null"> |
| | | rtu_addr, |
| | | </if> |
| | | <if test="protocol != null"> |
| | | protocol, |
| | |
| | | <if test="commandName != null"> |
| | | #{commandName,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="rtuaddr != null"> |
| | | #{rtuaddr,jdbcType=VARCHAR}, |
| | | <if test="intakeId != null"> |
| | | #{intakeId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="rtuAddr != null"> |
| | | #{rtuAddr,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="protocol != null"> |
| | | #{protocol,jdbcType=VARCHAR}, |
| | |
| | | <if test="commandName != null"> |
| | | command_name = #{commandName,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="rtuaddr != null"> |
| | | rtuAddr = #{rtuaddr,jdbcType=VARCHAR}, |
| | | <if test="intakeId != null"> |
| | | intake_id = #{intakeId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="rtuAddr != null"> |
| | | rtu_addr = #{rtuAddr,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="protocol != null"> |
| | | protocol = #{protocol,jdbcType=VARCHAR}, |
| | |
| | | update rm_command_history |
| | | set command_code = #{commandCode,jdbcType=VARCHAR}, |
| | | command_name = #{commandName,jdbcType=VARCHAR}, |
| | | rtuAddr = #{rtuaddr,jdbcType=VARCHAR}, |
| | | intake_id = #{intakeId,jdbcType=BIGINT}, |
| | | rtu_addr = #{rtuAddr,jdbcType=VARCHAR}, |
| | | protocol = #{protocol,jdbcType=VARCHAR}, |
| | | param = #{param,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, |
| | | send_time = #{sendTime,jdbcType=TIMESTAMP}, |
New file |
| | |
| | | HELP.md |
| | | target/ |
| | | !.mvn/wrapper/maven-wrapper.jar |
| | | !**/src/main/**/target/ |
| | | !**/src/test/**/target/ |
| | | |
| | | ### STS ### |
| | | .apt_generated |
| | | .classpath |
| | | .factorypath |
| | | .project |
| | | .settings |
| | | .springBeans |
| | | .sts4-cache |
| | | |
| | | ### IntelliJ IDEA ### |
| | | .idea |
| | | *.iws |
| | | *.iml |
| | | *.ipr |
| | | |
| | | ### NetBeans ### |
| | | /nbproject/private/ |
| | | /nbbuild/ |
| | | /dist/ |
| | | /nbdist/ |
| | | /.nb-gradle/ |
| | | build/ |
| | | !**/src/main/**/build/ |
| | | !**/src/test/**/build/ |
| | | |
| | | ### VS Code ### |
| | | .vscode/ |
New file |
| | |
| | | # Licensed to the Apache Software Foundation (ASF) under one |
| | | # or more contributor license agreements. See the NOTICE file |
| | | # distributed with this work for additional information |
| | | # regarding copyright ownership. The ASF licenses this file |
| | | # to you under the Apache License, Version 2.0 (the |
| | | # "License"); you may not use this file except in compliance |
| | | # with the License. You may obtain a copy of the License at |
| | | # |
| | | # https://www.apache.org/licenses/LICENSE-2.0 |
| | | # |
| | | # Unless required by applicable law or agreed to in writing, |
| | | # software distributed under the License is distributed on an |
| | | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| | | # KIND, either express or implied. See the License for the |
| | | # specific language governing permissions and limitations |
| | | # under the License. |
| | | wrapperVersion=3.3.1 |
| | | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip |
New file |
| | |
| | | #!/bin/sh |
| | | # ---------------------------------------------------------------------------- |
| | | # Licensed to the Apache Software Foundation (ASF) under one |
| | | # or more contributor license agreements. See the NOTICE file |
| | | # distributed with this work for additional information |
| | | # regarding copyright ownership. The ASF licenses this file |
| | | # to you under the Apache License, Version 2.0 (the |
| | | # "License"); you may not use this file except in compliance |
| | | # with the License. You may obtain a copy of the License at |
| | | # |
| | | # https://www.apache.org/licenses/LICENSE-2.0 |
| | | # |
| | | # Unless required by applicable law or agreed to in writing, |
| | | # software distributed under the License is distributed on an |
| | | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| | | # KIND, either express or implied. See the License for the |
| | | # specific language governing permissions and limitations |
| | | # under the License. |
| | | # ---------------------------------------------------------------------------- |
| | | |
| | | # ---------------------------------------------------------------------------- |
| | | # Apache Maven Wrapper startup batch script, version 3.3.1 |
| | | # |
| | | # Optional ENV vars |
| | | # ----------------- |
| | | # JAVA_HOME - location of a JDK home dir, required when download maven via java source |
| | | # MVNW_REPOURL - repo url base for downloading maven distribution |
| | | # MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven |
| | | # MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output |
| | | # ---------------------------------------------------------------------------- |
| | | |
| | | set -euf |
| | | [ "${MVNW_VERBOSE-}" != debug ] || set -x |
| | | |
| | | # OS specific support. |
| | | native_path() { printf %s\\n "$1"; } |
| | | case "$(uname)" in |
| | | CYGWIN* | MINGW*) |
| | | [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" |
| | | native_path() { cygpath --path --windows "$1"; } |
| | | ;; |
| | | esac |
| | | |
| | | # set JAVACMD and JAVACCMD |
| | | set_java_home() { |
| | | # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched |
| | | if [ -n "${JAVA_HOME-}" ]; then |
| | | if [ -x "$JAVA_HOME/jre/sh/java" ]; then |
| | | # IBM's JDK on AIX uses strange locations for the executables |
| | | JAVACMD="$JAVA_HOME/jre/sh/java" |
| | | JAVACCMD="$JAVA_HOME/jre/sh/javac" |
| | | else |
| | | JAVACMD="$JAVA_HOME/bin/java" |
| | | JAVACCMD="$JAVA_HOME/bin/javac" |
| | | |
| | | if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then |
| | | echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 |
| | | echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 |
| | | return 1 |
| | | fi |
| | | fi |
| | | else |
| | | JAVACMD="$( |
| | | 'set' +e |
| | | 'unset' -f command 2>/dev/null |
| | | 'command' -v java |
| | | )" || : |
| | | JAVACCMD="$( |
| | | 'set' +e |
| | | 'unset' -f command 2>/dev/null |
| | | 'command' -v javac |
| | | )" || : |
| | | |
| | | if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then |
| | | echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 |
| | | return 1 |
| | | fi |
| | | fi |
| | | } |
| | | |
| | | # hash string like Java String::hashCode |
| | | hash_string() { |
| | | str="${1:-}" h=0 |
| | | while [ -n "$str" ]; do |
| | | char="${str%"${str#?}"}" |
| | | h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) |
| | | str="${str#?}" |
| | | done |
| | | printf %x\\n $h |
| | | } |
| | | |
| | | verbose() { :; } |
| | | [ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } |
| | | |
| | | die() { |
| | | printf %s\\n "$1" >&2 |
| | | exit 1 |
| | | } |
| | | |
| | | # parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties |
| | | while IFS="=" read -r key value; do |
| | | case "${key-}" in |
| | | distributionUrl) distributionUrl="${value-}" ;; |
| | | distributionSha256Sum) distributionSha256Sum="${value-}" ;; |
| | | esac |
| | | done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties" |
| | | [ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties" |
| | | |
| | | case "${distributionUrl##*/}" in |
| | | maven-mvnd-*bin.*) |
| | | MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ |
| | | case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in |
| | | *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; |
| | | :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; |
| | | :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; |
| | | :Linux*x86_64*) distributionPlatform=linux-amd64 ;; |
| | | *) |
| | | echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 |
| | | distributionPlatform=linux-amd64 |
| | | ;; |
| | | esac |
| | | distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" |
| | | ;; |
| | | maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; |
| | | *) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; |
| | | esac |
| | | |
| | | # apply MVNW_REPOURL and calculate MAVEN_HOME |
| | | # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash> |
| | | [ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" |
| | | distributionUrlName="${distributionUrl##*/}" |
| | | distributionUrlNameMain="${distributionUrlName%.*}" |
| | | distributionUrlNameMain="${distributionUrlNameMain%-bin}" |
| | | MAVEN_HOME="$HOME/.m2/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" |
| | | |
| | | exec_maven() { |
| | | unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : |
| | | exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" |
| | | } |
| | | |
| | | if [ -d "$MAVEN_HOME" ]; then |
| | | verbose "found existing MAVEN_HOME at $MAVEN_HOME" |
| | | exec_maven "$@" |
| | | fi |
| | | |
| | | case "${distributionUrl-}" in |
| | | *?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; |
| | | *) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; |
| | | esac |
| | | |
| | | # prepare tmp dir |
| | | if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then |
| | | clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } |
| | | trap clean HUP INT TERM EXIT |
| | | else |
| | | die "cannot create temp dir" |
| | | fi |
| | | |
| | | mkdir -p -- "${MAVEN_HOME%/*}" |
| | | |
| | | # Download and Install Apache Maven |
| | | verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." |
| | | verbose "Downloading from: $distributionUrl" |
| | | verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" |
| | | |
| | | # select .zip or .tar.gz |
| | | if ! command -v unzip >/dev/null; then |
| | | distributionUrl="${distributionUrl%.zip}.tar.gz" |
| | | distributionUrlName="${distributionUrl##*/}" |
| | | fi |
| | | |
| | | # verbose opt |
| | | __MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' |
| | | [ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v |
| | | |
| | | # normalize http auth |
| | | case "${MVNW_PASSWORD:+has-password}" in |
| | | '') MVNW_USERNAME='' MVNW_PASSWORD='' ;; |
| | | has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; |
| | | esac |
| | | |
| | | if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then |
| | | verbose "Found wget ... using wget" |
| | | wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" |
| | | elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then |
| | | verbose "Found curl ... using curl" |
| | | curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" |
| | | elif set_java_home; then |
| | | verbose "Falling back to use Java to download" |
| | | javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" |
| | | targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" |
| | | cat >"$javaSource" <<-END |
| | | public class Downloader extends java.net.Authenticator |
| | | { |
| | | protected java.net.PasswordAuthentication getPasswordAuthentication() |
| | | { |
| | | return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); |
| | | } |
| | | public static void main( String[] args ) throws Exception |
| | | { |
| | | setDefault( new Downloader() ); |
| | | java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); |
| | | } |
| | | } |
| | | END |
| | | # For Cygwin/MinGW, switch paths to Windows format before running javac and java |
| | | verbose " - Compiling Downloader.java ..." |
| | | "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" |
| | | verbose " - Running Downloader.java ..." |
| | | "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" |
| | | fi |
| | | |
| | | # If specified, validate the SHA-256 sum of the Maven distribution zip file |
| | | if [ -n "${distributionSha256Sum-}" ]; then |
| | | distributionSha256Result=false |
| | | if [ "$MVN_CMD" = mvnd.sh ]; then |
| | | echo "Checksum validation is not supported for maven-mvnd." >&2 |
| | | echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 |
| | | exit 1 |
| | | elif command -v sha256sum >/dev/null; then |
| | | if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then |
| | | distributionSha256Result=true |
| | | fi |
| | | elif command -v shasum >/dev/null; then |
| | | if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then |
| | | distributionSha256Result=true |
| | | fi |
| | | else |
| | | echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 |
| | | echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 |
| | | exit 1 |
| | | fi |
| | | if [ $distributionSha256Result = false ]; then |
| | | echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 |
| | | echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 |
| | | exit 1 |
| | | fi |
| | | fi |
| | | |
| | | # unzip and move |
| | | if command -v unzip >/dev/null; then |
| | | unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" |
| | | else |
| | | tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" |
| | | fi |
| | | printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url" |
| | | mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" |
| | | |
| | | clean || : |
| | | exec_maven "$@" |
New file |
| | |
| | | <# : batch portion |
| | | @REM ---------------------------------------------------------------------------- |
| | | @REM Licensed to the Apache Software Foundation (ASF) under one |
| | | @REM or more contributor license agreements. See the NOTICE file |
| | | @REM distributed with this work for additional information |
| | | @REM regarding copyright ownership. The ASF licenses this file |
| | | @REM to you under the Apache License, Version 2.0 (the |
| | | @REM "License"); you may not use this file except in compliance |
| | | @REM with the License. You may obtain a copy of the License at |
| | | @REM |
| | | @REM https://www.apache.org/licenses/LICENSE-2.0 |
| | | @REM |
| | | @REM Unless required by applicable law or agreed to in writing, |
| | | @REM software distributed under the License is distributed on an |
| | | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| | | @REM KIND, either express or implied. See the License for the |
| | | @REM specific language governing permissions and limitations |
| | | @REM under the License. |
| | | @REM ---------------------------------------------------------------------------- |
| | | |
| | | @REM ---------------------------------------------------------------------------- |
| | | @REM Apache Maven Wrapper startup batch script, version 3.3.1 |
| | | @REM |
| | | @REM Optional ENV vars |
| | | @REM MVNW_REPOURL - repo url base for downloading maven distribution |
| | | @REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven |
| | | @REM MVNW_VERBOSE - true: enable verbose log; others: silence the output |
| | | @REM ---------------------------------------------------------------------------- |
| | | |
| | | @IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) |
| | | @SET __MVNW_CMD__= |
| | | @SET __MVNW_ERROR__= |
| | | @SET __MVNW_PSMODULEP_SAVE=%PSModulePath% |
| | | @SET PSModulePath= |
| | | @FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( |
| | | IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) |
| | | ) |
| | | @SET PSModulePath=%__MVNW_PSMODULEP_SAVE% |
| | | @SET __MVNW_PSMODULEP_SAVE= |
| | | @SET __MVNW_ARG0_NAME__= |
| | | @SET MVNW_USERNAME= |
| | | @SET MVNW_PASSWORD= |
| | | @IF NOT "%__MVNW_CMD__%"=="" (%__MVNW_CMD__% %*) |
| | | @echo Cannot start maven from wrapper >&2 && exit /b 1 |
| | | @GOTO :EOF |
| | | : end batch / begin powershell #> |
| | | |
| | | $ErrorActionPreference = "Stop" |
| | | if ($env:MVNW_VERBOSE -eq "true") { |
| | | $VerbosePreference = "Continue" |
| | | } |
| | | |
| | | # calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties |
| | | $distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl |
| | | if (!$distributionUrl) { |
| | | Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" |
| | | } |
| | | |
| | | switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { |
| | | "maven-mvnd-*" { |
| | | $USE_MVND = $true |
| | | $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" |
| | | $MVN_CMD = "mvnd.cmd" |
| | | break |
| | | } |
| | | default { |
| | | $USE_MVND = $false |
| | | $MVN_CMD = $script -replace '^mvnw','mvn' |
| | | break |
| | | } |
| | | } |
| | | |
| | | # apply MVNW_REPOURL and calculate MAVEN_HOME |
| | | # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash> |
| | | if ($env:MVNW_REPOURL) { |
| | | $MVNW_REPO_PATTERN = if ($USE_MVND) { "/org/apache/maven/" } else { "/maven/mvnd/" } |
| | | $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace '^.*'+$MVNW_REPO_PATTERN,'')" |
| | | } |
| | | $distributionUrlName = $distributionUrl -replace '^.*/','' |
| | | $distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' |
| | | $MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain" |
| | | $MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' |
| | | $MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" |
| | | |
| | | if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { |
| | | Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" |
| | | Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" |
| | | exit $? |
| | | } |
| | | |
| | | if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { |
| | | Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" |
| | | } |
| | | |
| | | # prepare tmp dir |
| | | $TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile |
| | | $TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" |
| | | $TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null |
| | | trap { |
| | | if ($TMP_DOWNLOAD_DIR.Exists) { |
| | | try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } |
| | | catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } |
| | | } |
| | | } |
| | | |
| | | New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null |
| | | |
| | | # Download and Install Apache Maven |
| | | Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." |
| | | Write-Verbose "Downloading from: $distributionUrl" |
| | | Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" |
| | | |
| | | $webclient = New-Object System.Net.WebClient |
| | | if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { |
| | | $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) |
| | | } |
| | | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 |
| | | $webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null |
| | | |
| | | # If specified, validate the SHA-256 sum of the Maven distribution zip file |
| | | $distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum |
| | | if ($distributionSha256Sum) { |
| | | if ($USE_MVND) { |
| | | Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." |
| | | } |
| | | Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash |
| | | if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { |
| | | Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." |
| | | } |
| | | } |
| | | |
| | | # unzip and move |
| | | Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null |
| | | Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null |
| | | try { |
| | | Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null |
| | | } catch { |
| | | if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { |
| | | Write-Error "fail to move MAVEN_HOME" |
| | | } |
| | | } finally { |
| | | try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } |
| | | catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } |
| | | } |
| | | |
| | | Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <parent> |
| | | <artifactId>pipIrr-web</artifactId> |
| | | <groupId>com.dy</groupId> |
| | | <version>1.0.0</version> |
| | | <relativePath>../pom.xml</relativePath> |
| | | </parent> |
| | | |
| | | <packaging>jar</packaging> |
| | | <artifactId>pipIrr-web-app</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | <name>pipIrr-web-app</name> |
| | | <description>手机App</description> |
| | | |
| | | |
| | | <build> |
| | | <plugins> |
| | | <!-- 生成不包含依赖jar的可执行jar包 |
| | | <plugin> |
| | | !- spring boot提供的maven打包插件 - |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <executions> |
| | | <execution> |
| | | !- |
| | | <goals> |
| | | <goal>repackage</goal> |
| | | </goals> |
| | | - |
| | | <configuration> |
| | | !- 不加的话最终包名为: ${artifactId}-${version}.jar, 加了的话最终包名: ${artifactId}-${version}-${classifier}.jar - |
| | | <classifier>execute</classifier> |
| | | !- 不指定生成路径的话, 默认保存在 ${build.directory} 下 - |
| | | <outputDirectory>${project.build.directory}/execute</outputDirectory> |
| | | <finalName>${artifactId}-${version}</finalName> |
| | | <layout>ZIP</layout> |
| | | <mainClass>com.dy.pipIrrBase.PipIrrBaseApplication</mainClass> |
| | | <includes> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-common</artifactId> |
| | | </include> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-global</artifactId> |
| | | </include> |
| | | </includes> |
| | | <excludes> |
| | | <exclude> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </exclude> |
| | | </excludes> |
| | | </configuration> |
| | | </execution> |
| | | </executions> |
| | | |
| | | </plugin> |
| | | --> |
| | | <!-- 拷贝依赖的jar包到lib目录--> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <executions> |
| | | <execution> |
| | | <configuration> |
| | | <!-- 不加的话最终包名为: ${artifactId}-${version}.jar, 加了的话最终包名: ${artifactId}-${version}-${classifier}.jar |
| | | <classifier>execute</classifier> |
| | | --> |
| | | <!-- ${project.build.directory}是maven变量,内置的,表示target目录,如果不写,将在根目录下创建/lib --> |
| | | <outputDirectory>${project.build.directory}/lib</outputDirectory> |
| | | <!-- excludeTransitive:是否不包含间接依赖包,比如我们依赖A,但是A又依赖了B,我们是否也要把B打进去 默认不打--> |
| | | <excludeTransitive>false</excludeTransitive> |
| | | <!-- 复制的jar文件去掉版本信息 --> |
| | | <stripVersion>false</stripVersion> |
| | | <finalName>${project.artifactId}-${project.version}</finalName> |
| | | <layout>ZIP</layout> |
| | | <mainClass>com.dy.pipIrrRemote.PipIrrRemoteApplication</mainClass> |
| | | <includes> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-common</artifactId> |
| | | </include> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-global</artifactId> |
| | | </include> |
| | | </includes> |
| | | <excludes> |
| | | <exclude> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </exclude> |
| | | </excludes> |
| | | </configuration> |
| | | </execution> |
| | | </executions> |
| | | </plugin> |
| | | |
| | | <plugin> |
| | | <!-- 设置java编译版本,运行环境版本 --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | | <!-- source: 源代码编译版本;target: 目标平台编译版本;encoding: 字符集编码。 --> |
| | | <configuration> |
| | | <source>${java.version}</source> |
| | | <target>${java.version}</target> |
| | | <encoding>${encoding}</encoding> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- 解决资源文件的编码问题 --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-resources-plugin</artifactId> |
| | | <configuration> |
| | | <encoding>${encoding}</encoding> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- maven里执行测试用例的插件 --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-surefire-plugin</artifactId> |
| | | <configuration> |
| | | <skipTests>true</skipTests> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- 下面解决:当进行Maven Lifecycle package时报错:Could not find artifact org.apache.mina:mina-core:bundle:2.2.1 in maven (https://repo1.maven.org/maven2/)--> |
| | | <groupId>org.apache.felix</groupId> |
| | | <artifactId>maven-bundle-plugin</artifactId> |
| | | <extensions>true</extensions> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.dy.pipIrrApp; |
| | | |
| | | import com.dy.common.multiDataSource.EnableMultiDataSource; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.context.annotation.ComponentScan; |
| | | import org.springframework.context.annotation.EnableAspectJAutoProxy; |
| | | import org.springframework.context.annotation.FilterType; |
| | | |
| | | @SpringBootApplication |
| | | @EnableAspectJAutoProxy |
| | | @EnableMultiDataSource |
| | | @ComponentScan(basePackages = {"com.dy.common", "com.dy.pipIrrGlobal", "com.dy.pipIrrApp"}, |
| | | excludeFilters = { |
| | | @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = { |
| | | com.dy.common.singleDataSource.DruidDataSourceConfig.class //排除单数据源 |
| | | }) |
| | | } |
| | | ) |
| | | @MapperScan(basePackages={"com.dy.pipIrrGlobal.daoRm", "com.dy.pipIrrGlobal.daoPr", "com.dy.pipIrrGlobal.daoSe", "com.dy.pipIrrGlobal.daoBa"}) |
| | | public class PipIrrAppApplication { |
| | | |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(PipIrrAppApplication.class, args); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrApp.config; |
| | | |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-05-07 17:09 |
| | | * @LastEditTime 2024-05-07 17:09 |
| | | * @Description |
| | | */ |
| | | @Configuration |
| | | public class RestTemplateConfig { |
| | | |
| | | @Bean |
| | | public RestTemplate restTemplate() { |
| | | return new RestTemplate(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrApp.config; |
| | | |
| | | import com.dy.common.webFilter.DevOfDataSourceNameSetFilter; |
| | | import com.dy.common.webFilter.UserTokenFilter; |
| | | import jakarta.servlet.Filter; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.boot.web.servlet.FilterRegistrationBean; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-05-07 14:51 |
| | | * @LastEditTime 2024-05-07 14:51 |
| | | * @Description |
| | | */ |
| | | @Configuration |
| | | public class WebFilterConfiguration { |
| | | |
| | | @Value("${pipIrr.global.dev}") |
| | | public String isDevStage ;//是否为开发阶段 |
| | | @Value("${pipIrr.global.dsName}") |
| | | public String dsName ;//开发阶段的数据源名称 |
| | | |
| | | /** |
| | | * DevOfDataSourceNameSetFilter与UserTokenFilter只能一个被配置上, |
| | | * 所以他们的order都是1 |
| | | */ |
| | | private static final int order_UserTokenFilter = 1 ;//与下面 |
| | | private static final int order_DevOfDataSourceNameSetFilter = 1 ; |
| | | |
| | | |
| | | @Bean |
| | | public FilterRegistrationBean<? extends Filter> RegFilter() { |
| | | FilterRegistrationBean<Filter> filterRegistrationBean = new FilterRegistrationBean<>(); |
| | | if(this.isDevStage != null && !this.isDevStage.trim().equals("") && this.isDevStage.trim().equalsIgnoreCase("true")){ |
| | | filterRegistrationBean.setFilter(new DevOfDataSourceNameSetFilter()); |
| | | filterRegistrationBean.addUrlPatterns("/*");//配置过滤规则 |
| | | filterRegistrationBean.addInitParameter("dataSourceName",dsName);//设置init参数 |
| | | filterRegistrationBean.setName("DevOfDataSourceNameSetFilter");//设置过滤器名称 |
| | | filterRegistrationBean.setOrder(order_DevOfDataSourceNameSetFilter);//执行次序 |
| | | }else{ |
| | | filterRegistrationBean.setFilter(new UserTokenFilter()); |
| | | filterRegistrationBean.addUrlPatterns("/*");//配置过滤规则 |
| | | filterRegistrationBean.setName("UserTokenFilter");//设置过滤器名称 |
| | | filterRegistrationBean.setOrder(order_UserTokenFilter);//执行次序 |
| | | } |
| | | return filterRegistrationBean; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrApp.config; |
| | | |
| | | import com.dy.common.webListener.GenerateIdSetSuffixListener; |
| | | import jakarta.servlet.ServletContextListener; |
| | | import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-05-07 14:52 |
| | | * @LastEditTime 2024-05-07 14:52 |
| | | * @Description |
| | | */ |
| | | @Configuration |
| | | public class WebListenerConfiguration { |
| | | |
| | | /** |
| | | * 启动顺序 |
| | | */ |
| | | //private static final int order_config = 0 ; |
| | | private static final int order_idSetSuffix = 1 ; |
| | | //private static final int order_init = 2 ; |
| | | |
| | | /* |
| | | * 解析各种***.config配置的ConfigListener,暂时不采用此种配置方式 |
| | | * |
| | | @Bean |
| | | public ConfigListener getGlConfigListener(){ |
| | | return new ConfigListener() ; |
| | | } |
| | | /** |
| | | * 外部提供Listener |
| | | * @param listener 外部提供Listener |
| | | * @return 注册Bean |
| | | @Bean |
| | | public ServletListenerRegistrationBean<? extends ServletContextListener> regConfigListener(ConfigListener listener) { |
| | | ServletListenerRegistrationBean<ConfigListener> listenerRegistrationBean = new ServletListenerRegistrationBean<>(); |
| | | listenerRegistrationBean.setListener(listener); |
| | | listenerRegistrationBean.setOrder(order_config); |
| | | return listenerRegistrationBean; |
| | | } |
| | | */ |
| | | |
| | | /** |
| | | * 内部提供listener,该listener在系统启动时,根据配置 设置ID产生器的后缀 |
| | | * @return 注册Bean |
| | | */ |
| | | @Bean |
| | | public ServletListenerRegistrationBean<? extends ServletContextListener> regSsoListener() { |
| | | ServletListenerRegistrationBean<GenerateIdSetSuffixListener> listenerRegistrationBean = new ServletListenerRegistrationBean<>(); |
| | | listenerRegistrationBean.setListener(new GenerateIdSetSuffixListener()); |
| | | listenerRegistrationBean.setOrder(order_idSetSuffix); |
| | | return listenerRegistrationBean; |
| | | } |
| | | |
| | | // /** |
| | | // * 内部提供listener,该listener在系统启动时,初始化数据库数据 |
| | | // * @return 注册Bean |
| | | // */ |
| | | // @Bean |
| | | // public ServletListenerRegistrationBean<? extends ServletContextListener> regInitListener() { |
| | | // ServletListenerRegistrationBean<InitListener> listenerRegistrationBean = new ServletListenerRegistrationBean<>(); |
| | | // listenerRegistrationBean.setListener(new InitListener()); |
| | | // listenerRegistrationBean.setOrder(order_init); |
| | | // return listenerRegistrationBean; |
| | | // } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrApp.result; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-05-30 9:37 |
| | | * @LastEditTime 2024-05-30 9:37 |
| | | * @Description |
| | | */ |
| | | |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum AppResultCode { |
| | | |
| | | XXX(10001,"XXX"); |
| | | |
| | | private final Integer code; |
| | | private final String message; |
| | | } |
New file |
| | |
| | | spring: |
| | | profiles: |
| | | include: global, database, database-ym, database-pj |
| | | |
| | | #actutor的web端口 |
| | | management: |
| | | server: |
| | | port: ${pipIrr.app.actutorPort} |
| | | #web服务端口,tomcat默认是8088 |
| | | server: |
| | | port: ${pipIrr.app.webPort} |
| | | servlet: |
| | | context-path: /app #web访问上下文路径 |
| | | context-parameters: |
| | | #GenerateIdSetSuffixListener中应用,取值范围是0-99 |
| | | idSuffix: ${pipIrr.app.idSuffix} |
| | | #ConfigListener中应用 |
| | | #configFileNames: config-global.xml,config-demo.xml |
New file |
| | |
| | | Configuration: |
| | | #status,这个用于设置log4j2自身内部的信息输出,可以不设置,当设置成trace时,你会看到log4j2内部各种详细输出;可以设置成Off(关闭)或Error(只输出错误信息) |
| | | status: Error |
| | | |
| | | Properties: # 定义全局变量 |
| | | Property: |
| | | #日志文件存储的目录 |
| | | - name: log.path |
| | | value: ./logs |
| | | #日志文件存储名称 |
| | | - name: project.name |
| | | value: pipIrrRemote |
| | | |
| | | #定义输出器,可以输出到控制台和文件. |
| | | Appenders: |
| | | #输出到控制台 |
| | | Console: |
| | | #Appender命名 |
| | | name: CONSOLE |
| | | target: SYSTEM_OUT |
| | | ThresholdFilter: |
| | | level: debug #输出日志级别,输出日志时,首先由Loggers.Root.level或Loggers.Logger.level判断是否输出,然后再由本level判断是否输出 |
| | | onMatch: ACCEPT #onMatch=ACCEPT 大于等于 "level" 配置的等级地日志输出 |
| | | onMismatch: DENY #onMismatch=DENY 小于 "level" 配置的等级地日志不输出 |
| | | #日志内容样式 |
| | | PatternLayout: |
| | | #%n-换行 |
| | | #%m-日志内容,输出代码中指定的日志信息 |
| | | #%p-输出优先级,即DEBUG,INFO,WARN,ERROR,FATAL |
| | | #%r-程序启动到现在的毫秒数 |
| | | #%%- 输出一个"%" 字符 |
| | | #%t-当前线程名 |
| | | #%d-日期和时间, 常用的格式有%d{DATE},%d{ABSOLUTE},%d{HH:mm:ss,SSS},%d{ddMMyyyyHH:mm:ss,SSS} |
| | | #%l-同%F%L%C%M |
| | | #%F-java源文件名 |
| | | #%L-java源码行数 |
| | | #%C-java类名,%C{1}输出最后一个元素 |
| | | #%M-java方法名 |
| | | pattern: "%d{yyyy-MM-dd HH:mm:ss,SSS}:%4p %t (%C.%M:%L) - %m%n" |
| | | # 输出到文件,超过10MB归档 |
| | | RollingFile: |
| | | - name: ROLLING_FILE |
| | | ignoreExceptions: false |
| | | fileName: ${log.path}/${project.name}.log |
| | | filePattern: "${log.path}/$${date:yyyy-MM}/${project.name}-%d{yyyy-MM-dd}-%i.log.gz" |
| | | ThresholdFilter: |
| | | level: error #输出日志级别,输出日志时,首先由Loggers.Root.level或Loggers.Logger.level判断是否输出,然后再由本level判断是否输出 |
| | | onMatch: ACCEPT #onMatch=ACCEPT 大于等于 "level" 配置的等级地日志输出 |
| | | onMismatch: DENY #onMismatch=DENY 小于 "level" 配置的等级地日志不输出 |
| | | #日志内容样式 |
| | | PatternLayout: |
| | | pattern: "%d{yyyy-MM-dd HH:mm:ss,SSS}:%4p %t (%C.%M:%L) - %m%n" |
| | | Policies: |
| | | SizeBasedTriggeringPolicy: |
| | | size: "10 MB" |
| | | DefaultRolloverStrategy: |
| | | max: 1000 |
| | | |
| | | Loggers: |
| | | Root: |
| | | level: info #日志输出级别,共有8个级别,按照从低到高为:all < trace < debug < info < warn < error < fatal < off |
| | | AppenderRef: #Root的子节点,用来指定该日志输出到哪个Appender. |
| | | - ref: CONSOLE #输出日志时,首先由本level判断是否输出,然后再由上面的Appenders.Console.ThresholdFilter.level判断是否输出 |
| | | - ref: ROLLING_FILE #输出日志时,首先由本level判断是否输出,然后再由上面的Appenders.RollingFile.ThresholdFilter.level判断是否输出 |
| | | # 为包配置特殊的Log级别,方便调试, |
| | | # 不受Loggers.Root.level限制 |
| | | Logger: |
| | | - name: com.dy.pipIrrGlobal.daoBa |
| | | additivity: false #去除重复的log |
| | | level: debug #输出日志级别 |
| | | AppenderRef: |
| | | - ref: CONSOLE #输出日志时,首先由本.level判断是否输出,然后再由上面的Appenders.Console.ThresholdFilter.level判断是否输出 |
| | | - ref: ROLLING_FILE #输出日志时,首先由本level判断是否输出,然后再由上面的Appenders.RollingFile.ThresholdFilter.level判断是否输出 |
New file |
| | |
| | | package com.dy.pipIrrApp; |
| | | |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | @SpringBootTest |
| | | class PipIrrWebAppApplicationTests { |
| | | |
| | | @Test |
| | | void contextLoads() { |
| | | } |
| | | |
| | | } |
| | |
| | | import com.dy.common.mw.protocol.CommandType; |
| | | import com.dy.common.mw.protocol.Data; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ProtocolConstantV206V202404; |
| | | import com.dy.common.mw.protocol.p206V202404.downVos.ComCdXyVo; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | |
| | | protected static String controllerType = "57" ;//控制器类型 |
| | | protected static Integer projectNo = 100 ;//项目编码 |
| | | |
| | | protected static String icCardAddr = "04BEA5BB" ;//IC卡地址 |
| | | protected static String icCardNo = "37142501020500001" ;//IC卡编号(用户卡序列号) |
| | | |
| | | protected String protocolName = ProtocolConstantV206V202404.protocolName; |
| | | //protected static String icCardAddr = "04BEA5BB" ;//IC卡地址 |
| | | //protected static String icCardNo = "37142501020500001" ;//IC卡编号(用户卡序列号) |
| | | //protected String protocolName = ProtocolConstantV206V202404.protocolName; |
| | | |
| | | protected String commandTypeOuter = CommandType.outerCommand; |
| | | |
| | | // 存储实例化的 CompletableFuture<Data> 对象 |
| | | protected static Map<String, Object> features = new HashMap<>(); |
| | | protected static Map<Long, Object> features = new HashMap<>(); |
| | | protected static Boolean setuped = false; |
| | | |
| | | @Autowired |
| | |
| | | * 获取系统配置参数 |
| | | */ |
| | | public void setUp() { |
| | | protocolName = comSupport.baSettingsMapper.getItemValue("protocolName"); |
| | | //protocolName = comSupport.baSettingsMapper.getItemValue("protocolName"); |
| | | controllerType = comSupport.baSettingsMapper.getItemValue("controllerType"); |
| | | projectNo = Integer.parseInt(comSupport.baSettingsMapper.getItemValue("projectNo")); |
| | | setuped = true; |
| | |
| | | |
| | | /** |
| | | * 创建命令日志对象 |
| | | * @param comId 主键 |
| | | * @param commandCode 功能码 |
| | | * @param rtuAddr 阀控器地址 |
| | | * @param protocol 通讯协议名称 |
| | | * @param param 参数数据 |
| | | * @param operator 操作员 |
| | | * @return 零零日志对象 |
| | | * @return |
| | | */ |
| | | protected RmCommandHistory getComHistory(String commandCode, String rtuAddr, Object param, Long operator ) { |
| | | protected RmCommandHistory getComHistory(Long comId, String commandCode, Long intakeId, String rtuAddr, String protocol, Object param, Long operator ) { |
| | | RmCommandHistory rmCommandHistory = new RmCommandHistory(); |
| | | rmCommandHistory.setId(comId); |
| | | rmCommandHistory.setCommandCode(commandCode); |
| | | rmCommandHistory.setCommandName(CodeV202404.getCodeName(commandCode)); |
| | | rmCommandHistory.setRtuaddr(rtuAddr); |
| | | rmCommandHistory.setProtocol(protocolName); |
| | | rmCommandHistory.setIntakeId(intakeId); |
| | | rmCommandHistory.setRtuAddr(rtuAddr); |
| | | rmCommandHistory.setProtocol(protocol); |
| | | rmCommandHistory.setParam((JSONObject) JSON.toJSON(param)); |
| | | rmCommandHistory.setSendTime(new Date()); |
| | | rmCommandHistory.setOperator(operator); |
| | |
| | | * @param param 参数数据 |
| | | * @return 构造好的命令对象 |
| | | */ |
| | | protected Command command(String comId, String commandCode, String rtuAddr, Object param){ |
| | | protected Command command(Long comId, String commandCode, String rtuAddr, String protocol, Object param){ |
| | | Command com = new Command() ; |
| | | com.id = comId==null?Command.defaultId:(comId.trim().equals("")?Command.defaultId:comId); |
| | | com.id = String.valueOf(comId); |
| | | com.code = commandCode ; |
| | | com.rtuAddr = rtuAddr ; |
| | | |
| | | com.protocol = protocolName; |
| | | com.protocol = protocol; |
| | | com.type = commandTypeOuter; |
| | | com.rtuResultSendWebUrl = rtuResultSendWebUrl ; |
| | | |
| | |
| | | * @param comId |
| | | * @return |
| | | */ |
| | | protected BaseResponse<Data> dealWithCallBack(String comId) { |
| | | protected BaseResponse<Data> dealWithCallBack(Long comId) { |
| | | CompletableFuture<Data> featureObject = new CompletableFuture<>(); |
| | | features.put(comId, featureObject); |
| | | try { |
| | | CompletableFuture<Data> feature = (CompletableFuture<Data>) features.get(comId); |
| | | System.out.println("receive result ID:" + comId); |
| | | Data resultData = feature.get(30, TimeUnit.SECONDS); |
| | | Data resultData = feature.get(10, TimeUnit.SECONDS); |
| | | features.remove(comId); |
| | | String commandId = resultData.getCommandId(); |
| | | if(commandId.equals(comId)) { |
| | |
| | | import com.dy.pipIrrGlobal.daoPr.PrIntakeMapper; |
| | | import com.dy.pipIrrGlobal.daoRm.RmCommandHistoryMapper; |
| | | import com.dy.pipIrrGlobal.daoSe.SeVirtualCardMapper; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrController; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmCommandHistory; |
| | | import com.dy.pipIrrGlobal.voPr.VoOnLineIntake; |
| | | import com.dy.pipIrrGlobal.voRm.VoUnclosedValve; |
| | |
| | | private final PrIntakeMapper prIntakeMapper; |
| | | |
| | | /** |
| | | * 根据取水口ID获取阀控器地址 |
| | | * @param intakeId 取水口ID |
| | | * @return 阀控器地址 |
| | | * 根据取水口ID获取阀控器对象 |
| | | * @param intakeId |
| | | * @return |
| | | */ |
| | | public String getRtuAddrByIntakeId(Long intakeId) { |
| | | return prControllerMapper.getRtuAddrByIntakeId(intakeId); |
| | | public PrController getControllerByIntakeId(Long intakeId) { |
| | | return prControllerMapper.getControllerByIntakeId(intakeId); |
| | | } |
| | | |
| | | /** |
| | | * 根据RTU地址获取阀控器对象 |
| | | * @param rtuAddr |
| | | * @return |
| | | */ |
| | | public PrController getControllerByRtuAddr(String rtuAddr) { |
| | | return prControllerMapper.getControllerByRtuAddr(rtuAddr); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param po 命令日志对象 |
| | | * @return 字符串类型的主键 |
| | | */ |
| | | public String insert(RmCommandHistory po) { |
| | | public Long insert(RmCommandHistory po) { |
| | | rmCommandHistoryMapper.insert(po); |
| | | return (po.getId()).toString(); |
| | | return po.getId(); |
| | | } |
| | | |
| | | /** |
| | |
| | | /** |
| | | * RTU |
| | | */ |
| | | RTU_ADDR_CANNOT_BE_NULL(20001, "阀控器地址不能为空"); |
| | | RTU_NOT_EXIST(20001, "阀控器不存在"), |
| | | RTU_ADDR_CANNOT_BE_NULL(20002, "阀控器地址不能为空"); |
| | | |
| | | private final Integer code; |
| | | private final String message; |
| | |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.downVos.ComCd10Vo; |
| | | import com.dy.common.mw.protocol.p206V202404.downVos.ComCdXyVo; |
| | | import com.dy.common.util.IDLongGenerator; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrController; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmCommandHistory; |
| | | import com.dy.pipIrrGlobal.voPr.VoOnLineIntake; |
| | | import com.dy.pipIrrRemote.common.ComSupport; |
| | |
| | | private final CommandSv commandSv; |
| | | |
| | | protected static String controllerType = "57"; |
| | | private final IDLongGenerator idLongGenerator; |
| | | |
| | | /** |
| | | * 查询所有RTU在线情况(仅测试用) |
| | |
| | | String newRtuAddr = addr.getNewRtuAddr(); |
| | | Long operator = addr.getOperator(); |
| | | String commandCode = CodeV202404.cd_10; |
| | | Long comId = idLongGenerator.generate(); |
| | | |
| | | // 取水口ID换阀控器地址 |
| | | String rtuAddr = commandSv.getRtuAddrByIntakeId(intakeId); |
| | | if(rtuAddr == null || rtuAddr.length() == 0) { |
| | | return BaseResponseUtils.buildError(RemoteResultCode.RTU_ADDR_CANNOT_BE_NULL.getMessage()); |
| | | // 取水口ID换阀控器地址及通讯协议 |
| | | PrController prController = commandSv.getControllerByIntakeId(intakeId); |
| | | if(prController == null) { |
| | | return BaseResponseUtils.buildError(RemoteResultCode.RTU_NOT_EXIST.getMessage()); |
| | | } |
| | | String rtuAddr = prController.getRtuAddr(); |
| | | String protocol = prController.getProtocol(); |
| | | |
| | | // 创建视图 |
| | | ComCd10Vo param = new ComCd10Vo() ; |
| | |
| | | param.rtuNewAddr = newRtuAddr; |
| | | |
| | | // 创建命令日志对象并添加到数据库中 |
| | | RmCommandHistory rmCommandHistory = getComHistory(commandCode, rtuAddr, param, operator); |
| | | String comId = commandSv.insert(rmCommandHistory); |
| | | RmCommandHistory rmCommandHistory = getComHistory(comId, commandCode, intakeId, rtuAddr, protocol, param, operator); |
| | | comId = commandSv.insert(rmCommandHistory); |
| | | System.out.println(comId); |
| | | |
| | | // 构造命令 |
| | | Command com = command(comId, commandCode, rtuAddr, param); |
| | | Command com = command(comId, commandCode, rtuAddr, protocol, param); |
| | | sendCom2Mw(com); |
| | | |
| | | CompletableFuture<Data> featureObject = new CompletableFuture<>(); |
| | |
| | | String commandCode = CodeV202404.cd_97; |
| | | Long intakeId = po.getIntakeId(); |
| | | Long operator = po.getOperator(); |
| | | Long comId = idLongGenerator.generate(); |
| | | |
| | | // 取水口ID换阀控器地址 |
| | | String rtuAddr = commandSv.getRtuAddrByIntakeId(intakeId); |
| | | if(rtuAddr == null || rtuAddr.length() == 0) { |
| | | return BaseResponseUtils.buildError(RemoteResultCode.RTU_ADDR_CANNOT_BE_NULL.getMessage()); |
| | | // 取水口ID换阀控器地址及通讯协议 |
| | | PrController prController = commandSv.getControllerByIntakeId(intakeId); |
| | | if(prController == null) { |
| | | return BaseResponseUtils.buildError(RemoteResultCode.RTU_NOT_EXIST.getMessage()); |
| | | } |
| | | String rtuAddr = prController.getRtuAddr(); |
| | | String protocol = prController.getProtocol(); |
| | | |
| | | // 创建视图 |
| | | ComCdXyVo param = new ComCdXyVo(); |
| | |
| | | param.projectNo = projectNo; |
| | | |
| | | // 创建命令日志对象并添加到数据库中 |
| | | RmCommandHistory rmCommandHistory = getComHistory(commandCode, rtuAddr, param, operator); |
| | | String comId = commandSv.insert(rmCommandHistory); |
| | | RmCommandHistory rmCommandHistory = getComHistory(comId, commandCode, intakeId, rtuAddr, protocol, param, operator); |
| | | comId = commandSv.insert(rmCommandHistory); |
| | | |
| | | // 构造命令 |
| | | Command com = command(comId, commandCode, rtuAddr, param); |
| | | Command com = command(comId, commandCode, rtuAddr, protocol, param); |
| | | return sendCom2Mw(com); |
| | | } |
| | | } |
| | |
| | | package com.dy.pipIrrRemote.valve; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.mw.protocol.Command; |
| | | import com.dy.common.mw.protocol.Data; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.downVos.ComCd92_A2Vo; |
| | | import com.dy.common.mw.protocol.p206V202404.downVos.ComCd93_A3Vo; |
| | | import com.dy.common.util.IDLongGenerator; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.pipIrrGlobal.daoPr.PrWaterPriceMapper; |
| | | import com.dy.pipIrrGlobal.daoRm.RmCommandHistoryMapper; |
| | | import com.dy.pipIrrGlobal.daoSe.SeVirtualCardMapper; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrController; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmCommandHistory; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeVirtualCard; |
| | | import com.dy.pipIrrGlobal.voRm.VoUnclosedValve; |
| | |
| | | */ |
| | | |
| | | @Slf4j |
| | | @Tag(name = "分水房管理", description = "分水房操作") |
| | | @Tag(name = "阀门管理", description = "阀门操作") |
| | | @RestController |
| | | @RequestMapping(path="valve") |
| | | @RequiredArgsConstructor |
| | |
| | | private final CommandSv commandSv; |
| | | private final SeVirtualCardMapper seVirtualCardMapper; |
| | | private final PrWaterPriceMapper prWaterPriceMapper; |
| | | private final RmCommandHistoryMapper rmCommandHistoryMapper; |
| | | private final IDLongGenerator idLongGenerator; |
| | | |
| | | /** |
| | | * 远程开阀(平台、APP) |
| | |
| | | Long vcId = valve.getVcId(); |
| | | Integer userType = valve.getUserType(); |
| | | Long operator = valve.getOperator(); |
| | | String comId = null; |
| | | Long comId = idLongGenerator.generate(); |
| | | |
| | | // 获取系统参数 |
| | | if(!setuped) { |
| | |
| | | // 获取水价 |
| | | Double waterPrice = prWaterPriceMapper.getPrice(); |
| | | |
| | | // 取水口ID换阀控器地址 |
| | | String rtuAddr = commandSv.getRtuAddrByIntakeId(intakeId); |
| | | if(rtuAddr == null || rtuAddr.length() == 0) { |
| | | return BaseResponseUtils.buildError(RemoteResultCode.RTU_ADDR_CANNOT_BE_NULL.getMessage()); |
| | | // 取水口ID换阀控器地址及通讯协议 |
| | | PrController prController = commandSv.getControllerByIntakeId(intakeId); |
| | | if(prController == null) { |
| | | return BaseResponseUtils.buildError(RemoteResultCode.RTU_NOT_EXIST.getMessage()); |
| | | } |
| | | String rtuAddr = prController.getRtuAddr(); |
| | | String protocol = prController.getProtocol(); |
| | | |
| | | // 生成订单号 |
| | | LocalDateTime dateTime = LocalDateTime.now(); |
| | |
| | | String orderNo = dtf.format(dateTime) + sb.toString(); |
| | | |
| | | String commandCode = null; |
| | | if(protocolName.equals("p206V202404")) { |
| | | if(protocol.equals("p206V202404")) { |
| | | // 获取功能码 |
| | | if(userType == 1) { |
| | | // 平台开阀 |
| | |
| | | param.elePrice = 0.0; |
| | | param.orderNo = orderNo; |
| | | |
| | | // 创建命令日志对象并添加到数据库中 |
| | | RmCommandHistory rmCommandHistory = getComHistory(commandCode, rtuAddr, param, operator); |
| | | comId = commandSv.insert(rmCommandHistory); |
| | | // 构造命令 |
| | | Command com = command(comId, commandCode, rtuAddr, protocol, param); |
| | | |
| | | // 构造并发送命令 |
| | | Command com = command(comId, commandCode, rtuAddr, param); |
| | | sendCom2Mw(com); |
| | | // 发送命令 |
| | | JSONObject response_SendCom= (JSONObject) JSON.toJSON(sendCom2Mw(com)); |
| | | if(response_SendCom != null && response_SendCom.getString("code").equals("0001")) { |
| | | // 请求成功 |
| | | |
| | | // 创建命令日志对象并添加到数据库中 |
| | | RmCommandHistory rmCommandHistory = getComHistory(comId, commandCode, intakeId, rtuAddr, protocol, param, operator); |
| | | commandSv.insert(rmCommandHistory); |
| | | |
| | | // 处理回调 |
| | | BaseResponse response_CallBack = dealWithCallBack(comId); |
| | | if(!response_CallBack.getCode().equals("0001")) { |
| | | return BaseResponseUtils.buildError(RemoteResultCode.GET_RESULT_ERROR.getMessage()); |
| | | } |
| | | |
| | | // 更改虚拟卡状态:是否使用中、最后操作、最后操作时间 |
| | | SeVirtualCard virtualCard = new SeVirtualCard(); |
| | | virtualCard.setId(vcId); |
| | | virtualCard.setInUse((byte) 1); |
| | | virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode()); |
| | | virtualCard.setLastOperateTime(new Date()); |
| | | seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard); |
| | | |
| | | // 回调返回的内容 |
| | | Data myData = (Data)response_CallBack.getContent(); |
| | | return BaseResponseUtils.buildSuccess(myData) ; |
| | | } else { |
| | | // 请求失败 |
| | | JSONObject job_param = response_SendCom.getJSONObject("content").getJSONObject("param"); |
| | | return BaseResponseUtils.buildFail(job_param.getString("message")); |
| | | } |
| | | } else { |
| | | // 获取功能码 |
| | | if(userType == 1) { |
| | |
| | | ComCd92_A2Vo param = new ComCd92_A2Vo(); |
| | | |
| | | // 创建命令日志对象并添加到数据库中 |
| | | RmCommandHistory rmCommandHistory = getComHistory(commandCode, rtuAddr, param, operator); |
| | | comId = commandSv.insert(rmCommandHistory); |
| | | //RmCommandHistory rmCommandHistory = getComHistory(commandCode, rtuAddr, protocol, param, operator); |
| | | //comId = commandSv.insert(rmCommandHistory); |
| | | |
| | | // 构造并发送命令 |
| | | Command com = command(comId, commandCode, rtuAddr, param); |
| | | Command com = command(comId, commandCode, rtuAddr, protocol, param); |
| | | sendCom2Mw(com); |
| | | |
| | | return BaseResponseUtils.buildSuccess(); |
| | | } |
| | | |
| | | // 处理回调 |
| | | BaseResponse response = dealWithCallBack(comId); |
| | | if(!response.getCode().equals("0001")) { |
| | | return BaseResponseUtils.buildError(RemoteResultCode.GET_RESULT_ERROR.getMessage()); |
| | | } |
| | | |
| | | // 更改虚拟卡状态:是否使用中、最后操作、最后操作时间 |
| | | SeVirtualCard virtualCard = new SeVirtualCard(); |
| | | virtualCard.setId(vcId); |
| | | virtualCard.setInUse((byte) 1); |
| | | virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode()); |
| | | virtualCard.setLastOperateTime(new Date()); |
| | | seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard); |
| | | |
| | | Data myData = (Data)response.getContent(); |
| | | return BaseResponseUtils.buildSuccess(myData) ; |
| | | } |
| | | |
| | | /** |
| | |
| | | String orderNo = valve.getOrderNo(); |
| | | Integer userType = valve.getUserType(); |
| | | Long operator = valve.getOperator(); |
| | | String comId = null; |
| | | Long comId = idLongGenerator.generate(); |
| | | |
| | | // 获取系统参数 |
| | | if(!setuped) { |
| | | setUp(); |
| | | } |
| | | |
| | | // 阀控器地址换取水口ID和通讯协议 |
| | | PrController prController = commandSv.getControllerByRtuAddr(rtuAddr); |
| | | if(prController == null) { |
| | | return BaseResponseUtils.buildError(RemoteResultCode.RTU_NOT_EXIST.getMessage()); |
| | | } |
| | | Long intakeId = prController.getIntakeId(); |
| | | String protocol = prController.getProtocol(); |
| | | |
| | | String commandCode = null; |
| | | if(protocolName.equals("p206V202404")) { |
| | | if(protocol.equals("p206V202404")) { |
| | | // 获取功能码 |
| | | if (userType == 1) { |
| | | // 平台关阀 |
| | |
| | | param.icCardNo = vcNum; |
| | | param.orderNo = orderNo; |
| | | |
| | | // 创建命令日志对象并添加到数据库中 |
| | | RmCommandHistory rmCommandHistory = getComHistory(commandCode, rtuAddr, param, operator); |
| | | comId = commandSv.insert(rmCommandHistory); |
| | | // 构造命令 |
| | | Command com = command(comId, commandCode, rtuAddr, protocol, param); |
| | | |
| | | // 构造并发送命令 |
| | | Command com = command(comId, commandCode, rtuAddr, param); |
| | | sendCom2Mw(com); |
| | | // 发送命令 |
| | | JSONObject response_SendCom= (JSONObject) JSON.toJSON(sendCom2Mw(com)); |
| | | if(response_SendCom != null && response_SendCom.getString("code").equals("0001")) { |
| | | // 请求成功 |
| | | |
| | | // 创建命令日志对象并添加到数据库中 |
| | | RmCommandHistory rmCommandHistory = getComHistory(comId, commandCode, intakeId, rtuAddr, protocol, param, operator); |
| | | commandSv.insert(rmCommandHistory); |
| | | |
| | | // 处理回调 |
| | | BaseResponse response_CallBack = dealWithCallBack(comId); |
| | | if(!response_CallBack.getCode().equals("0001")) { |
| | | return BaseResponseUtils.buildError(RemoteResultCode.GET_RESULT_ERROR.getMessage()); |
| | | } |
| | | |
| | | // 更改虚拟卡状态:是否使用中、最后操作、最后操作时间 |
| | | Long vcId = seVirtualCardMapper.getVcIdByNum(vcNum); |
| | | SeVirtualCard virtualCard = new SeVirtualCard(); |
| | | virtualCard.setId(vcId); |
| | | virtualCard.setInUse((byte) 1); |
| | | virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode()); |
| | | virtualCard.setLastOperateTime(new Date()); |
| | | seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard); |
| | | |
| | | // 回调返回的内容 |
| | | Data myData = (Data)response_CallBack.getContent(); |
| | | return BaseResponseUtils.buildSuccess(myData) ; |
| | | } else { |
| | | // 请求失败 |
| | | JSONObject job_param = response_SendCom.getJSONObject("content").getJSONObject("param"); |
| | | return BaseResponseUtils.buildFail(job_param.getString("message")); |
| | | } |
| | | } else { |
| | | // 获取功能码 |
| | | if (userType == 1) { |
| | |
| | | param.orderNo = orderNo; |
| | | |
| | | // 创建命令日志对象并添加到数据库中 |
| | | RmCommandHistory rmCommandHistory = getComHistory(commandCode, rtuAddr, param, operator); |
| | | RmCommandHistory rmCommandHistory = getComHistory(comId, commandCode, intakeId, rtuAddr, protocol, param, operator); |
| | | comId = commandSv.insert(rmCommandHistory); |
| | | |
| | | // 构造并发送命令 |
| | | Command com = command(comId, commandCode, rtuAddr, param); |
| | | Command com = command(comId, commandCode, rtuAddr, protocol, param); |
| | | sendCom2Mw(com); |
| | | } |
| | | |
New file |
| | |
| | | HELP.md |
| | | target/ |
| | | !.mvn/wrapper/maven-wrapper.jar |
| | | !**/src/main/**/target/ |
| | | !**/src/test/**/target/ |
| | | |
| | | ### STS ### |
| | | .apt_generated |
| | | .classpath |
| | | .factorypath |
| | | .project |
| | | .settings |
| | | .springBeans |
| | | .sts4-cache |
| | | |
| | | ### IntelliJ IDEA ### |
| | | .idea |
| | | *.iws |
| | | *.iml |
| | | *.ipr |
| | | |
| | | ### NetBeans ### |
| | | /nbproject/private/ |
| | | /nbbuild/ |
| | | /dist/ |
| | | /nbdist/ |
| | | /.nb-gradle/ |
| | | build/ |
| | | !**/src/main/**/build/ |
| | | !**/src/test/**/build/ |
| | | |
| | | ### VS Code ### |
| | | .vscode/ |
New file |
| | |
| | | # Licensed to the Apache Software Foundation (ASF) under one |
| | | # or more contributor license agreements. See the NOTICE file |
| | | # distributed with this work for additional information |
| | | # regarding copyright ownership. The ASF licenses this file |
| | | # to you under the Apache License, Version 2.0 (the |
| | | # "License"); you may not use this file except in compliance |
| | | # with the License. You may obtain a copy of the License at |
| | | # |
| | | # https://www.apache.org/licenses/LICENSE-2.0 |
| | | # |
| | | # Unless required by applicable law or agreed to in writing, |
| | | # software distributed under the License is distributed on an |
| | | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| | | # KIND, either express or implied. See the License for the |
| | | # specific language governing permissions and limitations |
| | | # under the License. |
| | | wrapperVersion=3.3.1 |
| | | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip |
New file |
| | |
| | | #!/bin/sh |
| | | # ---------------------------------------------------------------------------- |
| | | # Licensed to the Apache Software Foundation (ASF) under one |
| | | # or more contributor license agreements. See the NOTICE file |
| | | # distributed with this work for additional information |
| | | # regarding copyright ownership. The ASF licenses this file |
| | | # to you under the Apache License, Version 2.0 (the |
| | | # "License"); you may not use this file except in compliance |
| | | # with the License. You may obtain a copy of the License at |
| | | # |
| | | # https://www.apache.org/licenses/LICENSE-2.0 |
| | | # |
| | | # Unless required by applicable law or agreed to in writing, |
| | | # software distributed under the License is distributed on an |
| | | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| | | # KIND, either express or implied. See the License for the |
| | | # specific language governing permissions and limitations |
| | | # under the License. |
| | | # ---------------------------------------------------------------------------- |
| | | |
| | | # ---------------------------------------------------------------------------- |
| | | # Apache Maven Wrapper startup batch script, version 3.3.1 |
| | | # |
| | | # Optional ENV vars |
| | | # ----------------- |
| | | # JAVA_HOME - location of a JDK home dir, required when download maven via java source |
| | | # MVNW_REPOURL - repo url base for downloading maven distribution |
| | | # MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven |
| | | # MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output |
| | | # ---------------------------------------------------------------------------- |
| | | |
| | | set -euf |
| | | [ "${MVNW_VERBOSE-}" != debug ] || set -x |
| | | |
| | | # OS specific support. |
| | | native_path() { printf %s\\n "$1"; } |
| | | case "$(uname)" in |
| | | CYGWIN* | MINGW*) |
| | | [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" |
| | | native_path() { cygpath --path --windows "$1"; } |
| | | ;; |
| | | esac |
| | | |
| | | # set JAVACMD and JAVACCMD |
| | | set_java_home() { |
| | | # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched |
| | | if [ -n "${JAVA_HOME-}" ]; then |
| | | if [ -x "$JAVA_HOME/jre/sh/java" ]; then |
| | | # IBM's JDK on AIX uses strange locations for the executables |
| | | JAVACMD="$JAVA_HOME/jre/sh/java" |
| | | JAVACCMD="$JAVA_HOME/jre/sh/javac" |
| | | else |
| | | JAVACMD="$JAVA_HOME/bin/java" |
| | | JAVACCMD="$JAVA_HOME/bin/javac" |
| | | |
| | | if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then |
| | | echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 |
| | | echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 |
| | | return 1 |
| | | fi |
| | | fi |
| | | else |
| | | JAVACMD="$( |
| | | 'set' +e |
| | | 'unset' -f command 2>/dev/null |
| | | 'command' -v java |
| | | )" || : |
| | | JAVACCMD="$( |
| | | 'set' +e |
| | | 'unset' -f command 2>/dev/null |
| | | 'command' -v javac |
| | | )" || : |
| | | |
| | | if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then |
| | | echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 |
| | | return 1 |
| | | fi |
| | | fi |
| | | } |
| | | |
| | | # hash string like Java String::hashCode |
| | | hash_string() { |
| | | str="${1:-}" h=0 |
| | | while [ -n "$str" ]; do |
| | | char="${str%"${str#?}"}" |
| | | h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) |
| | | str="${str#?}" |
| | | done |
| | | printf %x\\n $h |
| | | } |
| | | |
| | | verbose() { :; } |
| | | [ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } |
| | | |
| | | die() { |
| | | printf %s\\n "$1" >&2 |
| | | exit 1 |
| | | } |
| | | |
| | | # parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties |
| | | while IFS="=" read -r key value; do |
| | | case "${key-}" in |
| | | distributionUrl) distributionUrl="${value-}" ;; |
| | | distributionSha256Sum) distributionSha256Sum="${value-}" ;; |
| | | esac |
| | | done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties" |
| | | [ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties" |
| | | |
| | | case "${distributionUrl##*/}" in |
| | | maven-mvnd-*bin.*) |
| | | MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ |
| | | case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in |
| | | *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; |
| | | :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; |
| | | :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; |
| | | :Linux*x86_64*) distributionPlatform=linux-amd64 ;; |
| | | *) |
| | | echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 |
| | | distributionPlatform=linux-amd64 |
| | | ;; |
| | | esac |
| | | distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" |
| | | ;; |
| | | maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; |
| | | *) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; |
| | | esac |
| | | |
| | | # apply MVNW_REPOURL and calculate MAVEN_HOME |
| | | # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash> |
| | | [ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" |
| | | distributionUrlName="${distributionUrl##*/}" |
| | | distributionUrlNameMain="${distributionUrlName%.*}" |
| | | distributionUrlNameMain="${distributionUrlNameMain%-bin}" |
| | | MAVEN_HOME="$HOME/.m2/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" |
| | | |
| | | exec_maven() { |
| | | unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : |
| | | exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" |
| | | } |
| | | |
| | | if [ -d "$MAVEN_HOME" ]; then |
| | | verbose "found existing MAVEN_HOME at $MAVEN_HOME" |
| | | exec_maven "$@" |
| | | fi |
| | | |
| | | case "${distributionUrl-}" in |
| | | *?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; |
| | | *) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; |
| | | esac |
| | | |
| | | # prepare tmp dir |
| | | if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then |
| | | clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } |
| | | trap clean HUP INT TERM EXIT |
| | | else |
| | | die "cannot create temp dir" |
| | | fi |
| | | |
| | | mkdir -p -- "${MAVEN_HOME%/*}" |
| | | |
| | | # Download and Install Apache Maven |
| | | verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." |
| | | verbose "Downloading from: $distributionUrl" |
| | | verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" |
| | | |
| | | # select .zip or .tar.gz |
| | | if ! command -v unzip >/dev/null; then |
| | | distributionUrl="${distributionUrl%.zip}.tar.gz" |
| | | distributionUrlName="${distributionUrl##*/}" |
| | | fi |
| | | |
| | | # verbose opt |
| | | __MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' |
| | | [ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v |
| | | |
| | | # normalize http auth |
| | | case "${MVNW_PASSWORD:+has-password}" in |
| | | '') MVNW_USERNAME='' MVNW_PASSWORD='' ;; |
| | | has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; |
| | | esac |
| | | |
| | | if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then |
| | | verbose "Found wget ... using wget" |
| | | wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" |
| | | elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then |
| | | verbose "Found curl ... using curl" |
| | | curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" |
| | | elif set_java_home; then |
| | | verbose "Falling back to use Java to download" |
| | | javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" |
| | | targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" |
| | | cat >"$javaSource" <<-END |
| | | public class Downloader extends java.net.Authenticator |
| | | { |
| | | protected java.net.PasswordAuthentication getPasswordAuthentication() |
| | | { |
| | | return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); |
| | | } |
| | | public static void main( String[] args ) throws Exception |
| | | { |
| | | setDefault( new Downloader() ); |
| | | java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); |
| | | } |
| | | } |
| | | END |
| | | # For Cygwin/MinGW, switch paths to Windows format before running javac and java |
| | | verbose " - Compiling Downloader.java ..." |
| | | "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" |
| | | verbose " - Running Downloader.java ..." |
| | | "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" |
| | | fi |
| | | |
| | | # If specified, validate the SHA-256 sum of the Maven distribution zip file |
| | | if [ -n "${distributionSha256Sum-}" ]; then |
| | | distributionSha256Result=false |
| | | if [ "$MVN_CMD" = mvnd.sh ]; then |
| | | echo "Checksum validation is not supported for maven-mvnd." >&2 |
| | | echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 |
| | | exit 1 |
| | | elif command -v sha256sum >/dev/null; then |
| | | if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then |
| | | distributionSha256Result=true |
| | | fi |
| | | elif command -v shasum >/dev/null; then |
| | | if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then |
| | | distributionSha256Result=true |
| | | fi |
| | | else |
| | | echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 |
| | | echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 |
| | | exit 1 |
| | | fi |
| | | if [ $distributionSha256Result = false ]; then |
| | | echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 |
| | | echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 |
| | | exit 1 |
| | | fi |
| | | fi |
| | | |
| | | # unzip and move |
| | | if command -v unzip >/dev/null; then |
| | | unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" |
| | | else |
| | | tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" |
| | | fi |
| | | printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url" |
| | | mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" |
| | | |
| | | clean || : |
| | | exec_maven "$@" |
New file |
| | |
| | | <# : batch portion |
| | | @REM ---------------------------------------------------------------------------- |
| | | @REM Licensed to the Apache Software Foundation (ASF) under one |
| | | @REM or more contributor license agreements. See the NOTICE file |
| | | @REM distributed with this work for additional information |
| | | @REM regarding copyright ownership. The ASF licenses this file |
| | | @REM to you under the Apache License, Version 2.0 (the |
| | | @REM "License"); you may not use this file except in compliance |
| | | @REM with the License. You may obtain a copy of the License at |
| | | @REM |
| | | @REM https://www.apache.org/licenses/LICENSE-2.0 |
| | | @REM |
| | | @REM Unless required by applicable law or agreed to in writing, |
| | | @REM software distributed under the License is distributed on an |
| | | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| | | @REM KIND, either express or implied. See the License for the |
| | | @REM specific language governing permissions and limitations |
| | | @REM under the License. |
| | | @REM ---------------------------------------------------------------------------- |
| | | |
| | | @REM ---------------------------------------------------------------------------- |
| | | @REM Apache Maven Wrapper startup batch script, version 3.3.1 |
| | | @REM |
| | | @REM Optional ENV vars |
| | | @REM MVNW_REPOURL - repo url base for downloading maven distribution |
| | | @REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven |
| | | @REM MVNW_VERBOSE - true: enable verbose log; others: silence the output |
| | | @REM ---------------------------------------------------------------------------- |
| | | |
| | | @IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) |
| | | @SET __MVNW_CMD__= |
| | | @SET __MVNW_ERROR__= |
| | | @SET __MVNW_PSMODULEP_SAVE=%PSModulePath% |
| | | @SET PSModulePath= |
| | | @FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( |
| | | IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) |
| | | ) |
| | | @SET PSModulePath=%__MVNW_PSMODULEP_SAVE% |
| | | @SET __MVNW_PSMODULEP_SAVE= |
| | | @SET __MVNW_ARG0_NAME__= |
| | | @SET MVNW_USERNAME= |
| | | @SET MVNW_PASSWORD= |
| | | @IF NOT "%__MVNW_CMD__%"=="" (%__MVNW_CMD__% %*) |
| | | @echo Cannot start maven from wrapper >&2 && exit /b 1 |
| | | @GOTO :EOF |
| | | : end batch / begin powershell #> |
| | | |
| | | $ErrorActionPreference = "Stop" |
| | | if ($env:MVNW_VERBOSE -eq "true") { |
| | | $VerbosePreference = "Continue" |
| | | } |
| | | |
| | | # calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties |
| | | $distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl |
| | | if (!$distributionUrl) { |
| | | Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" |
| | | } |
| | | |
| | | switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { |
| | | "maven-mvnd-*" { |
| | | $USE_MVND = $true |
| | | $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" |
| | | $MVN_CMD = "mvnd.cmd" |
| | | break |
| | | } |
| | | default { |
| | | $USE_MVND = $false |
| | | $MVN_CMD = $script -replace '^mvnw','mvn' |
| | | break |
| | | } |
| | | } |
| | | |
| | | # apply MVNW_REPOURL and calculate MAVEN_HOME |
| | | # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash> |
| | | if ($env:MVNW_REPOURL) { |
| | | $MVNW_REPO_PATTERN = if ($USE_MVND) { "/org/apache/maven/" } else { "/maven/mvnd/" } |
| | | $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace '^.*'+$MVNW_REPO_PATTERN,'')" |
| | | } |
| | | $distributionUrlName = $distributionUrl -replace '^.*/','' |
| | | $distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' |
| | | $MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain" |
| | | $MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' |
| | | $MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" |
| | | |
| | | if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { |
| | | Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" |
| | | Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" |
| | | exit $? |
| | | } |
| | | |
| | | if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { |
| | | Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" |
| | | } |
| | | |
| | | # prepare tmp dir |
| | | $TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile |
| | | $TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" |
| | | $TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null |
| | | trap { |
| | | if ($TMP_DOWNLOAD_DIR.Exists) { |
| | | try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } |
| | | catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } |
| | | } |
| | | } |
| | | |
| | | New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null |
| | | |
| | | # Download and Install Apache Maven |
| | | Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." |
| | | Write-Verbose "Downloading from: $distributionUrl" |
| | | Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" |
| | | |
| | | $webclient = New-Object System.Net.WebClient |
| | | if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { |
| | | $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) |
| | | } |
| | | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 |
| | | $webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null |
| | | |
| | | # If specified, validate the SHA-256 sum of the Maven distribution zip file |
| | | $distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum |
| | | if ($distributionSha256Sum) { |
| | | if ($USE_MVND) { |
| | | Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." |
| | | } |
| | | Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash |
| | | if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { |
| | | Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." |
| | | } |
| | | } |
| | | |
| | | # unzip and move |
| | | Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null |
| | | Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null |
| | | try { |
| | | Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null |
| | | } catch { |
| | | if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { |
| | | Write-Error "fail to move MAVEN_HOME" |
| | | } |
| | | } finally { |
| | | try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } |
| | | catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } |
| | | } |
| | | |
| | | Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <parent> |
| | | <artifactId>pipIrr-web</artifactId> |
| | | <groupId>com.dy</groupId> |
| | | <version>1.0.0</version> |
| | | <relativePath>../pom.xml</relativePath> |
| | | </parent> |
| | | |
| | | <packaging>jar</packaging> |
| | | |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-web-wechat</artifactId> |
| | | <name>pipIrr-web-wechat</name> |
| | | <description>微信小程序</description> |
| | | |
| | | <build> |
| | | <plugins> |
| | | <!-- 生成不包含依赖jar的可执行jar包 |
| | | <plugin> |
| | | !- spring boot提供的maven打包插件 - |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <executions> |
| | | <execution> |
| | | !- |
| | | <goals> |
| | | <goal>repackage</goal> |
| | | </goals> |
| | | - |
| | | <configuration> |
| | | !- 不加的话最终包名为: ${artifactId}-${version}.jar, 加了的话最终包名: ${artifactId}-${version}-${classifier}.jar - |
| | | <classifier>execute</classifier> |
| | | !- 不指定生成路径的话, 默认保存在 ${build.directory} 下 - |
| | | <outputDirectory>${project.build.directory}/execute</outputDirectory> |
| | | <finalName>${artifactId}-${version}</finalName> |
| | | <layout>ZIP</layout> |
| | | <mainClass>com.dy.pipIrrBase.PipIrrBaseApplication</mainClass> |
| | | <includes> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-common</artifactId> |
| | | </include> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-global</artifactId> |
| | | </include> |
| | | </includes> |
| | | <excludes> |
| | | <exclude> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </exclude> |
| | | </excludes> |
| | | </configuration> |
| | | </execution> |
| | | </executions> |
| | | |
| | | </plugin> |
| | | --> |
| | | <!-- 拷贝依赖的jar包到lib目录--> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <executions> |
| | | <execution> |
| | | <configuration> |
| | | <!-- 不加的话最终包名为: ${artifactId}-${version}.jar, 加了的话最终包名: ${artifactId}-${version}-${classifier}.jar |
| | | <classifier>execute</classifier> |
| | | --> |
| | | <!-- ${project.build.directory}是maven变量,内置的,表示target目录,如果不写,将在根目录下创建/lib --> |
| | | <outputDirectory>${project.build.directory}/lib</outputDirectory> |
| | | <!-- excludeTransitive:是否不包含间接依赖包,比如我们依赖A,但是A又依赖了B,我们是否也要把B打进去 默认不打--> |
| | | <excludeTransitive>false</excludeTransitive> |
| | | <!-- 复制的jar文件去掉版本信息 --> |
| | | <stripVersion>false</stripVersion> |
| | | <finalName>${project.artifactId}-${project.version}</finalName> |
| | | <layout>ZIP</layout> |
| | | <mainClass>com.dy.pipIrrRemote.PipIrrRemoteApplication</mainClass> |
| | | <includes> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-common</artifactId> |
| | | </include> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-global</artifactId> |
| | | </include> |
| | | </includes> |
| | | <excludes> |
| | | <exclude> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </exclude> |
| | | </excludes> |
| | | </configuration> |
| | | </execution> |
| | | </executions> |
| | | </plugin> |
| | | |
| | | <plugin> |
| | | <!-- 设置java编译版本,运行环境版本 --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | | <!-- source: 源代码编译版本;target: 目标平台编译版本;encoding: 字符集编码。 --> |
| | | <configuration> |
| | | <source>${java.version}</source> |
| | | <target>${java.version}</target> |
| | | <encoding>${encoding}</encoding> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- 解决资源文件的编码问题 --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-resources-plugin</artifactId> |
| | | <configuration> |
| | | <encoding>${encoding}</encoding> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- maven里执行测试用例的插件 --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-surefire-plugin</artifactId> |
| | | <configuration> |
| | | <skipTests>true</skipTests> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- 下面解决:当进行Maven Lifecycle package时报错:Could not find artifact org.apache.mina:mina-core:bundle:2.2.1 in maven (https://repo1.maven.org/maven2/)--> |
| | | <groupId>org.apache.felix</groupId> |
| | | <artifactId>maven-bundle-plugin</artifactId> |
| | | <extensions>true</extensions> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.dy.pipIrrWechat; |
| | | |
| | | import com.dy.common.multiDataSource.EnableMultiDataSource; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.context.annotation.ComponentScan; |
| | | import org.springframework.context.annotation.EnableAspectJAutoProxy; |
| | | import org.springframework.context.annotation.FilterType; |
| | | |
| | | @SpringBootApplication |
| | | @EnableAspectJAutoProxy |
| | | @EnableMultiDataSource |
| | | @ComponentScan(basePackages = {"com.dy.common", "com.dy.pipIrrGlobal", "com.dy.pipIrrWechat"}, |
| | | excludeFilters = { |
| | | @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = { |
| | | com.dy.common.singleDataSource.DruidDataSourceConfig.class //排除单数据源 |
| | | }) |
| | | } |
| | | ) |
| | | @MapperScan(basePackages={"com.dy.pipIrrGlobal.daoRm", "com.dy.pipIrrGlobal.daoPr", "com.dy.pipIrrGlobal.daoSe", "com.dy.pipIrrGlobal.daoBa"}) |
| | | public class PipIrrWechatApplication { |
| | | |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(PipIrrWechatApplication.class, args); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrWechat.config; |
| | | |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-05-07 17:09 |
| | | * @LastEditTime 2024-05-07 17:09 |
| | | * @Description |
| | | */ |
| | | @Configuration |
| | | public class RestTemplateConfig { |
| | | |
| | | @Bean |
| | | public RestTemplate restTemplate() { |
| | | return new RestTemplate(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrWechat.config; |
| | | |
| | | import com.dy.common.webFilter.DevOfDataSourceNameSetFilter; |
| | | import com.dy.common.webFilter.UserTokenFilter; |
| | | import jakarta.servlet.Filter; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.boot.web.servlet.FilterRegistrationBean; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-05-07 14:51 |
| | | * @LastEditTime 2024-05-07 14:51 |
| | | * @Description |
| | | */ |
| | | @Configuration |
| | | public class WebFilterConfiguration { |
| | | |
| | | @Value("${pipIrr.global.dev}") |
| | | public String isDevStage ;//是否为开发阶段 |
| | | @Value("${pipIrr.global.dsName}") |
| | | public String dsName ;//开发阶段的数据源名称 |
| | | |
| | | /** |
| | | * DevOfDataSourceNameSetFilter与UserTokenFilter只能一个被配置上, |
| | | * 所以他们的order都是1 |
| | | */ |
| | | private static final int order_UserTokenFilter = 1 ;//与下面 |
| | | private static final int order_DevOfDataSourceNameSetFilter = 1 ; |
| | | |
| | | |
| | | @Bean |
| | | public FilterRegistrationBean<? extends Filter> RegFilter() { |
| | | FilterRegistrationBean<Filter> filterRegistrationBean = new FilterRegistrationBean<>(); |
| | | if(this.isDevStage != null && !this.isDevStage.trim().equals("") && this.isDevStage.trim().equalsIgnoreCase("true")){ |
| | | filterRegistrationBean.setFilter(new DevOfDataSourceNameSetFilter()); |
| | | filterRegistrationBean.addUrlPatterns("/*");//配置过滤规则 |
| | | filterRegistrationBean.addInitParameter("dataSourceName",dsName);//设置init参数 |
| | | filterRegistrationBean.setName("DevOfDataSourceNameSetFilter");//设置过滤器名称 |
| | | filterRegistrationBean.setOrder(order_DevOfDataSourceNameSetFilter);//执行次序 |
| | | }else{ |
| | | filterRegistrationBean.setFilter(new UserTokenFilter()); |
| | | filterRegistrationBean.addUrlPatterns("/*");//配置过滤规则 |
| | | filterRegistrationBean.setName("UserTokenFilter");//设置过滤器名称 |
| | | filterRegistrationBean.setOrder(order_UserTokenFilter);//执行次序 |
| | | } |
| | | return filterRegistrationBean; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrWechat.config; |
| | | |
| | | import com.dy.common.webListener.GenerateIdSetSuffixListener; |
| | | import jakarta.servlet.ServletContextListener; |
| | | import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-05-07 14:52 |
| | | * @LastEditTime 2024-05-07 14:52 |
| | | * @Description |
| | | */ |
| | | @Configuration |
| | | public class WebListenerConfiguration { |
| | | |
| | | /** |
| | | * 启动顺序 |
| | | */ |
| | | //private static final int order_config = 0 ; |
| | | private static final int order_idSetSuffix = 1 ; |
| | | //private static final int order_init = 2 ; |
| | | |
| | | /* |
| | | * 解析各种***.config配置的ConfigListener,暂时不采用此种配置方式 |
| | | * |
| | | @Bean |
| | | public ConfigListener getGlConfigListener(){ |
| | | return new ConfigListener() ; |
| | | } |
| | | /** |
| | | * 外部提供Listener |
| | | * @param listener 外部提供Listener |
| | | * @return 注册Bean |
| | | @Bean |
| | | public ServletListenerRegistrationBean<? extends ServletContextListener> regConfigListener(ConfigListener listener) { |
| | | ServletListenerRegistrationBean<ConfigListener> listenerRegistrationBean = new ServletListenerRegistrationBean<>(); |
| | | listenerRegistrationBean.setListener(listener); |
| | | listenerRegistrationBean.setOrder(order_config); |
| | | return listenerRegistrationBean; |
| | | } |
| | | */ |
| | | |
| | | /** |
| | | * 内部提供listener,该listener在系统启动时,根据配置 设置ID产生器的后缀 |
| | | * @return 注册Bean |
| | | */ |
| | | @Bean |
| | | public ServletListenerRegistrationBean<? extends ServletContextListener> regSsoListener() { |
| | | ServletListenerRegistrationBean<GenerateIdSetSuffixListener> listenerRegistrationBean = new ServletListenerRegistrationBean<>(); |
| | | listenerRegistrationBean.setListener(new GenerateIdSetSuffixListener()); |
| | | listenerRegistrationBean.setOrder(order_idSetSuffix); |
| | | return listenerRegistrationBean; |
| | | } |
| | | |
| | | // /** |
| | | // * 内部提供listener,该listener在系统启动时,初始化数据库数据 |
| | | // * @return 注册Bean |
| | | // */ |
| | | // @Bean |
| | | // public ServletListenerRegistrationBean<? extends ServletContextListener> regInitListener() { |
| | | // ServletListenerRegistrationBean<InitListener> listenerRegistrationBean = new ServletListenerRegistrationBean<>(); |
| | | // listenerRegistrationBean.setListener(new InitListener()); |
| | | // listenerRegistrationBean.setOrder(order_init); |
| | | // return listenerRegistrationBean; |
| | | // } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrWechat.result; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-05-30 9:16 |
| | | * @LastEditTime 2024-05-30 9:16 |
| | | * @Description |
| | | */ |
| | | |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum WechatResultCode { |
| | | |
| | | XXX(10001,"XXX"); |
| | | |
| | | private final Integer code; |
| | | private final String message; |
| | | } |
New file |
| | |
| | | spring: |
| | | profiles: |
| | | include: global, database, database-ym, database-pj |
| | | |
| | | #actutor的web端口 |
| | | management: |
| | | server: |
| | | port: ${pipIrr.wechat.actutorPort} |
| | | #web服务端口,tomcat默认是8087 |
| | | server: |
| | | port: ${pipIrr.wechat.webPort} |
| | | servlet: |
| | | context-path: /wx #web访问上下文路径 |
| | | context-parameters: |
| | | #GenerateIdSetSuffixListener中应用,取值范围是0-99 |
| | | idSuffix: ${pipIrr.wechat.idSuffix} |
| | | #ConfigListener中应用 |
| | | #configFileNames: config-global.xml,config-demo.xml |
New file |
| | |
| | | Configuration: |
| | | #status,这个用于设置log4j2自身内部的信息输出,可以不设置,当设置成trace时,你会看到log4j2内部各种详细输出;可以设置成Off(关闭)或Error(只输出错误信息) |
| | | status: Error |
| | | |
| | | Properties: # 定义全局变量 |
| | | Property: |
| | | #日志文件存储的目录 |
| | | - name: log.path |
| | | value: ./logs |
| | | #日志文件存储名称 |
| | | - name: project.name |
| | | value: pipIrrRemote |
| | | |
| | | #定义输出器,可以输出到控制台和文件. |
| | | Appenders: |
| | | #输出到控制台 |
| | | Console: |
| | | #Appender命名 |
| | | name: CONSOLE |
| | | target: SYSTEM_OUT |
| | | ThresholdFilter: |
| | | level: debug #输出日志级别,输出日志时,首先由Loggers.Root.level或Loggers.Logger.level判断是否输出,然后再由本level判断是否输出 |
| | | onMatch: ACCEPT #onMatch=ACCEPT 大于等于 "level" 配置的等级地日志输出 |
| | | onMismatch: DENY #onMismatch=DENY 小于 "level" 配置的等级地日志不输出 |
| | | #日志内容样式 |
| | | PatternLayout: |
| | | #%n-换行 |
| | | #%m-日志内容,输出代码中指定的日志信息 |
| | | #%p-输出优先级,即DEBUG,INFO,WARN,ERROR,FATAL |
| | | #%r-程序启动到现在的毫秒数 |
| | | #%%- 输出一个"%" 字符 |
| | | #%t-当前线程名 |
| | | #%d-日期和时间, 常用的格式有%d{DATE},%d{ABSOLUTE},%d{HH:mm:ss,SSS},%d{ddMMyyyyHH:mm:ss,SSS} |
| | | #%l-同%F%L%C%M |
| | | #%F-java源文件名 |
| | | #%L-java源码行数 |
| | | #%C-java类名,%C{1}输出最后一个元素 |
| | | #%M-java方法名 |
| | | pattern: "%d{yyyy-MM-dd HH:mm:ss,SSS}:%4p %t (%C.%M:%L) - %m%n" |
| | | # 输出到文件,超过10MB归档 |
| | | RollingFile: |
| | | - name: ROLLING_FILE |
| | | ignoreExceptions: false |
| | | fileName: ${log.path}/${project.name}.log |
| | | filePattern: "${log.path}/$${date:yyyy-MM}/${project.name}-%d{yyyy-MM-dd}-%i.log.gz" |
| | | ThresholdFilter: |
| | | level: error #输出日志级别,输出日志时,首先由Loggers.Root.level或Loggers.Logger.level判断是否输出,然后再由本level判断是否输出 |
| | | onMatch: ACCEPT #onMatch=ACCEPT 大于等于 "level" 配置的等级地日志输出 |
| | | onMismatch: DENY #onMismatch=DENY 小于 "level" 配置的等级地日志不输出 |
| | | #日志内容样式 |
| | | PatternLayout: |
| | | pattern: "%d{yyyy-MM-dd HH:mm:ss,SSS}:%4p %t (%C.%M:%L) - %m%n" |
| | | Policies: |
| | | SizeBasedTriggeringPolicy: |
| | | size: "10 MB" |
| | | DefaultRolloverStrategy: |
| | | max: 1000 |
| | | |
| | | Loggers: |
| | | Root: |
| | | level: info #日志输出级别,共有8个级别,按照从低到高为:all < trace < debug < info < warn < error < fatal < off |
| | | AppenderRef: #Root的子节点,用来指定该日志输出到哪个Appender. |
| | | - ref: CONSOLE #输出日志时,首先由本level判断是否输出,然后再由上面的Appenders.Console.ThresholdFilter.level判断是否输出 |
| | | - ref: ROLLING_FILE #输出日志时,首先由本level判断是否输出,然后再由上面的Appenders.RollingFile.ThresholdFilter.level判断是否输出 |
| | | # 为包配置特殊的Log级别,方便调试, |
| | | # 不受Loggers.Root.level限制 |
| | | Logger: |
| | | - name: com.dy.pipIrrGlobal.daoBa |
| | | additivity: false #去除重复的log |
| | | level: debug #输出日志级别 |
| | | AppenderRef: |
| | | - ref: CONSOLE #输出日志时,首先由本.level判断是否输出,然后再由上面的Appenders.Console.ThresholdFilter.level判断是否输出 |
| | | - ref: ROLLING_FILE #输出日志时,首先由本level判断是否输出,然后再由上面的Appenders.RollingFile.ThresholdFilter.level判断是否输出 |
New file |
| | |
| | | package com.dy.pipIrrWechat; |
| | | |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | @SpringBootTest |
| | | class PipIrrWebWechatApplicationTests { |
| | | |
| | | @Test |
| | | void contextLoads() { |
| | | } |
| | | |
| | | } |
| | |
| | | <module>pipIrr-web-sell</module> |
| | | <module>pipIrr-web-project</module> |
| | | <module>pipIrr-web-irrigate</module> |
| | | <module>pipIrr-web-wechat</module> |
| | | <module>pipIrr-web-app</module> |
| | | </modules> |
| | | |
| | | <dependencies> |