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
4cf24f88
Commit
4cf24f88
authored
Aug 18, 2020
by
zhangkb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改报表2算同比排名,同比单位数逻辑
parent
24ab1197
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
30 deletions
+53
-30
IndicatorsReportService.java
...le/indicators/service/report/IndicatorsReportService.java
+52
-29
CalculateUtils.java
...n/java/com/keymobile/indicators/utils/CalculateUtils.java
+1
-1
No files found.
src/main/java/com/keymobile/indicators/service/report/IndicatorsReportService.java
View file @
4cf24f88
...
@@ -310,7 +310,8 @@ public class IndicatorsReportService {
...
@@ -310,7 +310,8 @@ public class IndicatorsReportService {
indReportData
.
setBestUnitValue
(
calDatas
.
get
(
0
).
getValue
());
indReportData
.
setBestUnitValue
(
calDatas
.
get
(
0
).
getValue
());
//优于平均数单位数
//优于平均数单位数
if
(
StringUtils
.
isNotBlank
(
average
))
{
if
(
StringUtils
.
isNotBlank
(
average
))
{
indReportData
.
setBestAverageUnits
(
this
.
bestAverageUnits
(
average
,
calDatas
));
indReportData
.
setBestAverageUnits
(
this
.
bestAverageUnits
(
driveIndDef
.
getIndRule
(),
average
,
calDatas
));
}
}
//同比提升单位
//同比提升单位
Map
<
String
,
Object
>
sameImproveResult
=
this
.
sameImproveUnits
(
indId
,
date
,
compareObjs
,
Map
<
String
,
Object
>
sameImproveResult
=
this
.
sameImproveUnits
(
indId
,
date
,
compareObjs
,
...
@@ -340,7 +341,7 @@ public class IndicatorsReportService {
...
@@ -340,7 +341,7 @@ public class IndicatorsReportService {
indReportData
.
setSameImproveHeadThreeDesc
(
sameImproveHeadThreeDesc
.
toString
());
indReportData
.
setSameImproveHeadThreeDesc
(
sameImproveHeadThreeDesc
.
toString
());
start
=
0
;
start
=
0
;
//同比提升末三
//同比提升末三
StringBuilder
sameImproveAfterThree
=
new
StringBuilder
(
""
);
//同比提升
前
三
StringBuilder
sameImproveAfterThree
=
new
StringBuilder
(
""
);
//同比提升
末
三
StringBuilder
sameImproveAfterThreeDesc
=
new
StringBuilder
(
""
);
//
StringBuilder
sameImproveAfterThreeDesc
=
new
StringBuilder
(
""
);
//
resultRank
=
CalculateUtils
.
sortMapByValue
(
resultRank
,
1
);
//按照value从大到小排序
resultRank
=
CalculateUtils
.
sortMapByValue
(
resultRank
,
1
);
//按照value从大到小排序
//根据省对市地区顺序排列排名并列的情况
//根据省对市地区顺序排列排名并列的情况
...
@@ -420,36 +421,51 @@ public class IndicatorsReportService {
...
@@ -420,36 +421,51 @@ public class IndicatorsReportService {
Integer
improveNum
=
0
;
//单位提升数
Integer
improveNum
=
0
;
//单位提升数
Map
<
String
,
Integer
>
resultRank
=
new
HashMap
<>();
Map
<
String
,
Integer
>
resultRank
=
new
HashMap
<>();
//查找同期考核结果
//根据指标id获取指标详情
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
DriveIndDef
driveIndDef
=
driveIndDefMapper
.
selectByPrimaryKey
(
indId
);
paramMap
.
put
(
"indId"
,
indId
);
if
(
driveIndDef
!=
null
)
{
paramMap
.
put
(
"date"
,
(
date
-
100
));
String
indRule
=
driveIndDef
.
getIndRule
();
paramMap
.
put
(
"compareObjs"
,
compareObjs
);
//查找同期考核结果
List
<
DriveIndCalResultDef
>
sameCalDatas
=
driveIndCalResultDefMapper
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
.
findByIndIdAndDateAndCompareObjIn
(
paramMap
);
paramMap
.
put
(
"indId"
,
indId
);
if
(!
sameCalDatas
.
isEmpty
())
{
paramMap
.
put
(
"date"
,
(
date
-
100
));
Map
<
String
,
String
>
rankMap
=
new
HashMap
<>();
paramMap
.
put
(
"compareObjs"
,
compareObjs
);
for
(
DriveIndCalResultDef
currentCalData
:
currentCalDatas
)
{
List
<
DriveIndCalResultDef
>
sameCalDatas
=
driveIndCalResultDefMapper
for
(
DriveIndCalResultDef
sameCalData
:
sameCalDatas
)
{
.
findByIndIdAndDateAndCompareObjIn
(
paramMap
);
if
(
sameCalData
.
getCompareObj
().
equals
(
currentCalData
.
getCompareObj
())
if
(!
sameCalDatas
.
isEmpty
())
{
&&
!
"NaN"
.
equals
(
sameCalData
.
getValue
())
Map
<
String
,
String
>
rankMap
=
new
HashMap
<>();
&&!
"Infinite"
.
equals
(
sameCalData
.
getValue
())
for
(
DriveIndCalResultDef
currentCalData
:
currentCalDatas
)
{
&&
!
"NaN"
.
equals
(
currentCalData
.
getValue
())
for
(
DriveIndCalResultDef
sameCalData
:
sameCalDatas
)
{
&&!
"Infinite"
.
equals
(
currentCalData
.
getValue
()))
{
if
(
sameCalData
.
getCompareObj
().
equals
(
currentCalData
.
getCompareObj
())
//如果本次考核结果排位和同期考核结果配位都存在
&&
!
"NaN"
.
equals
(
sameCalData
.
getValue
())
if
(
currentCalData
.
getRank
()!=
null
&&
sameCalData
.
getRank
()!=
null
)
{
&&
!
"Infinite"
.
equals
(
sameCalData
.
getValue
())
&&
StringUtils
.
isNotBlank
(
sameCalData
.
getValue
())
&&
!
"NaN"
.
equals
(
currentCalData
.
getValue
())
&&
!
"Infinite"
.
equals
(
currentCalData
.
getValue
())
&&
StringUtils
.
isNotBlank
(
currentCalData
.
getValue
()))
{
//同比提升单位指本期与同期值相比要好的单位(考虑指标的正反向)
rankMap
.
put
(
currentCalData
.
getCompareObj
(),
rankMap
.
put
(
currentCalData
.
getCompareObj
(),
String
.
valueOf
((
currentCalData
.
getRank
()-
sameCalData
.
getRank
())));
String
.
valueOf
(
Double
.
parseDouble
(
currentCalData
.
getValue
())-
if
((
currentCalData
.
getRank
()-
sameCalData
.
getRank
())>
0
)
{
Double
.
parseDouble
(
sameCalData
.
getValue
())));
improveNum
+=
1
;
//如果是正向指标
if
(
"0"
.
equals
(
indRule
))
{
if
(
Double
.
parseDouble
(
currentCalData
.
getValue
())-
Double
.
parseDouble
(
sameCalData
.
getValue
())>
0
)
{
improveNum
+=
1
;
}
}
else
{
//反向
if
(
Double
.
parseDouble
(
currentCalData
.
getValue
())-
Double
.
parseDouble
(
sameCalData
.
getValue
())<
0
)
{
improveNum
+=
1
;
}
}
}
break
;
}
}
break
;
}
}
}
}
resultRank
=
CalculateUtils
.
rankValue
(
rankMap
,
indRule
);
resultRank
=
CalculateUtils
.
sortMapByValue
(
resultRank
,
0
);
//按照value从小到大排序
}
}
resultRank
=
CalculateUtils
.
rankValue
(
rankMap
,
"0"
);
resultRank
=
CalculateUtils
.
sortMapByValue
(
resultRank
,
0
);
//按照value从小到大排序
}
}
result
.
put
(
"improveNum"
,
improveNum
);
result
.
put
(
"improveNum"
,
improveNum
);
result
.
put
(
"resultRank"
,
resultRank
);
result
.
put
(
"resultRank"
,
resultRank
);
...
@@ -457,13 +473,20 @@ public class IndicatorsReportService {
...
@@ -457,13 +473,20 @@ public class IndicatorsReportService {
}
}
//统计优于平均数量
//统计优于平均数量
private
Integer
bestAverageUnits
(
String
average
,
List
<
DriveIndCalResultDef
>
calDatas
)
{
private
Integer
bestAverageUnits
(
String
indRule
,
String
average
,
List
<
DriveIndCalResultDef
>
calDatas
)
{
Integer
result
=
0
;
Integer
result
=
0
;
for
(
DriveIndCalResultDef
calData
:
calDatas
)
{
for
(
DriveIndCalResultDef
calData
:
calDatas
)
{
if
(
StringUtils
.
isNotBlank
(
calData
.
getValue
())
&&
!
"NaN"
.
equals
(
calData
.
getValue
())
if
(
StringUtils
.
isNotBlank
(
calData
.
getValue
())
&&
!
"NaN"
.
equals
(
calData
.
getValue
())
&&
!
"Infinite"
.
equals
(
calData
.
getValue
()))
{
&&
!
"Infinite"
.
equals
(
calData
.
getValue
()))
{
if
(
Double
.
parseDouble
(
calData
.
getValue
())>
Double
.
parseDouble
(
average
))
{
//如果是正向指标
result
+=
1
;
if
(
"0"
.
equals
(
indRule
))
{
if
(
Double
.
parseDouble
(
calData
.
getValue
())>
Double
.
parseDouble
(
average
))
{
result
+=
1
;
}
}
else
{
//反向指标
if
(
Double
.
parseDouble
(
calData
.
getValue
())<
Double
.
parseDouble
(
average
))
{
result
+=
1
;
}
}
}
}
}
}
}
...
...
src/main/java/com/keymobile/indicators/utils/CalculateUtils.java
View file @
4cf24f88
...
@@ -195,7 +195,7 @@ public class CalculateUtils {
...
@@ -195,7 +195,7 @@ public class CalculateUtils {
public
static
Map
<
String
,
Object
>
rankByObjSort
(
Map
<
String
,
Integer
>
rankMap
,
Map
<
String
,
Integer
>
objSort
){
public
static
Map
<
String
,
Object
>
rankByObjSort
(
Map
<
String
,
Integer
>
rankMap
,
Map
<
String
,
Integer
>
objSort
){
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
//排名分类
//排名分类
Map
<
Integer
,
List
<
String
>>
rankClassifyMap
=
new
HashMap
<>();
Map
<
Integer
,
List
<
String
>>
rankClassifyMap
=
new
LinkedHashMap
<>();
//修改为插入顺序的map
int
rankNum
=
3
;
int
rankNum
=
3
;
for
(
Map
.
Entry
<
String
,
Integer
>
map
:
rankMap
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
Integer
>
map
:
rankMap
.
entrySet
())
{
if
(
objSort
.
get
(
map
.
getKey
())==
null
)
{
if
(
objSort
.
get
(
map
.
getKey
())==
null
)
{
...
...
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