Skip to content

Commit

Permalink
feat: compile with JDK17 LTS, build with JDK21 (#273)
Browse files Browse the repository at this point in the history
* chore: compile with JDK17 LTS, build with JDK21, update spotless, sonarcloud etc

* format: google-java-format 1.22.0
  • Loading branch information
xy-peng committed May 12, 2024
1 parent 31f42ff commit 738c3e4
Show file tree
Hide file tree
Showing 499 changed files with 2,205 additions and 24 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ jobs:
build:
strategy:
matrix:
java-version: [ 8, 11, 17 ]
java-version: [ 11, 17, 21 ]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java-version }}
distribution: 'temurin'
cache: 'gradle'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
uses: gradle/actions/wrapper-validation@v3
- name: Build with Gradle
run: ./gradlew build
run: ./gradlew build
12 changes: 6 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
check-tag:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Regex Match
id: regex-match
run: |
Expand All @@ -26,19 +26,19 @@ jobs:
needs: [check-tag]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '8'
java-version: '17'
distribution: 'temurin'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1.0.4
uses: gradle/actions/wrapper-validation@v3
# 发布项目
- name: Publish
run: ./gradlew publish
env:
SONATYPE_NEXUS_USERNAME: ${{secrets.SONATYPE_NEXUS_USERNAME}}
SONATYPE_NEXUS_PASSWORD: ${{secrets.SONATYPE_NEXUS_PASSWORD}}
SIGNING_KEY: ${{secrets.SIGNING_KEY}}
SIGNING_PASSWORD: ${{secrets.SIGNING_PASSWORD}}
SIGNING_PASSWORD: ${{secrets.SIGNING_PASSWORD}}
11 changes: 6 additions & 5 deletions .github/workflows/sonarcloud-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,28 @@ on:
- 'feat_*'
- 'fix_*'
- 'refactor_*'

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
- name: Cache SonarCloud packages
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Gradle packages
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
Expand Down
5 changes: 4 additions & 1 deletion buildSrc/src/main/groovy/common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ plugins {
id "jacoco"
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

version projectPropVersion
group projectPropGroup
compileJava.options.encoding = "UTF-8"
Expand All @@ -19,7 +22,7 @@ repositories {
spotless {
java {
removeUnusedImports()
googleJavaFormat('1.7')
googleJavaFormat('1.22.0')
}
}

Expand Down
2 changes: 1 addition & 1 deletion core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencies {
implementation "org.slf4j:slf4j-api:${slf4jVersion}"

testImplementation "junit:junit:${junitVersion}"
testImplementation "org.mockito:mockito-inline:${mockitoInlineVersion}"
testImplementation "org.mockito:mockito-core:${mockitoCoreVersion}"
testImplementation "com.squareup.okhttp3:mockwebserver:${okhttpVersion}"
testImplementation "org.awaitility:awaitility:${awaitilityVersion}"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ protected AbstractRSAConfig(

/** 商户号 */
private final String merchantId;

/** 商户私钥 */
private final PrivateKey privateKey;

/** 商户证书序列号 */
private final String merchantSerialNumber;

/** 微信支付平台证书Provider */
private final CertificateProvider certificateProvider;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package com.wechat.pay.java.core.notification;

/** Notification 常量 */
public final class Constant {
public static final String RSA_SIGN_TYPE = "WECHATPAY2-SHA256-RSA2048";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class RSAVerifierTest {

private static Verifier rsaVerifier;
private static final String MESSAGE = "message";

/** signature为使用RSASigner和测试商户证书私钥对MESSAGE签名得到的结果 */
private static final SignatureResult SIGNATURE_RESULT =
new SignatureResult(
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ junitVersion=4.13.2
junit5Version=5.9.1
okhttpVersion=4.10.0
gsonVersion=2.9.1
mockitoInlineVersion=4.8.1
mockitoCoreVersion=5.12.0
awaitilityVersion=4.2.0
spotlessVersion=6.11.0
spotlessVersion=6.25.0
shadowVersion=7.1.2
sonarqubeVersion=4.0.0.2929
sonarqubeVersion=5.0.0.4638
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ public class QuickStart {

/** 商户号 */
public static String merchantId = "";

/** 商户API私钥路径 */
public static String privateKeyPath = "";

/** 商户证书序列号 */
public static String merchantSerialNumber = "";

/** 商户APIV3密钥 */
public static String apiV3Key = "";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ public class BillDownloadServiceExample {

/** 商户号 */
public static String merchantId = "190000****";

/** 商户API私钥路径 */
public static String privateKeyPath = "/Users/yourname/your/path/apiclient_key.pem";

/** 商户证书序列号 */
public static String merchantSerialNumber = "5157F09EFDC096DE15EBE81A47057A72********";

/** 商户APIV3密钥 */
public static String apiV3Key = "...";

Expand All @@ -38,24 +41,28 @@ public static void main(String[] args) {
service = new BillDownloadService.Builder().config(config).build();
// ... 调用接口
}

/** 申请资金账单API */
public static QueryBillEntity getFundFlowBill() {

GetFundFlowBillRequest request = new GetFundFlowBillRequest();
return service.getFundFlowBill(request);
}

/** 申请单个子商户资金账单API */
public static QueryEncryptBillEntity getSingleSubMchFundFlowBill() {

GetSingleSubMchFundFlowBillRequest request = new GetSingleSubMchFundFlowBillRequest();
return service.getSingleSubMchFundFlowBill(request);
}

/** 申请二级商户资金账单API */
public static QueryEncryptBillEntity getAllSubMchFundFlowBill() {

GetAllSubMchFundFlowBillRequest request = new GetAllSubMchFundFlowBillRequest();
return service.getAllSubMchFundFlowBill(request);
}

/** 申请交易账单API */
public static QueryBillEntity getTradeBill() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ public class BrandProfitSharingServiceExample {

/** 商户号 */
public static String merchantId = "190000****";

/** 商户API私钥路径 */
public static String privateKeyPath = "/Users/yourname/your/path/apiclient_key.pem";

/** 商户证书序列号 */
public static String merchantSerialNumber = "5157F09EFDC096DE15EBE81A47057A72********";

/** 商户APIV3密钥 */
public static String apiV3Key = "...";

Expand All @@ -51,49 +54,58 @@ public static void main(String[] args) {
service = new BrandProfitSharingService.Builder().config(config).build();
// ... 调用接口
}

/** 查询最大分账比例 */
public static QueryBrandMerchantRatioResponse queryBrandMerchantRatio() {

QueryBrandMerchantRatioRequest request = new QueryBrandMerchantRatioRequest();
return service.queryBrandMerchantRatio(request);
}

/** 请求分账 */
public static CreateOrderResponse createOrder() {
CreateOrderRequest request = new CreateOrderRequest();
return service.createOrder(request);
}

/** 完结分账 */
public static FinishOrderResponse finishOrder() {
FinishOrderRequest request = new FinishOrderRequest();
return service.finishOrder(request);
}

/** 查询分账结果 */
public static QueryOrderResponse queryOrder() {

QueryOrderRequest request = new QueryOrderRequest();
return service.queryOrder(request);
}

/** 查询订单剩余待分金额 */
public static QueryOrderAmountResponse queryOrderAmount() {

QueryOrderAmountRequest request = new QueryOrderAmountRequest();
return service.queryOrderAmount(request);
}

/** 添加分账接收方 */
public static AddReceiverResponse addReceiver() {
AddReceiverRequest request = new AddReceiverRequest();
return service.addReceiver(request);
}

/** 删除分账接收方 */
public static DeleteReceiverResponse deleteReceiver() {
DeleteReceiverRequest request = new DeleteReceiverRequest();
return service.deleteReceiver(request);
}

/** 请求分账回退 */
public static CreateReturnOrderResponse createReturnOrder() {
CreateReturnOrderRequest request = new CreateReturnOrderRequest();
return service.createReturnOrder(request);
}

/** 查询分账回退结果 */
public static QueryReturnOrderResponse queryReturnOrder() {

Expand Down

0 comments on commit 738c3e4

Please sign in to comment.