|
@@ -1,7 +1,9 @@
|
|
|
package com.hfln.portal.domain.customer.util;
|
|
|
|
|
|
+import cn.hfln.framework.extension.BizException;
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
import com.google.gson.Gson;
|
|
|
+import com.hfln.portal.domain.exception.ErrorEnum;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.http.HttpEntity;
|
|
@@ -129,7 +131,7 @@ public class WxOfficeAccountClient {
|
|
|
//3.判断是否有错误码返回
|
|
|
if (map.containsKey("errcode")) {
|
|
|
log.error("微信接口返回错误码:{}", result);
|
|
|
- return null;
|
|
|
+ throw new BizException(ErrorEnum.GET_ACCESS_TOKEN_FAIL_ONE.getErrorCode(), ErrorEnum.GET_ACCESS_TOKEN_FAIL_ONE.getErrorMessage());
|
|
|
}
|
|
|
if (map.containsKey("access_token")) {
|
|
|
String accessToken = (String) map.get("access_token");
|
|
@@ -140,12 +142,13 @@ public class WxOfficeAccountClient {
|
|
|
return accessToken;
|
|
|
} else {
|
|
|
log.error("微信接口未返回 access_token, 原始响应:{}", result);
|
|
|
+ throw new BizException(ErrorEnum.GET_ACCESS_TOKEN_FAIL_TWO.getErrorCode(), ErrorEnum.GET_ACCESS_TOKEN_FAIL_TWO.getErrorMessage());
|
|
|
}
|
|
|
}
|
|
|
} catch (IOException e) {
|
|
|
log.error("调用微信接口异常,获取 access_token 失败", e);
|
|
|
+ throw new BizException(ErrorEnum.GET_ACCESS_TOKEN_FAIL_THREE.getErrorCode(), ErrorEnum.GET_ACCESS_TOKEN_FAIL_THREE.getErrorMessage());
|
|
|
}
|
|
|
- return null;
|
|
|
}
|
|
|
|
|
|
private boolean sendTemplateMessage(String accessToken, String openid,
|