first commit
This commit is contained in:
commit
492eb5292b
48
build.gradle
Normal file
48
build.gradle
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
Copyright 2025 MJM, All Rights Reserved.
|
||||
*/
|
||||
|
||||
plugins {
|
||||
id 'com.tridium.niagara-signing'
|
||||
id 'com.tridium.niagara' apply false
|
||||
id 'com.tridium.niagara-module' apply false
|
||||
id 'com.tridium.niagara-rjs' apply false
|
||||
}
|
||||
|
||||
import com.tridium.gradle.plugins.niagara.task.RunNiagaraTestTask
|
||||
|
||||
def getGradleProperty(String propName) {
|
||||
if (gradle.hasProperty(propName)) {
|
||||
gradle.getProperty(propName)
|
||||
} else {
|
||||
// Get system property, or, failing that, fall back to environment variable
|
||||
// This allows setting, e.g., -Pniagara_home=blah
|
||||
System.getProperty(propName) ?: System.getenv(propName)
|
||||
}
|
||||
}
|
||||
|
||||
ext.niagara_home = getGradleProperty('niagara_home')
|
||||
ext.niagara_dev_home = getGradleProperty('niagara_dev_home')
|
||||
ext.niagara_user_home = getGradleProperty('niagara_user_home')
|
||||
|
||||
|
||||
gradle.beforeProject { p ->
|
||||
configure(p) {
|
||||
def vendorSettings = file("${rootDir}/vendor.gradle")
|
||||
if (vendorSettings.exists()) {
|
||||
apply from: vendorSettings
|
||||
}
|
||||
apply from: "${rootDir}/gradle/niagara.gradle"
|
||||
tasks.withType(RunNiagaraTestTask) { RunNiagaraTestTask task ->
|
||||
task.groups = []
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
subprojects { Project p ->
|
||||
p.pluginManager.withPlugin('com.tridium.niagara-module') {
|
||||
p.niagaraModule {
|
||||
certAlias = "my-cert2"
|
||||
}
|
||||
}
|
||||
}
|
11
environment.gradle
Normal file
11
environment.gradle
Normal file
@ -0,0 +1,11 @@
|
||||
/*
|
||||
* Copyright 2025 MJM, All Rights Reserved.
|
||||
*/
|
||||
/* Environment Configuration File */
|
||||
|
||||
// Change niagara_home and niagara_user_home as needed to point to the
|
||||
// correct path to your desired Niagara install and its associated
|
||||
// user home
|
||||
gradle.ext.niagara_dev_home = "D:/lingliang-workspace/tsmc-solarInsertDB"
|
||||
gradle.ext.niagara_home = "d:/niagara/niagara-4.10.9.14"
|
||||
gradle.ext.niagara_user_home = "C:/Users/Administrator/Niagara4.10/vykon"
|
83
gradle/niagara.gradle
Normal file
83
gradle/niagara.gradle
Normal file
@ -0,0 +1,83 @@
|
||||
/*
|
||||
Copyright 2025 MJM, All Rights Reserved.
|
||||
*/
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'com.tridium.niagara'
|
||||
apply plugin: 'com.tridium.niagara-module'
|
||||
apply plugin: 'com.tridium.niagara-rjs'
|
||||
|
||||
|
||||
repositories {
|
||||
flatDir {
|
||||
name = "External JARs"
|
||||
dirs "${rootProject.ext.niagara_home}/bin/ext"
|
||||
}
|
||||
flatDir {
|
||||
name = "Nigara Modules"
|
||||
dirs "${rootProject.ext.niagara_home}/modules"
|
||||
}
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
niagaraModuleTestCompile "Tridium:test-wb:4.0.0"
|
||||
}
|
||||
|
||||
test {
|
||||
useTestNG()
|
||||
}
|
||||
|
||||
|
||||
javadoc.configure {
|
||||
failOnError false
|
||||
options.tags 'creation:a:Creation:'
|
||||
// Include or exclude specific package paths using the following syntax as an example
|
||||
include 'com/examples/**'
|
||||
exclude 'com/proprietary/**'
|
||||
}
|
||||
|
||||
task javadocJar (dependsOn: javadoc, type: Jar) {
|
||||
description 'Assemble javadoc jar for Niagara module'
|
||||
classifier 'javadoc'
|
||||
from javadoc.destinationDir
|
||||
|
||||
doLast {
|
||||
project.copy {
|
||||
into { "$rootProject.ext.niagara_home/javadoc" }
|
||||
from archivePath
|
||||
rename archiveName, "${baseName}-javadoc.jar"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
import javax.tools.ToolProvider
|
||||
import javax.tools.StandardLocation
|
||||
|
||||
class Bajadoc extends DefaultTask {
|
||||
|
||||
def Iterable<String> options = []
|
||||
def Iterable<File> sources = []
|
||||
def Iterable<File> classpath = []
|
||||
def Class<?> doclet
|
||||
|
||||
@TaskAction
|
||||
void doc() {
|
||||
def tool = ToolProvider.getSystemDocumentationTool();
|
||||
def fm = tool.getStandardFileManager(null, null, null);
|
||||
fm.setLocation(StandardLocation.CLASS_PATH, classpath)
|
||||
|
||||
tool.getTask(null, fm, null, doclet, options, fm.getJavaFileObjectsFromFiles(sources)).call()
|
||||
}
|
||||
}
|
||||
|
||||
task generateBajadoc(type: Bajadoc) {
|
||||
doFirst {
|
||||
configurations.compile.each { f -> classpath << f }
|
||||
options << '-module' << project.niagaraModule.moduleName.toString()
|
||||
options << '-rtprofile' << project.niagaraModule.runtimeProfile.toString()
|
||||
options << '-description' << project.description.toString().replace('\'', '')
|
||||
options << '-vendor' << project.group.toString()
|
||||
options << '-vendorVersion' << project.version.toString()
|
||||
options << '-bajaVersion' << project.niagaraModule.bajaVersion.toString()
|
||||
}
|
||||
}
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
#Tue Mar 20 10:56:06 EDT 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.2-bin.zip
|
172
gradlew
vendored
Normal file
172
gradlew
vendored
Normal file
@ -0,0 +1,172 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
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
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
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
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
84
gradlew.bat
vendored
Normal file
84
gradlew.bat
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
85
settings.gradle
Normal file
85
settings.gradle
Normal file
@ -0,0 +1,85 @@
|
||||
/*
|
||||
Copyright 2025 MJM, All Rights Reserved.
|
||||
*/
|
||||
|
||||
import groovy.io.FileVisitResult
|
||||
import groovy.io.FileType
|
||||
|
||||
pluginManagement {
|
||||
apply from: 'environment.gradle'
|
||||
|
||||
resolutionStrategy {
|
||||
eachPlugin {
|
||||
if (requested.id.namespace == 'com.tridium') {
|
||||
useModule('com.tridium.tools:niagara-plugins:4.1.5')
|
||||
}
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
url "${gradle.ext.niagara_home}/etc/m2/repository"
|
||||
}
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
|
||||
def discoveredProjects = [:] as Map<String, File>
|
||||
|
||||
ext {
|
||||
// CONFIGURE your sub-project folders here.
|
||||
// This will include ALL sub-folders as sub-projects.
|
||||
niagaraRoots = ['.']
|
||||
// To explicitly define sub-project folders, name them in the array like this
|
||||
//niagaraRoots = ['componentLinks', 'envCtrlDriver']
|
||||
|
||||
// CONFIGURE any directories to exclude from search for nested sub-projects
|
||||
excludeDirs = ['.hg', 'build', 'out', 'src', 'srcTest']
|
||||
}
|
||||
|
||||
// OR set the 'userRepos' gradle property.
|
||||
//
|
||||
if (hasProperty('userRepos')) {
|
||||
settings.ext.niagaraRoots += userRepos.split(",").collect()
|
||||
}
|
||||
|
||||
// my-settings.gradle.
|
||||
//
|
||||
def mySettings = file('my-settings.gradle')
|
||||
if (mySettings.exists()) {
|
||||
apply from: mySettings
|
||||
}
|
||||
|
||||
def environment = file('environment.gradle')
|
||||
if (environment.exists()) {
|
||||
apply from: environment
|
||||
}
|
||||
|
||||
// DO NOT MODIFY the niagaraRoots configuration
|
||||
niagaraRoots.collect({ file(it) }).findAll({ it.exists() }).each { File projectRoot ->
|
||||
projectRoot.traverse(
|
||||
type: FileType.DIRECTORIES,
|
||||
preRoot: true,
|
||||
preDir: { File projectDir ->
|
||||
def projectName = projectDir.name
|
||||
if (excludeDirs.contains(projectName)) {
|
||||
return FileVisitResult.SKIP_SUBTREE
|
||||
}
|
||||
|
||||
File buildScript = new File(projectDir, "${projectName}.gradle")
|
||||
if (buildScript.exists()) {
|
||||
discoveredProjects[projectName] = projectDir
|
||||
include projectName
|
||||
return FileVisitResult.SKIP_SUBTREE
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
// Can we change the rootproject.name?
|
||||
rootProject.name = 'niagara'
|
||||
rootProject.children.each { project ->
|
||||
project.projectDir = discoveredProjects[project.name]
|
||||
project.buildFileName = "${project.name}.gradle"
|
||||
assert project.projectDir.isDirectory()
|
||||
assert project.buildFile.isFile()
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
5
solarInsertDB/solarInsertDB-rt/build/tmp/jar/MANIFEST.MF
Normal file
5
solarInsertDB/solarInsertDB-rt/build/tmp/jar/MANIFEST.MF
Normal file
@ -0,0 +1,5 @@
|
||||
Manifest-Version: 1.0
|
||||
Implementation-Version: 1.0
|
||||
Sealed: true
|
||||
Implementation-Vendor: MJM
|
||||
|
30
solarInsertDB/solarInsertDB-rt/build/tmp/jar/module.xml
Normal file
30
solarInsertDB/solarInsertDB-rt/build/tmp/jar/module.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module name="solarInsertDB-rt" bajaVersion="0" vendor="MJM" vendorVersion="1.0" description="tsmc-solarInsertDB" preferredSymbol="mjmSolar" nre="true" autoload="true" installable="true" buildMillis="1742829288335" buildHost="WIN-VB61HI6M32L" moduleName="solarInsertDB" runtimeProfile="rt">
|
||||
<dependencies>
|
||||
<dependency name="baja" vendor="Tridium" vendorVersion="4.10"/>
|
||||
</dependencies>
|
||||
<dirs/>
|
||||
<types>
|
||||
<type class="com.mjm.solarInsertDB.BInsertData" name="InsertData"/>
|
||||
<type class="com.mjm.solarInsertDB.BDatabaseInformation" name="DatabaseInformation"/>
|
||||
<type class="com.mjm.solarInsertDB.BField" name="Field"/>
|
||||
<type class="com.mjm.solarInsertDB.BFieldUpdate" name="FieldUpdate"/>
|
||||
<type class="com.mjm.solarInsertDB.BInsertData2" name="InsertData2"/>
|
||||
<type class="com.mjm.solarInsertDB.BUpdateData" name="UpdateData"/>
|
||||
</types>
|
||||
<permissions>
|
||||
<niagara-permission-groups type="all"/>
|
||||
<niagara-permission-groups type="workbench"/>
|
||||
<niagara-permission-groups type="station">
|
||||
<req-permission>
|
||||
<name>NETWORK_COMMUNICATION</name>
|
||||
<purposeKey>Outside access for Driver</purposeKey>
|
||||
<parameters>
|
||||
<parameter name="hosts" value="192.168.0.132"/>
|
||||
<parameter name="ports" value="*"/>
|
||||
<parameter name="type" value="all"/>
|
||||
</parameters>
|
||||
</req-permission>
|
||||
</niagara-permission-groups>
|
||||
</permissions>
|
||||
</module>
|
12
solarInsertDB/solarInsertDB-rt/module-include.xml
Normal file
12
solarInsertDB/solarInsertDB-rt/module-include.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<!-- Module Include File -->
|
||||
<!-- Types -->
|
||||
<types>
|
||||
<!-- Type Example:<type name="MyClass" class="com.acme.BMyClass"/> -->
|
||||
<!--com.mjm.solarInsertDB-->
|
||||
<type class="com.mjm.solarInsertDB.BInsertData" name="InsertData"/>
|
||||
<type class="com.mjm.solarInsertDB.BDatabaseInformation" name="DatabaseInformation"/>
|
||||
<type class="com.mjm.solarInsertDB.BField" name="Field"/>
|
||||
<type class="com.mjm.solarInsertDB.BFieldUpdate" name="FieldUpdate"/>
|
||||
<type class="com.mjm.solarInsertDB.BInsertData2" name="InsertData2"/>
|
||||
<type class="com.mjm.solarInsertDB.BUpdateData" name="UpdateData"/>
|
||||
</types>
|
19
solarInsertDB/solarInsertDB-rt/module-permissions.xml
Normal file
19
solarInsertDB/solarInsertDB-rt/module-permissions.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<permissions>
|
||||
<niagara-permission-groups type="all">
|
||||
<!-- Insert any global permissions here. -->
|
||||
</niagara-permission-groups>
|
||||
<niagara-permission-groups type="workbench">
|
||||
<!-- Insert any workbench specific permissions here. -->
|
||||
</niagara-permission-groups>
|
||||
<niagara-permission-groups type="station">
|
||||
<req-permission>
|
||||
<name>NETWORK_COMMUNICATION</name>
|
||||
<purposeKey>Outside access for Driver</purposeKey>
|
||||
<parameters>
|
||||
<parameter name="hosts" value="192.168.0.132"/>
|
||||
<parameter name="ports" value="*"/>
|
||||
<parameter name="type" value="all"/>
|
||||
</parameters>
|
||||
</req-permission>
|
||||
</niagara-permission-groups>
|
||||
</permissions>
|
3
solarInsertDB/solarInsertDB-rt/module.lexicon
Normal file
3
solarInsertDB/solarInsertDB-rt/module.lexicon
Normal file
@ -0,0 +1,3 @@
|
||||
#
|
||||
# Lexicon for the solarInsertDB module.
|
||||
#
|
12
solarInsertDB/solarInsertDB-rt/module.palette
Normal file
12
solarInsertDB/solarInsertDB-rt/module.palette
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<bajaObjectGraph version="4.0" reversibleEncodingKeySource="none" reversibleEncodingValidator="[null.1]=" >
|
||||
<p m="b=baja" t="b:Folder">
|
||||
|
||||
|
||||
<!-- <p m="os=solarInsertDB" t="os:InsertData" n="AAA" />-->
|
||||
<p m="os=solarInsertDB" t="os:InsertData" n="InsertData" />
|
||||
|
||||
<p m="os=solarInsertDB" t="os:UpdateData" n="UpdateData" />
|
||||
|
||||
</p>
|
||||
</bajaObjectGraph>
|
8
solarInsertDB/solarInsertDB-rt/moduleTest-include.xml
Normal file
8
solarInsertDB/solarInsertDB-rt/moduleTest-include.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<!-- Module Include File -->
|
||||
|
||||
<!-- Types -->
|
||||
<types>
|
||||
|
||||
<type name="InsertData" class="com.mjm.solarInsertDB.BInsertData"/>
|
||||
|
||||
</types>
|
23
solarInsertDB/solarInsertDB-rt/solarInsertDB-rt.gradle
Normal file
23
solarInsertDB/solarInsertDB-rt/solarInsertDB-rt.gradle
Normal file
@ -0,0 +1,23 @@
|
||||
/* Module Build File */
|
||||
|
||||
description = "tsmc-solarInsertDB"
|
||||
ext {
|
||||
}
|
||||
niagaraModule {
|
||||
moduleName = "solarInsertDB"
|
||||
preferredSymbol = "mjmSolar"
|
||||
runtimeProfile = "rt"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "Tridium:nre:4.10"
|
||||
compile "Tridium:baja:4.10"
|
||||
uberjar files('tsmclibs/javacsv.jar')
|
||||
uberjar files('tsmclibs/mail-1.5.0-b01.jar')
|
||||
compile files('D:/Niagara/Niagara-4.7.109.20/jre/lib/ext/mssql-jdbc-8.4.1.jre8.jar')
|
||||
}
|
||||
|
||||
moduleTestJar {
|
||||
from('srcTest') {
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.mjm.solarInsertDB;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class A {
|
||||
|
||||
public static String makeUpdateCommand(List<String> fieldName, List<String> fieldValue , List<String> conditionName , List<String> conditionValue){
|
||||
// String command = "update " + databaseInformation.getDbName() + ".dbo." + databaseInformation.getDbTableName() + " set ";
|
||||
String command = "update " + "myDb" + ".dbo." + "myTable" + " set ";
|
||||
for (int i = 0; i < fieldName.size(); i++) {
|
||||
command = command + fieldName.get(i) +"='"+fieldValue.get(i) +"',";
|
||||
}
|
||||
command = command.substring(0, command.length() - 1)+" where ";
|
||||
for (int i = 0; i < conditionName.size(); i++) {
|
||||
command = command + conditionName.get(i) +"='"+conditionValue.get(i)+"' and ";
|
||||
}
|
||||
command = command.substring(0, command.length() - 4) + " ;";
|
||||
System.out.println("update command: " + command);
|
||||
return command;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param fieldName 要修改的属性
|
||||
* @param fieldValue 修改后值
|
||||
* @return
|
||||
*/
|
||||
private static String makeUpdateCommand2(List<String> fieldName, List<String> fieldValue){
|
||||
String command = "update " + "myDb" + ".dbo." + "myTable" + " set ";
|
||||
for (int i = 0; i < fieldName.size(); i++) {
|
||||
command = command + fieldName.get(i) +"='"+fieldValue.get(i) +"',";
|
||||
}
|
||||
command = command.substring(0, command.length()-1 ) + " ;";
|
||||
System.out.println("update command: " + command);
|
||||
return command;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
List<String> fieldName = Arrays.asList(new String[]{"name","age","sex"});
|
||||
List<String> fieldValue =Arrays.asList(new String[]{"bill","33","man"});
|
||||
// List<String> conditionName =Arrays.asList(new String[]{"color","pet"});
|
||||
// List<String> conditionValue =Arrays.asList(new String[]{"red","dog"});
|
||||
makeUpdateCommand2(fieldName,fieldValue);
|
||||
}
|
||||
}
|
@ -0,0 +1,178 @@
|
||||
package com.mjm.solarInsertDB;
|
||||
|
||||
import javax.baja.nre.annotations.NiagaraProperty;
|
||||
import javax.baja.nre.annotations.NiagaraType;
|
||||
import javax.baja.sys.*;
|
||||
|
||||
/**
|
||||
* Created by Huliang and jiahao on 2025/03/05.
|
||||
*/
|
||||
@NiagaraType
|
||||
@NiagaraProperty(name = "insertToDatabase", type = "boolean", defaultValue = "true",flags =Flags.SUMMARY )
|
||||
@NiagaraProperty(name = "dbIp", type = "BString", defaultValue = "127.0.0.1",flags =Flags.SUMMARY )
|
||||
@NiagaraProperty(name = "dbName", type = "BString", defaultValue = "center",flags =Flags.SUMMARY )
|
||||
@NiagaraProperty(name = "dbUser", type = "BString", defaultValue = "sa",flags =Flags.SUMMARY )
|
||||
@NiagaraProperty(name = "dbPassword", type = "BString", defaultValue = "123456",flags =Flags.SUMMARY )
|
||||
@NiagaraProperty(name = "dbTableName", type = "BString", defaultValue = "",flags =Flags.SUMMARY )
|
||||
public class BDatabaseInformation extends BComponent {
|
||||
|
||||
/*+ ------------ BEGIN BAJA AUTO GENERATED CODE ------------ +*/
|
||||
/*@ $com.mjm.solarInsertDB.BDatabaseInformation(371321780)1.0$ @*/
|
||||
/* Generated Fri Mar 07 22:03:14 CST 2025 by Slot-o-Matic (c) Tridium, Inc. 2012 */
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "insertToDatabase"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code insertToDatabase} property.
|
||||
* @see #getInsertToDatabase
|
||||
* @see #setInsertToDatabase
|
||||
*/
|
||||
public static final Property insertToDatabase = newProperty(Flags.SUMMARY, true, null);
|
||||
|
||||
/**
|
||||
* Get the {@code insertToDatabase} property.
|
||||
* @see #insertToDatabase
|
||||
*/
|
||||
public boolean getInsertToDatabase() { return getBoolean(insertToDatabase); }
|
||||
|
||||
/**
|
||||
* Set the {@code insertToDatabase} property.
|
||||
* @see #insertToDatabase
|
||||
*/
|
||||
public void setInsertToDatabase(boolean v) { setBoolean(insertToDatabase, v, null); }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "dbIp"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code dbIp} property.
|
||||
* @see #getDbIp
|
||||
* @see #setDbIp
|
||||
*/
|
||||
public static final Property dbIp = newProperty(Flags.SUMMARY, "127.0.0.1", null);
|
||||
|
||||
/**
|
||||
* Get the {@code dbIp} property.
|
||||
* @see #dbIp
|
||||
*/
|
||||
public String getDbIp() { return getString(dbIp); }
|
||||
|
||||
/**
|
||||
* Set the {@code dbIp} property.
|
||||
* @see #dbIp
|
||||
*/
|
||||
public void setDbIp(String v) { setString(dbIp, v, null); }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "dbName"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code dbName} property.
|
||||
* @see #getDbName
|
||||
* @see #setDbName
|
||||
*/
|
||||
public static final Property dbName = newProperty(Flags.SUMMARY, "center", null);
|
||||
|
||||
/**
|
||||
* Get the {@code dbName} property.
|
||||
* @see #dbName
|
||||
*/
|
||||
public String getDbName() { return getString(dbName); }
|
||||
|
||||
/**
|
||||
* Set the {@code dbName} property.
|
||||
* @see #dbName
|
||||
*/
|
||||
public void setDbName(String v) { setString(dbName, v, null); }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "dbUser"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code dbUser} property.
|
||||
* @see #getDbUser
|
||||
* @see #setDbUser
|
||||
*/
|
||||
public static final Property dbUser = newProperty(Flags.SUMMARY, "sa", null);
|
||||
|
||||
/**
|
||||
* Get the {@code dbUser} property.
|
||||
* @see #dbUser
|
||||
*/
|
||||
public String getDbUser() { return getString(dbUser); }
|
||||
|
||||
/**
|
||||
* Set the {@code dbUser} property.
|
||||
* @see #dbUser
|
||||
*/
|
||||
public void setDbUser(String v) { setString(dbUser, v, null); }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "dbPassword"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code dbPassword} property.
|
||||
* @see #getDbPassword
|
||||
* @see #setDbPassword
|
||||
*/
|
||||
public static final Property dbPassword = newProperty(Flags.SUMMARY, "123456", null);
|
||||
|
||||
/**
|
||||
* Get the {@code dbPassword} property.
|
||||
* @see #dbPassword
|
||||
*/
|
||||
public String getDbPassword() { return getString(dbPassword); }
|
||||
|
||||
/**
|
||||
* Set the {@code dbPassword} property.
|
||||
* @see #dbPassword
|
||||
*/
|
||||
public void setDbPassword(String v) { setString(dbPassword, v, null); }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "dbTableName"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code dbTableName} property.
|
||||
* @see #getDbTableName
|
||||
* @see #setDbTableName
|
||||
*/
|
||||
public static final Property dbTableName = newProperty(Flags.SUMMARY, "", null);
|
||||
|
||||
/**
|
||||
* Get the {@code dbTableName} property.
|
||||
* @see #dbTableName
|
||||
*/
|
||||
public String getDbTableName() { return getString(dbTableName); }
|
||||
|
||||
/**
|
||||
* Set the {@code dbTableName} property.
|
||||
* @see #dbTableName
|
||||
*/
|
||||
public void setDbTableName(String v) { setString(dbTableName, v, null); }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Type
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public Type getType() { return TYPE; }
|
||||
public static final Type TYPE = Sys.loadType(BDatabaseInformation.class);
|
||||
|
||||
/*+ ------------ END BAJA AUTO GENERATED CODE -------------- +*/
|
||||
|
||||
public void changed(Property property, Context context) {
|
||||
if (this.isRunning()) {
|
||||
System.out.println("DB information changed");
|
||||
BInsertData InsertData = (BInsertData)this.getParent().asComponent();
|
||||
InsertData.setDatabaseInformation();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
package com.mjm.solarInsertDB;
|
||||
|
||||
import javax.baja.nre.annotations.NiagaraProperty;
|
||||
import javax.baja.nre.annotations.NiagaraSlots;
|
||||
import javax.baja.nre.annotations.NiagaraType;
|
||||
import javax.baja.sys.*;
|
||||
|
||||
/**
|
||||
* Created by user on 2017/4/7.
|
||||
*/
|
||||
@NiagaraType
|
||||
@NiagaraSlots(
|
||||
properties =
|
||||
{
|
||||
@NiagaraProperty(name = "fieldName", type = "BString", defaultValue = "", flags = Flags.SUMMARY),
|
||||
@NiagaraProperty(name = "fieldValue", type = "BString", defaultValue = "", flags = Flags.SUMMARY)
|
||||
}
|
||||
)
|
||||
public class BField extends BComponent {
|
||||
/*+ ------------ BEGIN BAJA AUTO GENERATED CODE ------------ +*/
|
||||
/*@ $com.mjm.solarInsertDB.BField(3476477603)1.0$ @*/
|
||||
/* Generated Fri Mar 07 22:39:30 CST 2025 by Slot-o-Matic (c) Tridium, Inc. 2012 */
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "fieldName"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code fieldName} property.
|
||||
* @see #getFieldName
|
||||
* @see #setFieldName
|
||||
*/
|
||||
public static final Property fieldName = newProperty(Flags.SUMMARY, "", null);
|
||||
|
||||
/**
|
||||
* Get the {@code fieldName} property.
|
||||
* @see #fieldName
|
||||
*/
|
||||
public String getFieldName() { return getString(fieldName); }
|
||||
|
||||
/**
|
||||
* Set the {@code fieldName} property.
|
||||
* @see #fieldName
|
||||
*/
|
||||
public void setFieldName(String v) { setString(fieldName, v, null); }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "fieldValue"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code fieldValue} property.
|
||||
* @see #getFieldValue
|
||||
* @see #setFieldValue
|
||||
*/
|
||||
public static final Property fieldValue = newProperty(Flags.SUMMARY, "", null);
|
||||
|
||||
/**
|
||||
* Get the {@code fieldValue} property.
|
||||
* @see #fieldValue
|
||||
*/
|
||||
public String getFieldValue() { return getString(fieldValue); }
|
||||
|
||||
/**
|
||||
* Set the {@code fieldValue} property.
|
||||
* @see #fieldValue
|
||||
*/
|
||||
public void setFieldValue(String v) { setString(fieldValue, v, null); }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Type
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public Type getType() { return TYPE; }
|
||||
public static final Type TYPE = Sys.loadType(BField.class);
|
||||
|
||||
/*+ ------------ END BAJA AUTO GENERATED CODE -------------- +*/
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,130 @@
|
||||
package com.mjm.solarInsertDB;
|
||||
|
||||
import javax.baja.nre.annotations.NiagaraProperty;
|
||||
import javax.baja.nre.annotations.NiagaraSlots;
|
||||
import javax.baja.nre.annotations.NiagaraType;
|
||||
import javax.baja.sys.*;
|
||||
|
||||
/**
|
||||
* Created by user on 2017/4/7.
|
||||
*/
|
||||
@NiagaraType
|
||||
@NiagaraSlots(
|
||||
properties =
|
||||
{
|
||||
@NiagaraProperty(name = "fieldName", type = "BString", defaultValue = "", flags = Flags.SUMMARY),
|
||||
@NiagaraProperty(name = "fieldValue", type = "BString", defaultValue = "", flags = Flags.SUMMARY),
|
||||
@NiagaraProperty(name = "conditionName", type = "BString", defaultValue = "", flags = Flags.SUMMARY),
|
||||
@NiagaraProperty(name = "conditionValue", type = "BString", defaultValue = "", flags = Flags.SUMMARY)
|
||||
}
|
||||
)
|
||||
public class BFieldUpdate extends BComponent {
|
||||
/*+ ------------ BEGIN BAJA AUTO GENERATED CODE ------------ +*/
|
||||
/*@ $com.mjm.solarInsertDB.BFieldUpdate(1202817490)1.0$ @*/
|
||||
/* Generated Mon Mar 10 19:56:08 CST 2025 by Slot-o-Matic (c) Tridium, Inc. 2012 */
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "fieldName"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code fieldName} property.
|
||||
* @see #getFieldName
|
||||
* @see #setFieldName
|
||||
*/
|
||||
public static final Property fieldName = newProperty(Flags.SUMMARY, "", null);
|
||||
|
||||
/**
|
||||
* Get the {@code fieldName} property.
|
||||
* @see #fieldName
|
||||
*/
|
||||
public String getFieldName() { return getString(fieldName); }
|
||||
|
||||
/**
|
||||
* Set the {@code fieldName} property.
|
||||
* @see #fieldName
|
||||
*/
|
||||
public void setFieldName(String v) { setString(fieldName, v, null); }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "fieldValue"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code fieldValue} property.
|
||||
* @see #getFieldValue
|
||||
* @see #setFieldValue
|
||||
*/
|
||||
public static final Property fieldValue = newProperty(Flags.SUMMARY, "", null);
|
||||
|
||||
/**
|
||||
* Get the {@code fieldValue} property.
|
||||
* @see #fieldValue
|
||||
*/
|
||||
public String getFieldValue() { return getString(fieldValue); }
|
||||
|
||||
/**
|
||||
* Set the {@code fieldValue} property.
|
||||
* @see #fieldValue
|
||||
*/
|
||||
public void setFieldValue(String v) { setString(fieldValue, v, null); }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "conditionName"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code conditionName} property.
|
||||
* @see #getConditionName
|
||||
* @see #setConditionName
|
||||
*/
|
||||
public static final Property conditionName = newProperty(Flags.SUMMARY, "", null);
|
||||
|
||||
/**
|
||||
* Get the {@code conditionName} property.
|
||||
* @see #conditionName
|
||||
*/
|
||||
public String getConditionName() { return getString(conditionName); }
|
||||
|
||||
/**
|
||||
* Set the {@code conditionName} property.
|
||||
* @see #conditionName
|
||||
*/
|
||||
public void setConditionName(String v) { setString(conditionName, v, null); }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "conditionValue"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code conditionValue} property.
|
||||
* @see #getConditionValue
|
||||
* @see #setConditionValue
|
||||
*/
|
||||
public static final Property conditionValue = newProperty(Flags.SUMMARY, "", null);
|
||||
|
||||
/**
|
||||
* Get the {@code conditionValue} property.
|
||||
* @see #conditionValue
|
||||
*/
|
||||
public String getConditionValue() { return getString(conditionValue); }
|
||||
|
||||
/**
|
||||
* Set the {@code conditionValue} property.
|
||||
* @see #conditionValue
|
||||
*/
|
||||
public void setConditionValue(String v) { setString(conditionValue, v, null); }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Type
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public Type getType() { return TYPE; }
|
||||
public static final Type TYPE = Sys.loadType(BFieldUpdate.class);
|
||||
|
||||
/*+ ------------ END BAJA AUTO GENERATED CODE -------------- +*/
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,508 @@
|
||||
package com.mjm.solarInsertDB;
|
||||
|
||||
import com.csvreader.CsvWriter;
|
||||
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.nre.annotations.*;
|
||||
import javax.baja.sys.*;
|
||||
import javax.baja.util.BNotification;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.Statement;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Created by user on 2017/4/7.
|
||||
*/
|
||||
@NiagaraType
|
||||
@NiagaraSlots(
|
||||
properties =
|
||||
{
|
||||
@NiagaraProperty(name = "DatabaseInformation", type = "BDatabaseInformation", defaultValue = "new BDatabaseInformation()", flags = Flags.SUMMARY),
|
||||
@NiagaraProperty(name = "disable", type = "boolean", defaultValue = "true", flags = Flags.SUMMARY),
|
||||
@NiagaraProperty(name = "exception", type = "boolean", defaultValue = "false", flags = Flags.SUMMARY),
|
||||
@NiagaraProperty(name = "working", type = "boolean", defaultValue = "false", flags = Flags.SUMMARY),
|
||||
@NiagaraProperty(name = "showMessage", type = "boolean", defaultValue = "true", flags = Flags.SUMMARY),
|
||||
@NiagaraProperty(name = "path", type = "String", defaultValue = "", flags = Flags.SUMMARY),
|
||||
@NiagaraProperty(name = "fileName", type = "String", defaultValue = "", flags = Flags.SUMMARY)
|
||||
},
|
||||
actions =
|
||||
{
|
||||
@NiagaraAction(name = "insert"),
|
||||
@NiagaraAction(name = "setField", parameterType = "BInteger", defaultValue = "BInteger.make(1)")
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
public class BInsertData extends BComponent {
|
||||
/*+ ------------ BEGIN BAJA AUTO GENERATED CODE ------------ +*/
|
||||
/*@ $com.mjm.solarInsertDB.BInsertData(1564231253)1.0$ @*/
|
||||
/* Generated Fri Mar 07 22:21:47 CST 2025 by Slot-o-Matic (c) Tridium, Inc. 2012 */
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "DatabaseInformation"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code DatabaseInformation} property.
|
||||
*
|
||||
* @see #getDatabaseInformation
|
||||
* @see #setDatabaseInformation
|
||||
*/
|
||||
public static final Property DatabaseInformation = newProperty(Flags.SUMMARY, new BDatabaseInformation(), null);
|
||||
|
||||
/**
|
||||
* Get the {@code DatabaseInformation} property.
|
||||
*
|
||||
* @see #DatabaseInformation
|
||||
*/
|
||||
public BDatabaseInformation getDatabaseInformation() {
|
||||
return (BDatabaseInformation) get(DatabaseInformation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the {@code DatabaseInformation} property.
|
||||
*
|
||||
* @see #DatabaseInformation
|
||||
*/
|
||||
public void setDatabaseInformation(BDatabaseInformation v) {
|
||||
set(DatabaseInformation, v, null);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "disable"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code disable} property.
|
||||
*
|
||||
* @see #getDisable
|
||||
* @see #setDisable
|
||||
*/
|
||||
public static final Property disable = newProperty(Flags.SUMMARY, true, null);
|
||||
|
||||
/**
|
||||
* Get the {@code disable} property.
|
||||
*
|
||||
* @see #disable
|
||||
*/
|
||||
public boolean getDisable() {
|
||||
return getBoolean(disable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the {@code disable} property.
|
||||
*
|
||||
* @see #disable
|
||||
*/
|
||||
public void setDisable(boolean v) {
|
||||
setBoolean(disable, v, null);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "exception"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code exception} property.
|
||||
*
|
||||
* @see #getException
|
||||
* @see #setException
|
||||
*/
|
||||
public static final Property exception = newProperty(Flags.SUMMARY, false, null);
|
||||
|
||||
/**
|
||||
* Get the {@code exception} property.
|
||||
*
|
||||
* @see #exception
|
||||
*/
|
||||
public boolean getException() {
|
||||
return getBoolean(exception);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the {@code exception} property.
|
||||
*
|
||||
* @see #exception
|
||||
*/
|
||||
public void setException(boolean v) {
|
||||
setBoolean(exception, v, null);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "working"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code working} property.
|
||||
*
|
||||
* @see #getWorking
|
||||
* @see #setWorking
|
||||
*/
|
||||
public static final Property working = newProperty(Flags.SUMMARY, false, null);
|
||||
|
||||
/**
|
||||
* Get the {@code working} property.
|
||||
*
|
||||
* @see #working
|
||||
*/
|
||||
public boolean getWorking() {
|
||||
return getBoolean(working);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the {@code working} property.
|
||||
*
|
||||
* @see #working
|
||||
*/
|
||||
public void setWorking(boolean v) {
|
||||
setBoolean(working, v, null);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "showMessage"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code showMessage} property.
|
||||
*
|
||||
* @see #getShowMessage
|
||||
* @see #setShowMessage
|
||||
*/
|
||||
public static final Property showMessage = newProperty(Flags.SUMMARY, true, null);
|
||||
|
||||
/**
|
||||
* Get the {@code showMessage} property.
|
||||
*
|
||||
* @see #showMessage
|
||||
*/
|
||||
public boolean getShowMessage() {
|
||||
return getBoolean(showMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the {@code showMessage} property.
|
||||
*
|
||||
* @see #showMessage
|
||||
*/
|
||||
public void setShowMessage(boolean v) {
|
||||
setBoolean(showMessage, v, null);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "path"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code path} property.
|
||||
*
|
||||
* @see #getPath
|
||||
* @see #setPath
|
||||
*/
|
||||
public static final Property path = newProperty(Flags.SUMMARY, "", null);
|
||||
|
||||
/**
|
||||
* Get the {@code path} property.
|
||||
*
|
||||
* @see #path
|
||||
*/
|
||||
public String getPath() {
|
||||
return getString(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the {@code path} property.
|
||||
*
|
||||
* @see #path
|
||||
*/
|
||||
public void setPath(String v) {
|
||||
setString(path, v, null);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "fileName"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code fileName} property.
|
||||
*
|
||||
* @see #getFileName
|
||||
* @see #setFileName
|
||||
*/
|
||||
public static final Property fileName = newProperty(Flags.SUMMARY, "", null);
|
||||
|
||||
/**
|
||||
* Get the {@code fileName} property.
|
||||
*
|
||||
* @see #fileName
|
||||
*/
|
||||
public String getFileName() {
|
||||
return getString(fileName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the {@code fileName} property.
|
||||
*
|
||||
* @see #fileName
|
||||
*/
|
||||
public void setFileName(String v) {
|
||||
setString(fileName, v, null);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Action "insert"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code insert} action.
|
||||
*
|
||||
* @see #insert()
|
||||
*/
|
||||
public static final Action insert = newAction(0, null);
|
||||
|
||||
/**
|
||||
* Invoke the {@code insert} action.
|
||||
*
|
||||
* @see #insert
|
||||
*/
|
||||
public void insert() {
|
||||
invoke(insert, null, null);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Action "setField"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code setField} action.
|
||||
*
|
||||
* @see #setField(BInteger parameter)
|
||||
*/
|
||||
public static final Action setField = newAction(0, BInteger.make(1), null);
|
||||
|
||||
/**
|
||||
* Invoke the {@code setField} action.
|
||||
*
|
||||
* @see #setField
|
||||
*/
|
||||
public void setField(BInteger parameter) {
|
||||
invoke(setField, parameter, null);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Type
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static final Type TYPE = Sys.loadType(BInsertData.class);
|
||||
|
||||
/*+ ------------ END BAJA AUTO GENERATED CODE -------------- +*/
|
||||
|
||||
|
||||
BDatabaseInformation databaseInformation = null;
|
||||
|
||||
public void started() {
|
||||
databaseInformation = (BDatabaseInformation) this.getDatabaseInformation().asComponent();
|
||||
BOrd absolute = BOrd.make("station:|slot:/Services/PlatformServices/SystemService/hostId");
|
||||
String hostID = absolute.get().toString();
|
||||
System.out.println(this.getType().getTypeName() + " --onStarted-- " + hostID);
|
||||
}
|
||||
|
||||
|
||||
public void changed(Property property, Context context) {
|
||||
if (this.isRunning()) {
|
||||
if (property == databaseInformation) {
|
||||
System.out.println("in insert data");
|
||||
databaseInformation = (BDatabaseInformation) this.databaseInformation.asComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void doInsert() {
|
||||
|
||||
System.out.println("0323 doInsert: ");
|
||||
if (1 == 1) { //if (checkLicense.getLegal())
|
||||
List<String> fieldName = new ArrayList<String>();
|
||||
List<String> fieldValue = new ArrayList<String>();
|
||||
|
||||
if (this.getDisable() || this.getException()) {
|
||||
if (this.getShowMessage()) {
|
||||
System.out.println("disable or exception");
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
this.setWorking(true);
|
||||
Property property[] = this.getDynamicPropertiesArray();
|
||||
|
||||
for (int i = 0; i < property.length; i++) {
|
||||
if (property[i].getName().contains("Field")) {
|
||||
BField field = (BField) this.get(property[i]).asComponent();
|
||||
fieldName.add(field.getFieldName());
|
||||
fieldValue.add(field.getFieldValue());
|
||||
}
|
||||
}
|
||||
|
||||
if (fieldName.size() == fieldValue.size()) {
|
||||
if (databaseInformation.getInsertToDatabase()) {
|
||||
String insertCommand = makeInsertCommand(fieldName, fieldValue);
|
||||
|
||||
// 建立连接
|
||||
ConnectInformation connectInformation = new ConnectInformation();
|
||||
Connection connection = connectInformation.getSQLServerConnection(databaseInformation.getDbIp(), databaseInformation.getDbName(),
|
||||
databaseInformation.getDbUser(), databaseInformation.getDbPassword(), databaseInformation.getDbTableName());
|
||||
System.out.println("------connection info: " + connection);
|
||||
// 创建Statement
|
||||
Statement statement = connection.createStatement();
|
||||
System.out.println("------insertCommand info: " + insertCommand);
|
||||
// 执行查询
|
||||
statement.execute(insertCommand);
|
||||
statement.close();
|
||||
connection.close();
|
||||
}
|
||||
createCSV(fieldName, fieldValue);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
this.setException(true);
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
this.setWorking(false);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.out.println("no license!");
|
||||
BNotification note = new BNotification();
|
||||
note.add("title", BString.make("No License"));
|
||||
note.add("message", BString.make("Please contact FIC"));
|
||||
note.raise(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void doSetField(BInteger interger) {
|
||||
|
||||
int number = interger.getInt();
|
||||
Property property[] = this.getDynamicPropertiesArray();
|
||||
for (int i = 0; i < property.length; i++) {
|
||||
if (property[i].getName().contains("Field")) {
|
||||
this.remove(property[i].getName());
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < number; i++) {
|
||||
this.add("Field" + (i + 1), new BField());
|
||||
}
|
||||
}
|
||||
|
||||
private void createCSV(List<String> fieldName, List<String> fieldValue) {
|
||||
|
||||
SimpleDateFormat sdFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date date = new Date();
|
||||
String strDate = sdFormat.format(date);
|
||||
String outputFile = "../../shared/" + this.getPath() + strDate + this.getFileName();
|
||||
|
||||
// before we open the file check to see if it already exists
|
||||
boolean alreadyExists = new File(outputFile).exists();
|
||||
try {
|
||||
// use FileWriter constructor that specifies open for appending
|
||||
if (!alreadyExists) {
|
||||
deleteFile();
|
||||
if (!this.getPath().equals("")) {
|
||||
File file = new File(outputFile);
|
||||
file.getParentFile().mkdir();
|
||||
try {
|
||||
file.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CsvWriter csvOutput = new CsvWriter(new FileWriter(outputFile, true), ',');
|
||||
// if the file didn't already exist then we need to write out the header line
|
||||
if (!alreadyExists) {
|
||||
for (int i = 0; i < fieldName.size(); i++) {
|
||||
csvOutput.write(fieldName.get(i));
|
||||
}
|
||||
csvOutput.endRecord();
|
||||
}
|
||||
// else assume that the file already has the correct header line
|
||||
// write out a few records
|
||||
|
||||
for (int i = 0; i < fieldValue.size(); i++) {
|
||||
csvOutput.write(fieldValue.get(i));
|
||||
}
|
||||
csvOutput.endRecord();
|
||||
csvOutput.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteFile() {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.add(Calendar.DAY_OF_MONTH, -90);//90天前
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String before90 = format.format(cal.getTime()) + " 00:00:00";
|
||||
System.out.println("delete file before " + before90);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
|
||||
|
||||
try {
|
||||
Date sDate = sdf.parse(before90);
|
||||
long beforeTimestamp = sDate.getTime() / 1000;
|
||||
// System.out.println(beforeTimestamp);
|
||||
String fullpath = "../../shared/" + this.getPath();
|
||||
File a = new File(fullpath);
|
||||
if (a.isDirectory()) {
|
||||
String[] filenames = a.list();
|
||||
for (int i = 0; i < filenames.length; i++) {
|
||||
File tempFile = new File(fullpath + "\\" + filenames[i]);
|
||||
if (tempFile.isDirectory()) {
|
||||
System.out.println("目錄:" + filenames[i]);
|
||||
} else {
|
||||
// System.out.println("檔案:" + filenames[i]);
|
||||
String dateName = filenames[i].split(" ")[0] + " 00:00:00";
|
||||
sDate = sdf.parse(dateName);
|
||||
long fileTimestamp = sDate.getTime() / 1000;
|
||||
if (fileTimestamp < beforeTimestamp) {
|
||||
System.out.println("delete file " + fullpath + filenames[i]);
|
||||
File deleteFile = new File(fullpath + filenames[i]);
|
||||
deleteFile.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.out.println("[" + a + "]不是目錄");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private String makeInsertCommand(List<String> fieldName, List<String> fieldValue) {
|
||||
String command = "INSERT INTO " + databaseInformation.getDbName() + ".dbo." + databaseInformation.getDbTableName() + " (";
|
||||
for (int i = 0; i < fieldName.size(); i++) {
|
||||
command = command + fieldName.get(i) + ", ";
|
||||
}
|
||||
command = command.substring(0, command.length() - 2) + ") VALUES (";
|
||||
for (int i = 0; i < fieldValue.size(); i++) {
|
||||
command = command + "'" + fieldValue.get(i) + "', ";
|
||||
}
|
||||
command = command.substring(0, command.length() - 2) + ");";
|
||||
System.out.println("insert command: " + command);
|
||||
return command;
|
||||
}
|
||||
|
||||
|
||||
public void setDatabaseInformation() {
|
||||
databaseInformation = (BDatabaseInformation) this.getDatabaseInformation().asComponent();
|
||||
}
|
||||
}
|
@ -0,0 +1,553 @@
|
||||
package com.mjm.solarInsertDB;
|
||||
|
||||
import com.csvreader.CsvWriter;
|
||||
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.nre.annotations.NiagaraAction;
|
||||
import javax.baja.nre.annotations.NiagaraProperty;
|
||||
import javax.baja.nre.annotations.NiagaraSlots;
|
||||
import javax.baja.nre.annotations.NiagaraType;
|
||||
import javax.baja.sys.*;
|
||||
import javax.baja.util.BNotification;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.Statement;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
|
||||
/**
|
||||
* Created by user on 2017/4/7.
|
||||
*/
|
||||
@NiagaraType
|
||||
@NiagaraSlots(
|
||||
properties =
|
||||
{
|
||||
@NiagaraProperty(name = "DatabaseInformation", type = "BDatabaseInformation",defaultValue = "new BDatabaseInformation()",flags =Flags.SUMMARY ),
|
||||
@NiagaraProperty(name = "disable", type = "boolean", defaultValue = "true",flags =Flags.SUMMARY ),
|
||||
@NiagaraProperty(name = "exception", type = "boolean", defaultValue = "false",flags =Flags.SUMMARY ),
|
||||
@NiagaraProperty(name = "working", type = "boolean", defaultValue = "false",flags =Flags.SUMMARY ),
|
||||
@NiagaraProperty(name = "showMessage", type = "boolean", defaultValue = "true",flags =Flags.SUMMARY ),
|
||||
@NiagaraProperty(name = "path", type = "String", defaultValue = "",flags =Flags.SUMMARY ),
|
||||
@NiagaraProperty(name = "fileName", type = "String", defaultValue = "",flags =Flags.SUMMARY )
|
||||
},
|
||||
actions =
|
||||
{
|
||||
@NiagaraAction(name = "insert"),
|
||||
@NiagaraAction(name = "setField",parameterType = "BInteger",defaultValue ="BInteger.make(1)" )
|
||||
}
|
||||
)
|
||||
//@NiagaraActions(
|
||||
// @NiagaraAction(name = "insert"),
|
||||
// @NiagaraAction(name = "setField",parameterType = "BInteger",defaultValue = "BInteger.make(0)")
|
||||
//)
|
||||
|
||||
|
||||
public class BInsertData2 extends BComponent {
|
||||
/*+ ------------ BEGIN BAJA AUTO GENERATED CODE ------------ +*/
|
||||
/*@ $com.mjm.solarInsertDB.BInsertData(1564231253)1.0$ @*/
|
||||
/* Generated Fri Mar 07 22:21:47 CST 2025 by Slot-o-Matic (c) Tridium, Inc. 2012 */
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "DatabaseInformation"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code DatabaseInformation} property.
|
||||
* @see #getDatabaseInformation
|
||||
* @see #setDatabaseInformation
|
||||
*/
|
||||
public static final Property DatabaseInformation = newProperty(Flags.SUMMARY, new BDatabaseInformation(), null);
|
||||
|
||||
/**
|
||||
* Get the {@code DatabaseInformation} property.
|
||||
* @see #DatabaseInformation
|
||||
*/
|
||||
public BDatabaseInformation getDatabaseInformation() { return (BDatabaseInformation)get(DatabaseInformation); }
|
||||
|
||||
/**
|
||||
* Set the {@code DatabaseInformation} property.
|
||||
* @see #DatabaseInformation
|
||||
*/
|
||||
public void setDatabaseInformation(BDatabaseInformation v) { set(DatabaseInformation, v, null); }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "disable"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code disable} property.
|
||||
* @see #getDisable
|
||||
* @see #setDisable
|
||||
*/
|
||||
public static final Property disable = newProperty(Flags.SUMMARY, true, null);
|
||||
|
||||
/**
|
||||
* Get the {@code disable} property.
|
||||
* @see #disable
|
||||
*/
|
||||
public boolean getDisable() { return getBoolean(disable); }
|
||||
|
||||
/**
|
||||
* Set the {@code disable} property.
|
||||
* @see #disable
|
||||
*/
|
||||
public void setDisable(boolean v) { setBoolean(disable, v, null); }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "exception"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code exception} property.
|
||||
* @see #getException
|
||||
* @see #setException
|
||||
*/
|
||||
public static final Property exception = newProperty(Flags.SUMMARY, false, null);
|
||||
|
||||
/**
|
||||
* Get the {@code exception} property.
|
||||
* @see #exception
|
||||
*/
|
||||
public boolean getException() { return getBoolean(exception); }
|
||||
|
||||
/**
|
||||
* Set the {@code exception} property.
|
||||
* @see #exception
|
||||
*/
|
||||
public void setException(boolean v) { setBoolean(exception, v, null); }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "working"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code working} property.
|
||||
* @see #getWorking
|
||||
* @see #setWorking
|
||||
*/
|
||||
public static final Property working = newProperty(Flags.SUMMARY, false, null);
|
||||
|
||||
/**
|
||||
* Get the {@code working} property.
|
||||
* @see #working
|
||||
*/
|
||||
public boolean getWorking() { return getBoolean(working); }
|
||||
|
||||
/**
|
||||
* Set the {@code working} property.
|
||||
* @see #working
|
||||
*/
|
||||
public void setWorking(boolean v) { setBoolean(working, v, null); }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "showMessage"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code showMessage} property.
|
||||
* @see #getShowMessage
|
||||
* @see #setShowMessage
|
||||
*/
|
||||
public static final Property showMessage = newProperty(Flags.SUMMARY, true, null);
|
||||
|
||||
/**
|
||||
* Get the {@code showMessage} property.
|
||||
* @see #showMessage
|
||||
*/
|
||||
public boolean getShowMessage() { return getBoolean(showMessage); }
|
||||
|
||||
/**
|
||||
* Set the {@code showMessage} property.
|
||||
* @see #showMessage
|
||||
*/
|
||||
public void setShowMessage(boolean v) { setBoolean(showMessage, v, null); }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "path"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code path} property.
|
||||
* @see #getPath
|
||||
* @see #setPath
|
||||
*/
|
||||
public static final Property path = newProperty(Flags.SUMMARY, "", null);
|
||||
|
||||
/**
|
||||
* Get the {@code path} property.
|
||||
* @see #path
|
||||
*/
|
||||
public String getPath() { return getString(path); }
|
||||
|
||||
/**
|
||||
* Set the {@code path} property.
|
||||
* @see #path
|
||||
*/
|
||||
public void setPath(String v) { setString(path, v, null); }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "fileName"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code fileName} property.
|
||||
* @see #getFileName
|
||||
* @see #setFileName
|
||||
*/
|
||||
public static final Property fileName = newProperty(Flags.SUMMARY, "", null);
|
||||
|
||||
/**
|
||||
* Get the {@code fileName} property.
|
||||
* @see #fileName
|
||||
*/
|
||||
public String getFileName() { return getString(fileName); }
|
||||
|
||||
/**
|
||||
* Set the {@code fileName} property.
|
||||
* @see #fileName
|
||||
*/
|
||||
public void setFileName(String v) { setString(fileName, v, null); }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Action "insert"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code insert} action.
|
||||
* @see #insert()
|
||||
*/
|
||||
public static final Action insert = newAction(0, null);
|
||||
|
||||
/**
|
||||
* Invoke the {@code insert} action.
|
||||
* @see #insert
|
||||
*/
|
||||
public void insert() { invoke(insert, null, null); }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Action "setField"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code setField} action.
|
||||
* @see #setField(BInteger parameter)
|
||||
*/
|
||||
public static final Action setField = newAction(0, BInteger.make(1), null);
|
||||
|
||||
/**
|
||||
* Invoke the {@code setField} action.
|
||||
* @see #setField
|
||||
*/
|
||||
public void setField(BInteger parameter) { invoke(setField, parameter, null); }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Type
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public Type getType() { return TYPE; }
|
||||
public static final Type TYPE = Sys.loadType(BInsertData2.class);
|
||||
|
||||
/*+ ------------ END BAJA AUTO GENERATED CODE -------------- +*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BDatabaseInformation databaseInformation = null;
|
||||
|
||||
public void started() {
|
||||
databaseInformation = (BDatabaseInformation) this.getDatabaseInformation().asComponent();
|
||||
BOrd absolute = BOrd.make("station:|slot:/Services/PlatformServices/SystemService/hostId");
|
||||
String hostID = absolute.get().toString();
|
||||
|
||||
System.out.println(this.getType().getTypeName() + " --onStarted-- " + hostID);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void changed(Property property, Context context) {
|
||||
if (this.isRunning()) {
|
||||
if (property == databaseInformation) {
|
||||
System.out.println("in insert data");
|
||||
databaseInformation = (BDatabaseInformation)this.databaseInformation.asComponent();
|
||||
// .getDatabaseInformation().asComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void doInsert() {
|
||||
|
||||
System.out.println("0307 doInsert: ");
|
||||
if (1==1) {
|
||||
// if (checkLicense.getLegal()) {
|
||||
|
||||
ArrayList<String> fieldName = new ArrayList<String>();
|
||||
ArrayList<String> fieldValue = new ArrayList<String>();
|
||||
|
||||
|
||||
if (this.getDisable() || this.getException()) {
|
||||
if (this.getShowMessage()) {
|
||||
System.out.println("disable or exception");
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
this.setWorking(true);
|
||||
|
||||
Property property[] = this.getDynamicPropertiesArray();
|
||||
|
||||
for (int i = 0; i < property.length; i++) {
|
||||
|
||||
if (property[i].getName().contains("Field")) {
|
||||
|
||||
BField field = (BField) this.get(property[i]).asComponent();
|
||||
|
||||
fieldName.add(field.getFieldName());
|
||||
fieldValue.add(field.getFieldValue());
|
||||
}
|
||||
}
|
||||
|
||||
if (fieldName.size() == fieldValue.size()) {
|
||||
// System.out.println(databaseInformation.getInsertToDatabase());
|
||||
if (databaseInformation.getInsertToDatabase()) {
|
||||
String insertCommand = makeInsertCommand(fieldName, fieldValue);
|
||||
// System.out.println("insertCommand : "+insertCommand);
|
||||
// ConnectInformation connectInformation = new ConnectInformation(databaseInformation.getDbIp(), databaseInformation.getDbName(), databaseInformation.getDbUser(), databaseInformation.getDbPassword(), databaseInformation.getDbTableName());
|
||||
// MySQL mysql = new MySQL(connectInformation);
|
||||
////
|
||||
// mysql.insertSQLCommand(insertCommand);
|
||||
|
||||
// 建立连接
|
||||
ConnectInformation connectInformation = new ConnectInformation();
|
||||
Connection connection = connectInformation.getSQLServerConnection(databaseInformation.getDbIp(), databaseInformation.getDbName(), databaseInformation.getDbUser(), databaseInformation.getDbPassword(), databaseInformation.getDbTableName());
|
||||
System.out.println("------connection info: "+connection);
|
||||
// 创建Statement
|
||||
Statement statement = connection.createStatement();
|
||||
System.out.println("------insertCommand info: "+insertCommand);
|
||||
// 执行查询
|
||||
// statement.execute("insert into data (c0) values(23228);");
|
||||
statement.execute(insertCommand);
|
||||
statement.close();
|
||||
connection.close();
|
||||
}
|
||||
createCSV(fieldName, fieldValue);
|
||||
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
this.setException(true);
|
||||
e.printStackTrace();
|
||||
|
||||
} finally {
|
||||
this.setWorking(false);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
System.out.println("no license!");
|
||||
BNotification note = new BNotification();
|
||||
note.add("title", BString.make("No License"));
|
||||
note.add("message", BString.make("Please contact FIC"));
|
||||
note.raise(true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void doSetField(BInteger interger) {
|
||||
|
||||
int number = interger.getInt();
|
||||
|
||||
|
||||
Property property[] = this.getDynamicPropertiesArray();
|
||||
|
||||
|
||||
for (int i = 0; i < property.length; i++) {
|
||||
|
||||
if (property[i].getName().contains("Field")) {
|
||||
|
||||
this.remove(property[i].getName());
|
||||
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < number; i++) {
|
||||
|
||||
this.add("Field" + (i + 1), new BField());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void createCSV(ArrayList<String> fieldName, ArrayList<String> fieldValue) {
|
||||
|
||||
SimpleDateFormat sdFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date date = new Date();
|
||||
String strDate = sdFormat.format(date);
|
||||
|
||||
|
||||
String outputFile = "../../shared/" + this.getPath() + strDate + this.getFileName();
|
||||
|
||||
// before we open the file check to see if it already exists
|
||||
boolean alreadyExists = new File(outputFile).exists();
|
||||
|
||||
try {
|
||||
// use FileWriter constructor that specifies open for appending
|
||||
|
||||
|
||||
if (!alreadyExists) {
|
||||
|
||||
deleteFile();
|
||||
|
||||
if (!this.getPath().equals("")) {
|
||||
|
||||
File file = new File(outputFile);
|
||||
file.getParentFile().mkdir();
|
||||
try {
|
||||
file.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
CsvWriter csvOutput = new CsvWriter(new FileWriter(outputFile, true), ',');
|
||||
|
||||
// if the file didn't already exist then we need to write out the header line
|
||||
if (!alreadyExists) {
|
||||
|
||||
|
||||
for (int i = 0; i < fieldName.size(); i++) {
|
||||
csvOutput.write(fieldName.get(i));
|
||||
|
||||
|
||||
}
|
||||
csvOutput.endRecord();
|
||||
}
|
||||
// else assume that the file already has the correct header line
|
||||
|
||||
// write out a few records
|
||||
|
||||
for (int i = 0; i < fieldValue.size(); i++) {
|
||||
|
||||
// System.out.println(fieldValue.get(i));
|
||||
|
||||
csvOutput.write(fieldValue.get(i));
|
||||
|
||||
}
|
||||
|
||||
csvOutput.endRecord();
|
||||
|
||||
|
||||
csvOutput.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void deleteFile() {
|
||||
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.add(Calendar.DAY_OF_MONTH, -90);//90天前
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
String before90 = format.format(cal.getTime()) + " 00:00:00";
|
||||
|
||||
System.out.println("delete file before " + before90);
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
|
||||
|
||||
|
||||
try {
|
||||
Date sDate = sdf.parse(before90);
|
||||
long beforeTimestamp = sDate.getTime() / 1000;
|
||||
// System.out.println(beforeTimestamp);
|
||||
|
||||
|
||||
String fullpath = "../../shared/" + this.getPath();
|
||||
|
||||
File a = new File(fullpath);
|
||||
|
||||
|
||||
if (a.isDirectory()) {
|
||||
String[] filenames = a.list();
|
||||
for (int i = 0; i < filenames.length; i++) {
|
||||
File tempFile = new File(fullpath + "\\" + filenames[i]);
|
||||
if (tempFile.isDirectory()) {
|
||||
System.out.println("目錄:" + filenames[i]);
|
||||
} else {
|
||||
// System.out.println("檔案:" + filenames[i]);
|
||||
|
||||
String dateName = filenames[i].split(" ")[0] + " 00:00:00";
|
||||
|
||||
sDate = sdf.parse(dateName);
|
||||
long fileTimestamp = sDate.getTime() / 1000;
|
||||
|
||||
if (fileTimestamp < beforeTimestamp) {
|
||||
System.out.println("delete file " + fullpath + filenames[i]);
|
||||
File deleteFile = new File(fullpath + filenames[i]);
|
||||
deleteFile.delete();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.out.println("[" + a + "]不是目錄");
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private String makeInsertCommand(ArrayList<String> fieldName, ArrayList<String> fieldValue) {
|
||||
|
||||
String command = "INSERT INTO " + databaseInformation.getDbName() + ".dbo." + databaseInformation.getDbTableName() + " (";
|
||||
//INSERT INTO `fpgcenter`.`0071801` (`timestamp`, `inverterID`, `SN`, `status`, `AC1V`, `AC1A`, `AC1W`, `AC1F`, `AC1Wh`, `AC2V`, `AC2A`, `AC2W`, `AC2F`, `AC2Wh`, `AC3V`, `AC3A`, `AC3W`, `AC3F`, `AC3Wh`, `ACRT`, `DC1V`, `DC1A`, `DC1W`, `DC1Wh`, `DC2V`, `DC2A`, `DC2W`, `DC2Wh`, `DCRT`, `totalKWH`) VALUES ('1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1');
|
||||
|
||||
for (int i = 0; i < fieldName.size(); i++) {
|
||||
|
||||
command = command + fieldName.get(i) + ", ";
|
||||
|
||||
}
|
||||
command = command.substring(0, command.length() - 2) + ") VALUES (";
|
||||
|
||||
for (int i = 0; i < fieldValue.size(); i++) {
|
||||
|
||||
command = command + "'" + fieldValue.get(i) + "', ";
|
||||
|
||||
}
|
||||
|
||||
command = command.substring(0, command.length() - 2) + ");";
|
||||
|
||||
System.out.println("command: "+command);
|
||||
return command;
|
||||
|
||||
}
|
||||
public void setDatabaseInformation(){
|
||||
|
||||
databaseInformation = (BDatabaseInformation) this.getDatabaseInformation().asComponent();
|
||||
}
|
||||
}
|
@ -0,0 +1,482 @@
|
||||
package com.mjm.solarInsertDB;
|
||||
|
||||
import com.csvreader.CsvWriter;
|
||||
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.nre.annotations.NiagaraAction;
|
||||
import javax.baja.nre.annotations.NiagaraProperty;
|
||||
import javax.baja.nre.annotations.NiagaraSlots;
|
||||
import javax.baja.nre.annotations.NiagaraType;
|
||||
import javax.baja.sys.*;
|
||||
import javax.baja.util.BNotification;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.Statement;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Created by user on 2017/4/7.
|
||||
*/
|
||||
@NiagaraType
|
||||
@NiagaraSlots(
|
||||
properties =
|
||||
{
|
||||
@NiagaraProperty(name = "DatabaseInformation", type = "BDatabaseInformation", defaultValue = "new BDatabaseInformation()", flags = Flags.SUMMARY),
|
||||
@NiagaraProperty(name = "disable", type = "boolean", defaultValue = "true", flags = Flags.SUMMARY),
|
||||
@NiagaraProperty(name = "exception", type = "boolean", defaultValue = "false", flags = Flags.SUMMARY),
|
||||
@NiagaraProperty(name = "working", type = "boolean", defaultValue = "false", flags = Flags.SUMMARY),
|
||||
@NiagaraProperty(name = "showMessage", type = "boolean", defaultValue = "true", flags = Flags.SUMMARY),
|
||||
@NiagaraProperty(name = "path", type = "String", defaultValue = "", flags = Flags.SUMMARY),
|
||||
@NiagaraProperty(name = "fileName", type = "String", defaultValue = "", flags = Flags.SUMMARY)
|
||||
},
|
||||
actions =
|
||||
{
|
||||
@NiagaraAction(name = "update"),
|
||||
@NiagaraAction(name = "setField", parameterType = "BInteger", defaultValue = "BInteger.make(1)")
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
public class BUpdateData extends BComponent {
|
||||
/*+ ------------ BEGIN BAJA AUTO GENERATED CODE ------------ +*/
|
||||
/*@ $com.mjm.solarInsertDB.BUpdateData(2177564192)1.0$ @*/
|
||||
/* Generated Mon Mar 10 19:48:33 CST 2025 by Slot-o-Matic (c) Tridium, Inc. 2012 */
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "DatabaseInformation"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code DatabaseInformation} property.
|
||||
* @see #getDatabaseInformation
|
||||
* @see #setDatabaseInformation
|
||||
*/
|
||||
public static final Property DatabaseInformation = newProperty(Flags.SUMMARY, new BDatabaseInformation(), null);
|
||||
|
||||
/**
|
||||
* Get the {@code DatabaseInformation} property.
|
||||
* @see #DatabaseInformation
|
||||
*/
|
||||
public BDatabaseInformation getDatabaseInformation() { return (BDatabaseInformation)get(DatabaseInformation); }
|
||||
|
||||
/**
|
||||
* Set the {@code DatabaseInformation} property.
|
||||
* @see #DatabaseInformation
|
||||
*/
|
||||
public void setDatabaseInformation(BDatabaseInformation v) { set(DatabaseInformation, v, null); }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "disable"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code disable} property.
|
||||
* @see #getDisable
|
||||
* @see #setDisable
|
||||
*/
|
||||
public static final Property disable = newProperty(Flags.SUMMARY, true, null);
|
||||
|
||||
/**
|
||||
* Get the {@code disable} property.
|
||||
* @see #disable
|
||||
*/
|
||||
public boolean getDisable() { return getBoolean(disable); }
|
||||
|
||||
/**
|
||||
* Set the {@code disable} property.
|
||||
* @see #disable
|
||||
*/
|
||||
public void setDisable(boolean v) { setBoolean(disable, v, null); }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "exception"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code exception} property.
|
||||
* @see #getException
|
||||
* @see #setException
|
||||
*/
|
||||
public static final Property exception = newProperty(Flags.SUMMARY, false, null);
|
||||
|
||||
/**
|
||||
* Get the {@code exception} property.
|
||||
* @see #exception
|
||||
*/
|
||||
public boolean getException() { return getBoolean(exception); }
|
||||
|
||||
/**
|
||||
* Set the {@code exception} property.
|
||||
* @see #exception
|
||||
*/
|
||||
public void setException(boolean v) { setBoolean(exception, v, null); }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "working"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code working} property.
|
||||
* @see #getWorking
|
||||
* @see #setWorking
|
||||
*/
|
||||
public static final Property working = newProperty(Flags.SUMMARY, false, null);
|
||||
|
||||
/**
|
||||
* Get the {@code working} property.
|
||||
* @see #working
|
||||
*/
|
||||
public boolean getWorking() { return getBoolean(working); }
|
||||
|
||||
/**
|
||||
* Set the {@code working} property.
|
||||
* @see #working
|
||||
*/
|
||||
public void setWorking(boolean v) { setBoolean(working, v, null); }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "showMessage"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code showMessage} property.
|
||||
* @see #getShowMessage
|
||||
* @see #setShowMessage
|
||||
*/
|
||||
public static final Property showMessage = newProperty(Flags.SUMMARY, true, null);
|
||||
|
||||
/**
|
||||
* Get the {@code showMessage} property.
|
||||
* @see #showMessage
|
||||
*/
|
||||
public boolean getShowMessage() { return getBoolean(showMessage); }
|
||||
|
||||
/**
|
||||
* Set the {@code showMessage} property.
|
||||
* @see #showMessage
|
||||
*/
|
||||
public void setShowMessage(boolean v) { setBoolean(showMessage, v, null); }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "path"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code path} property.
|
||||
* @see #getPath
|
||||
* @see #setPath
|
||||
*/
|
||||
public static final Property path = newProperty(Flags.SUMMARY, "", null);
|
||||
|
||||
/**
|
||||
* Get the {@code path} property.
|
||||
* @see #path
|
||||
*/
|
||||
public String getPath() { return getString(path); }
|
||||
|
||||
/**
|
||||
* Set the {@code path} property.
|
||||
* @see #path
|
||||
*/
|
||||
public void setPath(String v) { setString(path, v, null); }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Property "fileName"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code fileName} property.
|
||||
* @see #getFileName
|
||||
* @see #setFileName
|
||||
*/
|
||||
public static final Property fileName = newProperty(Flags.SUMMARY, "", null);
|
||||
|
||||
/**
|
||||
* Get the {@code fileName} property.
|
||||
* @see #fileName
|
||||
*/
|
||||
public String getFileName() { return getString(fileName); }
|
||||
|
||||
/**
|
||||
* Set the {@code fileName} property.
|
||||
* @see #fileName
|
||||
*/
|
||||
public void setFileName(String v) { setString(fileName, v, null); }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Action "update"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code update} action.
|
||||
* @see #update()
|
||||
*/
|
||||
public static final Action update = newAction(0, null);
|
||||
|
||||
/**
|
||||
* Invoke the {@code update} action.
|
||||
* @see #update
|
||||
*/
|
||||
public void update() { invoke(update, null, null); }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Action "setField"
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Slot for the {@code setField} action.
|
||||
* @see #setField(BInteger parameter)
|
||||
*/
|
||||
public static final Action setField = newAction(0, BInteger.make(1), null);
|
||||
|
||||
/**
|
||||
* Invoke the {@code setField} action.
|
||||
* @see #setField
|
||||
*/
|
||||
public void setField(BInteger parameter) { invoke(setField, parameter, null); }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Type
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public Type getType() { return TYPE; }
|
||||
public static final Type TYPE = Sys.loadType(BUpdateData.class);
|
||||
|
||||
/*+ ------------ END BAJA AUTO GENERATED CODE -------------- +*/
|
||||
|
||||
|
||||
|
||||
BDatabaseInformation databaseInformation = null;
|
||||
|
||||
public void started() {
|
||||
databaseInformation = (BDatabaseInformation) this.getDatabaseInformation().asComponent();
|
||||
BOrd absolute = BOrd.make("station:|slot:/Services/PlatformServices/SystemService/hostId");
|
||||
String hostID = absolute.get().toString();
|
||||
System.out.println(this.getType().getTypeName() + " --onStarted-- " + hostID);
|
||||
}
|
||||
|
||||
|
||||
public void changed(Property property, Context context) {
|
||||
if (this.isRunning()) {
|
||||
if (property == databaseInformation) {
|
||||
System.out.println("in update data");
|
||||
databaseInformation = (BDatabaseInformation) this.databaseInformation.asComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void doUpdate() {
|
||||
|
||||
System.out.println("0310 doUpdate: ");
|
||||
if (1 == 1) { //if (checkLicense.getLegal())
|
||||
List<String> fieldName = new ArrayList<String>();
|
||||
List<String> fieldValue = new ArrayList<String>();
|
||||
List<String> conditionName = new ArrayList<String>();
|
||||
List<String> conditionValue = new ArrayList<String>();
|
||||
|
||||
if (this.getDisable() || this.getException()) {
|
||||
if (this.getShowMessage()) {
|
||||
System.out.println("disable or exception");
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
this.setWorking(true);
|
||||
Property property[] = this.getDynamicPropertiesArray();
|
||||
|
||||
for (int i = 0; i < property.length; i++) {
|
||||
if (property[i].getName().contains("Field")) {
|
||||
// BFieldUpdate field = (BFieldUpdate) this.get(property[i]).asComponent();
|
||||
// fieldName.add(field.getFieldName());
|
||||
// fieldValue.add(field.getFieldValue());
|
||||
// conditionName.add(field.getConditionName());
|
||||
// conditionValue.add(field.getConditionValue());
|
||||
|
||||
BField field = (BField) this.get(property[i]).asComponent();
|
||||
fieldName.add(field.getFieldName());
|
||||
fieldValue.add(field.getFieldValue());
|
||||
}
|
||||
}
|
||||
|
||||
if (fieldName.size() == fieldValue.size() && conditionName.size() == conditionValue.size()) {
|
||||
if (databaseInformation.getInsertToDatabase()) {
|
||||
// String updateCommand = makeUpdateCommand(fieldName, fieldValue,conditionName,conditionValue);
|
||||
String updateCommand = makeUpdateCommand2(fieldName, fieldValue);
|
||||
// 建立连接
|
||||
ConnectInformation connectInformation = new ConnectInformation();
|
||||
Connection connection = connectInformation.getSQLServerConnection(databaseInformation.getDbIp(), databaseInformation.getDbName(),
|
||||
databaseInformation.getDbUser(), databaseInformation.getDbPassword(), databaseInformation.getDbTableName());
|
||||
System.out.println("------connection info: " + connection);
|
||||
// 创建Statement
|
||||
Statement statement = connection.createStatement();
|
||||
System.out.println("------updateCommand info: " + updateCommand);
|
||||
// 执行查询
|
||||
statement.execute(updateCommand);
|
||||
statement.close();
|
||||
connection.close();
|
||||
}
|
||||
createCSV(fieldName, fieldValue);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
this.setException(true);
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
this.setWorking(false);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.out.println("no license!");
|
||||
BNotification note = new BNotification();
|
||||
note.add("title", BString.make("No License"));
|
||||
note.add("message", BString.make("Please contact FIC"));
|
||||
note.raise(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void doSetField(BInteger interger) {
|
||||
|
||||
int number = interger.getInt();
|
||||
Property property[] = this.getDynamicPropertiesArray();
|
||||
for (int i = 0; i < property.length; i++) {
|
||||
if (property[i].getName().contains("Field")) {
|
||||
this.remove(property[i].getName());
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < number; i++) {
|
||||
this.add("Field" + (i + 1), new BField());
|
||||
}
|
||||
}
|
||||
|
||||
private void createCSV(List<String> fieldName, List<String> fieldValue) {
|
||||
|
||||
SimpleDateFormat sdFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date date = new Date();
|
||||
String strDate = sdFormat.format(date);
|
||||
String outputFile = "../../shared/" + this.getPath() + strDate + this.getFileName();
|
||||
|
||||
// before we open the file check to see if it already exists
|
||||
boolean alreadyExists = new File(outputFile).exists();
|
||||
try {
|
||||
// use FileWriter constructor that specifies open for appending
|
||||
if (!alreadyExists) {
|
||||
deleteFile();
|
||||
if (!this.getPath().equals("")) {
|
||||
File file = new File(outputFile);
|
||||
file.getParentFile().mkdir();
|
||||
try {
|
||||
file.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CsvWriter csvOutput = new CsvWriter(new FileWriter(outputFile, true), ',');
|
||||
// if the file didn't already exist then we need to write out the header line
|
||||
if (!alreadyExists) {
|
||||
for (int i = 0; i < fieldName.size(); i++) {
|
||||
csvOutput.write(fieldName.get(i));
|
||||
}
|
||||
csvOutput.endRecord();
|
||||
}
|
||||
// else assume that the file already has the correct header line
|
||||
// write out a few records
|
||||
|
||||
for (int i = 0; i < fieldValue.size(); i++) {
|
||||
csvOutput.write(fieldValue.get(i));
|
||||
}
|
||||
csvOutput.endRecord();
|
||||
csvOutput.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteFile() {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.add(Calendar.DAY_OF_MONTH, -90);//90天前
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String before90 = format.format(cal.getTime()) + " 00:00:00";
|
||||
System.out.println("delete file before " + before90);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
|
||||
|
||||
try {
|
||||
Date sDate = sdf.parse(before90);
|
||||
long beforeTimestamp = sDate.getTime() / 1000;
|
||||
// System.out.println(beforeTimestamp);
|
||||
String fullpath = "../../shared/" + this.getPath();
|
||||
File a = new File(fullpath);
|
||||
if (a.isDirectory()) {
|
||||
String[] filenames = a.list();
|
||||
for (int i = 0; i < filenames.length; i++) {
|
||||
File tempFile = new File(fullpath + "\\" + filenames[i]);
|
||||
if (tempFile.isDirectory()) {
|
||||
System.out.println("目錄:" + filenames[i]);
|
||||
} else {
|
||||
// System.out.println("檔案:" + filenames[i]);
|
||||
String dateName = filenames[i].split(" ")[0] + " 00:00:00";
|
||||
sDate = sdf.parse(dateName);
|
||||
long fileTimestamp = sDate.getTime() / 1000;
|
||||
if (fileTimestamp < beforeTimestamp) {
|
||||
System.out.println("delete file " + fullpath + filenames[i]);
|
||||
File deleteFile = new File(fullpath + filenames[i]);
|
||||
deleteFile.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.out.println("[" + a + "]不是目錄");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param fieldName 要修改的属性
|
||||
* @param fieldValue 修改后值
|
||||
* @return
|
||||
*/
|
||||
private String makeUpdateCommand2(List<String> fieldName, List<String> fieldValue){
|
||||
String command = "update " + databaseInformation.getDbName() + ".dbo." + databaseInformation.getDbTableName() + " set ";
|
||||
for (int i = 0; i < fieldName.size(); i++) {
|
||||
command = command + fieldName.get(i) +"='"+fieldValue.get(i) +"',";
|
||||
}
|
||||
command = command.substring(0, command.length() -1) + " ;";
|
||||
System.out.println("update command: " + command);
|
||||
return command;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param fieldName 要修改的属性
|
||||
* @param fieldValue 修改后值
|
||||
* @param conditionName wehere属性
|
||||
* @param conditionValue wehere值
|
||||
* @return
|
||||
*/
|
||||
private String makeUpdateCommand(List<String> fieldName, List<String> fieldValue , List<String> conditionName ,List<String> conditionValue){
|
||||
String command = "update " + databaseInformation.getDbName() + ".dbo." + databaseInformation.getDbTableName() + " set ";
|
||||
for (int i = 0; i < fieldName.size(); i++) {
|
||||
command = command + fieldName.get(i) +"='"+fieldValue.get(i) +"',";
|
||||
}
|
||||
command = command.substring(0, command.length() - 1)+" where ";
|
||||
for (int i = 0; i < conditionName.size(); i++) {
|
||||
command = command + conditionName.get(i) +"='"+conditionValue.get(i)+"' and ";
|
||||
}
|
||||
command = command.substring(0, command.length() - 4) + " ;";
|
||||
System.out.println("update command: " + command);
|
||||
return command;
|
||||
}
|
||||
|
||||
public void setDatabaseInformation() {
|
||||
databaseInformation = (BDatabaseInformation) this.getDatabaseInformation().asComponent();
|
||||
}
|
||||
}
|
@ -0,0 +1,189 @@
|
||||
package com.mjm.solarInsertDB;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
/**
|
||||
* Created by user on 2016/12/30.
|
||||
*/
|
||||
public class ConnectInformation {
|
||||
String ip;
|
||||
String database;
|
||||
String table;
|
||||
String user;
|
||||
String password;
|
||||
Connection connection;
|
||||
StringBuffer url = new StringBuffer();
|
||||
// String url;
|
||||
|
||||
public ConnectInformation(String ip, String database, String user, String password,String table) {
|
||||
|
||||
|
||||
this.ip = ip;
|
||||
this.database = database;
|
||||
this.user = user;
|
||||
this.password = password;
|
||||
this.table = table;
|
||||
|
||||
url.append("jdbc:sqlserver://").append(ip).append(":1433/").append(database).append("?useSSL=false&serverTimezone=UTC");
|
||||
// url.append("jdbc:mysql://").append(ip).append(":3306/").append(database).append("?useSSL=false&serverTimezone=UTC");
|
||||
|
||||
// url.append("jdbc:mysql://").append(ip).append('/').append(database).append("?useUnicode=true&characterEncoding=utf-8");
|
||||
jdbc:mysql://localhost:3306/mysql?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||
try {
|
||||
connection = DriverManager.getConnection(url.toString(), user, password);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public ConnectInformation() {
|
||||
}
|
||||
|
||||
public Connection getSQLServerConnection(String ip, String database, String user, String password, String table){
|
||||
this.ip = ip;
|
||||
this.database = database;
|
||||
this.user = user;
|
||||
this.password = password;
|
||||
this.table = table;
|
||||
|
||||
|
||||
url.append("jdbc:sqlserver://").append(ip).append(":1433;databaseName=").append(database);
|
||||
System.out.println("url: "+url.toString());
|
||||
System.out.println("user: "+user);
|
||||
System.out.println("password: "+password);
|
||||
try {
|
||||
connection = DriverManager.getConnection(url.toString(), user, password);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return connection;
|
||||
}
|
||||
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
|
||||
public String getDatabase() {
|
||||
return database;
|
||||
}
|
||||
|
||||
public void setDatabase(String database) {
|
||||
this.database = database;
|
||||
}
|
||||
|
||||
public String getTable() {
|
||||
return table;
|
||||
}
|
||||
|
||||
public void setTable(String table) {
|
||||
this.table = table;
|
||||
}
|
||||
|
||||
public String getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(String user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public Connection getConnection(){
|
||||
return connection;
|
||||
|
||||
}
|
||||
public void checkConnection() {
|
||||
try {
|
||||
if (connection.isClosed() || connection == null) {
|
||||
// Class.forName("com.mysql.cj.jdbc.Driver");
|
||||
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
|
||||
connection = DriverManager.getConnection(url.toString(), this.user, this.password);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
System.out.println("checkConnection: "+e.toString());
|
||||
// e.printStackTrace();
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
//定义加载驱动
|
||||
String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
|
||||
//定义数据库用户
|
||||
String userName = "sa";
|
||||
//定义数据库密码
|
||||
String userPwd = "mjmadmin@99";
|
||||
//定义数据库连接对象
|
||||
Connection dbConn = null;
|
||||
//定义命令对象
|
||||
Statement stmt = null;
|
||||
try {
|
||||
//1.加载及注册驱动
|
||||
Class.forName(driverName);
|
||||
//2.定义数据库连接字符串
|
||||
String dbURL = "jdbc:sqlserver://192.168.0.132:1433;DatabaseName=solar_itri";
|
||||
//3.数据库连接
|
||||
dbConn = DriverManager.getConnection(dbURL, userName, userPwd);
|
||||
System.out.println("asdfsfsdf====");
|
||||
System.out.println("连接数据库成功");
|
||||
//4.定义SQL语句
|
||||
String sql = "insert into data (c0) values(2318);";
|
||||
//5.创建一个执行sql对象
|
||||
// compile 'com.microsoft.sqlserver:mssql-jdbc:8.4.1.jre8'
|
||||
stmt = dbConn.createStatement();
|
||||
//6.执行SQL语句命令
|
||||
// uberjar files('FICLibs/mssql-jdbc-8.4.1.jre8.jar')
|
||||
// ResultSet resultSet = stmt.executeQuery(sql);
|
||||
boolean execute = stmt.execute(sql);
|
||||
//7.处理结果,并获取数据
|
||||
// while (resultSet.next()) {
|
||||
// String userID = resultSet.getString("userID");
|
||||
// String password = resultSet.getString("password");
|
||||
// String name = resultSet.getString("userName");
|
||||
// System.out.println(userID + " " + password + " " + name);
|
||||
// }
|
||||
//8.关闭连接
|
||||
// resultSet.close();
|
||||
dbConn.close();
|
||||
stmt.close();
|
||||
} catch (SQLException e) { //数据库的处理异常的方法
|
||||
e.printStackTrace();
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (dbConn != null) {
|
||||
try {
|
||||
dbConn.close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (stmt != null) {
|
||||
try {
|
||||
stmt.close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package com.mjm.solarInsertDB;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
/**
|
||||
* Created by user on 2016/12/19.
|
||||
*/
|
||||
public class MySQL {
|
||||
ConnectInformation connectInformation;
|
||||
private StringBuffer url = new StringBuffer();
|
||||
|
||||
private Connection con;
|
||||
|
||||
public MySQL(ConnectInformation connectInformation) {
|
||||
|
||||
this.connectInformation = connectInformation;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void insertSQLCommand(String command) throws SQLException {
|
||||
|
||||
connectInformation.checkConnection();
|
||||
|
||||
Statement stmt;
|
||||
|
||||
|
||||
stmt = connectInformation.getConnection().createStatement();
|
||||
|
||||
stmt.execute(command);
|
||||
|
||||
stmt.close();
|
||||
|
||||
connectInformation.getConnection().close();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,125 @@
|
||||
package com.mjm.solarInsertDB;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
|
||||
/**
|
||||
* Created by user on 2017/4/10.
|
||||
*/
|
||||
public class test {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
System.out.println("start");
|
||||
new test().doSendMail();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void doSendMail() {
|
||||
|
||||
// System.out.println("1");
|
||||
// Properties props = new Properties();
|
||||
// props.put("mail.smtp.host", "smtp.gmail.com");
|
||||
// props.put("mail.smtp.auth", "true");
|
||||
// props.put("mail.smtp.starttls.enable", "true");
|
||||
// props.put("mail.smtp.port", 587);
|
||||
// props.put("mail.smtp.ssl.trust", "smtp.gmail.com");
|
||||
// Session session = Session.getInstance(props, new Authenticator() {
|
||||
// protected PasswordAuthentication getPasswordAuthentication() {
|
||||
// return new PasswordAuthentication("ivsserver01@gmail.com", "ficgreen2017");
|
||||
// }
|
||||
// });
|
||||
// System.out.println("2");
|
||||
// try {
|
||||
// Message msg = new MimeMessage(session);
|
||||
//
|
||||
// msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(getSendMailList()));
|
||||
// msg.setSubject("FIC Niagara Mail Test");
|
||||
// System.out.println("3");
|
||||
// //設定本文區的內容
|
||||
// MimeBodyPart mbp1 = new MimeBodyPart();
|
||||
// String s = "Dear Sir,\n\nPlease follow the report in the attachment, thanks!\n\nThis message is automatically sent, please do not reply directly!";
|
||||
//
|
||||
// mbp1.setContent(s, "text/plain;charset=big5");
|
||||
// //設定附加檔
|
||||
// MimeBodyPart mbp2 = new MimeBodyPart();
|
||||
// FileDataSource fds = new FileDataSource("C:/ProgramData/Niagara4.2/vykon/shared/0071801/2017-04-17 inverter.csv");
|
||||
// mbp2.setDataHandler(new DataHandler(fds));
|
||||
// mbp2.setFileName("report.csv"); //附加檔在mail接收時,出現的檔案名稱
|
||||
// Multipart mp = new MimeMultipart();//把所有MimeBodyPart加進Multipart,所以如果有第二個附加檔,應該要有另一MultiBodyPart
|
||||
// mp.addBodyPart(mbp1);
|
||||
//
|
||||
// msg.setContent(mp);
|
||||
// System.out.println("4");
|
||||
// Transport.send(msg);
|
||||
// System.out.println("send mail success!");
|
||||
// System.out.println("5");
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
//
|
||||
|
||||
}
|
||||
|
||||
private String getSendMailList() {
|
||||
String list = "jeremy_chang@fic.com.tw";
|
||||
|
||||
|
||||
return list;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void run() {
|
||||
|
||||
Calendar cal = Calendar.getInstance();//使用預設時區和語言環境獲得一個日曆。
|
||||
cal.add(Calendar.DAY_OF_MONTH, -90);//取當前日期的前一天.
|
||||
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
System.out.println("Today is:" + format.format(cal.getTime()));
|
||||
|
||||
String before90 = format.format(cal.getTime()) + " 00:00:00";
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
|
||||
|
||||
|
||||
try {
|
||||
Date sDate = sdf.parse(before90);
|
||||
|
||||
System.out.println(sDate.getTime() / 1000);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
File a = new File("C:\\ProgramData\\Niagara4.2\\vykon\\shared\\0071801");
|
||||
|
||||
String fullpath = a.getAbsolutePath();
|
||||
|
||||
if (a.isDirectory()) {
|
||||
String[] filenames = a.list();
|
||||
for (int i = 0; i < filenames.length; i++) {
|
||||
File tempFile = new File(fullpath + "\\" + filenames[i]);
|
||||
if (tempFile.isDirectory()) {
|
||||
System.out.println("目錄:" + filenames[i]);
|
||||
} else {
|
||||
System.out.println("檔案:" + filenames[i]);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.out.println("[" + a + "]不是目錄");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
BIN
solarInsertDB/solarInsertDB-rt/tsmclibs/javacsv.jar
Normal file
BIN
solarInsertDB/solarInsertDB-rt/tsmclibs/javacsv.jar
Normal file
Binary file not shown.
BIN
solarInsertDB/solarInsertDB-rt/tsmclibs/mail-1.5.0-b01.jar
Normal file
BIN
solarInsertDB/solarInsertDB-rt/tsmclibs/mail-1.5.0-b01.jar
Normal file
Binary file not shown.
9
vendor.gradle
Normal file
9
vendor.gradle
Normal file
@ -0,0 +1,9 @@
|
||||
/*
|
||||
* Copyright 2025 MJM, All Rights Reserved.
|
||||
*/
|
||||
/* Vendor Configuration File */
|
||||
group = 'MJM'
|
||||
|
||||
def moduleVersion = '1.0'
|
||||
def moduleVersionPatch = [:]
|
||||
version = "${moduleVersion}${moduleVersionPatch.get(project.name, '')}"
|
Loading…
Reference in New Issue
Block a user