Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gdtel-gztel-school-center
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
吴学德
gdtel-gztel-school-center
Commits
f67da0a4
Commit
f67da0a4
authored
Feb 22, 2021
by
罗承锋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加移动端非微信授权登录,修改线上版本配置
parent
0f5790e1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
38 deletions
+53
-38
apply-net/src/main/java/com/winsun/controller/SyncController.java
+2
-2
core-service/src/main/java/com/winsun/item/modular/system/controller/LoginPwdController.java
+46
-31
core-service/src/main/resources/application-prod.yml
+2
-2
service-manager/src/main/resources/application-prod.yml
+3
-3
No files found.
apply-net/src/main/java/com/winsun/controller/SyncController.java
View file @
f67da0a4
...
@@ -196,7 +196,7 @@ public class SyncController {
...
@@ -196,7 +196,7 @@ public class SyncController {
orderView
.
setOrderName
(
order
.
getCustomerName
());
orderView
.
setOrderName
(
order
.
getCustomerName
());
orderView
.
setOrderPhone
(
order
.
getContactNumber
());
orderView
.
setOrderPhone
(
order
.
getContactNumber
());
orderView
.
setOrderNumber
(
order
.
getIdCard
());
orderView
.
setOrderNumber
(
order
.
getIdCard
());
orderView
.
setProductName
(
"中国电信校园高速宽带"
);
orderView
.
setProductName
(
jsonObject
.
getString
(
"prodName"
)
);
orderView
.
setOrderSetMeal
(
"无人厅"
);
orderView
.
setOrderSetMeal
(
"无人厅"
);
orderView
.
setOrderDate
(
order
.
getCreateTime
());
orderView
.
setOrderDate
(
order
.
getCreateTime
());
orderView
.
setOrderUniversityName
(
order
.
getHehuorenSchool
());
orderView
.
setOrderUniversityName
(
order
.
getHehuorenSchool
());
...
@@ -256,7 +256,7 @@ public class SyncController {
...
@@ -256,7 +256,7 @@ public class SyncController {
if
(
jsonObject
.
getString
(
"termNo"
)
==
null
// 终端编码
if
(
jsonObject
.
getString
(
"termNo"
)
==
null
// 终端编码
||
jsonObject
.
getString
(
"orderTime"
)
==
null
// 订单时间
||
jsonObject
.
getString
(
"orderTime"
)
==
null
// 订单时间
||
jsonObject
.
getString
(
"prodName"
)
==
null
//
时间戳
||
jsonObject
.
getString
(
"prodName"
)
==
null
//
产品名
||
jsonObject
.
getString
(
"custName"
)
==
null
//客户姓名
||
jsonObject
.
getString
(
"custName"
)
==
null
//客户姓名
||
jsonObject
.
getString
(
"recNo"
)
==
null
// 订单流水号
||
jsonObject
.
getString
(
"recNo"
)
==
null
// 订单流水号
||
jsonObject
.
getString
(
"userName"
)
==
null
// 合伙人账号
||
jsonObject
.
getString
(
"userName"
)
==
null
// 合伙人账号
...
...
core-service/src/main/java/com/winsun/item/modular/system/controller/LoginPwdController.java
View file @
f67da0a4
...
@@ -268,7 +268,7 @@ public class LoginPwdController extends BaseController {
...
@@ -268,7 +268,7 @@ public class LoginPwdController extends BaseController {
String
username
,
String
verificationCode
,
String
username
,
String
verificationCode
,
@RequestParam
(
value
=
"remember"
,
defaultValue
=
"false"
)
boolean
remember
)
{
@RequestParam
(
value
=
"remember"
,
defaultValue
=
"false"
)
boolean
remember
)
{
log
.
info
(
accessToken
+
":"
+
openid
+
":"
+
":"
+
username
+
":"
+
verificationCode
+
":"
+
remember
);
log
.
info
(
accessToken
+
":"
+
openid
+
":"
+
":"
+
username
+
":"
+
verificationCode
+
":"
+
remember
);
if
(
StringUtils
.
isBlank
(
accessToken
)
||
StringUtils
.
isBlank
(
openid
)
||
StringUtils
.
isBlank
(
username
)
||
StringUtils
.
isBlank
(
verificationCode
))
{
if
(
StringUtils
.
isBlank
(
username
)
||
StringUtils
.
isBlank
(
verificationCode
))
{
return
ResponseData
.
error
(
"绑定失败,授权失效或账号验证码为空!"
);
return
ResponseData
.
error
(
"绑定失败,授权失效或账号验证码为空!"
);
}
}
String
str
=
stringRedisTemplate
.
opsForValue
().
get
(
username
+
GETPHONECODE
);
String
str
=
stringRedisTemplate
.
opsForValue
().
get
(
username
+
GETPHONECODE
);
...
@@ -284,39 +284,54 @@ public class LoginPwdController extends BaseController {
...
@@ -284,39 +284,54 @@ public class LoginPwdController extends BaseController {
if
(
users
.
size
()
==
0
)
{
if
(
users
.
size
()
==
0
)
{
return
ResponseData
.
error
(
"当前账号有误!"
);
return
ResponseData
.
error
(
"当前账号有误!"
);
}
}
log
.
info
(
"openId:"
+
openid
);
String
url1
=
"https://api.weixin.qq.com/sns/userinfo?access_token="
+
accessToken
+
"&openid="
+
openid
+
"&lang=zh_CN"
;
String
jsonObject1
=
null
;
try
{
jsonObject1
=
HttpHelper
.
sendGet
(
url1
);
}
catch
(
Exception
e
)
{
log
.
error
(
"微信登录获取用户信息失败"
+
e
.
getMessage
(),
e
);
}
if
(
StringUtils
.
isBlank
(
jsonObject1
))
{
return
ResponseData
.
error
(
"微信授权失效,请重新授权!"
);
}
if
(!
jsonObject1
.
contains
(
"openid"
)){
return
ResponseData
.
error
(
"微信授权失效,请重新授权!"
);
}
log
.
info
(
jsonObject1
);
Map
<
String
,
Object
>
map1
=
JSON
.
parseObject
(
jsonObject1
,
Map
.
class
);
String
headimgurl
=
map1
.
get
(
"headimgurl"
).
toString
();
String
nickname
=
map1
.
get
(
"nickname"
).
toString
();
SysUser
sysUser
=
users
.
get
(
0
);
SysUser
sysUser
=
users
.
get
(
0
);
Wrapper
wrapper
=
new
EntityWrapper
<>();
// 没有openid和accessToken直接登录,不访问微信
wrapper
.
eq
(
"id"
,
sysUser
.
getId
());
if
(
StringUtils
.
isNotBlank
(
openid
)
&&
StringUtils
.
isNotBlank
(
accessToken
))
{
Map
<
String
,
Object
>
dataMapping
=
new
HashMap
<>();
log
.
info
(
"openId:"
+
openid
);
// 不绑定微信则不保存openId
String
url1
=
"https://api.weixin.qq.com/sns/userinfo?access_token="
+
accessToken
+
"&openid="
+
openid
+
"&lang=zh_CN"
;
if
(
remember
)
{
String
jsonObject1
=
null
;
dataMapping
.
put
(
"open_id"
,
openid
);
try
{
}
jsonObject1
=
HttpHelper
.
sendGet
(
url1
);
}
catch
(
Exception
e
)
{
log
.
error
(
"微信登录获取用户信息失败"
+
e
.
getMessage
(),
e
);
}
if
(
StringUtils
.
isBlank
(
jsonObject1
))
{
return
ResponseData
.
error
(
"微信授权失效,请重新授权!"
);
}
if
(!
jsonObject1
.
contains
(
"openid"
)){
return
ResponseData
.
error
(
"微信授权失效,请重新授权!"
);
}
log
.
info
(
jsonObject1
);
Map
<
String
,
Object
>
map1
=
JSON
.
parseObject
(
jsonObject1
,
Map
.
class
);
String
headimgurl
=
map1
.
get
(
"headimgurl"
).
toString
();
String
nickname
=
map1
.
get
(
"nickname"
).
toString
();
Wrapper
wrapper
=
new
EntityWrapper
<>();
wrapper
.
eq
(
"id"
,
sysUser
.
getId
());
Map
<
String
,
Object
>
dataMapping
=
new
HashMap
<>();
// 不绑定微信则不保存openId
if
(
remember
)
{
dataMapping
.
put
(
"open_id"
,
openid
);
}
dataMapping
.
put
(
"wx_head_img_url"
,
headimgurl
);
dataMapping
.
put
(
"wx_head_img_url"
,
headimgurl
);
dataMapping
.
put
(
"wx_nick_name"
,
nickname
);
dataMapping
.
put
(
"wx_nick_name"
,
nickname
);
Integer
integer
=
hhrUserMapper
.
updateForSet
(
MyBatisPlusUpdateUtils
.
toUpdateSet
(
dataMapping
),
wrapper
);
Integer
integer
=
hhrUserMapper
.
updateForSet
(
MyBatisPlusUpdateUtils
.
toUpdateSet
(
dataMapping
),
wrapper
);
if
(
integer
==
1
)
{
if
(
integer
==
1
)
{
return
this
.
loginvalid
(
null
,
sysUser
.
getAccount
(),
openid
);
return
this
.
loginvalid
(
null
,
sysUser
.
getAccount
(),
openid
);
}
}
else
{
// 查询openid,模拟微信登录
HhrUser
hhrUser
=
hhrUserMapper
.
selectById
(
sysUser
.
getId
());
if
(
hhrUser
==
null
)
{
return
ResponseData
.
error
(
"合伙人信息有误!"
);
}
if
(
StringUtils
.
isBlank
(
hhrUser
.
getOpenId
()))
{
return
ResponseData
.
error
(
"请先在一人一码中绑定微信登录"
);
}
return
this
.
loginvalid
(
null
,
sysUser
.
getAccount
(),
hhrUser
.
getOpenId
());
}
}
return
ResponseData
.
error
(
"绑定失败!"
);
return
ResponseData
.
error
(
"绑定失败!"
);
}
}
...
...
core-service/src/main/resources/application-prod.yml
View file @
f67da0a4
...
@@ -96,8 +96,8 @@ spring:
...
@@ -96,8 +96,8 @@ spring:
prohibition
:
600
prohibition
:
600
datasource
:
datasource
:
url
:
jdbc:mysql://localhost:3306/school_center?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=CTT&allowPublicKeyRetrieval=true
url
:
jdbc:mysql://localhost:3306/school_center?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=CTT&allowPublicKeyRetrieval=true
username
:
yzzx
username
:
root
password
:
yzzx123!@#
password
:
AMrGBg6ZSsRrDLs6
#用来搜集数据库的所有表
#用来搜集数据库的所有表
db-name
:
guns
db-name
:
guns
filters
:
wall,mergeStat
filters
:
wall,mergeStat
...
...
service-manager/src/main/resources/application-prod.yml
View file @
f67da0a4
...
@@ -131,9 +131,9 @@ spring:
...
@@ -131,9 +131,9 @@ spring:
max-active
:
30
max-active
:
30
datasource
:
datasource
:
master
:
master
:
url
:
jdbc:mysql://localhost:3306/school_center?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=CTT&allowPublicKeyRetrieval=true
url
:
${spring.datasource.url}
username
:
yzzx
username
:
${spring.datasource.username}
password
:
yzzx123!@#
password
:
${spring.datasource.password}
driver-class-name
:
com.mysql.cj.jdbc.Driver
driver-class-name
:
com.mysql.cj.jdbc.Driver
devtools
:
devtools
:
restart
:
restart
:
...
...
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