🎨 修复日志代码报错问题

This commit is contained in:
Binary Wang 2025-04-29 11:33:46 +08:00
parent 2d8d1df00e
commit 854b50bd51
2 changed files with 4 additions and 2 deletions

View File

@ -30,6 +30,7 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxRuntimeException; import me.chanjar.weixin.common.error.WxRuntimeException;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.reflect.ConstructorUtils; import org.apache.commons.lang3.reflect.ConstructorUtils;
@ -59,6 +60,7 @@ import static com.github.binarywang.wxpay.constant.WxPayConstants.TarType;
* *
* @author <a href="https://github.com/binarywang">Binary Wang</a> * @author <a href="https://github.com/binarywang">Binary Wang</a>
*/ */
@Slf4j
public abstract class BaseWxPayServiceImpl implements WxPayService { public abstract class BaseWxPayServiceImpl implements WxPayService {
private static final String TOTAL_FUND_COUNT = "资金流水总笔数"; private static final String TOTAL_FUND_COUNT = "资金流水总笔数";

View File

@ -198,7 +198,7 @@ public class WxPayServiceApacheHttpImpl extends BaseWxPayServiceImpl {
JsonObject jsonObject = GsonParser.parse(responseString); JsonObject jsonObject = GsonParser.parse(responseString);
throw convertException(jsonObject); throw convertException(jsonObject);
} catch (Exception e) { } catch (Exception e) {
this.log.error("\n【请求地址】{}\n【异常信息】{}", url, e.getMessage()); log.error("\n【请求地址】{}\n【异常信息】{}", url, e.getMessage());
throw (e instanceof WxPayException) ? (WxPayException) e : new WxPayException(e.getMessage(), e); throw (e instanceof WxPayException) ? (WxPayException) e : new WxPayException(e.getMessage(), e);
} finally { } finally {
httpRequest.releaseConnection(); httpRequest.releaseConnection();
@ -344,7 +344,7 @@ public class WxPayServiceApacheHttpImpl extends BaseWxPayServiceImpl {
} }
private WxPayException convertException(JsonObject jsonObject) { private WxPayException convertException(JsonObject jsonObject) {
//todo 这里考虑使用新的适用于V3的异常 //TODO 这里考虑使用新的适用于V3的异常
JsonElement codeElement = jsonObject.get("code"); JsonElement codeElement = jsonObject.get("code");
String code = codeElement == null ? null : codeElement.getAsString(); String code = codeElement == null ? null : codeElement.getAsString();
String message = jsonObject.get("message").getAsString(); String message = jsonObject.get("message").getAsString();