Skip to content
Snippets Groups Projects
Commit f1746342 authored by gitea gitea's avatar gitea gitea
Browse files

toolsa

parent 10288a56
Branches
Tags
No related merge requests found
......@@ -103,6 +103,11 @@
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
</dependencies>
<dependencyManagement>
......@@ -147,22 +152,6 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<configuration>
<attach>true</attach>
<encoding>UTF-8</encoding>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
......
package com.guanweiming.common.aliyun.carno;
import com.guanweiming.common.ServerResponse;
import lombok.extern.slf4j.Slf4j;
import okhttp3.*;
import org.json.JSONObject;
......@@ -20,7 +19,7 @@ public class AliYunCarNoService {
}
public ServerResponse<String> ocr(String base64Str) {
public utils.ServerResponse<String> ocr(String base64Str) {
String url = "https://dm-53.data.aliyun.com/rest/160601/ocr/ocr_vehicle.json";
String appCode = aliYunCarNoProperties.getAppCode();
......@@ -53,8 +52,8 @@ public class AliYunCarNoService {
log.debug("hello");
} catch (IOException e) {
e.printStackTrace();
return ServerResponse.createByErrorMessage("解析失败:" + e.getMessage());
return utils.ServerResponse.createByErrorMessage("解析失败:" + e.getMessage());
}
return ServerResponse.createBySuccess(result);
return utils.ServerResponse.createBySuccess(result);
}
}
......@@ -8,7 +8,7 @@ import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.profile.IClientProfile;
import com.guanweiming.common.StringUtil;
import com.guanweiming.common.utils.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.configurationprocessor.json.JSONObject;
......
package com.guanweiming.common.map;
import com.google.common.collect.Lists;
import com.guanweiming.common.JsonUtil;
import com.guanweiming.common.ServerResponse;
import com.guanweiming.common.utils.JsonUtil;
import lombok.extern.slf4j.Slf4j;
import org.json.JSONObject;
import org.springframework.web.client.RestTemplate;
......@@ -37,7 +36,7 @@ public class GaoDeMapService {
* @param longitude 经度
* @return 逆地理位置解析结果
*/
public ServerResponse<Map> reGeo(double latitude, double longitude) {
public utils.ServerResponse<Map> reGeo(double latitude, double longitude) {
latitude = ((int) (latitude * 1000000)) / 1000000.0;
longitude = ((int) (longitude * 1000000)) / 1000000.0;
......@@ -49,9 +48,9 @@ public class GaoDeMapService {
Map map = JsonUtil.fromJson(result, Map.class);
JSONObject object = JsonUtil.toJsonObject(result);
if ("OK".equals(object.getString("info"))) {
return ServerResponse.createBySuccess(map);
return utils.ServerResponse.createBySuccess(map);
}
return ServerResponse.createByErrorMessage("错误");
return utils.ServerResponse.createByErrorMessage("错误");
}
}
package com.guanweiming.common.qiniu;
import com.google.gson.Gson;
import com.guanweiming.common.QiniuResponse;
import com.guanweiming.common.StringUtil;
import com.guanweiming.common.utils.QiniuResponse;
import com.guanweiming.common.utils.StringUtil;
import com.qiniu.common.QiniuException;
import com.qiniu.common.Zone;
import com.qiniu.http.Response;
......
package com.guanweiming.common.tencent.im;
import com.guanweiming.common.JsonUtil;
import com.guanweiming.common.utils.JsonUtil;
import lombok.extern.slf4j.Slf4j;
import okhttp3.*;
import org.json.JSONObject;
......
......@@ -3,9 +3,8 @@ package com.guanweiming.common.wx.miniapp;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.gson.annotations.SerializedName;
import com.guanweiming.common.JsonUtil;
import com.guanweiming.common.ServerResponse;
import com.guanweiming.common.StringUtil;
import com.guanweiming.common.utils.JsonUtil;
import com.guanweiming.common.utils.StringUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.json.JSONException;
......@@ -52,7 +51,7 @@ public class MiniAppService {
}
public ServerResponse<SessionKeyVo> sessionKey(String code) throws JSONException {
public utils.ServerResponse<SessionKeyVo> sessionKey(String code) throws JSONException {
StringBuilder stringBuilder = new StringBuilder();
......@@ -71,12 +70,12 @@ public class MiniAppService {
CACHE.put(code, sessinKey);
OPENID_CACHE.put(code, openid);
SessionKeyVo sessionKeyVo = JsonUtil.fromJson(result, SessionKeyVo.class);
return ServerResponse.createBySuccess(sessionKeyVo);
return utils.ServerResponse.createBySuccess(sessionKeyVo);
}
public ServerResponse<SessionKeyVo> descrypt(String code, String appId, String encryptedData, String iv) throws NoSuchPaddingException, InvalidKeyException, NoSuchAlgorithmException, IOException, BadPaddingException, IllegalBlockSizeException, InvalidAlgorithmParameterException, JSONException {
public utils.ServerResponse<SessionKeyVo> descrypt(String code, String appId, String encryptedData, String iv) throws NoSuchPaddingException, InvalidKeyException, NoSuchAlgorithmException, IOException, BadPaddingException, IllegalBlockSizeException, InvalidAlgorithmParameterException, JSONException {
if (StringUtil.isBlank(code)) {
return ServerResponse.createByErrorMessage("code 值不允许为空");
return utils.ServerResponse.createByErrorMessage("code 值不允许为空");
}
String sessionKey = CACHE.getIfPresent(code);
if (StringUtil.isBlank(sessionKey)) {
......@@ -98,6 +97,6 @@ public class MiniAppService {
}
String result = WXBizDataCrypt.getInstance().decrypt(encryptedData, sessionKey, iv, "utf-8");
SessionKeyVo sessionKeyVo = JsonUtil.fromJson(result, SessionKeyVo.class);
return ServerResponse.createBySuccess(sessionKeyVo);
return utils.ServerResponse.createBySuccess(sessionKeyVo);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment