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
2b6f44e9
Commit
2b6f44e9
authored
Jul 27, 2020
by
liwenbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新诚导流联系人缺失判断条件前置
parent
630a4027
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
108 additions
and
56 deletions
+108
-56
AidFundRouteServiceImpl.java
...ibution/service/funding/impl/AidFundRouteServiceImpl.java
+23
-5
CustomerTypeRuleConfig.java
...stribution/service/jpa/entity/CustomerTypeRuleConfig.java
+47
-47
ICustomerTypeRuleConfigRepository.java
...ice/jpa/repository/ICustomerTypeRuleConfigRepository.java
+2
-1
UserCenterServiceImpl.java
...distribution/service/user/impl/UserCenterServiceImpl.java
+36
-3
No files found.
src/main/java/com/quantgroup/asset/distribution/service/funding/impl/AidFundRouteServiceImpl.java
View file @
2b6f44e9
package
com
.
quantgroup
.
asset
.
distribution
.
service
.
funding
.
impl
;
import
cn.quantgroup.motan.bean.UserInfo
;
import
com.alibaba.fastjson.JSON
;
import
com.google.common.base.Stopwatch
;
import
com.quantgroup.asset.distribution.constant.AidFundStatus
;
...
...
@@ -7,6 +8,7 @@ import com.quantgroup.asset.distribution.constant.aid.AidRiskInfoConstants;
import
com.quantgroup.asset.distribution.enums.UserLoanType
;
import
com.quantgroup.asset.distribution.exception.QGExceptionType
;
import
com.quantgroup.asset.distribution.exception.QGPreconditions
;
import
com.quantgroup.asset.distribution.model.entity.user.SDKUserInfo
;
import
com.quantgroup.asset.distribution.model.form.AssetForm
;
import
com.quantgroup.asset.distribution.model.response.GlobalResponse
;
import
com.quantgroup.asset.distribution.service.feature.IFeatureService
;
...
...
@@ -19,6 +21,7 @@ import com.quantgroup.asset.distribution.service.jpa.repository.ICustomerTypeRul
import
com.quantgroup.asset.distribution.service.niwodai.INiwodaiAssetService
;
import
com.quantgroup.asset.distribution.service.redis.IRedisService
;
import
com.quantgroup.asset.distribution.service.rule.IRuleService
;
import
com.quantgroup.asset.distribution.service.user.IUserCenterService
;
import
com.quantgroup.asset.distribution.util.DateUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
...
...
@@ -48,17 +51,16 @@ public class AidFundRouteServiceImpl implements IAidFundRouteService {
@Autowired
private
IRedisService
<
String
>
redisService
;
@Autowired
private
IRedisService
<
AidLoanFundRouteRecord
>
redisRouteRecord
;
@Autowired
private
IRuleService
ruleService
;
@Autowired
private
ICustomerTypeRuleConfigRepository
iCustomerTypeRuleConfigRepository
;
@Autowired
private
IAidFundAssetService
aidFundAssetService
;
@Autowired
private
IAidFundAuditOrderService
aidFundAuditOrderService
;
@Autowired
private
IFeatureService
featureService
;
@Autowired
private
IUserCenterService
userCenterService
;
/**
* 助贷资金路由
...
...
@@ -270,6 +272,22 @@ public class AidFundRouteServiceImpl implements IAidFundRouteService {
asset
.
getUuid
(),
aidLoanFundConfig
.
getFundId
(),
aidLoanFundConfig
.
getFundProductId
(),
age
,
province
,
qgScore3
);
}
}
return
valid
;
if
(!
valid
)
{
return
false
;
}
// 通用, 用户联系人缺失的不导, md,这是用户中心的bug, 要在这里做兼容
UserInfo
userInfo
=
userCenterService
.
getUserInfoByUuid
(
assetForm
.
getUuid
());
if
(
userInfo
==
null
||
StringUtils
.
isEmpty
(
userInfo
.
getPhoneNo
()))
{
log
.
info
(
"助贷资方导流, 用户手机号缺失, 不进行导流, uuid : {}, fundId : {}, fundProductId : {}"
,
asset
.
getUuid
(),
aidLoanFundConfig
.
getFundId
(),
aidLoanFundConfig
.
getFundProductId
());
return
false
;
}
SDKUserInfo
sdkUserInfo
=
userCenterService
.
getSDKUserExtInfo
(
userInfo
.
getPhoneNo
(),
assetForm
.
getUuid
());
if
(
sdkUserInfo
==
null
||
sdkUserInfo
.
getContactList
()
==
null
||
sdkUserInfo
.
getContactList
().
size
()
==
0
)
{
log
.
info
(
"助贷资方导流, 用户联系人缺失, 不进行导流, uuid : {}, fundId : {}, fundProductId : {}, contactList : {}"
,
assetForm
.
getUuid
(),
aidLoanFundConfig
.
getFundId
(),
aidLoanFundConfig
.
getFundProductId
(),
0
);
return
false
;
}
return
true
;
}
}
src/main/java/com/quantgroup/asset/distribution/service/jpa/entity/CustomerTypeRuleConfig.java
View file @
2b6f44e9
...
...
@@ -9,55 +9,55 @@ import java.sql.Timestamp;
/**
* Created by renfeng on 2020/3/24.
*/
@Entity
@Table
(
name
=
"customer_type_rule_config"
)
//
@Entity
//
@Table(name="customer_type_rule_config")
@Data
public
class
CustomerTypeRuleConfig
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
1L
;
@Id
@Column
(
name
=
"id"
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Long
id
;
@Column
(
name
=
"customer_type_rule_no"
)
private
String
customerTypeRuleNo
;
@Column
(
name
=
"customer_type_rule_desc"
)
private
String
customerTypeRuleDesc
;
@Column
(
name
=
"customer_type"
)
private
Integer
customerType
;
@Column
(
name
=
"customer_type_rule_el"
)
private
String
customerTypeRuleEl
;
@Column
(
name
=
"enable"
)
private
Boolean
enable
;
@Column
(
name
=
"created_by"
)
private
String
createdBy
;
@Column
(
name
=
"updated_by"
)
private
String
updatedBy
;
@Column
(
name
=
"created_at"
)
private
Timestamp
createdAt
;
@Column
(
name
=
"updated_at"
)
private
Timestamp
updatedAt
;
@PrePersist
public
void
prePersist
()
{
Timestamp
timestamp
=
new
Timestamp
(
System
.
currentTimeMillis
());
createdAt
=
timestamp
;
updatedAt
=
timestamp
;
}
@PreUpdate
public
void
preUpdate
()
{
updatedAt
=
new
Timestamp
(
System
.
currentTimeMillis
());
}
//
//
@Id
//
@Column(name = "id")
//
@GeneratedValue(strategy = GenerationType.IDENTITY)
//
private Long id;
//
//
@Column(name="customer_type_rule_no")
//
private String customerTypeRuleNo;
//
//
@Column(name="customer_type_rule_desc")
//
private String customerTypeRuleDesc;
//
//
@Column(name="customer_type")
//
private Integer customerType;
//
//
@Column(name="customer_type_rule_el")
//
private String customerTypeRuleEl;
//
//
@Column(name = "enable")
//
private Boolean enable;
//
//
@Column(name="created_by")
//
private String createdBy;
//
//
@Column(name="updated_by")
//
private String updatedBy;
//
//
@Column(name = "created_at")
//
private Timestamp createdAt;
//
//
@Column(name = "updated_at")
//
private Timestamp updatedAt;
//
//
//
@PrePersist
//
public void prePersist() {
//
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
//
createdAt = timestamp;
//
updatedAt = timestamp;
//
}
//
//
@PreUpdate
//
public void preUpdate() {
//
updatedAt = new Timestamp(System.currentTimeMillis());
//
}
}
src/main/java/com/quantgroup/asset/distribution/service/jpa/repository/ICustomerTypeRuleConfigRepository.java
View file @
2b6f44e9
...
...
@@ -8,7 +8,8 @@ import java.util.List;
/**
* Created by renfeng on 2019/7/17.
*/
public
interface
ICustomerTypeRuleConfigRepository
extends
JpaRepository
<
CustomerTypeRuleConfig
,
Long
>{
public
interface
ICustomerTypeRuleConfigRepository
{
//public interface ICustomerTypeRuleConfigRepository extends JpaRepository<CustomerTypeRuleConfig, Long>{
...
...
src/main/java/com/quantgroup/asset/distribution/service/user/impl/UserCenterServiceImpl.java
View file @
2b6f44e9
...
...
@@ -43,6 +43,8 @@ public class UserCenterServiceImpl implements IUserCenterService {
@Autowired
private
IRedisService
<
UserInfo
>
redisService
;
@Autowired
private
IRedisService
<
SDKUserInfo
>
sdkUserInfoRedisService
;
@Autowired
private
IHttpService
httpService
;
...
...
@@ -51,6 +53,11 @@ public class UserCenterServiceImpl implements IUserCenterService {
*/
private
static
final
String
USER_INFO_PRE_FIX
=
"ASSET_DISTRIBUTION:GET_USER_INFO_BY_UUID:MMNACH99:"
;
/**
* SDKUserInfo redisKey前缀
*/
private
static
final
String
SDK_USER_INFO_PREFIX
=
"ASSET_DISTRIBUTION:GET_SDK_USER_INFO_BY_PHONE_NO:AMMVYY16:"
;
@PostConstruct
private
void
init
()
{
userSdkService
=
UserSdkServiceFactory
.
generateSDKService
(
userSysUrl
,
httpClient
);
...
...
@@ -75,17 +82,34 @@ public class UserCenterServiceImpl implements IUserCenterService {
@Override
public
SDKUserInfo
getSDKUserExtInfo
(
String
phoneNo
,
String
uuid
)
{
// 这个暂时就先不做缓存了,如果后续有需求用到,再加上缓存,目前是一次性使用
final
String
cacheKey
=
getSdkUserInfoCacheKey
(
phoneNo
);
SDKUserInfo
sdkUserInfo
=
sdkUserInfoRedisService
.
getEntity
(
cacheKey
);
if
(
sdkUserInfo
==
null
)
{
sdkUserInfo
=
getSDKUserInfoFromUserCenter
(
phoneNo
,
uuid
);
if
(
sdkUserInfo
!=
null
)
{
sdkUserInfoRedisService
.
setEntityEx
(
cacheKey
,
sdkUserInfo
,
5
,
TimeUnit
.
MINUTES
);
}
}
return
sdkUserInfo
;
}
/**
* 从用户中心获取SDKUserInfo
* @param uuid
* @param phoneNo
* @return
*/
private
SDKUserInfo
getSDKUserInfoFromUserCenter
(
String
phoneNo
,
String
uuid
)
{
String
url
=
userSysUrl
+
"/innerapi/user-association/search/userId"
;
Map
<
String
,
String
>
params
=
new
HashMap
<>();
params
.
put
(
"phoneNo"
,
phoneNo
);
String
result
=
httpService
.
post
(
url
,
params
);
JSONObject
data
=
JSON
.
parseObject
(
result
);
Boolean
success
=
data
.
getBoolean
(
"success"
);
if
(!(
success
!=
null
&&
success
.
booleanValue
()
&&
"0000"
.
equals
(
data
.
getString
(
"code"
))
&&
"0000"
.
equals
(
data
.
getString
(
"businessCode"
))))
{
log
.
info
(
"用户中心根据phoneNo查询用户全量信息失败,
phone : {}, result : {}"
,
phoneNo
,
result
);
log
.
info
(
"用户中心根据phoneNo查询用户全量信息失败,
uuid : {}, phone : {}, result : {}"
,
uuid
,
phoneNo
,
result
);
return
null
;
}
...
...
@@ -102,4 +126,13 @@ public class UserCenterServiceImpl implements IUserCenterService {
return
USER_INFO_PRE_FIX
+
uuid
;
}
/**
* 获取SDKUserInfo缓存key前缀
* @param phoneNo
* @return
*/
private
static
final
String
getSdkUserInfoCacheKey
(
String
phoneNo
)
{
return
SDK_USER_INFO_PREFIX
+
phoneNo
;
}
}
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