initialized decode service project

This commit is contained in:
strawmanbobi
2018-12-13 23:01:52 +08:00
parent b8b92d8bd9
commit a335769321
29 changed files with 1480 additions and 0 deletions

67
.gitignore vendored
View File

@@ -21,3 +21,70 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

1
.idea/.name generated Normal file
View File

@@ -0,0 +1 @@
decode-web-service

16
.idea/compiler.xml generated Normal file
View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="decode-web-service" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel>
<module name="decode-web-service" target="1.8" />
</bytecodeTargetLevel>
</component>
</project>

19
.idea/dataSources.xml generated Normal file
View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="sb_demo@localhost" uuid="7f071b48-82f5-4f9c-b912-7eacf118e158">
<driver-ref>mysql</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>com.mysql.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mysql://localhost:3306/sb_demo</jdbc-url>
<driver-properties>
<property name="autoReconnect" value="true" />
<property name="zeroDateTimeBehavior" value="convertToNull" />
<property name="tinyInt1isBit" value="false" />
<property name="characterEncoding" value="utf8" />
<property name="characterSetResults" value="utf8" />
<property name="yearIsDateType" value="false" />
</driver-properties>
</data-source>
</component>
</project>

6
.idea/encodings.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with NO BOM">
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
</component>
</project>

View File

@@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="SpringJavaInjectionPointsAutowiringInspection" enabled="false" level="ERROR" enabled_by_default="false" />
</profile>
</component>

13
.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="JDK-1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/classes" />
</component>
</project>

8
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/decode-web-service.iml" filepath="$PROJECT_DIR$/decode-web-service.iml" />
</modules>
</component>
</project>

7
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

1
.mvn/wrapper/maven-wrapper.properties vendored Normal file
View File

@@ -0,0 +1 @@
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip

28
db_init.sql Normal file
View File

@@ -0,0 +1,28 @@
create table irext_collect.collect_remote
(
id int auto_increment,
category_id int null,
category_name varchar(20) null,
brand_id int null,
brand_name varchar(20) null,
city_code varchar(6) null,
city_name varchar(20) null,
operator_id int null,
operator_name varchar(32) null,
remote_map varchar(128) null,
protocol varchar(64) null,
remote varchar(64) null,
constraint collect_remote_pk
primary key (id)
)
comment 'Collected Remote Info';
create table irext_collect.collect_key
(
id int auto_increment
primary key,
collect_remote_id int not null,
key_id int not null,
key_name varchar(20) not null,
key_value text not null
);

85
decode-web-service.iml Normal file
View File

@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration />
</facet>
<facet type="web" name="Web">
<configuration>
<webroots />
<sourceRoots>
<root url="file://$MODULE_DIR$/src/main/java" />
<root url="file://$MODULE_DIR$/src/main/resources" />
</sourceRoots>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.0" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:1.5.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:1.5.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:1.5.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:1.5.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.1.11" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.1.11" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.25" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.25" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:log4j-over-slf4j:1.7.25" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.17" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:1.5.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-jdbc:8.5.15" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-juli:8.5.15" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:4.3.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:4.3.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:1.3.0" level="project" />
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.4.4" level="project" />
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:1.3.1" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:1.5.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:1.5.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:8.5.15" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:8.5.15" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:8.5.15" level="project" />
<orderEntry type="library" name="Maven: org.hibernate:hibernate-validator:5.3.5.Final" level="project" />
<orderEntry type="library" name="Maven: javax.validation:validation-api:1.1.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.1.Final" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.3.3" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.8.8" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.8.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.8.8" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-web:4.3.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:4.3.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:4.3.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:4.3.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:4.3.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:4.3.9.RELEASE" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:5.1.42" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:1.5.4.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:1.5.4.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:1.5.4.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.2.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.2.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:1.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.ow2.asm:asm:5.0.3" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:2.6.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:1.10.19" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:2.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-library:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.4.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:4.3.9.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:4.3.9.RELEASE" level="project" />
</component>
</module>

225
mvnw vendored Normal file
View File

@@ -0,0 +1,225 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Maven2 Start Up Batch script
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ] ; then
if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
if [ -z "$JAVA_HOME" ]; then
if [ -x "/usr/libexec/java_home" ]; then
export JAVA_HOME="`/usr/libexec/java_home`"
else
export JAVA_HOME="/Library/Java/Home"
fi
fi
;;
esac
if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
JAVA_HOME=`java-config --jre-home`
fi
fi
if [ -z "$M2_HOME" ] ; then
## resolve links - $0 may be a link to maven's home
PRG="$0"
# need this for relative symlinks
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
saveddir=`pwd`
M2_HOME=`dirname "$PRG"`/..
# make it fully qualified
M2_HOME=`cd "$M2_HOME" && pwd`
cd "$saveddir"
# echo Using m2 at $M2_HOME
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --unix "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# For Migwn, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$M2_HOME" ] &&
M2_HOME="`(cd "$M2_HOME"; pwd)`"
[ -n "$JAVA_HOME" ] &&
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
# TODO classpath?
fi
if [ -z "$JAVA_HOME" ]; then
javaExecutable="`which javac`"
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
if $darwin ; then
javaHome="`dirname \"$javaExecutable\"`"
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
else
javaExecutable="`readlink -f \"$javaExecutable\"`"
fi
javaHome="`dirname \"$javaExecutable\"`"
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="`which java`"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi
if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
if [ -z "$1" ]
then
echo "Path not specified to find_maven_basedir"
return 1
fi
basedir="$1"
wdir="$1"
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
if [ -d "${wdir}" ]; then
wdir=`cd "$wdir/.."; pwd`
fi
# end of workaround
done
echo "${basedir}"
}
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
echo "$(tr -s '\n' ' ' < "$1")"
fi
}
BASE_DIR=`find_maven_basedir "$(pwd)"`
if [ -z "$BASE_DIR" ]; then
exit 1;
fi
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
echo $MAVEN_PROJECTBASEDIR
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --path --windows "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
exec "$JAVACMD" \
$MAVEN_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

143
mvnw.cmd vendored Normal file
View File

@@ -0,0 +1,143 @@
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven2 Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
exit /B %ERROR_CODE%

60
pom.xml Normal file
View File

@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.irext.collector</groupId>
<artifactId>spring-boot-mybatis</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>spring-boot-mybatis</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,180 @@
package net.irext.collector;
/**
* Filename: Constants.java
* Revised: Date: 2017-12-08
* Revision: Revision: 1.0
* <p>
* Description: SDK Constants
* <p>
* Revision log:
* 2017-12-08: created by strawmanbobi
*/
public class Constants {
public static final int ERROR_CODE_SUCCESS = 0;
public static final int ERROR_CODE_NETWORK_ERROR = -1;
public static final int ERROR_CODE_AUTH_FAILURE = 1;
public static final int ERROR_CODE_INVALID_CATEGORY = 2;
public static final int ERROR_CODE_INVALID_BRAND = 3;
public static final int ERROR_CODE_INVALID_PARAMETER = 4;
public static final int LANG_ZH_CN = 0;
public static final int LANG_EN = 1;
public static final int LANG_TW_CN = 2;
public enum CategoryID {
AIR_CONDITIONER(1),
TV(2),
STB(3),
NET_BOX(4),
IPTV(5),
DVD(6),
FAN(7),
PROJECTOR(8),
STEREO(9),
LIGHT(10),
BSTB(11),
CLEANING_ROBOT(12),
AIR_CLEANER(13),
DYSON_SERIES(14);
private final int id;
CategoryID(int id) {
this.id = id;
}
public int getValue() {
return id;
}
}
public enum BinaryType {
TYPE_BINARY(0),
TYPE_HEXDECIMAL(1);
private final int type;
BinaryType(int type) {
this.type = type;
}
public int getValue() {
return type;
}
}
public enum ACPower {
POWER_ON(0),
POWER_OFF(1);
private final int power;
ACPower(int power) {
this.power = power;
}
public int getValue() {
return power;
}
}
public enum ACMode {
MODE_COOL(0),
MODE_HEAT(1),
MODE_AUTO(2),
MODE_FAN(3),
MODE_DEHUMIDITY(4);
private final int mode;
ACMode(int mode) {
this.mode = mode;
}
public int getValue() {
return mode;
}
}
public enum ACTemperature {
TEMP_16(0),
TEMP_17(1),
TEMP_18(2),
TEMP_19(3),
TEMP_20(4),
TEMP_21(5),
TEMP_22(6),
TEMP_23(7),
TEMP_24(8),
TEMP_25(9),
TEMP_26(10),
TEMP_27(11),
TEMP_28(12),
TEMP_29(13),
TEMP_30(14);
private final int temp;
ACTemperature(int temp) {
this.temp = temp;
}
public int getValue() {
return temp;
}
}
public enum ACWindSpeed {
SPEED_AUTO(0),
SPEED_LOW(1),
SPEED_MEDIUM(2),
SPEED_HIGH(3);
private final int speed;
ACWindSpeed(int speed) {
this.speed = speed;
}
public int getValue() {
return speed;
}
}
public enum ACSwing {
SWING_ON(0),
SWING_OFF(1);
private final int swing;
ACSwing(int swing) {
this.swing = swing;
}
public int getValue() {
return swing;
}
}
public enum ACFunction {
FUNCTION_SWITCH_POWER(1),
FUNCTION_CHANGE_MODE(2),
FUNCTION_TEMPERATURE_UP(3),
FUNCTION_TEMPERATURE_DOWN(4),
FUNCTION_SWITCH_WIND_SPEED(5),
FUNCTION_SWITCH_WIND_DIR(6),
FUNCTION_SWITCH_SWING(7);
private final int function;
ACFunction(int function) {
this.function = function;
}
public int getValue() {
return function;
}
}
}

View File

@@ -0,0 +1,27 @@
package net.irext.collector;
import net.irext.collector.model.CollectRemote;
import org.apache.ibatis.type.MappedTypes;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* Filename: SpringBootMybatisApplication
* Revised: Date: 2018-12-08
* Revision: Revision: 1.0
* <p>
* Description: IRext Code Collector Application
* <p>
* Revision log:
* 2018-12-08: created by strawmanbobi
*/
@MappedTypes(CollectRemote.class)
@MapperScan("net.irext.collector.mybatis.springbootmybatis.mapper")
@SpringBootApplication
public class SpringBootMybatisApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootMybatisApplication.class, args);
}
}

View File

@@ -0,0 +1,52 @@
package net.irext.collector.businesslogic;
import net.irext.collector.model.IRCode;
import org.springframework.stereotype.Controller;
/**
* Filename: CollectCodeLogic
* Revised: Date: 2018-12-08
* Revision: Revision: 1.0
* <p>
* Description: IRext Code Collector Collect Code Logic
* <p>
* Revision log:
* 2018-12-08: created by strawmanbobi
*/
@Controller
public class CollectCodeLogic {
private Integer codeCollectState = 0;
private IRCode irCode;
private static CollectCodeLogic collectCodeLogic;
public static CollectCodeLogic getInstance(IRCode irCode) {
if (null == collectCodeLogic) {
collectCodeLogic = new CollectCodeLogic(irCode);
}
return collectCodeLogic;
}
public CollectCodeLogic(IRCode irCode) {
this.irCode = irCode;
}
public CollectCodeLogic() {
}
public boolean collectCodeWorkUnit() {
// step 1. figure out the category and brand for this code
// step 2. go through the FSM for remote in each category
codeCollectState++;
System.out.println("state = " + codeCollectState + " : " + irCode.getKey());
// step 3. record key code
// step 4. temporarily save to file
return true;
}
}

View File

@@ -0,0 +1,34 @@
package net.irext.collector.mapper;
import net.irext.collector.model.CollectRemote;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import java.util.List;
/**
* Filename: CollectRemoteMapper.java
* Revised: Date: 2018-12-08
* Revision: Revision: 1.0
* <p>
* Description: CollectRemote Mybatis Mapper
* <p>
* Revision log:
* 2018-12-08: created by strawmanbobi
*/
@Mapper
public interface CollectRemoteMapper {
@Select("select * from collect_remote")
List<CollectRemote> listCollectRemotes();
@Insert("INSERT INTO collect_remote(category_id, category_name, brand_id, brand_name, city_code, city_name, " +
"operator_id, operator_name, remote_map, protocol, remote) " +
"values(#{categoryId}, #{categoryName}, #{brandId}, #{brandName}, #{cityCode}, #{cityName}, " +
"#{operatorId}, #{operatorName}, #{remoteMap}, #{protocol}, #{remote})")
@SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "id",
before = false, resultType = Integer.class)
void createCollectRemote(CollectRemote collectRemote);
}

View File

@@ -0,0 +1,72 @@
package net.irext.collector.model;
/**
* Filename: CollectKey.java
* Revised: Date: 2018-12-08
* Revision: Revision: 1.0
* <p>
* Description: CollectKey Model
* <p>
* Revision log:
* 2018-12-08: created by strawmanbobi
*/
public class CollectKey {
private Integer id;
private Integer collectRemoteId;
private Integer keyId;
private String keyName;
private String keyValue;
public CollectKey(Integer id, Integer collectRemoteId, Integer keyId, String keyName, String keyValue) {
this.id = id;
this.collectRemoteId = collectRemoteId;
this.keyId = keyId;
this.keyName = keyName;
this.keyValue = keyValue;
}
public CollectKey() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getCollectRemoteId() {
return collectRemoteId;
}
public void setCollectRemoteId(Integer collectRemoteId) {
this.collectRemoteId = collectRemoteId;
}
public Integer getKeyId() {
return keyId;
}
public void setKeyId(Integer keyId) {
this.keyId = keyId;
}
public String getKeyName() {
return keyName;
}
public void setKeyName(String keyName) {
this.keyName = keyName;
}
public String getKeyValue() {
return keyValue;
}
public void setKeyValue(String keyValue) {
this.keyValue = keyValue;
}
}

View File

@@ -0,0 +1,144 @@
package net.irext.collector.model;
/**
* Filename: CollectRemote.java
* Revised: Date: 2018-12-08
* Revision: Revision: 1.0
* <p>
* Description: CollectRemote Model
* <p>
* Revision log:
* 2018-12-08: created by strawmanbobi
*/
public class CollectRemote {
private Integer id;
private Integer categoryId;
private String categoryName;
private Integer brandId;
private String brandName;
private String cityCode;
private String cityName;
private Integer operatorId;
private String operatorName;
private String remoteMap;
private String protocol;
private String remote;
public CollectRemote(Integer id, Integer categoryId, String categoryName, Integer brandId, String brandName,
String cityCode, String cityName, Integer operatorId, String operatorName,
String remoteMap, String protocol, String remote) {
this.id = id;
this.categoryId = categoryId;
this.categoryName = categoryName;
this.brandId = brandId;
this.brandName = brandName;
this.cityCode = cityCode;
this.cityName = cityName;
this.operatorId = operatorId;
this.operatorName = operatorName;
this.remoteMap = remoteMap;
this.protocol = protocol;
this.remote = remote;
}
public CollectRemote() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getCategoryId() {
return categoryId;
}
public void setCategoryId(Integer categoryId) {
this.categoryId = categoryId;
}
public String getCategoryName() {
return categoryName;
}
public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}
public Integer getBrandId() {
return brandId;
}
public void setBrandId(Integer brandId) {
this.brandId = brandId;
}
public String getBrandName() {
return brandName;
}
public void setBrandName(String brandName) {
this.brandName = brandName;
}
public String getCityCode() {
return cityCode;
}
public void setCityCode(String cityCode) {
this.cityCode = cityCode;
}
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}
public Integer getOperatorId() {
return operatorId;
}
public void setOperatorId(Integer operatorId) {
this.operatorId = operatorId;
}
public String getOperatorName() {
return operatorName;
}
public void setOperatorName(String operatorName) {
this.operatorName = operatorName;
}
public String getRemoteMap() {
return remoteMap;
}
public void setRemoteMap(String remoteMap) {
this.remoteMap = remoteMap;
}
public String getProtocol() {
return protocol;
}
public void setProtocol(String protocol) {
this.protocol = protocol;
}
public String getRemote() {
return remote;
}
public void setRemote(String remote) {
this.remote = remote;
}
}

View File

@@ -0,0 +1,54 @@
package net.irext.collector.model;
/**
* Filename: IRCode.java
* Revised: Date: 2018-12-08
* Revision: Revision: 1.0
* <p>
* Description: IR Code
* <p>
* Revision log:
* 2018-12-08: created by strawmanbobi
*/
public class IRCode {
private int id;
private String text;
private String key;
private String code;
public IRCode(int id, String text, String key, String code) {
this.id = id;
this.text = text;
this.key = key;
this.code = code;
}
public IRCode() {
}
public void setText(String text) {
this.text = text;
}
public void setKey(String key) {
this.key = key;
}
public void setCode(String code) {
this.code = code;
}
public String getText() {
return this.text;
}
public String getKey() {
return this.key;
}
public String getCode() {
return this.code;
}
}

View File

@@ -0,0 +1,36 @@
package net.irext.collector.response;
import net.irext.collector.model.CollectKey;
import java.util.List;
/**
* Filename: CollectKeysResponse.java
* Revised: Date: 2018-12-08
* Revision: Revision: 1.0
* <p>
* Description: HTTP Response class
* <p>
* Revision log:
* 2018-12-08: created by strawmanbobi
*/
public class CollectKeysResponse extends ServiceResponse {
List<CollectKey> entity;
public CollectKeysResponse(Status status, List<CollectKey> entity) {
super(status);
this.entity = entity;
}
public CollectKeysResponse() {
}
public List<CollectKey> getEntity() {
return entity;
}
public void setEntity(List<CollectKey> entity) {
this.entity = entity;
}
}

View File

@@ -0,0 +1,36 @@
package net.irext.collector.response;
import net.irext.collector.model.CollectRemote;
import java.util.List;
/**
* Filename: CollectRemotesResponse.java
* Revised: Date: 2018-12-08
* Revision: Revision: 1.0
* <p>
* Description: HTTP Response class
* <p>
* Revision log:
* 2018-12-08: created by strawmanbobi
*/
public class CollectRemotesResponse extends ServiceResponse {
List<CollectRemote> entity;
public CollectRemotesResponse(Status status, List<CollectRemote> entity) {
super(status);
this.entity = entity;
}
public CollectRemotesResponse() {
}
public List<CollectRemote> getEntity() {
return entity;
}
public void setEntity(List<CollectRemote> entity) {
this.entity = entity;
}
}

View File

@@ -0,0 +1,32 @@
package net.irext.collector.response;
/**
* Filename: ServiceResponse.java
* Revised: Date: 2018-12-08
* Revision: Revision: 1.0
* <p>
* Description: HTTP Response class
* <p>
* Revision log:
* 2018-12-08: created by strawmanbobi
*/
public class ServiceResponse {
private Status status;
public ServiceResponse(Status status) {
this.status = status;
}
public ServiceResponse() {
}
public Status getStatus() {
return status;
}
public void setStatus(Status status) {
this.status = status;
}
}

View File

@@ -0,0 +1,44 @@
package net.irext.collector.response;
import net.irext.collector.Constants;
/**
* Filename: Status.java
* Revised: Date: 2018-12-08
* Revision: Revision: 1.0
* <p>
* Description: HTTP response status
* <p>
* Revision log:
* 2018-12-08: created by strawmanbobi
*/
public class Status {
private int code;
private String cause;
public Status(int code, String cause) {
this.code = code;
this.cause = cause;
}
public Status() {
this.code = Constants.ERROR_CODE_SUCCESS;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getCause() {
return cause;
}
public void setCause(String cause) {
this.cause = cause;
}
}

View File

@@ -0,0 +1,46 @@
package net.irext.collector.service;
import net.irext.collector.mapper.CollectRemoteMapper;
import net.irext.collector.model.CollectRemote;
import net.irext.collector.response.CollectRemotesResponse;
import net.irext.collector.response.ServiceResponse;
import net.irext.collector.response.Status;
import org.springframework.web.bind.annotation.*;
/**
* Filename: CollectRemoteService
* Revised: Date: 2018-12-08
* Revision: Revision: 1.0
* <p>
* Description: IRext Remote Management Service
* <p>
* Revision log:
* 2018-12-08: created by strawmanbobi
*/
@RestController
@RequestMapping("/irext/collect")
public class CollectRemoteService {
private CollectRemoteMapper collectRemoteMapper;
public CollectRemoteService(CollectRemoteMapper collectRemoteMapper) {
this.collectRemoteMapper = collectRemoteMapper;
}
@GetMapping("/list_collect_remotes")
public CollectRemotesResponse listCollectRemotes() {
CollectRemotesResponse collectRemotesResponse = new CollectRemotesResponse();
collectRemotesResponse.setEntity(collectRemoteMapper.listCollectRemotes());
collectRemotesResponse.setStatus(new Status());
return collectRemotesResponse;
}
@PostMapping("/create_collect_remote")
private ServiceResponse createCollectRemote(@RequestBody CollectRemote collectRemote) {
ServiceResponse serviceResponse = new ServiceResponse();
collectRemoteMapper.createCollectRemote(collectRemote);
serviceResponse.setStatus(new Status());
return serviceResponse;
}
}

View File

@@ -0,0 +1,33 @@
package net.irext.collector.service;
import net.irext.collector.businesslogic.CollectCodeLogic;
import net.irext.collector.model.IRCode;
import net.irext.collector.response.ServiceResponse;
import net.irext.collector.response.Status;
import org.springframework.web.bind.annotation.*;
/**
* Filename: IRCodeService
* Revised: Date: 2018-12-08
* Revision: Revision: 1.0
* <p>
* Description: IRext Code Collector Service
* <p>
* Revision log:
* 2018-12-08: created by strawmanbobi
*/
@RestController
@RequestMapping("/irext/collect")
public class IRCodeService {
public IRCodeService() {
}
@PostMapping("/collect_code")
public ServiceResponse collectCode(@RequestBody IRCode irCode) {
CollectCodeLogic.getInstance(irCode).collectCodeWorkUnit();
ServiceResponse serviceResponse = new ServiceResponse();
serviceResponse.setStatus(new Status());
return serviceResponse;
}
}

View File

@@ -0,0 +1,5 @@
server.port=8081
spring.datasource.url=jdbc:mysql://localhost:3306/irext_collect
spring.datasource.username=root
spring.datasource.password=root