Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
8c772fce
Commit
8c772fce
authored
Sep 28, 2023
by
muhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 支付宝获取user_id
parent
39991996
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
221 additions
and
18 deletions
+221
-18
ch-dao/src/main/java/com/wwdz/ch/db/domain/User.java
ch-dao/src/main/java/com/wwdz/ch/db/domain/User.java
+10
-1
ch-dao/src/main/java/com/wwdz/ch/db/domain/UserExample.java
ch-dao/src/main/java/com/wwdz/ch/db/domain/UserExample.java
+142
-0
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/UserMapper.xml
...o/src/main/resources/com/wwdz/ch/db/mapper/UserMapper.xml
+29
-14
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/request/UserRequestDto.java
...in/java/com/wwdz/ch/wx/entity/request/UserRequestDto.java
+1
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
...pi/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
+6
-3
ch-wx-api/src/main/java/com/wwdz/ch/wx/manager/AlipayLoginManager.java
.../main/java/com/wwdz/ch/wx/manager/AlipayLoginManager.java
+33
-0
No files found.
ch-dao/src/main/java/com/wwdz/ch/db/domain/User.java
View file @
8c772fce
...
@@ -9,7 +9,7 @@ import java.util.Date;
...
@@ -9,7 +9,7 @@ import java.util.Date;
/**
/**
* @author shiyu
* @author shiyu
* @date 2023/0
8/07
* @date 2023/0
9/28
*/
*/
@Data
@Data
public
class
User
implements
Serializable
{
public
class
User
implements
Serializable
{
...
@@ -98,6 +98,11 @@ public class User implements Serializable {
...
@@ -98,6 +98,11 @@ public class User implements Serializable {
*/
*/
private
String
weixinOpenid
;
private
String
weixinOpenid
;
/**
* 支付宝user_id
*/
private
String
alipayUserId
;
/**
/**
* 微信号
* 微信号
*/
*/
...
@@ -147,6 +152,7 @@ public class User implements Serializable {
...
@@ -147,6 +152,7 @@ public class User implements Serializable {
sb
.
append
(
", profile="
).
append
(
profile
);
sb
.
append
(
", profile="
).
append
(
profile
);
sb
.
append
(
", background="
).
append
(
background
);
sb
.
append
(
", background="
).
append
(
background
);
sb
.
append
(
", weixinOpenid="
).
append
(
weixinOpenid
);
sb
.
append
(
", weixinOpenid="
).
append
(
weixinOpenid
);
sb
.
append
(
", alipayUserId="
).
append
(
alipayUserId
);
sb
.
append
(
", wechatId="
).
append
(
wechatId
);
sb
.
append
(
", wechatId="
).
append
(
wechatId
);
sb
.
append
(
", status="
).
append
(
status
);
sb
.
append
(
", status="
).
append
(
status
);
sb
.
append
(
", addTime="
).
append
(
addTime
);
sb
.
append
(
", addTime="
).
append
(
addTime
);
...
@@ -184,6 +190,7 @@ public class User implements Serializable {
...
@@ -184,6 +190,7 @@ public class User implements Serializable {
&&
(
this
.
getProfile
()
==
null
?
other
.
getProfile
()
==
null
:
this
.
getProfile
().
equals
(
other
.
getProfile
()))
&&
(
this
.
getProfile
()
==
null
?
other
.
getProfile
()
==
null
:
this
.
getProfile
().
equals
(
other
.
getProfile
()))
&&
(
this
.
getBackground
()
==
null
?
other
.
getBackground
()
==
null
:
this
.
getBackground
().
equals
(
other
.
getBackground
()))
&&
(
this
.
getBackground
()
==
null
?
other
.
getBackground
()
==
null
:
this
.
getBackground
().
equals
(
other
.
getBackground
()))
&&
(
this
.
getWeixinOpenid
()
==
null
?
other
.
getWeixinOpenid
()
==
null
:
this
.
getWeixinOpenid
().
equals
(
other
.
getWeixinOpenid
()))
&&
(
this
.
getWeixinOpenid
()
==
null
?
other
.
getWeixinOpenid
()
==
null
:
this
.
getWeixinOpenid
().
equals
(
other
.
getWeixinOpenid
()))
&&
(
this
.
getAlipayUserId
()
==
null
?
other
.
getAlipayUserId
()
==
null
:
this
.
getAlipayUserId
().
equals
(
other
.
getAlipayUserId
()))
&&
(
this
.
getWechatId
()
==
null
?
other
.
getWechatId
()
==
null
:
this
.
getWechatId
().
equals
(
other
.
getWechatId
()))
&&
(
this
.
getWechatId
()
==
null
?
other
.
getWechatId
()
==
null
:
this
.
getWechatId
().
equals
(
other
.
getWechatId
()))
&&
(
this
.
getStatus
()
==
null
?
other
.
getStatus
()
==
null
:
this
.
getStatus
().
equals
(
other
.
getStatus
()))
&&
(
this
.
getStatus
()
==
null
?
other
.
getStatus
()
==
null
:
this
.
getStatus
().
equals
(
other
.
getStatus
()))
&&
(
this
.
getAddTime
()
==
null
?
other
.
getAddTime
()
==
null
:
this
.
getAddTime
().
equals
(
other
.
getAddTime
()))
&&
(
this
.
getAddTime
()
==
null
?
other
.
getAddTime
()
==
null
:
this
.
getAddTime
().
equals
(
other
.
getAddTime
()))
...
@@ -210,6 +217,7 @@ public class User implements Serializable {
...
@@ -210,6 +217,7 @@ public class User implements Serializable {
result
=
prime
*
result
+
((
getProfile
()
==
null
)
?
0
:
getProfile
().
hashCode
());
result
=
prime
*
result
+
((
getProfile
()
==
null
)
?
0
:
getProfile
().
hashCode
());
result
=
prime
*
result
+
((
getBackground
()
==
null
)
?
0
:
getBackground
().
hashCode
());
result
=
prime
*
result
+
((
getBackground
()
==
null
)
?
0
:
getBackground
().
hashCode
());
result
=
prime
*
result
+
((
getWeixinOpenid
()
==
null
)
?
0
:
getWeixinOpenid
().
hashCode
());
result
=
prime
*
result
+
((
getWeixinOpenid
()
==
null
)
?
0
:
getWeixinOpenid
().
hashCode
());
result
=
prime
*
result
+
((
getAlipayUserId
()
==
null
)
?
0
:
getAlipayUserId
().
hashCode
());
result
=
prime
*
result
+
((
getWechatId
()
==
null
)
?
0
:
getWechatId
().
hashCode
());
result
=
prime
*
result
+
((
getWechatId
()
==
null
)
?
0
:
getWechatId
().
hashCode
());
result
=
prime
*
result
+
((
getStatus
()
==
null
)
?
0
:
getStatus
().
hashCode
());
result
=
prime
*
result
+
((
getStatus
()
==
null
)
?
0
:
getStatus
().
hashCode
());
result
=
prime
*
result
+
((
getAddTime
()
==
null
)
?
0
:
getAddTime
().
hashCode
());
result
=
prime
*
result
+
((
getAddTime
()
==
null
)
?
0
:
getAddTime
().
hashCode
());
...
@@ -252,6 +260,7 @@ public class User implements Serializable {
...
@@ -252,6 +260,7 @@ public class User implements Serializable {
profile
(
"profile"
,
"profile"
,
"VARCHAR"
,
false
),
profile
(
"profile"
,
"profile"
,
"VARCHAR"
,
false
),
background
(
"background"
,
"background"
,
"VARCHAR"
,
false
),
background
(
"background"
,
"background"
,
"VARCHAR"
,
false
),
weixinOpenid
(
"weixin_openid"
,
"weixinOpenid"
,
"VARCHAR"
,
false
),
weixinOpenid
(
"weixin_openid"
,
"weixinOpenid"
,
"VARCHAR"
,
false
),
alipayUserId
(
"alipay_user_id"
,
"alipayUserId"
,
"VARCHAR"
,
false
),
wechatId
(
"wechat_id"
,
"wechatId"
,
"VARCHAR"
,
false
),
wechatId
(
"wechat_id"
,
"wechatId"
,
"VARCHAR"
,
false
),
status
(
"status"
,
"status"
,
"TINYINT"
,
true
),
status
(
"status"
,
"status"
,
"TINYINT"
,
true
),
addTime
(
"add_time"
,
"addTime"
,
"TIMESTAMP"
,
false
),
addTime
(
"add_time"
,
"addTime"
,
"TIMESTAMP"
,
false
),
...
...
ch-dao/src/main/java/com/wwdz/ch/db/domain/UserExample.java
View file @
8c772fce
...
@@ -2113,6 +2113,148 @@ public class UserExample {
...
@@ -2113,6 +2113,148 @@ public class UserExample {
return
(
Criteria
)
this
;
return
(
Criteria
)
this
;
}
}
public
Criteria
andAlipayUserIdIsNull
()
{
addCriterion
(
"alipay_user_id is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andAlipayUserIdIsNotNull
()
{
addCriterion
(
"alipay_user_id is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andAlipayUserIdEqualTo
(
String
value
)
{
addCriterion
(
"alipay_user_id ="
,
value
,
"alipayUserId"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andAlipayUserIdEqualToColumn
(
User
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"alipay_user_id = "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andAlipayUserIdNotEqualTo
(
String
value
)
{
addCriterion
(
"alipay_user_id <>"
,
value
,
"alipayUserId"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andAlipayUserIdNotEqualToColumn
(
User
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"alipay_user_id <> "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andAlipayUserIdGreaterThan
(
String
value
)
{
addCriterion
(
"alipay_user_id >"
,
value
,
"alipayUserId"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andAlipayUserIdGreaterThanColumn
(
User
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"alipay_user_id > "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andAlipayUserIdGreaterThanOrEqualTo
(
String
value
)
{
addCriterion
(
"alipay_user_id >="
,
value
,
"alipayUserId"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andAlipayUserIdGreaterThanOrEqualToColumn
(
User
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"alipay_user_id >= "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andAlipayUserIdLessThan
(
String
value
)
{
addCriterion
(
"alipay_user_id <"
,
value
,
"alipayUserId"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andAlipayUserIdLessThanColumn
(
User
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"alipay_user_id < "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andAlipayUserIdLessThanOrEqualTo
(
String
value
)
{
addCriterion
(
"alipay_user_id <="
,
value
,
"alipayUserId"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andAlipayUserIdLessThanOrEqualToColumn
(
User
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"alipay_user_id <= "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andAlipayUserIdLike
(
String
value
)
{
addCriterion
(
"alipay_user_id like"
,
value
,
"alipayUserId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andAlipayUserIdNotLike
(
String
value
)
{
addCriterion
(
"alipay_user_id not like"
,
value
,
"alipayUserId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andAlipayUserIdIn
(
List
<
String
>
values
)
{
addCriterion
(
"alipay_user_id in"
,
values
,
"alipayUserId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andAlipayUserIdNotIn
(
List
<
String
>
values
)
{
addCriterion
(
"alipay_user_id not in"
,
values
,
"alipayUserId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andAlipayUserIdBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"alipay_user_id between"
,
value1
,
value2
,
"alipayUserId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andAlipayUserIdNotBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"alipay_user_id not between"
,
value1
,
value2
,
"alipayUserId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andWechatIdIsNull
()
{
public
Criteria
andWechatIdIsNull
()
{
addCriterion
(
"wechat_id is null"
);
addCriterion
(
"wechat_id is null"
);
return
(
Criteria
)
this
;
return
(
Criteria
)
this
;
...
...
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/UserMapper.xml
View file @
8c772fce
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
<result
column=
"profile"
jdbcType=
"VARCHAR"
property=
"profile"
/>
<result
column=
"profile"
jdbcType=
"VARCHAR"
property=
"profile"
/>
<result
column=
"background"
jdbcType=
"VARCHAR"
property=
"background"
/>
<result
column=
"background"
jdbcType=
"VARCHAR"
property=
"background"
/>
<result
column=
"weixin_openid"
jdbcType=
"VARCHAR"
property=
"weixinOpenid"
/>
<result
column=
"weixin_openid"
jdbcType=
"VARCHAR"
property=
"weixinOpenid"
/>
<result
column=
"alipay_user_id"
jdbcType=
"VARCHAR"
property=
"alipayUserId"
/>
<result
column=
"wechat_id"
jdbcType=
"VARCHAR"
property=
"wechatId"
/>
<result
column=
"wechat_id"
jdbcType=
"VARCHAR"
property=
"wechatId"
/>
<result
column=
"status"
jdbcType=
"TINYINT"
property=
"status"
/>
<result
column=
"status"
jdbcType=
"TINYINT"
property=
"status"
/>
<result
column=
"add_time"
jdbcType=
"TIMESTAMP"
property=
"addTime"
/>
<result
column=
"add_time"
jdbcType=
"TIMESTAMP"
property=
"addTime"
/>
...
@@ -83,8 +84,8 @@
...
@@ -83,8 +84,8 @@
</sql>
</sql>
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
id, username, `password`, gender, birthday, last_login_time, last_login_ip, user_level,
id, username, `password`, gender, birthday, last_login_time, last_login_ip, user_level,
nickname, mobile, avatar, profile, background, weixin_openid,
wechat_id, `status`
,
nickname, mobile, avatar, profile, background, weixin_openid,
alipay_user_id, wechat_id
,
add_time, update_time, deleted, share_user_id
`status`,
add_time, update_time, deleted, share_user_id
</sql>
</sql>
<select
id=
"selectByExample"
parameterType=
"com.wwdz.ch.db.domain.UserExample"
resultMap=
"BaseResultMap"
>
<select
id=
"selectByExample"
parameterType=
"com.wwdz.ch.db.domain.UserExample"
resultMap=
"BaseResultMap"
>
select
select
...
@@ -120,8 +121,8 @@
...
@@ -120,8 +121,8 @@
</when>
</when>
<otherwise>
<otherwise>
id, username, `password`, gender, birthday, last_login_time, last_login_ip, user_level,
id, username, `password`, gender, birthday, last_login_time, last_login_ip, user_level,
nickname, mobile, avatar, profile, background, weixin_openid,
wechat_id, `status`
,
nickname, mobile, avatar, profile, background, weixin_openid,
alipay_user_id, wechat_id
,
add_time, update_time, deleted, share_user_id
`status`,
add_time, update_time, deleted, share_user_id
</otherwise>
</otherwise>
</choose>
</choose>
from user
from user
...
@@ -173,8 +174,8 @@
...
@@ -173,8 +174,8 @@
</when>
</when>
<otherwise>
<otherwise>
id, username, `password`, gender, birthday, last_login_time, last_login_ip, user_level,
id, username, `password`, gender, birthday, last_login_time, last_login_ip, user_level,
nickname, mobile, avatar, profile, background, weixin_openid,
wechat_id, `status`
,
nickname, mobile, avatar, profile, background, weixin_openid,
alipay_user_id, wechat_id
,
add_time, update_time, deleted, share_user_id
`status`,
add_time, update_time, deleted, share_user_id
</otherwise>
</otherwise>
</choose>
</choose>
from user
from user
...
@@ -198,16 +199,16 @@
...
@@ -198,16 +199,16 @@
birthday, last_login_time, last_login_ip,
birthday, last_login_time, last_login_ip,
user_level, nickname, mobile,
user_level, nickname, mobile,
avatar, profile, background,
avatar, profile, background,
weixin_openid,
wechat_id, `status`
,
weixin_openid,
alipay_user_id, wechat_id
,
add_time, update_time, deleted
,
`status`, add_time, update_time
,
share_user_id)
deleted,
share_user_id)
values (#{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{gender,jdbcType=TINYINT},
values (#{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{gender,jdbcType=TINYINT},
#{birthday,jdbcType=DATE}, #{lastLoginTime,jdbcType=TIMESTAMP}, #{lastLoginIp,jdbcType=VARCHAR},
#{birthday,jdbcType=DATE}, #{lastLoginTime,jdbcType=TIMESTAMP}, #{lastLoginIp,jdbcType=VARCHAR},
#{userLevel,jdbcType=TINYINT}, #{nickname,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR},
#{userLevel,jdbcType=TINYINT}, #{nickname,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR},
#{avatar,jdbcType=VARCHAR}, #{profile,jdbcType=VARCHAR}, #{background,jdbcType=VARCHAR},
#{avatar,jdbcType=VARCHAR}, #{profile,jdbcType=VARCHAR}, #{background,jdbcType=VARCHAR},
#{weixinOpenid,jdbcType=VARCHAR}, #{
wechatId,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT
},
#{weixinOpenid,jdbcType=VARCHAR}, #{
alipayUserId,jdbcType=VARCHAR}, #{wechatId,jdbcType=VARCHAR
},
#{
addTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=BIT
},
#{
status,jdbcType=TINYINT}, #{addTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP
},
#{shareUserId,jdbcType=BIGINT})
#{
deleted,jdbcType=BIT}, #{
shareUserId,jdbcType=BIGINT})
</insert>
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.wwdz.ch.db.domain.User"
>
<insert
id=
"insertSelective"
parameterType=
"com.wwdz.ch.db.domain.User"
>
<selectKey
keyProperty=
"id"
order=
"AFTER"
resultType=
"java.lang.Long"
>
<selectKey
keyProperty=
"id"
order=
"AFTER"
resultType=
"java.lang.Long"
>
...
@@ -254,6 +255,9 @@
...
@@ -254,6 +255,9 @@
<if
test=
"weixinOpenid != null"
>
<if
test=
"weixinOpenid != null"
>
weixin_openid,
weixin_openid,
</if>
</if>
<if
test=
"alipayUserId != null"
>
alipay_user_id,
</if>
<if
test=
"wechatId != null"
>
<if
test=
"wechatId != null"
>
wechat_id,
wechat_id,
</if>
</if>
...
@@ -313,6 +317,9 @@
...
@@ -313,6 +317,9 @@
<if
test=
"weixinOpenid != null"
>
<if
test=
"weixinOpenid != null"
>
#{weixinOpenid,jdbcType=VARCHAR},
#{weixinOpenid,jdbcType=VARCHAR},
</if>
</if>
<if
test=
"alipayUserId != null"
>
#{alipayUserId,jdbcType=VARCHAR},
</if>
<if
test=
"wechatId != null"
>
<if
test=
"wechatId != null"
>
#{wechatId,jdbcType=VARCHAR},
#{wechatId,jdbcType=VARCHAR},
</if>
</if>
...
@@ -384,6 +391,9 @@
...
@@ -384,6 +391,9 @@
<if
test=
"record.weixinOpenid != null"
>
<if
test=
"record.weixinOpenid != null"
>
weixin_openid = #{record.weixinOpenid,jdbcType=VARCHAR},
weixin_openid = #{record.weixinOpenid,jdbcType=VARCHAR},
</if>
</if>
<if
test=
"record.alipayUserId != null"
>
alipay_user_id = #{record.alipayUserId,jdbcType=VARCHAR},
</if>
<if
test=
"record.wechatId != null"
>
<if
test=
"record.wechatId != null"
>
wechat_id = #{record.wechatId,jdbcType=VARCHAR},
wechat_id = #{record.wechatId,jdbcType=VARCHAR},
</if>
</if>
...
@@ -423,6 +433,7 @@
...
@@ -423,6 +433,7 @@
profile = #{record.profile,jdbcType=VARCHAR},
profile = #{record.profile,jdbcType=VARCHAR},
background = #{record.background,jdbcType=VARCHAR},
background = #{record.background,jdbcType=VARCHAR},
weixin_openid = #{record.weixinOpenid,jdbcType=VARCHAR},
weixin_openid = #{record.weixinOpenid,jdbcType=VARCHAR},
alipay_user_id = #{record.alipayUserId,jdbcType=VARCHAR},
wechat_id = #{record.wechatId,jdbcType=VARCHAR},
wechat_id = #{record.wechatId,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=TINYINT},
`status` = #{record.status,jdbcType=TINYINT},
add_time = #{record.addTime,jdbcType=TIMESTAMP},
add_time = #{record.addTime,jdbcType=TIMESTAMP},
...
@@ -475,6 +486,9 @@
...
@@ -475,6 +486,9 @@
<if
test=
"weixinOpenid != null"
>
<if
test=
"weixinOpenid != null"
>
weixin_openid = #{weixinOpenid,jdbcType=VARCHAR},
weixin_openid = #{weixinOpenid,jdbcType=VARCHAR},
</if>
</if>
<if
test=
"alipayUserId != null"
>
alipay_user_id = #{alipayUserId,jdbcType=VARCHAR},
</if>
<if
test=
"wechatId != null"
>
<if
test=
"wechatId != null"
>
wechat_id = #{wechatId,jdbcType=VARCHAR},
wechat_id = #{wechatId,jdbcType=VARCHAR},
</if>
</if>
...
@@ -511,6 +525,7 @@
...
@@ -511,6 +525,7 @@
profile = #{profile,jdbcType=VARCHAR},
profile = #{profile,jdbcType=VARCHAR},
background = #{background,jdbcType=VARCHAR},
background = #{background,jdbcType=VARCHAR},
weixin_openid = #{weixinOpenid,jdbcType=VARCHAR},
weixin_openid = #{weixinOpenid,jdbcType=VARCHAR},
alipay_user_id = #{alipayUserId,jdbcType=VARCHAR},
wechat_id = #{wechatId,jdbcType=VARCHAR},
wechat_id = #{wechatId,jdbcType=VARCHAR},
`status` = #{status,jdbcType=TINYINT},
`status` = #{status,jdbcType=TINYINT},
add_time = #{addTime,jdbcType=TIMESTAMP},
add_time = #{addTime,jdbcType=TIMESTAMP},
...
@@ -553,8 +568,8 @@
...
@@ -553,8 +568,8 @@
</when>
</when>
<otherwise>
<otherwise>
id, username, `password`, gender, birthday, last_login_time, last_login_ip, user_level,
id, username, `password`, gender, birthday, last_login_time, last_login_ip, user_level,
nickname, mobile, avatar, profile, background, weixin_openid,
wechat_id, `status`
,
nickname, mobile, avatar, profile, background, weixin_openid,
alipay_user_id, wechat_id
,
add_time, update_time, deleted, share_user_id
`status`,
add_time, update_time, deleted, share_user_id
</otherwise>
</otherwise>
</choose>
</choose>
from user
from user
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/request/UserRequestDto.java
View file @
8c772fce
...
@@ -25,4 +25,5 @@ public class UserRequestDto implements Entity {
...
@@ -25,4 +25,5 @@ public class UserRequestDto implements Entity {
// 快捷登录方式(1、微信,2、支付宝,3、抖音)
// 快捷登录方式(1、微信,2、支付宝,3、抖音)
private
Integer
loginType
;
private
Integer
loginType
;
private
String
wxOpenId
;
private
String
wxOpenId
;
private
String
alipayUserId
;
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
View file @
8c772fce
...
@@ -179,6 +179,7 @@ public class UserServiceImpl implements UserService {
...
@@ -179,6 +179,7 @@ public class UserServiceImpl implements UserService {
if
(
StringUtils
.
equals
(
"false"
,
mobile
))
{
if
(
StringUtils
.
equals
(
"false"
,
mobile
))
{
return
Result
.
failed
(
"用户信息解密失败"
);
return
Result
.
failed
(
"用户信息解密失败"
);
}
}
dto
.
setAlipayUserId
(
alipayLoginManager
.
getAlipayUserId
(
dto
.
getLoginCode
()));
}
}
if
(
dto
.
getLoginType
().
equals
(
LoginTypeEnum
.
TIKTOK
.
getCode
()))
{
if
(
dto
.
getLoginType
().
equals
(
LoginTypeEnum
.
TIKTOK
.
getCode
()))
{
String
sessionKey
=
tikTokLoginManager
.
getSessionKey
(
dto
.
getLoginCode
());
String
sessionKey
=
tikTokLoginManager
.
getSessionKey
(
dto
.
getLoginCode
());
...
@@ -456,9 +457,8 @@ public class UserServiceImpl implements UserService {
...
@@ -456,9 +457,8 @@ public class UserServiceImpl implements UserService {
user
.
setWechatId
(
""
);
user
.
setWechatId
(
""
);
user
.
setMobile
(
dto
.
getMobile
());
user
.
setMobile
(
dto
.
getMobile
());
user
.
setAvatar
(
avatarUrl
);
user
.
setAvatar
(
avatarUrl
);
if
(
StringUtils
.
isNotBlank
(
dto
.
getWxOpenId
()))
{
user
.
setWeixinOpenid
(
dto
.
getWxOpenId
());
user
.
setWeixinOpenid
(
dto
.
getWxOpenId
());
}
user
.
setAlipayUserId
(
dto
.
getAlipayUserId
());
while
(
true
)
{
while
(
true
)
{
String
nickname
=
"收藏家"
+
StringUtil
.
generateRandomString
(
10
);
String
nickname
=
"收藏家"
+
StringUtil
.
generateRandomString
(
10
);
if
(!
userDao
.
isExistedByNickname
(
0L
,
nickname
))
{
if
(!
userDao
.
isExistedByNickname
(
0L
,
nickname
))
{
...
@@ -480,6 +480,9 @@ public class UserServiceImpl implements UserService {
...
@@ -480,6 +480,9 @@ public class UserServiceImpl implements UserService {
if
(
StringUtils
.
isNotBlank
(
dto
.
getWxOpenId
()))
{
if
(
StringUtils
.
isNotBlank
(
dto
.
getWxOpenId
()))
{
user
.
setWeixinOpenid
(
dto
.
getWxOpenId
());
user
.
setWeixinOpenid
(
dto
.
getWxOpenId
());
}
}
if
(
StringUtils
.
isNotBlank
(
dto
.
getAlipayUserId
()))
{
user
.
setAlipayUserId
(
dto
.
getAlipayUserId
());
}
user
.
setLastLoginTime
(
new
Date
());
user
.
setLastLoginTime
(
new
Date
());
user
.
setLastLoginIp
(
IpUtil
.
client
(
request
));
user
.
setLastLoginIp
(
IpUtil
.
client
(
request
));
if
(
userDao
.
updateById
(
user
)
==
0
)
{
if
(
userDao
.
updateById
(
user
)
==
0
)
{
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/manager/AlipayLoginManager.java
View file @
8c772fce
...
@@ -5,11 +5,14 @@ import com.alibaba.fastjson.TypeReference;
...
@@ -5,11 +5,14 @@ import com.alibaba.fastjson.TypeReference;
import
com.alibaba.fastjson.parser.Feature
;
import
com.alibaba.fastjson.parser.Feature
;
import
com.alipay.api.AlipayApiException
;
import
com.alipay.api.AlipayApiException
;
import
com.alipay.api.AlipayClient
;
import
com.alipay.api.AlipayClient
;
import
com.alipay.api.AlipayConfig
;
import
com.alipay.api.DefaultAlipayClient
;
import
com.alipay.api.DefaultAlipayClient
;
import
com.alipay.api.internal.util.AlipayEncrypt
;
import
com.alipay.api.internal.util.AlipayEncrypt
;
import
com.alipay.api.internal.util.AlipaySignature
;
import
com.alipay.api.internal.util.AlipaySignature
;
import
com.alipay.api.request.AlipayOpenAppQrcodeCreateRequest
;
import
com.alipay.api.request.AlipayOpenAppQrcodeCreateRequest
;
import
com.alipay.api.request.AlipaySystemOauthTokenRequest
;
import
com.alipay.api.response.AlipayOpenAppQrcodeCreateResponse
;
import
com.alipay.api.response.AlipayOpenAppQrcodeCreateResponse
;
import
com.alipay.api.response.AlipaySystemOauthTokenResponse
;
import
com.xxdxxs.utils.JsonUtils
;
import
com.xxdxxs.utils.JsonUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -90,6 +93,36 @@ public class AlipayLoginManager {
...
@@ -90,6 +93,36 @@ public class AlipayLoginManager {
return
JsonUtils
.
getValueByPath
(
plainData
,
"mobile"
);
return
JsonUtils
.
getValueByPath
(
plainData
,
"mobile"
);
}
}
public
String
getAlipayUserId
(
String
loginCode
)
{
logger
.
info
(
"开始解密获取支付宝小程序登录用户的access_token"
);
AlipayConfig
alipayConfig
=
new
AlipayConfig
();
alipayConfig
.
setServerUrl
(
"https://openapi.alipay.com/gateway.do"
);
alipayConfig
.
setAppId
(
appid
);
alipayConfig
.
setPrivateKey
(
privateKey
);
alipayConfig
.
setFormat
(
"json"
);
alipayConfig
.
setAlipayPublicKey
(
signVeriKey
);
alipayConfig
.
setCharset
(
"UTF8"
);
alipayConfig
.
setSignType
(
"RSA2"
);
try
{
AlipayClient
alipayClient
=
new
DefaultAlipayClient
(
alipayConfig
);
AlipaySystemOauthTokenRequest
request
=
new
AlipaySystemOauthTokenRequest
();
request
.
setCode
(
loginCode
);
request
.
setGrantType
(
"authorization_code"
);
AlipaySystemOauthTokenResponse
response
=
alipayClient
.
execute
(
request
);
logger
.
info
(
"调用支付宝小程序获取登录用户的access_token的结果:"
+
response
.
getBody
());
if
(
response
.
isSuccess
())
{
logger
.
info
(
"调用支付宝小程序获取登录用户的access_token成功"
);
return
JsonUtils
.
getValueByPath
(
response
.
getBody
(),
"alipay_system_oauth_token_response/user_id"
);
}
else
{
logger
.
info
(
"调用支付宝小程序获取登录用户的access_token失败"
);
return
""
;
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"调用支付宝小程序获取登录用户的access_token异常"
);
return
""
;
}
}
/**
/**
* 获取二维码
* 获取二维码
*
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment