Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
asset-distribution
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
data-spider
asset-distribution
Commits
ff156b33
Commit
ff156b33
authored
Aug 28, 2021
by
shihuajun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
基础方法
parent
6bd29b52
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
84 additions
and
36 deletions
+84
-36
HttpClientConfig.java
...roup/asset/distribution/config/http/HttpClientConfig.java
+15
-10
ChannelRuleEntity.java
...et/distribution/service/jpa/entity/ChannelRuleEntity.java
+11
-0
FundProductEntity.java
...et/distribution/service/jpa/entity/FundProductEntity.java
+14
-20
ProductRuleEntity.java
...et/distribution/service/jpa/entity/ProductRuleEntity.java
+6
-2
IChannelRuleRepository.java
...bution/service/jpa/repository/IChannelRuleRepository.java
+1
-1
IProductRuleRepository.java
...bution/service/jpa/repository/IProductRuleRepository.java
+1
-1
IWhiteListRepository.java
...ribution/service/jpa/repository/IWhiteListRepository.java
+1
-1
package-info.java
...roup/asset/distribution/service/newrule/package-info.java
+6
-0
IUserCenterService.java
...p/asset/distribution/service/user/IUserCenterService.java
+8
-1
UserCenterServiceImpl.java
...distribution/service/user/impl/UserCenterServiceImpl.java
+21
-0
No files found.
src/main/java/com/quantgroup/asset/distribution/config/http/HttpClientConfig.java
View file @
ff156b33
...
...
@@ -60,12 +60,15 @@ public class HttpClientConfig {
* 创建TrustManager
*/
X509TrustManager
xtm
=
new
X509TrustManager
()
{
@Override
public
void
checkClientTrusted
(
X509Certificate
[]
chain
,
String
authType
)
throws
CertificateException
{
}
@Override
public
void
checkServerTrusted
(
X509Certificate
[]
chain
,
String
authType
)
throws
CertificateException
{
}
@Override
public
X509Certificate
[]
getAcceptedIssuers
()
{
return
null
;
}
...
...
@@ -86,16 +89,17 @@ public class HttpClientConfig {
HttpRequestRetryHandler
retryHandler
=
new
HttpRequestRetryHandler
()
{
@Override
public
boolean
retryRequest
(
IOException
arg0
,
int
retryTimes
,
HttpContext
arg2
)
{
if
(
retryTimes
>=
2
)
if
(
retryTimes
>=
2
)
{
return
false
;
}
if
(
arg0
instanceof
UnknownHostException
||
arg0
instanceof
ConnectTimeoutException
||
!(
arg0
instanceof
SSLException
)
||
arg0
instanceof
SocketTimeoutException
)
||
!(
arg0
instanceof
SSLException
)
||
arg0
instanceof
SocketTimeoutException
)
{
return
true
;
}
HttpClientContext
clientContext
=
HttpClientContext
.
adapt
(
arg2
);
HttpRequest
request
=
clientContext
.
getRequest
();
if
(!(
request
instanceof
HttpEntityEnclosingRequest
))
// 如果请求被认为是幂等的,那么就重试。即重复执行不影响程序其他效果的
return
true
;
return
false
;
// 如果请求被认为是幂等的,那么就重试。即重复执行不影响程序其他效果的
return
!(
request
instanceof
HttpEntityEnclosingRequest
);
}
};
// keep alive strategy
...
...
@@ -153,16 +157,17 @@ public class HttpClientConfig {
HttpRequestRetryHandler
retryHandler
=
new
HttpRequestRetryHandler
()
{
@Override
public
boolean
retryRequest
(
IOException
arg0
,
int
retryTimes
,
HttpContext
arg2
)
{
if
(
retryTimes
>=
2
)
if
(
retryTimes
>=
2
)
{
return
false
;
}
if
(
arg0
instanceof
UnknownHostException
||
arg0
instanceof
ConnectTimeoutException
||
!(
arg0
instanceof
SSLException
)
||
arg0
instanceof
SocketTimeoutException
)
||
!(
arg0
instanceof
SSLException
)
||
arg0
instanceof
SocketTimeoutException
)
{
return
true
;
}
HttpClientContext
clientContext
=
HttpClientContext
.
adapt
(
arg2
);
HttpRequest
request
=
clientContext
.
getRequest
();
if
(!(
request
instanceof
HttpEntityEnclosingRequest
))
// 如果请求被认为是幂等的,那么就重试。即重复执行不影响程序其他效果的
return
true
;
return
false
;
// 如果请求被认为是幂等的,那么就重试。即重复执行不影响程序其他效果的
return
!(
request
instanceof
HttpEntityEnclosingRequest
);
}
};
// keep alive strategy
...
...
src/main/java/com/quantgroup/asset/distribution/service/jpa/entity/ChannelRuleEntity.java
View file @
ff156b33
...
...
@@ -27,6 +27,7 @@ public class ChannelRuleEntity {
private
String
userLevel
;
private
int
priority
;
private
Byte
enable
;
private
Byte
routeWait
;
private
Timestamp
createdAt
;
private
Timestamp
updatedAt
;
...
...
@@ -180,6 +181,16 @@ public class ChannelRuleEntity {
this
.
enable
=
enable
;
}
@Basic
@Column
(
name
=
"route_wait"
,
nullable
=
true
)
public
Byte
getRouteWait
()
{
return
routeWait
;
}
public
void
setRouteWait
(
Byte
routeWait
)
{
this
.
routeWait
=
routeWait
;
}
@Basic
@Column
(
name
=
"created_at"
,
nullable
=
false
)
public
Timestamp
getCreatedAt
()
{
...
...
src/main/java/com/quantgroup/asset/distribution/service/jpa/entity/FundProductEntity.java
View file @
ff156b33
...
...
@@ -14,7 +14,7 @@ import java.util.Objects;
public
class
FundProductEntity
{
private
long
id
;
private
long
fundId
;
private
long
fundCorp
Id
;
private
Long
fundPro
Id
;
private
String
fundName
;
private
String
fundType
;
private
String
orgType
;
...
...
@@ -48,13 +48,13 @@ public class FundProductEntity {
}
@Basic
@Column
(
name
=
"fund_
corp
_id"
,
nullable
=
false
)
public
long
getFundCorp
Id
()
{
return
fund
Corp
Id
;
@Column
(
name
=
"fund_
pro
_id"
,
nullable
=
false
)
public
Long
getFundPro
Id
()
{
return
fund
Pro
Id
;
}
public
void
setFund
CorpId
(
long
fundCorp
Id
)
{
this
.
fund
CorpId
=
fundCorp
Id
;
public
void
setFund
ProId
(
Long
fundPro
Id
)
{
this
.
fund
ProId
=
fundPro
Id
;
}
@Basic
...
...
@@ -117,16 +117,6 @@ public class FundProductEntity {
this
.
basicRule
=
basicRule
;
}
@Basic
@Column
(
name
=
"other_rule"
,
nullable
=
false
,
length
=
500
)
public
String
getOtherRule
()
{
return
otherRule
;
}
public
void
setOtherRule
(
String
otherRule
)
{
this
.
otherRule
=
otherRule
;
}
@Basic
@Column
(
name
=
"rule_list"
,
nullable
=
false
,
length
=
500
)
public
String
getRuleList
()
{
...
...
@@ -169,14 +159,18 @@ public class FundProductEntity {
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
if
(
this
==
o
)
{
return
true
;
}
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
{
return
false
;
}
FundProductEntity
that
=
(
FundProductEntity
)
o
;
return
id
==
that
.
id
&&
fundId
==
that
.
fundId
&&
fundCorpId
==
that
.
fundCorpId
&&
Objects
.
equals
(
fundName
,
that
.
fundName
)
&&
Objects
.
equals
(
fundType
,
that
.
fundType
)
&&
Objects
.
equals
(
orgType
,
that
.
orgType
)
&&
Objects
.
equals
(
businessType
,
that
.
businessType
)
&&
Objects
.
equals
(
systermType
,
that
.
systermType
)
&&
Objects
.
equals
(
basicRule
,
that
.
basicRule
)
&&
Objects
.
equals
(
otherRule
,
that
.
otherRule
)
&&
Objects
.
equals
(
ruleList
,
that
.
ruleList
)
&&
Objects
.
equals
(
enable
,
that
.
enable
)
&&
Objects
.
equals
(
createdAt
,
that
.
createdAt
)
&&
Objects
.
equals
(
updatedAt
,
that
.
updatedAt
);
return
id
==
that
.
id
&&
fundId
==
that
.
fundId
&&
Objects
.
equals
(
fundProId
,
that
.
fundProId
)
&&
Objects
.
equals
(
fundName
,
that
.
fundName
)
&&
Objects
.
equals
(
fundType
,
that
.
fundType
)
&&
Objects
.
equals
(
orgType
,
that
.
orgType
)
&&
Objects
.
equals
(
businessType
,
that
.
businessType
)
&&
Objects
.
equals
(
systermType
,
that
.
systermType
)
&&
Objects
.
equals
(
basicRule
,
that
.
basicRule
)
&&
Objects
.
equals
(
otherRule
,
that
.
otherRule
)
&&
Objects
.
equals
(
ruleList
,
that
.
ruleList
)
&&
Objects
.
equals
(
enable
,
that
.
enable
)
&&
Objects
.
equals
(
createdAt
,
that
.
createdAt
)
&&
Objects
.
equals
(
updatedAt
,
that
.
updatedAt
);
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
id
,
fundId
,
fund
Corp
Id
,
fundName
,
fundType
,
orgType
,
businessType
,
systermType
,
basicRule
,
otherRule
,
ruleList
,
enable
,
createdAt
,
updatedAt
);
return
Objects
.
hash
(
id
,
fundId
,
fund
Pro
Id
,
fundName
,
fundType
,
orgType
,
businessType
,
systermType
,
basicRule
,
otherRule
,
ruleList
,
enable
,
createdAt
,
updatedAt
);
}
}
src/main/java/com/quantgroup/asset/distribution/service/jpa/entity/ProductRuleEntity.java
View file @
ff156b33
...
...
@@ -92,8 +92,12 @@ public class ProductRuleEntity {
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
if
(
this
==
o
)
{
return
true
;
}
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
{
return
false
;
}
ProductRuleEntity
that
=
(
ProductRuleEntity
)
o
;
return
id
==
that
.
id
&&
Objects
.
equals
(
ruleName
,
that
.
ruleName
)
&&
Objects
.
equals
(
ruleEnglish
,
that
.
ruleEnglish
)
&&
Objects
.
equals
(
ruleChinese
,
that
.
ruleChinese
)
&&
Objects
.
equals
(
enable
,
that
.
enable
)
&&
Objects
.
equals
(
createdAt
,
that
.
createdAt
)
&&
Objects
.
equals
(
updatedAt
,
that
.
updatedAt
);
}
...
...
src/main/java/com/quantgroup/asset/distribution/service/jpa/repository/IChannelRuleRepository.java
View file @
ff156b33
...
...
@@ -5,5 +5,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
public
interface
IChannelRuleRepository
extends
JpaRepository
<
ChannelRuleEntity
,
Long
>{
ChannelRuleEntity
getByFundProductIdEquals
(
long
fundProductId
);
}
src/main/java/com/quantgroup/asset/distribution/service/jpa/repository/IProductRuleRepository.java
View file @
ff156b33
...
...
@@ -5,5 +5,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
public
interface
IProductRuleRepository
extends
JpaRepository
<
ProductRuleEntity
,
Long
>{
ProductRuleEntity
getByRuleNameEquals
(
String
ruleName
);
}
src/main/java/com/quantgroup/asset/distribution/service/jpa/repository/IWhiteListRepository.java
View file @
ff156b33
...
...
@@ -5,5 +5,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
public
interface
IWhiteListRepository
extends
JpaRepository
<
WhiteListEntity
,
Long
>{
WhiteListEntity
getByPhoneEquals
(
String
phone
);
}
src/main/java/com/quantgroup/asset/distribution/service/newrule/package-info.java
0 → 100644
View file @
ff156b33
/**
* @date 2021/8/26 19:23
* @author shihuajun
* @ describing
*/
package
com
.
quantgroup
.
asset
.
distribution
.
service
.
newrule
;
\ No newline at end of file
src/main/java/com/quantgroup/asset/distribution/service/user/IUserCenterService.java
View file @
ff156b33
package
com
.
quantgroup
.
asset
.
distribution
.
service
.
user
;
import
cn.quantgroup.motan.bean.UserAssociationBean
;
import
cn.quantgroup.motan.bean.UserInfo
;
import
cn.quantgroup.motan.retbean.XUserExtInfo
;
import
com.quantgroup.asset.distribution.model.entity.user.SDKUserInfo
;
/**
...
...
@@ -25,4 +25,11 @@ public interface IUserCenterService {
* @return
*/
SDKUserInfo
getSDKUserExtInfo
(
String
phoneNo
,
String
uuid
);
/**
* 根据uuid查询带有联系人的信息
* @param uuid 入参
* @return 结果
*/
UserAssociationBean
getUserAssociationBean
(
String
uuid
);
}
src/main/java/com/quantgroup/asset/distribution/service/user/impl/UserCenterServiceImpl.java
View file @
ff156b33
package
com
.
quantgroup
.
asset
.
distribution
.
service
.
user
.
impl
;
import
cn.quantgroup.motan.bean.UserAssociationBean
;
import
cn.quantgroup.motan.bean.UserInfo
;
import
cn.quantgroup.motan.retbean.XUserExtInfo
;
import
cn.quantgroup.motan.vo.UserSysResult
;
...
...
@@ -14,6 +15,7 @@ import com.quantgroup.asset.distribution.service.httpclient.IHttpService;
import
com.quantgroup.asset.distribution.service.redis.IRedisService
;
import
com.quantgroup.asset.distribution.service.user.IUserCenterService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
...
...
@@ -93,6 +95,25 @@ public class UserCenterServiceImpl implements IUserCenterService {
return
sdkUserInfo
;
}
@Override
public
UserAssociationBean
getUserAssociationBean
(
String
uuid
)
{
UserSysResult
<
UserInfo
>
result
=
userSdkService
.
findUserInfoByUuid
(
uuid
);
UserInfo
userInfo
=
new
UserInfo
();
if
(
result
.
isSuccess
()
&&
result
.
getData
()
!=
null
&&
result
.
getData
().
getId
()
==
null
)
{
userInfo
=
result
.
getData
();
}
else
{
log
.
error
(
"调用用户中心接口findUserInfoByUuid异常 {}"
,
JSON
.
toJSONString
(
userInfo
));
throw
new
RuntimeException
(
"调用用户中心接口findUserInfoByUuid异常"
);
}
UserSysResult
<
UserAssociationBean
>
association
=
userSdkService
.
findUserAssociationByUid
(
userInfo
.
getId
().
toString
());
if
(
association
==
null
||
!
association
.
isSuccess
()
||
association
.
getData
()
==
null
||
CollectionUtils
.
isEmpty
(
association
.
getData
().
getContractResults
())){
log
.
error
(
"调用用户中心接口findUserAssociationByUid异常 {}"
,
JSON
.
toJSONString
(
association
));
throw
new
RuntimeException
(
"调用用户中心接口findUserAssociationByUid异常"
);
}
return
association
.
getData
();
}
/**
* 从用户中心获取SDKUserInfo
* @param uuid
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment