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
579cfc65
Commit
579cfc65
authored
Dec 27, 2019
by
liwenbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
f
parent
f52ba6cc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
21 deletions
+34
-21
QGExceptionType.java
...ntgroup/asset/distribution/exception/QGExceptionType.java
+2
-1
AssetServiceImpl.java
...set/distribution/service/asset/impl/AssetServiceImpl.java
+32
-20
No files found.
src/main/java/com/quantgroup/asset/distribution/exception/QGExceptionType.java
View file @
579cfc65
...
...
@@ -42,7 +42,8 @@ public enum QGExceptionType {
NO_FUND_INFO_BEEN_HIT
(
3002
,
"未命中任何资方, bizChannel : %s, amount : %s, term : %s"
),
FUND_PRIORITY_IS_ERROR
(
3003
,
"资方优先级不符合要求, bizChannel : %s, amount : %s, term : %s"
),
NOT_FOUNT_CHANNEL_FUNDS_INFO
(
3004
,
"未找到渠道资方配置, 请检查; bizChannel : %s"
),
CHANNEL_FUND_CONFIG_GREATER_THAN_TOW
(
3005
,
"渠道资方有效配置大于2条,请检查; bizChannel : % s"
);
CHANNEL_FUND_CONFIG_GREATER_THAN_TOW
(
3005
,
"渠道资方有效配置大于2条,请检查; bizChannel : % s"
),
HIT_FUND_BUT_AMOUNT_OR_TERM_IS_EMPTY
(
3006
,
"命中资方但额度或期数为空, 请检查!"
);
...
...
src/main/java/com/quantgroup/asset/distribution/service/asset/impl/AssetServiceImpl.java
View file @
579cfc65
...
...
@@ -225,27 +225,10 @@ public class AssetServiceImpl implements IAssetService{
if
(
"true"
.
equals
(
assetForm
.
getAuditResult
())
&&
(
StringUtils
.
isEmpty
(
assetForm
.
getAmount
())
||
StringUtils
.
isEmpty
(
assetForm
.
getTerm
())))
{
return
null
;
}
// 创建金融产品集,并初始化金额期数
JSONArray
financeProductArray
=
new
JSONArray
();
JSONObject
amountJSON
=
new
JSONObject
();
financeProductArray
.
add
(
amountJSON
);
amountJSON
.
put
(
"min"
,
assetForm
.
getAmount
());
amountJSON
.
put
(
"max"
,
assetForm
.
getAmount
());
JSONArray
termArray
=
new
JSONArray
();
amountJSON
.
put
(
"terms"
,
termArray
);
JSONObject
termJSON
=
new
JSONObject
();
termArray
.
add
(
termJSON
);
try
{
// 不能是string,否则资方那边会报错
termJSON
.
put
(
"term"
,
Integer
.
parseInt
(
assetForm
.
getTerm
()));
}
catch
(
Exception
e
)
{
termJSON
.
put
(
"term"
,
Double
.
parseDouble
(
assetForm
.
getTerm
()));
}
JSONArray
fundArray
=
new
JSONArray
();
termJSON
.
put
(
"fundInfo"
,
fundArray
);
FundModuleChannelFundConfig
config
=
fundModuleCHannelFundConfigService
.
findByBizChannel
(
assetForm
.
getBizChannel
());
QGPreconditions
.
checkArgument
(
config
!=
null
,
QGExceptionType
.
NOT_FOUNT_CHANNEL_FUNDS_INFO
,
assetForm
.
getBizChannel
());
JSONArray
fundArray
=
new
JSONArray
();
List
<
ChannelFundConfig
>
fundConfigList
=
JSONArray
.
parseArray
(
config
.
getFunds
(),
ChannelFundConfig
.
class
);
A
:
for
(
ChannelFundConfig
channelFundConfig
:
fundConfigList
)
{
List
<
ChannelFundConfig
.
Limit
>
limits
=
channelFundConfig
.
getLimits
();
...
...
@@ -290,7 +273,6 @@ public class AssetServiceImpl implements IAssetService{
return
null
;
}
QGPreconditions
.
checkArgument
(
fundArray
.
size
()
!=
0
,
QGExceptionType
.
NO_FUND_INFO_BEEN_HIT
,
assetForm
.
getBizChannel
(),
assetForm
.
getAmount
(),
assetForm
.
getTerm
());
// 看命中优先级是否符合要求
boolean
[]
bucket
=
new
boolean
[
fundArray
.
size
()
+
1
];
for
(
int
i
=
0
,
len
=
fundArray
.
size
();
i
<
len
;
i
++)
{
...
...
@@ -304,7 +286,7 @@ public class AssetServiceImpl implements IAssetService{
}
bucket
[
priority
]
=
true
;
}
String
hitFinanceProduct
=
JSON
.
toJSONString
(
financeProduct
Array
);
String
hitFinanceProduct
=
createFinancePro
(
assetForm
,
fund
Array
);
log
.
info
(
"资方模块组成金融产品集完成, uuid : {}, assetNo : {}, bizNo : {}, bizChannel : {}, financeProduct : {}"
,
assetForm
.
getUuid
(),
assetForm
.
getAssetNo
(),
assetForm
.
getBizNo
(),
assetForm
.
getBizChannel
(),
hitFinanceProduct
);
return
hitFinanceProduct
;
}
...
...
@@ -335,6 +317,36 @@ public class AssetServiceImpl implements IAssetService{
return
assetForm
;
}
/**
* 组建金融产品集
* @param assetForm
* @param fundArray
* @return
*/
private
String
createFinancePro
(
AssetForm
assetForm
,
JSONArray
fundArray
)
{
// 首先判断是否有额度期数
QGPreconditions
.
checkArgument
(
StringUtils
.
isNotEmpty
(
assetForm
.
getAmount
())
&&
StringUtils
.
isNotEmpty
(
assetForm
.
getTerm
()),
QGExceptionType
.
HIT_FUND_BUT_AMOUNT_OR_TERM_IS_EMPTY
);
JSONArray
financeProductArray
=
new
JSONArray
();
JSONObject
amountJSON
=
new
JSONObject
();
financeProductArray
.
add
(
amountJSON
);
amountJSON
.
put
(
"min"
,
assetForm
.
getAmount
());
amountJSON
.
put
(
"max"
,
assetForm
.
getAmount
());
JSONArray
termArray
=
new
JSONArray
();
amountJSON
.
put
(
"terms"
,
termArray
);
JSONObject
termJSON
=
new
JSONObject
();
termArray
.
add
(
termJSON
);
try
{
// 不能是string,否则资方那边会报错
termJSON
.
put
(
"term"
,
Integer
.
parseInt
(
assetForm
.
getTerm
()));
}
catch
(
Exception
e
)
{
termJSON
.
put
(
"term"
,
Double
.
parseDouble
(
assetForm
.
getTerm
()));
}
termJSON
.
put
(
"fundInfo"
,
fundArray
);
return
JSON
.
toJSONString
(
financeProductArray
);
}
/**
* 资方配置空跑
* @param testAssetForm
...
...
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