From 60a3f2bc64b7a5f502e4133ced31f0b25c88d3f1 Mon Sep 17 00:00:00 2001
From: Hunter0x7c7 <1125607007@qq.com>
Date: 星期四, 12 九月 2024 14:57:03 +0800
Subject: [PATCH] 版本v1.0.2(3)发布。
---
src/main/resources/forxml/sample.fxml | 14 +-
src/main/java/com/github/hunter0x7c7/sync/model/global/Parameters.java | 6
src/main/java/com/github/hunter0x7c7/sync/Main.java | 14 ++
readme.md | 26 ++++
pom.xml | 26 ++--
src/main/java/com/github/hunter0x7c7/sync/ctrls/Controller.java | 214 ++++++++++++++++++++++++-----------
src/main/java/com/github/hunter0x7c7/sync/utils/TrayUtil.java | 18 ++-
7 files changed, 220 insertions(+), 98 deletions(-)
diff --git a/pom.xml b/pom.xml
index 492ed3b..1459e00 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
<groupId>com.github.hunter0x7c7</groupId>
<artifactId>SyncTools</artifactId>
- <version>1.0.1.RELEASE</version>
+ <version>1.0.2.RELEASE</version>
<packaging>war</packaging>
<name>SyncTools</name>
@@ -56,7 +56,7 @@
</repositories>
- <!--灏嗛」鐩墦鍖呮垚exe瀹夎鍖�-->
+ <!--灏嗛」鐩墦鍖呮垚exe瀹夎鍖� mvn package-->
<build>
<plugins>
<plugin>
@@ -80,8 +80,8 @@
<!-- 绮剧畝鐗坖re -->
<bundleJre>true</bundleJre>
<!-- 缁戝畾鑷畾涔塉RE璺緞 -->
- <!--<jrePath>D:\Develop\Java\jdk-9.0.1\jre</jrePath>-->
- <jrePath>/Library/Java/JavaVirtualMachines/jre-9.0.1.jre/Contents/Home</jrePath>
+ <jrePath>D:\Develop\Java\jdk-9.0.1\jre</jrePath>
+ <!--<jrePath>/Library/Java/JavaVirtualMachines/jre-9.0.1.jre/Contents/Home</jrePath>-->
<!-- 鐢熸垚瀹夎鍖� -->
<generateInstaller>false</generateInstaller>
<!-- 涓嶄娇鐢ㄧ鐞嗗憳韬唤鎵撳紑绋嬪簭 -->
@@ -89,11 +89,11 @@
<!-- 灏嗘寚瀹氭枃浠跺す鍖呭惈鍒扮敓鎴愮殑绋嬪簭璺緞 -->
<!-- 鎵嬪姩寮曞叆棰濆璧勬簮-->
<additionalResources>
- <!--<additionalResource>F:\workspace_java\JavaFx\SyncTools\libs</additionalResource>-->
- <additionalResource>/Users/hunter/workspace/JavaFx/SyncTools/lib</additionalResource>
+ <additionalResource>F:\workspace_java\JavaFx\SyncTools\libs</additionalResource>
+ <!--<additionalResource>/Users/hunter/workspace/JavaFx/SyncTools/lib</additionalResource>-->
</additionalResources>
<!-- 褰撳墠鎵撳寘鐨勫钩鍙� -->
- <platform>mac</platform>
+ <platform>windows</platform>
<name>SyncTools</name>
<!-- exe 鍚嶇О锛岄�氳繃寮曠敤鐨勬柟寮� -->
<displayName>${project.name}</displayName>
@@ -103,16 +103,16 @@
<vmArg>-Dfile.encoding=GBK</vmArg><!-- 瑙e喅鎵撳寘涔嬪悗鎵樼洏涔辩爜 -->
</vmArgs>
<!-- 鐗瑰畾骞冲彴鍙傛暟 -->
- <!--<winConfig>
+ <winConfig>
<icoFile>
F:\workspace_java\JavaFx\SyncTools\src\main\deploy\package\windows\SyncTools.ico
</icoFile>
<generateSetup>false</generateSetup>
<generateMsi>false</generateMsi>
<generateMsm>false</generateMsm>
- </winConfig>-->
+ </winConfig>
<!--<linuxConfig></linuxConfig>-->
- <macConfig>
+ <!--<macConfig>
<appId>com.github.hunter0x7c7.SyncTools</appId>
<icnsFile>
/Users/hunter/workspace/JavaFx/SyncTools/src/main/deploy/package/mac/SyncTools.icns
@@ -120,7 +120,7 @@
<generateDmg>false</generateDmg>
<generatePkg>false</generatePkg>
<relocateJar>false</relocateJar>
- </macConfig>
+ </macConfig>-->
</configuration>
</execution>
</executions>
@@ -140,8 +140,8 @@
<configuration>
<verbose>true</verbose>
<fork>true</fork>
- <!--<executable>D:\Develop\Java\jdk-9.0.1\bin\javac</executable>-->
- <executable>/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home/bin/javac</executable>
+ <executable>D:\Develop\Java\jdk-9.0.1\bin\javac</executable>
+ <!--<executable>/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home/bin/javac</executable>-->
</configuration>
</plugin>
</plugins>
diff --git a/readme.md b/readme.md
index 9d3c4c8..ae7c91e 100644
--- a/readme.md
+++ b/readme.md
@@ -3,7 +3,9 @@
鏍规嵁鐩爣鏁版嵁搴撲腑鐨勪紶鎰熷櫒鏁版嵁鍒楄〃锛屽埌鎬昏〃涓煡鎵炬渶鏂扮殑鏁版嵁鍊�
- 灏唅dea涓殑JavaFX椤圭洰鎵撳寘鎴愬彲鎵ц鐨別xe搴旂敤
-https://blog.csdn.net/qq_29428909/article/details/122103131
+ https://blog.csdn.net/qq_29428909/article/details/122103131
+ 鎵цmaven鎸囦护鎵撳寘锛歚``mvn package```
+
- JavaFx 鑷畾涔夌郴缁熸墭鐩�
https://www.jianshu.com/p/6058e7a48f0b
@@ -19,3 +21,25 @@
## 瑙e喅绯荤粺鎵樼洏涔辩爜闂
1. 杩愯涔辩爜锛孯un->Edit Configurations->Modify options->Add VM options->杈撳叆鈥�-Dfile.encoding=GBK鈥�
2. 鎵撳寘涔辩爜锛孞avaPackager鎵撳寘涔辩爜锛屾墦寮�pom.xml鏂囦欢锛屽湪<vmArgs>鏍囩涓彃鍏ヤ竴琛�<vmArg>-Dfile.encoding=GBK</vmArg>
+
+
+## Release Logs
+
+ + Tag v1.0.2
+ - 20230921
+ - 浼樺寲鏈�灏忓寲鍜屾仮澶嶆樉绀哄姛鑳斤紱
+ - 澧炲姞浜嗗涓紶鎰熷櫒绫诲瀷鐨勭綉鍏筹紱
+ - 瑙e喅浜嗘鍦ㄥ悓姝ユ椂浠庤彍鍗曟爮閫�鍑哄け璐ョ殑闂銆�
+
+ + Tag v1.0.1
+ - 20230818
+ - 浼樺寲鎵撳寘鍚庣郴缁熸墭鐩樹腑鏂囦贡鐮佺殑闂銆�
+
+ + Tag v1.0.0
+ - 20230804
+ - 瀹炵幇浜嗗畾鏃跺悓姝ュ姛鑳斤紱
+ - 鏀寔璁剧疆鍚屾鏃堕棿鐨勫崟浣嶏紱
+ - 鏀寔璁剧疆鏄惁鍚姩鍗冲紑鍚悓姝ュ姛鑳斤紱
+ - 鏀寔淇濆瓨閰嶇疆淇℃伅鍒板悓鐩綍锛�
+ - 閰嶇疆淇℃伅涓殑瀵嗙爜鍔犲瘑鍚庡啀淇濆瓨锛�
+ - 鍙煡鎵綳PH鐗╄仈缃戝叧銆�
diff --git a/src/main/java/com/github/hunter0x7c7/sync/Main.java b/src/main/java/com/github/hunter0x7c7/sync/Main.java
index 760b192..b409592 100644
--- a/src/main/java/com/github/hunter0x7c7/sync/Main.java
+++ b/src/main/java/com/github/hunter0x7c7/sync/Main.java
@@ -12,6 +12,20 @@
public class Main extends Application {
+ /* {
+ "sh": "db.tyuniot.com:20235",
+ "sn": "sa",
+ "sp": "uQo/ij8nAbTmhCv/BKAMxQ\u003d\u003d",
+ "sdn": "TY_SPDB",
+ "th": "220.203.22.91:1466",
+ "tn": "sa",
+ "tp": "UpVahnS5ZlI/uNaNUNdmuQ\u003d\u003d",
+ "tdn": "proj_hbzgfy",
+ "fv": "10",
+ "fu": 2,
+ "ss": true
+} */
+
@Override
public void start(Stage stage) throws Exception {
Session.getInstance().setPrimaryStage(stage);
diff --git a/src/main/java/com/github/hunter0x7c7/sync/ctrls/Controller.java b/src/main/java/com/github/hunter0x7c7/sync/ctrls/Controller.java
index d3eb8d5..c2d1428 100644
--- a/src/main/java/com/github/hunter0x7c7/sync/ctrls/Controller.java
+++ b/src/main/java/com/github/hunter0x7c7/sync/ctrls/Controller.java
@@ -16,6 +16,8 @@
import io.reactivex.functions.Predicate;
import io.reactivex.schedulers.Schedulers;
import javafx.application.Platform;
+import javafx.beans.value.ChangeListener;
+import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
@@ -48,21 +50,37 @@
import static com.github.hunter0x7c7.sync.model.global.Parameters.*;
public class Controller {
- public static final String SQL1_QUERY = "SELECT * FROM IOT_Equipment_Info WHERE IE_Type = 'XPH鐗╄仈缃戝叧'; ";
- public static final String SQL2_QUERY = "SELECT SD_Addr + '|' + SD_Code IE_Param, * " +
- "FROM TY_SensorData WHERE SD_Key IN ( '%s' );";
- public static final String SQL3_UPDATE = "UPDATE IOT_Equipment_Info " +
+ //1. 鍦ㄧ洰鏍囧簱锛屾妸閲囬泦绫荤綉鍏宠澶囧厛鎵惧嚭鏉�
+ public static final String SQL_QUERY_TARGET = "SELECT * " +
+ "FROM IOT_Equipment_Info " +
+ "WHERE IE_Type = '鐗╄仈缃戝叧' " +
+ "OR IE_Type = 'XPH缃戝叧' " +
+ "OR IE_Type = 'XPH鐗╄仈缃戝叧' " +
+ "OR IE_Type = '姘旇薄绔欑綉鍏�' " +
+ "OR IE_Type = '閲囬泦鐗╄仈缃戝叧' " +//娓╁閲囬泦鏈烘煖
+ "OR IE_Type = '铏儏鐩戞祴缃戝叧' " +
+ "OR IE_Type = '澧掓儏缃戝叧' " +
+ "OR IE_Type = '杩滀紶姘磋〃'; ";
+
+ //2. 鍦ㄦ簮鏁版嵁搴擄紝鎶婄浉鍏崇綉鍏宠澶囩殑瀛愯鏌ユ壘鍑烘潵锛屾嫾鎺ュソParam鍙傛暟00|01
+ public static final String SQL_QUERY_SRC = "SELECT SD_Addr + '|' + SD_Code IE_Param, * " +
+ "FROM TY_SensorData " +
+ "WHERE SD_Key IN ( '%s' ); ";
+ //3. 鍦ㄧ洰鏍囧簱锛屾妸鍖归厤鐨勬渶鏂版暟鎹洿鏂板埌鐩稿叧鐨勮涓�
+ public static final String SQL_UPDATE_TARGET = "UPDATE IOT_Equipment_Info " +
"SET IE_Realtime_Data = ?, IE_Realtime_Time = ?, Edit_User = ?, Edit_Time = ? " +
- "WHERE IE_Param = ? AND IE_Parent = ( " +
- "SELECT IE_ID FROM IOT_Equipment_Info WHERE IE_Param = ? " +
- ") ;";
+ "WHERE IE_Param = ? " +
+ "AND IE_Parent IN ( " +
+ "SELECT IE_ID " +
+ "FROM IOT_Equipment_Info " +
+ "WHERE IE_Param = ? ) ;";
@FXML
private TextField tvInputSrcHost;
@FXML
private TextField tvInputSrcName;
@FXML
- private PasswordField tvInputSrcPwd;
+ private TextField tvInputSrcPwd;
@FXML
private TextField tvInputSrcDbName;
@@ -71,7 +89,7 @@
@FXML
private TextField tvInputTargetName;
@FXML
- private PasswordField tvInputTargetPwd;
+ private TextField tvInputTargetPwd;
@FXML
private TextField tvInputTargetDbName;
@FXML
@@ -100,7 +118,12 @@
private CompositeDisposable mCompositeDisposable;
//鍚屾棰戠巼鍗曚綅鍒楄〃
- private static final TimeUnit[] mFreqUnitList = {TimeUnit.MILLISECONDS, TimeUnit.SECONDS, TimeUnit.MINUTES, TimeUnit.HOURS, TimeUnit.DAYS};
+ private static final TimeUnit[] mFreqUnitList = {
+ TimeUnit.MILLISECONDS,
+ TimeUnit.SECONDS,
+ TimeUnit.MINUTES,
+ TimeUnit.HOURS,
+ TimeUnit.DAYS};
//鍚屾棰戠巼鍗曚綅鍚嶇О鍒楄〃
private static final String[] mFreqNameList = {"姣", "绉�", "鍒嗛挓", "灏忔椂", "澶�"};
//鍚屾娆℃暟
@@ -186,7 +209,13 @@
show.addActionListener(actionListener -> {
Platform.runLater(() -> {
if (primaryStage != null) {
- primaryStage.show();
+ if (primaryStage.isIconified()) {//鏈�灏忓寲
+ primaryStage.setIconified(false);
+ }
+ if (!primaryStage.isShowing()) {
+ primaryStage.show();
+ }
+ primaryStage.toFront();
}
});
});
@@ -200,6 +229,21 @@
};
//娣诲姞鍒扮郴缁熸墭鐩�
TrayUtil.getInstance().addSystemTray(primaryStage, AppName_zh_rCN, mipmap, callback, show);
+
+ //鏈�灏忓寲涔嬪悗锛屽叧闂獥鍙�
+ primaryStage.iconifiedProperty().addListener(new ChangeListener<Boolean>() {
+ @Override
+ public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
+ //濡傛灉浣犳墽琛屼簡setIconified(true)涔嬪悗鍐嶆墽琛宧ide(),
+ // stage浼氳閿�姣�,鍥犳闇�瑕佸湪绐楀彛鍏抽棴鍓嶅皢Iconified璁句负false
+ if (!oldValue && newValue) {
+ //鏈�灏忓寲涔嬪悗锛屽叧闂獥鍙�
+ if (primaryStage != null) {
+ primaryStage.close();
+ }
+ }
+ }
+ });
}
}).concatMap(new Function<Object, Observable<ConfigBean>>() {//鍑嗗鍒濆鍖栫殑閰嶇疆鏁版嵁
@Override
@@ -217,6 +261,9 @@
}).map(new Function<Boolean, ConfigBean>() {
@Override
public ConfigBean apply(Boolean aBoolean) throws Exception {
+ assert configBean != null;
+ configBean.setSrcPwd(getDecryptData(configBean.getSrcPwd()));
+ configBean.setTargetPwd(getDecryptData(configBean.getTargetPwd()));
return configBean;
}
}).switchIfEmpty(new Observable<ConfigBean>() {
@@ -270,11 +317,11 @@
//鏇存柊鐣岄潰鏁版嵁
setInputText(tvInputSrcHost, cb.getSrcHost());
setInputText(tvInputSrcName, cb.getSrcName());
- setInputText(tvInputSrcPwd, getDecryptData(cb.getSrcPwd()));
+ setInputText(tvInputSrcPwd, cb.getSrcPwd());
setInputText(tvInputSrcDbName, cb.getSrcDbName());
setInputText(tvInputTargetHost, cb.getTargetHost());
setInputText(tvInputTargetName, cb.getTargetName());
- setInputText(tvInputTargetPwd, getDecryptData(cb.getTargetPwd()));
+ setInputText(tvInputTargetPwd, cb.getTargetPwd());
setInputText(tvInputTargetDbName, cb.getTargetDbName());
setInputText(tvInputFreq, cb.getFreqValue());
cbSelectFreqUnit.getSelectionModel().select(cb.getFreqUnit());
@@ -372,42 +419,54 @@
//鐐瑰嚮锛氶��鍑�
private void clickExit() {
- addSubscribe(Observable.just(true)
+ Disposable d = Observable.just(true)
.subscribeOn(Schedulers.newThread())
.observeOn(Schedulers.io())
.doOnNext(new Consumer<Object>() {
@Override
public void accept(Object o) throws Exception {
+ //1. 鍋滄鍚屾
if (isSyncing()) {
stopSync();//鍋滄鍚屾
}
}
})
- .doOnNext(new Consumer<Object>() {
+ .concatMap(new Function<Object, ObservableSource<Object>>() {
@Override
- public void accept(Object o) throws Exception {
-
- //妫�鏌ョ郴缁熸槸鍚︽敮鎸佹墭鐩�
- if (SystemTray.isSupported()) {
- //绯荤粺鎵樼洏
- SystemTray tray = SystemTray.getSystemTray();
- if (tray != null) {
- TrayIcon[] icons = tray.getTrayIcons();
- for (TrayIcon icon : icons) {
- if (icon == null) continue;
+ public ObservableSource<Object> apply(Object o) throws Exception {
+ //2. 绉婚櫎绯荤粺鎵樼洏
+ return Observable.create(new ObservableOnSubscribe<Object>() {
+ @Override
+ public void subscribe(ObservableEmitter<Object> emitter) throws Exception {
+ //妫�鏌ョ郴缁熸槸鍚︽敮鎸佹墭鐩�
+ if (SystemTray.isSupported()) {
//閫�鍑轰箣鍓嶅厛绉婚櫎绯荤粺鎵樼洏鍥炬爣
- if (APPID.equals(icon.getActionCommand())) {
- tray.remove(icon);
- }
+ final SystemTray tray = SystemTray.getSystemTray();//绯荤粺鎵樼洏
+ final TrayIcon icon = getTrayIcon(tray, APPID);
+ Platform.runLater(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ //绉婚櫎绯荤粺鎵樼洏
+ tray.remove(icon);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ if (emitter != null) {
+ emitter.onNext(o);
+ emitter.onComplete();
+ }
+ }
+ });
}
}
- }
+ });
}
})
- .subscribe(new Consumer<Boolean>() {
+ .subscribe(new Consumer<Object>() {
@Override
- public void accept(Boolean aBoolean) throws Exception {
-
+ public void accept(Object o) throws Exception {
+ //3. 鍋滄鍚屾鍜岀Щ闄ょ郴缁熸墭鐩樺悗锛岄��鍑虹▼搴�
TrayUtil.getInstance().exitApp();//閫�鍑�
}
}, new Consumer<Throwable>() {
@@ -417,7 +476,7 @@
TrayUtil.getInstance().exitApp();//閫�鍑�
}
- }));
+ });
}
@@ -495,11 +554,21 @@
//鐐瑰嚮锛氬仠姝㈠悓姝�
private void clickStopSync() {
- if (isSyncing()) {
- stopSync();//鍋滄鍚屾
- } else {
- updateResult("鏈惎鍔ㄥ悓姝ュ姛鑳斤紒");
+ stopSync();//鍋滄鍚屾
+ }
+
+ public TrayIcon getTrayIcon(SystemTray tray, String key) {
+ if (tray != null && key != null) {
+ TrayIcon[] icons = tray.getTrayIcons();
+ for (TrayIcon icon : icons) {
+ if (icon == null) continue;
+ //鎵惧埌鎸囧畾鐨勬墭鐩樺浘鏍�
+ if (key.equals(icon.getActionCommand())) {
+ return icon;
+ }
+ }
}
+ return null;
}
//瑙e瘑
@@ -745,7 +814,10 @@
//鍚姩鍚屾鍔熻兘
private void startSync() {
mSyncCount = 0;
+ setInputText(txSyncStatus, "鍚姩涓�");
setInputText(txSyncCount, String.valueOf(mSyncCount));
+ setInputText(txStartSyncTime, "-");
+ setInputText(txLastSyncTime, "-");
final String srcHost = getInputText(tvInputSrcHost);
final String srcName = getInputText(tvInputSrcName);
@@ -800,14 +872,18 @@
.doOnNext(new Consumer<Object>() {
@Override
public void accept(Object o) throws Exception {
- //UI绾跨▼
+ setInputText(txStartSyncTime, DateUtils.formatDate(new Date()));
updateResult("杩炴帴涓�...");
+ btnStartSync.setDisable(true);
+ btnStopSync.setDisable(false);
}
})
.observeOn(Schedulers.newThread())
.concatMap(new Function<String, ObservableSource<String>>() {
@Override
public ObservableSource<String> apply(String targetFreq) throws Exception {
+ mSyncCount = 0;
+ setSyncing(true);
return getStartSyncObservable(srcHost, srcName, srcPwd, srcDbName, targetHost, targetName, targetPwd, targetDbName)
.map(new Function<String, String>() {
@Override
@@ -821,20 +897,18 @@
@Override
public void accept(Object o) throws Exception {
//鍚姩鎴愬姛
- setSyncing(true);
- mSyncCount++;
- if (mSyncCount >= Integer.MAX_VALUE) {
- mSyncCount = 0;
+ if (isSyncing()) {
+ mSyncCount++;
+ if (mSyncCount >= Integer.MAX_VALUE) {
+ mSyncCount = 0;
+ }
+ setInputText(txLastSyncTime, DateUtils.formatDate(new Date()));
+ setInputText(txSyncCount, String.valueOf(mSyncCount));
+ setInputText(txSyncStatus, "鍚屾涓�");
+ updateResult("鍚姩鎴愬姛锛�");
+ btnStartSync.setDisable(true);
+ btnStopSync.setDisable(false);
}
- setInputText(txLastSyncTime, DateUtils.formatDate(new Date()));
- setInputText(txSyncCount, String.valueOf(mSyncCount));
-
- btnStartSync.setDisable(true);
- btnStopSync.setDisable(false);
-
- setInputText(txSyncStatus, "鍚屾涓�");
- setInputText(txStartSyncTime, DateUtils.formatDate(new Date()));
- updateResult("鍚姩鎴愬姛锛�");
}
})
.map(new Function<String, Integer>() {
@@ -866,14 +940,17 @@
@Override
public void accept(Object o) throws Exception {
//鍚屾鎴愬姛锛�
- setSyncing(true);
- mSyncCount++;
- if (mSyncCount >= Integer.MAX_VALUE) {
- mSyncCount = 0;
+ if (isSyncing()) {
+ mSyncCount++;
+ if (mSyncCount >= Integer.MAX_VALUE) {
+ mSyncCount = 0;
+ }
+ setInputText(txLastSyncTime, DateUtils.formatDate(new Date()));
+ setInputText(txSyncCount, String.valueOf(mSyncCount));
+ updateResult("鍚屾鎴愬姛锛�");
+ btnStartSync.setDisable(true);
+ btnStopSync.setDisable(false);
}
- setInputText(txLastSyncTime, DateUtils.formatDate(new Date()));
- setInputText(txSyncCount, String.valueOf(mSyncCount));
- updateResult("鍚屾鎴愬姛锛�");
}
}, new Consumer<Throwable>() {
@Override
@@ -910,16 +987,16 @@
//鍋滄鍚屾
private void stopSync() {
+ setSyncing(false);
+ mSyncCount = 0;
if (mCompositeDisposable != null) {
- mCompositeDisposable.clear();
+ mCompositeDisposable.clear();//娉ㄦ剰锛氫細鎶婃墍鏈夋搷浣滈兘鍙栨秷
}
+ setInputText(txSyncStatus, "宸插仠姝�");
+ updateResult("鍚屾鍋滄锛�");
btnStartSync.setDisable(false);
btnStopSync.setDisable(true);
-
- setSyncing(false);
- setInputText(txSyncStatus, "宸插仠姝�");
- updateResult("鍋滄鎴愬姛锛�");
}
//淇濆瓨 鍦ㄥ惎鍔ㄦ椂鈥濆惎鍔ㄢ�滃悓姝ュ姛鑳�
@@ -975,7 +1052,8 @@
.doOnNext(new Consumer<Object>() {
@Override
public void accept(Object o) throws Exception {
- String targetUrl = "jdbc:sqlserver://" + targetHost + ";databaseName=" + targetDbName + ";integratedSecurity=false;";
+ String urlString = "jdbc:sqlserver://%s;databaseName=%s;integratedSecurity=false;";
+ String targetUrl = String.format(urlString, targetHost, targetDbName);
List<String> keyList = new ArrayList<>();
//1.浠庣洰鏍囧簱鏌ュ嚭鏉ユ湁澶氬皯浼犳劅鍣ㄩ渶瑕佹煡鎵�
@@ -983,7 +1061,7 @@
Statement stmt = con.createStatement()
) {
- ResultSet rs = stmt.executeQuery(SQL1_QUERY);
+ ResultSet rs = stmt.executeQuery(SQL_QUERY_TARGET);
while (rs.next()) {
keyList.add(rs.getString("IE_Param"));
}
@@ -1000,9 +1078,9 @@
for (String key : keyList) {
StringUtil.append(sb, key, "','");
}
- String sql = String.format(SQL2_QUERY, sb);
+ String sql = String.format(SQL_QUERY_SRC, sb);
- String srcUrl = "jdbc:sqlserver://" + srcHost + ";databaseName=" + srcDbName + ";integratedSecurity=false;";
+ String srcUrl = String.format(urlString, srcHost, srcDbName);
//System.out.println("sql2:" + sql);
Map<String, List<TargetBean>> map = new HashMap<>();
@@ -1052,7 +1130,7 @@
for (TargetBean tb : list) {
if (tb == null) continue;
- PreparedStatement ps = con3.prepareStatement(SQL3_UPDATE);
+ PreparedStatement ps = con3.prepareStatement(SQL_UPDATE_TARGET);
ps.setString(1, tb.getData());
ps.setTimestamp(2, tb.getTime());
ps.setString(3, version);
diff --git a/src/main/java/com/github/hunter0x7c7/sync/model/global/Parameters.java b/src/main/java/com/github/hunter0x7c7/sync/model/global/Parameters.java
index 0169d49..be61b76 100644
--- a/src/main/java/com/github/hunter0x7c7/sync/model/global/Parameters.java
+++ b/src/main/java/com/github/hunter0x7c7/sync/model/global/Parameters.java
@@ -5,9 +5,9 @@
//鍙傛暟璁剧疆
public class Parameters {
- public static final int VersionCode = 2;
- public static final String VersionName = "1.0.1";
- public static final String BuildDate = "230818";
+ public static final int VersionCode = 3;
+ public static final String VersionName = "1.0.2";
+ public static final String BuildDate = "230921";
public static final BuildTypeEnum BuildType = BuildTypeEnum.RELEASE;
diff --git a/src/main/java/com/github/hunter0x7c7/sync/utils/TrayUtil.java b/src/main/java/com/github/hunter0x7c7/sync/utils/TrayUtil.java
index 50f3170..3e40968 100644
--- a/src/main/java/com/github/hunter0x7c7/sync/utils/TrayUtil.java
+++ b/src/main/java/com/github/hunter0x7c7/sync/utils/TrayUtil.java
@@ -8,6 +8,7 @@
import javax.swing.*;
import java.awt.*;
+import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import static com.github.hunter0x7c7.sync.model.global.Parameters.APPID;
@@ -60,26 +61,31 @@
Image img = imageIcon.getImage();
- TrayIcon trayIcon = new TrayIcon(img, tooltip, popup);
- //璁剧疆鍥炬爣灏哄鑷姩閫傚簲
- //trayIcon.setImageAutoSize(true);
+ final TrayIcon trayIcon = new TrayIcon(img, tooltip, popup);
+ //trayIcon.setImageAutoSize(true);//璁剧疆鍥炬爣灏哄鑷姩閫傚簲
trayIcon.setActionCommand(APPID);
trayIcon.addActionListener(new ActionListener() {
@Override
- public void actionPerformed(java.awt.event.ActionEvent e) {
+ public void actionPerformed(ActionEvent e) {
//榧犳爣鍙屽嚮绯荤粺鎵樼洏鍥炬爣
Platform.runLater(new Runnable() {
@Override
public void run() {
if (stage != null) {
- stage.show();
+ if (stage.isIconified()) {//鏈�灏忓寲
+ stage.setIconified(false);
+ }
+ if (!stage.isShowing()) {
+ stage.show();
+ }
+ stage.toFront();
}
}
});
}
});
//绯荤粺鎵樼洏
- SystemTray tray = SystemTray.getSystemTray();
+ final SystemTray tray = SystemTray.getSystemTray();
Platform.runLater(new Runnable() {
@Override
public void run() {
diff --git a/src/main/resources/forxml/sample.fxml b/src/main/resources/forxml/sample.fxml
index e39834a..a4b66f6 100644
--- a/src/main/resources/forxml/sample.fxml
+++ b/src/main/resources/forxml/sample.fxml
@@ -221,7 +221,7 @@
</font>
</Text>
<Text fill="#000000b3" layoutX="27.0" layoutY="118.0" strokeType="OUTSIDE"
- strokeWidth="0.0" text="寮�濮嬪悓姝ユ椂闂�">
+ strokeWidth="0.0" text="鍚姩鍚屾鏃堕棿">
<font>
<Font size="16.0"/>
</font>
@@ -266,9 +266,9 @@
<Font size="16.0"/>
</font>
</Text>
- <Button fx:id="btnSaveConfig" layoutX="44.0" layoutY="37.0" mnemonicParsing="false"
- onAction="#onClickSaveConfig" prefHeight="34.0" prefWidth="200.0"
- text="淇濆瓨閰嶇疆"/>
+ <Button fx:id="btnSaveConfig" cancelButton="true" layoutX="44.0" layoutY="37.0"
+ mnemonicParsing="false" onAction="#onClickSaveConfig" prefHeight="34.0"
+ prefWidth="200.0" text="淇濆瓨閰嶇疆"/>
<Button fx:id="btnStartSync" defaultButton="true" layoutX="44.0" layoutY="78.0"
mnemonicParsing="false" onAction="#onClickStartSync" prefHeight="62.0"
prefWidth="122.0" text="鍚姩">
@@ -276,9 +276,9 @@
<Font size="18.0"/>
</font>
</Button>
- <Button fx:id="btnStopSync" disable="true" layoutX="172.0" layoutY="78.0"
- mnemonicParsing="false" onAction="#onClickStopSync" prefHeight="62.0"
- prefWidth="72.0" text="鍋滄"/>
+ <Button fx:id="btnStopSync" cancelButton="true" disable="true" layoutX="172.0"
+ layoutY="78.0" mnemonicParsing="false" onAction="#onClickStopSync"
+ prefHeight="62.0" prefWidth="72.0" text="鍋滄"/>
</children>
</Pane>
</children>
--
Gitblit v1.9.1