Skip to content

Commit 4ab0f86

Browse files
committed
merge v4.4.14.0-gcc13a9359 into opensource digirunner repo
1 parent 000e96f commit 4ab0f86

File tree

129 files changed

+2019
-2503
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+2019
-2503
lines changed
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
arguments=
2+
auto.sync=false
3+
build.scans.enabled=false
4+
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
5+
connection.project.dir=
6+
eclipse.preferences.version=1
7+
gradle.user.home=
8+
java.home=
9+
jvm.arguments=
10+
offline.mode=false
11+
override.workspace.settings=false
12+
show.console.view=false
13+
show.executions.view=false

Dockerfile

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
FROM azul/zulu-openjdk-alpine:17
1+
FROM azul/zulu-openjdk-alpine:21-jre-headless-latest
22

3-
RUN apk add --no-cache curl
3+
RUN set -eux; \
4+
apk update; \
5+
apk upgrade; \
6+
apk add --no-cache curl; \
7+
mkdir -p /app; \
8+
rm -rf /var/cache/apk/*;
49

510
COPY ./dgrv4_Gateway_serv/build/libs/* /opt/digirunner/
611
COPY ./dgrv4_Gateway_serv/keys/* /opt/digirunner/keys/

build.gradle

+15-13
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ buildscript {
1010
}
1111

1212
plugins {
13-
id 'org.springframework.boot' version '3.4.0'
13+
id 'org.springframework.boot' version '3.4.0' apply false // 加上 apply false
1414
id 'io.spring.dependency-management' version '1.1.6'
1515
id 'com.github.jk1.dependency-license-report' version '2.9'
1616

@@ -35,7 +35,7 @@ licenseReport {
3535

3636
allprojects {
3737
group = 'tpi.dgrv4'
38-
version = 'release-rc-v4.4.11.0-gd0900e2'
38+
version = 'release-rc-v4.4.14.0-gcc13a9359'
3939
apply plugin: 'io.spring.dependency-management'
4040

4141
repositories {
@@ -57,14 +57,13 @@ subprojects {
5757
apply plugin: 'java-library'
5858
apply plugin: 'eclipse'
5959

60-
sourceCompatibility = '17'
61-
targetCompatibility = '17'
60+
sourceCompatibility = '21'
61+
targetCompatibility = '21'
6262

6363

6464
dependencies {
65-
implementation files("${rootDir}/libsext/dgrv4_CodecUtil-v4.4.11.0-2-gd0900e21d-lib.jar")
66-
implementation files("${rootDir}/libsext/dgrv4_HttpUtil-v4.4.11.0-2-gd0900e21d-lib.jar")
67-
implementation files("${rootDir}/libsext/onlineConsole-v1.0-55-gdc3e362.jar")
65+
implementation files("${rootDir}/libsext/dgrv4_CodecUtil-v4.4.14.0-4-gcc13a9359-lib.jar")
66+
implementation files("${rootDir}/libsext/dgrv4_HttpUtil-v4.4.14.0-4-gcc13a9359-lib.jar")
6867

6968
implementation ('org.springframework.boot:spring-boot-starter-data-jpa'){
7069
exclude group: 'ch.qos.logback', module: 'logback-classic'
@@ -87,7 +86,7 @@ subprojects {
8786
implementation 'org.jboss.xnio:xnio-nio:3.8.16.Final'
8887
implementation 'jakarta.servlet:jakarta.servlet-api:6.1.0'
8988

90-
implementation 'com.h2database:h2'
89+
compileOnly 'com.h2database:h2'
9190
testImplementation 'org.springframework.boot:spring-boot-starter-test'
9291
compileOnly 'org.projectlombok:lombok:1.18.32'
9392
annotationProcessor 'org.projectlombok:lombok:1.18.32'
@@ -121,7 +120,7 @@ subprojects {
121120
}
122121
from(configurations.runtimeClasspath){
123122
include '**/google-cloud-logging-logback*.jar'
124-
include '**/bcprov-jdk15on*.jar'
123+
include '**/bcprov-jdk18on*.jar'
125124
include '**/aws-java-sdk*.jar'
126125
include '**/h2-*.jar'
127126
include '**/mariadb-java-client-*.jar'
@@ -134,7 +133,7 @@ subprojects {
134133
}
135134
}
136135

137-
def getDate() {
136+
static def getDate() {
138137
return new Date().format('yyyyMMdd_HHmm')
139138
}
140139

@@ -194,15 +193,19 @@ project(':dgrv4_Gateway_serv'){
194193

195194

196195
// compileOnly: JDBC Driver 5 種
196+
implementation 'com.h2database:h2'
197197
implementation project(':dgrv4_H2Config_lib')
198198
implementation 'com.microsoft.sqlserver:mssql-jdbc'
199199
implementation 'com.oracle.database.jdbc:ojdbc11'
200200
implementation 'org.postgresql:postgresql'
201201
implementation('org.mariadb.jdbc:mariadb-java-client:3.1.2', {
202202
exclude group: 'net.java.dev.jna', module: 'jna-platform' //使用其它版本的相依
203+
exclude group: 'com.google.protobuf', module: 'protobuf-java'
203204
})
205+
206+
// 修正上方排除的
207+
compileOnly 'com.google.protobuf:protobuf-java:3.25.5'
204208

205-
implementation 'org.springframework.boot:spring-boot-starter-freemarker:3.3.4'
206209
}
207210

208211
task createVersionTxt() {
@@ -281,8 +284,7 @@ project(':dgrv4_Entity_lib'){
281284
dependencies{
282285
implementation project(':dgrv4_Common_lib')
283286
compileOnly 'org.apache.commons:commons-lang3:3.12.0'
284-
compileOnly 'com.oracle.database.jdbc:ojdbc11'
285-
287+
286288
// Kryo Serialization
287289
compileOnly 'com.esotericsoftware:kryo:5.4.0'
288290
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
connection.project.dir=..
2+
eclipse.preferences.version=1

dgrv4_Common_lib/bin/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/main/

dgrv4_Common_lib/src/main/java/tpi/dgrv4/common/constant/TsmpDpAaRtnCode.java

+2
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,8 @@ public enum TsmpDpAaRtnCode implements ITsmpDpAaError<TsmpDpAaException> {
426426
_1557(TsmpDpModule.DP5, "57", "啟用日期需要小於停用日期"),
427427
_1558(TsmpDpModule.DP5, "58", "停用日期需要小於啟用日期"),
428428
_1559(TsmpDpModule.DP5, "59", "{{0}}"),
429+
_1561(TsmpDpModule.DP5, "61", "對稱式加密失敗:{{0}}"),
430+
_1562(TsmpDpModule.DP5, "62", "對稱式解密失敗:{{0}}"),
429431

430432
_2000(TsmpDpModule.DP10, "00", "必填"),
431433
_2001(TsmpDpModule.DP10, "01", "最大長度為 [{{0}}]"),

dgrv4_Common_lib/src/main/java/tpi/dgrv4/common/utils/ServiceUtil.java

+2-9
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import java.io.PrintWriter;
44
import java.io.StringWriter;
5+
import java.lang.management.ManagementFactory;
6+
import java.lang.management.OperatingSystemMXBean;
57
import java.math.BigDecimal;
68
import java.math.BigInteger;
79
import java.net.Inet6Address;
@@ -610,14 +612,5 @@ public static Long parseSequenceToLong(Object seq) {
610612
return result;
611613
}
612614

613-
public static String getMemoryInfo() {
614-
StringBuilder sb = new StringBuilder();
615-
String freeMemory = Runtime.getRuntime().freeMemory() / 1024 / 1024 + "MB";
616-
String totalMemory = Runtime.getRuntime().totalMemory() / 1024 / 1024 + "MB";
617-
String maxMemory = Runtime.getRuntime().maxMemory() / 1024 / 1024 + "MB";
618-
sb.append("\n...Memory(free/total/Max): "+freeMemory + " / " + totalMemory + " / " + maxMemory + "\n");
619-
620-
return sb.toString();
621-
}
622615

623616
}

dgrv4_Common_lib/src/main/java/tpi/dgrv4/common/utils/autoInitSQL/Initializer/TsmpRtnCodeTableInitializer.java

+6
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,12 @@ public List<TsmpRtnCodeVo> insertTsmpRtnCode() {
10421042
createTsmpRtnCode((tsmpRtnCodeColumn = "1559"), (locale = "zh-TW"), (tsmpRtnMsg = "{{0}}"), (tsmpRtnDesc = ""));
10431043
createTsmpRtnCode((tsmpRtnCodeColumn = "1559"), (locale = "en-US"), (tsmpRtnMsg = "{{0}}"), (tsmpRtnDesc = ""));
10441044

1045+
// 20250206, 對稱式加密/解密失敗訊息, Mini Lee
1046+
createTsmpRtnCode((tsmpRtnCodeColumn = "1561"), (locale = "zh-TW"), (tsmpRtnMsg = "對稱式加密失敗:{{0}}"), (tsmpRtnDesc = ""));
1047+
createTsmpRtnCode((tsmpRtnCodeColumn = "1561"), (locale = "en-US"), (tsmpRtnMsg = "Symmetric encryption error: {{0}}"), (tsmpRtnDesc = ""));
1048+
1049+
createTsmpRtnCode((tsmpRtnCodeColumn = "1562"), (locale = "zh-TW"), (tsmpRtnMsg = "對稱式解密失敗:{{0}}"), (tsmpRtnDesc = ""));
1050+
createTsmpRtnCode((tsmpRtnCodeColumn = "1562"), (locale = "en-US"), (tsmpRtnMsg = "Symmetric decryption error: {{0}}"), (tsmpRtnDesc = ""));
10451051
} catch (Exception e) {
10461052
StackTraceUtil.logStackTrace(e);
10471053
throw e;

dgrv4_Common_lib/src/main/java/tpi/dgrv4/common/utils/autoInitSQL/Initializer/TsmpSettingTableInitializer.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ public List<TsmpSettingVo> insertTsmpSetting() {
7474
createTsmpSetting("LDAP_TIMEOUT","3000","ldap登入的連線timeout,單位毫秒");
7575
createTsmpSetting("LDAP_CHECK_ACCT_ENABLE","false","LDAP檢查帳號功能是否啟用 true/false");
7676
///* 交給 resetAdminConsoleData() 建立了
77-
createTsmpSetting("TSMP_AC_CLIENT_ID","YWRtaW5Db25zb2xl","登入AC的帳號 (請勿修改)");
78-
createTsmpSetting("TSMP_AC_CLIENT_PW","dHNtcDEyMw==","登入AC的密碼 (請勿修改)");
77+
createTsmpSetting("TSMP_AC_CLIENT_ID","YWRtaW5Db25zb2xl","Login AC account (do not modify)");
78+
createTsmpSetting("TSMP_AC_CLIENT_PW","dHNtcDEyMw==","AC login password (do not modify)");
79+
7980
// */
8081
createTsmpSetting("TSMP_FAIL_THRESHOLD","6","允許User密碼錯誤次數上限");
8182
createTsmpSetting("SSO_PKCE","true","PKCE等級AuthCode驗證是否啟用 true/false");
@@ -293,6 +294,9 @@ public List<TsmpSettingVo> insertTsmpSetting() {
293294

294295
// -- 2024/12/27 HIGHWAY_THRESHOLD, Webber
295296
createTsmpSetting((id = "HIGHWAY_THRESHOLD"), (value = "1000"), (memo = "High speed channel for API requests"));
297+
298+
// -- 2025/02/03 kibana status API
299+
createTsmpSetting((id = "KIBANA_STATUS_URL"), (value = "/kibana/api/status"), (memo = " Kibana status API. defult: /kibana/api/status"));
296300
} catch (Exception e) {
297301
StackTraceUtil.logStackTrace(e);
298302
throw e;

dgrv4_Common_lib/src/main/resources/application.properties

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
connection.project.dir=..
2+
eclipse.preferences.version=1

dgrv4_Entity_lib/bin/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/main/

dgrv4_Entity_lib/src/main/java/tpi/dgrv4/entity/component/cipher/TsmpCoreTokenInitializer.java

+18-18
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public class TsmpCoreTokenInitializer {
5252
private static final String KEY_TYPE = "digiRunner.token.keyStoreType";
5353

5454
private static final String KEY_ALIAS = "digiRunner.token.keyAlias";
55-
55+
5656
@Autowired
5757
private ITPILogger logger;
5858

@@ -80,17 +80,17 @@ public TsmpCoreTokenInitializer(ITPILogger logger) {
8080
* 並與資料庫(tsmp_dp_file)儲存的 KeyPair 比對,若資料庫無 KeyPair 或是兩者的 KeyPair hashCode
8181
* 不相符<br>
8282
* 則將 ${digiRunner.token.key-store.path} JKS 中的 KeyPair 新增/更新至資料庫
83-
*
83+
*
8484
* @param e
8585
* @throws Exception
8686
*/
8787
@EventListener
8888
public void init(ContextRefreshedEvent e) throws Exception {
89-
89+
9090
StringBuffer info = new StringBuffer();
9191
final StringBuffer infoStr = info;
9292
final int delayTime = 800;
93-
93+
9494
// 利用時間差取得 Spring Boot 啟動完成的訊息, "Started DgrApplication in 20.436 seconds"
9595
new Thread() {
9696
public void run() {
@@ -107,8 +107,8 @@ public void run() {
107107
logger.tl.info(infoStr.toString());
108108
}
109109
}.start();
110-
111-
110+
111+
112112
KeyPair localKeyPair = getKeyPair();
113113
KeyPair remoteKeyPair = loadAndExtractKeyPair();
114114

@@ -136,7 +136,7 @@ public void run() {
136136
// 留給 {@link TsmpCoreTokenHelper} 用
137137
TsmpCoreTokenInitializer.KEY_PAIR_FILE_NAME = getKeyStoreName();
138138
logger.tl.debugDelay2sec("=== Token keyPair initialize successfully! ===");
139-
139+
140140
final StringBuffer buf = new StringBuffer();
141141
new Thread() {
142142
public void run() {
@@ -167,7 +167,7 @@ private String getProjectName() {
167167
* 有時 AP 環境跟 DB 環境可能在不同系統上運行,造成目錄路徑的預設分隔符號有差異 ("/"與"\"),<br>
168168
* 這會導致使用 filePath 查詢 TSMP_DP_FILE 表時查無資料<br>
169169
* 因此利用 "KEY_PAIR" 檔案類型應該只會有一筆的特性,來查詢 keyPair
170-
*
170+
*
171171
* @return
172172
*/
173173
private KeyPair getKeyPair() {
@@ -211,7 +211,7 @@ private KeyPair getKeyPair() {
211211

212212
/**
213213
* 將 KeyPair 儲存至 TsmpDpFile 中
214-
*
214+
*
215215
* @param keyPair
216216
* @return
217217
* @throws TsmpAsyCryptInitException
@@ -261,7 +261,7 @@ private TsmpDpFile setKeyPair(KeyPair keyPair) throws Exception {
261261

262262
/**
263263
* 載入 KeyStore 並取出金鑰對
264-
*
264+
*
265265
* @return
266266
*/
267267
private KeyPair loadAndExtractKeyPair() {
@@ -345,7 +345,7 @@ private KeyPair loadAndExtractKeyPair() {
345345

346346
/**
347347
* 產生一組 KeyPair 並存到 TsmpDpFile 中
348-
*
348+
*
349349
* @param algorithm
350350
* @param keySize 1024 or 2048
351351
* @return
@@ -368,7 +368,7 @@ private KeyPair generateKeyPair(String algorithm, int keySize) throws Exception
368368

369369
/**
370370
* 從資料庫取得 KeyPair 的 TsmpDpFile 檔
371-
*
371+
*
372372
* @return
373373
*/
374374
private TsmpDpFile getKeyPairFileEntry() {
@@ -395,7 +395,7 @@ private boolean isReadyToLoadKeyStore() {
395395

396396
/**
397397
* 確認 KeyStore 是否已載入
398-
*
398+
*
399399
* @param keyStore
400400
* @return
401401
*/
@@ -409,7 +409,7 @@ private boolean isKeyStoreLoaded(KeyStore keyStore) {
409409

410410
/**
411411
* KeyPair反序列化
412-
*
412+
*
413413
* @param content
414414
* @return
415415
*/
@@ -424,7 +424,7 @@ private KeyPair deserializeKeyPair(byte[] content) throws Exception {
424424

425425
/**
426426
* KeyPair序列化
427-
*
427+
*
428428
* @param obj
429429
* @return
430430
* @throws Exception
@@ -442,7 +442,7 @@ private byte[] serializeKeyPair(Object obj) throws Exception {
442442

443443
/**
444444
* 檢查公、私鑰的 Hash 值是否相同
445-
*
445+
*
446446
* @param kp1
447447
* @param kp2
448448
* @return
@@ -462,11 +462,11 @@ private void mySleepTsmpCoreTokenInitializer(long t) {
462462
Thread.currentThread().interrupt();
463463
}
464464
}
465-
465+
466466
protected IVersionService getVersionService() {
467467
return versionService;
468468
}
469-
469+
470470
protected Environment getEnvironment() {
471471
return env;
472472
}

dgrv4_Entity_lib/src/main/java/tpi/dgrv4/entity/component/cipher/TsmpTAEASKHelper.java

+6-20
Original file line numberDiff line numberDiff line change
@@ -117,28 +117,11 @@ private String genKey() {
117117
}
118118

119119
public String encrypt(String content) {
120-
/*
121-
* 2022.05.10 改用 AESUtils try { byte[] contentBytes =
122-
* content.getBytes(this.defaultCharset); byte[] encryptBytes =
123-
* getEncryptCipher().doFinal(contentBytes); String code =
124-
* HexStringUtils.toString(encryptBytes); return code; } catch (Exception e) {
125-
* logger.debug(StackTraceUtil.logStackTrace(e)); throw
126-
* DgrRtnCode._1297.throwing(); }
127-
*/
128120
String code = encryptByAESUtils(content);
129121
return code;
130122
}
131123

132124
public String decrypt(String content) {
133-
/*
134-
* 2022.05.10 改用 AESUtils try { byte[] contentBytes =
135-
* HexStringUtils.toBytes(content); byte[] decryptBytes =
136-
* getDecryptCipher().doFinal(contentBytes);
137-
*
138-
* String decryptContent = new String(decryptBytes); return decryptContent; }
139-
* catch (Exception e) { logger.debug(StackTraceUtil.logStackTrace(e)); throw
140-
* DgrRtnCode._1297.throwing(); }
141-
*/
142125
String decryptContent = decryptByAESUtils(content);
143126
return decryptContent;
144127
}
@@ -169,9 +152,12 @@ public String decryptByAESUtils(String content) {
169152
String dec = AESUtils.AesCipher(content, Cipher.DECRYPT_MODE, this.keySize, this.algorithm, null, seed);
170153

171154
return dec;
172-
} catch (Exception e) {
173-
logger.debug(StackTraceUtil.logStackTrace(e));
174-
throw TsmpDpAaRtnCode._1297.throwing();
155+
} catch (Exception e) {// AES 解密錯誤
156+
StringBuilder sb = new StringBuilder();
157+
sb.append("...AES decryption error. \n");
158+
sb.append(StackTraceUtil.logStackTrace(e));
159+
ITPILogger.tl.error(sb.toString());
160+
throw TsmpDpAaRtnCode._1562.throwing("AES");
175161
}
176162
}
177163

0 commit comments

Comments
 (0)