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
8bff8218
Commit
8bff8218
authored
Apr 07, 2020
by
郑建
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
6.6-2
parent
af94c28d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
156 deletions
+2
-156
FundModuleServiceImpl.java
...tribution/service/funding/impl/FundModuleServiceImpl.java
+2
-20
Range.java
...uantgroup/asset/distribution/util/ruleRelation/Range.java
+0
-38
SetRelationUtil.java
...asset/distribution/util/ruleRelation/SetRelationUtil.java
+0
-98
No files found.
src/main/java/com/quantgroup/asset/distribution/service/funding/impl/FundModuleServiceImpl.java
View file @
8bff8218
...
@@ -270,7 +270,6 @@ public class FundModuleServiceImpl implements IFundModuleService{
...
@@ -270,7 +270,6 @@ public class FundModuleServiceImpl implements IFundModuleService{
Set
<
String
>
fundSet
=
new
HashSet
<>();
Set
<
String
>
fundSet
=
new
HashSet
<>();
JSONArray
fundArray
=
new
JSONArray
();
JSONArray
fundArray
=
new
JSONArray
();
List
<
String
>
fundIds
=
new
ArrayList
<>();
List
<
String
>
fundIds
=
new
ArrayList
<>();
Map
<
String
,
String
>
fundIdToTranslateMap
=
new
HashMap
<>();
A:
for
(
ChannelFundConfigNew
channelFundConfig
:
fundConfigList
)
{
A:
for
(
ChannelFundConfigNew
channelFundConfig
:
fundConfigList
)
{
IRuleVO
ruleVO
=
ruleService
.
getIRuleVo
(
channelFundConfig
.
getLimits
());
IRuleVO
ruleVO
=
ruleService
.
getIRuleVo
(
channelFundConfig
.
getLimits
());
if
(
ruleVO
==
null
)
{
throw
new
QGException
(
QGExceptionType
.
CRATE_RULE_VO_ERROR
);
}
if
(
ruleVO
==
null
)
{
throw
new
QGException
(
QGExceptionType
.
CRATE_RULE_VO_ERROR
);
}
...
@@ -327,11 +326,8 @@ public class FundModuleServiceImpl implements IFundModuleService{
...
@@ -327,11 +326,8 @@ public class FundModuleServiceImpl implements IFundModuleService{
boolean
hasSameResultTotal
=
false
;
boolean
hasSameResultTotal
=
false
;
for
(
String
id
:
fundIds
){
for
(
String
id
:
fundIds
){
if
(
bag
.
getCount
(
id
)
>
1
){
if
(
bag
.
getCount
(
id
)
>
1
){
boolean
hasSameResult
=
hasSameResult
(
configId
,
id
);
hasSameResultTotal
=
true
;
if
(
hasSameResult
){
break
;
hasSameResultTotal
=
true
;
break
;
}
}
}
}
}
if
(
hasSameResultTotal
){
if
(
hasSameResultTotal
){
...
@@ -352,20 +348,6 @@ public class FundModuleServiceImpl implements IFundModuleService{
...
@@ -352,20 +348,6 @@ public class FundModuleServiceImpl implements IFundModuleService{
return
GlobalResponse
.
success
(
vo
);
return
GlobalResponse
.
success
(
vo
);
}
}
private
boolean
hasSameResult
(
Long
configId
,
String
fundId
){
List
<
BaseRuleVO
>
ruleVOS
=
new
ArrayList
<>();
FundModuleChannelFundConfigNew
config
=
fundModuleChannelFundConfigNewService
.
findById
(
configId
);
List
<
ChannelFundConfigNew
>
fundConfigList
=
JSONArray
.
parseArray
(
config
.
getFunds
(),
ChannelFundConfigNew
.
class
);
for
(
ChannelFundConfigNew
channelFundConfig
:
fundConfigList
){
if
(
fundId
.
equals
(
channelFundConfig
.
getFundId
().
toString
())){
IRuleVO
ruleVO
=
ruleService
.
getIRuleVo
(
channelFundConfig
.
getLimits
());
ruleVOS
.
addAll
(
getAllBaseRule
(
ruleVO
));
}
}
//对多个rule求交集
return
false
;
}
private
static
List
<
BaseRuleVO
>
getAllBaseRule
(
IRuleVO
ruleVO
){
private
static
List
<
BaseRuleVO
>
getAllBaseRule
(
IRuleVO
ruleVO
){
List
<
BaseRuleVO
>
baseRuleList
=
new
ArrayList
<>();
List
<
BaseRuleVO
>
baseRuleList
=
new
ArrayList
<>();
if
(
ruleVO
.
getClass
().
isAssignableFrom
(
UnionRuleVO
.
class
)){
if
(
ruleVO
.
getClass
().
isAssignableFrom
(
UnionRuleVO
.
class
)){
...
...
src/main/java/com/quantgroup/asset/distribution/util/ruleRelation/Range.java
deleted
100644 → 0
View file @
af94c28d
package
com
.
quantgroup
.
asset
.
distribution
.
util
.
ruleRelation
;
import
lombok.Data
;
import
java.util.List
;
/**
* @author jian.zheng
*/
public
class
Range
<
T
>
{
private
RangeType
rangeType
;
private
List
<
T
>
items
;
private
Aggregation
aggregation
;
/**
* @author jian.zheng
*/
public
enum
RangeType
{
/**
* 数字
*/
NUMERIC
,
/**
* 数组
*/
ARRAY
;
}
@Data
public
static
class
Aggregation
{
private
Number
start
;
private
boolean
startClosed
;
private
Number
end
;
private
boolean
endClosed
;
}
}
src/main/java/com/quantgroup/asset/distribution/util/ruleRelation/SetRelationUtil.java
deleted
100644 → 0
View file @
af94c28d
package
com
.
quantgroup
.
asset
.
distribution
.
util
.
ruleRelation
;
import
com.quantgroup.asset.distribution.enums.RuleOperator
;
import
com.quantgroup.asset.distribution.exception.QGException
;
import
com.quantgroup.asset.distribution.exception.QGExceptionType
;
import
org.apache.commons.lang3.RandomUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.util.Arrays
;
import
java.util.List
;
public
class
SetRelationUtil
{
public
static
<
T
>
Range
<
T
>
getRange
(
String
operator
,
String
value
){
Class
<?>
clazz
=
getType
(
value
);
return
null
;
}
private
static
String
getValue
(
String
operator
,
String
value
){
Class
<?>
clazz
=
getType
(
value
);
switch
(
RuleOperator
.
fromCode
(
operator
))
{
case
Equal:
return
value
;
case
NotEqual:
if
(
clazz
.
isAssignableFrom
(
BigDecimal
.
class
))
{
return
new
BigDecimal
(
value
).
add
(
new
BigDecimal
(
1
)).
toString
();
}
else
if
(
clazz
.
isAssignableFrom
(
Boolean
.
class
)){
return
Boolean
.
toString
(!
Boolean
.
valueOf
(
value
));
}
else
{
if
(
value
.
length
()
==
1
){
return
String
.
valueOf
((
char
)
(
value
.
charAt
(
0
)
+
1
));
}
else
{
return
value
.
substring
(
0
,
value
.
length
()
-
1
)
+
String
.
valueOf
((
char
)
(
value
.
charAt
(
value
.
length
()
-
1
)
+
1
));
}
}
case
In:
if
(
value
.
contains
(
","
)){
List
<
String
>
list
=
Arrays
.
asList
(
value
.
split
(
","
));
return
list
.
get
(
RandomUtils
.
nextInt
(
0
,
list
.
size
()-
1
));
}
else
{
return
value
;
}
case
NotIn:
if
(
value
.
contains
(
","
)){
List
<
String
>
list
=
Arrays
.
asList
(
value
.
split
(
","
));
if
(
BigDecimal
.
class
.
isAssignableFrom
(
list
.
get
(
0
).
getClass
())){
Integer
num
=
1
;
while
(
list
.
contains
(
String
.
valueOf
(
num
))){
num
++;
}
return
num
.
toString
();
}
else
{
String
start
=
getValue
(
operator
,
list
.
get
(
0
));
while
(
list
.
contains
(
start
)){
start
=
getValue
(
operator
,
start
);
}
return
start
;
}
}
else
{
return
value
;
}
case
LessThan:
if
(
BigDecimal
.
class
.
isAssignableFrom
(
clazz
)){
if
(
new
BigDecimal
(
value
).
doubleValue
()
<
1
&&
new
BigDecimal
(
value
).
doubleValue
()
>
0
){
return
new
BigDecimal
(
value
).
divide
(
new
BigDecimal
(
10
),
value
.
split
(
"."
)[
1
].
length
(),
RoundingMode
.
HALF_UP
).
toString
();
}
else
{
return
new
BigDecimal
(
value
).
subtract
(
new
BigDecimal
(
1
)).
toString
();
}
}
else
{
throw
new
QGException
(
QGExceptionType
.
CRATE_RULE_VO_ERROR
);
}
case
GreaterThan:
if
(
BigDecimal
.
class
.
isAssignableFrom
(
clazz
)){
return
new
BigDecimal
(
value
).
add
(
new
BigDecimal
(
1
)).
toString
();
}
else
{
throw
new
QGException
(
QGExceptionType
.
CRATE_RULE_VO_ERROR
);
}
case
LessThanOrEqual:
return
getValue
(
"<"
,
value
);
case
GreaterThanOrEqual:
return
getValue
(
">"
,
value
);
default
:
throw
new
QGException
(
QGExceptionType
.
RULE_OPERATOR_NOT_EXIST
);
}
}
private
static
Class
<?>
getType
(
String
value
){
if
(
StringUtils
.
isNumeric
(
value
)){
return
BigDecimal
.
class
;
}
if
(
"true"
.
equals
(
value
)
||
"false"
.
equals
(
value
)){
return
Boolean
.
class
;
}
return
String
.
class
;
}
}
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