|
|
@@ -15,6 +15,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.github.pagehelper.Page;
|
|
|
import com.zhongzheng.common.config.WxSmallConfig;
|
|
|
import com.zhongzheng.common.core.redis.RedisCache;
|
|
|
+import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.utils.AES;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
|
@@ -200,6 +201,9 @@ public class WxPayServiceImpl implements IWxPayService {
|
|
|
|
|
|
public String wx_config_sign(Map<String, String> result,String url) {
|
|
|
String jsapi_ticket = wx_get_jsapi_ticket();
|
|
|
+ if(!Validator.isNotNull(jsapi_ticket)){
|
|
|
+ throw new CustomException("jsapi_ticket错误"+jsapi_ticket);
|
|
|
+ }
|
|
|
String str = "jsapi_ticket="+jsapi_ticket+"&noncestr="+result.get("nonceStr")+"×tamp="+result.get("timeStamp")+"&url="+url;
|
|
|
String signature = AES.SHA1(str);
|
|
|
return signature;
|
|
|
@@ -301,7 +305,7 @@ public class WxPayServiceImpl implements IWxPayService {
|
|
|
{
|
|
|
String key = "gzh_access_token";
|
|
|
String access_token = redisCache.getCacheObject(key);
|
|
|
- if(access_token==null){
|
|
|
+ if(!Validator.isNotNull(access_token)){
|
|
|
String param = String.format(gzh_tokenParam, gzhAppid, gzh_appsrcret);
|
|
|
String resultString = HttpUtils.sendGet(gzh_tokenUrl,param);
|
|
|
//解析json
|
|
|
@@ -311,6 +315,9 @@ public class WxPayServiceImpl implements IWxPayService {
|
|
|
redisCache.setCacheObject(key, access_token, 2*50, TimeUnit.MINUTES);//2个小时
|
|
|
}
|
|
|
}
|
|
|
+ if(!Validator.isNotNull(access_token)){
|
|
|
+ throw new CustomException("access_token错误"+access_token);
|
|
|
+ }
|
|
|
return access_token;
|
|
|
}
|
|
|
}
|