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
提交
3e62a3e1
提交
3e62a3e1
编写于
9月 17, 2019
作者:
rushui.chen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
“20190917 客服系统添加医生
上级
d650482c
流水线
#14577
已失败 于阶段
in 1 second
变更
19
流水线
1
显示空白字符变更
内嵌
并排
正在显示
19 个修改的文件
包含
338 行增加
和
106 行删除
+338
-106
Test.java
...main/java/com/pica/cloud/account/account/server/Test.java
+10
-0
CipherController.java
...d/account/account/server/controller/CipherController.java
+6
-2
DoctorController.java
...d/account/account/server/controller/DoctorController.java
+29
-5
PatientInfoController.java
...ount/account/server/controller/PatientInfoController.java
+22
-5
AccountInfoEntity.java
...loud/account/account/server/entity/AccountInfoEntity.java
+5
-5
AccountPatientInfoEntity.java
...count/account/server/entity/AccountPatientInfoEntity.java
+20
-0
Doctor.java
.../com/pica/cloud/account/account/server/entity/Doctor.java
+21
-11
AccountExceptionEnum.java
...ud/account/account/server/enums/AccountExceptionEnum.java
+2
-1
DoctorService.java
...a/cloud/account/account/server/service/DoctorService.java
+7
-0
PatientInfoService.java
...ud/account/account/server/service/PatientInfoService.java
+8
-0
DoctorServiceImpl.java
...ccount/account/server/service/impl/DoctorServiceImpl.java
+62
-0
PatientInfoServerImpl.java
...nt/account/server/service/impl/PatientInfoServerImpl.java
+29
-1
RegisterServiceImpl.java
...ount/account/server/service/impl/RegisterServiceImpl.java
+10
-11
RSAUtil.java
...a/com/pica/cloud/account/account/server/util/RSAUtil.java
+26
-14
TokenUtils.java
...om/pica/cloud/account/account/server/util/TokenUtils.java
+43
-47
bootstrap-prod.properties
server/src/main/resources/bootstrap-prod.properties
+5
-1
bootstrap-test1.properties
server/src/main/resources/bootstrap-test1.properties
+11
-1
bootstrap-test2.properties
server/src/main/resources/bootstrap-test2.properties
+11
-1
bootstrap-uat.properties
server/src/main/resources/bootstrap-uat.properties
+11
-1
未找到文件。
server/src/main/java/com/pica/cloud/account/account/server/Test.java
浏览文件 @
3e62a3e1
package
com
.
pica
.
cloud
.
account
.
account
.
server
;
package
com
.
pica
.
cloud
.
account
.
account
.
server
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.pica.cloud.account.account.server.entity.Doctor
;
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.req.BaseRequest
;
import
com.pica.cloud.account.account.server.req.BaseRequest
;
import
com.pica.cloud.account.account.server.req.PatientReq
;
import
com.pica.cloud.account.account.server.req.PatientReq
;
...
@@ -46,6 +47,15 @@ public class Test {
...
@@ -46,6 +47,15 @@ public class Test {
patientReqEncryptEntity
.
setContent
(
json
);
patientReqEncryptEntity
.
setContent
(
json
);
System
.
out
.
println
(
JSONObject
.
toJSONString
(
patientReqEncryptEntity
));
System
.
out
.
println
(
JSONObject
.
toJSONString
(
patientReqEncryptEntity
));
Doctor
doctor
=
new
Doctor
();
doctor
.
setName
(
"crs"
);
doctor
.
setMobilePhone
(
"13024112222"
);
doctor
.
setPassword
(
"qq123456"
);
doctor
.
setCard
(
"412702195468146814821"
);
doctor
.
setCityName
(
"上海市"
);
String
doctorJson
=
JSONObject
.
toJSONString
(
doctor
);
System
.
out
.
println
(
doctorJson
);
}
}
...
...
server/src/main/java/com/pica/cloud/account/account/server/controller/CipherController.java
浏览文件 @
3e62a3e1
...
@@ -4,6 +4,7 @@ import com.pica.cloud.account.account.server.util.RSAUtil;
...
@@ -4,6 +4,7 @@ import com.pica.cloud.account.account.server.util.RSAUtil;
import
com.pica.cloud.foundation.entity.PicaResponse
;
import
com.pica.cloud.foundation.entity.PicaResponse
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
...
@@ -12,13 +13,16 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -12,13 +13,16 @@ import org.springframework.web.bind.annotation.RestController;
* author:crs
* author:crs
* Description:H5端获取公钥资源
* Description:H5端获取公钥资源
*/
*/
@Api
(
"密钥接口资源"
)
@Api
(
description
=
"密钥接口资源"
)
@RestController
@RestController
public
class
CipherController
{
public
class
CipherController
{
@Value
(
"${rsapublickey}"
)
private
String
rsaPublicKey
;
@ApiOperation
(
"获取公钥Key接口"
)
@ApiOperation
(
"获取公钥Key接口"
)
@GetMapping
(
value
=
"/cipher/key"
)
@GetMapping
(
value
=
"/cipher/key"
)
public
PicaResponse
<
String
>
getPublicKey
()
{
public
PicaResponse
<
String
>
getPublicKey
()
{
return
PicaResponse
.
toResponse
(
RSAUtil
.
p
ublicKey
);
return
PicaResponse
.
toResponse
(
rsaP
ublicKey
);
}
}
}
}
server/src/main/java/com/pica/cloud/account/account/server/controller/DoctorController.java
浏览文件 @
3e62a3e1
...
@@ -3,9 +3,14 @@ package com.pica.cloud.account.account.server.controller;
...
@@ -3,9 +3,14 @@ package com.pica.cloud.account.account.server.controller;
import
com.pica.cloud.account.account.server.entity.AccountUser
;
import
com.pica.cloud.account.account.server.entity.AccountUser
;
import
com.pica.cloud.account.account.server.entity.Doctor
;
import
com.pica.cloud.account.account.server.entity.Doctor
;
import
com.pica.cloud.account.account.server.enums.AccountExceptionEnum
;
import
com.pica.cloud.account.account.server.enums.AccountExceptionEnum
;
import
com.pica.cloud.account.account.server.enums.AccountTypeEnum
;
import
com.pica.cloud.account.account.server.exception.AccountException
;
import
com.pica.cloud.account.account.server.exception.AccountException
;
import
com.pica.cloud.account.account.server.service.DoctorService
;
import
com.pica.cloud.account.account.server.service.DoctorService
;
import
com.pica.cloud.account.account.server.util.AccountUtils
;
import
com.pica.cloud.foundation.encryption.common.constants.EncryptConstants
;
import
com.pica.cloud.foundation.encryption.util.EncryptUtils
;
import
com.pica.cloud.foundation.entity.PicaResponse
;
import
com.pica.cloud.foundation.entity.PicaResponse
;
import
com.pica.cloud.foundation.utils.utils.EncryptCreateUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -31,11 +36,14 @@ public class DoctorController extends AccountBaseController {
...
@@ -31,11 +36,14 @@ public class DoctorController extends AccountBaseController {
try
{
try
{
accountUser
=
super
.
getAccountUser
();
accountUser
=
super
.
getAccountUser
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
AccountException
(
AccountExceptionEnum
.
PICA_LOGIN_AGAIN
);
throw
new
AccountException
(
AccountExceptionEnum
.
PICA_LOGIN_AGAIN
);
}
}
Integer
userId
=
accountUser
.
getId
();
Integer
userId
=
accountUser
.
getId
();
Doctor
doctorInfo
=
doctorService
.
getDoctorInfo
(
userId
);
Doctor
doctorInfo
=
doctorService
.
getDoctorInfo
(
userId
);
String
mobilePhone
=
doctorInfo
.
getMobilePhone
();
String
dencrypt
=
EncryptUtils
.
decryptContent
(
mobilePhone
,
EncryptConstants
.
ENCRYPT_TYPE_MOBILE
,
super
.
getToken
());
mobilePhone
=
dencrypt
.
substring
(
0
,
3
)
+
"****"
+
dencrypt
.
substring
(
7
,
11
);
doctorInfo
.
setMobilePhone
(
mobilePhone
);
return
PicaResponse
.
toResponse
(
doctorInfo
);
return
PicaResponse
.
toResponse
(
doctorInfo
);
}
}
...
@@ -55,8 +63,24 @@ public class DoctorController extends AccountBaseController {
...
@@ -55,8 +63,24 @@ public class DoctorController extends AccountBaseController {
return
PicaResponse
.
toResponse
();
return
PicaResponse
.
toResponse
();
}
}
/**
//TODO: 2019/9/11 doctor服务已经有这两个接口了 暂时不需要提供
* 当前医生是哪个admin账户添加的
*
* @param doctor
* @return
*/
@ApiOperation
(
"客服系统新增医生"
)
@PostMapping
(
value
=
"/info"
,
produces
=
"application/json;charset=utf-8"
)
public
PicaResponse
addDoctorInfo
(
@RequestBody
Doctor
doctor
)
{
AccountUser
accountUser
=
super
.
getAccountUser
();
Integer
userId
=
accountUser
.
getId
();
if
(
doctor
!=
null
&&
doctor
.
getMobilePhone
()
!=
null
)
{
AccountUtils
.
checkMobilePhone
(
doctor
.
getMobilePhone
());
AccountUtils
.
checkPassword
(
doctor
.
getPassword
());
doctorService
.
addDoctorInfo
(
doctor
,
userId
);
return
PicaResponse
.
toResponse
();
}
else
{
throw
new
AccountException
(
AccountExceptionEnum
.
PICA_PARAMS_ERROR
);
}
}
}
}
server/src/main/java/com/pica/cloud/account/account/server/controller/PatientInfoController.java
浏览文件 @
3e62a3e1
...
@@ -3,17 +3,22 @@ package com.pica.cloud.account.account.server.controller;
...
@@ -3,17 +3,22 @@ package com.pica.cloud.account.account.server.controller;
import
com.pica.cloud.account.account.server.entity.AccountPatientInfoEntity
;
import
com.pica.cloud.account.account.server.entity.AccountPatientInfoEntity
;
import
com.pica.cloud.account.account.server.entity.AccountUser
;
import
com.pica.cloud.account.account.server.entity.AccountUser
;
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.enums.AccountExceptionEnum
;
import
com.pica.cloud.account.account.server.enums.AccountTypeEnum
;
import
com.pica.cloud.account.account.server.exception.AccountException
;
import
com.pica.cloud.account.account.server.req.PatientReq
;
import
com.pica.cloud.account.account.server.req.PatientReq
;
import
com.pica.cloud.account.account.server.service.PatientInfoService
;
import
com.pica.cloud.account.account.server.service.PatientInfoService
;
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
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.beanutils.BeanUtils
;
import
org.apache.commons.beanutils.BeanUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
@Api
(
description
=
"云鹊健康用户信息
信息
资源"
)
@Api
(
description
=
"云鹊健康用户信息资源"
)
@RestController
@RestController
@RequestMapping
(
value
=
"/patient"
)
@RequestMapping
(
value
=
"/patient"
)
public
class
PatientInfoController
extends
AccountBaseController
{
public
class
PatientInfoController
extends
AccountBaseController
{
...
@@ -26,8 +31,8 @@ public class PatientInfoController extends AccountBaseController {
...
@@ -26,8 +31,8 @@ public class PatientInfoController extends AccountBaseController {
*
*
* @return
* @return
*/
*/
@ApiOperation
(
"获取
用户信息接口
"
)
@ApiOperation
(
"获取
居民信息
"
)
@GetMapping
(
value
=
"/info"
)
@GetMapping
(
value
=
"/info"
,
produces
=
"application/json;charset=utf-8"
)
public
PicaResponse
getUserInfo
()
{
public
PicaResponse
getUserInfo
()
{
AccountUser
accountUser
=
super
.
getAccountUser
();
AccountUser
accountUser
=
super
.
getAccountUser
();
AccountPatientInfoEntity
userInfo
=
null
;
AccountPatientInfoEntity
userInfo
=
null
;
...
@@ -44,8 +49,8 @@ public class PatientInfoController extends AccountBaseController {
...
@@ -44,8 +49,8 @@ public class PatientInfoController extends AccountBaseController {
*
*
* @return
* @return
*/
*/
@ApiOperation
(
"修改
用户
信息"
)
@ApiOperation
(
"修改
居民
信息"
)
@PutMapping
(
value
=
"/info"
)
@PutMapping
(
value
=
"/info"
,
produces
=
"application/json;charset=utf-8"
)
public
PicaResponse
putUserInfo
(
@RequestBody
EncryptEntity
entity
)
throws
Exception
{
public
PicaResponse
putUserInfo
(
@RequestBody
EncryptEntity
entity
)
throws
Exception
{
Integer
id
=
super
.
getAccountUser
().
getId
();
Integer
id
=
super
.
getAccountUser
().
getId
();
PatientReq
request
=
CryptoUtil
.
decrypt
(
entity
,
PatientReq
.
class
);
PatientReq
request
=
CryptoUtil
.
decrypt
(
entity
,
PatientReq
.
class
);
...
@@ -57,4 +62,16 @@ public class PatientInfoController extends AccountBaseController {
...
@@ -57,4 +62,16 @@ public class PatientInfoController extends AccountBaseController {
return
PicaResponse
.
toResponse
();
return
PicaResponse
.
toResponse
();
}
}
@ApiOperation
(
"客服系统添加居民信息"
)
@PostMapping
(
value
=
"/info"
,
produces
=
"application/json;charset=utf-8"
)
public
PicaResponse
addPatientInfo
(
AccountPatientInfoEntity
entity
)
{
Integer
userId
=
super
.
getAccountUser
().
getId
();
AccountUtils
.
checkMobilePhone
(
entity
.
getMobilePhone
());
if
(
StringUtils
.
isBlank
(
entity
.
getName
()))
{
patientInfoService
.
addPatientInfo
(
entity
,
userId
);
}
else
{
throw
new
AccountException
(
AccountExceptionEnum
.
PICA_PARAMS_ERROR
);
}
return
PicaResponse
.
toResponse
();
}
}
}
server/src/main/java/com/pica/cloud/account/account/server/entity/AccountInfoEntity.java
浏览文件 @
3e62a3e1
...
@@ -15,7 +15,7 @@ public class AccountInfoEntity {
...
@@ -15,7 +15,7 @@ public class AccountInfoEntity {
private
String
name
;
private
String
name
;
private
int
age
;
private
Integer
age
;
private
Date
birthday
;
private
Date
birthday
;
...
@@ -83,11 +83,11 @@ public class AccountInfoEntity {
...
@@ -83,11 +83,11 @@ public class AccountInfoEntity {
this
.
name
=
name
;
this
.
name
=
name
;
}
}
public
int
getAge
()
{
public
Integer
getAge
()
{
return
age
;
return
age
;
}
}
public
void
setAge
(
int
age
)
{
public
void
setAge
(
Integer
age
)
{
this
.
age
=
age
;
this
.
age
=
age
;
}
}
...
@@ -99,11 +99,11 @@ public class AccountInfoEntity {
...
@@ -99,11 +99,11 @@ public class AccountInfoEntity {
this
.
birthday
=
birthday
;
this
.
birthday
=
birthday
;
}
}
public
int
getSex
()
{
public
Integer
getSex
()
{
return
sex
;
return
sex
;
}
}
public
void
setSex
(
int
sex
)
{
public
void
setSex
(
Integer
sex
)
{
this
.
sex
=
sex
;
this
.
sex
=
sex
;
}
}
...
...
server/src/main/java/com/pica/cloud/account/account/server/entity/AccountPatientInfoEntity.java
浏览文件 @
3e62a3e1
...
@@ -9,6 +9,10 @@ public class AccountPatientInfoEntity {
...
@@ -9,6 +9,10 @@ public class AccountPatientInfoEntity {
private
String
villageName
;
private
String
villageName
;
private
String
mobilePhone
;
private
String
name
;
private
Long
villageId
;
private
Long
villageId
;
private
String
townName
;
private
String
townName
;
...
@@ -85,6 +89,22 @@ public class AccountPatientInfoEntity {
...
@@ -85,6 +89,22 @@ public class AccountPatientInfoEntity {
this
.
villageName
=
villageName
==
null
?
null
:
villageName
.
trim
();
this
.
villageName
=
villageName
==
null
?
null
:
villageName
.
trim
();
}
}
public
String
getMobilePhone
()
{
return
mobilePhone
;
}
public
void
setMobilePhone
(
String
mobilePhone
)
{
this
.
mobilePhone
=
mobilePhone
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
Long
getVillageId
()
{
public
Long
getVillageId
()
{
return
villageId
;
return
villageId
;
}
}
...
...
server/src/main/java/com/pica/cloud/account/account/server/entity/Doctor.java
浏览文件 @
3e62a3e1
...
@@ -5,10 +5,14 @@ import java.util.Date;
...
@@ -5,10 +5,14 @@ import java.util.Date;
public
class
Doctor
{
public
class
Doctor
{
private
Integer
id
;
private
Integer
id
;
private
Integer
acctId
;
private
Integer
sex
;
private
Integer
sex
;
private
String
name
;
private
String
name
;
private
Integer
age
;
private
String
mobilePhone
;
private
String
mobilePhone
;
private
String
tel
;
private
String
tel
;
...
@@ -121,8 +125,6 @@ public class Doctor {
...
@@ -121,8 +125,6 @@ public class Doctor {
private
Integer
showFlag
;
private
Integer
showFlag
;
private
Integer
acctId
;
public
Integer
getId
()
{
public
Integer
getId
()
{
return
id
;
return
id
;
}
}
...
@@ -131,6 +133,14 @@ public class Doctor {
...
@@ -131,6 +133,14 @@ public class Doctor {
this
.
id
=
id
;
this
.
id
=
id
;
}
}
public
Integer
getAcctId
()
{
return
acctId
;
}
public
void
setAcctId
(
Integer
acctId
)
{
this
.
acctId
=
acctId
;
}
public
Integer
getSex
()
{
public
Integer
getSex
()
{
return
sex
;
return
sex
;
}
}
...
@@ -147,6 +157,14 @@ public class Doctor {
...
@@ -147,6 +157,14 @@ public class Doctor {
this
.
name
=
name
==
null
?
null
:
name
.
trim
();
this
.
name
=
name
==
null
?
null
:
name
.
trim
();
}
}
public
Integer
getAge
()
{
return
age
;
}
public
void
setAge
(
Integer
age
)
{
this
.
age
=
age
;
}
public
String
getMobilePhone
()
{
public
String
getMobilePhone
()
{
return
mobilePhone
;
return
mobilePhone
;
}
}
...
@@ -594,12 +612,4 @@ public class Doctor {
...
@@ -594,12 +612,4 @@ public class Doctor {
public
void
setShowFlag
(
Integer
showFlag
)
{
public
void
setShowFlag
(
Integer
showFlag
)
{
this
.
showFlag
=
showFlag
;
this
.
showFlag
=
showFlag
;
}
}
public
Integer
getAcctId
()
{
return
acctId
;
}
public
void
setAcctId
(
Integer
acctId
)
{
this
.
acctId
=
acctId
;
}
}
}
\ No newline at end of file
server/src/main/java/com/pica/cloud/account/account/server/enums/AccountExceptionEnum.java
浏览文件 @
3e62a3e1
...
@@ -21,7 +21,8 @@ public enum AccountExceptionEnum {
...
@@ -21,7 +21,8 @@ public enum AccountExceptionEnum {
PICA_PASSWORD_NULL
(
"216513"
,
"密码不能为空"
),
PICA_PASSWORD_NULL
(
"216513"
,
"密码不能为空"
),
PICA_PASSWORD_EQUAL
(
"216514"
,
"旧密码与新密码不能相同"
),
PICA_PASSWORD_EQUAL
(
"216514"
,
"旧密码与新密码不能相同"
),
PICA_UNBIND_MOBILE
(
"216515"
,
"该手机号未绑定微信"
),
PICA_UNBIND_MOBILE
(
"216515"
,
"该手机号未绑定微信"
),
PICA_MOBILE_SAME
(
"216516"
,
"新手机号与旧手机号不能相同"
);
PICA_MOBILE_SAME
(
"216516"
,
"新手机号与旧手机号不能相同"
),
PICA_PARAMS_ERROR
(
"216517"
,
"传递参数有误"
);
private
String
code
;
private
String
code
;
...
...
server/src/main/java/com/pica/cloud/account/account/server/service/DoctorService.java
浏览文件 @
3e62a3e1
...
@@ -23,4 +23,11 @@ public interface DoctorService {
...
@@ -23,4 +23,11 @@ public interface DoctorService {
* @param doctor 待修改数据
* @param doctor 待修改数据
*/
*/
void
modifyDoctorInfo
(
Doctor
doctor
);
void
modifyDoctorInfo
(
Doctor
doctor
);
/**
* 客服系统新增医生用户
*
* @param doctor 新的医生数据
*/
void
addDoctorInfo
(
Doctor
doctor
,
Integer
userId
);
}
}
server/src/main/java/com/pica/cloud/account/account/server/service/PatientInfoService.java
浏览文件 @
3e62a3e1
...
@@ -28,4 +28,12 @@ public interface PatientInfoService {
...
@@ -28,4 +28,12 @@ public interface PatientInfoService {
* @return
* @return
*/
*/
AccountPatientInfoEntity
getUserInfoByAcctId
(
Integer
acctId
);
AccountPatientInfoEntity
getUserInfoByAcctId
(
Integer
acctId
);
/**
* 添加居民用户
*
* @param entity 居民信息
*/
void
addPatientInfo
(
AccountPatientInfoEntity
entity
,
Integer
userId
);
}
}
server/src/main/java/com/pica/cloud/account/account/server/service/impl/DoctorServiceImpl.java
浏览文件 @
3e62a3e1
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
service
.
impl
;
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
service
.
impl
;
import
com.pica.cloud.account.account.server.entity.AccountInfoEntity
;
import
com.pica.cloud.account.account.server.entity.Doctor
;
import
com.pica.cloud.account.account.server.entity.Doctor
;
import
com.pica.cloud.account.account.server.enums.AccountExceptionEnum
;
import
com.pica.cloud.account.account.server.exception.AccountException
;
import
com.pica.cloud.account.account.server.mapper.AccountInfoDetailMapper
;
import
com.pica.cloud.account.account.server.mapper.DoctorMapper
;
import
com.pica.cloud.account.account.server.mapper.DoctorMapper
;
import
com.pica.cloud.account.account.server.service.DoctorService
;
import
com.pica.cloud.account.account.server.service.DoctorService
;
import
com.pica.cloud.foundation.entity.PicaException
;
import
com.pica.cloud.foundation.utils.utils.EncryptCreateUtil
;
import
microsoft.exchange.webservices.data.core.IFileAttachmentContentHandler
;
import
org.apache.commons.lang.exception.ExceptionUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -19,6 +30,9 @@ public class DoctorServiceImpl implements DoctorService {
...
@@ -19,6 +30,9 @@ public class DoctorServiceImpl implements DoctorService {
@Autowired
@Autowired
private
DoctorMapper
doctorMapper
;
private
DoctorMapper
doctorMapper
;
@Autowired
private
AccountInfoDetailMapper
accountInfoDetailMapper
;
@Override
@Override
public
Doctor
getDoctorInfo
(
Integer
id
)
{
public
Doctor
getDoctorInfo
(
Integer
id
)
{
return
doctorMapper
.
selectByPrimaryKey
(
id
);
return
doctorMapper
.
selectByPrimaryKey
(
id
);
...
@@ -29,4 +43,52 @@ public class DoctorServiceImpl implements DoctorService {
...
@@ -29,4 +43,52 @@ public class DoctorServiceImpl implements DoctorService {
doctor
.
setModifyTime
(
new
Date
());
doctor
.
setModifyTime
(
new
Date
());
doctorMapper
.
insertSelective
(
doctor
);
doctorMapper
.
insertSelective
(
doctor
);
}
}
/**
* 客服管理后台添加医生
* 1)当前医生信息是否存在,如果已经存在直接抛出异常;
* 2)账户表和医生表;
* 3)手机号进行加密存储;
* 4)账户基本信息的处理:姓名,性别,年龄,生日,身份证号;
*
* @param doctor 新的医生数据
* @param userId
*/
@Override
@Transactional
public
void
addDoctorInfo
(
Doctor
doctor
,
Integer
userId
)
{
String
mobilePhone
=
doctor
.
getMobilePhone
();
String
mobileEncrypt
=
EncryptCreateUtil
.
encrypt
(
mobilePhone
);
AccountInfoEntity
accountInfoEntity
=
accountInfoDetailMapper
.
selectByMobile
(
mobileEncrypt
);
if
(
accountInfoEntity
!=
null
)
{
throw
new
AccountException
(
AccountExceptionEnum
.
PICA_ALREADY_REGISTER
);
}
String
password
=
doctor
.
getPassword
();
Date
currentTime
=
new
Date
();
AccountInfoEntity
entity
=
new
AccountInfoEntity
();
entity
.
setMobilePhone
(
mobileEncrypt
);
entity
.
setPassword
(
password
);
entity
.
setCreatedTime
(
currentTime
);
entity
.
setModifiedTime
(
currentTime
);
entity
.
setModifiedId
(
userId
);
entity
.
setRegisterProduct
(
1
);
entity
.
setRegTime
(
currentTime
);
entity
.
setRegisterSource
(
3
);
entity
.
setCreatedId
(
userId
);
entity
.
setDeleteFlag
(
1
);
entity
.
setSex
(
doctor
.
getSex
());
entity
.
setName
(
doctor
.
getName
());
entity
.
setIdCard
(
doctor
.
getCard
());
entity
.
setAge
(
doctor
.
getAge
());
entity
.
setBirthday
(
doctor
.
getBirthday
());
accountInfoDetailMapper
.
insertSelective
(
entity
);
doctor
.
setAcctId
(
entity
.
getId
());
doctor
.
setMobilePhone
(
mobileEncrypt
);
doctor
.
setModifyId
(
userId
);
doctor
.
setCreatId
(
userId
);
doctor
.
setCreatTime
(
currentTime
);
doctor
.
setModifyTime
(
new
Date
());
doctor
.
setDeleteFlag
(
1
);
doctorMapper
.
insertSelective
(
doctor
);
}
}
}
server/src/main/java/com/pica/cloud/account/account/server/service/impl/PatientInfoServerImpl.java
浏览文件 @
3e62a3e1
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
service
.
impl
;
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
service
.
impl
;
import
com.pica.cloud.account.account.server.entity.AccountInfoEntity
;
import
com.pica.cloud.account.account.server.entity.AccountPatientInfoEntity
;
import
com.pica.cloud.account.account.server.entity.AccountPatientInfoEntity
;
import
com.pica.cloud.account.account.server.entity.LogUserInfoEntity
;
import
com.pica.cloud.account.account.server.entity.LogUserInfoEntity
;
import
com.pica.cloud.account.account.server.enums.AccountTypeEnum
;
import
com.pica.cloud.account.account.server.enums.AccountTypeEnum
;
import
com.pica.cloud.account.account.server.log.AccountLogUtils
;
import
com.pica.cloud.account.account.server.log.AccountLogUtils
;
import
com.pica.cloud.account.account.server.mapper.AccountInfoDetailMapper
;
import
com.pica.cloud.account.account.server.mapper.AccountPatientInfoMapper
;
import
com.pica.cloud.account.account.server.mapper.AccountPatientInfoMapper
;
import
com.pica.cloud.account.account.server.service.PatientInfoService
;
import
com.pica.cloud.account.account.server.service.PatientInfoService
;
import
com.pica.cloud.foundation.utils.utils.EncryptCreateUtil
;
import
org.apache.commons.beanutils.BeanUtils
;
import
org.apache.commons.beanutils.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.InvocationTargetException
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -22,11 +26,13 @@ public class PatientInfoServerImpl implements PatientInfoService {
...
@@ -22,11 +26,13 @@ public class PatientInfoServerImpl implements PatientInfoService {
@Autowired
@Autowired
private
AccountLogUtils
accountLogUtils
;
private
AccountLogUtils
accountLogUtils
;
@Autowired
private
AccountInfoDetailMapper
accountInfoDetailMapper
;
@Override
@Override
public
void
updateUserInfo
(
AccountPatientInfoEntity
accountPatientInfoEntity
)
{
public
void
updateUserInfo
(
AccountPatientInfoEntity
accountPatientInfoEntity
)
{
accountPatientInfoEntity
.
setModifyTime
(
new
Date
());
accountPatientInfoEntity
.
setModifyTime
(
new
Date
());
accountPatientInfoEntity
.
setModifyId
(
accountPatientInfoEntity
.
getAcctId
());
accountPatientInfoEntity
.
setModifyId
(
accountPatientInfoEntity
.
getAcctId
());
accountPatientInfoMapper
.
updateByPrimaryKeySelective
(
accountPatientInfoEntity
);
accountPatientInfoMapper
.
updateByPrimaryKeySelective
(
accountPatientInfoEntity
);
//用户信息更新日志
//用户信息更新日志
...
@@ -57,4 +63,26 @@ public class PatientInfoServerImpl implements PatientInfoService {
...
@@ -57,4 +63,26 @@ public class PatientInfoServerImpl implements PatientInfoService {
public
AccountPatientInfoEntity
getUserInfoByAcctId
(
Integer
acctId
)
{
public
AccountPatientInfoEntity
getUserInfoByAcctId
(
Integer
acctId
)
{
return
accountPatientInfoMapper
.
selectByAcctId
(
acctId
);
return
accountPatientInfoMapper
.
selectByAcctId
(
acctId
);
}
}
@Override
@Transactional
public
void
addPatientInfo
(
AccountPatientInfoEntity
entity
,
Integer
userId
)
{
String
mobilePhone
=
entity
.
getMobilePhone
();
Date
currentTime
=
new
Date
();
AccountInfoEntity
accountInfoEntity
=
new
AccountInfoEntity
();
accountInfoEntity
.
setMobilePhone
(
mobilePhone
);
accountInfoEntity
.
setCreatedTime
(
currentTime
);
accountInfoEntity
.
setModifiedTime
(
currentTime
);
accountInfoEntity
.
setModifiedId
(
userId
);
accountInfoEntity
.
setCreatedId
(
userId
);
accountInfoEntity
.
setDeleteFlag
(
1
);
//居民:姓名和手机号
accountInfoEntity
.
setName
(
entity
.
getName
());
accountInfoDetailMapper
.
insertSelective
(
accountInfoEntity
);
entity
.
setAcctId
(
accountInfoEntity
.
getId
());
entity
.
setMobilePhone
(
EncryptCreateUtil
.
encrypt
(
entity
.
getMobilePhone
()));
entity
.
setModifyId
(
userId
);
entity
.
setModifyTime
(
currentTime
);
accountPatientInfoMapper
.
insertSelective
(
entity
);
}
}
}
server/src/main/java/com/pica/cloud/account/account/server/service/impl/RegisterServiceImpl.java
浏览文件 @
3e62a3e1
...
@@ -14,7 +14,6 @@ import com.pica.cloud.account.account.server.log.AccountLogUtils;
...
@@ -14,7 +14,6 @@ import com.pica.cloud.account.account.server.log.AccountLogUtils;
import
com.pica.cloud.account.account.server.mapper.AccountInfoDetailMapper
;
import
com.pica.cloud.account.account.server.mapper.AccountInfoDetailMapper
;
import
com.pica.cloud.account.account.server.mapper.AccountMapper
;
import
com.pica.cloud.account.account.server.mapper.AccountMapper
;
import
com.pica.cloud.account.account.server.mapper.AccountPatientInfoMapper
;
import
com.pica.cloud.account.account.server.mapper.AccountPatientInfoMapper
;
import
com.pica.cloud.account.account.server.mapper.DoctorMapper
;
import
com.pica.cloud.account.account.server.queue.QueueProducer
;
import
com.pica.cloud.account.account.server.queue.QueueProducer
;
import
com.pica.cloud.account.account.server.req.BaseRequest
;
import
com.pica.cloud.account.account.server.req.BaseRequest
;
import
com.pica.cloud.account.account.server.service.RegisterService
;
import
com.pica.cloud.account.account.server.service.RegisterService
;
...
@@ -23,18 +22,14 @@ import com.pica.cloud.account.account.server.util.TokenUtils;
...
@@ -23,18 +22,14 @@ import com.pica.cloud.account.account.server.util.TokenUtils;
import
com.pica.cloud.foundation.redis.ICacheClient
;
import
com.pica.cloud.foundation.redis.ICacheClient
;
import
com.pica.cloud.foundation.utils.utils.EncryptCreateUtil
;
import
com.pica.cloud.foundation.utils.utils.EncryptCreateUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
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.Qualifier
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.io.ByteArrayOutputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.DataOutputStream
;
import
java.io.DataOutputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.*
;
@Service
@Service
public
class
RegisterServiceImpl
implements
RegisterService
{
public
class
RegisterServiceImpl
implements
RegisterService
{
...
@@ -66,16 +61,17 @@ public class RegisterServiceImpl implements RegisterService {
...
@@ -66,16 +61,17 @@ public class RegisterServiceImpl implements RegisterService {
@Override
@Override
public
String
register
(
BaseRequest
baseRequest
)
{
public
String
register
(
BaseRequest
baseRequest
)
{
String
mobile
=
EncryptCreateUtil
.
encrypt
(
baseRequest
.
getMobile
());
//对手机号进行加密处理
//校验用户是否已经注册
String
mobile
=
baseRequest
.
getMobile
();
AccountInfoEntity
accountInfoEntity
=
accountInfoDetailMapper
.
selectByMobile
(
mobile
);
String
mobileEncrypt
=
EncryptCreateUtil
.
encrypt
(
mobile
);
AccountInfoEntity
accountInfoEntity
=
accountInfoDetailMapper
.
selectByMobile
(
mobileEncrypt
);
if
(
accountInfoEntity
==
null
)
{
if
(
accountInfoEntity
==
null
)
{
Date
currentTime
=
new
Date
();
Date
currentTime
=
new
Date
();
int
productType
=
baseRequest
.
getProductType
();
int
productType
=
baseRequest
.
getProductType
();
int
sourceType
=
baseRequest
.
getSourceType
();
int
sourceType
=
baseRequest
.
getSourceType
();
String
password
=
baseRequest
.
getPassword
();
String
password
=
baseRequest
.
getPassword
();
AccountInfoEntity
accountInfo
=
new
AccountInfoEntity
();
AccountInfoEntity
accountInfo
=
new
AccountInfoEntity
();
accountInfo
.
setMobilePhone
(
EncryptCreateUtil
.
encrypt
(
baseRequest
.
getMobile
())
);
accountInfo
.
setMobilePhone
(
mobileEncrypt
);
if
(
StringUtils
.
isEmpty
(
password
))
{
if
(
StringUtils
.
isEmpty
(
password
))
{
password
=
""
;
password
=
""
;
}
}
...
@@ -104,7 +100,7 @@ public class RegisterServiceImpl implements RegisterService {
...
@@ -104,7 +100,7 @@ public class RegisterServiceImpl implements RegisterService {
}
else
{
}
else
{
Account
account
=
new
Account
();
Account
account
=
new
Account
();
account
.
setAcctId
(
acctId
);
account
.
setAcctId
(
acctId
);
account
.
setMobilePhone
(
EncryptCreateUtil
.
encrypt
(
mobile
)
);
account
.
setMobilePhone
(
mobileEncrypt
);
account
.
setDeleteFlag
(
1
);
account
.
setDeleteFlag
(
1
);
account
.
setCreatId
(
0L
);
account
.
setCreatId
(
0L
);
account
.
setModifyId
(
0L
);
account
.
setModifyId
(
0L
);
...
@@ -147,4 +143,7 @@ public class RegisterServiceImpl implements RegisterService {
...
@@ -147,4 +143,7 @@ public class RegisterServiceImpl implements RegisterService {
throw
new
AccountException
(
AccountExceptionEnum
.
PICA_ALREADY_REGISTER
);
throw
new
AccountException
(
AccountExceptionEnum
.
PICA_ALREADY_REGISTER
);
}
}
}
}
}
}
server/src/main/java/com/pica/cloud/account/account/server/util/RSAUtil.java
浏览文件 @
3e62a3e1
...
@@ -21,7 +21,7 @@ public class RSAUtil {
...
@@ -21,7 +21,7 @@ public class RSAUtil {
//用于封装随机产生的公钥与私钥
//用于封装随机产生的公钥与私钥
private
static
Map
<
Integer
,
String
>
keyMap
=
new
HashMap
<>();
private
static
Map
<
Integer
,
String
>
keyMap
=
new
HashMap
<>();
private
static
final
String
privateK
ey
=
"MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAO+zh8bnUA+elnRy1BHKEGrbTmh/"
+
private
static
final
String
rsaprivatek
ey
=
"MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAO+zh8bnUA+elnRy1BHKEGrbTmh/"
+
"r71zFboVTznwAuEzPnvOezQBOY+623mIXh86/cyCLlCRzbGm0Q5M3LSY6sTemNXtupVnb1lWwD1xDrSG0JsCgeS/weCLI9gHaknNuMfVlg+"
+
"r71zFboVTznwAuEzPnvOezQBOY+623mIXh86/cyCLlCRzbGm0Q5M3LSY6sTemNXtupVnb1lWwD1xDrSG0JsCgeS/weCLI9gHaknNuMfVlg+"
+
"5esYcy2JlyG5ldcJahCgAOog2lJr4pLUSj8fJAgMBAAECgYEAiJIlnjJU71FQL/Ds22XhjMB/IBMAMlTL4EYb6crSGTV1OF0g3TSFc1rniY"
+
"5esYcy2JlyG5ldcJahCgAOog2lJr4pLUSj8fJAgMBAAECgYEAiJIlnjJU71FQL/Ds22XhjMB/IBMAMlTL4EYb6crSGTV1OF0g3TSFc1rniY"
+
"sk9W5LBKZ3dPhd1gZRvnAUn+EwgPh1bVBG0Z30vr2Ea0w9v+D3T96byeCKh+xoKQqG+Yp+u5w8v6MNNX6sVN2D0gks9YgY+2xGEeAf9kuF5"
+
"sk9W5LBKZ3dPhd1gZRvnAUn+EwgPh1bVBG0Z30vr2Ea0w9v+D3T96byeCKh+xoKQqG+Yp+u5w8v6MNNX6sVN2D0gks9YgY+2xGEeAf9kuF5"
+
...
@@ -31,7 +31,7 @@ public class RSAUtil {
...
@@ -31,7 +31,7 @@ public class RSAUtil {
"v4J8WlsQOnRTvF/Q43wo3TeuY29p1749qHf5Z3QQJBANnZYSe93QlOT+6PFT1Dkv8osnOY/93CZYD2IvTpfXfqJnbBZ9bkSe7xcxIIqGO6M"
+
"v4J8WlsQOnRTvF/Q43wo3TeuY29p1749qHf5Z3QQJBANnZYSe93QlOT+6PFT1Dkv8osnOY/93CZYD2IvTpfXfqJnbBZ9bkSe7xcxIIqGO6M"
+
"JWlZjItnYBZLLHP3JKVgOQ="
;
"JWlZjItnYBZLLHP3JKVgOQ="
;
public
static
final
String
publicK
ey
=
"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDvs4fG51APnpZ0ctQRyhBq205of6+9cxW6FU858"
+
public
static
final
String
rsapublick
ey
=
"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDvs4fG51APnpZ0ctQRyhBq205of6+9cxW6FU858"
+
"ALhMz57zns0ATmPutt5iF4fOv3Mgi5Qkc2xptEOTNy0mOrE3pjV7bqVZ29ZVsA9cQ60htCbAoHkv8HgiyPYB2pJzbjH1ZYPuXrGHMtiZchu"
+
"ALhMz57zns0ATmPutt5iF4fOv3Mgi5Qkc2xptEOTNy0mOrE3pjV7bqVZ29ZVsA9cQ60htCbAoHkv8HgiyPYB2pJzbjH1ZYPuXrGHMtiZchu"
+
"ZXXCWoQoADqINpSa+KS1Eo/HyQIDAQAB"
;
"ZXXCWoQoADqINpSa+KS1Eo/HyQIDAQAB"
;
...
@@ -42,7 +42,7 @@ public class RSAUtil {
...
@@ -42,7 +42,7 @@ public class RSAUtil {
* @return
* @return
*/
*/
public
static
String
encrypt
(
String
keyString
)
throws
Exception
{
public
static
String
encrypt
(
String
keyString
)
throws
Exception
{
return
encrypt
(
keyString
,
publicK
ey
);
return
encrypt
(
keyString
,
rsapublick
ey
);
}
}
/**
/**
...
@@ -52,7 +52,7 @@ public class RSAUtil {
...
@@ -52,7 +52,7 @@ public class RSAUtil {
* @return
* @return
*/
*/
public
static
String
decrypt
(
String
key
)
throws
Exception
{
public
static
String
decrypt
(
String
key
)
throws
Exception
{
return
decrypt
(
key
,
privateK
ey
);
return
decrypt
(
key
,
rsaprivatek
ey
);
}
}
/**
/**
...
@@ -120,15 +120,27 @@ public class RSAUtil {
...
@@ -120,15 +120,27 @@ public class RSAUtil {
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
//生成公钥和私钥
//生成公钥和私钥
//genKeyPair();
//genKeyPair();
keyMap
.
put
(
0
,
publicKey
);
// keyMap.put(0, publicKey);
keyMap
.
put
(
1
,
privateKey
);
// keyMap.put(1, privateKey);
//加密字符串
// //加密字符串
String
message
=
"df723820"
;
// String message = "df723820";
System
.
out
.
println
(
"随机生成的公钥为:"
+
keyMap
.
get
(
0
));
// System.out.println("随机生成的公钥为:" + keyMap.get(0));
System
.
out
.
println
(
"随机生成的私钥为:"
+
keyMap
.
get
(
1
));
// System.out.println("随机生成的私钥为:" + keyMap.get(1));
String
messageEn
=
encrypt
(
message
,
keyMap
.
get
(
0
));
// String messageEn = encrypt(message, keyMap.get(0));
System
.
out
.
println
(
message
+
"\t加密后的字符串为:"
+
messageEn
);
// System.out.println(message + "\t加密后的字符串为:" + messageEn);
String
messageDe
=
decrypt
(
messageEn
,
keyMap
.
get
(
1
));
// String messageDe = decrypt(messageEn, keyMap.get(1));
System
.
out
.
println
(
"还原后的字符串为:"
+
messageDe
);
// System.out.println("还原后的字符串为:" + messageDe);
genKeyPair
();
String
s
=
keyMap
.
get
(
0
);
System
.
out
.
println
(
s
);
String
s1
=
keyMap
.
get
(
1
);
System
.
out
.
println
(
s1
);
String
key1
=
""
;
String
key2
=
""
;
}
}
}
}
server/src/main/java/com/pica/cloud/account/account/server/util/TokenUtils.java
浏览文件 @
3e62a3e1
...
@@ -3,6 +3,8 @@ package com.pica.cloud.account.account.server.util;
...
@@ -3,6 +3,8 @@ package com.pica.cloud.account.account.server.util;
import
com.pica.cloud.account.account.server.entity.Account
;
import
com.pica.cloud.account.account.server.entity.Account
;
import
com.pica.cloud.foundation.redis.ICacheClient
;
import
com.pica.cloud.foundation.redis.ICacheClient
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
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.Qualifier
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -19,6 +21,8 @@ import java.util.UUID;
...
@@ -19,6 +21,8 @@ import java.util.UUID;
@Component
@Component
public
class
TokenUtils
{
public
class
TokenUtils
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
this
.
getClass
());
@Autowired
@Autowired
@Qualifier
(
"cacheMigrateClient"
)
@Qualifier
(
"cacheMigrateClient"
)
private
ICacheClient
cacheClient
;
private
ICacheClient
cacheClient
;
...
@@ -35,62 +39,54 @@ public class TokenUtils {
...
@@ -35,62 +39,54 @@ public class TokenUtils {
return
StringUtils
.
isBlank
(
str
);
return
StringUtils
.
isBlank
(
str
);
}
}
/**
/**
*
生成随机
token
*
获取新的
token
*
*
* @param account
* @param account
* @return
* @return
*/
*/
public
String
generateToken
(
Account
account
)
{
public
String
generateToken
(
Account
account
)
{
//判断用户终端类型
Integer
registerSource
=
account
.
getRegisterSource
();
Integer
registerSource
=
account
.
getRegisterSource
();
String
sourceType
=
AccountUtils
.
getSourceType
(
registerSource
);
String
newToken
=
""
;
String
newToken
=
StringUtils
.
EMPTY
;
try
{
//用户唯一key
//用户id
String
tokenDoctorId
=
"token-doctor-"
+
account
.
getId
().
toString
();
String
value
=
"token-doctor-"
+
account
.
getId
().
toString
();
//清除旧token对应的用户id
// 根据不同的产品线设置token有效期
String
oldToken
=
cacheClient
.
get
(
tokenDoctorId
+
"-"
+
sourceType
);
int
expiredSeconds
=
24
*
60
*
60
;
if
(
StringUtils
.
isNoneBlank
(
oldToken
))
{
if
(
registerSource
!=
3
&&
registerSource
!=
5
)
{
cacheClient
.
del
(
oldToken
);
}
//生成新的token,并和用户唯一key绑定
newToken
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
).
toUpperCase
();
//过期时间处理
int
expiredSeconds
=
0
;
switch
(
registerSource
)
{
case
3
:
case
5
:
expiredSeconds
=
24
*
60
*
60
;
break
;
default
:
expiredSeconds
=
expiredSeconds
*
30
;
expiredSeconds
=
expiredSeconds
*
30
;
}
}
cacheClient
.
set
(
"token-"
+
newToken
,
tokenDoctorId
,
expiredSeconds
);
newToken
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
).
toUpperCase
();
//存储当前登录终端对应的token
String
Key
=
"token-"
+
newToken
;
cacheClient
.
set
(
tokenDoctorId
+
"-"
+
sourceType
,
"token-"
+
newToken
,
expiredSeconds
);
//存储token对应的用户id,数据结构如:(token-FF9FCB0D93A642328A01C279701B7607:token-doctor-1)
String
userData
=
cacheClient
.
hget
(
tokenDoctorId
,
"id"
);
cacheClient
.
set
(
Key
,
value
,
expiredSeconds
);
if
(
StringUtils
.
isEmpty
(
userData
))
{
//存储不同终端对应的token,数据结构如:(token-doctor-12345678-app:token-FF9FCB0D93A642328A01C279701B7607)
Map
<
String
,
String
>
map
=
new
HashMap
<>();
String
sourceType
=
AccountUtils
.
getSourceType
(
registerSource
);
//重新登录后token没有更新
cacheClient
.
set
(
value
+
"-"
+
sourceType
,
Key
,
expiredSeconds
);
map
.
put
(
"token"
,
newToken
);
//用户数据放入redis缓存
map
.
put
(
"id"
,
account
.
getId
()
+
""
);
String
userData
=
cacheClient
.
hget
(
value
,
"id"
);
map
.
put
(
"acctId"
,
account
.
getAcctId
()
+
""
);
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isEmpty
(
userData
))
{
map
.
put
(
"mobile"
,
account
.
getMobilePhone
());
Map
<
String
,
String
>
data
=
new
HashMap
<>();
map
.
put
(
"name"
,
account
.
getMobilePhone
().
replaceAll
(
"(\\d{3})\\d{4}(\\w{4})"
,
"$1****$2"
));
data
.
put
(
"token"
,
newToken
);
map
.
put
(
"created_time"
,
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
).
format
(
account
.
getCreatTime
()));
data
.
put
(
"id"
,
account
.
getId
()
+
""
);
map
.
put
(
"sysCode"
,
sourceType
);
data
.
put
(
"acctId"
,
account
.
getAcctId
()
+
""
);
Iterator
<
Map
.
Entry
<
String
,
String
>>
iterator
=
map
.
entrySet
().
iterator
();
data
.
put
(
"mobile"
,
account
.
getMobilePhone
());
data
.
put
(
"name"
,
account
.
getMobilePhone
().
replaceAll
(
"(\\d{3})\\d{4}(\\w{4})"
,
"$1****$2"
));
data
.
put
(
"created_time"
,
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
).
format
(
account
.
getCreatTime
()));
data
.
put
(
"sysCode"
,
sourceType
);
Iterator
<
Map
.
Entry
<
String
,
String
>>
iterator
=
data
.
entrySet
().
iterator
();
while
(
iterator
.
hasNext
())
{
while
(
iterator
.
hasNext
())
{
Map
.
Entry
<
String
,
String
>
mapData
=
iterator
.
next
();
Map
.
Entry
<
String
,
String
>
map
=
iterator
.
next
();
String
key
=
mapData
.
getKey
();
String
key
=
map
.
getKey
();
String
valueInfo
=
mapData
.
getValue
();
String
valueInfo
=
map
.
getValue
();
//存储token:(token-doctor-1:用户数据)
//存储token:(token-doctor-1:用户数据)
cacheClient
.
hset
(
tokenDoctorId
,
key
,
valueInfo
);
cacheClient
.
hset
(
value
,
key
,
valueInfo
);
}
}
}
else
{
}
else
{
//每次登录成功,手动更新token
cacheClient
.
hset
(
value
,
"token"
,
newToken
);
cacheClient
.
hset
(
tokenDoctorId
,
"token"
,
newToken
);
}
}
catch
(
Exception
ex
)
{
logger
.
error
(
"生成token异常:{}"
+
ex
.
getMessage
(),
ex
);
}
}
return
newToken
;
return
newToken
;
}
}
...
...
server/src/main/resources/bootstrap-prod.properties
浏览文件 @
3e62a3e1
...
@@ -40,3 +40,7 @@ memcached.url=172.19.121.31:11211
...
@@ -40,3 +40,7 @@ memcached.url=172.19.121.31:11211
weChatAppID
=
wx5103ed453ef2dbe8
weChatAppID
=
wx5103ed453ef2dbe8
weChatAppSecret
=
6faa9bef3302786c08b2baf278613f38
weChatAppSecret
=
6faa9bef3302786c08b2baf278613f38
weChatURL
=
https://api.weixin.qq.com/sns/userinfo?
weChatURL
=
https://api.weixin.qq.com/sns/userinfo?
#是否开启双写模式,是否需要向p_doctor表写数据
doubleWritingMode
=
true
server/src/main/resources/bootstrap-test1.properties
浏览文件 @
3e62a3e1
...
@@ -40,3 +40,13 @@ memcached.url=192.168.130.230:11211
...
@@ -40,3 +40,13 @@ memcached.url=192.168.130.230:11211
weChatAppID
=
wx5103ed453ef2dbe8
weChatAppID
=
wx5103ed453ef2dbe8
weChatAppSecret
=
6faa9bef3302786c08b2baf278613f38
weChatAppSecret
=
6faa9bef3302786c08b2baf278613f38
weChatURL
=
https://api.weixin.qq.com/sns/userinfo?
weChatURL
=
https://api.weixin.qq.com/sns/userinfo?
#是否开启双写模式,是否需要向p_doctor表写数据
doubleWritingMode
=
true
#rabbitmq settings
spring.rabbitmq.host
=
192.168.110.206
spring.rabbitmq.port
=
5672
spring.rabbitmq.username
=
appuser
spring.rabbitmq.password
=
AqLfvyWOvLQEUzdI
spring.rabbitmq.virtual-host
=
account-register-vhost
\ No newline at end of file
server/src/main/resources/bootstrap-test2.properties
浏览文件 @
3e62a3e1
...
@@ -40,3 +40,13 @@ memcached.url=192.168.130.230:11211
...
@@ -40,3 +40,13 @@ memcached.url=192.168.130.230:11211
weChatAppID
=
wx5103ed453ef2dbe8
weChatAppID
=
wx5103ed453ef2dbe8
weChatAppSecret
=
6faa9bef3302786c08b2baf278613f38
weChatAppSecret
=
6faa9bef3302786c08b2baf278613f38
weChatURL
=
https://api.weixin.qq.com/sns/userinfo?
weChatURL
=
https://api.weixin.qq.com/sns/userinfo?
#是否开启双写模式,是否需要向p_doctor表写数据
doubleWritingMode
=
true
#rabbitmq settings
spring.rabbitmq.host
=
192.168.110.206
spring.rabbitmq.port
=
5672
spring.rabbitmq.username
=
appuser
spring.rabbitmq.password
=
AqLfvyWOvLQEUzdI
spring.rabbitmq.virtual-host
=
account-register-vhost
\ No newline at end of file
server/src/main/resources/bootstrap-uat.properties
浏览文件 @
3e62a3e1
...
@@ -40,3 +40,13 @@ memcached.url=192.168.130.230:11211
...
@@ -40,3 +40,13 @@ memcached.url=192.168.130.230:11211
weChatAppID
=
wx5103ed453ef2dbe8
weChatAppID
=
wx5103ed453ef2dbe8
weChatAppSecret
=
6faa9bef3302786c08b2baf278613f38
weChatAppSecret
=
6faa9bef3302786c08b2baf278613f38
weChatURL
=
https://api.weixin.qq.com/sns/userinfo?
weChatURL
=
https://api.weixin.qq.com/sns/userinfo?
#是否开启双写模式,是否需要向p_doctor表写数据
doubleWritingMode
=
true
#rabbitmq settings
spring.rabbitmq.host
=
192.168.110.206
spring.rabbitmq.port
=
5672
spring.rabbitmq.username
=
appuser
spring.rabbitmq.password
=
AqLfvyWOvLQEUzdI
spring.rabbitmq.virtual-host
=
account-register-vhost
\ No newline at end of file
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录