From 71e4b0bffa8ef78eda493de46fb3fe22c93adcd2 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Wed, 19 Mar 2025 18:28:55 +0800 Subject: [PATCH] =?UTF-8?q?init=20=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../czg/service/account/util/AlipayUtil.java | 40 +++++++++---------- .../service/account/util/WechatAuthUtil.java | 27 ++++++------- 2 files changed, 32 insertions(+), 35 deletions(-) diff --git a/cash-service/account-service/src/main/java/com/czg/service/account/util/AlipayUtil.java b/cash-service/account-service/src/main/java/com/czg/service/account/util/AlipayUtil.java index e48eb6e8..b07bf7a8 100644 --- a/cash-service/account-service/src/main/java/com/czg/service/account/util/AlipayUtil.java +++ b/cash-service/account-service/src/main/java/com/czg/service/account/util/AlipayUtil.java @@ -69,26 +69,26 @@ public class AlipayUtil { // @Value("${alipay.account.publicKey}") private String accountPublicKey; - @PostConstruct - private void init() { - CzgResult aliGateway = sysParamsService.getParamsByCode("ali_gateway"); - CzgResult aliMiniAppId = sysParamsService.getParamsByCode("ali_mini_app_id"); - CzgResult aliMiniPrivateKey = sysParamsService.getParamsByCode("ali_mini_private_key"); - CzgResult aliMiniPublicKey = sysParamsService.getParamsByCode("ali_mini_public_key"); - CzgResult aliAccountAppId = sysParamsService.getParamsByCode("ali_account_app_id"); - CzgResult aliAccountPrivateKey = sysParamsService.getParamsByCode("ali_account_private_key"); - CzgResult aliAccountPublicKey = sysParamsService.getParamsByCode("ali_account_public_key"); - CzgResult aliEncryptKey = sysParamsService.getParamsByCode("ali_encrypt_key"); - serverUrl = aliGateway.getData().getParamValue(); - appId = aliMiniAppId.getData().getParamValue(); - privateKey = aliMiniPrivateKey.getData().getParamValue(); - alipayPublicKey = aliMiniPublicKey.getData().getParamValue(); - encryptKey = aliEncryptKey.getData().getParamValue(); - accountAppId = aliAccountAppId.getData().getParamValue(); - accountPrivateKey = aliAccountPrivateKey.getData().getParamValue(); - accountPublicKey = aliAccountPublicKey.getData().getParamValue(); - log.info("支付宝工具类初始化成功, {}", this); - } +// @PostConstruct +// private void init() { +// CzgResult aliGateway = sysParamsService.getParamsByCode("ali_gateway"); +// CzgResult aliMiniAppId = sysParamsService.getParamsByCode("ali_mini_app_id"); +// CzgResult aliMiniPrivateKey = sysParamsService.getParamsByCode("ali_mini_private_key"); +// CzgResult aliMiniPublicKey = sysParamsService.getParamsByCode("ali_mini_public_key"); +// CzgResult aliAccountAppId = sysParamsService.getParamsByCode("ali_account_app_id"); +// CzgResult aliAccountPrivateKey = sysParamsService.getParamsByCode("ali_account_private_key"); +// CzgResult aliAccountPublicKey = sysParamsService.getParamsByCode("ali_account_public_key"); +// CzgResult aliEncryptKey = sysParamsService.getParamsByCode("ali_encrypt_key"); +// serverUrl = aliGateway.getData().getParamValue(); +// appId = aliMiniAppId.getData().getParamValue(); +// privateKey = aliMiniPrivateKey.getData().getParamValue(); +// alipayPublicKey = aliMiniPublicKey.getData().getParamValue(); +// encryptKey = aliEncryptKey.getData().getParamValue(); +// accountAppId = aliAccountAppId.getData().getParamValue(); +// accountPrivateKey = aliAccountPrivateKey.getData().getParamValue(); +// accountPublicKey = aliAccountPublicKey.getData().getParamValue(); +// log.info("支付宝工具类初始化成功, {}", this); +// } /** * 创建支付宝客户端 diff --git a/cash-service/account-service/src/main/java/com/czg/service/account/util/WechatAuthUtil.java b/cash-service/account-service/src/main/java/com/czg/service/account/util/WechatAuthUtil.java index dfb0dc1c..6af58659 100644 --- a/cash-service/account-service/src/main/java/com/czg/service/account/util/WechatAuthUtil.java +++ b/cash-service/account-service/src/main/java/com/czg/service/account/util/WechatAuthUtil.java @@ -1,8 +1,6 @@ package com.czg.service.account.util; import cn.hutool.core.codec.Base64; -import cn.hutool.core.io.IoUtil; -import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.crypto.symmetric.AES; import cn.hutool.http.HttpUtil; @@ -21,7 +19,6 @@ import jakarta.validation.constraints.NotBlank; import lombok.extern.slf4j.Slf4j; import org.apache.dubbo.config.annotation.DubboReference; import org.springframework.stereotype.Component; -import org.springframework.stereotype.Service; import java.io.InputStream; import java.util.HashMap; @@ -71,18 +68,18 @@ public class WechatAuthUtil { } - @PostConstruct - public void init() { - CzgResult wxMiniAppId = sysParamsService.getParamsByCode("wx_mini_app_id"); - CzgResult wxMiniSecrete = sysParamsService.getParamsByCode("wx_mini_secrete"); - CzgResult wxAccountAppId = sysParamsService.getParamsByCode("wx_account_app_id"); - CzgResult wxAccountSecrete = sysParamsService.getParamsByCode("wx_account_secrete"); - appId = wxMiniAppId.getData().getParamValue(); - secrete = wxMiniSecrete.getData().getParamValue(); - accountAppId = wxAccountAppId.getData().getParamValue(); - accountSecrete = wxAccountSecrete.getData().getParamValue(); - log.info("微信工具类初始化成功, appId: {}, secrete: {}, accountAppId: {}, accountSecrete: {}", appId, secrete, accountAppId, accountSecrete); - } +// @PostConstruct +// public void init() { +// CzgResult wxMiniAppId = sysParamsService.getParamsByCode("wx_mini_app_id"); +// CzgResult wxMiniSecrete = sysParamsService.getParamsByCode("wx_mini_secrete"); +// CzgResult wxAccountAppId = sysParamsService.getParamsByCode("wx_account_app_id"); +// CzgResult wxAccountSecrete = sysParamsService.getParamsByCode("wx_account_secrete"); +// appId = wxMiniAppId.getData().getParamValue(); +// secrete = wxMiniSecrete.getData().getParamValue(); +// accountAppId = wxAccountAppId.getData().getParamValue(); +// accountSecrete = wxAccountSecrete.getData().getParamValue(); +// log.info("微信工具类初始化成功, appId: {}, secrete: {}, accountAppId: {}, accountSecrete: {}", appId, secrete, accountAppId, accountSecrete); +// } public String getAccountOpenId(String code) { String requestUrl = "https://api.weixin.qq.com/sns/oauth2/access_token?";