Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
slm-bi
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林锐标
slm-bi
Commits
e67dec12
Commit
e67dec12
authored
May 26, 2021
by
梁光意
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改不限过滤条件
parent
ad82269a
Pipeline
#9248
passed with stages
in 2 minutes 41 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
6 deletions
+39
-6
Condition.java
src/main/java/com/syc/slm/slmbi/enums/Condition.java
+13
-2
BusinessConfigServiceImpl.java
...syc/slm/slmbi/service/impl/BusinessConfigServiceImpl.java
+26
-4
No files found.
src/main/java/com/syc/slm/slmbi/enums/Condition.java
View file @
e67dec12
...
@@ -53,9 +53,20 @@ public enum Condition {
...
@@ -53,9 +53,20 @@ public enum Condition {
/**
/**
* nin
* nin
*/
*/
NO_INS
(
"no_ins"
);
NO_INS
(
"no_ins"
),
/**
* 不限
*/
NO_LIMIT
(
"no_limit"
);
private
String
value
;
private
String
value
;
Condition
(
String
v
)
{
Condition
(
String
v
)
{
this
.
value
=
v
;
this
.
value
=
v
;
}}
}
public
String
getValue
()
{
return
value
;
}
}
src/main/java/com/syc/slm/slmbi/service/impl/BusinessConfigServiceImpl.java
View file @
e67dec12
...
@@ -14,11 +14,13 @@ import com.syc.slm.common.core.constant.SlmConstants;
...
@@ -14,11 +14,13 @@ import com.syc.slm.common.core.constant.SlmConstants;
import
com.syc.slm.common.core.util.R
;
import
com.syc.slm.common.core.util.R
;
import
com.syc.slm.common.core.util.RestTemplateUtils
;
import
com.syc.slm.common.core.util.RestTemplateUtils
;
import
com.syc.slm.slmbi.dao.BusinessConfigMapper
;
import
com.syc.slm.slmbi.dao.BusinessConfigMapper
;
import
com.syc.slm.slmbi.dto.BusinessConditionDTO
;
import
com.syc.slm.slmbi.dto.BusinessDTO
;
import
com.syc.slm.slmbi.dto.BusinessDTO
;
import
com.syc.slm.slmbi.dto.BusinessStatisticsDTO
;
import
com.syc.slm.slmbi.dto.BusinessStatisticsDTO
;
import
com.syc.slm.slmbi.entity.BaseEntity
;
import
com.syc.slm.slmbi.entity.BaseEntity
;
import
com.syc.slm.slmbi.entity.BusinessConfig
;
import
com.syc.slm.slmbi.entity.BusinessConfig
;
import
com.syc.slm.slmbi.entity.CurrentUser
;
import
com.syc.slm.slmbi.entity.CurrentUser
;
import
com.syc.slm.slmbi.enums.Condition
;
import
com.syc.slm.slmbi.exception.SysException
;
import
com.syc.slm.slmbi.exception.SysException
;
import
com.syc.slm.slmbi.service.BusinessConfigService
;
import
com.syc.slm.slmbi.service.BusinessConfigService
;
import
com.syc.slm.slmbi.vo.BusinessConfigVo
;
import
com.syc.slm.slmbi.vo.BusinessConfigVo
;
...
@@ -28,8 +30,10 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -28,8 +30,10 @@ import org.springframework.transaction.annotation.Transactional;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.net.URLDecoder
;
import
java.net.URLDecoder
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.charset.StandardCharsets
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
/**
* slm-bi
* slm-bi
...
@@ -110,13 +114,13 @@ public class BusinessConfigServiceImpl extends ServiceImpl<BusinessConfigMapper,
...
@@ -110,13 +114,13 @@ public class BusinessConfigServiceImpl extends ServiceImpl<BusinessConfigMapper,
}
}
x
.
forEach
((
k
,
v
)->{
x
.
forEach
((
k
,
v
)->{
if
(
v
.
stream
().
anyMatch
(
y
->
StringUtils
.
isBlank
(
y
.
getKey
()))
if
(
v
.
stream
().
anyMatch
(
y
->
StringUtils
.
isBlank
(
y
.
getKey
()))
||
v
.
stream
().
anyMatch
(
y
->
ObjectUtils
.
isEmpty
(
y
.
getValue
()))
||
v
.
stream
().
filter
(
y
->
!
Condition
.
NO_LIMIT
.
getValue
().
equals
(
y
.
getQueryType
())).
anyMatch
(
y
->
ObjectUtils
.
isEmpty
(
y
.
getValue
()))
||
v
.
stream
().
anyMatch
(
y
->
StringUtils
.
isBlank
(
y
.
getQueryType
())))
{
||
v
.
stream
().
anyMatch
(
y
->
StringUtils
.
isBlank
(
y
.
getQueryType
())))
{
throw
new
SysException
(
"where 条件不能key value queryType 都不能为空"
);
throw
new
SysException
(
"where 条件不能key value queryType 都不能为空"
);
}
}
});
});
});
});
dto
.
setWhere
(
this
.
filterWhereNoLimit
(
dto
.
getWhere
()));
Map
<
String
,
String
>
uriVariables
=
Maps
.
newHashMap
();
Map
<
String
,
String
>
uriVariables
=
Maps
.
newHashMap
();
uriVariables
.
put
(
"appId"
,
user
.
getAppId
());
uriVariables
.
put
(
"appId"
,
user
.
getAppId
());
R
<
Map
<
String
,
List
<
Object
>>>
result
=
RestTemplateUtils
.
post
(
uri
,
null
,
dto
,
new
TypeToken
<
R
<
Map
<
String
,
List
<
Object
>>>>()
{}.
getType
(),
uriVariables
);
R
<
Map
<
String
,
List
<
Object
>>>
result
=
RestTemplateUtils
.
post
(
uri
,
null
,
dto
,
new
TypeToken
<
R
<
Map
<
String
,
List
<
Object
>>>>()
{}.
getType
(),
uriVariables
);
...
@@ -148,13 +152,13 @@ public class BusinessConfigServiceImpl extends ServiceImpl<BusinessConfigMapper,
...
@@ -148,13 +152,13 @@ public class BusinessConfigServiceImpl extends ServiceImpl<BusinessConfigMapper,
}
}
x
.
forEach
((
k
,
v
)->{
x
.
forEach
((
k
,
v
)->{
if
(
v
.
stream
().
anyMatch
(
y
->
StringUtils
.
isBlank
(
y
.
getKey
()))
if
(
v
.
stream
().
anyMatch
(
y
->
StringUtils
.
isBlank
(
y
.
getKey
()))
||
v
.
stream
().
anyMatch
(
y
->
ObjectUtils
.
isEmpty
(
y
.
getValue
()))
||
v
.
stream
().
filter
(
y
->
!
Condition
.
NO_LIMIT
.
getValue
().
equals
(
y
.
getQueryType
())).
anyMatch
(
y
->
ObjectUtils
.
isEmpty
(
y
.
getValue
()))
||
v
.
stream
().
anyMatch
(
y
->
StringUtils
.
isBlank
(
y
.
getQueryType
())))
{
||
v
.
stream
().
anyMatch
(
y
->
StringUtils
.
isBlank
(
y
.
getQueryType
())))
{
throw
new
SysException
(
"where 条件不能key value queryType 都不能为空"
);
throw
new
SysException
(
"where 条件不能key value queryType 都不能为空"
);
}
}
});
});
});
});
dto
.
setWhere
(
this
.
filterWhereNoLimit
(
dto
.
getWhere
()));
Map
<
String
,
String
>
uriVariables
=
Maps
.
newHashMap
();
Map
<
String
,
String
>
uriVariables
=
Maps
.
newHashMap
();
uriVariables
.
put
(
"appId"
,
user
.
getAppId
());
uriVariables
.
put
(
"appId"
,
user
.
getAppId
());
R
<
Map
<
String
,
Object
>>
result
=
RestTemplateUtils
.
post
(
uri
,
null
,
dto
,
new
TypeToken
<
R
<
Map
<
String
,
Object
>>>()
{}.
getType
(),
uriVariables
);
R
<
Map
<
String
,
Object
>>
result
=
RestTemplateUtils
.
post
(
uri
,
null
,
dto
,
new
TypeToken
<
R
<
Map
<
String
,
Object
>>>()
{}.
getType
(),
uriVariables
);
...
@@ -189,4 +193,22 @@ public class BusinessConfigServiceImpl extends ServiceImpl<BusinessConfigMapper,
...
@@ -189,4 +193,22 @@ public class BusinessConfigServiceImpl extends ServiceImpl<BusinessConfigMapper,
}
}
return
page
;
return
page
;
}
}
private
List
<
Map
<
String
,
List
<
BusinessConditionDTO
>>>
filterWhereNoLimit
(
List
<
Map
<
String
,
List
<
BusinessConditionDTO
>>>
where
){
List
<
Map
<
String
,
List
<
BusinessConditionDTO
>>>
resultList
=
Lists
.
newArrayList
();
where
.
forEach
(
map
->
{
Map
<
String
,
List
<
BusinessConditionDTO
>>
resultMap
=
Maps
.
newHashMap
();
map
.
forEach
((
key
,
value
)
->{
List
<
BusinessConditionDTO
>
dtoList
=
value
.
stream
().
filter
(
dto
->
!
Condition
.
NO_LIMIT
.
getValue
().
equals
(
dto
.
getQueryType
())).
collect
(
Collectors
.
toList
());
if
(
org
.
apache
.
commons
.
collections4
.
CollectionUtils
.
isNotEmpty
(
dtoList
)){
resultMap
.
put
(
key
,
dtoList
);
}
});
if
(!
resultMap
.
isEmpty
()){
resultList
.
add
(
resultMap
);
}
});
return
resultList
;
}
}
}
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