From 4e3ebe2646aecb63d9632cb0e129c1c426a7e18c Mon Sep 17 00:00:00 2001
From: ck <851316342@qq.com>
Date: Thu, 15 Oct 2020 21:46:43 +0800
Subject: [PATCH] up
---
.idea/misc.xml | 13 +
.idea/vcs.xml | 6 +
.../com/bsd/cases/model/FillterConstants.java | 22 ++
.../cases/service/CaseCategoryService.java | 2 +
.../impl/WxMpInMemoryConfigStorage.java | 236 ------------------
.../cases/service/impl/WxMpServiceImpl.java | 99 --------
src/main/java/com/bsd/cases/vo/CaseVo.java | 8 +
7 files changed, 51 insertions(+), 335 deletions(-)
create mode 100644 .idea/misc.xml
create mode 100644 .idea/vcs.xml
create mode 100644 src/main/java/com/bsd/cases/model/FillterConstants.java
delete mode 100644 src/main/java/com/bsd/cases/service/impl/WxMpInMemoryConfigStorage.java
delete mode 100644 src/main/java/com/bsd/cases/service/impl/WxMpServiceImpl.java
create mode 100644 src/main/java/com/bsd/cases/vo/CaseVo.java
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..d30d09e
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/com/bsd/cases/model/FillterConstants.java b/src/main/java/com/bsd/cases/model/FillterConstants.java
new file mode 100644
index 0000000..fd205c7
--- /dev/null
+++ b/src/main/java/com/bsd/cases/model/FillterConstants.java
@@ -0,0 +1,22 @@
+package com.bsd.cases.model;
+
+public class FillterConstants {
+
+ public static String EQUAL = "is";
+
+ public static String EQUALSYM = "=";
+
+ public static String LIKE = "like";
+
+ public static String LIKESYM = "regex";
+
+ public static String IN = "in";
+
+ public static String GTE = "gte";
+
+ public static String GTESYM = ">=";
+
+ public static String LTE = "lte";
+
+ public static String LTESYM = "<=";
+}
diff --git a/src/main/java/com/bsd/cases/service/CaseCategoryService.java b/src/main/java/com/bsd/cases/service/CaseCategoryService.java
index 49fbbbd..8eb08a1 100644
--- a/src/main/java/com/bsd/cases/service/CaseCategoryService.java
+++ b/src/main/java/com/bsd/cases/service/CaseCategoryService.java
@@ -10,4 +10,6 @@ public interface CaseCategoryService extends BaseService this.expiresTime;
- }
-
- public synchronized void updateAccessToken(WxAccessToken accessToken) {
- updateAccessToken(accessToken.getAccessToken(), accessToken.getExpiresIn());
- }
-
- public synchronized void updateAccessToken(String accessToken, int expiresInSeconds) {
- this.accessToken = accessToken;
- this.expiresTime = System.currentTimeMillis() + (expiresInSeconds - 200) * 1000l;
- }
-
- public void expireAccessToken() {
- this.expiresTime = 0;
- }
-
- public String getJsapiTicket() {
- return jsapiTicket;
- }
-
- public void setJsapiTicket(String jsapiTicket) {
- this.jsapiTicket = jsapiTicket;
- }
-
- public long getJsapiTicketExpiresTime() {
- return jsapiTicketExpiresTime;
- }
-
- public void setJsapiTicketExpiresTime(long jsapiTicketExpiresTime) {
- this.jsapiTicketExpiresTime = jsapiTicketExpiresTime;
- }
-
- public boolean isJsapiTicketExpired() {
- return System.currentTimeMillis() > this.jsapiTicketExpiresTime;
- }
-
- public synchronized void updateJsapiTicket(String jsapiTicket, int expiresInSeconds) {
- this.jsapiTicket = jsapiTicket;
- // 预留200秒的时间
- this.jsapiTicketExpiresTime = System.currentTimeMillis() + (expiresInSeconds - 200) * 1000l;
- }
-
- public void expireJsapiTicket() {
- this.jsapiTicketExpiresTime = 0;
- }
-
- public String getAppId() {
- return this.appId;
- }
-
- public String getSecret() {
- return this.secret;
- }
-
- public String getToken() {
- return this.token;
- }
-
- public long getExpiresTime() {
- return this.expiresTime;
- }
-
- public void setAppId(String appId) {
- this.appId = appId;
- }
-
- public void setSecret(String secret) {
- this.secret = secret;
- }
-
- public void setToken(String token) {
- this.token = token;
- }
-
- public String getAesKey() {
- return aesKey;
- }
-
- public void setAesKey(String aesKey) {
- this.aesKey = aesKey;
- }
-
- public void setAccessToken(String accessToken) {
- this.accessToken = accessToken;
- }
-
- public void setExpiresTime(long expiresTime) {
- this.expiresTime = expiresTime;
- }
-
- @Override
- public String getOauth2redirectUri() {
- return this.oauth2redirectUri;
- }
-
- public void setOauth2redirectUri(String oauth2redirectUri) {
- this.oauth2redirectUri = oauth2redirectUri;
- }
-
- public String getHttp_proxy_host() {
- return http_proxy_host;
- }
-
- public void setHttp_proxy_host(String http_proxy_host) {
- this.http_proxy_host = http_proxy_host;
- }
-
- public int getHttp_proxy_port() {
- return http_proxy_port;
- }
-
- public void setHttp_proxy_port(int http_proxy_port) {
- this.http_proxy_port = http_proxy_port;
- }
-
- public String getHttp_proxy_username() {
- return http_proxy_username;
- }
-
- public void setHttp_proxy_username(String http_proxy_username) {
- this.http_proxy_username = http_proxy_username;
- }
-
- public String getHttp_proxy_password() {
- return http_proxy_password;
- }
-
- public void setHttp_proxy_password(String http_proxy_password) {
- this.http_proxy_password = http_proxy_password;
- }
-
- @Override
- public String toString() {
- return "WxMpInMemoryConfigStorage{" +
- "appId='" + appId + '\'' +
- ", secret='" + secret + '\'' +
- ", token='" + token + '\'' +
- ", partnerId='" + partnerId + '\'' +
- ", partnerKey='" + partnerKey + '\'' +
- ", accessToken='" + accessToken + '\'' +
- ", aesKey='" + aesKey + '\'' +
- ", expiresTime=" + expiresTime +
- ", http_proxy_host='" + http_proxy_host + '\'' +
- ", http_proxy_port=" + http_proxy_port +
- ", http_proxy_username='" + http_proxy_username + '\'' +
- ", http_proxy_password='" + http_proxy_password + '\'' +
- ", jsapiTicket='" + jsapiTicket + '\'' +
- ", jsapiTicketExpiresTime='" + jsapiTicketExpiresTime + '\'' +
- ", tmpDirFile='" + tmpDirFile + '\'' +
- '}';
- }
-
- @Override
- public String getPartnerId() {
- return partnerId;
- }
-
- public void setPartnerId(String partnerId) {
- this.partnerId = partnerId;
- }
-
- @Override
- public String getPartnerKey() {
- return partnerKey;
- }
-
- public void setPartnerKey(String partnerKey) {
- this.partnerKey = partnerKey;
- }
-
- @Override
- public File getTmpDirFile() {
- return this.tmpDirFile;
- }
-
- public void setTmpDirFile(File tmpDirFile) {
- this.tmpDirFile = tmpDirFile;
- }
-
- @Override
- public SSLContext getSSLContext() {
- return sslContext;
- }
-
- public void setSSLContext(SSLContext context) {
- sslContext = context;
- }
-
-}
diff --git a/src/main/java/com/bsd/cases/service/impl/WxMpServiceImpl.java b/src/main/java/com/bsd/cases/service/impl/WxMpServiceImpl.java
deleted file mode 100644
index be75500..0000000
--- a/src/main/java/com/bsd/cases/service/impl/WxMpServiceImpl.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package com.bsd.cases.service.impl;
-
-import com.bsd.cases.service.WxMpConfigStorage;
-import com.bsd.cases.service.WxMpService;
-import com.bsd.cases.util.wx.common.bean.WxAccessToken;
-import com.bsd.cases.util.wx.common.bean.result.WxError;
-import com.bsd.cases.util.wx.common.exception.WxErrorException;
-import com.bsd.cases.util.wx.common.session.StandardSessionManager;
-import com.bsd.cases.util.wx.common.session.WxSessionManager;
-import com.bsd.cases.util.wx.common.util.crypto.SHA1;
-
-import org.apache.http.HttpHost;
-import org.apache.http.client.ClientProtocolException;
-import org.apache.http.client.config.RequestConfig;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.impl.client.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-
-public class WxMpServiceImpl implements WxMpService {
-
- protected final Logger log = LoggerFactory.getLogger(WxMpServiceImpl.class);
-
- /**
- * 全局的是否正在刷新access token的锁
- */
- protected final Object globalAccessTokenRefreshLock = new Object();
-
- /**
- * 全局的是否正在刷新jsapi_ticket的锁
- */
- protected final Object globalJsapiTicketRefreshLock = new Object();
-
- protected WxMpConfigStorage wxMpConfigStorage;
-
- protected CloseableHttpClient httpClient;
-
- protected HttpHost httpProxy;
-
- private int retrySleepMillis = 1000;
-
- private int maxRetryTimes = 5;
-
- protected WxSessionManager sessionManager = new StandardSessionManager();
-
- public boolean checkSignature(String timestamp, String nonce, String signature) {
- try {
- return SHA1.gen(wxMpConfigStorage.getToken(), timestamp, nonce).equals(signature);
- } catch (Exception e) {
- return false;
- }
- }
-
- public String getAccessToken() throws WxErrorException {
- return getAccessToken(false);
- }
-
- public String getAccessToken(boolean forceRefresh) throws WxErrorException {
- if (forceRefresh) {
- wxMpConfigStorage.expireAccessToken();
- }
- if (wxMpConfigStorage.isAccessTokenExpired()) {
- synchronized (globalAccessTokenRefreshLock) {
- if (wxMpConfigStorage.isAccessTokenExpired()) {
- String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential"
- + "&appid=" + wxMpConfigStorage.getAppId()
- + "&secret=" + wxMpConfigStorage.getSecret();
- try {
- HttpGet httpGet = new HttpGet(url);
- if (httpProxy != null) {
- RequestConfig config = RequestConfig.custom().setProxy(httpProxy).build();
- httpGet.setConfig(config);
- }
- CloseableHttpResponse response = getHttpclient().execute(httpGet);
- String resultContent = new BasicResponseHandler().handleResponse(response);
- WxError error = WxError.fromJson(resultContent);
- if (error.getErrorCode() != 0) {
- throw new WxErrorException(error);
- }
- WxAccessToken accessToken = WxAccessToken.fromJson(resultContent);
- wxMpConfigStorage.updateAccessToken(accessToken.getAccessToken(), accessToken.getExpiresIn());
- } catch (ClientProtocolException e) {
- throw new RuntimeException(e);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
- }
- }
- return wxMpConfigStorage.getAccessToken();
- }
-
- protected CloseableHttpClient getHttpclient() {
- return httpClient;
- }
-}
diff --git a/src/main/java/com/bsd/cases/vo/CaseVo.java b/src/main/java/com/bsd/cases/vo/CaseVo.java
new file mode 100644
index 0000000..47169ad
--- /dev/null
+++ b/src/main/java/com/bsd/cases/vo/CaseVo.java
@@ -0,0 +1,8 @@
+package com.bsd.cases.vo;
+
+import lombok.Data;
+
+@Data
+public class CaseVo {
+
+}