diff --git a/pom.xml b/pom.xml
index d686706..e3232c2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -89,6 +89,18 @@
31.1-jre
+
+
+ org.projectlombok
+ lombok
+ true
+
+
+
+ com.squareup.okhttp3
+ okhttp
+ 4.10.0
+
org.springframework.boot
@@ -194,12 +206,6 @@
spring-boot-starter-thymeleaf
-
- org.projectlombok
- lombok
- true
-
-
diff --git a/src/main/java/com/northtecom/visatrack/api/controller/api/CrawlController.java b/src/main/java/com/northtecom/visatrack/api/controller/api/CrawlController.java
index da74a11..67ea65c 100644
--- a/src/main/java/com/northtecom/visatrack/api/controller/api/CrawlController.java
+++ b/src/main/java/com/northtecom/visatrack/api/controller/api/CrawlController.java
@@ -6,7 +6,7 @@ import com.northtecom.visatrack.api.base.web.Status;
import com.northtecom.visatrack.api.controller.vo.ImportReportRequest;
import com.northtecom.visatrack.api.controller.vo.VisaCrawlRequest;
import com.northtecom.visatrack.api.data.spec.DateRange;
-import com.northtecom.visatrack.api.model.api.request.CheckeeSyncRequest;
+import com.northtecom.visatrack.api.model.request.api.CheckeeSyncRequest;
import com.northtecom.visatrack.api.service.impl.CrawlService;
import com.northtecom.visatrack.api.service.impl.VisaCaseService;
import com.northtecom.visatrack.api.service.impl.VisaReportCheckeeService;
diff --git a/src/main/java/com/northtecom/visatrack/api/controller/auth/WeChatController.java b/src/main/java/com/northtecom/visatrack/api/controller/auth/WeChatController.java
index 4163540..3357efc 100644
--- a/src/main/java/com/northtecom/visatrack/api/controller/auth/WeChatController.java
+++ b/src/main/java/com/northtecom/visatrack/api/controller/auth/WeChatController.java
@@ -2,15 +2,24 @@ package com.northtecom.visatrack.api.controller.auth;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.northtecom.visatrack.api.controller.vo.ForgotPasswordRequest;
+import com.northtecom.visatrack.api.controller.vo.UserChangePasswordResponse;
+import com.northtecom.visatrack.api.data.entity.UserChangePassword;
+import com.northtecom.visatrack.api.model.request.auth.WeChatTokenizeRequest;
import com.northtecom.visatrack.api.service.impl.UserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
+import okhttp3.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.ResponseBody;
+import javax.validation.Valid;
+import java.io.IOException;
import java.util.UUID;
/**
@@ -58,10 +67,35 @@ public class WeChatController {
qrconnect.append("state=" + UUID.randomUUID().toString() + "#wechat_redirect");
- https:
-//open.weixin.qq.com/connect/qrconnect?appid=wxbdc5610cc59c1631&redirect_uri=https%3A%2F%2Fpassport.yhd.com%2Fwechat%2Fcallback.do&response_type=code&scope=snsapi_login&state=3d6be0a4035d839573b04816624a415e#wechat_redirect
-
return qrconnect.toString();
}
+ @PostMapping("/tokenize")
+ @ResponseBody
+ @Operation(summary = "用户忘记密码接口", description = "用户忘记密码接口,用户忘记密码以后,通过该接口输入一个邮件地址,系统会给用户发送一封邮件,邮件中包含了重置密码的链接,用户点击以后,可以重置密码")
+ public String getWeChatAccessToken(@RequestBody @Valid WeChatTokenizeRequest weChatTokenizeRequest) throws IOException {
+ OkHttpClient client = new OkHttpClient();
+
+ String weChatAppId = "wx26e01c2be46730f3";
+ String weChatSecret = "1eef340a999bc71b431dda85e9bffd3a";
+ String weChatCode = weChatTokenizeRequest.getWeChatCode();
+ String weChatState = weChatTokenizeRequest.getWeChatState();
+
+ HttpUrl.Builder urlBuilder = HttpUrl.parse("https://api.weixin.qq.com/sns/oauth2/access_token").newBuilder();
+ urlBuilder.addQueryParameter("appid", weChatAppId);
+ urlBuilder.addQueryParameter("secret", weChatSecret);
+ urlBuilder.addQueryParameter("code", weChatCode);
+ urlBuilder.addQueryParameter("grant_type", "authorization_code");
+
+ String url = urlBuilder.build().toString();
+
+ Request request = new Request.Builder().url(url).build();
+ Call call = client.newCall(request);
+
+ Response response = call.execute();
+
+
+ return url;
+ }
+
}
diff --git a/src/main/java/com/northtecom/visatrack/api/data/entity/User.java b/src/main/java/com/northtecom/visatrack/api/data/entity/User.java
index 4cf849c..2faba1d 100644
--- a/src/main/java/com/northtecom/visatrack/api/data/entity/User.java
+++ b/src/main/java/com/northtecom/visatrack/api/data/entity/User.java
@@ -19,6 +19,18 @@ import java.time.LocalDateTime;
@org.hibernate.annotations.Table(appliesTo = "user", comment = "Customer user for us visa track")
public class User extends BaseEntity {
+ /**
+ * User name
+ */
+ @Column(name = "wechat_unionid", columnDefinition = "varchar(128) COMMENT 'WeChat unionid'")
+ private String wechatUnionid;
+
+ /**
+ * User name
+ */
+ @Column(name = "wechat_openid", columnDefinition = "varchar(128) COMMENT 'WeChat Openid'")
+ private String wechatOpenid;
+
/**
* User name
*/
diff --git a/src/main/java/com/northtecom/visatrack/api/model/api/request/CheckeeSyncRequest.java b/src/main/java/com/northtecom/visatrack/api/model/request/api/CheckeeSyncRequest.java
similarity index 85%
rename from src/main/java/com/northtecom/visatrack/api/model/api/request/CheckeeSyncRequest.java
rename to src/main/java/com/northtecom/visatrack/api/model/request/api/CheckeeSyncRequest.java
index 2f11eea..4eb12f8 100644
--- a/src/main/java/com/northtecom/visatrack/api/model/api/request/CheckeeSyncRequest.java
+++ b/src/main/java/com/northtecom/visatrack/api/model/request/api/CheckeeSyncRequest.java
@@ -1,4 +1,4 @@
-package com.northtecom.visatrack.api.model.api.request;
+package com.northtecom.visatrack.api.model.request.api;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;