Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
hphy
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
向怀芳
hphy
Commits
8d82fb17
Commit
8d82fb17
authored
Jan 13, 2023
by
gaozhaochen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add: 中智公众号对接
parent
a9b851b0
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
168 additions
and
3 deletions
+168
-3
LoginTypeEnum.java
.../sict/cloud/common/core/constant/enums/LoginTypeEnum.java
+5
-0
WOAZzUserInfo.java
...a/cn/sh/stc/sict/cloud/common/core/dto/WOAZzUserInfo.java
+26
-0
WoaUtil.java
...n/java/cn/sh/stc/sict/cloud/common/core/util/WoaUtil.java
+30
-0
SictUserDetailsServiceImpl.java
...d/common/security/service/SictUserDetailsServiceImpl.java
+3
-0
SysUserBaseServiceImpl.java
.../sict/cloud/upms/service/impl/SysUserBaseServiceImpl.java
+53
-0
HphyPatientBaseController.java
...t/theme/hphy/controller/mp/HphyPatientBaseController.java
+7
-0
HphyPatientBaseService.java
...h/stc/sict/theme/hphy/service/HphyPatientBaseService.java
+12
-2
HphyPatientBaseServiceImpl.java
...t/theme/hphy/service/impl/HphyPatientBaseServiceImpl.java
+32
-1
No files found.
cloud-common/cloud-common-core/src/main/java/cn/sh/stc/sict/cloud/common/core/constant/enums/LoginTypeEnum.java
View file @
8d82fb17
...
...
@@ -37,6 +37,11 @@ public enum LoginTypeEnum {
*/
WOA_NL
(
"woa_nl"
,
"纳里用户系统公众号登录"
),
/**
* 打浦桥,外滩,小东门,老西门,豫园,五里桥,淮海,瑞二
*/
WOA_ZZ
(
"woa_zz"
,
"中智用户系统公众号登录"
),
/**
* H5登录
*/
...
...
cloud-common/cloud-common-core/src/main/java/cn/sh/stc/sict/cloud/common/core/dto/WOAZzUserInfo.java
0 → 100644
View file @
8d82fb17
package
cn
.
sh
.
stc
.
sict
.
cloud
.
common
.
core
.
dto
;
import
lombok.Data
;
import
java.util.Date
;
/**
* 中智公众号-用户基础信息
*
* @author gao
* @date 2023/01/13 09:39
*/
@Data
public
class
WOAZzUserInfo
{
private
String
id
;
private
String
username
;
private
String
personcard
;
private
String
mobile
;
private
String
avator
;
private
Byte
gender
;
private
Integer
verifyStatus
;
private
Date
regtime
;
private
String
openid
;
}
cloud-common/cloud-common-core/src/main/java/cn/sh/stc/sict/cloud/common/core/util/WoaUtil.java
View file @
8d82fb17
...
...
@@ -2,7 +2,10 @@ package cn.sh.stc.sict.cloud.common.core.util;
import
cn.hutool.core.collection.ListUtil
;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.json.JSONUtil
;
import
cn.sh.stc.sict.cloud.common.core.dto.WOAZzUserInfo
;
import
cn.sh.stc.sict.cloud.common.core.dto.XSZYUserInfo
;
import
lombok.experimental.UtilityClass
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -87,4 +90,31 @@ public class WoaUtil {
}
}
/**
* 中智公众号用户url
* 打浦桥,外滩,小东门,老西门,豫园,五里桥,淮海,瑞二
*/
private
final
static
String
WOA_ZZ_PROXY_PASS_URL
=
"http://30.30.5.74:9988/woa/zz"
;
// private final static String WOA_ZZ_PROXY_PASS_URL = "https://booking.hpdapuqiao.com";
private
final
static
String
ZZ_USER_INFO_API_URL
=
WOA_ZZ_PROXY_PASS_URL
+
"/api/Other/GetPerson"
;
public
WOAZzUserInfo
getZzUserInfo
(
String
accessToken
)
{
try
{
HttpResponse
response
=
HttpRequest
.
get
(
ZZ_USER_INFO_API_URL
)
.
header
(
"access-token"
,
accessToken
)
.
execute
();
if
(
response
.
getStatus
()
!=
200
)
{
log
.
error
(
"中智获取用户信息异常-1"
);
return
null
;
}
return
JSONUtil
.
toBean
(
response
.
body
(),
WOAZzUserInfo
.
class
);
}
catch
(
Exception
ex
)
{
log
.
error
(
"中智token获取用户信息异-2!"
);
log
.
error
(
ex
.
getMessage
(),
ex
);
return
null
;
}
}
}
cloud-common/cloud-common-security/src/main/java/cn/sh/stc/sict/cloud/common/security/service/SictUserDetailsServiceImpl.java
View file @
8d82fb17
...
...
@@ -130,6 +130,9 @@ public class SictUserDetailsServiceImpl implements SictUserDetailsService {
user
.
setUserName
(
user
.
getId
().
toString
());
}
String
userName
=
user
.
getUserName
()
+
StringPool
.
COLON
+
info
.
getAppId
();
if
(
StrUtil
.
isNotBlank
(
info
.
getHospitalCode
()))
{
userName
=
userName
.
concat
(
StringPool
.
COLON
).
concat
(
info
.
getHospitalCode
());
}
String
password
=
SecurityConstants
.
BCRYPT
+
user
.
getPasswd
();
// 登录失败5次锁定半小时
boolean
nonLockd
=
!
Constant
.
BYTE_YES
.
equals
(
user
.
getStatus
());
...
...
smart-health-modules/cloud-upms/cloud-upms-biz/src/main/java/cn/sh/stc/sict/cloud/upms/service/impl/SysUserBaseServiceImpl.java
View file @
8d82fb17
...
...
@@ -10,6 +10,7 @@ import cn.sh.stc.sict.cloud.common.core.constant.RedisCacheConstant;
import
cn.sh.stc.sict.cloud.common.core.constant.UserConstant
;
import
cn.sh.stc.sict.cloud.common.core.constant.enums.LoginTypeEnum
;
import
cn.sh.stc.sict.cloud.common.core.dto.WDUserInfo
;
import
cn.sh.stc.sict.cloud.common.core.dto.WOAZzUserInfo
;
import
cn.sh.stc.sict.cloud.common.core.dto.XSZYUserInfo
;
import
cn.sh.stc.sict.cloud.common.core.util.NumberUtil
;
import
cn.sh.stc.sict.cloud.common.core.util.SsbUtil
;
...
...
@@ -92,6 +93,9 @@ public class SysUserBaseServiceImpl extends ServiceImpl<SysUserBaseMapper, SysUs
// inStr = 公众号标识符@公众号appId@token@hospitalCode
case
WOA_NL:
return
this
.
getByXszyWoa
(
split
);
// 中智公众号登录
case
WOA_ZZ:
return
this
.
getWoaZzUserInfoByToken
(
split
);
// 微信登录
default
:
WxOAuth2AccessToken
token
=
wxMpService
.
getOAuth2Service
().
getAccessToken
(
split
[
2
]);
...
...
@@ -192,6 +196,55 @@ public class SysUserBaseServiceImpl extends ServiceImpl<SysUserBaseMapper, SysUs
return
info
;
}
private
UserInfo
getWoaZzUserInfoByToken
(
String
[]
infoArray
)
{
String
source
=
infoArray
[
0
];
String
appId
=
infoArray
[
1
];
String
token
=
infoArray
[
2
];
String
hospitalCode
=
infoArray
[
3
];
WOAZzUserInfo
zzUserInfo
=
WoaUtil
.
getZzUserInfo
(
token
);
String
zzUserInfoStr
=
JSONUtil
.
toJsonStr
(
zzUserInfo
);
log
.
error
(
"woa.login.zzUser = {}"
,
zzUserInfoStr
);
if
(
ObjectUtil
.
isNull
(
zzUserInfo
)
||
StrUtil
.
isBlank
(
zzUserInfo
.
getId
()))
{
return
null
;
}
// 根据用户ID和手机号查询当前用户是否已注册过
LambdaQueryWrapper
<
SysUserBase
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
SysUserBase:
:
getOpenId
,
zzUserInfo
.
getId
())
.
or
()
.
eq
(
SysUserBase:
:
getPhone
,
zzUserInfo
.
getMobile
())
.
orderByDesc
(
SysUserBase:
:
getUpdateTime
)
.
last
(
"limit 1"
);
SysUserBase
user
=
this
.
getOne
(
wrapper
);
// 未注册用户默认注册
if
(
user
==
null
)
{
user
=
new
SysUserBase
();
user
.
setUserName
(
zzUserInfo
.
getMobile
());
user
.
setOpenId
(
zzUserInfo
.
getId
());
user
.
setName
(
zzUserInfo
.
getUsername
());
user
.
setIdCard
(
zzUserInfo
.
getPersoncard
());
user
.
setSex
(
zzUserInfo
.
getGender
());
user
.
setHeadimg
(
zzUserInfo
.
getAvator
());
user
.
setSource
(
source
);
user
.
setStatus
(
Constant
.
BYTE_NO
);
user
.
setPasswd
(
ENCODER
.
encode
(
Constant
.
DEFAULT_PASSWORD
));
user
.
setPhone
(
zzUserInfo
.
getMobile
());
user
.
setAppId
(
appId
);
this
.
save
(
user
);
}
UserInfo
info
=
new
UserInfo
();
info
.
setSysUserBase
(
user
);
info
.
setOpenId
(
zzUserInfo
.
getId
());
// 设置医疗机构代码,后续查询只显示当前医疗机构下的查询结果
info
.
setHospitalCode
(
hospitalCode
);
return
info
;
}
@Override
public
boolean
saveDto
(
UserDTO
dto
)
{
if
(
NumberUtil
.
isNotNullOrZero
(
dto
.
getUser
().
getId
()))
{
...
...
smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/mp/HphyPatientBaseController.java
View file @
8d82fb17
...
...
@@ -8,6 +8,7 @@ import cn.sh.stc.sict.cloud.common.core.constant.Constant;
import
cn.sh.stc.sict.cloud.common.core.constant.enums.LoginTypeEnum
;
import
cn.sh.stc.sict.cloud.common.core.dto.WDUserCardInfo
;
import
cn.sh.stc.sict.cloud.common.core.dto.WDUserInfo
;
import
cn.sh.stc.sict.cloud.common.core.dto.WOAZzUserInfo
;
import
cn.sh.stc.sict.cloud.common.core.dto.XSZYUserInfo
;
import
cn.sh.stc.sict.cloud.common.core.util.NumberUtil
;
import
cn.sh.stc.sict.cloud.common.core.util.R
;
...
...
@@ -167,6 +168,12 @@ public class HphyPatientBaseController {
log
.
error
(
"woaXszyUser = {}"
,
xszyUserInfo
);
base
=
hphyPatientBaseService
.
saveWoaXszyInfo
(
current
,
xszyUserInfo
);
}
// 中智用户系统公众号
if
(
LoginTypeEnum
.
WOA_ZZ
.
getType
().
equals
(
source
))
{
WOAZzUserInfo
zzUserInfo
=
WoaUtil
.
getZzUserInfo
(
token
);
log
.
error
(
"zzUser = {}"
,
zzUserInfo
);
base
=
hphyPatientBaseService
.
saveWoaInfo
(
current
,
zzUserInfo
);
}
}
if
(
ObjectUtil
.
isNull
(
base
)
||
NumberUtil
.
isNullOrZero
(
base
.
getId
()))
{
...
...
smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/HphyPatientBaseService.java
View file @
8d82fb17
...
...
@@ -2,10 +2,11 @@ package cn.sh.stc.sict.theme.hphy.service;
import
cn.sh.stc.sict.cloud.common.core.dto.WDUserCardInfo
;
import
cn.sh.stc.sict.cloud.common.core.dto.WDUserInfo
;
import
cn.sh.stc.sict.cloud.common.core.dto.WOAZzUserInfo
;
import
cn.sh.stc.sict.cloud.common.core.dto.XSZYUserInfo
;
import
cn.sh.stc.sict.cloud.upms.dto.CurrentUser
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
cn.sh.stc.sict.theme.hphy.model.HphyPatientBase
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
java.util.List
;
...
...
@@ -25,12 +26,21 @@ public interface HphyPatientBaseService extends IService<HphyPatientBase> {
/**
* 保存香山中医医院公众号用户
*
* @param current 当前用户
* @param current
当前用户
* @param userInfo 公众号用户详情
* @return XSZYUserInfo {@link XSZYUserInfo}
*/
HphyPatientBase
saveWoaXszyInfo
(
CurrentUser
current
,
XSZYUserInfo
userInfo
);
/**
* 保存中智公众号用户信息
*
* @param current 当前用户
* @param userInfo 公众号用户详情
* @return XSZYUserInfo {@link WOAZzUserInfo}
*/
HphyPatientBase
saveWoaInfo
(
CurrentUser
current
,
WOAZzUserInfo
userInfo
);
void
savePatient
(
HphyPatientBase
patient
);
HphyPatientBase
getCurrentBase
();
...
...
smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/impl/HphyPatientBaseServiceImpl.java
View file @
8d82fb17
...
...
@@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
import
cn.sh.stc.sict.cloud.common.core.constant.Constant
;
import
cn.sh.stc.sict.cloud.common.core.dto.WDUserCardInfo
;
import
cn.sh.stc.sict.cloud.common.core.dto.WDUserInfo
;
import
cn.sh.stc.sict.cloud.common.core.dto.WOAZzUserInfo
;
import
cn.sh.stc.sict.cloud.common.core.dto.XSZYUserInfo
;
import
cn.sh.stc.sict.cloud.common.core.util.NumberUtil
;
import
cn.sh.stc.sict.cloud.common.security.util.SecurityUtils
;
...
...
@@ -89,12 +90,13 @@ public class HphyPatientBaseServiceImpl extends ServiceImpl<HphyPatientBaseMappe
if
(
Constant
.
STRING_YES
.
equals
(
userInfo
.
getCertificateType
()))
{
base
.
setCertId
(
userInfo
.
getCertificate
());
}
base
.
setVerifyStatus
(
Constant
.
STRING_
YES
);
base
.
setVerifyStatus
(
Constant
.
STRING_
NO
);
// 身份证号合法,设置年龄、性别、实名认证标志
if
(
IdcardUtil
.
isValidCard
(
base
.
getCertId
()))
{
String
certId
=
base
.
getCertId
();
base
.
setAge
(
String
.
valueOf
(
IdcardUtil
.
getAgeByIdCard
(
certId
)));
base
.
setGender
(
Constant
.
INT_YES
.
equals
(
IdcardUtil
.
getGenderByIdCard
(
certId
))
?
"男"
:
"女"
);
base
.
setVerifyStatus
(
Constant
.
STRING_YES
);
}
this
.
save
(
base
);
return
base
;
...
...
@@ -102,6 +104,35 @@ public class HphyPatientBaseServiceImpl extends ServiceImpl<HphyPatientBaseMappe
return
null
;
}
/**
* 保存中智公众号用户信息
*
* @param current 当前用户
* @param userInfo 公众号用户详情
* @return XSZYUserInfo {@link WOAZzUserInfo}
*/
@Override
public
HphyPatientBase
saveWoaInfo
(
CurrentUser
current
,
WOAZzUserInfo
userInfo
)
{
if
(
ObjectUtil
.
isNotNull
(
userInfo
))
{
HphyPatientBase
base
=
new
HphyPatientBase
();
base
.
setUserId
(
current
.
getId
());
base
.
setOpenId
(
current
.
getOpenId
());
base
.
setPhone
(
userInfo
.
getMobile
());
base
.
setName
(
userInfo
.
getUsername
());
base
.
setCertId
(
userInfo
.
getPersoncard
());
base
.
setGender
(
Constant
.
BYTE_YES
.
equals
(
userInfo
.
getGender
())
?
"男"
:
"女"
);
base
.
setVerifyStatus
(
Constant
.
STRING_NO
);
// 身份证号合法,设置年龄、性别、实名认证标志
if
(
IdcardUtil
.
isValidCard
(
base
.
getCertId
()))
{
String
certId
=
base
.
getCertId
();
base
.
setAge
(
String
.
valueOf
(
IdcardUtil
.
getAgeByIdCard
(
certId
)));
base
.
setVerifyStatus
(
Constant
.
STRING_YES
);
}
this
.
save
(
base
);
return
base
;
}
return
null
;
}
@Override
public
void
savePatient
(
HphyPatientBase
patient
)
{
...
...
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