Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica-cloud-account
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
com.pica.cloud.account
pica-cloud-account
提交
9d7b40f1
提交
9d7b40f1
编写于
7月 22, 2022
作者:
minghao.wu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feature: 红杉健康接口
上级
a231c18f
流水线
#49107
已失败 于阶段
变更
8
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
213 行增加
和
10 行删除
+213
-10
pom.xml
client/pom.xml
+2
-2
pom.xml
common/pom.xml
+1
-1
HongShanRequest.java
...ica/cloud/account/account/common/req/HongShanRequest.java
+51
-0
pom.xml
server/pom.xml
+1
-1
RegisterController.java
...account/account/server/controller/RegisterController.java
+8
-0
RegisterService.java
...cloud/account/account/server/service/RegisterService.java
+6
-0
RegisterServiceImpl.java
...ount/account/server/service/impl/RegisterServiceImpl.java
+116
-6
RegisterServiceTest.java
...d/account/account/server/service/RegisterServiceTest.java
+28
-0
未找到文件。
client/pom.xml
浏览文件 @
9d7b40f1
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
<groupId>
com.pica.cloud.account
</groupId>
<groupId>
com.pica.cloud.account
</groupId>
<artifactId>
pica-cloud-account-client
</artifactId>
<artifactId>
pica-cloud-account-client
</artifactId>
<version>
1.1.
4
-SNAPSHOT
</version>
<version>
1.1.
5
-SNAPSHOT
</version>
<name>
pica-cloud-account-client
</name>
<name>
pica-cloud-account-client
</name>
<packaging>
jar
</packaging>
<packaging>
jar
</packaging>
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
<dependency>
<dependency>
<groupId>
com.pica.cloud.account
</groupId>
<groupId>
com.pica.cloud.account
</groupId>
<artifactId>
pica-cloud-account-common
</artifactId>
<artifactId>
pica-cloud-account-common
</artifactId>
<version>
1.1.
4
-SNAPSHOT
</version>
<version>
1.1.
5
-SNAPSHOT
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<groupId>
org.springframework.cloud
</groupId>
...
...
common/pom.xml
浏览文件 @
9d7b40f1
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
<groupId>
com.pica.cloud.account
</groupId>
<groupId>
com.pica.cloud.account
</groupId>
<artifactId>
pica-cloud-account-common
</artifactId>
<artifactId>
pica-cloud-account-common
</artifactId>
<version>
1.1.
4
-SNAPSHOT
</version>
<version>
1.1.
5
-SNAPSHOT
</version>
<name>
pica-cloud-account-common
</name>
<name>
pica-cloud-account-common
</name>
<packaging>
jar
</packaging>
<packaging>
jar
</packaging>
...
...
common/src/main/java/com/pica/cloud/account/account/common/req/HongShanRequest.java
0 → 100644
浏览文件 @
9d7b40f1
package
com
.
pica
.
cloud
.
account
.
account
.
common
.
req
;
import
io.swagger.annotations.ApiModelProperty
;
public
class
HongShanRequest
{
public
String
mobile
;
private
String
name
;
private
String
hospitalId
;
private
String
hospitalName
;
private
String
loginIp
;
public
String
getMobile
()
{
return
mobile
;
}
public
void
setMobile
(
String
mobile
)
{
this
.
mobile
=
mobile
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getHospitalId
()
{
return
hospitalId
;
}
public
void
setHospitalId
(
String
hospitalId
)
{
this
.
hospitalId
=
hospitalId
;
}
public
String
getHospitalName
()
{
return
hospitalName
;
}
public
void
setHospitalName
(
String
hospitalName
)
{
this
.
hospitalName
=
hospitalName
;
}
public
String
getLoginIp
()
{
return
loginIp
;
}
public
void
setLoginIp
(
String
loginIp
)
{
this
.
loginIp
=
loginIp
;
}
}
server/pom.xml
浏览文件 @
9d7b40f1
...
@@ -167,7 +167,7 @@
...
@@ -167,7 +167,7 @@
<dependency>
<dependency>
<groupId>
com.pica.cloud.account
</groupId>
<groupId>
com.pica.cloud.account
</groupId>
<artifactId>
pica-cloud-account-common
</artifactId>
<artifactId>
pica-cloud-account-common
</artifactId>
<version>
1.1.
4
-SNAPSHOT
</version>
<version>
1.1.
5
-SNAPSHOT
</version>
</dependency>
</dependency>
<dependency>
<dependency>
...
...
server/src/main/java/com/pica/cloud/account/account/server/controller/RegisterController.java
浏览文件 @
9d7b40f1
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
controller
;
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.pica.cloud.account.account.common.req.HongShanRequest
;
import
com.pica.cloud.account.account.common.req.OCINRequest
;
import
com.pica.cloud.account.account.common.req.OCINRequest
;
import
com.pica.cloud.account.account.server.entity.EncryptEntity
;
import
com.pica.cloud.account.account.server.entity.EncryptEntity
;
import
com.pica.cloud.account.account.server.entity.LoginResult
;
import
com.pica.cloud.account.account.server.entity.LoginResult
;
...
@@ -11,6 +12,7 @@ import com.pica.cloud.account.account.server.util.AccountUtils;
...
@@ -11,6 +12,7 @@ import com.pica.cloud.account.account.server.util.AccountUtils;
import
com.pica.cloud.account.account.server.util.CryptoUtil
;
import
com.pica.cloud.account.account.server.util.CryptoUtil
;
import
com.pica.cloud.foundation.entity.PicaResponse
;
import
com.pica.cloud.foundation.entity.PicaResponse
;
import
com.pica.cloud.foundation.redis.ICacheClient
;
import
com.pica.cloud.foundation.redis.ICacheClient
;
import
com.pica.cloud.foundation.utils.entity.PicaUser
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -71,4 +73,10 @@ public class RegisterController extends AccountBaseController {
...
@@ -71,4 +73,10 @@ public class RegisterController extends AccountBaseController {
registerService
.
ocinRegister
(
ocinRequest
);
registerService
.
ocinRegister
(
ocinRequest
);
return
PicaResponse
.
toResponse
();
return
PicaResponse
.
toResponse
();
}
}
@ApiOperation
(
"红杉项目"
)
@PostMapping
(
value
=
"/hongshan"
)
public
PicaResponse
<
LoginResult
>
registerHongShan
(
@RequestBody
HongShanRequest
hongShanRequest
)
{
return
PicaResponse
.
toResponse
(
registerService
.
hongShanRegister
(
hongShanRequest
));
}
}
}
server/src/main/java/com/pica/cloud/account/account/server/service/RegisterService.java
浏览文件 @
9d7b40f1
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
service
;
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
service
;
import
com.pica.cloud.account.account.common.req.HongShanRequest
;
import
com.pica.cloud.account.account.common.req.OCINRequest
;
import
com.pica.cloud.account.account.common.req.OCINRequest
;
import
com.pica.cloud.account.account.server.entity.LoginResult
;
import
com.pica.cloud.account.account.server.entity.LoginResult
;
import
com.pica.cloud.account.account.server.entity.QueryMobileEntity
;
import
com.pica.cloud.account.account.server.entity.QueryMobileEntity
;
...
@@ -24,6 +25,11 @@ public interface RegisterService {
...
@@ -24,6 +25,11 @@ public interface RegisterService {
*/
*/
void
ocinRegister
(
OCINRequest
request
);
void
ocinRegister
(
OCINRequest
request
);
/**
* 红杉健康接口对接
* @return
*/
LoginResult
hongShanRegister
(
HongShanRequest
request
);
LoginResult
register
(
BaseRequest
baseRequest
,
QueryMobileEntity
queryMobileEntity
);
LoginResult
register
(
BaseRequest
baseRequest
,
QueryMobileEntity
queryMobileEntity
);
...
...
server/src/main/java/com/pica/cloud/account/account/server/service/impl/RegisterServiceImpl.java
浏览文件 @
9d7b40f1
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
service
.
impl
;
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.google.common.collect.Lists
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.pica.cloud.account.account.common.req.HongShanRequest
;
import
com.pica.cloud.account.account.common.req.OCINRequest
;
import
com.pica.cloud.account.account.common.req.OCINRequest
;
import
com.pica.cloud.account.account.server.constants.Constants
;
import
com.pica.cloud.account.account.server.constants.Constants
;
import
com.pica.cloud.account.account.server.entity.*
;
import
com.pica.cloud.account.account.server.entity.*
;
...
@@ -21,18 +21,13 @@ import com.pica.cloud.account.account.server.util.*;
...
@@ -21,18 +21,13 @@ import com.pica.cloud.account.account.server.util.*;
import
com.pica.cloud.foundation.completeness.client.utils.IntactUtils
;
import
com.pica.cloud.foundation.completeness.client.utils.IntactUtils
;
import
com.pica.cloud.foundation.encryption.common.constants.EncryptConstants
;
import
com.pica.cloud.foundation.encryption.common.constants.EncryptConstants
;
import
com.pica.cloud.foundation.encryption.util.EncryptUtils
;
import
com.pica.cloud.foundation.encryption.util.EncryptUtils
;
import
com.pica.cloud.foundation.entity.PicaResponse
;
import
com.pica.cloud.foundation.redis.ICacheClient
;
import
com.pica.cloud.foundation.redis.ICacheClient
;
import
com.pica.cloud.foundation.utils.utils.RequestUtils
;
import
com.pica.cloud.foundation.utils.utils.RequestUtils
;
import
com.pica.cloud.foundation.utils.utils.StringUtil
;
import
com.pica.cloud.foundation.utils.utils.StringUtil
;
import
com.pica.cloud.tag.transport.client.ITransportDoctorClient
;
import
com.pica.cloud.tag.transport.contract.req.StickerProfileDto
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -302,6 +297,121 @@ public class RegisterServiceImpl implements RegisterService {
...
@@ -302,6 +297,121 @@ public class RegisterServiceImpl implements RegisterService {
}
}
}
}
@Transactional
@Override
public
LoginResult
hongShanRegister
(
HongShanRequest
request
)
{
String
requestId
=
UUID
.
randomUUID
().
toString
();
//接入新旭事务一致性
String
batchNo
=
IntactUtils
.
getUUID
();
intactUtil
.
sendIntact
(
batchNo
,
"register"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_1
,
"request:"
+
JSON
.
toJSONString
(
request
));
String
mobile
=
request
.
getMobile
();
if
(
StringUtil
.
isEmpty
(
mobile
)){
mobile
=
""
;
}
//对注册接口做幂等性处理:注册成功,删除缓存,注册失败提示用户
String
nxKey
=
Constants
.
REPEAT_REGISTER_PREFIX
+
mobile
;
Long
resultNx
=
redisClient
.
setnx
(
nxKey
,
mobile
);
redisClient
.
expire
(
nxKey
,
2
);
if
(
resultNx
==
1
)
{
//try {
String
mobileEncrypt
=
AESUtil
.
encryptV0
(
mobile
);
AccountInfoEntity
accountInfoEntity
=
accountInfoDetailMapper
.
selectByMobile
(
mobileEncrypt
);
//added by joy begin 适配苹果登录 手机号为空传入,过审核
if
(
StringUtil
.
isEmpty
(
mobile
)){
mobileEncrypt
=
""
;
accountInfoEntity
=
null
;
}
//added by joy end
if
(
accountInfoEntity
==
null
)
{
redisClient
.
expire
(
nxKey
,
30
);
Date
currentTime
=
new
Date
();
int
productType
=
5
;
int
sourceType
=
9
;
// 默认使用手机号做密码
String
password
=
request
.
getMobile
();
AccountInfoEntity
accountInfo
=
new
AccountInfoEntity
();
accountInfo
.
setMobilePhone
(
mobileEncrypt
);
if
(
StringUtils
.
isEmpty
(
password
))
{
password
=
""
;
}
accountInfo
.
setPassword
(
password
);
accountInfo
.
setCreatedTime
(
currentTime
);
accountInfo
.
setCreatedId
(
0
);
accountInfo
.
setModifiedId
(
0
);
accountInfo
.
setModifiedTime
(
currentTime
);
accountInfo
.
setRegTime
(
currentTime
);
accountInfo
.
setDeleteFlag
(
1
);
accountInfo
.
setSex
(
0
);
accountInfo
.
setRegisterProduct
(
productType
);
accountInfo
.
setRegisterSource
(
sourceType
);
/*注册app版本*/
try
{
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
RequestUtils
.
getRequest
().
getHeader
(
"deviceInfo"
));
accountInfo
.
setRegVersion
(
jsonObject
.
getString
(
"app_version"
));
}
catch
(
Exception
ex
)
{
logger
.
error
(
"从header中获取app版本异常"
,
ex
);
}
accountInfoDetailMapper
.
insertSelective
(
accountInfo
);
Integer
acctId
=
accountInfo
.
getId
();
accountInfoDetailMapper
.
updateCreateInfo
(
acctId
);
Account
account
=
new
Account
();
account
.
setAcctId
(
acctId
);
account
.
setMobilePhone
(
mobileEncrypt
);
account
.
setDeleteFlag
(
1
);
account
.
setCreatId
(
0L
);
account
.
setModifyId
(
0L
);
account
.
setCreatTime
(
currentTime
);
account
.
setModifyTime
(
currentTime
);
account
.
setFirstLoginTime
(
currentTime
);
account
.
setLastLoginTime
(
currentTime
);
account
.
setRegisterSource
(
sourceType
);
account
.
setPassword
(
password
);
if
(!
StringUtils
.
isBlank
(
password
))
{
account
.
setEntireFlag
(
3
);
}
logger
.
info
(
"register-add-doctor-start"
);
accountMapper
.
insertSelective
(
account
);
Long
userId
=
account
.
getId
();
Account
accountToken
=
new
Account
();
accountToken
.
setId
(
userId
);
accountToken
.
setAcctId
(
acctId
);
accountToken
.
setCreatTime
(
currentTime
);
accountToken
.
setMobilePhone
(
mobile
);
accountToken
.
setRegisterSource
(
sourceType
);
String
newToken
=
tokenUtils
.
generateToken
(
accountToken
);
LoginResult
result
=
new
LoginResult
();
result
.
setToken
(
newToken
);
result
.
setUserId
(
userId
);
result
.
setEntireFlag
(
1
);
result
.
setDoctorId
(
EncryptUtils
.
encryptContent
(
userId
+
""
,
EncryptConstants
.
ENCRYPT_TYPE_ID
));
result
.
setMobile
(
mobile
);
result
.
setAcctId
(
acctId
);
LogLoginEntity
entity
=
AccountLogEntityUtils
.
getLogLoginEntity
(
acctId
,
productType
,
sourceType
,
AccountTypeEnum
.
LOGIN_REGISTER
.
getCode
(),
request
.
getLoginIp
(),
AccountTypeEnum
.
LOGIN_STATUS_SUCCESS
.
getCode
(),
AccountTypeEnum
.
LOG_TYPE_LOGIN
.
getCode
(),
newToken
,
1
,
""
);
picaLogUtils
.
info
(
entity
);
processAgreement
(
userId
);
processRoleMap
(
userId
);
redisClient
.
del
(
nxKey
);
intactUtil
.
sendIntact
(
batchNo
,
"register"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"baseRequest:"
+
JSON
.
toJSONString
(
request
));
return
result
;
}
else
{
logger
.
info
(
"register-account is exists"
);
intactUtil
.
sendIntact
(
batchNo
,
"register"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"该手机号已注册,请直接登录"
);
throw
new
AccountException
(
AccountExceptionEnum
.
PICA_ALREADY_REGISTER
);
}
}
else
{
logger
.
info
(
"register-nxKey is exists"
);
intactUtil
.
sendIntact
(
batchNo
,
"register"
,
com
.
pica
.
cloud
.
foundation
.
completeness
.
contract
.
constants
.
CommonConstants
.
INTACT_CONTENT_LOG_STATUS_3
,
"该手机号已注册,请直接登录"
);
throw
new
AccountException
(
AccountExceptionEnum
.
PICA_ALREADY_REGISTER
);
}
}
/**
/**
* 异步处理协议信息
* 异步处理协议信息
* 1)从协议表中获取最新的协议信息;
* 1)从协议表中获取最新的协议信息;
...
...
server/src/test/java/com/pica/cloud/account/account/server/service/RegisterServiceTest.java
0 → 100644
浏览文件 @
9d7b40f1
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
service
;
import
com.pica.cloud.account.account.common.req.HongShanRequest
;
import
com.pica.cloud.account.account.server.App
;
import
junit.framework.TestCase
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
classes
=
App
.
class
)
public
class
RegisterServiceTest
extends
TestCase
{
@Autowired
private
RegisterService
registerService
;
@Test
public
void
testHongShanRegister
()
{
HongShanRequest
request
=
new
HongShanRequest
();
request
.
setMobile
(
"13391420001"
);
request
.
setName
(
"张三"
);
request
.
setHospitalId
(
""
);
request
.
setHospitalName
(
"张三的机构"
);
request
.
setLoginIp
(
"192.168.1.1"
);
registerService
.
hongShanRegister
(
request
);
}
}
\ No newline at end of file
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录