Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
indicators
Overview
Overview
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
zhangkb
indicators
Commits
a2822fac
Commit
a2822fac
authored
Jun 17, 2020
by
zhangkb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加根据给定的指标和短板筛选规则筛选短板单位接口
parent
54bcf8d3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
2 deletions
+49
-2
ShortboardRuleCtrl.java
...eymobile/indicators/api/hytobacco/ShortboardRuleCtrl.java
+8
-1
ShortboardRuleService.java
...e/indicators/service/hytobacco/ShortboardRuleService.java
+41
-1
No files found.
src/main/java/com/keymobile/indicators/api/hytobacco/ShortboardRuleCtrl.java
View file @
a2822fac
...
...
@@ -74,10 +74,17 @@ public class ShortboardRuleCtrl {
return
shortboardRuleService
.
getById
(
id
);
}
@ApiOperation
(
value
=
"根据
短板规则筛选短板单位"
,
notes
=
"根据
短板规则筛选短板单位"
)
@ApiOperation
(
value
=
"根据
指标关联的短板规则筛选短板单位"
,
notes
=
"根据指标关联的
短板规则筛选短板单位"
)
@PostMapping
(
value
=
"/getShortboardObj"
)
public
List
<
Map
<
String
,
Object
>>
getObjShortboard
(
@RequestParam
String
compareId
,
@RequestParam
int
date
,
@RequestParam
List
<
String
>
compareObjs
,
@RequestParam
List
<
String
>
driveIds
)
throws
Exception
{
return
shortboardRuleService
.
getObjShortboard
(
compareId
,
date
,
compareObjs
,
driveIds
);
}
@ApiOperation
(
value
=
"根据给定的短板规则筛选短板单位"
,
notes
=
"根据给定的短板规则筛选短板单位"
)
@PostMapping
(
value
=
"/getObjFromShortboardRule"
)
public
List
<
Map
<
String
,
Object
>>
getObjFromShortboardRule
(
@RequestParam
int
date
,
@RequestParam
List
<
String
>
compareObjs
,
@RequestParam
List
<
String
>
driveIds
,
@RequestParam
List
<
Integer
>
shortboardRuleIds
)
throws
Exception
{
return
shortboardRuleService
.
getObjFromShortboardRule
(
date
,
compareObjs
,
driveIds
,
shortboardRuleIds
);
}
}
src/main/java/com/keymobile/indicators/service/hytobacco/ShortboardRuleService.java
View file @
a2822fac
...
...
@@ -75,7 +75,47 @@ public class ShortboardRuleService {
return
null
;
}
//根据短板规则筛选短板单位
//根据给定的短板规则筛选短板单位
public
List
<
Map
<
String
,
Object
>>
getObjFromShortboardRule
(
int
date
,
List
<
String
>
compareObjs
,
List
<
String
>
driveIds
,
List
<
Integer
>
shortboardRuleIds
)
throws
Exception
{
List
<
Map
<
String
,
Object
>>
result
=
new
ArrayList
<>();
Gson
gson
=
new
Gson
();
int
status
=
0
;
List
<
DriveIndCalResultDef
>
compareCalResults
=
new
ArrayList
<>();
for
(
String
driveId
:
driveIds
)
{
List
<
Integer
>
shortboardRuleIdList
=
new
ArrayList
<>();
//保存短板筛选规则id
for
(
Integer
sbRuleId
:
shortboardRuleIds
)
{
ShortboardRule
shortboardRule
=
this
.
getById
(
sbRuleId
);
if
(
shortboardRule
!=
null
)
{
shortboardRuleIdList
.
add
(
shortboardRule
.
getId
());
if
(
StringUtils
.
isNotBlank
(
shortboardRule
.
getShortboardItemJson
()))
{
List
<
ShortboardItem
>
shortboardItems
=
gson
.
fromJson
(
shortboardRule
.
getShortboardItemJson
(),
new
TypeToken
<
List
<
ShortboardItem
>>(){}.
getType
());
for
(
ShortboardItem
shortboardItem
:
shortboardItems
)
{
List
<
DriveIndCalResultDef
>
driveIndCalResults
=
this
.
selectShortboardObj
(
shortboardItem
,
compareObjs
,
driveId
,
date
);
if
(
status
==
0
)
{
compareCalResults
.
addAll
(
driveIndCalResults
);
status
=
1
;
}
else
{
//求交集
compareCalResults
.
retainAll
(
driveIndCalResults
);
}
}
}
}
}
if
(!
compareCalResults
.
isEmpty
())
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"driveId"
,
driveId
);
map
.
put
(
"shortboardRuleId"
,
shortboardRuleIdList
);
map
.
put
(
"compareCalResults"
,
compareCalResults
);
result
.
add
(
map
);
}
}
return
result
;
}
//根据指标关联的短板规则筛选短板单位
public
List
<
Map
<
String
,
Object
>>
getObjShortboard
(
String
compareId
,
int
date
,
List
<
String
>
compareObjs
,
List
<
String
>
driveIds
)
throws
Exception
{
List
<
Map
<
String
,
Object
>>
result
=
new
ArrayList
<>();
...
...
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