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
提交
97c7d9db
提交
97c7d9db
编写于
3月 23, 2020
作者:
rushui.chen
浏览文件
操作
浏览文件
下载
差异文件
20200323 测试代码
上级
3ebfd83a
74b22cbe
流水线
#23351
已失败 于阶段
in 0 second
变更
26
流水线
1
显示空白字符变更
内嵌
并排
正在显示
26 个修改的文件
包含
1875 行增加
和
0 行删除
+1875
-0
ThreadPoolConfig.java
...ccount/account/server/configuration/ThreadPoolConfig.java
+32
-0
AccountAppleInfo.java
...cloud/account/account/server/entity/AccountAppleInfo.java
+95
-0
LogLoginOnekey.java
...a/cloud/account/account/server/entity/LogLoginOnekey.java
+135
-0
MobileDataEntity.java
...cloud/account/account/server/entity/MobileDataEntity.java
+56
-0
QueryMobileEntity.java
...loud/account/account/server/entity/QueryMobileEntity.java
+76
-0
RcRepTypeEnum.java
...ica/cloud/account/account/server/enums/RcRepTypeEnum.java
+47
-0
SourceTypeEnum.java
...ca/cloud/account/account/server/enums/SourceTypeEnum.java
+43
-0
AccountAppleInfoMapper.java
...account/account/server/mapper/AccountAppleInfoMapper.java
+18
-0
LogLoginOnekeyMapper.java
...d/account/account/server/mapper/LogLoginOnekeyMapper.java
+17
-0
OneClickProcessor.java
...cloud/account/account/server/model/OneClickProcessor.java
+126
-0
OneClickLoginReq.java
...ca/cloud/account/account/server/req/OneClickLoginReq.java
+49
-0
QueryMobileReq.java
...pica/cloud/account/account/server/req/QueryMobileReq.java
+64
-0
UnifiedVerificationResp.java
.../account/account/server/resp/UnifiedVerificationResp.java
+35
-0
AuthCodeService.java
...cloud/account/account/server/service/AuthCodeService.java
+22
-0
AuthCodeServiceImpl.java
...ount/account/server/service/impl/AuthCodeServiceImpl.java
+157
-0
Base64.java
...va/com/pica/cloud/account/account/server/util/Base64.java
+172
-0
ByteFormat.java
...om/pica/cloud/account/account/server/util/ByteFormat.java
+58
-0
HttpUtil.java
.../com/pica/cloud/account/account/server/util/HttpUtil.java
+64
-0
IPUtil.java
...va/com/pica/cloud/account/account/server/util/IPUtil.java
+76
-0
MD5.java
.../java/com/pica/cloud/account/account/server/util/MD5.java
+44
-0
SignUtils.java
...com/pica/cloud/account/account/server/util/SignUtils.java
+52
-0
OneClickLoginResultVo.java
...loud/account/account/server/vo/OneClickLoginResultVo.java
+21
-0
mybatis-generator.xml
server/src/main/resources/mybatis-generator.xml
+49
-0
AccountAppleInfoMapper.xml
server/src/main/resources/mybatis/AccountAppleInfoMapper.xml
+137
-0
LogLoginOnekeyMapper.xml
server/src/main/resources/mybatis/LogLoginOnekeyMapper.xml
+188
-0
AccountWeChatInfoMapperTest.java
...nt/account/server/mapper/AccountWeChatInfoMapperTest.java
+42
-0
未找到文件。
server/src/main/java/com/pica/cloud/account/account/server/configuration/ThreadPoolConfig.java
0 → 100644
浏览文件 @
97c7d9db
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
configuration
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
java.util.concurrent.ThreadPoolExecutor
;
/**
* @Description ThreadPoolConfig
* @Author Chongwen.jiang
* @Date 2020/2/27 16:37
* @ModifyDate 2020/2/27 16:37
* @Params
* @Return
*/
@Configuration
public
class
ThreadPoolConfig
{
@Bean
(
name
=
"accountThreadPool"
)
public
ThreadPoolTaskExecutor
getExecutor
()
{
ThreadPoolTaskExecutor
executor
=
new
ThreadPoolTaskExecutor
();
executor
.
setCorePoolSize
(
3
);
executor
.
setMaxPoolSize
(
10
);
executor
.
setQueueCapacity
(
100
);
executor
.
setKeepAliveSeconds
(
60
);
executor
.
setThreadNamePrefix
(
"account_ThreadPool"
);
executor
.
setRejectedExecutionHandler
(
new
ThreadPoolExecutor
.
CallerRunsPolicy
());
executor
.
initialize
();
System
.
out
.
println
(
"accountThreadPool init end-"
);
return
executor
;
}
}
server/src/main/java/com/pica/cloud/account/account/server/entity/AccountAppleInfo.java
0 → 100644
浏览文件 @
97c7d9db
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
entity
;
import
java.util.Date
;
public
class
AccountAppleInfo
{
private
Integer
id
;
private
String
appleUserId
;
private
String
appleId
;
private
String
info
;
private
Integer
deleteFlag
;
private
Integer
createdId
;
private
Date
createdTime
;
private
Integer
modifiedId
;
private
Date
modifiedTime
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
String
getAppleUserId
()
{
return
appleUserId
;
}
public
void
setAppleUserId
(
String
appleUserId
)
{
this
.
appleUserId
=
appleUserId
==
null
?
null
:
appleUserId
.
trim
();
}
public
String
getAppleId
()
{
return
appleId
;
}
public
void
setAppleId
(
String
appleId
)
{
this
.
appleId
=
appleId
==
null
?
null
:
appleId
.
trim
();
}
public
String
getInfo
()
{
return
info
;
}
public
void
setInfo
(
String
info
)
{
this
.
info
=
info
==
null
?
null
:
info
.
trim
();
}
public
Integer
getDeleteFlag
()
{
return
deleteFlag
;
}
public
void
setDeleteFlag
(
Integer
deleteFlag
)
{
this
.
deleteFlag
=
deleteFlag
;
}
public
Integer
getCreatedId
()
{
return
createdId
;
}
public
void
setCreatedId
(
Integer
createdId
)
{
this
.
createdId
=
createdId
;
}
public
Date
getCreatedTime
()
{
return
createdTime
;
}
public
void
setCreatedTime
(
Date
createdTime
)
{
this
.
createdTime
=
createdTime
;
}
public
Integer
getModifiedId
()
{
return
modifiedId
;
}
public
void
setModifiedId
(
Integer
modifiedId
)
{
this
.
modifiedId
=
modifiedId
;
}
public
Date
getModifiedTime
()
{
return
modifiedTime
;
}
public
void
setModifiedTime
(
Date
modifiedTime
)
{
this
.
modifiedTime
=
modifiedTime
;
}
}
\ No newline at end of file
server/src/main/java/com/pica/cloud/account/account/server/entity/LogLoginOnekey.java
0 → 100644
浏览文件 @
97c7d9db
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
entity
;
import
java.util.Date
;
public
class
LogLoginOnekey
{
private
Integer
id
;
private
Integer
logLoginId
;
private
Integer
deviceType
;
private
String
mobile
;
private
String
tradeNo
;
private
Integer
fanqizha
;
private
String
tag
;
private
String
info
;
private
Integer
deleteFlag
;
private
Integer
createId
;
private
Date
createTime
;
private
Integer
modifyId
;
private
Date
modifyTime
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
Integer
getLogLoginId
()
{
return
logLoginId
;
}
public
void
setLogLoginId
(
Integer
logLoginId
)
{
this
.
logLoginId
=
logLoginId
;
}
public
Integer
getDeviceType
()
{
return
deviceType
;
}
public
void
setDeviceType
(
Integer
deviceType
)
{
this
.
deviceType
=
deviceType
;
}
public
String
getMobile
()
{
return
mobile
;
}
public
void
setMobile
(
String
mobile
)
{
this
.
mobile
=
mobile
==
null
?
null
:
mobile
.
trim
();
}
public
String
getTradeNo
()
{
return
tradeNo
;
}
public
void
setTradeNo
(
String
tradeNo
)
{
this
.
tradeNo
=
tradeNo
==
null
?
null
:
tradeNo
.
trim
();
}
public
Integer
getFanqizha
()
{
return
fanqizha
;
}
public
void
setFanqizha
(
Integer
fanqizha
)
{
this
.
fanqizha
=
fanqizha
;
}
public
String
getTag
()
{
return
tag
;
}
public
void
setTag
(
String
tag
)
{
this
.
tag
=
tag
==
null
?
null
:
tag
.
trim
();
}
public
String
getInfo
()
{
return
info
;
}
public
void
setInfo
(
String
info
)
{
this
.
info
=
info
==
null
?
null
:
info
.
trim
();
}
public
Integer
getDeleteFlag
()
{
return
deleteFlag
;
}
public
void
setDeleteFlag
(
Integer
deleteFlag
)
{
this
.
deleteFlag
=
deleteFlag
;
}
public
Integer
getCreateId
()
{
return
createId
;
}
public
void
setCreateId
(
Integer
createId
)
{
this
.
createId
=
createId
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
public
Integer
getModifyId
()
{
return
modifyId
;
}
public
void
setModifyId
(
Integer
modifyId
)
{
this
.
modifyId
=
modifyId
;
}
public
Date
getModifyTime
()
{
return
modifyTime
;
}
public
void
setModifyTime
(
Date
modifyTime
)
{
this
.
modifyTime
=
modifyTime
;
}
}
\ No newline at end of file
server/src/main/java/com/pica/cloud/account/account/server/entity/MobileDataEntity.java
0 → 100644
浏览文件 @
97c7d9db
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
entity
;
/**
* @program: pica-cloud-account
* @description:
* @author: wfy
* @create: 2020-02-12 17:09
*/
public
class
MobileDataEntity
{
private
String
mobileName
;
private
String
tradeNo
;
private
Integer
fanqizha
;
private
String
tag
;
public
String
getMobileName
()
{
return
mobileName
;
}
public
void
setMobileName
(
String
mobileName
)
{
this
.
mobileName
=
mobileName
;
}
public
String
getTradeNo
()
{
return
tradeNo
;
}
public
void
setTradeNo
(
String
tradeNo
)
{
this
.
tradeNo
=
tradeNo
;
}
public
Integer
getFanqizha
()
{
return
fanqizha
;
}
public
void
setFanqizha
(
Integer
fanqizha
)
{
this
.
fanqizha
=
fanqizha
;
}
public
String
getTag
()
{
return
tag
;
}
public
void
setTag
(
String
tag
)
{
this
.
tag
=
tag
;
}
@Override
public
String
toString
()
{
return
"MobileDataEntity{"
+
"mobileName='"
+
mobileName
+
'\''
+
", tradeNo='"
+
tradeNo
+
'\''
+
", fanqizha="
+
fanqizha
+
", tag='"
+
tag
+
'\''
+
'}'
;
}
}
server/src/main/java/com/pica/cloud/account/account/server/entity/QueryMobileEntity.java
0 → 100644
浏览文件 @
97c7d9db
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
entity
;
/**
* @program: pica-cloud-account
* @description:
* @author: wfy
* @create: 2020-02-12 17:06
*/
public
class
QueryMobileEntity
{
private
String
code
;
private
String
message
;
private
Integer
chargeStatus
;
private
MobileDataEntity
data
;
private
String
mobile
;
private
Integer
sourceType
;
public
Integer
getSourceType
()
{
return
sourceType
;
}
public
void
setSourceType
(
Integer
sourceType
)
{
this
.
sourceType
=
sourceType
;
}
public
String
getMobile
()
{
return
mobile
;
}
public
void
setMobile
(
String
mobile
)
{
this
.
mobile
=
mobile
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getMessage
()
{
return
message
;
}
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
public
Integer
getChargeStatus
()
{
return
chargeStatus
;
}
public
void
setChargeStatus
(
Integer
chargeStatus
)
{
this
.
chargeStatus
=
chargeStatus
;
}
public
MobileDataEntity
getData
()
{
return
data
;
}
public
void
setData
(
MobileDataEntity
data
)
{
this
.
data
=
data
;
}
@Override
public
String
toString
()
{
return
"QueryMobileEntity{"
+
"code='"
+
code
+
'\''
+
", message='"
+
message
+
'\''
+
", chargeStatus="
+
chargeStatus
+
", data="
+
data
+
", mobile='"
+
mobile
+
'\''
+
", sourceType="
+
sourceType
+
'}'
;
}
}
server/src/main/java/com/pica/cloud/account/account/server/enums/RcRepTypeEnum.java
0 → 100644
浏览文件 @
97c7d9db
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
enums
;
/**
* @Description 统一校验响应枚举类
* @Author Chongwen.jiang
* @Date 2020/2/20 18:19
* @ModifyDate 2020/2/20 18:19
* @Params
* @Return
*/
public
enum
RcRepTypeEnum
{
// 风控禁止发送
RC_SEND_FAIL
(
"2"
,
"发送失败"
),
RC_TRIGGER
(
"3"
,
"需要触发风控滑动验证"
),
// 账号、IP、设备在黑名单内,前端提示发送成功,后端不发送短信
RC_BLACKLIST
(
"4"
,
"发送成功"
),
RC_DAY_LIMIT
(
"5"
,
"今日获取验证码次数已超过上限,请使用账户密码登录"
),
RC_60_SECOND_LIMIT
(
"6"
,
"验证码发送频率过高,请{remainTime}秒后再试"
),
XXX
(
"0"
,
"xxxxxx"
);
private
String
code
;
private
String
msg
;
RcRepTypeEnum
(
String
code
,
String
msg
)
{
this
.
code
=
code
;
this
.
msg
=
msg
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getMsg
()
{
return
msg
;
}
public
void
setType
(
String
msg
)
{
this
.
msg
=
msg
;
}
}
server/src/main/java/com/pica/cloud/account/account/server/enums/SourceTypeEnum.java
0 → 100644
浏览文件 @
97c7d9db
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
enums
;
/**
* @Description 统一校验业务类型枚举类
* @Author Chongwen.jiang
* @Date 2020/2/20 18:19
* @ModifyDate 2020/2/20 18:19
* @Params
* @Return
*/
public
enum
SourceTypeEnum
{
ANDROID
(
1
,
"安卓"
),
APPLE
(
2
,
"ios"
),
SAAS
(
3
,
"saas"
),
H5
(
4
,
"h5"
),
ADMIN
(
5
,
"admin"
),
XXX
(
10
,
"xxxxxx"
);
private
Integer
code
;
private
String
type
;
SourceTypeEnum
(
Integer
code
,
String
type
)
{
this
.
code
=
code
;
this
.
type
=
type
;
}
public
Integer
getCode
()
{
return
code
;
}
public
void
setCode
(
Integer
code
)
{
this
.
code
=
code
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
}
server/src/main/java/com/pica/cloud/account/account/server/mapper/AccountAppleInfoMapper.java
0 → 100644
浏览文件 @
97c7d9db
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
mapper
;
import
com.pica.cloud.account.account.server.entity.AccountAppleInfo
;
import
org.apache.ibatis.annotations.Param
;
public
interface
AccountAppleInfoMapper
{
int
insert
(
AccountAppleInfo
record
);
int
insertSelective
(
AccountAppleInfo
record
);
AccountAppleInfo
selectByPrimaryKey
(
Integer
id
);
int
updateByPrimaryKeySelective
(
AccountAppleInfo
record
);
int
updateByPrimaryKey
(
AccountAppleInfo
record
);
AccountAppleInfo
selectByUserId
(
@Param
(
"id"
)
String
appleUserId
);
}
\ No newline at end of file
server/src/main/java/com/pica/cloud/account/account/server/mapper/LogLoginOnekeyMapper.java
0 → 100644
浏览文件 @
97c7d9db
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
mapper
;
import
com.pica.cloud.account.account.server.entity.LogLoginOnekey
;
public
interface
LogLoginOnekeyMapper
{
int
deleteByPrimaryKey
(
Integer
id
);
int
insert
(
LogLoginOnekey
record
);
int
insertSelective
(
LogLoginOnekey
record
);
LogLoginOnekey
selectByPrimaryKey
(
Integer
id
);
int
updateByPrimaryKeySelective
(
LogLoginOnekey
record
);
int
updateByPrimaryKey
(
LogLoginOnekey
record
);
}
\ No newline at end of file
server/src/main/java/com/pica/cloud/account/account/server/model/OneClickProcessor.java
0 → 100644
浏览文件 @
97c7d9db
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
model
;
import
com.alibaba.fastjson.JSONObject
;
import
com.pica.cloud.account.account.server.entity.LogLoginOnekey
;
import
com.pica.cloud.account.account.server.entity.MobileDataEntity
;
import
com.pica.cloud.account.account.server.entity.QueryMobileEntity
;
import
com.pica.cloud.account.account.server.mapper.LogLoginOnekeyMapper
;
import
com.pica.cloud.account.account.server.util.AESUtil
;
import
com.pica.cloud.account.account.server.util.HttpUtil
;
import
com.pica.cloud.account.account.server.util.MD5
;
import
com.pica.cloud.account.account.server.util.RSAUtil
;
import
com.pica.cloud.account.account.server.util.SignUtils
;
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.Value
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Component
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @program: pica-cloud-account
* @description:
* @author: wfy
* @create: 2020-02-24 13:57
*/
@Component
public
class
OneClickProcessor
{
private
static
final
String
DEFAULT_ENCRYPT_TYPE
=
"0"
;
private
Logger
logger
=
LoggerFactory
.
getLogger
(
this
.
getClass
());
//手机号加解密方式 0 AES 1 RSA , 可以不传,不传则手机号解密直接使用AES解密
private
String
aesEncryptType
=
DEFAULT_ENCRYPT_TYPE
;
private
String
rsaEncryptType
=
"1"
;
private
String
encryptType
=
DEFAULT_ENCRYPT_TYPE
;
private
static
final
String
SHANYAN_SUCCESS_CODE
=
"200000"
;
//创建应用时填入的rsa公钥对应的私钥字符串
public
static
final
String
privateKey
=
""
;
public
static
final
Integer
TYPE_IOS
=
2
;
public
static
final
Integer
TYPE_ANDROID
=
1
;
private
static
final
String
TOKEN
=
"token"
;
private
static
final
String
APPID
=
"appId"
;
private
static
final
String
ENCRYPT_TYPE
=
"encryptType"
;
private
static
final
String
SIGN
=
"sign"
;
@Value
(
"${shanyan.url.mobilequery}"
)
private
String
mobileQueryUrl
;
@Value
(
"${shanyan.android.appId}"
)
private
String
androidAppId
;
@Value
(
"${shanyan.android.appKey}"
)
private
String
androidAppKey
;
@Value
(
"${shanyan.ios.appId}"
)
private
String
iosAppId
;
@Value
(
"${shanyan.ios.appKey}"
)
private
String
iosAppKey
;
@Autowired
private
LogLoginOnekeyMapper
logLoginOnekeyMapper
;
public
QueryMobileEntity
tokenExchangeMobile
(
String
token
,
Integer
type
)
{
if
(
type
==
null
||
StringUtils
.
isEmpty
(
token
))
{
return
null
;
}
String
appId
;
String
appKey
;
if
(
type
.
equals
(
TYPE_ANDROID
))
{
appId
=
androidAppId
;
appKey
=
androidAppKey
;
}
else
if
(
type
.
equals
(
TYPE_IOS
))
{
appId
=
iosAppId
;
appKey
=
iosAppKey
;
}
else
{
return
null
;
}
//从SDK获取的token参数
QueryMobileEntity
queryMobileEntity
=
null
;
try
{
Map
<
String
,
String
>
params
=
new
HashMap
<>();
params
.
put
(
TOKEN
,
token
);
params
.
put
(
APPID
,
appId
);
params
.
put
(
ENCRYPT_TYPE
,
encryptType
);
//可以不传,不传则解密直接使用AES解密
params
.
put
(
SIGN
,
SignUtils
.
getSign
(
params
,
appKey
));
queryMobileEntity
=
HttpUtil
.
postForm
(
mobileQueryUrl
,
params
,
QueryMobileEntity
.
class
);
if
(
null
!=
queryMobileEntity
)
{
logger
.
info
(
"一键登录token换取手机号结果:{}"
,
queryMobileEntity
);
String
code
=
queryMobileEntity
.
getCode
();
//返回码 200000为成功
if
(
SHANYAN_SUCCESS_CODE
.
equals
(
code
))
{
MobileDataEntity
mobileDataEntity
=
queryMobileEntity
.
getData
();
String
mobile
=
mobileDataEntity
.
getMobileName
();
if
(
aesEncryptType
.
equals
(
encryptType
))
{
String
key
=
MD5
.
getMD5Code
(
appKey
);
mobile
=
AESUtil
.
decrypt
(
mobile
,
key
.
substring
(
0
,
16
),
key
.
substring
(
16
));
}
else
if
(
rsaEncryptType
.
equals
(
encryptType
))
{
mobile
=
RSAUtil
.
decryptByPrivateKeyForLongStr
(
mobile
,
privateKey
);
}
queryMobileEntity
.
setMobile
(
mobile
);
}
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
());
}
return
queryMobileEntity
;
}
@Async
public
void
savelogLoginOnekey
(
QueryMobileEntity
queryMobileEntity
,
Integer
logLoginId
)
{
LogLoginOnekey
l
=
new
LogLoginOnekey
();
l
.
setDeviceType
(
queryMobileEntity
.
getSourceType
());
MobileDataEntity
data
=
queryMobileEntity
.
getData
();
l
.
setFanqizha
(
data
.
getFanqizha
());
l
.
setTradeNo
(
data
.
getTradeNo
());
l
.
setMobile
(
AESUtil
.
encryptV0
(
queryMobileEntity
.
getMobile
()));
l
.
setLogLoginId
(
logLoginId
);
l
.
setInfo
(
JSONObject
.
toJSONString
(
queryMobileEntity
));
Date
d
=
new
Date
();
l
.
setCreateId
(-
1
);
l
.
setCreateTime
(
d
);
l
.
setModifyId
(-
1
);
l
.
setModifyTime
(
d
);
logLoginOnekeyMapper
.
insertSelective
(
l
);
}
}
server/src/main/java/com/pica/cloud/account/account/server/req/OneClickLoginReq.java
0 → 100644
浏览文件 @
97c7d9db
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
req
;
/**
* @program: pica-cloud-account
* @description:
* @author: wfy
* @create: 2020-02-12 15:58
*/
public
class
OneClickLoginReq
{
private
Integer
sourceType
;
private
String
token
=
""
;
private
String
loginIp
;
private
int
productType
;
public
String
getLoginIp
()
{
return
loginIp
;
}
public
void
setLoginIp
(
String
loginIp
)
{
this
.
loginIp
=
loginIp
;
}
public
int
getProductType
()
{
return
productType
;
}
public
void
setProductType
(
int
productType
)
{
this
.
productType
=
productType
;
}
public
String
getToken
()
{
return
token
;
}
public
void
setToken
(
String
token
)
{
this
.
token
=
token
;
}
public
Integer
getSourceType
()
{
return
sourceType
;
}
public
void
setSourceType
(
Integer
sourceType
)
{
this
.
sourceType
=
sourceType
;
}
}
server/src/main/java/com/pica/cloud/account/account/server/req/QueryMobileReq.java
0 → 100644
浏览文件 @
97c7d9db
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
req
;
/**
* @program: pica-cloud-account
* @description:
* @author: wfy
* @create: 2020-02-12 17:11
*/
public
class
QueryMobileReq
{
private
String
token
;
private
String
appId
;
private
String
clientIp
;
private
String
encryptType
;
private
String
outId
;
private
String
sign
;
public
String
getToken
()
{
return
token
;
}
public
void
setToken
(
String
token
)
{
this
.
token
=
token
;
}
public
String
getAppId
()
{
return
appId
;
}
public
void
setAppId
(
String
appId
)
{
this
.
appId
=
appId
;
}
public
String
getClientIp
()
{
return
clientIp
;
}
public
void
setClientIp
(
String
clientIp
)
{
this
.
clientIp
=
clientIp
;
}
public
String
getEncryptType
()
{
return
encryptType
;
}
public
void
setEncryptType
(
String
encryptType
)
{
this
.
encryptType
=
encryptType
;
}
public
String
getOutId
()
{
return
outId
;
}
public
void
setOutId
(
String
outId
)
{
this
.
outId
=
outId
;
}
public
String
getSign
()
{
return
sign
;
}
public
void
setSign
(
String
sign
)
{
this
.
sign
=
sign
;
}
}
server/src/main/java/com/pica/cloud/account/account/server/resp/UnifiedVerificationResp.java
0 → 100644
浏览文件 @
97c7d9db
// Copyright 2016-2101 Pica.
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
resp
;
import
io.swagger.annotations.ApiModel
;
/**
* @ClassName UnifiedVerificationResp
* @Description 统一验证响应类
* @Author Chongwen.jiang
* @Date 2020/2/20 20:48
* @ModifyDate 2020/2/20 20:48
* @Version 1.0
*/
@ApiModel
(
value
=
"UnifiedVerificationResp"
,
description
=
"统一验证响应类"
)
public
class
UnifiedVerificationResp
{
private
Integer
bizCode
;
private
String
bizMsg
;
public
Integer
getBizCode
()
{
return
bizCode
;
}
public
void
setBizCode
(
Integer
bizCode
)
{
this
.
bizCode
=
bizCode
;
}
public
String
getBizMsg
()
{
return
bizMsg
;
}
public
void
setBizMsg
(
String
bizMsg
)
{
this
.
bizMsg
=
bizMsg
;
}
}
server/src/main/java/com/pica/cloud/account/account/server/service/AuthCodeService.java
0 → 100644
浏览文件 @
97c7d9db
// Copyright 2016-2101 Pica.
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
service
;
import
com.pica.cloud.account.account.server.req.BaseRequest
;
import
javax.servlet.http.HttpServletRequest
;
/**
* @ClassName AuthCodeService
* @Description 验证码业务
* @Author Chongwen.jiang
* @Date 2020/3/5 17:01
* @ModifyDate 2020/3/5 17:01
* @Version 1.0
*/
public
interface
AuthCodeService
{
void
rcValidate
(
HttpServletRequest
request
,
BaseRequest
baseRequest
,
String
deviceInfoStr
);
void
recordRcData
(
HttpServletRequest
req
,
BaseRequest
baseRequest
,
String
deviceIp
);
}
server/src/main/java/com/pica/cloud/account/account/server/service/impl/AuthCodeServiceImpl.java
0 → 100644
浏览文件 @
97c7d9db
// Copyright 2016-2101 Pica.
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONException
;
import
com.pica.cloud.account.account.server.constants.Constants
;
import
com.pica.cloud.account.account.server.enums.AccountExceptionEnum
;
import
com.pica.cloud.account.account.server.enums.RcRepTypeEnum
;
import
com.pica.cloud.account.account.server.req.BaseRequest
;
import
com.pica.cloud.account.account.server.service.AuthCodeService
;
import
com.pica.cloud.account.account.server.util.AESUtil
;
import
com.pica.cloud.account.account.server.util.IPUtil
;
import
com.pica.cloud.account.account.server.util.PICAPDeviceInfo
;
import
com.pica.cloud.foundation.entity.PicaResponse
;
import
com.pica.cloud.foundation.entity.PicaResultCode
;
import
com.pica.cloud.foundation.entity.PicaWarnException
;
import
com.pica.cloud.foundation.redis.ICacheClient
;
import
com.pica.cloud.riskcontrol.riskcontrol.client.CheckCodeClient
;
import
com.pica.cloud.riskcontrol.riskcontrol.common.req.CheckcodeRiskReq
;
import
com.pica.cloud.riskcontrol.riskcontrol.common.resp.CheckcodeRiskResp
;
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.Qualifier
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
org.springframework.stereotype.Service
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Objects
;
/**
* @ClassName AuthCodeServiceImpl
* @Description
* @Author Chongwen.jiang
* @Date 2020/3/5 17:01
* @ModifyDate 2020/3/5 17:01
* @Version 1.0
*/
@Service
public
class
AuthCodeServiceImpl
implements
AuthCodeService
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
this
.
getClass
());
@Autowired
private
CheckCodeClient
rcClient
;
@Autowired
private
ICacheClient
cacheClient
;
@Autowired
@Qualifier
(
"accountThreadPool"
)
private
ThreadPoolTaskExecutor
threadPoolTaskExecutor
;
/**
* @Description 调用风控接口
* @Author Chongwen.jiang
* @Date 2020/2/21 17:12
* @ModifyDate 2020/2/21 17:12
* @Params [mobile]
* @Return com.pica.cloud.account.account.server.resp.UnifiedVerificationResp
*/
@Override
public
void
rcValidate
(
HttpServletRequest
request
,
BaseRequest
baseRequest
,
String
deviceInfoStr
)
{
// 调用风控接口
PicaResponse
picaResponse
=
null
;
try
{
PICAPDeviceInfo
deviceInfo
=
JSON
.
parseObject
(
deviceInfoStr
,
PICAPDeviceInfo
.
class
);
String
publicIp
=
IPUtil
.
getIpAdrress
(
request
);
String
deviceToken
=
baseRequest
.
getDevice_token
();
CheckcodeRiskReq
rcReq
=
new
CheckcodeRiskReq
();
rcReq
.
setMobile
(
baseRequest
.
getMobile
());
rcReq
.
setIp
(
publicIp
);
rcReq
.
setDeviceIp
(
deviceInfo
.
getDevice_ip
());
rcReq
.
setDeviceId
(
deviceToken
);
logger
.
info
(
"rc-checkcodeRisk-req:{}"
,
JSON
.
toJSONString
(
rcReq
));
picaResponse
=
rcClient
.
checkcodeRisk
(
rcReq
);
logger
.
info
(
"rc-checkcodeRisk-resp:{}"
,
JSON
.
toJSONString
(
picaResponse
));
}
catch
(
JSONException
e
)
{
logger
.
error
(
"rc-checkcodeRisk-JSONException"
,
e
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"rc-checkcodeRisk-invoke-exception"
,
e
);
}
if
(
picaResponse
!=
null
&&
PicaResultCode
.
SUCCESS
.
code
().
equals
(
picaResponse
.
getCode
()))
{
Object
data
=
picaResponse
.
getData
();
if
(
Objects
.
nonNull
(
data
))
{
CheckcodeRiskResp
respData
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
data
),
CheckcodeRiskResp
.
class
);
if
(
StringUtils
.
isNotEmpty
(
respData
.
getProcessCode
()))
{
String
processCode
=
respData
.
getProcessCode
();
if
(
StringUtils
.
isNotEmpty
(
processCode
))
{
// 请求返回正常
if
(
processCode
.
equals
(
RcRepTypeEnum
.
RC_SEND_FAIL
.
getCode
()))
{
throw
new
PicaWarnException
(
AccountExceptionEnum
.
PICA_RC_SEND_FAIL
.
getCode
(),
AccountExceptionEnum
.
PICA_RC_SEND_FAIL
.
getMessage
());
}
else
if
(
processCode
.
equals
(
RcRepTypeEnum
.
RC_TRIGGER
.
getCode
()))
{
throw
new
PicaWarnException
(
AccountExceptionEnum
.
PICA_RC_TRIGGER
.
getCode
(),
AccountExceptionEnum
.
PICA_RC_TRIGGER
.
getMessage
());
}
else
if
(
processCode
.
equals
(
RcRepTypeEnum
.
RC_BLACKLIST
.
getCode
()))
{
throw
new
PicaWarnException
(
AccountExceptionEnum
.
PICA_RC_BLACKLIST
.
getCode
(),
AccountExceptionEnum
.
PICA_RC_BLACKLIST
.
getMessage
());
}
else
if
(
processCode
.
equals
(
RcRepTypeEnum
.
RC_DAY_LIMIT
.
getCode
()))
{
throw
new
PicaWarnException
(
AccountExceptionEnum
.
PICA_RC_DAY_LIMIT
.
getCode
(),
AccountExceptionEnum
.
PICA_RC_DAY_LIMIT
.
getMessage
());
}
else
if
(
processCode
.
equals
(
RcRepTypeEnum
.
RC_60_SECOND_LIMIT
.
getCode
()))
{
// 获取剩余秒数
String
authCodeKey
=
Constants
.
AUTH_CODE_PREFIX
+
baseRequest
.
getFlag
()
+
"-"
+
AESUtil
.
encryptV0
(
baseRequest
.
getMobile
())
+
"-secure"
;
Long
time
=
cacheClient
.
get
(
authCodeKey
,
Long
.
class
);
if
(
Objects
.
nonNull
(
time
))
{
int
remainTime
=
59
-
(
int
)
(
System
.
currentTimeMillis
()
-
time
)
/
1000
;
if
(
remainTime
>
0
)
{
throw
new
PicaWarnException
(
AccountExceptionEnum
.
PICA_RC_60_SECOND_LIMIT
.
getCode
(),
AccountExceptionEnum
.
PICA_RC_60_SECOND_LIMIT
.
getMessage
().
replace
(
"{remainTime}"
,
String
.
valueOf
(
remainTime
)));
}
}
else
{
// 刚好60秒缓存时间过去了,也允许发送短信验证码
}
}
else
{
// processCode equals "1" (允许发送短信验证码)
}
}
}
}
}
}
/**
* @Description 记录风控数据
* @Author Chongwen.jiang
* @Date 2020/2/27 16:53
* @ModifyDate 2020/2/27 16:53
* @Params [req, request]
* @Return void
*/
@Override
public
void
recordRcData
(
HttpServletRequest
request
,
BaseRequest
baseRequest
,
String
deviceIp
)
{
CheckcodeRiskReq
rec
=
new
CheckcodeRiskReq
();
rec
.
setMobile
(
baseRequest
.
getMobile
());
rec
.
setIp
(
IPUtil
.
getIpAdrress
(
request
));
rec
.
setDeviceIp
(
deviceIp
);
rec
.
setDeviceId
(
baseRequest
.
getDevice_token
());
try
{
threadPoolTaskExecutor
.
execute
(()
->
{
logger
.
info
(
"recordRcData-execute-{}"
,
JSON
.
toJSONString
(
rec
));
PicaResponse
resp
=
rcClient
.
logSend
(
rec
);
logger
.
info
(
"recordRcData-resp-{}"
,
JSON
.
toJSONString
(
resp
));
});
}
catch
(
Exception
e
)
{
logger
.
error
(
"recordRcData invoke error"
,
e
.
getMessage
());
}
}
}
server/src/main/java/com/pica/cloud/account/account/server/util/Base64.java
0 → 100644
浏览文件 @
97c7d9db
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
util
;
public
final
class
Base64
{
/**
* Base64编码表。
*/
private
static
final
char
[]
BASE64CODE
=
{
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
,
'G'
,
'H'
,
'I'
,
'J'
,
'K'
,
'L'
,
'M'
,
'N'
,
'O'
,
'P'
,
'Q'
,
'R'
,
'S'
,
'T'
,
'U'
,
'V'
,
'W'
,
'X'
,
'Y'
,
'Z'
,
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
,
'g'
,
'h'
,
'i'
,
'j'
,
'k'
,
'l'
,
'm'
,
'n'
,
'o'
,
'p'
,
'q'
,
'r'
,
's'
,
't'
,
'u'
,
'v'
,
'w'
,
'x'
,
'y'
,
'z'
,
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'+'
,
'/'
,
};
/**
* Base64解码表。
*/
private
static
final
byte
[]
BASE64DECODE
=
{
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
// 注意两个63,为兼容SMP,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
62
,
-
1
,
63
,
-
1
,
63
,
// “/”和“-”都翻译成63。
52
,
53
,
54
,
55
,
56
,
57
,
58
,
59
,
60
,
61
,
-
1
,
-
1
,
-
1
,
0
,
-
1
,
-
1
,
-
1
,
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
// 注意两个0:
15
,
16
,
17
,
18
,
19
,
20
,
21
,
22
,
23
,
24
,
25
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
// “A”和“=”都翻译成0。
-
1
,
26
,
27
,
28
,
29
,
30
,
31
,
32
,
33
,
34
,
35
,
36
,
37
,
38
,
39
,
40
,
41
,
42
,
43
,
44
,
45
,
46
,
47
,
48
,
49
,
50
,
51
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
};
private
static
final
int
HEX_255
=
0x0000ff
;
private
static
final
int
HEX_16515072
=
0xfc0000
;
private
static
final
int
HEX_258048
=
0x3f000
;
private
static
final
int
HEX_4032
=
0xfc0
;
private
static
final
int
HEX_63
=
0x3f
;
private
static
final
int
HEX_16711680
=
0xff0000
;
private
static
final
int
HEX_65280
=
0x00ff00
;
private
static
final
int
NUMBER_TWO
=
2
;
private
static
final
int
NUMBER_THREE
=
3
;
private
static
final
int
NUMBER_FOUR
=
4
;
private
static
final
int
NUMBER_SIX
=
6
;
private
static
final
int
NUMBER_EIGHT
=
8
;
private
static
final
int
NUMBER_TWELVE
=
12
;
private
static
final
int
NUMBER_SIXTEEN
=
16
;
private
static
final
int
NUMBER_EIGHTEEN
=
18
;
/**
* 构造方法私有化,防止实例化。
*/
private
Base64
()
{
}
/**
* Base64编码。将字节数组中字节3个一组编码成4个可见字符。
*
* @param b
* 需要被编码的字节数据。
* @return 编码后的Base64字符串。
*/
public
static
String
encode
(
byte
[]
b
)
{
int
code
=
0
;
// 按实际编码后长度开辟内存,加快速度
StringBuffer
sb
=
new
StringBuffer
(
((
b
.
length
-
1
)
/
NUMBER_THREE
)
<<
NUMBER_TWO
+
NUMBER_FOUR
);
// 进行编码
for
(
int
i
=
0
;
i
<
b
.
length
;
i
++)
{
code
|=
(
b
[
i
]
<<
(
NUMBER_SIXTEEN
-
i
%
NUMBER_THREE
*
NUMBER_EIGHT
))
&
(
HEX_255
<<
(
NUMBER_SIXTEEN
-
i
%
NUMBER_THREE
*
NUMBER_EIGHT
));
if
(
i
%
NUMBER_THREE
==
NUMBER_TWO
||
i
==
b
.
length
-
1
)
{
sb
.
append
(
BASE64CODE
[(
code
&
HEX_16515072
)
>>>
NUMBER_EIGHTEEN
]);
sb
.
append
(
BASE64CODE
[(
code
&
HEX_258048
)
>>>
NUMBER_TWELVE
]);
sb
.
append
(
BASE64CODE
[(
code
&
HEX_4032
)
>>>
NUMBER_SIX
]);
sb
.
append
(
BASE64CODE
[
code
&
HEX_63
]);
code
=
0
;
}
}
// 对于长度非3的整数倍的字节数组,编码前先补0,编码后结尾处编码用=代替,
// =的个数和短缺的长度一致,以此来标识出数据实际长度
if
(
b
.
length
%
NUMBER_THREE
>
0
)
{
sb
.
setCharAt
(
sb
.
length
()
-
1
,
'='
);
}
if
(
b
.
length
%
NUMBER_THREE
==
1
)
{
sb
.
setCharAt
(
sb
.
length
()
-
NUMBER_TWO
,
'='
);
}
return
sb
.
toString
();
}
/**
* Base64解码。
*
* @param code
* 用Base64编码的ASCII字符串
* @return 解码后的字节数据
*/
public
static
byte
[]
decode
(
String
code
)
{
// 检查参数合法性
if
(
code
==
null
)
{
return
null
;
}
int
len
=
code
.
length
();
if
(
len
%
NUMBER_FOUR
!=
0
)
{
throw
new
IllegalArgumentException
(
"Base64 string length must be 4*n"
);
}
if
(
code
.
length
()
==
0
)
{
return
new
byte
[
0
];
}
// 统计填充的等号个数
int
pad
=
0
;
if
(
code
.
charAt
(
len
-
1
)
==
'='
)
{
pad
++;
}
if
(
code
.
charAt
(
len
-
NUMBER_TWO
)
==
'='
)
{
pad
++;
}
// 根据填充等号的个数来计算实际数据长度
int
retLen
=
len
/
NUMBER_FOUR
*
NUMBER_THREE
-
pad
;
// 分配字节数组空间
byte
[]
ret
=
new
byte
[
retLen
];
// 查表解码
char
ch1
,
ch2
,
ch3
,
ch4
;
int
i
;
for
(
i
=
0
;
i
<
len
;
i
+=
NUMBER_FOUR
)
{
int
j
=
i
/
NUMBER_FOUR
*
NUMBER_THREE
;
ch1
=
code
.
charAt
(
i
);
ch2
=
code
.
charAt
(
i
+
1
);
ch3
=
code
.
charAt
(
i
+
NUMBER_TWO
);
ch4
=
code
.
charAt
(
i
+
NUMBER_THREE
);
int
tmp
=
(
BASE64DECODE
[
ch1
]
<<
NUMBER_EIGHTEEN
)
|
(
BASE64DECODE
[
ch2
]
<<
NUMBER_TWELVE
)
|
(
BASE64DECODE
[
ch3
]
<<
NUMBER_SIX
)
|
(
BASE64DECODE
[
ch4
]);
ret
[
j
]
=
(
byte
)
((
tmp
&
HEX_16711680
)
>>
NUMBER_SIXTEEN
);
if
(
i
<
len
-
NUMBER_FOUR
)
{
ret
[
j
+
1
]
=
(
byte
)
((
tmp
&
HEX_65280
)
>>
NUMBER_EIGHT
);
ret
[
j
+
NUMBER_TWO
]
=
(
byte
)
((
tmp
&
HEX_255
));
}
else
{
if
(
j
+
1
<
retLen
)
{
ret
[
j
+
1
]
=
(
byte
)
((
tmp
&
HEX_65280
)
>>
NUMBER_EIGHT
);
}
if
(
j
+
NUMBER_TWO
<
retLen
)
{
ret
[
j
+
NUMBER_TWO
]
=
(
byte
)
((
tmp
&
HEX_255
));
}
}
}
return
ret
;
}
}
server/src/main/java/com/pica/cloud/account/account/server/util/ByteFormat.java
0 → 100644
浏览文件 @
97c7d9db
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
util
;
/**
* 格式化操作类
*/
public
class
ByteFormat
{
private
static
final
char
[]
HEX
=
new
char
[]{
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
};
public
ByteFormat
()
{
}
public
static
final
String
bytesToHexString
(
byte
[]
bArray
)
{
StringBuffer
sb
=
new
StringBuffer
(
bArray
.
length
);
for
(
int
i
=
0
;
i
<
bArray
.
length
;
++
i
)
{
String
sTemp
=
Integer
.
toHexString
(
255
&
bArray
[
i
]);
if
(
sTemp
.
length
()
<
2
)
{
sb
.
append
(
0
);
}
sb
.
append
(
sTemp
.
toUpperCase
());
}
return
sb
.
toString
();
}
public
static
byte
[]
hexToBytes
(
String
str
)
{
if
(
str
==
null
)
{
return
null
;
}
else
{
char
[]
hex
=
str
.
toCharArray
();
int
length
=
hex
.
length
/
2
;
byte
[]
raw
=
new
byte
[
length
];
for
(
int
i
=
0
;
i
<
length
;
++
i
)
{
int
high
=
Character
.
digit
(
hex
[
i
*
2
],
16
);
int
low
=
Character
.
digit
(
hex
[
i
*
2
+
1
],
16
);
int
value
=
high
<<
4
|
low
;
if
(
value
>
127
)
{
value
-=
256
;
}
raw
[
i
]
=
(
byte
)
value
;
}
return
raw
;
}
}
public
static
void
main
(
String
[]
args
)
{
byte
[]
data
=
new
byte
[
65536
];
for
(
int
i
=
0
;
i
<
data
.
length
;
++
i
)
{
data
[
i
]
=
(
byte
)
i
;
}
}
}
server/src/main/java/com/pica/cloud/account/account/server/util/HttpUtil.java
0 → 100644
浏览文件 @
97c7d9db
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
util
;
import
com.alibaba.fastjson.JSON
;
import
com.pica.cloud.foundation.utils.utils.HttpClientUtil
;
import
com.pica.cloud.foundation.utils.utils.StringUtil
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.http.HttpEntity
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.client.utils.URIBuilder
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.HttpClients
;
import
org.apache.http.impl.conn.PoolingHttpClientConnectionManager
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.io.IOException
;
import
java.net.URISyntaxException
;
import
java.util.Iterator
;
import
java.util.Map
;
/**
* @program: pica-cloud-account
* @description:
* @author: wfy
* @create: 2020-02-12 17:45
*/
public
class
HttpUtil
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
HttpClientUtil
.
class
);
private
static
final
CloseableHttpClient
hc
;
static
{
PoolingHttpClientConnectionManager
cm
=
new
PoolingHttpClientConnectionManager
();
cm
.
setDefaultMaxPerRoute
(
20
);
cm
.
setMaxTotal
(
200
);
hc
=
HttpClients
.
custom
().
setConnectionManager
(
cm
).
build
();
}
public
static
<
T
>
T
postForm
(
String
url
,
Map
<
String
,
String
>
params
,
Class
<
T
>
clazz
)
throws
IOException
,
URISyntaxException
{
URIBuilder
builder
=
new
URIBuilder
(
url
);
if
(
params
!=
null
&&
params
.
size
()
>
0
)
{
params
.
forEach
((
k
,
v
)
->
{
builder
.
setParameter
(
k
,
v
);
});
}
HttpPost
post
=
new
HttpPost
(
builder
.
build
());
CloseableHttpResponse
resp
=
null
;
T
data
;
try
{
resp
=
hc
.
execute
(
post
);
String
buf
=
IOUtils
.
toString
(
resp
.
getEntity
().
getContent
(),
"utf-8"
);
data
=
StringUtil
.
isNotNull
(
buf
)
?
JSON
.
parseObject
(
buf
,
clazz
)
:
null
;
}
finally
{
if
(
resp
!=
null
)
{
try
{
resp
.
close
();
}
catch
(
IOException
var12
)
{
logger
.
error
(
var12
.
getMessage
());
}
}
}
return
data
;
}
}
server/src/main/java/com/pica/cloud/account/account/server/util/IPUtil.java
0 → 100644
浏览文件 @
97c7d9db
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
util
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Enumeration
;
public
class
IPUtil
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
IPUtil
.
class
);
/**
* @Description 获取请求的外网ip
* @Author Chongwen.jiang
* @Date 2020/2/25 9:34
* @ModifyDate 2020/2/25 9:34
* @Params [request]
* @Return java.lang.String
*/
public
static
String
getIpAdrress
(
HttpServletRequest
request
)
{
String
ip
=
null
;
//X-Forwarded-For:Squid 服务代理
String
ipAddresses
=
request
.
getHeader
(
"X-Forwarded-For"
);
Enumeration
<
String
>
headerNames
=
request
.
getHeaderNames
();
while
(
headerNames
.
hasMoreElements
())
{
//打印所有头信息
String
s
=
headerNames
.
nextElement
();
String
header
=
request
.
getHeader
(
s
);
// System.out.println(s+"::::"+header);
}
// System.out.println("headerNames:"+ JSON.toJSONString(headerNames));
// System.out.println("RemoteHost:"+request.getRemoteHost());
// System.out.println("RemoteAddr:"+request.getRemoteAddr());
String
unknown
=
"unknown"
;
if
(
ipAddresses
==
null
||
ipAddresses
.
length
()
==
0
||
unknown
.
equalsIgnoreCase
(
ipAddresses
))
{
//Proxy-Client-IP:apache 服务代理
ipAddresses
=
request
.
getHeader
(
"Proxy-Client-IP"
);
}
if
(
ipAddresses
==
null
||
ipAddresses
.
length
()
==
0
||
unknown
.
equalsIgnoreCase
(
ipAddresses
))
{
//WL-Proxy-Client-IP:weblogic 服务代理
ipAddresses
=
request
.
getHeader
(
"WL-Proxy-Client-IP"
);
}
if
(
ipAddresses
==
null
||
ipAddresses
.
length
()
==
0
||
unknown
.
equalsIgnoreCase
(
ipAddresses
))
{
//HTTP_CLIENT_IP:有些代理服务器
ipAddresses
=
request
.
getHeader
(
"HTTP_CLIENT_IP"
);
}
if
(
ipAddresses
==
null
||
ipAddresses
.
length
()
==
0
||
unknown
.
equalsIgnoreCase
(
ipAddresses
))
{
//X-Real-IP:nginx服务代理
ipAddresses
=
request
.
getHeader
(
"X-Real-IP"
);
}
//有些网络通过多层代理,那么获取到的ip就会有多个,一般都是通过逗号(,)分割开来,并且第一个ip为客户端的真实IP
if
(
ipAddresses
!=
null
&&
ipAddresses
.
length
()
!=
0
)
{
ip
=
ipAddresses
.
split
(
","
)[
0
];
}
//还是不能获取到,最后再通过request.getRemoteAddr();获取
if
(
ip
==
null
||
ip
.
length
()
==
0
||
unknown
.
equalsIgnoreCase
(
ipAddresses
))
{
ip
=
request
.
getRemoteAddr
();
}
if
(
"0:0:0:0:0:0:0:1"
.
equalsIgnoreCase
(
ip
)){
ip
=
"127.0.0.1"
;
}
return
ip
;
}
}
server/src/main/java/com/pica/cloud/account/account/server/util/MD5.java
0 → 100644
浏览文件 @
97c7d9db
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
util
;
import
java.security.MessageDigest
;
public
class
MD5
{
// 全局数组
private
final
static
String
[]
strDigits
=
{
"0"
,
"1"
,
"2"
,
"3"
,
"4"
,
"5"
,
"6"
,
"7"
,
"8"
,
"9"
,
"a"
,
"b"
,
"c"
,
"d"
,
"e"
,
"f"
,
"g"
,
"h"
,
"j"
,
"?"
,
"~"
};
// 返回形式为数字跟字符串
private
static
String
byteToArrayString
(
byte
bByte
)
{
int
iRet
=
bByte
;
if
(
iRet
<
0
)
{
iRet
+=
256
;
}
int
iD1
=
iRet
/
16
;
int
iD2
=
iRet
%
16
;
return
strDigits
[
iD1
]
+
strDigits
[
iD2
];
}
// 转换字节数组为16进制字串
private
static
String
byteToString
(
byte
[]
bByte
)
{
StringBuffer
sBuffer
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
bByte
.
length
;
i
++)
{
sBuffer
.
append
(
byteToArrayString
(
bByte
[
i
]));
}
return
sBuffer
.
toString
();
}
public
static
String
getMD5Code
(
String
strObj
)
{
String
resultString
=
null
;
try
{
resultString
=
new
String
(
strObj
);
MessageDigest
md
=
MessageDigest
.
getInstance
(
"MD5"
);
// md.digest() 该函数返回值为存放哈希值结果的byte数组
resultString
=
byteToString
(
md
.
digest
(
strObj
.
getBytes
(
"UTF-8"
)));
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
}
return
resultString
;
}
}
server/src/main/java/com/pica/cloud/account/account/server/util/SignUtils.java
0 → 100644
浏览文件 @
97c7d9db
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
util
;
import
javax.crypto.Mac
;
import
javax.crypto.spec.SecretKeySpec
;
import
java.util.Arrays
;
import
java.util.Map
;
/**
* Description:签名工具类
* User: liutao
* Date: 2019-09-11
* Time: 10:29
*/
public
class
SignUtils
{
public
static
String
getSign
(
Map
<
String
,
String
>
requestMap
,
String
appKey
)
{
return
hmacSHA256Encrypt
(
requestMap2Str
(
requestMap
),
appKey
);
}
private
static
String
hmacSHA256Encrypt
(
String
encryptText
,
String
encryptKey
)
{
byte
[]
result
=
null
;
try
{
//根据给定的字节数组构造一个密钥,第二参数指定一个密钥算法的名称
SecretKeySpec
signinKey
=
new
SecretKeySpec
(
encryptKey
.
getBytes
(
"UTF-8"
),
"HmacSHA256"
);
//生成一个指定 Mac 算法 的 Mac 对象
Mac
mac
=
Mac
.
getInstance
(
"HmacSHA256"
);
//用给定密钥初始化 Mac 对象
mac
.
init
(
signinKey
);
//完成 Mac 操作
byte
[]
rawHmac
=
mac
.
doFinal
(
encryptText
.
getBytes
(
"UTF-8"
));
return
ByteFormat
.
bytesToHexString
(
rawHmac
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
private
static
String
requestMap2Str
(
Map
<
String
,
String
>
requestMap
)
{
String
[]
keys
=
requestMap
.
keySet
().
toArray
(
new
String
[
0
]);
Arrays
.
sort
(
keys
);
StringBuilder
stringBuilder
=
new
StringBuilder
();
for
(
String
str
:
keys
)
{
if
(!
str
.
equals
(
"sign"
))
{
stringBuilder
.
append
(
str
).
append
(
requestMap
.
get
(
str
));
}
}
return
stringBuilder
.
toString
();
}
}
server/src/main/java/com/pica/cloud/account/account/server/vo/OneClickLoginResultVo.java
0 → 100644
浏览文件 @
97c7d9db
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
vo
;
import
com.pica.cloud.account.account.server.entity.QueryMobileEntity
;
/**
* @program: pica-cloud-account
* @description:
* @author: wfy
* @create: 2020-02-12 16:01
*/
public
class
OneClickLoginResultVo
{
private
QueryMobileEntity
queryMobileEntity
;
public
QueryMobileEntity
getQueryMobileEntity
()
{
return
queryMobileEntity
;
}
public
void
setQueryMobileEntity
(
QueryMobileEntity
queryMobileEntity
)
{
this
.
queryMobileEntity
=
queryMobileEntity
;
}
}
server/src/main/resources/mybatis-generator.xml
0 → 100644
浏览文件 @
97c7d9db
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<!-- 数据库驱动:选择你的本地硬盘上面的数据库驱动包-->
<classPathEntry
location=
"D:\programer\reponsitory\maven\mysql\mysql-connector-java\5.1.39\mysql-connector-java-5.1.39.jar"
/>
<!--<classPathEntry location="E:\mysql_jar/mysql-connector-java-5.1.39.jar"/>-->
<context
id=
"tableEntity"
targetRuntime=
"MyBatis3"
>
<commentGenerator>
<property
name=
"suppressDate"
value=
"true"
/>
<!-- 是否去除自动生成的注释 true:是 : false:否 -->
<property
name=
"suppressAllComments"
value=
"true"
/>
<property
name=
"addRemarkComments"
value=
"true"
/>
<property
name=
"dateFormat"
value=
"false"
/>
<property
name=
"suppressDate"
value=
"false"
/>
</commentGenerator>
<!--数据库链接URL,用户名、密码 -->
<jdbcConnection
driverClass=
"com.mysql.jdbc.Driver"
connectionURL=
"jdbc:mysql://192.168.130.200:3306/pica"
userId=
"pica"
password=
"Joa5@73&8yAYJ2fe"
>
</jdbcConnection>
<javaTypeResolver>
<property
name=
"forceBigDecimals"
value=
"false"
/>
</javaTypeResolver>
<!-- 生成模型的包名和位置-->
<javaModelGenerator
targetPackage=
"com.pica.cloud.account.account.server.entity"
targetProject=
"src/main/java"
>
<property
name=
"enableSubPackages"
value=
"true"
/>
<property
name=
"trimStrings"
value=
"true"
/>
</javaModelGenerator>
<!-- 生成映射文件的包名和位置-->
<sqlMapGenerator
targetPackage=
"mybatis"
targetProject=
"src/main/resources"
>
<property
name=
"enableSubPackages"
value=
"true"
/>
</sqlMapGenerator>
<!-- 生成DAO的包名和位置-->
<javaClientGenerator
type=
"XMLMAPPER"
targetPackage=
"com.pica.cloud.account.account.server.mapper"
targetProject=
"src/main/java"
>
<property
name=
"enableSubPackages"
value=
"true"
/>
</javaClientGenerator>
<table
tableName=
"account_apple_info"
domainObjectName=
"AccountAppleInfo"
enableCountByExample=
"false"
enableUpdateByExample=
"false"
enableDeleteByExample=
"false"
enableSelectByExample=
"false"
selectByExampleQueryId=
"false"
></table>
</context>
</generatorConfiguration>
server/src/main/resources/mybatis/AccountAppleInfoMapper.xml
0 → 100644
浏览文件 @
97c7d9db
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pica.cloud.account.account.server.mapper.AccountAppleInfoMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pica.cloud.account.account.server.entity.AccountAppleInfo"
>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"apple_user_id"
property=
"appleUserId"
jdbcType=
"VARCHAR"
/>
<result
column=
"apple_id"
property=
"appleId"
jdbcType=
"VARCHAR"
/>
<result
column=
"info"
property=
"info"
jdbcType=
"VARCHAR"
/>
<result
column=
"delete_flag"
property=
"deleteFlag"
jdbcType=
"INTEGER"
/>
<result
column=
"created_id"
property=
"createdId"
jdbcType=
"INTEGER"
/>
<result
column=
"created_time"
property=
"createdTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"modified_id"
property=
"modifiedId"
jdbcType=
"INTEGER"
/>
<result
column=
"modified_time"
property=
"modifiedTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, apple_user_id, apple_id, info, delete_flag, created_id, created_time, modified_id,
modified_time
</sql>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Integer"
>
select
<include
refid=
"Base_Column_List"
/>
from account_apple_info
where id = #{id,jdbcType=INTEGER}
</select>
<insert
id=
"insert"
parameterType=
"com.pica.cloud.account.account.server.entity.AccountAppleInfo"
>
insert into account_apple_info (id, apple_user_id, apple_id,
info, delete_flag, created_id,
created_time, modified_id, modified_time
)
values (#{id,jdbcType=INTEGER}, #{appleUserId,jdbcType=VARCHAR}, #{appleId,jdbcType=VARCHAR},
#{info,jdbcType=VARCHAR}, #{deleteFlag,jdbcType=INTEGER}, #{createdId,jdbcType=INTEGER},
#{createdTime,jdbcType=TIMESTAMP}, #{modifiedId,jdbcType=INTEGER}, #{modifiedTime,jdbcType=TIMESTAMP}
)
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.pica.cloud.account.account.server.entity.AccountAppleInfo"
>
insert into account_apple_info
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"appleUserId != null"
>
apple_user_id,
</if>
<if
test=
"appleId != null"
>
apple_id,
</if>
<if
test=
"info != null"
>
info,
</if>
delete_flag,
<if
test=
"createdId != null"
>
created_id,
</if>
created_time,
<if
test=
"modifiedId != null"
>
modified_id,
</if>
modified_time
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=INTEGER},
</if>
<if
test=
"appleUserId != null"
>
#{appleUserId,jdbcType=VARCHAR},
</if>
<if
test=
"appleId != null"
>
#{appleId,jdbcType=VARCHAR},
</if>
<if
test=
"info != null"
>
#{info,jdbcType=VARCHAR},
</if>
1,
<if
test=
"createdId != null"
>
#{createdId,jdbcType=INTEGER},
</if>
now(),
<if
test=
"modifiedId != null"
>
#{modifiedId,jdbcType=INTEGER},
</if>
now()
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.pica.cloud.account.account.server.entity.AccountAppleInfo"
>
update account_apple_info
<set
>
<if
test=
"appleUserId != null"
>
apple_user_id = #{appleUserId,jdbcType=VARCHAR},
</if>
<if
test=
"appleId != null"
>
apple_id = #{appleId,jdbcType=VARCHAR},
</if>
<if
test=
"info != null"
>
info = #{info,jdbcType=VARCHAR},
</if>
<if
test=
"deleteFlag != null"
>
delete_flag = #{deleteFlag,jdbcType=INTEGER},
</if>
<if
test=
"createdId != null"
>
created_id = #{createdId,jdbcType=INTEGER},
</if>
<if
test=
"createdTime != null"
>
created_time = #{createdTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"modifiedId != null"
>
modified_id = #{modifiedId,jdbcType=INTEGER},
</if>
<if
test=
"modifiedTime != null"
>
modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.pica.cloud.account.account.server.entity.AccountAppleInfo"
>
update account_apple_info
set apple_user_id = #{appleUserId,jdbcType=VARCHAR},
apple_id = #{appleId,jdbcType=VARCHAR},
info = #{info,jdbcType=VARCHAR},
delete_flag = #{deleteFlag,jdbcType=INTEGER},
created_id = #{createdId,jdbcType=INTEGER},
created_time = #{createdTime,jdbcType=TIMESTAMP},
modified_id = #{modifiedId,jdbcType=INTEGER},
modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<!--通过appleUserId获取apple信息-->
<select
id=
"selectByUserId"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
id
from account_apple_info
where apple_user_id = #{id} and delete_flag = 1
limit 1
</select>
</mapper>
\ No newline at end of file
server/src/main/resources/mybatis/LogLoginOnekeyMapper.xml
0 → 100644
浏览文件 @
97c7d9db
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pica.cloud.account.account.server.mapper.LogLoginOnekeyMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pica.cloud.account.account.server.entity.LogLoginOnekey"
>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"log_login_id"
property=
"logLoginId"
jdbcType=
"INTEGER"
/>
<result
column=
"device_type"
property=
"deviceType"
jdbcType=
"INTEGER"
/>
<result
column=
"mobile"
property=
"mobile"
jdbcType=
"VARCHAR"
/>
<result
column=
"trade_no"
property=
"tradeNo"
jdbcType=
"VARCHAR"
/>
<result
column=
"fanqizha"
property=
"fanqizha"
jdbcType=
"INTEGER"
/>
<result
column=
"tag"
property=
"tag"
jdbcType=
"VARCHAR"
/>
<result
column=
"info"
property=
"info"
jdbcType=
"VARCHAR"
/>
<result
column=
"delete_flag"
property=
"deleteFlag"
jdbcType=
"INTEGER"
/>
<result
column=
"create_id"
property=
"createId"
jdbcType=
"INTEGER"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"modify_id"
property=
"modifyId"
jdbcType=
"INTEGER"
/>
<result
column=
"modify_time"
property=
"modifyTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, log_login_id, device_type, mobile, trade_no, fanqizha, tag, info, delete_flag,
create_id, create_time, modify_id, modify_time
</sql>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Integer"
>
select
<include
refid=
"Base_Column_List"
/>
from log_login_onekey
where id = #{id,jdbcType=INTEGER}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
delete from log_login_onekey
where id = #{id,jdbcType=INTEGER}
</delete>
<insert
id=
"insert"
parameterType=
"com.pica.cloud.account.account.server.entity.LogLoginOnekey"
>
insert into log_login_onekey (id, log_login_id, device_type,
mobile, trade_no, fanqizha,
tag, info, delete_flag,
create_id, create_time, modify_id,
modify_time)
values (#{id,jdbcType=INTEGER}, #{logLoginId,jdbcType=INTEGER}, #{deviceType,jdbcType=INTEGER},
#{mobile,jdbcType=VARCHAR}, #{tradeNo,jdbcType=VARCHAR}, #{fanqizha,jdbcType=INTEGER},
#{tag,jdbcType=VARCHAR}, #{info,jdbcType=VARCHAR}, #{deleteFlag,jdbcType=INTEGER},
#{createId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{modifyId,jdbcType=INTEGER},
#{modifyTime,jdbcType=TIMESTAMP})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.pica.cloud.account.account.server.entity.LogLoginOnekey"
>
insert into log_login_onekey
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"logLoginId != null"
>
log_login_id,
</if>
<if
test=
"deviceType != null"
>
device_type,
</if>
<if
test=
"mobile != null"
>
mobile,
</if>
<if
test=
"tradeNo != null"
>
trade_no,
</if>
<if
test=
"fanqizha != null"
>
fanqizha,
</if>
<if
test=
"tag != null"
>
tag,
</if>
<if
test=
"info != null"
>
info,
</if>
<if
test=
"deleteFlag != null"
>
delete_flag,
</if>
<if
test=
"createId != null"
>
create_id,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"modifyId != null"
>
modify_id,
</if>
<if
test=
"modifyTime != null"
>
modify_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=INTEGER},
</if>
<if
test=
"logLoginId != null"
>
#{logLoginId,jdbcType=INTEGER},
</if>
<if
test=
"deviceType != null"
>
#{deviceType,jdbcType=INTEGER},
</if>
<if
test=
"mobile != null"
>
#{mobile,jdbcType=VARCHAR},
</if>
<if
test=
"tradeNo != null"
>
#{tradeNo,jdbcType=VARCHAR},
</if>
<if
test=
"fanqizha != null"
>
#{fanqizha,jdbcType=INTEGER},
</if>
<if
test=
"tag != null"
>
#{tag,jdbcType=VARCHAR},
</if>
<if
test=
"info != null"
>
#{info,jdbcType=VARCHAR},
</if>
<if
test=
"deleteFlag != null"
>
#{deleteFlag,jdbcType=INTEGER},
</if>
<if
test=
"createId != null"
>
#{createId,jdbcType=INTEGER},
</if>
<if
test=
"createTime != null"
>
#{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"modifyId != null"
>
#{modifyId,jdbcType=INTEGER},
</if>
<if
test=
"modifyTime != null"
>
#{modifyTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.pica.cloud.account.account.server.entity.LogLoginOnekey"
>
update log_login_onekey
<set
>
<if
test=
"logLoginId != null"
>
log_login_id = #{logLoginId,jdbcType=INTEGER},
</if>
<if
test=
"deviceType != null"
>
device_type = #{deviceType,jdbcType=INTEGER},
</if>
<if
test=
"mobile != null"
>
mobile = #{mobile,jdbcType=VARCHAR},
</if>
<if
test=
"tradeNo != null"
>
trade_no = #{tradeNo,jdbcType=VARCHAR},
</if>
<if
test=
"fanqizha != null"
>
fanqizha = #{fanqizha,jdbcType=INTEGER},
</if>
<if
test=
"tag != null"
>
tag = #{tag,jdbcType=VARCHAR},
</if>
<if
test=
"info != null"
>
info = #{info,jdbcType=VARCHAR},
</if>
<if
test=
"deleteFlag != null"
>
delete_flag = #{deleteFlag,jdbcType=INTEGER},
</if>
<if
test=
"createId != null"
>
create_id = #{createId,jdbcType=INTEGER},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"modifyId != null"
>
modify_id = #{modifyId,jdbcType=INTEGER},
</if>
<if
test=
"modifyTime != null"
>
modify_time = #{modifyTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.pica.cloud.account.account.server.entity.LogLoginOnekey"
>
update log_login_onekey
set log_login_id = #{logLoginId,jdbcType=INTEGER},
device_type = #{deviceType,jdbcType=INTEGER},
mobile = #{mobile,jdbcType=VARCHAR},
trade_no = #{tradeNo,jdbcType=VARCHAR},
fanqizha = #{fanqizha,jdbcType=INTEGER},
tag = #{tag,jdbcType=VARCHAR},
info = #{info,jdbcType=VARCHAR},
delete_flag = #{deleteFlag,jdbcType=INTEGER},
create_id = #{createId,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
modify_id = #{modifyId,jdbcType=INTEGER},
modify_time = #{modifyTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
server/test/main/java/com/pica/cloud/account/account/server/mapper/AccountWeChatInfoMapperTest.java
0 → 100644
浏览文件 @
97c7d9db
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
mapper
;
// Copyright 2016-2101 Pica.
import
com.pica.cloud.account.account.server.constants.Constants
;
import
com.pica.cloud.account.account.server.entity.AccountWeChatInfoEntity
;
import
com.pica.cloud.foundation.redis.ICacheClient
;
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
;
/**
* @ClassName com.pica.cloud.account.account.server.mapper.Test
* @Description junit test
* @Author Chongwen.jiang
* @Date 2020/2/25 14:51
* @ModifyDate 2020/2/25 14:51
* @Version 1.0
*/
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
AccountWeChatInfoMapperTest
{
@Autowired
private
AccountWeChatInfoMapper
weChatInfoMapper
;
@Autowired
private
ICacheClient
cacheClient
;
@org
.
junit
.
Test
public
void
test1
(){
/* AccountWeChatInfoEntity record = new AccountWeChatInfoEntity();
record.setNickname("Zz");
record.setSex(1);
record.setCountry("中国");
record.setCity("邵阳");
int count = weChatInfoMapper.insertSelective(record);
System.out.println(count);*/
//System.out.println(cacheClient.set(Constants.AUTHCODE_H5_SWITCH_KEY, Constants.AUTHCODE_H5_SWITCH_KEY+"-/account/H5/authCode"));
//System.out.println(cacheClient.del(Constants.AUTHCODE_H5_SWITCH_KEY));
}
}
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录